Skip to content

Commit dbd15b8

Browse files
dcskidmoJeff Kirsher
authored andcommitted
ixgbe: Place SWFW semaphore in known valid state at probe
It is possible on some HW that a system reset could occur when we are holding the SWFW semaphore lock. So next time the driver was loaded we would see it incorrectly as locked. This patch will recover from that state by: Attempting to acquire the semaphore and then regardless of whether or not it was acquire we immediately release it. This will force us into a known good state. Signed-off-by: Don Skidmore <[email protected]> Tested-by: Andrew Bowers <[email protected]> Signed-off-by: Jeff Kirsher <[email protected]>
1 parent c04f90e commit dbd15b8

File tree

7 files changed

+30
-0
lines changed

7 files changed

+30
-0
lines changed

drivers/net/ethernet/intel/ixgbe/ixgbe_82598.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1196,6 +1196,7 @@ static const struct ixgbe_mac_operations mac_ops_82598 = {
11961196
.set_fw_drv_ver = NULL,
11971197
.acquire_swfw_sync = &ixgbe_acquire_swfw_sync,
11981198
.release_swfw_sync = &ixgbe_release_swfw_sync,
1199+
.init_swfw_sync = NULL,
11991200
.get_thermal_sensor_data = NULL,
12001201
.init_thermal_sensor_thresh = NULL,
12011202
.prot_autoc_read = &prot_autoc_read_generic,

drivers/net/ethernet/intel/ixgbe/ixgbe_82599.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2228,6 +2228,7 @@ static const struct ixgbe_mac_operations mac_ops_82599 = {
22282228
.set_vlan_anti_spoofing = &ixgbe_set_vlan_anti_spoofing,
22292229
.acquire_swfw_sync = &ixgbe_acquire_swfw_sync,
22302230
.release_swfw_sync = &ixgbe_release_swfw_sync,
2231+
.init_swfw_sync = NULL,
22312232
.get_thermal_sensor_data = &ixgbe_get_thermal_sensor_data_generic,
22322233
.init_thermal_sensor_thresh = &ixgbe_init_thermal_sensor_thresh_generic,
22332234
.prot_autoc_read = &prot_autoc_read_82599,

drivers/net/ethernet/intel/ixgbe/ixgbe_main.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9126,6 +9126,10 @@ static int ixgbe_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
91269126
if (err)
91279127
goto err_sw_init;
91289128

9129+
/* Make sure the SWFW semaphore is in a valid state */
9130+
if (hw->mac.ops.init_swfw_sync)
9131+
hw->mac.ops.init_swfw_sync(hw);
9132+
91299133
/* Make it possible the adapter to be woken up via WOL */
91309134
switch (adapter->hw.mac.type) {
91319135
case ixgbe_mac_82599EB:

drivers/net/ethernet/intel/ixgbe/ixgbe_type.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3266,6 +3266,7 @@ struct ixgbe_mac_operations {
32663266
s32 (*enable_rx_dma)(struct ixgbe_hw *, u32);
32673267
s32 (*acquire_swfw_sync)(struct ixgbe_hw *, u32);
32683268
void (*release_swfw_sync)(struct ixgbe_hw *, u32);
3269+
void (*init_swfw_sync)(struct ixgbe_hw *);
32693270
s32 (*prot_autoc_read)(struct ixgbe_hw *, bool *, u32 *);
32703271
s32 (*prot_autoc_write)(struct ixgbe_hw *, u32, bool);
32713272

drivers/net/ethernet/intel/ixgbe/ixgbe_x540.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -746,6 +746,25 @@ static void ixgbe_release_swfw_sync_semaphore(struct ixgbe_hw *hw)
746746
IXGBE_WRITE_FLUSH(hw);
747747
}
748748

749+
/**
750+
* ixgbe_init_swfw_sync_X540 - Release hardware semaphore
751+
* @hw: pointer to hardware structure
752+
*
753+
* This function reset hardware semaphore bits for a semaphore that may
754+
* have be left locked due to a catastrophic failure.
755+
**/
756+
void ixgbe_init_swfw_sync_X540(struct ixgbe_hw *hw)
757+
{
758+
/* First try to grab the semaphore but we don't need to bother
759+
* looking to see whether we got the lock or not since we do
760+
* the same thing regardless of whether we got the lock or not.
761+
* We got the lock - we release it.
762+
* We timeout trying to get the lock - we force its release.
763+
*/
764+
ixgbe_get_swfw_sync_semaphore(hw);
765+
ixgbe_release_swfw_sync_semaphore(hw);
766+
}
767+
749768
/**
750769
* ixgbe_blink_led_start_X540 - Blink LED based on index.
751770
* @hw: pointer to hardware structure
@@ -854,6 +873,7 @@ static const struct ixgbe_mac_operations mac_ops_X540 = {
854873
.set_vlan_anti_spoofing = &ixgbe_set_vlan_anti_spoofing,
855874
.acquire_swfw_sync = &ixgbe_acquire_swfw_sync_X540,
856875
.release_swfw_sync = &ixgbe_release_swfw_sync_X540,
876+
.init_swfw_sync = &ixgbe_init_swfw_sync_X540,
857877
.disable_rx_buff = &ixgbe_disable_rx_buff_generic,
858878
.enable_rx_buff = &ixgbe_enable_rx_buff_generic,
859879
.get_thermal_sensor_data = NULL,

drivers/net/ethernet/intel/ixgbe/ixgbe_x540.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,5 @@ s32 ixgbe_blink_led_start_X540(struct ixgbe_hw *hw, u32 index);
3636
s32 ixgbe_blink_led_stop_X540(struct ixgbe_hw *hw, u32 index);
3737
s32 ixgbe_acquire_swfw_sync_X540(struct ixgbe_hw *hw, u32 mask);
3838
void ixgbe_release_swfw_sync_X540(struct ixgbe_hw *hw, u32 mask);
39+
void ixgbe_init_swfw_sync_X540(struct ixgbe_hw *hw);
3940
s32 ixgbe_init_eeprom_params_X540(struct ixgbe_hw *hw);

drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2432,6 +2432,7 @@ static const struct ixgbe_mac_operations mac_ops_X550 = {
24322432
.setup_sfp = NULL,
24332433
.acquire_swfw_sync = &ixgbe_acquire_swfw_sync_X540,
24342434
.release_swfw_sync = &ixgbe_release_swfw_sync_X540,
2435+
.init_swfw_sync = &ixgbe_init_swfw_sync_X540,
24352436
.prot_autoc_read = prot_autoc_read_generic,
24362437
.prot_autoc_write = prot_autoc_write_generic,
24372438
.setup_fc = ixgbe_setup_fc_generic,
@@ -2449,6 +2450,7 @@ static const struct ixgbe_mac_operations mac_ops_X550EM_x = {
24492450
.setup_sfp = ixgbe_setup_sfp_modules_X550em,
24502451
.acquire_swfw_sync = &ixgbe_acquire_swfw_sync_X550em,
24512452
.release_swfw_sync = &ixgbe_release_swfw_sync_X550em,
2453+
.init_swfw_sync = &ixgbe_init_swfw_sync_X540,
24522454
.setup_fc = NULL, /* defined later */
24532455
};
24542456

0 commit comments

Comments
 (0)