Skip to content

Commit 1388875

Browse files
Vasundhara Volamkuba-moo
authored andcommitted
bnxt_en: Add stored FW version info to devlink info_get cb.
This patch adds FW versions stored in the flash to devlink info_get callback. Return the correct fw.psid running version using the newly added bp->nvm_cfg_ver. v2: Ensure stored pkg_name string is NULL terminated when copied to devlink. Return directly from the last call to bnxt_dl_info_put(). If the FW call to get stored version fails for any reason, return success immediately to devlink without the stored versions. Reviewed-by: Andy Gospodarek <gospo@broadcom.com> Signed-off-by: Vasundhara Volam <vasundhara-v.volam@broadcom.com> Signed-off-by: Michael Chan <michael.chan@broadcom.com> Link: https://lore.kernel.org/r/1602493854-29283-10-git-send-email-michael.chan@broadcom.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent 7154917 commit 1388875

1 file changed

Lines changed: 45 additions & 2 deletions

File tree

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

Lines changed: 45 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -410,6 +410,7 @@ static int bnxt_dl_info_put(struct bnxt *bp, struct devlink_info_req *req,
410410
static int bnxt_dl_info_get(struct devlink *dl, struct devlink_info_req *req,
411411
struct netlink_ext_ack *extack)
412412
{
413+
struct hwrm_nvm_get_dev_info_output nvm_dev_info;
413414
struct bnxt *bp = bnxt_get_bp_from_dl(dl);
414415
union devlink_param_value nvm_cfg_ver;
415416
struct hwrm_ver_get_output *ver_resp;
@@ -457,6 +458,12 @@ static int bnxt_dl_info_get(struct devlink *dl, struct devlink_info_req *req,
457458
if (rc)
458459
return rc;
459460

461+
rc = bnxt_dl_info_put(bp, req, BNXT_VERSION_RUNNING,
462+
DEVLINK_INFO_VERSION_GENERIC_FW_PSID,
463+
bp->nvm_cfg_ver);
464+
if (rc)
465+
return rc;
466+
460467
buf[0] = 0;
461468
strncat(buf, ver_resp->active_pkg_name, HWRM_FW_VER_STR_LEN);
462469
rc = bnxt_dl_info_put(bp, req, BNXT_VERSION_RUNNING,
@@ -469,7 +476,7 @@ static int bnxt_dl_info_get(struct devlink *dl, struct devlink_info_req *req,
469476

470477
sprintf(buf, "%X.%X.%X", (ver >> 16) & 0xF, (ver >> 8) & 0xF,
471478
ver & 0xF);
472-
rc = bnxt_dl_info_put(bp, req, BNXT_VERSION_RUNNING,
479+
rc = bnxt_dl_info_put(bp, req, BNXT_VERSION_STORED,
473480
DEVLINK_INFO_VERSION_GENERIC_FW_PSID,
474481
buf);
475482
if (rc)
@@ -517,7 +524,43 @@ static int bnxt_dl_info_get(struct devlink *dl, struct devlink_info_req *req,
517524
if (rc)
518525
return rc;
519526

520-
return bnxt_dl_info_put(bp, req, BNXT_VERSION_RUNNING,
527+
rc = bnxt_dl_info_put(bp, req, BNXT_VERSION_RUNNING,
528+
DEVLINK_INFO_VERSION_GENERIC_FW_ROCE, roce_ver);
529+
if (rc)
530+
return rc;
531+
532+
rc = bnxt_hwrm_nvm_get_dev_info(bp, &nvm_dev_info);
533+
if (rc ||
534+
!(nvm_dev_info.flags & NVM_GET_DEV_INFO_RESP_FLAGS_FW_VER_VALID))
535+
return 0;
536+
537+
buf[0] = 0;
538+
strncat(buf, nvm_dev_info.pkg_name, HWRM_FW_VER_STR_LEN);
539+
rc = bnxt_dl_info_put(bp, req, BNXT_VERSION_STORED,
540+
DEVLINK_INFO_VERSION_GENERIC_FW, buf);
541+
if (rc)
542+
return rc;
543+
544+
snprintf(mgmt_ver, FW_VER_STR_LEN, "%d.%d.%d.%d",
545+
nvm_dev_info.hwrm_fw_major, nvm_dev_info.hwrm_fw_minor,
546+
nvm_dev_info.hwrm_fw_build, nvm_dev_info.hwrm_fw_patch);
547+
rc = bnxt_dl_info_put(bp, req, BNXT_VERSION_STORED,
548+
DEVLINK_INFO_VERSION_GENERIC_FW_MGMT, mgmt_ver);
549+
if (rc)
550+
return rc;
551+
552+
snprintf(ncsi_ver, FW_VER_STR_LEN, "%d.%d.%d.%d",
553+
nvm_dev_info.mgmt_fw_major, nvm_dev_info.mgmt_fw_minor,
554+
nvm_dev_info.mgmt_fw_build, nvm_dev_info.mgmt_fw_patch);
555+
rc = bnxt_dl_info_put(bp, req, BNXT_VERSION_STORED,
556+
DEVLINK_INFO_VERSION_GENERIC_FW_NCSI, ncsi_ver);
557+
if (rc)
558+
return rc;
559+
560+
snprintf(roce_ver, FW_VER_STR_LEN, "%d.%d.%d.%d",
561+
nvm_dev_info.roce_fw_major, nvm_dev_info.roce_fw_minor,
562+
nvm_dev_info.roce_fw_build, nvm_dev_info.roce_fw_patch);
563+
return bnxt_dl_info_put(bp, req, BNXT_VERSION_STORED,
521564
DEVLINK_INFO_VERSION_GENERIC_FW_ROCE, roce_ver);
522565
}
523566

0 commit comments

Comments
 (0)