Skip to content

Commit b5aae90

Browse files
jjagielskanguy11
authored andcommitted
ixgbe: add FW API version check
Add E610 specific function checking whether the FW API version is compatible with the driver expectations. The major API version should be less than or equal to the expected API version. If not the driver won't be fully operational. Check the minor version, and if it is more than two versions lesser or greater than the expected version, print a message indicating that the NVM or driver should be updated respectively. Reviewed-by: Mateusz Polchlopek <mateusz.polchlopek@intel.com> Co-developed-by: Piotr Kwapulinski <piotr.kwapulinski@intel.com> Signed-off-by: Piotr Kwapulinski <piotr.kwapulinski@intel.com> Signed-off-by: Jedrzej Jagielski <jedrzej.jagielski@intel.com> Tested-by: Bharath R <bharath.r@intel.com> Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
1 parent c9e563c commit b5aae90

File tree

6 files changed

+43
-0
lines changed

6 files changed

+43
-0
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -471,6 +471,8 @@ static int ixgbe_devlink_reload_empr_finish(struct devlink *devlink,
471471

472472
*actions_performed = BIT(DEVLINK_RELOAD_ACTION_FW_ACTIVATE);
473473

474+
adapter->flags2 &= ~IXGBE_FLAG2_API_MISMATCH;
475+
474476
return 0;
475477
}
476478

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -671,6 +671,7 @@ struct ixgbe_adapter {
671671
#define IXGBE_FLAG2_PHY_FW_LOAD_FAILED BIT(20)
672672
#define IXGBE_FLAG2_NO_MEDIA BIT(21)
673673
#define IXGBE_FLAG2_MOD_POWER_UNSUPPORTED BIT(22)
674+
#define IXGBE_FLAG2_API_MISMATCH BIT(23)
674675

675676
/* Tx fast path data */
676677
int num_tx_queues;

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3873,6 +3873,7 @@ static const struct ixgbe_mac_operations mac_ops_e610 = {
38733873
.led_off = ixgbe_led_off_generic,
38743874
.init_led_link_act = ixgbe_init_led_link_act_generic,
38753875
.reset_hw = ixgbe_reset_hw_e610,
3876+
.get_fw_ver = ixgbe_aci_get_fw_ver,
38763877
.get_media_type = ixgbe_get_media_type_e610,
38773878
.setup_link = ixgbe_setup_link_e610,
38783879
.get_link_capabilities = ixgbe_get_link_capabilities_e610,

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

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8365,6 +8365,34 @@ static void ixgbe_reset_subtask(struct ixgbe_adapter *adapter)
83658365
rtnl_unlock();
83668366
}
83678367

8368+
static int ixgbe_check_fw_api_mismatch(struct ixgbe_adapter *adapter)
8369+
{
8370+
struct ixgbe_hw *hw = &adapter->hw;
8371+
8372+
if (hw->mac.type != ixgbe_mac_e610)
8373+
return 0;
8374+
8375+
if (hw->mac.ops.get_fw_ver && hw->mac.ops.get_fw_ver(hw))
8376+
return 0;
8377+
8378+
if (hw->api_maj_ver > IXGBE_FW_API_VER_MAJOR) {
8379+
e_dev_err("The driver for the device stopped because the NVM image is newer than expected. You must install the most recent version of the network driver.\n");
8380+
8381+
adapter->flags2 |= IXGBE_FLAG2_API_MISMATCH;
8382+
return -EOPNOTSUPP;
8383+
} else if (hw->api_maj_ver == IXGBE_FW_API_VER_MAJOR &&
8384+
hw->api_min_ver > IXGBE_FW_API_VER_MINOR + IXGBE_FW_API_VER_DIFF_ALLOWED) {
8385+
e_dev_info("The driver for the device detected a newer version of the NVM image than expected. Please install the most recent version of the network driver.\n");
8386+
adapter->flags2 |= IXGBE_FLAG2_API_MISMATCH;
8387+
} else if (hw->api_maj_ver < IXGBE_FW_API_VER_MAJOR ||
8388+
hw->api_min_ver < IXGBE_FW_API_VER_MINOR - IXGBE_FW_API_VER_DIFF_ALLOWED) {
8389+
e_dev_info("The driver for the device detected an older version of the NVM image than expected. Please update the NVM image.\n");
8390+
adapter->flags2 |= IXGBE_FLAG2_API_MISMATCH;
8391+
}
8392+
8393+
return 0;
8394+
}
8395+
83688396
/**
83698397
* ixgbe_check_fw_error - Check firmware for errors
83708398
* @adapter: the adapter private structure
@@ -8375,6 +8403,7 @@ static bool ixgbe_check_fw_error(struct ixgbe_adapter *adapter)
83758403
{
83768404
struct ixgbe_hw *hw = &adapter->hw;
83778405
u32 fwsm;
8406+
int err;
83788407

83798408
/* read fwsm.ext_err_ind register and log errors */
83808409
fwsm = IXGBE_READ_REG(hw, IXGBE_FWSM(hw));
@@ -8389,6 +8418,11 @@ static bool ixgbe_check_fw_error(struct ixgbe_adapter *adapter)
83898418
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");
83908419
return true;
83918420
}
8421+
if (!(adapter->flags2 & IXGBE_FLAG2_API_MISMATCH)) {
8422+
err = ixgbe_check_fw_api_mismatch(adapter);
8423+
if (err)
8424+
return true;
8425+
}
83928426

83938427
return false;
83948428
}

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3456,6 +3456,7 @@ struct ixgbe_mac_operations {
34563456
int (*start_hw)(struct ixgbe_hw *);
34573457
int (*clear_hw_cntrs)(struct ixgbe_hw *);
34583458
enum ixgbe_media_type (*get_media_type)(struct ixgbe_hw *);
3459+
int (*get_fw_ver)(struct ixgbe_hw *hw);
34593460
int (*get_mac_addr)(struct ixgbe_hw *, u8 *);
34603461
int (*get_san_mac_addr)(struct ixgbe_hw *, u8 *);
34613462
int (*get_device_caps)(struct ixgbe_hw *, u16 *);

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,10 @@
112112
#define IXGBE_PF_HICR_SV BIT(2)
113113
#define IXGBE_PF_HICR_EV BIT(3)
114114

115+
#define IXGBE_FW_API_VER_MAJOR 0x01
116+
#define IXGBE_FW_API_VER_MINOR 0x07
117+
#define IXGBE_FW_API_VER_DIFF_ALLOWED 0x02
118+
115119
#define IXGBE_ACI_DESC_SIZE 32
116120
#define IXGBE_ACI_DESC_SIZE_IN_DWORDS (IXGBE_ACI_DESC_SIZE / BYTES_PER_DWORD)
117121

0 commit comments

Comments
 (0)