aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGleb Smirnoff <glebius@FreeBSD.org>2025-01-17 02:31:15 +0000
committerGleb Smirnoff <glebius@FreeBSD.org>2025-01-17 02:31:15 +0000
commita1be7978f1879313c141882a1e0812b468dead57 (patch)
tree28f114dddee0b3a6de9ad9d5fbd472adf9eb38a6
parent1e9bca400b9c7ae3dc3f31aa48df69cf2259e16c (diff)
netisr: avoid VNET recursion warning in netisr_register()
While here, move some assertions to the top of the function.
-rw-r--r--sys/net/netisr.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/sys/net/netisr.c b/sys/net/netisr.c
index 4ae1aa9ab89d..e9b8fa4d833c 100644
--- a/sys/net/netisr.c
+++ b/sys/net/netisr.c
@@ -395,6 +395,9 @@ netisr_register(const struct netisr_handler *nhp)
/*
* Test that the requested registration is valid.
*/
+ CURVNET_ASSERT_SET();
+ KASSERT(IS_DEFAULT_VNET(curvnet), ("%s: curvnet %p is not vnet0 %p",
+ __func__, curvnet, vnet0));
KASSERT(nhp->nh_name != NULL,
("%s: nh_name NULL for %u", __func__, proto));
KASSERT(nhp->nh_handler != NULL,
@@ -454,15 +457,12 @@ netisr_register(const struct netisr_handler *nhp)
npwp->nw_qlimit = netisr_proto[proto].np_qlimit;
}
+ V_netisr_enable[proto] = 1;
#ifdef VIMAGE
- /*
- * Test that we are in vnet0 and have a curvnet set.
- */
- KASSERT(curvnet != NULL, ("%s: curvnet is NULL", __func__));
- KASSERT(IS_DEFAULT_VNET(curvnet), ("%s: curvnet %p is not vnet0 %p",
- __func__, curvnet, vnet0));
VNET_LIST_RLOCK_NOSLEEP();
VNET_FOREACH(vnet_iter) {
+ if (vnet_iter == curvnet)
+ continue;
CURVNET_SET(vnet_iter);
V_netisr_enable[proto] = 1;
CURVNET_RESTORE();