diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h --- a/sys/net/pfvar.h +++ b/sys/net/pfvar.h @@ -687,7 +687,6 @@ int open; uint32_t ticket; } active, inactive; - struct epoch_context epoch_ctx; struct vnet *vnet; struct pf_keth_anchor *anchor; }; diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -5186,11 +5186,6 @@ return (PF_PASS); } - ruleset = V_pf_keth; - rules = ck_pr_load_ptr(&ruleset->active.rules); - r = TAILQ_FIRST(rules); - rm = NULL; - if (__predict_false(m->m_len < sizeof(struct ether_header)) && (m = *m0 = m_pullup(*m0, sizeof(struct ether_header))) == NULL) { DPFPRINTF(PF_DEBUG_URGENT, @@ -5234,7 +5229,9 @@ PF_RULES_RLOCK(); - while (r != NULL) { + ruleset = V_pf_keth; + rules = atomic_load_ptr(&ruleset->active.rules); + for (r = TAILQ_FIRST(rules), rm = NULL; r != NULL;) { counter_u64_add(r->evaluations, 1); SDT_PROBE2(pf, eth, test_rule, test, r->nr, r); diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -107,7 +107,6 @@ static int pfioctl(struct cdev *, u_long, caddr_t, int, struct thread *); static int pf_begin_eth(uint32_t *, const char *); -static void pf_rollback_eth_cb(struct epoch_context *); static int pf_rollback_eth(uint32_t, const char *); static int pf_commit_eth(uint32_t, const char *); static void pf_free_eth_rule(struct pf_keth_rule *); @@ -794,23 +793,6 @@ return (0); } -static void -pf_rollback_eth_cb(struct epoch_context *ctx) -{ - struct pf_keth_ruleset *rs; - - rs = __containerof(ctx, struct pf_keth_ruleset, epoch_ctx); - - CURVNET_SET(rs->vnet); - - PF_RULES_WLOCK(); - pf_rollback_eth(rs->inactive.ticket, - rs->anchor ? rs->anchor->path : ""); - PF_RULES_WUNLOCK(); - - CURVNET_RESTORE(); -} - static int pf_rollback_eth(uint32_t ticket, const char *anchor) { @@ -904,15 +886,12 @@ pf_eth_calc_skip_steps(rs->inactive.rules); rules = rs->active.rules; - ck_pr_store_ptr(&rs->active.rules, rs->inactive.rules); + atomic_store_ptr(&rs->active.rules, rs->inactive.rules); rs->inactive.rules = rules; rs->inactive.ticket = rs->active.ticket; - /* Clean up inactive rules (i.e. previously active rules), only when - * we're sure they're no longer used. */ - NET_EPOCH_CALL(pf_rollback_eth_cb, &rs->epoch_ctx); - - return (0); + return (pf_rollback_eth(rs->inactive.ticket, + rs->anchor ? rs->anchor->path : "")); } #ifdef ALTQ @@ -5179,8 +5158,6 @@ free(ioes, M_TEMP); break; } - /* Ensure there's no more ethernet rules to clean up. */ - NET_EPOCH_DRAIN_CALLBACKS(); PF_RULES_WLOCK(); for (i = 0, ioe = ioes; i < io->size; i++, ioe++) { ioe->anchor[sizeof(ioe->anchor) - 1] = '\0'; @@ -6805,9 +6782,6 @@ shutdown_pf(); PF_RULES_WUNLOCK(); - /* Make sure we've cleaned up ethernet rules before we continue. */ - NET_EPOCH_DRAIN_CALLBACKS(); - ret = swi_remove(V_pf_swi_cookie); MPASS(ret == 0); ret = intr_event_destroy(V_pf_swi_ie);