drivers/net/ethernet/broadcom/bnge/bnge_devlink.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/broadcom/bnge/bnge_devlink.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/broadcom/bnge/bnge_devlink.c- Extension
.c- Size
- 8349 bytes
- Lines
- 307
- Domain
- Driver Families
- Bucket
- drivers/net
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/unaligned.hlinux/pci.hlinux/types.hnet/devlink.hbnge.hbnge_devlink.hbnge_hwrm_lib.h
Detected Declarations
function bnge_dl_info_putfunction bnge_vpd_read_infofunction bnge_devlink_info_getfunction bnge_devlink_freefunction bnge_devlink_registerfunction bnge_devlink_unregister
Annotated Snippet
if (rc) {
NL_SET_ERR_MSG_MOD(extack, "Failed to set dsn");
return rc;
}
}
if (strlen(bd->board_serialno)) {
rc = devlink_info_board_serial_number_put(req,
bd->board_serialno);
if (rc) {
NL_SET_ERR_MSG_MOD(extack,
"Failed to set board serial number");
return rc;
}
}
rc = bnge_dl_info_put(bd, req, BNGE_VERSION_FIXED,
DEVLINK_INFO_VERSION_GENERIC_BOARD_ID,
bd->board_partno);
if (rc) {
NL_SET_ERR_MSG_MOD(extack, "Failed to set board part number");
return rc;
}
/* More information from HWRM ver get command */
sprintf(buf, "%X", bd->chip_num);
rc = bnge_dl_info_put(bd, req, BNGE_VERSION_FIXED,
DEVLINK_INFO_VERSION_GENERIC_ASIC_ID, buf);
if (rc) {
NL_SET_ERR_MSG_MOD(extack, "Failed to set asic id");
return rc;
}
ver_resp = &bd->ver_resp;
sprintf(buf, "%c%d", 'A' + ver_resp->chip_rev, ver_resp->chip_metal);
rc = bnge_dl_info_put(bd, req, BNGE_VERSION_FIXED,
DEVLINK_INFO_VERSION_GENERIC_ASIC_REV, buf);
if (rc) {
NL_SET_ERR_MSG_MOD(extack, "Failed to set asic info");
return rc;
}
rc = bnge_dl_info_put(bd, req, BNGE_VERSION_RUNNING,
DEVLINK_INFO_VERSION_GENERIC_FW_PSID,
bd->nvm_cfg_ver);
if (rc) {
NL_SET_ERR_MSG_MOD(extack, "Failed to set firmware version");
return rc;
}
buf[0] = 0;
strncat(buf, ver_resp->active_pkg_name, HWRM_FW_VER_STR_LEN);
rc = bnge_dl_info_put(bd, req, BNGE_VERSION_RUNNING,
DEVLINK_INFO_VERSION_GENERIC_FW, buf);
if (rc) {
NL_SET_ERR_MSG_MOD(extack,
"Failed to set firmware generic version");
return rc;
}
if (ver_resp->flags & VER_GET_RESP_FLAGS_EXT_VER_AVAIL) {
snprintf(mgmt_ver, FW_VER_STR_LEN, "%d.%d.%d.%d",
ver_resp->hwrm_fw_major, ver_resp->hwrm_fw_minor,
ver_resp->hwrm_fw_build, ver_resp->hwrm_fw_patch);
snprintf(ncsi_ver, FW_VER_STR_LEN, "%d.%d.%d.%d",
ver_resp->mgmt_fw_major, ver_resp->mgmt_fw_minor,
ver_resp->mgmt_fw_build, ver_resp->mgmt_fw_patch);
snprintf(roce_ver, FW_VER_STR_LEN, "%d.%d.%d.%d",
ver_resp->roce_fw_major, ver_resp->roce_fw_minor,
ver_resp->roce_fw_build, ver_resp->roce_fw_patch);
} else {
snprintf(mgmt_ver, FW_VER_STR_LEN, "%d.%d.%d.%d",
ver_resp->hwrm_fw_maj_8b, ver_resp->hwrm_fw_min_8b,
ver_resp->hwrm_fw_bld_8b, ver_resp->hwrm_fw_rsvd_8b);
snprintf(ncsi_ver, FW_VER_STR_LEN, "%d.%d.%d.%d",
ver_resp->mgmt_fw_maj_8b, ver_resp->mgmt_fw_min_8b,
ver_resp->mgmt_fw_bld_8b, ver_resp->mgmt_fw_rsvd_8b);
snprintf(roce_ver, FW_VER_STR_LEN, "%d.%d.%d.%d",
ver_resp->roce_fw_maj_8b, ver_resp->roce_fw_min_8b,
ver_resp->roce_fw_bld_8b, ver_resp->roce_fw_rsvd_8b);
}
rc = bnge_dl_info_put(bd, req, BNGE_VERSION_RUNNING,
DEVLINK_INFO_VERSION_GENERIC_FW_MGMT, mgmt_ver);
if (rc) {
NL_SET_ERR_MSG_MOD(extack,
"Failed to set firmware mgmt version");
Annotation
- Immediate include surface: `linux/unaligned.h`, `linux/pci.h`, `linux/types.h`, `net/devlink.h`, `bnge.h`, `bnge_devlink.h`, `bnge_hwrm_lib.h`.
- Detected declarations: `function bnge_dl_info_put`, `function bnge_vpd_read_info`, `function bnge_devlink_info_get`, `function bnge_devlink_free`, `function bnge_devlink_register`, `function bnge_devlink_unregister`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.