Index: net/if.c =================================================================== RCS file: /cvs/src/sys/net/if.c,v diff -u -p -r1.733 if.c --- net/if.c 7 May 2025 23:27:19 -0000 1.733 +++ net/if.c 8 May 2025 01:54:23 -0000 @@ -3675,15 +3675,21 @@ unhandled_af(int af) panic("unhandled af %d", af); } -struct softnet * -net_sn(unsigned int ifindex) +int +net_sn_count(void) { - static int nettaskqs; + static int nsoftnets; + + if (nsoftnets == 0) + nsoftnets = min(NET_TASKQ, ncpus); - if (nettaskqs == 0) - nettaskqs = min(NET_TASKQ, ncpus); + return (nsoftnets); +} - return (&softnets[ifindex % nettaskqs]); +struct softnet * +net_sn(unsigned int ifindex) +{ + return (&softnets[ifindex % net_sn_count()]); } struct taskq * Index: net/if.h =================================================================== RCS file: /cvs/src/sys/net/if.h,v diff -u -p -r1.218 if.h --- net/if.h 2 Mar 2025 21:28:31 -0000 1.218 +++ net/if.h 8 May 2025 01:54:23 -0000 @@ -563,6 +563,7 @@ int if_setlladdr(struct ifnet *, const u struct taskq * net_tq(unsigned int); void net_tq_barriers(const char *); +int net_sn_count(void); #endif /* _KERNEL */ Index: net/if_loop.c =================================================================== RCS file: /cvs/src/sys/net/if_loop.c,v diff -u -p -r1.100 if_loop.c --- net/if_loop.c 2 Mar 2025 21:28:31 -0000 1.100 +++ net/if_loop.c 8 May 2025 01:54:23 -0000 @@ -192,6 +192,8 @@ loop_clone_create(struct if_clone *ifc, rtable_l2set(0, 0, ifp->if_index); } else if_attach(ifp); + if_attach_queues(ifp, net_sn_count()); + if_attach_iqueues(ifp, net_sn_count()); if_alloc_sadl(ifp); #if NBPFILTER > 0 bpfattach(&ifp->if_bpf, ifp, DLT_LOOP, sizeof(u_int32_t)); Index: dev/pci/if_vmx.c =================================================================== RCS file: /cvs/src/sys/dev/pci/if_vmx.c,v diff -u -p -r1.92 if_vmx.c --- dev/pci/if_vmx.c 5 Mar 2025 06:51:25 -0000 1.92 +++ dev/pci/if_vmx.c 8 May 2025 01:54:23 -0000 @@ -317,7 +317,8 @@ vmxnet3_attach(struct device *parent, st isr = vmxnet3_intr_event; sc->sc_intrmap = intrmap_create(&sc->sc_dev, - msix, VMX_MAX_QUEUES, INTRMAP_POWEROF2); + msix, min(VMX_MAX_QUEUES, net_sn_count()), + INTRMAP_POWEROF2); sc->sc_nqueues = intrmap_count(sc->sc_intrmap); } break;