net/bnx2x: fix MSIX vector and VF resource counts
authorCharles (Chas) Williams <ciwillia@brocade.com>
Fri, 10 Jun 2016 22:18:52 +0000 (18:18 -0400)
committerBruce Richardson <bruce.richardson@intel.com>
Tue, 21 Jun 2016 10:09:16 +0000 (12:09 +0200)
If MSIX is available, the vector count given by the table size is one
less than the actual count.  This count also limits the receive and
transmit queue resources the VF can support.

Fixes: 540a211084a7 ("bnx2x: driver core")

Signed-off-by: Charles (Chas) Williams <ciwillia@brocade.com>
Acked-by: Harish Patil <harish.patil@qlogic.com>
drivers/net/bnx2x/bnx2x.c

index f1bc2dd..3095d2b 100644 (file)
@@ -9552,8 +9552,10 @@ static int bnx2x_pci_get_caps(struct bnx2x_softc *sc)
 static void bnx2x_init_rte(struct bnx2x_softc *sc)
 {
        if (IS_VF(sc)) {
-               sc->max_tx_queues = BNX2X_VF_MAX_QUEUES_PER_VF;
-               sc->max_rx_queues = BNX2X_VF_MAX_QUEUES_PER_VF;
+               sc->max_tx_queues = min(BNX2X_VF_MAX_QUEUES_PER_VF,
+                                       sc->igu_sb_cnt);
+               sc->max_rx_queues = min(BNX2X_VF_MAX_QUEUES_PER_VF,
+                                       sc->igu_sb_cnt);
        } else {
                sc->max_tx_queues = 128;
                sc->max_rx_queues = 128;
@@ -9695,7 +9697,7 @@ int bnx2x_attach(struct bnx2x_softc *sc)
                pci_read(sc,
                         (sc->devinfo.pcie_msix_cap_reg + PCIR_MSIX_CTRL), &val,
                         2);
-               sc->igu_sb_cnt = (val & PCIM_MSIXCTRL_TABLE_SIZE);
+               sc->igu_sb_cnt = (val & PCIM_MSIXCTRL_TABLE_SIZE) + 1;
        } else {
                sc->igu_sb_cnt = 1;
        }