be2net: fix max VFs reported by HW
authorVasundhara Volam <vasundhara.volam@emulex.com>
Tue, 28 Aug 2012 20:37:41 +0000 (20:37 +0000)
committerDavid S. Miller <davem@davemloft.net>
Thu, 30 Aug 2012 17:27:05 +0000 (13:27 -0400)
BE3 FW allocates VF resources for upto 30 VFs per PF while a max value of 32
may be reported via PCI config space. Fix this in the driver.

Signed-off-by: Vasundhara Volam <vasundhara.volam@emulex.com>
Signed-off-by: Sathya Perla <sathya.perla@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/emulex/benet/be.h
drivers/net/ethernet/emulex/benet/be_main.c

index d266c86a53f71245a3d344c2169696949f9afcb0..5b622993ff17049e07df51760399799705e96ea0 100644 (file)
@@ -110,6 +110,7 @@ static inline char *nic_name(struct pci_dev *pdev)
 #define MAX_RX_POST            BE_NAPI_WEIGHT /* Frags posted at a time */
 #define RX_FRAGS_REFILL_WM     (RX_Q_LEN - MAX_RX_POST)
 
+#define MAX_VFS                        30 /* Max VFs supported by BE3 FW */
 #define FW_VER_LEN             32
 
 struct be_dma_mem {
index d86d25cc33cf6554a3ccc420141a03e35adb5eb2..def2f668896491dd8df669cd9cda3658c406d0c6 100644 (file)
@@ -2723,6 +2723,8 @@ static int be_get_config(struct be_adapter *adapter)
        if (pos) {
                pci_read_config_word(adapter->pdev, pos + PCI_SRIOV_TOTAL_VF,
                                     &dev_num_vfs);
+               if (!lancer_chip(adapter))
+                       dev_num_vfs = min_t(u16, dev_num_vfs, MAX_VFS);
                adapter->dev_num_vfs = dev_num_vfs;
        }
        return 0;