Skip to content

Commit 59dd45d

Browse files
sebastianbasierskiJeff Kirsher
authored andcommitted
ixgbe: firmware recovery mode
Add check for FW NVM recovery mode during driver initialization and service task. If in recovery mode, log message and unregister device Signed-off-by: Sebastian Basierski <[email protected]> Tested-by: Don Buchholz <[email protected]> Signed-off-by: Jeff Kirsher <[email protected]>
1 parent 050cdc6 commit 59dd45d

File tree

4 files changed

+71
-0
lines changed

4 files changed

+71
-0
lines changed

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3484,6 +3484,17 @@ void ixgbe_set_vlan_anti_spoofing(struct ixgbe_hw *hw, bool enable, int vf)
34843484
IXGBE_WRITE_REG(hw, IXGBE_PFVFSPOOF(vf_target_reg), pfvfspoof);
34853485
}
34863486

3487+
/**
3488+
* ixgbe_fw_recovery_mode - Check if in FW NVM recovery mode
3489+
* @hw: pointer to hardware structure
3490+
*/
3491+
bool ixgbe_fw_recovery_mode(struct ixgbe_hw *hw)
3492+
{
3493+
if (hw->mac.ops.fw_recovery_mode)
3494+
return hw->mac.ops.fw_recovery_mode(hw);
3495+
return false;
3496+
}
3497+
34873498
/**
34883499
* ixgbe_get_device_caps_generic - Get additional device capabilities
34893500
* @hw: pointer to hardware structure

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

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7774,6 +7774,33 @@ static void ixgbe_reset_subtask(struct ixgbe_adapter *adapter)
77747774
rtnl_unlock();
77757775
}
77767776

7777+
/**
7778+
* ixgbe_check_fw_error - Check firmware for errors
7779+
* @adapter: the adapter private structure
7780+
*
7781+
* Check firmware errors in register FWSM
7782+
*/
7783+
static bool ixgbe_check_fw_error(struct ixgbe_adapter *adapter)
7784+
{
7785+
struct ixgbe_hw *hw = &adapter->hw;
7786+
u32 fwsm;
7787+
7788+
/* read fwsm.ext_err_ind register and log errors */
7789+
fwsm = IXGBE_READ_REG(hw, IXGBE_FWSM(hw));
7790+
7791+
if (fwsm & IXGBE_FWSM_EXT_ERR_IND_MASK ||
7792+
!(fwsm & IXGBE_FWSM_FW_VAL_BIT))
7793+
e_dev_warn("Warning firmware error detected FWSM: 0x%08X\n",
7794+
fwsm);
7795+
7796+
if (hw->mac.ops.fw_recovery_mode && hw->mac.ops.fw_recovery_mode(hw)) {
7797+
e_dev_err("Firmware recovery mode detected. Limiting functionality. Refer to the Intel(R) Ethernet Adapters and Devices User Guide for details on firmware recovery mode.\n");
7798+
return true;
7799+
}
7800+
7801+
return false;
7802+
}
7803+
77777804
/**
77787805
* ixgbe_service_task - manages and runs subtasks
77797806
* @work: pointer to work_struct containing our data
@@ -7792,6 +7819,15 @@ static void ixgbe_service_task(struct work_struct *work)
77927819
ixgbe_service_event_complete(adapter);
77937820
return;
77947821
}
7822+
if (ixgbe_check_fw_error(adapter)) {
7823+
if (!test_bit(__IXGBE_DOWN, &adapter->state)) {
7824+
rtnl_lock();
7825+
unregister_netdev(adapter->netdev);
7826+
rtnl_unlock();
7827+
}
7828+
ixgbe_service_event_complete(adapter);
7829+
return;
7830+
}
77957831
if (adapter->flags2 & IXGBE_FLAG2_UDP_TUN_REREG_NEEDED) {
77967832
rtnl_lock();
77977833
adapter->flags2 &= ~IXGBE_FLAG2_UDP_TUN_REREG_NEEDED;
@@ -10716,6 +10752,11 @@ static int ixgbe_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
1071610752
if (adapter->flags2 & IXGBE_FLAG2_RSC_ENABLED)
1071710753
netdev->features |= NETIF_F_LRO;
1071810754

10755+
if (ixgbe_check_fw_error(adapter)) {
10756+
err = -EIO;
10757+
goto err_sw_init;
10758+
}
10759+
1071910760
/* make sure the EEPROM is good */
1072010761
if (hw->eeprom.ops.validate_checksum(hw, NULL) < 0) {
1072110762
e_dev_err("The EEPROM Checksum Is Not Valid\n");

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -924,6 +924,9 @@ struct ixgbe_nvm_version {
924924
/* Firmware Semaphore Register */
925925
#define IXGBE_FWSM_MODE_MASK 0xE
926926
#define IXGBE_FWSM_FW_MODE_PT 0x4
927+
#define IXGBE_FWSM_FW_NVM_RECOVERY_MODE BIT(5)
928+
#define IXGBE_FWSM_EXT_ERR_IND_MASK 0x01F80000
929+
#define IXGBE_FWSM_FW_VAL_BIT BIT(15)
927930

928931
/* ARC Subsystem registers */
929932
#define IXGBE_HICR 0x15F00
@@ -3461,6 +3464,7 @@ struct ixgbe_mac_operations {
34613464
const char *);
34623465
s32 (*get_thermal_sensor_data)(struct ixgbe_hw *);
34633466
s32 (*init_thermal_sensor_thresh)(struct ixgbe_hw *hw);
3467+
bool (*fw_recovery_mode)(struct ixgbe_hw *hw);
34643468
void (*disable_rx)(struct ixgbe_hw *hw);
34653469
void (*enable_rx)(struct ixgbe_hw *hw);
34663470
void (*set_source_address_pruning)(struct ixgbe_hw *, bool,

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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1247,6 +1247,20 @@ static s32 ixgbe_get_bus_info_X550em(struct ixgbe_hw *hw)
12471247
return 0;
12481248
}
12491249

1250+
/**
1251+
* ixgbe_fw_recovery_mode - Check FW NVM recovery mode
1252+
* @hw: pointer t hardware structure
1253+
*
1254+
* Returns true if in FW NVM recovery mode.
1255+
*/
1256+
static bool ixgbe_fw_recovery_mode_X550(struct ixgbe_hw *hw)
1257+
{
1258+
u32 fwsm;
1259+
1260+
fwsm = IXGBE_READ_REG(hw, IXGBE_FWSM(hw));
1261+
return !!(fwsm & IXGBE_FWSM_FW_NVM_RECOVERY_MODE);
1262+
}
1263+
12501264
/** ixgbe_disable_rx_x550 - Disable RX unit
12511265
*
12521266
* Enables the Rx DMA unit for x550
@@ -3816,6 +3830,7 @@ static s32 ixgbe_write_phy_reg_x550a(struct ixgbe_hw *hw, u32 reg_addr,
38163830
.enable_rx_buff = &ixgbe_enable_rx_buff_generic, \
38173831
.get_thermal_sensor_data = NULL, \
38183832
.init_thermal_sensor_thresh = NULL, \
3833+
.fw_recovery_mode = &ixgbe_fw_recovery_mode_X550, \
38193834
.enable_rx = &ixgbe_enable_rx_generic, \
38203835
.disable_rx = &ixgbe_disable_rx_x550, \
38213836

0 commit comments

Comments
 (0)