ibmvnic: Non-fatal error handling
authorJohn Allen <jallen@linux.vnet.ibm.com>
Fri, 26 May 2017 14:30:37 +0000 (10:30 -0400)
committerDavid S. Miller <davem@davemloft.net>
Fri, 26 May 2017 19:32:45 +0000 (15:32 -0400)
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>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/ibm/ibmvnic.c
drivers/net/ethernet/ibm/ibmvnic.h

index 0f705e6..def867a 100644 (file)
@@ -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,
index fa6ac4e..7e2300e 100644 (file)
@@ -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 {