git: 6033382aab2e - main - if_bnxt: Display firmware version along with SIT package version
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 04 Nov 2022 22:55:50 UTC
The branch main has been updated by imp:
URL: https://cgit.FreeBSD.org/src/commit/?id=6033382aab2e6108e6faa273fd945274e161cd5b
commit 6033382aab2e6108e6faa273fd945274e161cd5b
Author: Sumit Saxena <sumit.saxena@broadcom.com>
AuthorDate: 2022-11-04 22:18:38 +0000
Commit: Warner Losh <imp@FreeBSD.org>
CommitDate: 2022-11-04 22:18:38 +0000
if_bnxt: Display firmware version along with SIT package version
Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D36441
---
sys/dev/bnxt/bnxt.h | 3 +++
sys/dev/bnxt/bnxt_hwrm.c | 28 ++++++++++++++++++++++++++++
sys/dev/bnxt/bnxt_sysctl.c | 3 +++
3 files changed, 34 insertions(+)
diff --git a/sys/dev/bnxt/bnxt.h b/sys/dev/bnxt/bnxt.h
index 753d1aac92de..9638ad78fb6d 100644
--- a/sys/dev/bnxt/bnxt.h
+++ b/sys/dev/bnxt/bnxt.h
@@ -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];
diff --git a/sys/dev/bnxt/bnxt_hwrm.c b/sys/dev/bnxt/bnxt_hwrm.c
index eb1c60ac35d6..91e6865449ac 100644
--- a/sys/dev/bnxt/bnxt_hwrm.c
+++ b/sys/dev/bnxt/bnxt_hwrm.c
@@ -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);
diff --git a/sys/dev/bnxt/bnxt_sysctl.c b/sys/dev/bnxt/bnxt_sysctl.c
index e8b3edc27e4d..36afed71a726 100644
--- a/sys/dev/bnxt/bnxt_sysctl.c
+++ b/sys/dev/bnxt/bnxt_sysctl.c
@@ -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");