drivers/net/ethernet/intel/i40e/i40e_common.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/intel/i40e/i40e_common.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/intel/i40e/i40e_common.c- Extension
.c- Size
- 147854 bytes
- Lines
- 5257
- 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/avf/virtchnl.hlinux/bitfield.hlinux/delay.hlinux/etherdevice.hlinux/pci.hi40e_adminq_cmd.hi40e_devids.hi40e_prototype.hi40e_register.h
Detected Declarations
function i40e_set_mac_typefunction i40e_debug_aqfunction i40e_check_asq_alivefunction i40e_aq_queue_shutdownfunction i40e_aq_get_set_rss_lutfunction i40e_aq_get_rss_lutfunction i40e_aq_set_rss_lutfunction i40e_aq_get_set_rss_keyfunction i40e_aq_get_rss_keyfunction i40e_aq_set_rss_keyfunction i40e_init_shared_codefunction i40e_aq_mac_address_readfunction i40e_aq_mac_address_writefunction i40e_get_mac_addrfunction i40e_get_port_mac_addrfunction i40e_pre_tx_queue_cfgfunction i40e_get_pba_stringfunction i40e_get_media_typefunction i40e_poll_globrfunction i40e_pf_resetfunction i40e_clear_hwfunction i40e_clear_pxe_modefunction i40e_led_is_minefunction i40e_led_getfunction i40e_led_setfunction i40e_aq_get_phy_capabilitiesfunction i40e_aq_set_phy_configfunction i40e_set_fc_statusfunction i40e_set_fcfunction configurationfunction i40e_aq_clear_pxe_modefunction i40e_aq_set_link_restart_anfunction i40e_aq_get_link_infofunction i40e_aq_set_phy_int_maskfunction i40e_aq_set_mac_loopbackfunction i40e_aq_set_phy_debugfunction i40e_aq_add_vsifunction i40e_aq_set_default_vsifunction i40e_aq_clear_default_vsifunction i40e_aq_set_vsi_unicast_promiscuousfunction i40e_aq_set_vsi_multicast_promiscuousfunction i40e_aq_set_vsi_mc_promisc_on_vlanfunction i40e_aq_set_vsi_uc_promisc_on_vlanfunction i40e_aq_set_vsi_bc_promisc_on_vlanfunction flagfunction i40e_aq_get_vsi_paramsfunction i40e_aq_update_vsi_paramsfunction i40e_aq_get_switch_config
Annotated Snippet
switch (hw->device_id) {
case I40E_DEV_ID_SFP_XL710:
case I40E_DEV_ID_QEMU:
case I40E_DEV_ID_KX_B:
case I40E_DEV_ID_KX_C:
case I40E_DEV_ID_QSFP_A:
case I40E_DEV_ID_QSFP_B:
case I40E_DEV_ID_QSFP_C:
case I40E_DEV_ID_1G_BASE_T_BC:
case I40E_DEV_ID_5G_BASE_T_BC:
case I40E_DEV_ID_10G_BASE_T:
case I40E_DEV_ID_10G_BASE_T4:
case I40E_DEV_ID_10G_BASE_T_BC:
case I40E_DEV_ID_10G_B:
case I40E_DEV_ID_10G_SFP:
case I40E_DEV_ID_20G_KR2:
case I40E_DEV_ID_20G_KR2_A:
case I40E_DEV_ID_25G_B:
case I40E_DEV_ID_25G_SFP28:
case I40E_DEV_ID_X710_N3000:
case I40E_DEV_ID_XXV710_N3000:
hw->mac.type = I40E_MAC_XL710;
break;
case I40E_DEV_ID_KX_X722:
case I40E_DEV_ID_QSFP_X722:
case I40E_DEV_ID_SFP_X722:
case I40E_DEV_ID_1G_BASE_T_X722:
case I40E_DEV_ID_10G_BASE_T_X722:
case I40E_DEV_ID_SFP_I_X722:
case I40E_DEV_ID_SFP_X722_A:
hw->mac.type = I40E_MAC_X722;
break;
default:
hw->mac.type = I40E_MAC_GENERIC;
break;
}
} else {
status = -ENODEV;
}
hw_dbg(hw, "i40e_set_mac_type found mac: %d, returns: %d\n",
hw->mac.type, status);
return status;
}
/**
* i40e_debug_aq
* @hw: debug mask related to admin queue
* @mask: debug mask
* @desc: pointer to admin queue descriptor
* @buffer: pointer to command buffer
* @buf_len: max length of buffer
*
* Dumps debug log about adminq command with descriptor contents.
**/
void i40e_debug_aq(struct i40e_hw *hw, enum i40e_debug_mask mask, void *desc,
void *buffer, u16 buf_len)
{
struct libie_aq_desc *aq_desc = (struct libie_aq_desc *)desc;
u32 effective_mask = hw->debug_mask & mask;
char prefix[27];
u16 len;
u8 *buf = (u8 *)buffer;
if (!effective_mask || !desc)
return;
len = le16_to_cpu(aq_desc->datalen);
i40e_debug(hw, mask & I40E_DEBUG_AQ_DESCRIPTOR,
"AQ CMD: opcode 0x%04X, flags 0x%04X, datalen 0x%04X, retval 0x%04X\n",
le16_to_cpu(aq_desc->opcode),
le16_to_cpu(aq_desc->flags),
le16_to_cpu(aq_desc->datalen),
le16_to_cpu(aq_desc->retval));
i40e_debug(hw, mask & I40E_DEBUG_AQ_DESCRIPTOR,
"\tcookie (h,l) 0x%08X 0x%08X\n",
le32_to_cpu(aq_desc->cookie_high),
le32_to_cpu(aq_desc->cookie_low));
i40e_debug(hw, mask & I40E_DEBUG_AQ_DESCRIPTOR,
"\tparam (0,1) 0x%08X 0x%08X\n",
le32_to_cpu(aq_desc->params.generic.param0),
le32_to_cpu(aq_desc->params.generic.param1));
i40e_debug(hw, mask & I40E_DEBUG_AQ_DESCRIPTOR,
"\taddr (h,l) 0x%08X 0x%08X\n",
le32_to_cpu(aq_desc->params.generic.addr_high),
le32_to_cpu(aq_desc->params.generic.addr_low));
if (buffer && buf_len != 0 && len != 0 &&
(effective_mask & I40E_DEBUG_AQ_DESC_BUFFER)) {
Annotation
- Immediate include surface: `linux/avf/virtchnl.h`, `linux/bitfield.h`, `linux/delay.h`, `linux/etherdevice.h`, `linux/pci.h`, `i40e_adminq_cmd.h`, `i40e_devids.h`, `i40e_prototype.h`.
- Detected declarations: `function i40e_set_mac_type`, `function i40e_debug_aq`, `function i40e_check_asq_alive`, `function i40e_aq_queue_shutdown`, `function i40e_aq_get_set_rss_lut`, `function i40e_aq_get_rss_lut`, `function i40e_aq_set_rss_lut`, `function i40e_aq_get_set_rss_key`, `function i40e_aq_get_rss_key`, `function i40e_aq_set_rss_key`.
- 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.