drivers/net/ethernet/intel/ice/devlink/port.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/intel/ice/devlink/port.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/intel/ice/devlink/port.c- Extension
.c- Size
- 27189 bytes
- Lines
- 1002
- 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.
- 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.hdevlink.hport.hice_lib.hice_fltr.h
Detected Declarations
function ice_devlink_port_options_printfunction ice_devlink_aq_set_port_optionfunction ice_devlink_port_splitfunction ice_devlink_port_unsplitfunction ice_devlink_set_port_split_optionsfunction ice_devlink_set_switch_idfunction ice_devlink_create_pf_portfunction ice_devlink_destroy_pf_portfunction ice_devlink_port_get_vf_fn_macfunction ice_devlink_port_set_vf_fn_macfunction ice_devlink_create_vf_portfunction ice_devlink_destroy_vf_portfunction ice_devlink_create_sf_dev_portfunction ice_devlink_destroy_sf_dev_portfunction ice_activate_dynamic_portfunction ice_deactivate_dynamic_portfunction ice_dealloc_dynamic_portfunction ice_dealloc_all_dynamic_portsfunction ice_devlink_port_new_check_attrfunction ice_devlink_port_delfunction ice_devlink_port_fn_hw_addr_setfunction ice_devlink_port_fn_hw_addr_getfunction ice_devlink_port_fn_state_setfunction ice_devlink_port_fn_state_getfunction ice_reserve_sf_numfunction ice_devlink_create_sf_portfunction ice_devlink_destroy_sf_portfunction ice_alloc_dynamic_portfunction ice_devlink_port_new
Annotated Snippet
if (status) {
dev_dbg(dev, "Couldn't read port option for port %d, err %d\n",
i, status);
goto err;
}
}
dev_dbg(dev, "Available port split options and max port speeds (Gbps):\n");
dev_dbg(dev, "Status Split Quad 0 Quad 1\n");
dev_dbg(dev, " count L0 L1 L2 L3 L4 L5 L6 L7\n");
for (i = 0; i < options_count; i++) {
cnt = 0;
if (i == ice_active_port_option)
str = "Active";
else if ((i == pending_idx) && pending_valid)
str = "Pending";
else
str = "";
cnt += snprintf(&desc[cnt], ICE_PORT_OPT_DESC_LEN - cnt,
"%-8s", str);
cnt += snprintf(&desc[cnt], ICE_PORT_OPT_DESC_LEN - cnt,
"%-6u", options[i].pmd);
for (j = 0; j < ICE_MAX_PORT_PER_PCI_DEV; ++j) {
speed = options[i + j * ICE_AQC_PORT_OPT_MAX].max_lane_speed;
str = ice_devlink_port_opt_speed_str(speed);
cnt += snprintf(&desc[cnt], ICE_PORT_OPT_DESC_LEN - cnt,
"%3s ", str);
}
dev_dbg(dev, "%s\n", desc);
}
err:
kfree(options);
}
/**
* ice_devlink_aq_set_port_option - Send set port option admin queue command
* @pf: the PF to print split port options
* @option_idx: selected port option
* @extack: extended netdev ack structure
*
* Sends set port option admin queue command with selected port option and
* calls NVM write activate.
*/
static int
ice_devlink_aq_set_port_option(struct ice_pf *pf, u8 option_idx,
struct netlink_ext_ack *extack)
{
struct device *dev = ice_pf_to_dev(pf);
int status;
status = ice_aq_set_port_option(&pf->hw, 0, true, option_idx);
if (status) {
dev_dbg(dev, "ice_aq_set_port_option, err %d aq_err %d\n",
status, pf->hw.adminq.sq_last_status);
NL_SET_ERR_MSG_MOD(extack, "Port split request failed");
return -EIO;
}
status = ice_acquire_nvm(&pf->hw, ICE_RES_WRITE);
if (status) {
dev_dbg(dev, "ice_acquire_nvm failed, err %d aq_err %d\n",
status, pf->hw.adminq.sq_last_status);
NL_SET_ERR_MSG_MOD(extack, "Failed to acquire NVM semaphore");
return -EIO;
}
status = ice_nvm_write_activate(&pf->hw, ICE_AQC_NVM_ACTIV_REQ_EMPR, NULL);
if (status) {
dev_dbg(dev, "ice_nvm_write_activate failed, err %d aq_err %d\n",
status, pf->hw.adminq.sq_last_status);
NL_SET_ERR_MSG_MOD(extack, "Port split request failed to save data");
ice_release_nvm(&pf->hw);
return -EIO;
}
ice_release_nvm(&pf->hw);
NL_SET_ERR_MSG_MOD(extack, "Reboot required to finish port split");
return 0;
}
/**
* ice_devlink_port_split - .port_split devlink handler
Annotation
- Immediate include surface: `linux/vmalloc.h`, `ice.h`, `devlink.h`, `port.h`, `ice_lib.h`, `ice_fltr.h`.
- Detected declarations: `function ice_devlink_port_options_print`, `function ice_devlink_aq_set_port_option`, `function ice_devlink_port_split`, `function ice_devlink_port_unsplit`, `function ice_devlink_set_port_split_options`, `function ice_devlink_set_switch_id`, `function ice_devlink_create_pf_port`, `function ice_devlink_destroy_pf_port`, `function ice_devlink_port_get_vf_fn_mac`, `function ice_devlink_port_set_vf_fn_mac`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: source implementation candidate.
- 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.