diff mbox series

[1/1] ibmvnic: retry reset if there are no other resets

Message ID 20210630183617.3093690-1-sukadev@linux.ibm.com (mailing list archive)
State Accepted
Commit 4f408e1fa6e10b6da72691233369172bac7d9e9b
Delegated to: Netdev Maintainers
Headers show
Series [1/1] ibmvnic: retry reset if there are no other resets | expand

Checks

Context Check Description
netdev/cover_letter success Link
netdev/fixes_present success Link
netdev/patch_count success Link
netdev/tree_selection success Guessed tree name to be net-next
netdev/subject_prefix warning Target tree name not specified in the subject
netdev/cc_maintainers warning 7 maintainers not CCed: tlfalcon@linux.ibm.com paulus@samba.org benh@kernel.crashing.org linuxppc-dev@lists.ozlabs.org mpe@ellerman.id.au davem@davemloft.net kuba@kernel.org
netdev/source_inline success Was 0 now: 0
netdev/verify_signedoff success Link
netdev/module_param success Was 0 now: 0
netdev/build_32bit success Errors and warnings before: 39 this patch: 39
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/verify_fixes success Link
netdev/checkpatch warning WARNING: networking block comments don't use an empty /* line, use /* Comment...
netdev/build_allmodconfig_warn success Errors and warnings before: 32 this patch: 32
netdev/header_inline success Link

Commit Message

Sukadev Bhattiprolu June 30, 2021, 6:36 p.m. UTC
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>
---
 drivers/net/ethernet/ibm/ibmvnic.c | 22 +++++++++++++++++++---
 1 file changed, 19 insertions(+), 3 deletions(-)

Comments

Dany Madden June 30, 2021, 7:04 p.m. UTC | #1
On 2021-06-30 11:36, Sukadev Bhattiprolu wrote:
> 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>

> ---
patchwork-bot+netdevbpf@kernel.org July 1, 2021, 8:20 p.m. UTC | #2
Hello:

This patch was applied to netdev/net.git (refs/heads/master):

On Wed, 30 Jun 2021 14:36:17 -0400 you wrote:
> 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.
> 
> [...]

Here is the summary with links:
  - [1/1] ibmvnic: retry reset if there are no other resets
    https://git.kernel.org/netdev/net/c/4f408e1fa6e1

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
diff mbox series

Patch

diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c
index 697b9714fc76..ff49cda142b0 100644
--- a/drivers/net/ethernet/ibm/ibmvnic.c
+++ b/drivers/net/ethernet/ibm/ibmvnic.c
@@ -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;
@@ -2489,7 +2490,7 @@  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)
@@ -2497,8 +2498,23 @@  static void __ibmvnic_reset(struct work_struct *work)
 
 		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;
 	}