git: 27b23cdec9d1 - main - pf: remove pd_refs from pfsync
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 28 Mar 2023 01:18:33 UTC
The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=27b23cdec9d1255e014ea0decac42a5be8d00735 commit 27b23cdec9d1255e014ea0decac42a5be8d00735 Author: Kristof Provost <kp@FreeBSD.org> AuthorDate: 2023-03-24 06:04:56 +0000 Commit: Kristof Provost <kp@FreeBSD.org> CommitDate: 2023-03-27 23:18:07 +0000 pf: remove pd_refs from pfsync It only served to complicate cleanup, and added no value. While here drop packets in pfsync_defer_tmo() if we don't have a syncif, rather than just leaving them on the queue. Reviewed by: markj Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D39248 --- sys/netpfil/pf/if_pfsync.c | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/sys/netpfil/pf/if_pfsync.c b/sys/netpfil/pf/if_pfsync.c index 4e4bbc9bc8b7..c9d214d73470 100644 --- a/sys/netpfil/pf/if_pfsync.c +++ b/sys/netpfil/pf/if_pfsync.c @@ -185,7 +185,6 @@ struct pfsync_upd_req_item { struct pfsync_deferral { struct pfsync_softc *pd_sc; TAILQ_ENTRY(pfsync_deferral) pd_entry; - u_int pd_refs; struct callout pd_tmo; struct pf_kstate *pd_st; @@ -421,10 +420,8 @@ pfsync_clone_destroy(struct ifnet *ifp) if (ret > 0) { pfsync_undefer(pd, 1); } else { - pd->pd_refs++; callout_drain(&pd->pd_tmo); } - free(pd, M_PFSYNC); PFSYNC_BUCKET_LOCK(b); } MPASS(b->b_deferred == 0); @@ -1780,7 +1777,6 @@ pfsync_defer(struct pf_kstate *st, struct mbuf *m) st->state_flags |= PFSTATE_ACK; pd->pd_sc = sc; - pd->pd_refs = 0; pd->pd_st = st; pf_ref_state(st); pd->pd_m = m; @@ -1831,21 +1827,21 @@ pfsync_defer_tmo(void *arg) PFSYNC_BUCKET_LOCK_ASSERT(b); + TAILQ_REMOVE(&b->b_deferrals, pd, pd_entry); + b->b_deferred--; + pd->pd_st->state_flags &= ~PFSTATE_ACK; /* XXX: locking! */ + PFSYNC_BUCKET_UNLOCK(b); + free(pd, M_PFSYNC); + if (sc->sc_sync_if == NULL) { - PFSYNC_BUCKET_UNLOCK(b); + pf_release_state(st); + m_freem(m); return; } NET_EPOCH_ENTER(et); CURVNET_SET(sc->sc_sync_if->if_vnet); - TAILQ_REMOVE(&b->b_deferrals, pd, pd_entry); - b->b_deferred--; - pd->pd_st->state_flags &= ~PFSTATE_ACK; /* XXX: locking! */ - if (pd->pd_refs == 0) - free(pd, M_PFSYNC); - PFSYNC_BUCKET_UNLOCK(b); - pfsync_tx(sc, m); pf_release_state(st);