netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Nathan Fontenot <nfont@linux.vnet.ibm.com>
To: netdev@vger.kernel.org, tlfalcon@linux.vnet.ibm.com,
	jallen@linux.vnet.ibm.com
Subject: [PATCH net-next 05/11] ibmvnic: Non-fatal error handling
Date: Fri, 26 May 2017 10:30:37 -0400	[thread overview]
Message-ID: <20170526143037.63648.45770.stgit@ltcalpine2-lp14.aus.stglabs.ibm.com> (raw)
In-Reply-To: <20170526142523.63648.62938.stgit@ltcalpine2-lp14.aus.stglabs.ibm.com>

From: John Allen <jallen@linux.vnet.ibm.com>

Handle non-fatal error conditions. The process to do this when
resetting the driver is to just do __ibmvnic_close followed by
__ibmvnic_open.

Signed-off-by: John Allen <jallen@linux.vnet.ibm.com>
---
 drivers/net/ethernet/ibm/ibmvnic.c |   56 ++++++++++++++++++++----------------
 drivers/net/ethernet/ibm/ibmvnic.h |    1 +
 2 files changed, 32 insertions(+), 25 deletions(-)

diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c
index 0f705e6..def867a 100644
--- a/drivers/net/ethernet/ibm/ibmvnic.c
+++ b/drivers/net/ethernet/ibm/ibmvnic.c
@@ -1225,37 +1225,41 @@ static int do_reset(struct ibmvnic_adapter *adapter,
 	if (rc)
 		return rc;
 
-	/* remove the closed state so when we call open it appears
-	 * we are coming from the probed state.
-	 */
-	adapter->state = VNIC_PROBED;
+	if (adapter->reset_reason != VNIC_RESET_NON_FATAL) {
+		/* remove the closed state so when we call open it appears
+		 * we are coming from the probed state.
+		 */
+		adapter->state = VNIC_PROBED;
 
-	release_resources(adapter);
-	release_sub_crqs(adapter);
-	release_crq_queue(adapter);
+		release_resources(adapter);
+		release_sub_crqs(adapter);
+		release_crq_queue(adapter);
 
-	rc = ibmvnic_init(adapter);
-	if (rc)
-		return 0;
+		rc = ibmvnic_init(adapter);
+		if (rc)
+			return 0;
 
-	/* If the adapter was in PROBE state prior to the reset, exit here. */
-	if (reset_state == VNIC_PROBED)
-		return 0;
+		/* If the adapter was in PROBE state prior to the reset,
+		 * exit here.
+		 */
+		if (reset_state == VNIC_PROBED)
+			return 0;
 
-	rc = ibmvnic_login(netdev);
-	if (rc) {
-		adapter->state = VNIC_PROBED;
-		return 0;
-	}
+		rc = ibmvnic_login(netdev);
+		if (rc) {
+			adapter->state = VNIC_PROBED;
+			return 0;
+		}
 
-	rtnl_lock();
-	rc = init_resources(adapter);
-	rtnl_unlock();
-	if (rc)
-		return rc;
+		rtnl_lock();
+		rc = init_resources(adapter);
+		rtnl_unlock();
+		if (rc)
+			return rc;
 
-	if (reset_state == VNIC_CLOSED)
-		return 0;
+		if (reset_state == VNIC_CLOSED)
+			return 0;
+	}
 
 	rc = __ibmvnic_open(netdev);
 	if (rc) {
@@ -2763,6 +2767,8 @@ static void handle_error_indication(union ibmvnic_crq *crq,
 
 	if (crq->error_indication.flags & IBMVNIC_FATAL_ERROR)
 		ibmvnic_reset(adapter, VNIC_RESET_FATAL);
+	else
+		ibmvnic_reset(adapter, VNIC_RESET_NON_FATAL);
 }
 
 static void handle_change_mac_rsp(union ibmvnic_crq *crq,
diff --git a/drivers/net/ethernet/ibm/ibmvnic.h b/drivers/net/ethernet/ibm/ibmvnic.h
index fa6ac4e..7e2300e 100644
--- a/drivers/net/ethernet/ibm/ibmvnic.h
+++ b/drivers/net/ethernet/ibm/ibmvnic.h
@@ -925,6 +925,7 @@ enum vnic_state {VNIC_PROBING = 1,
 enum ibmvnic_reset_reason {VNIC_RESET_FAILOVER = 1,
 			   VNIC_RESET_MOBILITY,
 			   VNIC_RESET_FATAL,
+			   VNIC_RESET_NON_FATAL,
 			   VNIC_RESET_TIMEOUT};
 
 struct ibmvnic_rwi {

  parent reply	other threads:[~2017-05-26 14:42 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-26 14:30 [PATCH net-next 00/11] ibmvnic: Driver updates Nathan Fontenot
2017-05-26 14:30 ` [PATCH net-next 01/11] ibmvnic: Track state of adapter napis Nathan Fontenot
2017-05-26 14:30 ` [PATCH net-next 02/11] ibmvnic: Handle failover after failed init crq Nathan Fontenot
2017-05-26 14:30 ` [PATCH net-next 03/11] ibmvnic: Send gratuitous arp on reset Nathan Fontenot
2017-05-26 14:30 ` [PATCH net-next 04/11] ibmvnic: Fix cleanup of SKB's on driver close Nathan Fontenot
2017-05-26 14:30 ` Nathan Fontenot [this message]
2017-05-26 14:30 ` [PATCH net-next 06/11] ibmvnic: Halt TX and report carrier off on H_CLOSED return code Nathan Fontenot
2017-05-26 14:30 ` [PATCH net-next 07/11] ibmvnic: Deactivate RX pool buffer replenishment on H_CLOSED Nathan Fontenot
2017-05-26 14:30 ` [PATCH net-next 08/11] ibmvnic: Check adapter state during ibmvnic_poll Nathan Fontenot
2017-05-26 14:31 ` [PATCH net-next 09/11] ibmvnic: Reset the CRQ queue during driver reset Nathan Fontenot
2017-05-26 14:31 ` [PATCH net-next 10/11] ibmvnic: Reset tx/rx pools on " Nathan Fontenot
2017-05-26 14:31 ` [PATCH net-next 11/11] ibmvnic: Reset sub-crqs during " Nathan Fontenot
2017-05-26 19:33 ` [PATCH net-next 00/11] ibmvnic: Driver updates 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=20170526143037.63648.45770.stgit@ltcalpine2-lp14.aus.stglabs.ibm.com \
    --to=nfont@linux.vnet.ibm.com \
    --cc=jallen@linux.vnet.ibm.com \
    --cc=netdev@vger.kernel.org \
    --cc=tlfalcon@linux.vnet.ibm.com \
    /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).