netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Michael Chan <michael.chan@broadcom.com>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org
Subject: [PATCH net 7/8] bnxt_en: close & open NIC, only when the interface is in running state.
Date: Fri,  9 Mar 2018 23:46:09 -0500	[thread overview]
Message-ID: <1520657170-398-8-git-send-email-michael.chan@broadcom.com> (raw)
In-Reply-To: <1520657170-398-1-git-send-email-michael.chan@broadcom.com>

From: Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>

bnxt_restore_pf_fw_resources routine frees PF resources by calling
close_nic and allocates the resources back, by doing open_nic. However,
this is not needed, if the PF is already in closed state.

This bug causes the driver to call open the device and call request_irq()
when it is not needed.  Ultimately, pci_disable_msix() will crash
when bnxt_en is unloaded.

This patch fixes the problem by skipping __bnxt_close_nic and
__bnxt_open_nic inside bnxt_restore_pf_fw_resources routine, if the
interface is not running.

Fixes: 80fcaf46c092 ("bnxt_en: Restore MSIX after disabling SRIOV.")
Signed-off-by: Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
---
 drivers/net/ethernet/broadcom/bnxt/bnxt.c | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
index cbdb54f..cc9569f 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
@@ -8432,13 +8432,20 @@ int bnxt_restore_pf_fw_resources(struct bnxt *bp)
 		return 0;
 
 	bnxt_hwrm_func_qcaps(bp);
-	__bnxt_close_nic(bp, true, false);
+
+	if (netif_running(bp->dev))
+		__bnxt_close_nic(bp, true, false);
+
 	bnxt_clear_int_mode(bp);
 	rc = bnxt_init_int_mode(bp);
-	if (rc)
-		dev_close(bp->dev);
-	else
-		rc = bnxt_open_nic(bp, true, false);
+
+	if (netif_running(bp->dev)) {
+		if (rc)
+			dev_close(bp->dev);
+		else
+			rc = bnxt_open_nic(bp, true, false);
+	}
+
 	return rc;
 }
 
-- 
1.8.3.1

  parent reply	other threads:[~2018-03-10  4:46 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-10  4:46 [PATCH net 0/8] bnxt_en: Bug fixes Michael Chan
2018-03-10  4:46 ` [PATCH net 1/8] bnxt_en: Refactor the functions to reserve hardware rings Michael Chan
2018-03-10  4:46 ` [PATCH net 2/8] bnxt_en: Fix vnic accounting in the bnxt_check_rings() path Michael Chan
2018-03-10  4:46 ` [PATCH net 3/8] bnxt_en: Remove unwanted ovs-offload messages in some conditions Michael Chan
2018-03-10  4:46 ` [PATCH net 4/8] bnxt_en: Pass complete VLAN TCI to the stack Michael Chan
2018-03-10  4:46 ` [PATCH net 5/8] bnxt_en: Fix regressions when setting up MQPRIO TX rings Michael Chan
2018-03-10  4:46 ` [PATCH net 6/8] bnxt_en: Return standard Linux error codes for hwrm flow cmds Michael Chan
2018-03-10  4:46 ` Michael Chan [this message]
2018-03-10  4:46 ` [PATCH net 8/8] bnxt_en: Check valid VNIC ID in bnxt_hwrm_vnic_set_tpa() Michael Chan
2018-03-12 14:58 ` [PATCH net 0/8] bnxt_en: Bug fixes David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1520657170-398-8-git-send-email-michael.chan@broadcom.com \
    --to=michael.chan@broadcom.com \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).