git: f48bfa248f39 - stable/14 - axgbe: Remove a nonsensical use of kernel_sysctlbyname()

From: Mark Johnston <markj_at_FreeBSD.org>
Date: Mon, 22 Jul 2024 00:55:41 UTC
The branch stable/14 has been updated by markj:

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

commit f48bfa248f3991f4a6d9b99b4dcc5099886855b4
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2024-07-14 16:15:23 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2024-07-22 00:55:28 +0000

    axgbe: Remove a nonsensical use of kernel_sysctlbyname()
    
    No functional change intended.
    
    MFC after:      1 week
    
    (cherry picked from commit d254651de392538fa7f5c0020093dde0ca06c614)
---
 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 7f661e6d9c98..7a7c8539405c 100644
--- a/sys/dev/axgbe/if_axgbe_pci.c
+++ b/sys/dev/axgbe/if_axgbe_pci.c
@@ -37,6 +37,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>
@@ -589,8 +590,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);
@@ -617,21 +616,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,