Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

vmxnet3: fix minimum vectors alloc issue

'Commit 39f9895a00f4 ("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: 39f9895a00f4 ("vmxnet3: add support for 32 Tx/Rx queues")
Signed-off-by: Ronak Doshi <doshir@vmware.com>
Acked-by: Guolin Yang <gyang@vmware.com>
Link: https://lore.kernel.org/r/20211207081737.14000-1-doshir@vmware.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Ronak Doshi and committed by
Jakub Kicinski
f71ef02f e195e9b5

+7 -6
+7 -6
drivers/net/vmxnet3/vmxnet3_drv.c
··· 3261 3261 3262 3262 #ifdef CONFIG_PCI_MSI 3263 3263 if (adapter->intr.type == VMXNET3_IT_MSIX) { 3264 - int i, nvec; 3264 + int i, nvec, nvec_allocated; 3265 3265 3266 3266 nvec = adapter->share_intr == VMXNET3_INTR_TXSHARE ? 3267 3267 1 : adapter->num_tx_queues; ··· 3274 3274 for (i = 0; i < nvec; i++) 3275 3275 adapter->intr.msix_entries[i].entry = i; 3276 3276 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) 3279 3279 goto msix_err; 3280 3280 3281 3281 /* If we cannot allocate one MSIx vector per queue 3282 3282 * then limit the number of rx queues to 1 3283 3283 */ 3284 - if (nvec == VMXNET3_LINUX_MIN_MSIX_VECT) { 3284 + if (nvec_allocated == VMXNET3_LINUX_MIN_MSIX_VECT && 3285 + nvec != VMXNET3_LINUX_MIN_MSIX_VECT) { 3285 3286 if (adapter->share_intr != VMXNET3_INTR_BUDDYSHARE 3286 3287 || adapter->num_rx_queues != 1) { 3287 3288 adapter->share_intr = VMXNET3_INTR_TXSHARE; ··· 3292 3291 } 3293 3292 } 3294 3293 3295 - adapter->intr.num_intrs = nvec; 3294 + adapter->intr.num_intrs = nvec_allocated; 3296 3295 return; 3297 3296 3298 3297 msix_err: 3299 3298 /* If we cannot allocate MSIx vectors use only one rx queue */ 3300 3299 dev_info(&adapter->pdev->dev, 3301 3300 "Failed to enable MSI-X, error %d. " 3302 - "Limiting #rx queues to 1, try MSI.\n", nvec); 3301 + "Limiting #rx queues to 1, try MSI.\n", nvec_allocated); 3303 3302 3304 3303 adapter->intr.type = VMXNET3_IT_MSI; 3305 3304 }