summaryrefslogtreecommitdiffstats
path: root/drivers/net/benet
diff options
context:
space:
mode:
authorAjit Khaparde <ajit.khaparde@emulex.com>2011-04-06 18:08:17 +0000
committerDavid S. Miller <davem@davemloft.net>2011-04-07 15:04:45 -0700
commit81be8f0ab47db1171dac0eb8b062291603b57dd4 (patch)
tree91dbff61d5dda0a8be1c775cadddd15aea4c398c /drivers/net/benet
parentb0060586d23968d66325d775651d92ee830c032f (diff)
downloadtalos-op-linux-81be8f0ab47db1171dac0eb8b062291603b57dd4.tar.gz
talos-op-linux-81be8f0ab47db1171dac0eb8b062291603b57dd4.zip
be2net: fix to get max VFs supported from adapter
The user supplied num_vfs value need not be compared against a static BE_MAX_VF, but can be checked against the actual VFs that the device can support. Signed-off-by: Ajit Khaparde <ajit.khaparde@emulex.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/benet')
-rw-r--r--drivers/net/benet/be_main.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/drivers/net/benet/be_main.c b/drivers/net/benet/be_main.c
index d762c2a3dd9b..bc110782da88 100644
--- a/drivers/net/benet/be_main.c
+++ b/drivers/net/benet/be_main.c
@@ -1947,7 +1947,20 @@ static void be_sriov_enable(struct be_adapter *adapter)
be_check_sriov_fn_type(adapter);
#ifdef CONFIG_PCI_IOV
if (be_physfn(adapter) && num_vfs) {
- int status;
+ int status, pos;
+ u16 nvfs;
+
+ pos = pci_find_ext_capability(adapter->pdev,
+ PCI_EXT_CAP_ID_SRIOV);
+ pci_read_config_word(adapter->pdev,
+ pos + PCI_SRIOV_TOTAL_VF, &nvfs);
+
+ if (num_vfs > nvfs) {
+ dev_info(&adapter->pdev->dev,
+ "Device supports %d VFs and not %d\n",
+ nvfs, num_vfs);
+ num_vfs = nvfs;
+ }
status = pci_enable_sriov(adapter->pdev, num_vfs);
adapter->sriov_enabled = status ? false : true;
@@ -3284,13 +3297,6 @@ static int __init be_init_module(void)
rx_frag_size = 2048;
}
- if (num_vfs > 32) {
- printk(KERN_WARNING DRV_NAME
- " : Module param num_vfs must not be greater than 32."
- "Using 32\n");
- num_vfs = 32;
- }
-
return pci_register_driver(&be_driver);
}
module_init(be_init_module);
OpenPOWER on IntegriCloud