Skip to content

Commit f71ef02

Browse files
Ronak Doshikuba-moo
authored andcommitted
vmxnet3: fix minimum vectors alloc issue
'Commit 39f9895 ("vmxnet3: add support for 32 Tx/Rx queues")' added support for 32Tx/Rx queues. Within that patch, value of VMXNET3_LINUX_MIN_MSIX_VECT was updated. However, there is a case (numvcpus = 2) which actually requires 3 intrs which matches VMXNET3_LINUX_MIN_MSIX_VECT which then is treated as failure by stack to allocate more vectors. This patch fixes this issue. Fixes: 39f9895 ("vmxnet3: add support for 32 Tx/Rx queues") Signed-off-by: Ronak Doshi <[email protected]> Acked-by: Guolin Yang <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent e195e9b commit f71ef02

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

drivers/net/vmxnet3/vmxnet3_drv.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3261,7 +3261,7 @@ vmxnet3_alloc_intr_resources(struct vmxnet3_adapter *adapter)
32613261

32623262
#ifdef CONFIG_PCI_MSI
32633263
if (adapter->intr.type == VMXNET3_IT_MSIX) {
3264-
int i, nvec;
3264+
int i, nvec, nvec_allocated;
32653265

32663266
nvec = adapter->share_intr == VMXNET3_INTR_TXSHARE ?
32673267
1 : adapter->num_tx_queues;
@@ -3274,14 +3274,15 @@ vmxnet3_alloc_intr_resources(struct vmxnet3_adapter *adapter)
32743274
for (i = 0; i < nvec; i++)
32753275
adapter->intr.msix_entries[i].entry = i;
32763276

3277-
nvec = vmxnet3_acquire_msix_vectors(adapter, nvec);
3278-
if (nvec < 0)
3277+
nvec_allocated = vmxnet3_acquire_msix_vectors(adapter, nvec);
3278+
if (nvec_allocated < 0)
32793279
goto msix_err;
32803280

32813281
/* If we cannot allocate one MSIx vector per queue
32823282
* then limit the number of rx queues to 1
32833283
*/
3284-
if (nvec == VMXNET3_LINUX_MIN_MSIX_VECT) {
3284+
if (nvec_allocated == VMXNET3_LINUX_MIN_MSIX_VECT &&
3285+
nvec != VMXNET3_LINUX_MIN_MSIX_VECT) {
32853286
if (adapter->share_intr != VMXNET3_INTR_BUDDYSHARE
32863287
|| adapter->num_rx_queues != 1) {
32873288
adapter->share_intr = VMXNET3_INTR_TXSHARE;
@@ -3291,14 +3292,14 @@ vmxnet3_alloc_intr_resources(struct vmxnet3_adapter *adapter)
32913292
}
32923293
}
32933294

3294-
adapter->intr.num_intrs = nvec;
3295+
adapter->intr.num_intrs = nvec_allocated;
32953296
return;
32963297

32973298
msix_err:
32983299
/* If we cannot allocate MSIx vectors use only one rx queue */
32993300
dev_info(&adapter->pdev->dev,
33003301
"Failed to enable MSI-X, error %d. "
3301-
"Limiting #rx queues to 1, try MSI.\n", nvec);
3302+
"Limiting #rx queues to 1, try MSI.\n", nvec_allocated);
33023303

33033304
adapter->intr.type = VMXNET3_IT_MSI;
33043305
}

0 commit comments

Comments
 (0)