axgbe: Remove a nonsensical use of kernel_sysctlbyname()

No functional change intended.

MFC after:	1 week
This commit is contained in:
Mark Johnston 2024-07-14 12:15:23 -04:00
parent dc8357de60
commit d254651de3

View File

@ -36,6 +36,7 @@
#include <sys/module.h> #include <sys/module.h>
#include <sys/mutex.h> #include <sys/mutex.h>
#include <sys/rman.h> #include <sys/rman.h>
#include <sys/smp.h>
#include <sys/socket.h> #include <sys/socket.h>
#include <sys/sysctl.h> #include <sys/sysctl.h>
#include <sys/systm.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 axgbe_if_softc *sc = iflib_get_softc(ctx);
struct xgbe_prv_data *pdata = &sc->pdata; struct xgbe_prv_data *pdata = &sc->pdata;
cpuset_t lcpus; cpuset_t lcpus;
int cpu_count, err;
size_t len;
/* Set all function pointers */ /* Set all function pointers */
xgbe_init_all_fptrs(pdata); xgbe_init_all_fptrs(pdata);
@ -638,21 +637,12 @@ axgbe_set_counts(if_ctx_t ctx)
* number of Rx queues or maximum allowed * 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) { if (bus_get_cpus(pdata->dev, INTR_CPUS, sizeof(lcpus), &lcpus) != 0) {
axgbe_error("Unable to fetch CPU list\n"); axgbe_error("Unable to fetch CPU list\n");
/* TODO - handle CPU_COPY(&all_cpus, &lcpus); */ /* 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(CPU_COUNT(&lcpus), pdata->hw_feat.tx_ch_cnt);
pdata->tx_ring_count = min(pdata->tx_ring_count, pdata->tx_ring_count = min(pdata->tx_ring_count,