Netdev List
 help / color / mirror / Atom feed
From: "Michael Chan" <mchan@broadcom.com>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org
Subject: [PATCH 1/6 net-next] bnx2: Handle error condition in ->slot_reset()
Date: Tue, 6 Aug 2013 15:50:07 -0700	[thread overview]
Message-ID: <1375829412-26425-2-git-send-email-mchan@broadcom.com> (raw)
In-Reply-To: <1375829412-26425-1-git-send-email-mchan@broadcom.com>

by closing the device if necessary.  Otherwise, since NAPI state is
already disabled, a subsequent close will hang the system.

Signed-off-by: Michael Chan <mchan@broadcom.com>
---
 drivers/net/ethernet/broadcom/bnx2.c |   15 ++++++++++-----
 1 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ethernet/broadcom/bnx2.c b/drivers/net/ethernet/broadcom/bnx2.c
index 6a2de1d..3baf8b5 100644
--- a/drivers/net/ethernet/broadcom/bnx2.c
+++ b/drivers/net/ethernet/broadcom/bnx2.c
@@ -8694,14 +8694,13 @@ static pci_ers_result_t bnx2_io_slot_reset(struct pci_dev *pdev)
 {
 	struct net_device *dev = pci_get_drvdata(pdev);
 	struct bnx2 *bp = netdev_priv(dev);
-	pci_ers_result_t result;
-	int err;
+	pci_ers_result_t result = PCI_ERS_RESULT_DISCONNECT;
+	int err = 0;
 
 	rtnl_lock();
 	if (pci_enable_device(pdev)) {
 		dev_err(&pdev->dev,
 			"Cannot re-enable PCI device after reset\n");
-		result = PCI_ERS_RESULT_DISCONNECT;
 	} else {
 		pci_set_master(pdev);
 		pci_restore_state(pdev);
@@ -8709,9 +8708,15 @@ static pci_ers_result_t bnx2_io_slot_reset(struct pci_dev *pdev)
 
 		if (netif_running(dev)) {
 			bnx2_set_power_state(bp, PCI_D0);
-			bnx2_init_nic(bp, 1);
+			err = bnx2_init_nic(bp, 1);
 		}
-		result = PCI_ERS_RESULT_RECOVERED;
+		if (!err)
+			result = PCI_ERS_RESULT_RECOVERED;
+	}
+
+	if (result != PCI_ERS_RESULT_RECOVERED && netif_running(dev)) {
+		bnx2_napi_enable(bp);
+		dev_close(dev);
 	}
 	rtnl_unlock();
 
-- 
1.7.1

  reply	other threads:[~2013-08-06 22:28 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-06 22:50 [PATCH 0/6 net-next] bnx2 EEH and WoL/PM patches Michael Chan
2013-08-06 22:50 ` Michael Chan [this message]
2013-08-06 22:50   ` [PATCH 2/6 net-next] bnx2: Use kernel APIs for WoL and power state changes Michael Chan
2013-08-06 22:50     ` [PATCH 3/6 net-next] bnx2: Refactor WoL setup into a separate function Michael Chan
2013-08-06 22:50       ` [PATCH 4/6 net-next] bnx2: Use SIMPLE_DEV_PM_OPS Michael Chan
2013-08-06 22:50         ` [PATCH 5/6 net-next] bnx2: Add pci shutdown handler Michael Chan
2013-08-06 22:50           ` [PATCH 6/6 net-next] bnx2: Update version to 2.2.4 Michael Chan
2013-08-07 17:45 ` [PATCH 0/6 net-next] bnx2 EEH and WoL/PM patches 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=1375829412-26425-2-git-send-email-mchan@broadcom.com \
    --to=mchan@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