]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
bnxt_en: Reset rings if ring reservation fails during open()
authorVasundhara Volam <vasundhara-v.volam@broadcom.com>
Sun, 22 Mar 2020 20:40:05 +0000 (16:40 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 1 Apr 2020 08:59:49 +0000 (10:59 +0200)
[ Upstream commit 5d765a5e4bd7c368e564e11402bba74cf7f03ac1 ]

If ring counts are not reset when ring reservation fails,
bnxt_init_dflt_ring_mode() will not be called again to reinitialise
IRQs when open() is called and results in system crash as napi will
also be not initialised. This patch fixes it by resetting the ring
counts.

Fixes: 47558acd56a7 ("bnxt_en: Reserve rings at driver open if none was reserved at probe time.")
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: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/net/ethernet/broadcom/bnxt/bnxt.c

index 9ad40bfdfd4fc6c8cd3956cdd8c82c8a921bc457..b92c4751866544fe589d4b6a4c634e69968568eb 100644 (file)
@@ -11666,6 +11666,10 @@ static int bnxt_set_dflt_rings(struct bnxt *bp, bool sh)
                bp->rx_nr_rings++;
                bp->cp_nr_rings++;
        }
+       if (rc) {
+               bp->tx_nr_rings = 0;
+               bp->rx_nr_rings = 0;
+       }
        return rc;
 }