diff --git a/sys/kern/uipc_domain.c b/sys/kern/uipc_domain.c index 26412972f6d5..60e30eb1ae00 100644 --- a/sys/kern/uipc_domain.c +++ b/sys/kern/uipc_domain.c @@ -39,6 +39,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -47,8 +48,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include /* XXXGL: net_epoch should move out there */ -#include /* XXXGL: net_epoch should move out there */ /* * System initialization diff --git a/sys/net/if.c b/sys/net/if.c index 9a0cbb3cb29b..8517b0bc07d0 100644 --- a/sys/net/if.c +++ b/sys/net/if.c @@ -108,7 +108,6 @@ _Static_assert(sizeof(((struct ifreq *)0)->ifr_name) == offsetof(struct ifreq, ifr_ifru), "gap between ifr_name and ifr_ifru"); __read_mostly epoch_t net_epoch_preempt; -__read_mostly epoch_t net_epoch; #ifdef COMPAT_FREEBSD32 #include #include @@ -932,7 +931,6 @@ if_epochalloc(void *dummy __unused) { net_epoch_preempt = epoch_alloc("Net preemptible", EPOCH_PREEMPT); - net_epoch = epoch_alloc("Net", 0); } SYSINIT(ifepochalloc, SI_SUB_EPOCH, SI_ORDER_ANY, if_epochalloc, NULL); diff --git a/sys/net/if_var.h b/sys/net/if_var.h index 3b869346eb17..e1d22d5b436b 100644 --- a/sys/net/if_var.h +++ b/sys/net/if_var.h @@ -107,8 +107,6 @@ VNET_DECLARE(struct hhook_head *, ipsec_hhh_in[HHOOK_IPSEC_COUNT]); VNET_DECLARE(struct hhook_head *, ipsec_hhh_out[HHOOK_IPSEC_COUNT]); #define V_ipsec_hhh_in VNET(ipsec_hhh_in) #define V_ipsec_hhh_out VNET(ipsec_hhh_out) -extern epoch_t net_epoch_preempt; -extern epoch_t net_epoch; #endif /* _KERNEL */ typedef enum { @@ -445,10 +443,6 @@ struct ifnet { #define IF_ADDR_WUNLOCK(if) mtx_unlock(&(if)->if_addr_lock) #define IF_ADDR_LOCK_ASSERT(if) MPASS(in_epoch(net_epoch_preempt) || mtx_owned(&(if)->if_addr_lock)) #define IF_ADDR_WLOCK_ASSERT(if) mtx_assert(&(if)->if_addr_lock, MA_OWNED) -#define NET_EPOCH_ENTER(et) epoch_enter_preempt(net_epoch_preempt, &(et)) -#define NET_EPOCH_EXIT(et) epoch_exit_preempt(net_epoch_preempt, &(et)) -#define NET_EPOCH_WAIT() epoch_wait_preempt(net_epoch_preempt) -#define NET_EPOCH_ASSERT() MPASS(in_epoch(net_epoch_preempt)) #ifdef _KERNEL /* interface link layer address change event */ diff --git a/sys/sys/epoch.h b/sys/sys/epoch.h index 91a7a71a27e4..67b08dfa6912 100644 --- a/sys/sys/epoch.h +++ b/sys/sys/epoch.h @@ -93,5 +93,15 @@ void epoch_trace_list(struct thread *); void epoch_enter(epoch_t epoch); void epoch_exit(epoch_t epoch); +/* + * Globally recognized epochs in the FreeBSD kernel. + */ +/* Network preemptible epoch, declared in sys/net/if.c. */ +extern epoch_t net_epoch_preempt; +#define NET_EPOCH_ENTER(et) epoch_enter_preempt(net_epoch_preempt, &(et)) +#define NET_EPOCH_EXIT(et) epoch_exit_preempt(net_epoch_preempt, &(et)) +#define NET_EPOCH_WAIT() epoch_wait_preempt(net_epoch_preempt) +#define NET_EPOCH_ASSERT() MPASS(in_epoch(net_epoch_preempt)) + #endif /* _KERNEL */ #endif /* _SYS_EPOCH_H_ */