aboutsummaryrefslogtreecommitdiff
path: root/sys/netinet/ip_input.c
diff options
context:
space:
mode:
authorBjoern A. Zeeb <bz@FreeBSD.org>2016-06-03 13:57:10 +0000
committerBjoern A. Zeeb <bz@FreeBSD.org>2016-06-03 13:57:10 +0000
commit484149def80975bda4e583a1d77c4c6ee2baf074 (patch)
treeb9bad282d3f1a106a25f2d6b11e1232e2b57223b /sys/netinet/ip_input.c
parent3e0522bc8f9a1b4011d7223100f0b85e7c97bb41 (diff)
downloadsrc-484149def80975bda4e583a1d77c4c6ee2baf074.tar.gz
src-484149def80975bda4e583a1d77c4c6ee2baf074.zip
Introduce a per-VNET flag to enable/disable netisr prcessing on that VNET.
Add accessor functions to toggle the state per VNET. The base system (vnet0) will always enable itself with the normal registration. We will share the registered protocol handlers in all VNETs minimising duplication and management. Upon disabling netisr processing for a VNET drain the netisr queue from packets for that VNET. Update netisr consumers to (de)register on a per-VNET start/teardown using VNET_SYS(UN)INIT functionality. The change should be transparent for non-VIMAGE kernels. Reviewed by: gnn (, hiren) Obtained from: projects/vnet MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D6691
Notes
Notes: svn path=/head/; revision=301270
Diffstat (limited to 'sys/netinet/ip_input.c')
-rw-r--r--sys/netinet/ip_input.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/sys/netinet/ip_input.c b/sys/netinet/ip_input.c
index 9afb8d66b381..f30913e49ab8 100644
--- a/sys/netinet/ip_input.c
+++ b/sys/netinet/ip_input.c
@@ -331,8 +331,15 @@ ip_init(void)
__func__);
/* Skip initialization of globals for non-default instances. */
- if (!IS_DEFAULT_VNET(curvnet))
+#ifdef VIMAGE
+ if (!IS_DEFAULT_VNET(curvnet)) {
+ netisr_register_vnet(&ip_nh);
+#ifdef RSS
+ netisr_register_vnet(&ip_direct_nh);
+#endif
return;
+ }
+#endif
pr = pffindproto(PF_INET, IPPROTO_RAW, SOCK_RAW);
if (pr == NULL)
@@ -366,6 +373,11 @@ ip_destroy(void *unused __unused)
{
int error;
+#ifdef RSS
+ netisr_unregister_vnet(&ip_direct_nh);
+#endif
+ netisr_unregister_vnet(&ip_nh);
+
if ((error = pfil_head_unregister(&V_inet_pfil_hook)) != 0)
printf("%s: WARNING: unable to unregister pfil hook, "
"error %d\n", __func__, error);