From nobody Thu Mar 30 03:07:45 2023 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Pn7db15FVz42JhY; Thu, 30 Mar 2023 03:07:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Pn7dY6gpTz3ND9; Thu, 30 Mar 2023 03:07:45 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1680145665; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=gD8NTxcxm16PB0p8T1sqNvFDBVRw8fH5vXWuhyhvEd8=; b=P98URLIQzQS9sdQAC6EaVYdspd/R5b3DaC1Uq5cyXB0IqIQnpcnLXSq7hqxdOj3KuRr9e/ d9xE8ZlSwXl/v0LnajQ3OO7D3h6HxVrm+fxnxusEGxoaVwmWQ+22f8U7UYKOwelukupdwd I6wNoiRLCAe/2kfAlRFyVeyj0hVJHk8DDCp3KhMmc/GtC/koxz5+dhvxB4FuzodxkAkQOh 9RsgRs+9v5A+tzrSuYMDM9GVDjJIZu+7z7XxacZahTCoEB5x9GIjZ9CabFNMjawhhicwA8 15pmBOUeJMwh6BCK9rdwcV4l3z2hurmmUP6Czl/QMRiiia4gUP/C/zVS48nzmQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1680145665; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=gD8NTxcxm16PB0p8T1sqNvFDBVRw8fH5vXWuhyhvEd8=; b=kp7csMxB2rX195SoJbe8lxR0spv0NjmfaG/JIo3Ucpo5vwNXKtt6iUmauzygfN0gyeCRlI XVMqzH1LQNHu4MHY3baTAfvgTsGX4rN/dYKzfh9c1Lksn7t5068XcJb9W0AMWjQyrNTlTU hYLztlC5UzSiGY6nfhhPh4xFT955L1Yamcj9T2GQ6jfDBM30JRM8/gymmDMSug1Syul5Nr gmq6a6v/cpTt708o5ptBGlSbW5/OG+OdSEDVpKauz7+wmn+Jf4aYYL8twI4cGm2V+qJtcY IoPIIt9P6v27de7dXGLUbrgfnqjTwtxInQKUBaovXBfIfsf5pWSrF5Sx4rI6fA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1680145665; a=rsa-sha256; cv=none; b=cOGXN3t6etnc/1QoKq+Gu0tS+k0jnbFOO2ameGA2HUjsXvRpIbTTthnRk8+OzayifcXnwm eQ1JmhJO6SWdyAxWMqtqqDlQdr96659o1RiJLA4ZoWwXghmbw+ficUoBAIo6nIIs3ViLQB K6+kDaBc9WcKRHHehAwNqwcciJ4keMiWuIh5OyD5T49nCizRG36jXG+7wVAMcnGw1Ozy7U nX8MOOzDq4fB5Z9g9g6gy0UywBZS/ybZIQhc0jXuUNdxR7wsVcDHVr4wjh9WRj7fKbGlrd MTJ6M913WFe0pr8xe66W68nLMAzIemvMi1KilV6lyRaIlEHzlInepgRBAj1M+A== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Pn7dY5nBtzvf7; Thu, 30 Mar 2023 03:07:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 32U37jXD046498; Thu, 30 Mar 2023 03:07:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32U37jgp046497; Thu, 30 Mar 2023 03:07:45 GMT (envelope-from git) Date: Thu, 30 Mar 2023 03:07:45 GMT Message-Id: <202303300307.32U37jgp046497@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 8d261cd2d38f - stable/13 - pf: remove pd_refs from pfsync List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 8d261cd2d38fb1cbf4ba5450fafa92f85f64eb82 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=8d261cd2d38fb1cbf4ba5450fafa92f85f64eb82 commit 8d261cd2d38fb1cbf4ba5450fafa92f85f64eb82 Author: Kristof Provost AuthorDate: 2023-03-24 06:04:56 +0000 Commit: Kristof Provost CommitDate: 2023-03-30 00:23:30 +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 (cherry picked from commit 27b23cdec9d1255e014ea0decac42a5be8d00735) --- 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 a05fd85423ee..b05e1ae9550a 100644 --- a/sys/netpfil/pf/if_pfsync.c +++ b/sys/netpfil/pf/if_pfsync.c @@ -184,7 +184,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; @@ -414,10 +413,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); @@ -1782,7 +1779,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; @@ -1833,21 +1829,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);