diff options
| author | Shreyas Bhatewara <sbhatewara@vmware.com> | 2011-07-07 03:25:52 -0400 |
|---|---|---|
| committer | David S. Miller <davem@davemloft.net> | 2011-07-07 03:25:52 -0400 |
| commit | eebb02b1f03b3722d678bfcb560f3b26661ab0d2 (patch) | |
| tree | 6a133a4faa1278c2faf93962c19269f93b076edc | |
| parent | 2e98e7974de208de0dab9e9969bd47576d07ff10 (diff) | |
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: Yong Wang <yongwang@vmware.com>
Signed-off-by: Shreyas N Bhatewara <sbhatewara@vmware.com>
Reviewed-by: Dmitry Torokhov <dtor@vmware.com>
| -rw-r--r-- | drivers/net/vmxnet3/vmxnet3_drv.c | 3 | ||||
| -rw-r--r-- | drivers/net/vmxnet3/vmxnet3_int.h | 5 |
2 files changed, 6 insertions, 2 deletions
diff --git a/drivers/net/vmxnet3/vmxnet3_drv.c b/drivers/net/vmxnet3/vmxnet3_drv.c index 45a23b2599f3..67402350d0df 100644 --- a/drivers/net/vmxnet3/vmxnet3_drv.c +++ b/drivers/net/vmxnet3/vmxnet3_drv.c | |||
| @@ -2947,6 +2947,7 @@ vmxnet3_probe_device(struct pci_dev *pdev, | |||
| 2947 | else | 2947 | else |
| 2948 | #endif | 2948 | #endif |
| 2949 | num_rx_queues = 1; | 2949 | num_rx_queues = 1; |
| 2950 | num_rx_queues = rounddown_pow_of_two(num_rx_queues); | ||
| 2950 | 2951 | ||
| 2951 | if (enable_mq) | 2952 | if (enable_mq) |
| 2952 | num_tx_queues = min(VMXNET3_DEVICE_MAX_TX_QUEUES, | 2953 | num_tx_queues = min(VMXNET3_DEVICE_MAX_TX_QUEUES, |
| @@ -2954,6 +2955,7 @@ vmxnet3_probe_device(struct pci_dev *pdev, | |||
| 2954 | else | 2955 | else |
| 2955 | num_tx_queues = 1; | 2956 | num_tx_queues = 1; |
| 2956 | 2957 | ||
| 2958 | num_tx_queues = rounddown_pow_of_two(num_tx_queues); | ||
| 2957 | netdev = alloc_etherdev_mq(sizeof(struct vmxnet3_adapter), | 2959 | netdev = alloc_etherdev_mq(sizeof(struct vmxnet3_adapter), |
| 2958 | max(num_tx_queues, num_rx_queues)); | 2960 | max(num_tx_queues, num_rx_queues)); |
| 2959 | printk(KERN_INFO "# of Tx queues : %d, # of Rx queues : %d\n", | 2961 | printk(KERN_INFO "# of Tx queues : %d, # of Rx queues : %d\n", |
| @@ -3138,6 +3140,7 @@ vmxnet3_remove_device(struct pci_dev *pdev) | |||
| 3138 | else | 3140 | else |
| 3139 | #endif | 3141 | #endif |
| 3140 | num_rx_queues = 1; | 3142 | num_rx_queues = 1; |
| 3143 | num_rx_queues = rounddown_pow_of_two(num_rx_queues); | ||
| 3141 | 3144 | ||
| 3142 | cancel_work_sync(&adapter->work); | 3145 | cancel_work_sync(&adapter->work); |
| 3143 | 3146 | ||
diff --git a/drivers/net/vmxnet3/vmxnet3_int.h b/drivers/net/vmxnet3/vmxnet3_int.h index 8db7ecf5bcab..e08d75e3f170 100644 --- a/drivers/net/vmxnet3/vmxnet3_int.h +++ b/drivers/net/vmxnet3/vmxnet3_int.h | |||
| @@ -55,6 +55,7 @@ | |||
| 55 | #include <linux/if_vlan.h> | 55 | #include <linux/if_vlan.h> |
| 56 | #include <linux/if_arp.h> | 56 | #include <linux/if_arp.h> |
| 57 | #include <linux/inetdevice.h> | 57 | #include <linux/inetdevice.h> |
| 58 | #include <linux/log2.h> | ||
| 58 | 59 | ||
| 59 | #include "vmxnet3_defs.h" | 60 | #include "vmxnet3_defs.h" |
| 60 | 61 | ||
| @@ -68,10 +69,10 @@ | |||
| 68 | /* | 69 | /* |
| 69 | * Version numbers | 70 | * Version numbers |
| 70 | */ | 71 | */ |
| 71 | #define VMXNET3_DRIVER_VERSION_STRING "1.1.14.0-k" | 72 | #define VMXNET3_DRIVER_VERSION_STRING "1.1.18.0-k" |
| 72 | 73 | ||
| 73 | /* a 32-bit int, each byte encode a verion number in VMXNET3_DRIVER_VERSION */ | 74 | /* a 32-bit int, each byte encode a verion number in VMXNET3_DRIVER_VERSION */ |
| 74 | #define VMXNET3_DRIVER_VERSION_NUM 0x01010E00 | 75 | #define VMXNET3_DRIVER_VERSION_NUM 0x01011200 |
| 75 | 76 | ||
| 76 | #if defined(CONFIG_PCI_MSI) | 77 | #if defined(CONFIG_PCI_MSI) |
| 77 | /* RSS only makes sense if MSI-X is supported. */ | 78 | /* RSS only makes sense if MSI-X is supported. */ |
