git: 38d947b53cbc - main - netisr: fix compilation without VIMAGE

From: Gleb Smirnoff <glebius_at_FreeBSD.org>
Date: Fri, 17 Jan 2025 04:33:34 UTC
The branch main has been updated by glebius:

URL: https://cgit.FreeBSD.org/src/commit/?id=38d947b53cbca845926bdd91272ce1c65ba59ecb

commit 38d947b53cbca845926bdd91272ce1c65ba59ecb
Author:     Gleb Smirnoff <glebius@FreeBSD.org>
AuthorDate: 2025-01-17 04:29:40 +0000
Commit:     Gleb Smirnoff <glebius@FreeBSD.org>
CommitDate: 2025-01-17 04:32:53 +0000

    netisr: fix compilation without VIMAGE
    
    - Don't use bare vnet(4) definitions in the KASSERT, they aren't available
      on a kernel without VIMAGE.  Just through MPASS() here.  This is more of
      documenting assertion rather than an assertion that may actually fire on
      an unmodified kernel.
    - V_netisr_enable is different to the rest of V_ prefixed globals.  On a
      kernel without VIMAGE it basically doesn't exist, instead of being
      present as a single instance.
    
    Fixes:  a1be7978f1879313c141882a1e0812b468dead57
---
 sys/net/netisr.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/sys/net/netisr.c b/sys/net/netisr.c
index e9b8fa4d833c..7b4368276c58 100644
--- a/sys/net/netisr.c
+++ b/sys/net/netisr.c
@@ -396,8 +396,7 @@ 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));
+	MPASS(IS_DEFAULT_VNET(curvnet));
 	KASSERT(nhp->nh_name != NULL,
 	    ("%s: nh_name NULL for %u", __func__, proto));
 	KASSERT(nhp->nh_handler != NULL,
@@ -457,8 +456,8 @@ netisr_register(const struct netisr_handler *nhp)
 		npwp->nw_qlimit = netisr_proto[proto].np_qlimit;
 	}
 
-	V_netisr_enable[proto] = 1;
 #ifdef VIMAGE
+	V_netisr_enable[proto] = 1;
 	VNET_LIST_RLOCK_NOSLEEP();
 	VNET_FOREACH(vnet_iter) {
 		if (vnet_iter == curvnet)