Restore power-of-2 queue count constraint from r290948
When vmx(4) was converted to an iflib driver in r343291, the power-of-2 queue count constraint was removed as it appeared that current implementations of the VMXNET3 virtual device no longer required that constraint. It turns out that some of the implementations still do, and on such systems, the device will fail to initialize when configured with a non-power-of-2 RX or TX queue count. PR: 237321 Reported by: ncrogers@gmail.com MFC after: 1 week
This commit is contained in:
parent
1d7a2bbe37
commit
5d1899eedb
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=359029
@ -320,6 +320,13 @@ vmxnet3_register(device_t dev)
|
||||
return (&vmxnet3_sctx_init);
|
||||
}
|
||||
|
||||
static int
|
||||
trunc_powerof2(int val)
|
||||
{
|
||||
|
||||
return (1U << (fls(val) - 1));
|
||||
}
|
||||
|
||||
static int
|
||||
vmxnet3_attach_pre(if_ctx_t ctx)
|
||||
{
|
||||
@ -349,12 +356,16 @@ vmxnet3_attach_pre(if_ctx_t ctx)
|
||||
/* If 0, the iflib tunable was not set, so set to the default */
|
||||
if (scctx->isc_nrxqsets == 0)
|
||||
scctx->isc_nrxqsets = VMXNET3_DEF_RX_QUEUES;
|
||||
scctx->isc_nrxqsets = trunc_powerof2(scctx->isc_nrxqsets);
|
||||
scctx->isc_nrxqsets_max = min(VMXNET3_MAX_RX_QUEUES, mp_ncpus);
|
||||
scctx->isc_nrxqsets_max = trunc_powerof2(scctx->isc_nrxqsets_max);
|
||||
|
||||
/* If 0, the iflib tunable was not set, so set to the default */
|
||||
if (scctx->isc_ntxqsets == 0)
|
||||
scctx->isc_ntxqsets = VMXNET3_DEF_TX_QUEUES;
|
||||
scctx->isc_ntxqsets = trunc_powerof2(scctx->isc_ntxqsets);
|
||||
scctx->isc_ntxqsets_max = min(VMXNET3_MAX_TX_QUEUES, mp_ncpus);
|
||||
scctx->isc_ntxqsets_max = trunc_powerof2(scctx->isc_ntxqsets_max);
|
||||
|
||||
/*
|
||||
* Enforce that the transmit completion queue descriptor count is
|
||||
|
Loading…
Reference in New Issue
Block a user