svn commit: r356748 - in head/sys: kern net sys
Gleb Smirnoff
glebius at FreeBSD.org
Wed Jan 15 03:34:22 UTC 2020
Author: glebius
Date: Wed Jan 15 03:34:21 2020
New Revision: 356748
URL: https://svnweb.freebsd.org/changeset/base/356748
Log:
- 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.
Modified:
head/sys/kern/uipc_domain.c
head/sys/net/if.c
head/sys/net/if_var.h
head/sys/sys/epoch.h
Modified: head/sys/kern/uipc_domain.c
==============================================================================
--- head/sys/kern/uipc_domain.c Wed Jan 15 03:30:33 2020 (r356747)
+++ head/sys/kern/uipc_domain.c Wed Jan 15 03:34:21 2020 (r356748)
@@ -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
Modified: head/sys/net/if.c
==============================================================================
--- head/sys/net/if.c Wed Jan 15 03:30:33 2020 (r356747)
+++ head/sys/net/if.c Wed Jan 15 03:34:21 2020 (r356748)
@@ -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);
Modified: head/sys/net/if_var.h
==============================================================================
--- head/sys/net/if_var.h Wed Jan 15 03:30:33 2020 (r356747)
+++ head/sys/net/if_var.h Wed Jan 15 03:34:21 2020 (r356748)
@@ -107,8 +107,6 @@ VNET_DECLARE(struct hhook_head *, ipsec_hhh_in[HHOOK_I
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 */
Modified: head/sys/sys/epoch.h
==============================================================================
--- head/sys/sys/epoch.h Wed Jan 15 03:30:33 2020 (r356747)
+++ head/sys/sys/epoch.h Wed Jan 15 03:34:21 2020 (r356748)
@@ -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_ */
More information about the svn-src-head
mailing list