- Move global network epoch definition to epoch.h, as more different

subsystems tend to need to know about it, and including if_var.h is
  huge header pollution for them.  Polluting possible non-network
  users with single symbol seems much lesser evil.
- Remove non-preemptible network epoch.  Not used yet, and unlikely
  to get used in close future.
This commit is contained in:
Gleb Smirnoff 2020-01-15 03:34:21 +00:00
parent 9cdc43b16e
commit 3264dcadc9
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=356748
4 changed files with 11 additions and 10 deletions

View File

@ -39,6 +39,7 @@ __FBSDID("$FreeBSD$");
#include <sys/protosw.h>
#include <sys/domain.h>
#include <sys/eventhandler.h>
#include <sys/epoch.h>
#include <sys/mbuf.h>
#include <sys/kernel.h>
#include <sys/lock.h>
@ -47,8 +48,6 @@ __FBSDID("$FreeBSD$");
#include <sys/systm.h>
#include <net/vnet.h>
#include <net/if.h> /* XXXGL: net_epoch should move out there */
#include <net/if_var.h> /* XXXGL: net_epoch should move out there */
/*
* System initialization

View File

@ -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 <sys/mount.h>
#include <compat/freebsd32/freebsd32.h>
@ -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);

View File

@ -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 */

View File

@ -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_ */