Commit eebb02b1 authored by Shreyas Bhatewara's avatar Shreyas Bhatewara Committed by David S. Miller

vmxnet3: round down # of queues to power of two

vmxnet3 device supports only power-of-two number of queues. The driver
therefore needs to check this and rounds down the number of queues to the
nearest power of two.
Signed-off-by: default avatarYong Wang <yongwang@vmware.com>
Signed-off-by: default avatarShreyas N Bhatewara <sbhatewara@vmware.com>
Reviewed-by: default avatarDmitry Torokhov <dtor@vmware.com>
parent 2e98e797
...@@ -2947,6 +2947,7 @@ vmxnet3_probe_device(struct pci_dev *pdev, ...@@ -2947,6 +2947,7 @@ vmxnet3_probe_device(struct pci_dev *pdev,
else else
#endif #endif
num_rx_queues = 1; num_rx_queues = 1;
num_rx_queues = rounddown_pow_of_two(num_rx_queues);
if (enable_mq) if (enable_mq)
num_tx_queues = min(VMXNET3_DEVICE_MAX_TX_QUEUES, num_tx_queues = min(VMXNET3_DEVICE_MAX_TX_QUEUES,
...@@ -2954,6 +2955,7 @@ vmxnet3_probe_device(struct pci_dev *pdev, ...@@ -2954,6 +2955,7 @@ vmxnet3_probe_device(struct pci_dev *pdev,
else else
num_tx_queues = 1; num_tx_queues = 1;
num_tx_queues = rounddown_pow_of_two(num_tx_queues);
netdev = alloc_etherdev_mq(sizeof(struct vmxnet3_adapter), netdev = alloc_etherdev_mq(sizeof(struct vmxnet3_adapter),
max(num_tx_queues, num_rx_queues)); max(num_tx_queues, num_rx_queues));
printk(KERN_INFO "# of Tx queues : %d, # of Rx queues : %d\n", printk(KERN_INFO "# of Tx queues : %d, # of Rx queues : %d\n",
...@@ -3138,6 +3140,7 @@ vmxnet3_remove_device(struct pci_dev *pdev) ...@@ -3138,6 +3140,7 @@ vmxnet3_remove_device(struct pci_dev *pdev)
else else
#endif #endif
num_rx_queues = 1; num_rx_queues = 1;
num_rx_queues = rounddown_pow_of_two(num_rx_queues);
cancel_work_sync(&adapter->work); cancel_work_sync(&adapter->work);
......
...@@ -55,6 +55,7 @@ ...@@ -55,6 +55,7 @@
#include <linux/if_vlan.h> #include <linux/if_vlan.h>
#include <linux/if_arp.h> #include <linux/if_arp.h>
#include <linux/inetdevice.h> #include <linux/inetdevice.h>
#include <linux/log2.h>
#include "vmxnet3_defs.h" #include "vmxnet3_defs.h"
...@@ -68,10 +69,10 @@ ...@@ -68,10 +69,10 @@
/* /*
* Version numbers * Version numbers
*/ */
#define VMXNET3_DRIVER_VERSION_STRING "1.1.14.0-k" #define VMXNET3_DRIVER_VERSION_STRING "1.1.18.0-k"
/* a 32-bit int, each byte encode a verion number in VMXNET3_DRIVER_VERSION */ /* a 32-bit int, each byte encode a verion number in VMXNET3_DRIVER_VERSION */
#define VMXNET3_DRIVER_VERSION_NUM 0x01010E00 #define VMXNET3_DRIVER_VERSION_NUM 0x01011200
#if defined(CONFIG_PCI_MSI) #if defined(CONFIG_PCI_MSI)
/* RSS only makes sense if MSI-X is supported. */ /* RSS only makes sense if MSI-X is supported. */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment