Skip to content

Commit

Permalink
pfsync: fix defer timeout
Browse files Browse the repository at this point in the history
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 93a3fa4)
  • Loading branch information
kprovost committed Dec 13, 2021
1 parent 2c1d3e5 commit 912a0f7
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion sys/netpfil/pf/if_pfsync.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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);

Expand Down

0 comments on commit 912a0f7

Please sign in to comment.