Skip to content

Commit 4933f67

Browse files
Vasundhara Volamkuba-moo
authored andcommitted
bnxt_en: Add bnxt_hwrm_nvm_get_dev_info() to query NVM info.
Add a new bnxt_hwrm_nvm_get_dev_info() to query firmware version information via NVM_GET_DEV_INFO firmware command. Use it to get the running version of the NVM configuration information. This new function will also be used in subsequent patches to get the stored firmware versions. Reviewed-by: Andy Gospodarek <[email protected]> Signed-off-by: Vasundhara Volam <[email protected]> Signed-off-by: Michael Chan <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 8eddb3e commit 4933f67

File tree

4 files changed

+31
-0
lines changed

4 files changed

+31
-0
lines changed

drivers/net/ethernet/broadcom/bnxt/bnxt.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7562,6 +7562,16 @@ static int bnxt_hwrm_func_reset(struct bnxt *bp)
75627562
return hwrm_send_message(bp, &req, sizeof(req), HWRM_RESET_TIMEOUT);
75637563
}
75647564

7565+
static void bnxt_nvm_cfg_ver_get(struct bnxt *bp)
7566+
{
7567+
struct hwrm_nvm_get_dev_info_output nvm_info;
7568+
7569+
if (!bnxt_hwrm_nvm_get_dev_info(bp, &nvm_info))
7570+
snprintf(bp->nvm_cfg_ver, FW_VER_STR_LEN, "%d.%d.%d",
7571+
nvm_info.nvm_cfg_ver_maj, nvm_info.nvm_cfg_ver_min,
7572+
nvm_info.nvm_cfg_ver_upd);
7573+
}
7574+
75657575
static int bnxt_hwrm_queue_qportcfg(struct bnxt *bp)
75667576
{
75677577
int rc = 0;
@@ -11223,6 +11233,8 @@ static int bnxt_fw_init_one_p1(struct bnxt *bp)
1122311233
if (rc)
1122411234
return rc;
1122511235
}
11236+
bnxt_nvm_cfg_ver_get(bp);
11237+
1122611238
rc = bnxt_hwrm_func_reset(bp);
1122711239
if (rc)
1122811240
return -ENODEV;

drivers/net/ethernet/broadcom/bnxt/bnxt.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1856,6 +1856,7 @@ struct bnxt {
18561856
#define PHY_VER_STR_LEN (FW_VER_STR_LEN - BC_HWRM_STR_LEN)
18571857
char fw_ver_str[FW_VER_STR_LEN];
18581858
char hwrm_ver_supp[FW_VER_STR_LEN];
1859+
char nvm_cfg_ver[FW_VER_STR_LEN];
18591860
u64 fw_ver_code;
18601861
#define BNXT_FW_VER_CODE(maj, min, bld, rsv) \
18611862
((u64)(maj) << 48 | (u64)(min) << 32 | (u64)(bld) << 16 | (rsv))

drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2072,6 +2072,22 @@ static u32 bnxt_get_link(struct net_device *dev)
20722072
return bp->link_info.link_up;
20732073
}
20742074

2075+
int bnxt_hwrm_nvm_get_dev_info(struct bnxt *bp,
2076+
struct hwrm_nvm_get_dev_info_output *nvm_dev_info)
2077+
{
2078+
struct hwrm_nvm_get_dev_info_output *resp = bp->hwrm_cmd_resp_addr;
2079+
struct hwrm_nvm_get_dev_info_input req = {0};
2080+
int rc;
2081+
2082+
bnxt_hwrm_cmd_hdr_init(bp, &req, HWRM_NVM_GET_DEV_INFO, -1, -1);
2083+
mutex_lock(&bp->hwrm_cmd_lock);
2084+
rc = _hwrm_send_message(bp, &req, sizeof(req), HWRM_CMD_TIMEOUT);
2085+
if (!rc)
2086+
memcpy(nvm_dev_info, resp, sizeof(*resp));
2087+
mutex_unlock(&bp->hwrm_cmd_lock);
2088+
return rc;
2089+
}
2090+
20752091
static void bnxt_print_admin_err(struct bnxt *bp)
20762092
{
20772093
netdev_info(bp->dev, "PF does not have admin privileges to flash or reset the device\n");

drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,8 @@ u32 bnxt_get_rxfh_indir_size(struct net_device *dev);
9292
u32 _bnxt_fw_to_ethtool_adv_spds(u16, u8);
9393
u32 bnxt_fw_to_ethtool_speed(u16);
9494
u16 bnxt_get_fw_auto_link_speeds(u32);
95+
int bnxt_hwrm_nvm_get_dev_info(struct bnxt *bp,
96+
struct hwrm_nvm_get_dev_info_output *nvm_dev_info);
9597
int bnxt_flash_package_from_file(struct net_device *dev, const char *filename,
9698
u32 install_type);
9799
void bnxt_ethtool_init(struct bnxt *bp);

0 commit comments

Comments
 (0)