git: d254651de392 - main - axgbe: Remove a nonsensical use of kernel_sysctlbyname()

From: Mark Johnston <markj_at_FreeBSD.org>
Date: Sun, 14 Jul 2024 18:30:19 UTC
The branch main has been updated by markj:

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

commit d254651de392538fa7f5c0020093dde0ca06c614
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2024-07-14 16:15:23 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2024-07-14 18:29:15 +0000

    axgbe: Remove a nonsensical use of kernel_sysctlbyname()
    
    No functional change intended.
    
    MFC after:      1 week
---
 sys/dev/axgbe/if_axgbe_pci.c | 14 ++------------
 1 file changed, 2 insertions(+), 12 deletions(-)

diff --git a/sys/dev/axgbe/if_axgbe_pci.c b/sys/dev/axgbe/if_axgbe_pci.c
index 3e68525067fb..320799e77188 100644
--- a/sys/dev/axgbe/if_axgbe_pci.c
+++ b/sys/dev/axgbe/if_axgbe_pci.c
@@ -36,6 +36,7 @@
 #include <sys/module.h>
 #include <sys/mutex.h>
 #include <sys/rman.h>
+#include <sys/smp.h>
 #include <sys/socket.h>
 #include <sys/sysctl.h>
 #include <sys/systm.h>
@@ -610,8 +611,6 @@ axgbe_set_counts(if_ctx_t ctx)
 	struct axgbe_if_softc *sc = iflib_get_softc(ctx);
 	struct xgbe_prv_data *pdata = &sc->pdata;
 	cpuset_t lcpus;
-	int cpu_count, err;
-	size_t len;
 
 	/* Set all function pointers */
 	xgbe_init_all_fptrs(pdata);
@@ -638,21 +637,12 @@ axgbe_set_counts(if_ctx_t ctx)
 	 *   number of Rx queues or maximum allowed
 	 */
 
-	/* Get cpu count from sysctl */
-	len = sizeof(cpu_count);
-	err = kernel_sysctlbyname(curthread, "hw.ncpu", &cpu_count, &len, NULL,
-	    0, NULL, 0);
-	if (err) {
-		axgbe_error("Unable to fetch number of cpus\n");
-		cpu_count = 1;
-	}
-
 	if (bus_get_cpus(pdata->dev, INTR_CPUS, sizeof(lcpus), &lcpus) != 0) {
                 axgbe_error("Unable to fetch CPU list\n");
                 /* TODO - handle CPU_COPY(&all_cpus, &lcpus); */
         }
 
-	DBGPR("ncpu %d intrcpu %d\n", cpu_count, CPU_COUNT(&lcpus));
+	DBGPR("ncpu %d intrcpu %d\n", mp_ncpus, CPU_COUNT(&lcpus));
 
 	pdata->tx_ring_count = min(CPU_COUNT(&lcpus), pdata->hw_feat.tx_ch_cnt);
 	pdata->tx_ring_count = min(pdata->tx_ring_count,