]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
ibmvnic: Allow extra failures before disabling
authorSukadev Bhattiprolu <sukadev@linux.ibm.com>
Sat, 22 Jan 2022 02:59:18 +0000 (18:59 -0800)
committerPaolo Pisati <paolo.pisati@canonical.com>
Thu, 3 Feb 2022 09:28:53 +0000 (10:28 +0100)
BugLink: https://bugs.launchpad.net/bugs/1959879
[ Upstream commit db9f0e8bf79e6da7068b5818fea0ffd9d0d4b4da ]

If auto-priority-failover (APF) is enabled and there are at least two
backing devices of different priorities, some resets like fail-over,
change-param etc can cause at least two back to back failovers. (Failover
from high priority backing device to lower priority one and then back
to the higher priority one if that is still functional).

Depending on the timimg of the two failovers it is possible to trigger
a "hard" reset and for the hard reset to fail due to failovers. When this
occurs, the driver assumes that the network is unstable and disables the
VNIC for a 60-second "settling time". This in turn can cause the ethtool
command to fail with "No such device" while the vnic automatically recovers
a little while later.

Given that it's possible to have two back to back failures, allow for extra
failures before disabling the vnic for the settling time.

Fixes: f15fde9d47b8 ("ibmvnic: delay next reset if hard reset fails")
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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
drivers/net/ethernet/ibm/ibmvnic.c

index 352ffe982d849b2bef82968d8c34fee390235274..191b3b7350182368f1f69588f878b9211e83991b 100644 (file)
@@ -2424,6 +2424,7 @@ static void __ibmvnic_reset(struct work_struct *work)
        struct ibmvnic_rwi *rwi;
        unsigned long flags;
        u32 reset_state;
+       int num_fails = 0;
        int rc = 0;
 
        adapter = container_of(work, struct ibmvnic_adapter, ibmvnic_reset);
@@ -2477,11 +2478,23 @@ static void __ibmvnic_reset(struct work_struct *work)
                                rc = do_hard_reset(adapter, rwi, reset_state);
                                rtnl_unlock();
                        }
-                       if (rc) {
-                               /* give backing device time to settle down */
+                       if (rc)
+                               num_fails++;
+                       else
+                               num_fails = 0;
+
+                       /* If auto-priority-failover is enabled we can get
+                        * back to back failovers during resets, resulting
+                        * in at least two failed resets (from high-priority
+                        * backing device to low-priority one and then back)
+                        * If resets continue to fail beyond that, give the
+                        * adapter some time to settle down before retrying.
+                        */
+                       if (num_fails >= 3) {
                                netdev_dbg(adapter->netdev,
-                                          "[S:%s] Hard reset failed, waiting 60 secs\n",
-                                          adapter_state_to_string(adapter->state));
+                                          "[S:%s] Hard reset failed %d times, waiting 60 secs\n",
+                                          adapter_state_to_string(adapter->state),
+                                          num_fails);
                                set_current_state(TASK_UNINTERRUPTIBLE);
                                schedule_timeout(60 * HZ);
                        }