if_bnxt: Display firmware version along with SIT package version

Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D36441
This commit is contained in:
Sumit Saxena 2022-11-04 16:18:38 -06:00 committed by Warner Losh
parent fb4b7e02d2
commit 6033382aab
3 changed files with 34 additions and 0 deletions

View File

@ -471,6 +471,8 @@ struct bnxt_full_tpa_start {
/* All the version information for the part */
#define BNXT_VERSTR_SIZE (3*3+2+1) /* ie: "255.255.255\0" */
#define BNXT_NAME_SIZE 17
#define FW_VER_STR_LEN 32
#define BC_HWRM_STR_LEN 21
struct bnxt_ver_info {
uint8_t hwrm_if_major;
uint8_t hwrm_if_minor;
@ -481,6 +483,7 @@ struct bnxt_ver_info {
char mgmt_fw_ver[BNXT_VERSTR_SIZE];
char netctrl_fw_ver[BNXT_VERSTR_SIZE];
char roce_fw_ver[BNXT_VERSTR_SIZE];
char fw_ver_str[FW_VER_STR_LEN];
char phy_ver[BNXT_VERSTR_SIZE];
char pkg_ver[64];

View File

@ -546,6 +546,7 @@ bnxt_hwrm_ver_get(struct bnxt_softc *softc)
const char nastr[] = "<not installed>";
const char naver[] = "<N/A>";
uint32_t dev_caps_cfg;
uint16_t fw_maj, fw_min, fw_bld, fw_rsv, len;
softc->hwrm_max_req_len = HWRM_MAX_REQ_LEN;
softc->hwrm_cmd_timeo = 1000;
@ -620,6 +621,32 @@ bnxt_hwrm_ver_get(struct bnxt_softc *softc)
strlcpy(softc->ver_info->roce_fw_name, resp->roce_fw_name,
BNXT_NAME_SIZE);
}
fw_maj = le32toh(resp->hwrm_fw_major);
if (softc->hwrm_spec_code > 0x10803 && fw_maj) {
fw_min = le16toh(resp->hwrm_fw_minor);
fw_bld = le16toh(resp->hwrm_fw_build);
fw_rsv = le16toh(resp->hwrm_fw_patch);
len = FW_VER_STR_LEN;
} else {
fw_maj = resp->hwrm_fw_maj_8b;
fw_min = resp->hwrm_fw_min_8b;
fw_bld = resp->hwrm_fw_bld_8b;
fw_rsv = resp->hwrm_fw_rsvd_8b;
len = BC_HWRM_STR_LEN;
}
snprintf (softc->ver_info->fw_ver_str, len, "%d.%d.%d.%d",
fw_maj, fw_min, fw_bld, fw_rsv);
if (strlen(resp->active_pkg_name)) {
int fw_ver_len = strlen (softc->ver_info->fw_ver_str);
snprintf(softc->ver_info->fw_ver_str + fw_ver_len,
FW_VER_STR_LEN - fw_ver_len - 1, "/pkg %s",
resp->active_pkg_name);
}
softc->ver_info->chip_num = le16toh(resp->chip_num);
softc->ver_info->chip_rev = resp->chip_rev;
softc->ver_info->chip_metal = resp->chip_metal;
@ -1470,6 +1497,7 @@ bnxt_hwrm_rss_cfg(struct bnxt_softc *softc, struct bnxt_vnic_info *vnic,
/* TBD */
if (BNXT_CHIP_P5(softc))
return 0;
bnxt_hwrm_cmd_hdr_init(softc, &req, HWRM_VNIC_RSS_CFG);
req.hash_type = htole32(hash_type);

View File

@ -834,6 +834,9 @@ bnxt_create_ver_sysctls(struct bnxt_softc *softc)
SYSCTL_ADD_STRING(&vi->ver_ctx, SYSCTL_CHILDREN(oid), OID_AUTO,
"roce_fw", CTLFLAG_RD, vi->roce_fw_ver, 0,
"RoCE firmware version");
SYSCTL_ADD_STRING(&vi->ver_ctx, SYSCTL_CHILDREN(oid), OID_AUTO,
"fw_ver", CTLFLAG_RD, vi->fw_ver_str, 0,
"Firmware version");
SYSCTL_ADD_STRING(&vi->ver_ctx, SYSCTL_CHILDREN(oid), OID_AUTO,
"phy", CTLFLAG_RD, vi->phy_ver, 0,
"PHY version");