]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
bnxt_en: Do function reset on the 1st PF open only.
authorMichael Chan <michael.chan@broadcom.com>
Fri, 1 Jul 2016 22:46:21 +0000 (18:46 -0400)
committerDhaval Giani <dhaval.giani@oracle.com>
Fri, 20 Jan 2017 17:57:33 +0000 (12:57 -0500)
Orabug: 24567991

Calling the firmware to do function reset on the PF will kill all the VFs.
To prevent that, we call function reset on the 1st PF open before any VF
can be activated.  On subsequent PF opens (with possibly some active VFs),
a bit has been set and we'll skip the function reset.  VF driver will
always do function reset on every open.  If there is an AER event, we will
always do function reset.

Signed-off-by: Michael Chan <michael.chan@broadocm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 2a5bedfa674cf81d60a20a76f456778834bd2123)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
Signed-off-by: Dhaval Giani <dhaval.giani@oracle.com>
drivers/net/ethernet/broadcom/bnxt/bnxt.c
drivers/net/ethernet/broadcom/bnxt/bnxt.h

index 09c5babf456948087663bc3eac1c9b6e951fb900..bbf3cf7d7100a36c6cf9f891074cc425bd259d3d 100644 (file)
@@ -5315,12 +5315,19 @@ static int bnxt_open(struct net_device *dev)
        struct bnxt *bp = netdev_priv(dev);
        int rc = 0;
 
-       rc = bnxt_hwrm_func_reset(bp);
-       if (rc) {
-               netdev_err(bp->dev, "hwrm chip reset failure rc: %x\n",
-                          rc);
-               rc = -1;
-               return rc;
+       if (!test_bit(BNXT_STATE_FN_RST_DONE, &bp->state)) {
+               rc = bnxt_hwrm_func_reset(bp);
+               if (rc) {
+                       netdev_err(bp->dev, "hwrm chip reset failure rc: %x\n",
+                                  rc);
+                       rc = -EBUSY;
+                       return rc;
+               }
+               /* Do func_reset during the 1st PF open only to prevent killing
+                * the VFs when the PF is brought down and up.
+                */
+               if (BNXT_PF(bp))
+                       set_bit(BNXT_STATE_FN_RST_DONE, &bp->state);
        }
        return __bnxt_open_nic(bp, true, true);
 }
@@ -6717,6 +6724,7 @@ static pci_ers_result_t bnxt_io_error_detected(struct pci_dev *pdev,
                                               pci_channel_state_t state)
 {
        struct net_device *netdev = pci_get_drvdata(pdev);
+       struct bnxt *bp = netdev_priv(netdev);
 
        netdev_info(netdev, "PCI I/O error detected\n");
 
@@ -6731,6 +6739,8 @@ static pci_ers_result_t bnxt_io_error_detected(struct pci_dev *pdev,
        if (netif_running(netdev))
                bnxt_close(netdev);
 
+       /* So that func_reset will be done during slot_reset */
+       clear_bit(BNXT_STATE_FN_RST_DONE, &bp->state);
        pci_disable_device(pdev);
        rtnl_unlock();
 
index 084b3f2a8fc0543ee19110d5a49e48b805e13d1a..1d5a3cdefcf31eb9a433b7408ac48a06553b6296 100644 (file)
@@ -1018,6 +1018,7 @@ struct bnxt {
        unsigned long           state;
 #define BNXT_STATE_OPEN                0
 #define BNXT_STATE_IN_SP_TASK  1
+#define BNXT_STATE_FN_RST_DONE 2
 
        struct bnxt_irq *irq_tbl;
        u8                      mac_addr[ETH_ALEN];