Skip to content

Commit fffeedd

Browse files
pkwapuliJeff Kirsher
authored andcommitted
i40e: detect and log info about pre-recovery mode
Detect and log information about pre-recovery mode when firmware transitions to a recovery mode. When a firmware transitions to a recovery mode it stores a number of unexpected EMP resets in one of its registers. The number of EMP resets ranging from 0x21 to 0x2A indicates that FW transitions to recovery mode. Use these values to emit log entry about transition process. Previously the pre-recovery mode may not have been detected and there was no log entry when NIC was in pre-recovery mode. Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com> Signed-off-by: Piotr Kwapulinski <piotr.kwapulinski@intel.com> Tested-by: Andrew Bowers <andrewx.bowers@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
1 parent 91c534b commit fffeedd

File tree

2 files changed

+52
-22
lines changed

2 files changed

+52
-22
lines changed

drivers/net/ethernet/intel/i40e/i40e_main.c

Lines changed: 50 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -14557,28 +14557,17 @@ void i40e_set_fec_in_flags(u8 fec_cfg, u32 *flags)
1455714557
**/
1455814558
static bool i40e_check_recovery_mode(struct i40e_pf *pf)
1455914559
{
14560-
u32 val = rd32(&pf->hw, I40E_GL_FWSTS) & I40E_GL_FWSTS_FWS1B_MASK;
14561-
bool is_recovery_mode = false;
14562-
14563-
if (pf->hw.mac.type == I40E_MAC_XL710)
14564-
is_recovery_mode =
14565-
val == I40E_XL710_GL_FWSTS_FWS1B_REC_MOD_CORER_MASK ||
14566-
val == I40E_XL710_GL_FWSTS_FWS1B_REC_MOD_GLOBR_MASK ||
14567-
val == I40E_XL710_GL_FWSTS_FWS1B_REC_MOD_TRANSITION_MASK ||
14568-
val == I40E_XL710_GL_FWSTS_FWS1B_REC_MOD_NVM_MASK;
14569-
if (pf->hw.mac.type == I40E_MAC_X722)
14570-
is_recovery_mode =
14571-
val == I40E_X722_GL_FWSTS_FWS1B_REC_MOD_CORER_MASK ||
14572-
val == I40E_X722_GL_FWSTS_FWS1B_REC_MOD_GLOBR_MASK;
14573-
if (is_recovery_mode) {
14574-
dev_notice(&pf->pdev->dev, "Firmware recovery mode detected. Limiting functionality.\n");
14575-
dev_notice(&pf->pdev->dev, "Refer to the Intel(R) Ethernet Adapters and Devices User Guide for details on firmware recovery mode.\n");
14560+
u32 val = rd32(&pf->hw, I40E_GL_FWSTS);
14561+
14562+
if (val & I40E_GL_FWSTS_FWS1B_MASK) {
14563+
dev_crit(&pf->pdev->dev, "Firmware recovery mode detected. Limiting functionality.\n");
14564+
dev_crit(&pf->pdev->dev, "Refer to the Intel(R) Ethernet Adapters and Devices User Guide for details on firmware recovery mode.\n");
1457614565
set_bit(__I40E_RECOVERY_MODE, pf->state);
1457714566

1457814567
return true;
1457914568
}
14580-
if (test_and_clear_bit(__I40E_RECOVERY_MODE, pf->state))
14581-
dev_info(&pf->pdev->dev, "Reinitializing in normal mode with full functionality.\n");
14569+
if (test_bit(__I40E_RECOVERY_MODE, pf->state))
14570+
dev_info(&pf->pdev->dev, "Please do Power-On Reset to initialize adapter in normal mode with full functionality.\n");
1458214571

1458314572
return false;
1458414573
}
@@ -14626,6 +14615,47 @@ static i40e_status i40e_pf_loop_reset(struct i40e_pf *pf)
1462614615
return ret;
1462714616
}
1462814617

14618+
/**
14619+
* i40e_check_fw_empr - check if FW issued unexpected EMP Reset
14620+
* @pf: board private structure
14621+
*
14622+
* Check FW registers to determine if FW issued unexpected EMP Reset.
14623+
* Every time when unexpected EMP Reset occurs the FW increments
14624+
* a counter of unexpected EMP Resets. When the counter reaches 10
14625+
* the FW should enter the Recovery mode
14626+
*
14627+
* Returns true if FW issued unexpected EMP Reset
14628+
**/
14629+
static bool i40e_check_fw_empr(struct i40e_pf *pf)
14630+
{
14631+
const u32 fw_sts = rd32(&pf->hw, I40E_GL_FWSTS) &
14632+
I40E_GL_FWSTS_FWS1B_MASK;
14633+
return (fw_sts > I40E_GL_FWSTS_FWS1B_EMPR_0) &&
14634+
(fw_sts <= I40E_GL_FWSTS_FWS1B_EMPR_10);
14635+
}
14636+
14637+
/**
14638+
* i40e_handle_resets - handle EMP resets and PF resets
14639+
* @pf: board private structure
14640+
*
14641+
* Handle both EMP resets and PF resets and conclude whether there are
14642+
* any issues regarding these resets. If there are any issues then
14643+
* generate log entry.
14644+
*
14645+
* Return 0 if NIC is healthy or negative value when there are issues
14646+
* with resets
14647+
**/
14648+
static i40e_status i40e_handle_resets(struct i40e_pf *pf)
14649+
{
14650+
const i40e_status pfr = i40e_pf_loop_reset(pf);
14651+
const bool is_empr = i40e_check_fw_empr(pf);
14652+
14653+
if (is_empr || pfr != I40E_SUCCESS)
14654+
dev_crit(&pf->pdev->dev, "Entering recovery mode due to repeated FW resets. This may take several minutes. Refer to the Intel(R) Ethernet Adapters and Devices User Guide.\n");
14655+
14656+
return is_empr ? I40E_ERR_RESET_FAILED : pfr;
14657+
}
14658+
1462914659
/**
1463014660
* i40e_init_recovery_mode - initialize subsystems needed in recovery mode
1463114661
* @pf: board private structure
@@ -14862,11 +14892,9 @@ static int i40e_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
1486214892
goto err_pf_reset;
1486314893
}
1486414894

14865-
err = i40e_pf_loop_reset(pf);
14866-
if (err) {
14867-
dev_info(&pdev->dev, "Initial pf_reset failed: %d\n", err);
14895+
err = i40e_handle_resets(pf);
14896+
if (err)
1486814897
goto err_pf_reset;
14869-
}
1487014898

1487114899
i40e_check_recovery_mode(pf);
1487214900

drivers/net/ethernet/intel/i40e/i40e_register.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@
4343
#define I40E_GL_FWSTS 0x00083048 /* Reset: POR */
4444
#define I40E_GL_FWSTS_FWS1B_SHIFT 16
4545
#define I40E_GL_FWSTS_FWS1B_MASK I40E_MASK(0xFF, I40E_GL_FWSTS_FWS1B_SHIFT)
46+
#define I40E_GL_FWSTS_FWS1B_EMPR_0 I40E_MASK(0x20, I40E_GL_FWSTS_FWS1B_SHIFT)
47+
#define I40E_GL_FWSTS_FWS1B_EMPR_10 I40E_MASK(0x2A, I40E_GL_FWSTS_FWS1B_SHIFT)
4648
#define I40E_XL710_GL_FWSTS_FWS1B_REC_MOD_CORER_MASK I40E_MASK(0x30, I40E_GL_FWSTS_FWS1B_SHIFT)
4749
#define I40E_XL710_GL_FWSTS_FWS1B_REC_MOD_GLOBR_MASK I40E_MASK(0x31, I40E_GL_FWSTS_FWS1B_SHIFT)
4850
#define I40E_XL710_GL_FWSTS_FWS1B_REC_MOD_TRANSITION_MASK I40E_MASK(0x32, I40E_GL_FWSTS_FWS1B_SHIFT)

0 commit comments

Comments
 (0)