drivers/net/ethernet/intel/ice/devlink/devlink.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/intel/ice/devlink/devlink.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/intel/ice/devlink/devlink.c- Extension
.c- Size
- 60126 bytes
- Lines
- 2113
- 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/vmalloc.hice.hice_lib.hdevlink.hport.hice_eswitch.hice_fw_update.hice_dcb_lib.hice_sf_eth.h
Detected Declarations
struct ice_info_ctxenum ice_version_typeenum ice_param_idfunction ice_info_get_dsnfunction ice_info_pbafunction ice_info_fw_mgmtfunction ice_info_fw_apifunction ice_info_fw_buildfunction ice_info_orom_verfunction ice_info_pending_orom_verfunction ice_info_nvm_verfunction ice_info_pending_nvm_verfunction ice_info_eetrackfunction ice_info_pending_eetrackfunction ice_info_ddp_pkg_namefunction ice_info_ddp_pkg_versionfunction ice_info_ddp_pkg_bundle_idfunction ice_info_netlist_verfunction ice_info_netlist_buildfunction ice_info_pending_netlist_verfunction ice_info_pending_netlist_buildfunction ice_info_cgu_fw_buildfunction ice_info_cgu_idfunction ice_devlink_info_getfunction ice_devlink_reload_empr_startfunction ice_devlink_reinit_downfunction ice_devlink_reload_downfunction ice_devlink_reload_empr_finishfunction ice_get_tx_topo_user_selfunction ice_update_tx_topo_user_selfunction ice_devlink_tx_sched_layers_getfunction ice_devlink_tx_sched_layers_setfunction ice_devlink_tx_sched_layers_validatefunction ice_tear_down_devlink_rate_treefunction ice_enable_custom_txfunction ice_traverse_tx_treefunction ice_devlink_rate_init_tx_topologyfunction ice_clear_rate_nodesfunction ice_devlink_rate_clear_tx_topologyfunction ice_set_object_tx_sharefunction ice_set_object_tx_maxfunction ice_set_object_tx_priorityfunction ice_set_object_tx_weightfunction ice_devlink_rate_node_newfunction ice_devlink_rate_node_delfunction ice_devlink_rate_leaf_tx_max_setfunction ice_devlink_rate_leaf_tx_share_setfunction ice_devlink_rate_leaf_tx_priority_set
Annotated Snippet
struct ice_info_ctx {
char buf[128];
struct ice_orom_info pending_orom;
struct ice_nvm_info pending_nvm;
struct ice_netlist_info pending_netlist;
struct ice_hw_dev_caps dev_caps;
};
/* The following functions are used to format specific strings for various
* devlink info versions. The ctx parameter is used to provide the storage
* buffer, as well as any ancillary information calculated when the info
* request was made.
*
* If a version does not exist, for example when attempting to get the
* inactive version of flash when there is no pending update, the function
* should leave the buffer in the ctx structure empty.
*/
static void ice_info_get_dsn(struct ice_pf *pf, struct ice_info_ctx *ctx)
{
u8 dsn[8];
/* Copy the DSN into an array in Big Endian format */
put_unaligned_be64(pci_get_dsn(pf->pdev), dsn);
snprintf(ctx->buf, sizeof(ctx->buf), "%8phD", dsn);
}
static void ice_info_pba(struct ice_pf *pf, struct ice_info_ctx *ctx)
{
struct ice_hw *hw = &pf->hw;
int status;
status = ice_read_pba_string(hw, (u8 *)ctx->buf, sizeof(ctx->buf));
if (status)
/* We failed to locate the PBA, so just skip this entry */
dev_dbg(ice_pf_to_dev(pf), "Failed to read Product Board Assembly string, status %d\n",
status);
}
static void ice_info_fw_mgmt(struct ice_pf *pf, struct ice_info_ctx *ctx)
{
struct ice_hw *hw = &pf->hw;
snprintf(ctx->buf, sizeof(ctx->buf), "%u.%u.%u",
hw->fw_maj_ver, hw->fw_min_ver, hw->fw_patch);
}
static void ice_info_fw_api(struct ice_pf *pf, struct ice_info_ctx *ctx)
{
struct ice_hw *hw = &pf->hw;
snprintf(ctx->buf, sizeof(ctx->buf), "%u.%u.%u", hw->api_maj_ver,
hw->api_min_ver, hw->api_patch);
}
static void ice_info_fw_build(struct ice_pf *pf, struct ice_info_ctx *ctx)
{
struct ice_hw *hw = &pf->hw;
snprintf(ctx->buf, sizeof(ctx->buf), "0x%08x", hw->fw_build);
}
static void ice_info_orom_ver(struct ice_pf *pf, struct ice_info_ctx *ctx)
{
struct ice_orom_info *orom = &pf->hw.flash.orom;
snprintf(ctx->buf, sizeof(ctx->buf), "%u.%u.%u",
orom->major, orom->build, orom->patch);
}
static void
ice_info_pending_orom_ver(struct ice_pf __always_unused *pf,
struct ice_info_ctx *ctx)
{
struct ice_orom_info *orom = &ctx->pending_orom;
if (ctx->dev_caps.common_cap.nvm_update_pending_orom)
snprintf(ctx->buf, sizeof(ctx->buf), "%u.%u.%u",
orom->major, orom->build, orom->patch);
}
static void ice_info_nvm_ver(struct ice_pf *pf, struct ice_info_ctx *ctx)
{
struct ice_nvm_info *nvm = &pf->hw.flash.nvm;
snprintf(ctx->buf, sizeof(ctx->buf), "%x.%02x", nvm->major, nvm->minor);
}
static void
Annotation
- Immediate include surface: `linux/vmalloc.h`, `ice.h`, `ice_lib.h`, `devlink.h`, `port.h`, `ice_eswitch.h`, `ice_fw_update.h`, `ice_dcb_lib.h`.
- Detected declarations: `struct ice_info_ctx`, `enum ice_version_type`, `enum ice_param_id`, `function ice_info_get_dsn`, `function ice_info_pba`, `function ice_info_fw_mgmt`, `function ice_info_fw_api`, `function ice_info_fw_build`, `function ice_info_orom_ver`, `function ice_info_pending_orom_ver`.
- 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.