From nobody Thu Mar 30 03:07:46 2023 X-Original-To: dev-commits-src-branches@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 4Pn7db0qwGz42JpJ; 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 4Pn7dZ2DlSz3N1J; Thu, 30 Mar 2023 03:07:46 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1680145666; 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=8v1dqga6G3oYgr+/92eylGLfLlDxIrEFqABxO4WEjqA=; b=kTsLWj6eCG/3ZGfziqM0V3vw3+uG5vLncouAPynec5uLxMw6BmTTEejXDiAb22IjqyA7U8 iZuf9l2wGP3ek5P6NoO5Y+QlVTKWu17KiqDej83SvREJVCvzeLKzp17+3sAvJHtRz2MV/r 0VnR+m1l61f3yGsMmcbJ/2cyKw3uDPT7Dnvl5vgDZa8Uew6xHDAJhg+YvKq8SB04N0uw5M evyVJtrN7VSrTFvxXosJT4Lm/1S8zCmYYP9XcjrFDo4O7TKdem/k7tGxxos5kRLtTuzNnf 1or0KSfGYpf1wXd4b2UC19CUuUlhoU13NWGJ8pK5X1kk09CJrgEp5x05OmFzSg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1680145666; 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=8v1dqga6G3oYgr+/92eylGLfLlDxIrEFqABxO4WEjqA=; b=dTdxYWeehCPK6jHbJqVPn8LCavzrDOswrwGSPRT2sknC+p8ez6yBhdLEulkGiqh+v/In63 PgidqCLiW876bujiGTCWyJd4nl4ZG/gfvI+0bB2krNZenlSkCB6wGgye3e/99r94G34TCM dpTjU5bb/X4PX9MKTx9h4cOQhRy8r/V1O1kLfBqVgAPI5ID2EmuoxztXHWtsnnNQ4NRdzQ SwNJiwC0peyfY5aKv5NzXN1SsGbB42mvhetE1tVJkyGlXovJArkFkBgb3LViBgXdwT92BA XEn5/Mh8W4hCc5tenzD7rF8Qa0eA5abwyeCwW7XW8OrocAVZ2II+mDy7M69CVw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1680145666; a=rsa-sha256; cv=none; b=rcCaswFXAH+TILz2A0FHgw+k3L74kY8MwVtHLfQ/0QmdQfY9KrCF6q3kxuB3fqstnfVxhr ++DuMJqloPThy5SgDU5tSDRhnZfOWPej/gZJj/75aXI3afWrobLlp3FATMSPbI96uuhVlD GLtZH10M9ulWW3/pYZfrZBONGYlPn0KwdYgllaIt+w21Yc4Y/1D2zVv5Pc+9sztfDLaX8W DVS2H1YyUmRX3XeVuiVLpUF3HQGInZxqITIi7YS/rmU0jbInCdkcCK+1xHoB4X7uJY8QGB uIFdCI9HpGY6j0Lr2hFJXYAxzpyhBLe1TIO0n8Qa9MtCZxgLUV99zGiOq32PBQ== 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 4Pn7dZ1KwZzwGj; Thu, 30 Mar 2023 03:07:46 +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 32U37kP8046518; Thu, 30 Mar 2023 03:07:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32U37kb1046517; Thu, 30 Mar 2023 03:07:46 GMT (envelope-from git) Date: Thu, 30 Mar 2023 03:07:46 GMT Message-Id: <202303300307.32U37kb1046517@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: 8d636e4d6937 - stable/12 - pf: remove pd_refs from pfsync List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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/12 X-Git-Reftype: branch X-Git-Commit: 8d636e4d6937b36cd6f1c45f057c672c855571cc Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=8d636e4d6937b36cd6f1c45f057c672c855571cc commit 8d636e4d6937b36cd6f1c45f057c672c855571cc Author: Kristof Provost AuthorDate: 2023-03-24 06:04:56 +0000 Commit: Kristof Provost CommitDate: 2023-03-30 00:23:31 +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 30cac5717df5..648e2bd36f34 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); @@ -1784,7 +1781,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; @@ -1834,20 +1830,20 @@ 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; } 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);