drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c- Extension
.c- Size
- 36760 bytes
- Lines
- 1332
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/pci.hlinux/netdevice.hlinux/vmalloc.hnet/devlink.hnet/netdev_lock.hlinux/bnxt/hsi.hlinux/bnxt/ulp.hbnxt.hbnxt_hwrm.hbnxt_vfr.hbnxt_devlink.hbnxt_ethtool.hbnxt_ptp.hbnxt_coredump.hbnxt_nvm_defs.h
Detected Declarations
enum bnxt_dl_param_idfunction __bnxt_fw_recoverfunction bnxt_dl_flash_updatefunction bnxt_hwrm_remote_dev_reset_setfunction bnxt_fw_diagnosefunction bnxt_fw_dumpfunction bnxt_fw_recoverfunction __bnxt_dl_reporter_createfunction bnxt_dl_fw_reporters_createfunction bnxt_dl_fw_reporters_destroyfunction bnxt_devlink_health_fw_reportfunction bnxt_dl_health_fw_status_updatefunction bnxt_dl_health_fw_recovery_donefunction bnxt_dl_livepatch_report_errfunction bnxt_dl_livepatch_activatefunction bnxt_dl_reload_downfunction bnxt_dl_reload_upfunction bnxt_nvm_testfunction bnxt_dl_selftest_checkfunction bnxt_dl_selftest_runfunction bnxt_copy_to_nvm_datafunction bnxt_copy_from_nvm_datafunction bnxt_hwrm_get_nvm_cfg_verfunction bnxt_dl_info_putfunction bnxt_dl_livepatch_info_putfunction bnxt_dl_info_getfunction __bnxt_hwrm_nvm_reqfunction bnxt_hwrm_nvm_reqfunction bnxt_dl_nvm_param_getfunction bnxt_dl_nvm_param_setfunction bnxt_dl_roce_validatefunction bnxt_dl_msix_validatefunction bnxt_remote_dev_reset_getfunction bnxt_remote_dev_reset_setfunction bnxt_dl_params_registerfunction bnxt_dl_params_unregisterfunction bnxt_dl_registerfunction bnxt_dl_unregister
Annotated Snippet
if (!h->severity) {
h->severity = SEVERITY_FATAL;
h->remedy = REMEDY_POWER_CYCLE_DEVICE;
h->diagnoses++;
devlink_health_report(h->fw_reporter,
"FW error diagnosed", h);
}
devlink_fmsg_string_pair_put(fmsg, "Status", "error");
devlink_fmsg_u32_pair_put(fmsg, "Syndrome", fw_status);
} else {
devlink_fmsg_string_pair_put(fmsg, "Status", "healthy");
}
devlink_fmsg_string_pair_put(fmsg, "Severity",
bnxt_health_severity_str(h->severity));
if (h->severity) {
devlink_fmsg_string_pair_put(fmsg, "Remedy",
bnxt_health_remedy_str(h->remedy));
if (h->remedy == REMEDY_DEVLINK_RECOVER)
devlink_fmsg_string_pair_put(fmsg, "Impact",
"traffic+ntuple_cfg");
}
mutex_unlock(&h->lock);
if (!h->resets_reliable)
return 0;
fw_resets = bnxt_fw_health_readl(bp, BNXT_FW_RESET_CNT_REG);
devlink_fmsg_u32_pair_put(fmsg, "Resets", fw_resets);
devlink_fmsg_u32_pair_put(fmsg, "Arrests", h->arrests);
devlink_fmsg_u32_pair_put(fmsg, "Survivals", h->survivals);
devlink_fmsg_u32_pair_put(fmsg, "Discoveries", h->discoveries);
devlink_fmsg_u32_pair_put(fmsg, "Fatalities", h->fatalities);
devlink_fmsg_u32_pair_put(fmsg, "Diagnoses", h->diagnoses);
return 0;
}
static int bnxt_fw_dump(struct devlink_health_reporter *reporter,
struct devlink_fmsg *fmsg, void *priv_ctx,
struct netlink_ext_ack *extack)
{
struct bnxt *bp = devlink_health_reporter_priv(reporter);
u32 dump_len;
void *data;
int rc;
/* TODO: no firmware dump support in devlink_health_report() context */
if (priv_ctx)
return -EOPNOTSUPP;
dump_len = bnxt_get_coredump_length(bp, BNXT_DUMP_LIVE);
if (!dump_len)
return -EIO;
data = vmalloc(dump_len);
if (!data)
return -ENOMEM;
rc = bnxt_get_coredump(bp, BNXT_DUMP_LIVE, data, &dump_len);
if (!rc) {
devlink_fmsg_pair_nest_start(fmsg, "core");
devlink_fmsg_binary_pair_put(fmsg, "data", data, dump_len);
devlink_fmsg_u32_pair_put(fmsg, "size", dump_len);
devlink_fmsg_pair_nest_end(fmsg);
}
vfree(data);
return rc;
}
static int bnxt_fw_recover(struct devlink_health_reporter *reporter,
void *priv_ctx,
struct netlink_ext_ack *extack)
{
struct bnxt *bp = devlink_health_reporter_priv(reporter);
if (bp->fw_health->severity == SEVERITY_FATAL)
return -ENODEV;
set_bit(BNXT_STATE_RECOVER, &bp->state);
__bnxt_fw_recover(bp);
return -EINPROGRESS;
}
static const struct devlink_health_reporter_ops bnxt_dl_fw_reporter_ops = {
.name = "fw",
.diagnose = bnxt_fw_diagnose,
.dump = bnxt_fw_dump,
Annotation
- Immediate include surface: `linux/pci.h`, `linux/netdevice.h`, `linux/vmalloc.h`, `net/devlink.h`, `net/netdev_lock.h`, `linux/bnxt/hsi.h`, `linux/bnxt/ulp.h`, `bnxt.h`.
- Detected declarations: `enum bnxt_dl_param_id`, `function __bnxt_fw_recover`, `function bnxt_dl_flash_update`, `function bnxt_hwrm_remote_dev_reset_set`, `function bnxt_fw_diagnose`, `function bnxt_fw_dump`, `function bnxt_fw_recover`, `function __bnxt_dl_reporter_create`, `function bnxt_dl_fw_reporters_create`, `function bnxt_dl_fw_reporters_destroy`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
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.