Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F178171018
D62263.1796178656.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
12 KB
Referenced Files
None
Subscribers
None
D62263.1796178656.diff
View Options
diff --git a/share/man/man9/netisr.9 b/share/man/man9/netisr.9
--- a/share/man/man9/netisr.9
+++ b/share/man/man9/netisr.9
@@ -53,16 +53,6 @@
.Fn netisr_getqlimit "const struct netisr_handler *nhp" "u_int *qlimitp"
.Ft int
.Fn netisr_setqlimit "const struct netisr_handler *nhp" "u_int qlimit"
-.Pp
-With optional virtual network stack support enabled via the following kernel
-compile option:
-.Bd -ragged -offset indent
-.Cd "options VIMAGE"
-.Ed
-.Ft void
-.Fn netisr_register_vnet "const struct netisr_handler *nhp"
-.Ft void
-.Fn netisr_unregister_vnet "const struct netisr_handler *nhp"
.Sh DESCRIPTION
The
.Nm
@@ -82,16 +72,6 @@
and
.Fn netisr_setqlimit .
.Pp
-In case of VIMAGE kernels each virtual network stack (vnet), that is not the
-default base system network stack, calls
-.Fn netisr_register_vnet
-and
-.Fn netisr_unregister_vnet
-to enable or disable packet processing by the
-.Nm
-for each protocol.
-Disabling will also purge any outstanding packet from the protocol queue.
-.Pp
.Nm
supports multi-processor execution of handlers, and relies on a combination
of source ordering and protocol-specific ordering and work-placement
diff --git a/sys/net/if_ethersubr.c b/sys/net/if_ethersubr.c
--- a/sys/net/if_ethersubr.c
+++ b/sys/net/if_ethersubr.c
@@ -722,10 +722,6 @@
args.pa_type = PFIL_TYPE_ETHERNET;
args.pa_headname = PFIL_ETHER_NAME;
V_link_pfil_head = pfil_head_register(&args);
-
-#ifdef VIMAGE
- netisr_register_vnet(ðer_nh);
-#endif
}
VNET_SYSINIT(vnet_ether_init, SI_SUB_PROTO_IF, SI_ORDER_ANY,
vnet_ether_init, NULL);
@@ -739,15 +735,6 @@
}
VNET_SYSUNINIT(vnet_ether_pfil_uninit, SI_SUB_PROTO_PFIL, SI_ORDER_ANY,
vnet_ether_pfil_destroy, NULL);
-
-static void
-vnet_ether_destroy(__unused void *arg)
-{
-
- netisr_unregister_vnet(ðer_nh);
-}
-VNET_SYSUNINIT(vnet_ether_uninit, SI_SUB_PROTO_IF, SI_ORDER_ANY,
- vnet_ether_destroy, NULL);
#endif
static void
diff --git a/sys/net/netisr.h b/sys/net/netisr.h
--- a/sys/net/netisr.h
+++ b/sys/net/netisr.h
@@ -212,10 +212,6 @@
void netisr_register(const struct netisr_handler *nhp);
int netisr_setqlimit(const struct netisr_handler *nhp, u_int qlimit);
void netisr_unregister(const struct netisr_handler *nhp);
-#ifdef VIMAGE
-void netisr_register_vnet(const struct netisr_handler *nhp);
-void netisr_unregister_vnet(const struct netisr_handler *nhp);
-#endif
/*
* Process a packet destined for a protocol, and attempt direct dispatch.
diff --git a/sys/net/netisr.c b/sys/net/netisr.c
--- a/sys/net/netisr.c
+++ b/sys/net/netisr.c
@@ -270,23 +270,6 @@
*/
static struct netisr_proto netisr_proto[NETISR_MAXPROT];
-#ifdef VIMAGE
-/*
- * The netisr_enable array describes a per-VNET flag for registered
- * protocols on whether this netisr is active in this VNET or not.
- * netisr_register() will automatically enable the netisr for the
- * default VNET and all currently active instances.
- * netisr_unregister() will disable all active VNETs, including vnet0.
- * Individual network stack instances can be enabled/disabled by the
- * netisr_(un)register _vnet() functions.
- * With this we keep the one netisr_proto per protocol but add a
- * mechanism to stop netisr processing for vnet teardown.
- * Apart from that we expect a VNET to always be enabled.
- */
-VNET_DEFINE_STATIC(u_int, netisr_enable[NETISR_MAXPROT]);
-#define V_netisr_enable VNET(netisr_enable)
-#endif
-
/*
* The array is populated up to net.isr.numthreads / nws_count.
* A workstream can be picked up with curcpu % nws_count and once number of
@@ -407,7 +390,6 @@
void
netisr_register(const struct netisr_handler *nhp)
{
- VNET_ITERATOR_DECL(vnet_iter);
const char *name;
u_int proto;
@@ -472,19 +454,6 @@
nw->nw_queued = counter_u64_alloc(M_WAITOK);
nw->nw_handled = counter_u64_alloc(M_WAITOK);
}
-
-#ifdef VIMAGE
- V_netisr_enable[proto] = 1;
- VNET_LIST_RLOCK_NOSLEEP();
- VNET_FOREACH(vnet_iter) {
- if (vnet_iter == curvnet)
- continue;
- CURVNET_SET(vnet_iter);
- V_netisr_enable[proto] = 1;
- CURVNET_RESTORE();
- }
- VNET_LIST_RUNLOCK_NOSLEEP();
-#endif
NETISR_WUNLOCK();
}
@@ -614,7 +583,6 @@
void
netisr_unregister(const struct netisr_handler *nhp)
{
- VNET_ITERATOR_DECL(vnet_iter);
u_int proto = nhp->nh_proto;
KASSERT(proto < NETISR_MAXPROT,
@@ -625,16 +593,6 @@
("%s(%u): protocol not registered for %s", __func__, proto,
nhp->nh_name));
-#ifdef VIMAGE
- VNET_LIST_RLOCK_NOSLEEP();
- VNET_FOREACH(vnet_iter) {
- CURVNET_SET(vnet_iter);
- V_netisr_enable[proto] = 0;
- CURVNET_RESTORE();
- }
- VNET_LIST_RUNLOCK_NOSLEEP();
-#endif
-
netisr_proto[proto].np_name = NULL;
netisr_proto[proto].np_handler = NULL;
netisr_proto[proto].np_m2flow = NULL;
@@ -654,99 +612,6 @@
NETISR_WUNLOCK();
}
-#ifdef VIMAGE
-void
-netisr_register_vnet(const struct netisr_handler *nhp)
-{
- u_int proto;
-
- proto = nhp->nh_proto;
-
- KASSERT(curvnet != NULL, ("%s: curvnet is NULL", __func__));
- KASSERT(proto < NETISR_MAXPROT,
- ("%s(%u): protocol too big for %s", __func__, proto, nhp->nh_name));
- NETISR_WLOCK();
- KASSERT(netisr_proto[proto].np_handler != NULL,
- ("%s(%u): protocol not registered for %s", __func__, proto,
- nhp->nh_name));
-
- V_netisr_enable[proto] = 1;
- NETISR_WUNLOCK();
-}
-
-static void
-netisr_drain_proto_vnet(struct vnet *vnet, u_int proto)
-{
- struct epoch_tracker et;
- struct mbuf *m, *mp, *n, *ne;
- struct ifnet *ifp;
-
- KASSERT(vnet != NULL, ("%s: vnet is NULL", __func__));
- NETISR_LOCK_ASSERT();
-
- for (u_int i = 0; i < nws_count; i++) {
- struct netisr_workstream *nws = nws_array[i];
- struct netisr_work *nw = &nws->nws_work[proto];
-
- NWS_LOCK(nws);
- /*
- * Rather than dissecting and removing mbufs from the middle
- * of the chain, we build a new chain if the packet stays and
- * update the head and tail pointers at the end. All packets
- * matching the given vnet are freed.
- */
- m = nw->nw_head;
- n = ne = NULL;
- NET_EPOCH_ENTER(et);
- while (m != NULL) {
- mp = m;
- m = m->m_nextpkt;
- mp->m_nextpkt = NULL;
- if ((ifp = ifnet_byindexgen(mp->m_pkthdr.rcvidx,
- mp->m_pkthdr.rcvgen)) != NULL &&
- ifp->if_vnet != vnet) {
- if (n == NULL) {
- n = ne = mp;
- } else {
- ne->m_nextpkt = mp;
- ne = mp;
- }
- continue;
- }
- /* This is a packet in the selected vnet, or belongs
- to destroyed interface. Free it. */
- nw->nw_len--;
- m_freem(mp);
- }
- NET_EPOCH_EXIT(et);
- nw->nw_head = n;
- nw->nw_tail = ne;
- NWS_UNLOCK(nws);
- }
-}
-
-void
-netisr_unregister_vnet(const struct netisr_handler *nhp)
-{
- u_int proto;
-
- proto = nhp->nh_proto;
-
- KASSERT(curvnet != NULL, ("%s: curvnet is NULL", __func__));
- KASSERT(proto < NETISR_MAXPROT,
- ("%s(%u): protocol too big for %s", __func__, proto, nhp->nh_name));
- NETISR_WLOCK();
- KASSERT(netisr_proto[proto].np_handler != NULL,
- ("%s(%u): protocol not registered for %s", __func__, proto,
- nhp->nh_name));
-
- V_netisr_enable[proto] = 0;
-
- netisr_drain_proto_vnet(curvnet, proto);
- NETISR_WUNLOCK();
-}
-#endif
-
/*
* Compose the global and per-protocol policies on dispatch, and return the
* dispatch policy to use.
@@ -1040,13 +905,6 @@
KASSERT(netisr_proto[proto].np_handler != NULL,
("%s: invalid proto %u", __func__, proto));
-#ifdef VIMAGE
- if (V_netisr_enable[proto] == 0) {
- m_freem(m);
- return (ENOPROTOOPT);
- }
-#endif
-
m = netisr_select_nws(&netisr_proto[proto], NETISR_DISPATCH_DEFERRED,
source, m, &nws_id);
if (m != NULL) {
@@ -1094,13 +952,6 @@
KASSERT(npp->np_handler != NULL, ("%s: invalid proto %u", __func__,
proto));
-#ifdef VIMAGE
- if (V_netisr_enable[proto] == 0) {
- m_freem(m);
- return (ENOPROTOOPT);
- }
-#endif
-
dispatch_policy = netisr_get_dispatch(npp);
if (dispatch_policy == NETISR_DISPATCH_DEFERRED)
return (netisr_queue_src(proto, source, m));
diff --git a/sys/net/rtsock.c b/sys/net/rtsock.c
--- a/sys/net/rtsock.c
+++ b/sys/net/rtsock.c
@@ -244,35 +244,6 @@
0, 0, sysctl_route_netisr_maxqlen, "I",
"maximum routing socket dispatch queue length");
-static void
-vnet_rts_init(void)
-{
- int tmp;
-
- if (IS_DEFAULT_VNET(curvnet)) {
- if (TUNABLE_INT_FETCH("net.route.netisr_maxqlen", &tmp))
- rtsock_nh.nh_qlimit = tmp;
- netisr_register(&rtsock_nh);
- }
-#ifdef VIMAGE
- else
- netisr_register_vnet(&rtsock_nh);
-#endif
-}
-VNET_SYSINIT(vnet_rtsock, SI_SUB_PROTO_DOMAIN, SI_ORDER_THIRD,
- vnet_rts_init, NULL);
-
-#ifdef VIMAGE
-static void
-vnet_rts_uninit(void)
-{
-
- netisr_unregister_vnet(&rtsock_nh);
-}
-VNET_SYSUNINIT(vnet_rts_uninit, SI_SUB_PROTO_DOMAIN, SI_ORDER_THIRD,
- vnet_rts_uninit, NULL);
-#endif
-
static void
report_route_event(const struct rib_cmd_info *rc, void *_cbdata)
{
@@ -309,8 +280,13 @@
static void
rtsock_init(void *dummy __unused)
{
+ int tmp;
+
rtsbridge_orig_p = rtsock_callback_p;
rtsock_callback_p = &rtsbridge;
+ if (TUNABLE_INT_FETCH("net.route.netisr_maxqlen", &tmp))
+ rtsock_nh.nh_qlimit = tmp;
+ netisr_register(&rtsock_nh);
}
SYSINIT(rtsock_init, SI_SUB_PROTO_DOMAIN, SI_ORDER_THIRD, rtsock_init, NULL);
diff --git a/sys/netinet/if_ether.c b/sys/netinet/if_ether.c
--- a/sys/netinet/if_ether.c
+++ b/sys/netinet/if_ether.c
@@ -1492,33 +1492,10 @@
}
static void
-vnet_arp_init(void)
+arp_init(void)
{
-
- if (IS_DEFAULT_VNET(curvnet)) {
- netisr_register(&arp_nh);
- iflladdr_tag = EVENTHANDLER_REGISTER(iflladdr_event,
- arp_iflladdr, NULL, EVENTHANDLER_PRI_ANY);
- }
-#ifdef VIMAGE
- else
- netisr_register_vnet(&arp_nh);
-#endif
-}
-VNET_SYSINIT(vnet_arp_init, SI_SUB_PROTO_DOMAIN, SI_ORDER_SECOND,
- vnet_arp_init, NULL);
-
-#ifdef VIMAGE
-/*
- * We have to unregister ARP along with IP otherwise we risk doing INADDR_HASH
- * lookups after destroying the hash. Ideally this would go on SI_ORDER_3.5.
- */
-static void
-vnet_arp_destroy(__unused void *arg)
-{
-
- netisr_unregister_vnet(&arp_nh);
+ netisr_register(&arp_nh);
+ iflladdr_tag = EVENTHANDLER_REGISTER(iflladdr_event, arp_iflladdr,
+ NULL, EVENTHANDLER_PRI_ANY);
}
-VNET_SYSUNINIT(vnet_arp_uninit, SI_SUB_PROTO_DOMAIN, SI_ORDER_THIRD,
- vnet_arp_destroy, NULL);
-#endif
+SYSINIT(vnet_arp_init, SI_SUB_PROTO_DOMAIN, SI_ORDER_SECOND, arp_init, NULL);
diff --git a/sys/netinet/igmp.c b/sys/netinet/igmp.c
--- a/sys/netinet/igmp.c
+++ b/sys/netinet/igmp.c
@@ -3641,29 +3641,6 @@
}
#endif
-#ifdef VIMAGE
-static void
-vnet_igmp_init(const void *unused __unused)
-{
-
- netisr_register_vnet(&igmp_nh);
-}
-VNET_SYSINIT(vnet_igmp_init, SI_SUB_PROTO_MC, SI_ORDER_ANY,
- vnet_igmp_init, NULL);
-
-static void
-vnet_igmp_uninit(const void *unused __unused)
-{
-
- /* This can happen when we shutdown the entire network stack. */
- CTR1(KTR_IGMPV3, "%s: tearing down", __func__);
-
- netisr_unregister_vnet(&igmp_nh);
-}
-VNET_SYSUNINIT(vnet_igmp_uninit, SI_SUB_PROTO_MC, SI_ORDER_ANY,
- vnet_igmp_uninit, NULL);
-#endif
-
#ifdef DDB
DB_SHOW_COMMAND(igi_list, db_show_igi_list)
{
diff --git a/sys/netinet/ip_input.c b/sys/netinet/ip_input.c
--- a/sys/netinet/ip_input.c
+++ b/sys/netinet/ip_input.c
@@ -344,13 +344,6 @@
HHOOK_WAITOK | HHOOK_HEADISINVNET) != 0)
printf("%s: WARNING: unable to register output helper hook\n",
__func__);
-
-#ifdef VIMAGE
- netisr_register_vnet(&ip_nh);
-#ifdef RSS
- netisr_register_vnet(&ip_direct_nh);
-#endif
-#endif
}
VNET_SYSINIT(ip_vnet_init, SI_SUB_PROTO_DOMAIN, SI_ORDER_FOURTH,
ip_vnet_init, NULL);
@@ -400,11 +393,6 @@
{
int error;
-#ifdef RSS
- netisr_unregister_vnet(&ip_direct_nh);
-#endif
- netisr_unregister_vnet(&ip_nh);
-
pfil_head_unregister(V_inet_pfil_head);
error = hhook_head_deregister(V_ipsec_hhh_in[HHOOK_IPSEC_INET]);
if (error != 0) {
diff --git a/sys/netinet6/ip6_input.c b/sys/netinet6/ip6_input.c
--- a/sys/netinet6/ip6_input.c
+++ b/sys/netinet6/ip6_input.c
@@ -271,14 +271,6 @@
(V_ip6_temp_preferred_lifetime >> 2) +
(V_ip6_temp_preferred_lifetime >> 3);
V_ip6_desync_factor = arc4random() % V_ip6_temp_max_desync_factor;
-
- /* Skip global initialization stuff for non-default instances. */
-#ifdef VIMAGE
- netisr_register_vnet(&ip6_nh);
-#ifdef RSS
- netisr_register_vnet(&ip6_direct_nh);
-#endif
-#endif
}
VNET_SYSINIT(ip6_vnet_init, SI_SUB_PROTO_DOMAIN, SI_ORDER_FOURTH,
ip6_vnet_init, NULL);
@@ -359,11 +351,6 @@
struct ifnet *ifp;
int error;
-#ifdef RSS
- netisr_unregister_vnet(&ip6_direct_nh);
-#endif
- netisr_unregister_vnet(&ip6_nh);
-
pfil_head_unregister(V_inet6_pfil_head);
error = hhook_head_deregister(V_ipsec_hhh_in[HHOOK_IPSEC_INET6]);
if (error != 0) {
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Dec 2, 2:30 AM (23 h, 6 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
42136020
Default Alt Text
D62263.1796178656.diff (12 KB)
Attached To
Mode
D62263: netisr: remove vnet(4) registration
Attached
Detach File
Event Timeline