drivers/net/ethernet/intel/i40e/i40e_main.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/intel/i40e/i40e_main.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/intel/i40e/i40e_main.c- Extension
.c- Size
- 471475 bytes
- Lines
- 16683
- Domain
- Driver Families
- Bucket
- drivers/net
- Inferred role
- Driver Families: operation-table or driver-model contract
- Status
- pattern 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 an operation table; this is where Linux turns generic core objects into subsystem-specific behavior.
- 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
generated/utsrelease.hlinux/crash_dump.hlinux/net/intel/libie/pctype.hlinux/if_bridge.hlinux/if_macvlan.hlinux/module.hnet/pkt_cls.hnet/xdp_sock_drv.hi40e.hi40e_devids.hi40e_diag.hi40e_lan_hmc.hi40e_virtchnl_pf.hi40e_xsk.hi40e_trace.h
Detected Declarations
function netdev_hw_addr_refcntfunction netdev_hw_addr_list_for_eachfunction i40e_allocate_dma_memfunction i40e_free_dma_memfunction i40e_allocate_virt_memfunction i40e_free_virt_memfunction i40e_get_lumpfunction i40e_put_lumpfunction i40e_service_event_schedulefunction i40e_tx_timeoutfunction i40e_get_netdev_stats_struct_txfunction i40e_get_netdev_stats_structfunction i40e_vsi_reset_statsfunction i40e_pf_reset_statsfunction i40e_pf_for_each_vebfunction i40e_compute_pci_to_hw_idfunction i40e_stat_update64function i40e_stat_update48function i40e_stat_update32function i40e_stat_update_and_clear32function i40e_stats_update_rx_discardsfunction i40e_update_eth_statsfunction i40e_update_veb_statsfunction i40e_update_vsi_statsfunction i40e_update_pf_statsfunction i40e_update_statsfunction i40e_count_all_filtersfunction i40e_count_active_filtersfunction hash_for_each_safefunction i40e_is_vsi_in_vlanfunction i40e_correct_mac_vlan_filtersfunction i40e_get_vf_new_vlanfunction i40e_correct_vf_mac_vlan_filtersfunction hlist_for_each_entryfunction hash_for_each_safefunction i40e_rm_default_mac_filterfunction list_for_each_entryfunction hash_for_each_safefunction i40e_del_mac_filterfunction i40e_set_macfunction i40e_config_rss_aqfunction i40e_vsi_config_rssfunction i40e_vsi_setup_queue_map_mqpriofunction i40e_vsi_setup_queue_mapfunction __dev_function __dev_function i40e_set_rx_modefunction i40e_undo_del_filter_entries
Annotated Snippet
static const struct net_device_ops i40e_netdev_ops = {
.ndo_open = i40e_open,
.ndo_stop = i40e_close,
.ndo_start_xmit = i40e_lan_xmit_frame,
.ndo_get_stats64 = i40e_get_netdev_stats_struct,
.ndo_set_rx_mode = i40e_set_rx_mode,
.ndo_validate_addr = eth_validate_addr,
.ndo_set_mac_address = i40e_set_mac,
.ndo_change_mtu = i40e_change_mtu,
.ndo_tx_timeout = i40e_tx_timeout,
.ndo_vlan_rx_add_vid = i40e_vlan_rx_add_vid,
.ndo_vlan_rx_kill_vid = i40e_vlan_rx_kill_vid,
#ifdef CONFIG_NET_POLL_CONTROLLER
.ndo_poll_controller = i40e_netpoll,
#endif
.ndo_setup_tc = __i40e_setup_tc,
.ndo_select_queue = i40e_lan_select_queue,
.ndo_set_features = i40e_set_features,
.ndo_set_vf_mac = i40e_ndo_set_vf_mac,
.ndo_set_vf_vlan = i40e_ndo_set_vf_port_vlan,
.ndo_get_vf_stats = i40e_get_vf_stats,
.ndo_set_vf_rate = i40e_ndo_set_vf_bw,
.ndo_get_vf_config = i40e_ndo_get_vf_config,
.ndo_set_vf_link_state = i40e_ndo_set_vf_link_state,
.ndo_set_vf_spoofchk = i40e_ndo_set_vf_spoofchk,
.ndo_set_vf_trust = i40e_ndo_set_vf_trust,
.ndo_get_phys_port_id = i40e_get_phys_port_id,
.ndo_fdb_add = i40e_ndo_fdb_add,
.ndo_features_check = i40e_features_check,
.ndo_bridge_getlink = i40e_ndo_bridge_getlink,
.ndo_bridge_setlink = i40e_ndo_bridge_setlink,
.ndo_bpf = i40e_xdp,
.ndo_xdp_xmit = i40e_xdp_xmit,
.ndo_xsk_wakeup = i40e_xsk_wakeup,
.ndo_dfwd_add_station = i40e_fwd_add,
.ndo_dfwd_del_station = i40e_fwd_del,
.ndo_hwtstamp_get = i40e_ptp_hwtstamp_get,
.ndo_hwtstamp_set = i40e_ptp_hwtstamp_set,
};
/**
* i40e_config_netdev - Setup the netdev flags
* @vsi: the VSI being configured
*
* Returns 0 on success, negative value on failure
**/
static int i40e_config_netdev(struct i40e_vsi *vsi)
{
struct i40e_pf *pf = vsi->back;
struct i40e_hw *hw = &pf->hw;
struct i40e_netdev_priv *np;
struct net_device *netdev;
u8 broadcast[ETH_ALEN];
u8 mac_addr[ETH_ALEN];
int etherdev_size;
netdev_features_t hw_enc_features;
netdev_features_t hw_features;
etherdev_size = sizeof(struct i40e_netdev_priv);
netdev = alloc_etherdev_mq(etherdev_size, vsi->alloc_queue_pairs);
if (!netdev)
return -ENOMEM;
vsi->netdev = netdev;
np = netdev_priv(netdev);
np->vsi = vsi;
hw_enc_features = NETIF_F_SG |
NETIF_F_HW_CSUM |
NETIF_F_HIGHDMA |
NETIF_F_SOFT_FEATURES |
NETIF_F_TSO |
NETIF_F_TSO_ECN |
NETIF_F_TSO6 |
NETIF_F_GSO_GRE |
NETIF_F_GSO_GRE_CSUM |
NETIF_F_GSO_PARTIAL |
NETIF_F_GSO_IPXIP4 |
NETIF_F_GSO_IPXIP6 |
NETIF_F_GSO_UDP_TUNNEL |
NETIF_F_GSO_UDP_TUNNEL_CSUM |
NETIF_F_GSO_UDP_L4 |
NETIF_F_SCTP_CRC |
NETIF_F_RXHASH |
NETIF_F_RXCSUM |
0;
if (!test_bit(I40E_HW_CAP_OUTER_UDP_CSUM, pf->hw.caps))
netdev->gso_partial_features |= NETIF_F_GSO_UDP_TUNNEL_CSUM;
Annotation
- Immediate include surface: `generated/utsrelease.h`, `linux/crash_dump.h`, `linux/net/intel/libie/pctype.h`, `linux/if_bridge.h`, `linux/if_macvlan.h`, `linux/module.h`, `net/pkt_cls.h`, `net/xdp_sock_drv.h`.
- Detected declarations: `function netdev_hw_addr_refcnt`, `function netdev_hw_addr_list_for_each`, `function i40e_allocate_dma_mem`, `function i40e_free_dma_mem`, `function i40e_allocate_virt_mem`, `function i40e_free_virt_mem`, `function i40e_get_lump`, `function i40e_put_lump`, `function i40e_service_event_schedule`, `function i40e_tx_timeout`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: pattern 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.