Skip to content

Commit

Permalink
ibmvnic: retry reset if there are no other resets
Browse files Browse the repository at this point in the history
Normally, if a reset fails due to failover or other communication error
there is another reset (eg: FAILOVER) in the queue and we would process
that reset. But if we are unable to communicate with PHYP or VIOS after
H_FREE_CRQ, there would be no other resets in the queue and the adapter
would be in an undefined state even though it was in the OPEN state
earlier. While starting the reset we set the carrier to off state so
we won't even get the timeout resets.

If the last queued reset fails, retry it as a hard reset (after the
usual 60 second settling time).

Signed-off-by: Sukadev Bhattiprolu <sukadev@linux.ibm.com>
Reviewed-by: Dany Madden <drt@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Sukadev Bhattiprolu authored and David S. Miller committed Jul 1, 2021
1 parent b2bc814 commit 4f408e1
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions drivers/net/ethernet/ibm/ibmvnic.c
Original file line number Diff line number Diff line change
Expand Up @@ -2420,9 +2420,10 @@ static int do_passive_init(struct ibmvnic_adapter *adapter)

static void __ibmvnic_reset(struct work_struct *work)
{
struct ibmvnic_rwi *rwi;
struct ibmvnic_adapter *adapter;
bool saved_state = false;
struct ibmvnic_rwi *tmprwi;
struct ibmvnic_rwi *rwi;
unsigned long flags;
u32 reset_state;
int rc = 0;
Expand Down Expand Up @@ -2489,16 +2490,31 @@ static void __ibmvnic_reset(struct work_struct *work)
} else {
rc = do_reset(adapter, rwi, reset_state);
}
kfree(rwi);
tmprwi = rwi;
adapter->last_reset_time = jiffies;

if (rc)
netdev_dbg(adapter->netdev, "Reset failed, rc=%d\n", rc);

rwi = get_next_rwi(adapter);

/*
* If there is another reset queued, free the previous rwi
* and process the new reset even if previous reset failed
* (the previous reset could have failed because of a fail
* over for instance, so process the fail over).
*
* If there are no resets queued and the previous reset failed,
* the adapter would be in an undefined state. So retry the
* previous reset as a hard reset.
*/
if (rwi)
kfree(tmprwi);
else if (rc)
rwi = tmprwi;

if (rwi && (rwi->reset_reason == VNIC_RESET_FAILOVER ||
rwi->reset_reason == VNIC_RESET_MOBILITY))
rwi->reset_reason == VNIC_RESET_MOBILITY || rc))
adapter->force_reset_recovery = true;
}

Expand Down

0 comments on commit 4f408e1

Please sign in to comment.