summaryrefslogtreecommitdiff
path: root/sys/dev/vmware
diff options
context:
space:
mode:
authorJohn Baldwin <jhb@FreeBSD.org>2015-11-16 21:36:50 +0000
committerJohn Baldwin <jhb@FreeBSD.org>2015-11-16 21:36:50 +0000
commit1941909336df8c7fd37da8b74d52aea786d13de9 (patch)
tree9ddb5ebef396cd2f882c77885e8d9847956defc4 /sys/dev/vmware
parent2409c5b0cccec7bbc120cc750c2ab34f07017ba5 (diff)
Notes
Diffstat (limited to 'sys/dev/vmware')
-rw-r--r--sys/dev/vmware/vmxnet3/if_vmx.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/sys/dev/vmware/vmxnet3/if_vmx.c b/sys/dev/vmware/vmxnet3/if_vmx.c
index 5faf716acf4d..be249c9fcb51 100644
--- a/sys/dev/vmware/vmxnet3/if_vmx.c
+++ b/sys/dev/vmware/vmxnet3/if_vmx.c
@@ -510,6 +510,13 @@ vmxnet3_check_version(struct vmxnet3_softc *sc)
return (0);
}
+static int
+trunc_powerof2(int val)
+{
+
+ return (1U << (fls(val) - 1));
+}
+
static void
vmxnet3_initial_config(struct vmxnet3_softc *sc)
{
@@ -520,14 +527,14 @@ vmxnet3_initial_config(struct vmxnet3_softc *sc)
nqueue = VMXNET3_DEF_TX_QUEUES;
if (nqueue > mp_ncpus)
nqueue = mp_ncpus;
- sc->vmx_max_ntxqueues = nqueue;
+ sc->vmx_max_ntxqueues = trunc_powerof2(nqueue);
nqueue = vmxnet3_tunable_int(sc, "rxnqueue", vmxnet3_default_rxnqueue);
if (nqueue > VMXNET3_MAX_RX_QUEUES || nqueue < 1)
nqueue = VMXNET3_DEF_RX_QUEUES;
if (nqueue > mp_ncpus)
nqueue = mp_ncpus;
- sc->vmx_max_nrxqueues = nqueue;
+ sc->vmx_max_nrxqueues = trunc_powerof2(nqueue);
if (vmxnet3_tunable_int(sc, "mq_disable", vmxnet3_mq_disable)) {
sc->vmx_max_nrxqueues = 1;