Skip to content

Commit e3215f0

Browse files
etantilovJeff Kirsher
authored andcommitted
ixgbe: fix race when setting advertised speed
Following commands: modprobe ixgbe ifconfig ethX up ethtool -s ethX advertise 0x020 can lead to "setup link failed with code -14" error due to the setup_link call racing with the SFP detection routine in the watchdog. This patch resolves this issue by protecting the setup_link call with check for __IXGBE_IN_SFP_INIT. Reported-by: Scott Harrison <scoharr2@cisco.com> Signed-off-by: Emil Tantilov <emil.s.tantilov@intel.com> Tested-by: Phil Schmitt <phillip.j.schmitt@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
1 parent 4d2fcfb commit e3215f0

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

‎drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,12 +342,16 @@ static int ixgbe_set_settings(struct net_device *netdev,
342342
if (old == advertised)
343343
return err;
344344
/* this sets the link speed and restarts auto-neg */
345+
while (test_and_set_bit(__IXGBE_IN_SFP_INIT, &adapter->state))
346+
usleep_range(1000, 2000);
347+
345348
hw->mac.autotry_restart = true;
346349
err = hw->mac.ops.setup_link(hw, advertised, true);
347350
if (err) {
348351
e_info(probe, "setup link failed with code %d\n", err);
349352
hw->mac.ops.setup_link(hw, old, true);
350353
}
354+
clear_bit(__IXGBE_IN_SFP_INIT, &adapter->state);
351355
} else {
352356
/* in this case we currently only support 10Gb/FULL */
353357
u32 speed = ethtool_cmd_speed(ecmd);

0 commit comments

Comments
 (0)