]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
bnxt_en: Improve bnxt_ulp_stop()/bnxt_ulp_start() call sequence.
authorVasundhara Volam <vasundhara-v.volam@broadcom.com>
Thu, 31 Oct 2019 05:07:49 +0000 (01:07 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 28 Jul 2021 11:30:56 +0000 (13:30 +0200)
[ Upstream commit aa46dffff452f7c6d907c4e6a0062e2c53a87fc0 ]

We call bnxt_ulp_stop() to notify the RDMA driver that some error or
imminent reset is about to happen.  After that we always call
some variants of bnxt_close().

In the next patch, we will integrate the recently added error
recovery with the RDMA driver.  In response to ulp_stop, the
RDMA driver may free MSIX vectors and that will also trigger
bnxt_close().  To avoid bnxt_close() from being called twice,
we set a new flag after ulp_stop is called.  If the RDMA driver
frees MSIX vectors while the new flag is set, we will not call
bnxt_close(), knowing that it will happen in due course.

With this change, we must make sure that the bnxt_close() call
after ulp_stop will reset IRQ.  Modify bnxt_reset_task()
accordingly if we call ulp_stop.

Signed-off-by: Vasundhara Volam <vasundhara-v.volam@broadcom.com>
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/broadcom/bnxt/bnxt.c
drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c
drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.h

index d1c3939b0307fcf875ab28537c0a0b507097d6d8..e840aae894ff206ebfaa6aa6c82f4de0b0802776 100644 (file)
@@ -9987,12 +9987,15 @@ static void bnxt_reset_task(struct bnxt *bp, bool silent)
        if (netif_running(bp->dev)) {
                int rc;
 
-               if (!silent)
+               if (silent) {
+                       bnxt_close_nic(bp, false, false);
+                       bnxt_open_nic(bp, false, false);
+               } else {
                        bnxt_ulp_stop(bp);
-               bnxt_close_nic(bp, false, false);
-               rc = bnxt_open_nic(bp, false, false);
-               if (!silent && !rc)
-                       bnxt_ulp_start(bp);
+                       bnxt_close_nic(bp, true, false);
+                       rc = bnxt_open_nic(bp, true, false);
+                       bnxt_ulp_start(bp, rc);
+               }
        }
 }
 
@@ -12144,10 +12147,9 @@ static pci_ers_result_t bnxt_io_slot_reset(struct pci_dev *pdev)
                if (!err && netif_running(netdev))
                        err = bnxt_open(netdev);
 
-               if (!err) {
+               if (!err)
                        result = PCI_ERS_RESULT_RECOVERED;
-                       bnxt_ulp_start(bp);
-               }
+               bnxt_ulp_start(bp, err);
        }
 
        if (result != PCI_ERS_RESULT_RECOVERED) {
index 13ef6a9afaa09978d0e506794ded0006ec99cff8..85bacaed763e8bec077bbd0d3732074f4dfc8f27 100644 (file)
@@ -186,7 +186,7 @@ static int bnxt_free_msix_vecs(struct bnxt_en_dev *edev, int ulp_id)
 
        edev->ulp_tbl[ulp_id].msix_requested = 0;
        edev->flags &= ~BNXT_EN_FLAG_MSIX_REQUESTED;
-       if (netif_running(dev)) {
+       if (netif_running(dev) && !(edev->flags & BNXT_EN_FLAG_ULP_STOPPED)) {
                bnxt_close_nic(bp, true, false);
                bnxt_open_nic(bp, true, false);
        }
@@ -274,6 +274,7 @@ void bnxt_ulp_stop(struct bnxt *bp)
        if (!edev)
                return;
 
+       edev->flags |= BNXT_EN_FLAG_ULP_STOPPED;
        for (i = 0; i < BNXT_MAX_ULP; i++) {
                struct bnxt_ulp *ulp = &edev->ulp_tbl[i];
 
@@ -284,7 +285,7 @@ void bnxt_ulp_stop(struct bnxt *bp)
        }
 }
 
-void bnxt_ulp_start(struct bnxt *bp)
+void bnxt_ulp_start(struct bnxt *bp, int err)
 {
        struct bnxt_en_dev *edev = bp->edev;
        struct bnxt_ulp_ops *ops;
@@ -293,6 +294,11 @@ void bnxt_ulp_start(struct bnxt *bp)
        if (!edev)
                return;
 
+       edev->flags &= ~BNXT_EN_FLAG_ULP_STOPPED;
+
+       if (err)
+               return;
+
        for (i = 0; i < BNXT_MAX_ULP; i++) {
                struct bnxt_ulp *ulp = &edev->ulp_tbl[i];
 
index cd78453d0bf0f2735b382a52e0ee67daf3421db7..9895406b9830810583db87b0507225fda03a1386 100644 (file)
@@ -64,6 +64,7 @@ struct bnxt_en_dev {
        #define BNXT_EN_FLAG_ROCE_CAP           (BNXT_EN_FLAG_ROCEV1_CAP | \
                                                 BNXT_EN_FLAG_ROCEV2_CAP)
        #define BNXT_EN_FLAG_MSIX_REQUESTED     0x4
+       #define BNXT_EN_FLAG_ULP_STOPPED        0x8
        const struct bnxt_en_ops        *en_ops;
        struct bnxt_ulp                 ulp_tbl[BNXT_MAX_ULP];
 };
@@ -92,7 +93,7 @@ int bnxt_get_ulp_msix_num(struct bnxt *bp);
 int bnxt_get_ulp_msix_base(struct bnxt *bp);
 int bnxt_get_ulp_stat_ctxs(struct bnxt *bp);
 void bnxt_ulp_stop(struct bnxt *bp);
-void bnxt_ulp_start(struct bnxt *bp);
+void bnxt_ulp_start(struct bnxt *bp, int err);
 void bnxt_ulp_sriov_cfg(struct bnxt *bp, int num_vfs);
 void bnxt_ulp_shutdown(struct bnxt *bp);
 void bnxt_ulp_irq_stop(struct bnxt *bp);