Skip to content

Commit

Permalink
vmxnet3: remove power of 2 limitation on the queues
Browse files Browse the repository at this point in the history
With version 6, vmxnet3 relaxes the restriction on queues to
be power of two. This is helpful in cases (Edge VM) where
vcpus are less than 8 and device requires more than 4 queues.

Signed-off-by: Ronak Doshi <doshir@vmware.com>
Acked-by: Guolin Yang <gyang@vmware.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Ronak Doshi authored and David S. Miller committed Jul 17, 2021
1 parent 39f9895 commit 15ccf2f
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions drivers/net/vmxnet3/vmxnet3_drv.c
Original file line number Diff line number Diff line change
Expand Up @@ -3399,15 +3399,13 @@ vmxnet3_probe_device(struct pci_dev *pdev,
else
#endif
num_rx_queues = 1;
num_rx_queues = rounddown_pow_of_two(num_rx_queues);

if (enable_mq)
num_tx_queues = min(VMXNET3_DEVICE_MAX_TX_QUEUES,
(int)num_online_cpus());
else
num_tx_queues = 1;

num_tx_queues = rounddown_pow_of_two(num_tx_queues);
netdev = alloc_etherdev_mq(sizeof(struct vmxnet3_adapter),
max(num_tx_queues, num_rx_queues));
if (!netdev)
Expand Down Expand Up @@ -3525,6 +3523,8 @@ vmxnet3_probe_device(struct pci_dev *pdev,
}
} else {
adapter->queuesExtEnabled = false;
num_rx_queues = rounddown_pow_of_two(num_rx_queues);
num_tx_queues = rounddown_pow_of_two(num_tx_queues);
adapter->num_rx_queues = min(num_rx_queues,
VMXNET3_DEVICE_DEFAULT_RX_QUEUES);
adapter->num_tx_queues = min(num_tx_queues,
Expand Down Expand Up @@ -3705,7 +3705,9 @@ vmxnet3_remove_device(struct pci_dev *pdev)
else
#endif
num_rx_queues = 1;
num_rx_queues = rounddown_pow_of_two(num_rx_queues);
if (!VMXNET3_VERSION_GE_6(adapter)) {
num_rx_queues = rounddown_pow_of_two(num_rx_queues);
}
if (VMXNET3_VERSION_GE_6(adapter)) {
spin_lock_irqsave(&adapter->cmd_lock, flags);
VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD,
Expand Down

0 comments on commit 15ccf2f

Please sign in to comment.