Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 13 Dec 2021 13:50:36 GMT
From:      Kristof Provost <kp@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 912a0f7fabfa - stable/13 - pfsync: fix defer timeout
Message-ID:  <202112131350.1BDDoaIg036939@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by kp:

URL: https://cgit.FreeBSD.org/src/commit/?id=912a0f7fabfa02f98ab08bc36508de3d2ceeb6cf

commit 912a0f7fabfa02f98ab08bc36508de3d2ceeb6cf
Author:     Kristof Provost <kp@FreeBSD.org>
AuthorDate: 2021-12-02 16:30:36 +0000
Commit:     Kristof Provost <kp@FreeBSD.org>
CommitDate: 2021-12-13 13:49:27 +0000

    pfsync: fix defer timeout
    
    Don't use a fixed number of ticks, but take hz into account so we have a
    consistent timeout, regardless of what hz is set up.
    Use a 20ms timeout, becaues that's what OpenBSD uses.
    
    Reviewed by:    glebius
    MFC after:      1 week
    Sponsored by:   Rubicon Communications, LLC ("Netgate")
    Differential Revision:  https://reviews.freebsd.org/D33242
    
    (cherry picked from commit 93a3fa41dcff274180133712a13392d17a3e75a1)
---
 sys/netpfil/pf/if_pfsync.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/sys/netpfil/pf/if_pfsync.c b/sys/netpfil/pf/if_pfsync.c
index c10f1a64799f..a4f1d43f5ea0 100644
--- a/sys/netpfil/pf/if_pfsync.c
+++ b/sys/netpfil/pf/if_pfsync.c
@@ -316,6 +316,7 @@ static struct pfsync_bucket	*pfsync_get_bucket(struct pfsync_softc *,
 		    struct pf_kstate *);
 
 #define PFSYNC_MAX_BULKTRIES	12
+#define PFSYNC_DEFER_TIMEOUT	((20 * hz) / 1000)
 
 VNET_DEFINE(struct if_clone *, pfsync_cloner);
 #define	V_pfsync_cloner	VNET(pfsync_cloner)
@@ -1769,7 +1770,7 @@ pfsync_defer(struct pf_kstate *st, struct mbuf *m)
 
 	TAILQ_INSERT_TAIL(&b->b_deferrals, pd, pd_entry);
 	callout_init_mtx(&pd->pd_tmo, &b->b_mtx, CALLOUT_RETURNUNLOCKED);
-	callout_reset(&pd->pd_tmo, 10, pfsync_defer_tmo, pd);
+	callout_reset(&pd->pd_tmo, PFSYNC_DEFER_TIMEOUT, pfsync_defer_tmo, pd);
 
 	pfsync_push(b);
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202112131350.1BDDoaIg036939>