drivers/net/ethernet/intel/i40e/i40e_txrx.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/intel/i40e/i40e_txrx.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/intel/i40e/i40e_txrx.c- Extension
.c- Size
- 114308 bytes
- Lines
- 4042
- 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/bpf_trace.hlinux/net/intel/libie/pctype.hlinux/net/intel/libie/rx.hlinux/prefetch.hlinux/sctp.hnet/mpls.hnet/xdp.hi40e_txrx_common.hi40e_trace.hi40e_xsk.h
Detected Declarations
enum ip_verfunction i40e_fdirfunction i40e_program_fdir_filterfunction i40e_create_dummy_udp_packetfunction i40e_create_dummy_tcp_packetfunction i40e_create_dummy_sctp_packetfunction i40e_prepare_fdir_filterfunction i40e_change_filter_numfunction i40e_add_del_fdir_udpfunction i40e_add_del_fdir_tcpfunction i40e_add_del_fdir_sctpfunction i40e_add_del_fdir_ipfunction i40e_add_del_fdirfunction i40e_fd_handle_statusfunction i40e_unmap_and_free_tx_resourcefunction i40e_clean_tx_ringfunction i40e_free_tx_resourcesfunction i40e_get_tx_pendingfunction i40e_detect_recover_hungfunction i40e_clean_tx_irqfunction i40e_enable_wb_on_itrfunction i40e_force_wbfunction i40e_container_is_rxfunction i40e_itr_divisorfunction i40e_update_itrfunction i40e_reuse_rx_pagefunction i40e_clean_programming_statusfunction i40e_setup_tx_descriptorsfunction i40e_clear_rx_bifunction i40e_clean_rx_ringfunction i40e_free_rx_resourcesfunction i40e_setup_rx_descriptorsfunction i40e_release_rx_descfunction i40e_rx_frame_truesizefunction i40e_alloc_mapped_pagefunction i40e_alloc_rx_buffersfunction i40e_rx_checksumfunction i40e_rx_hashfunction i40e_process_skb_fieldsfunction i40e_cleanup_headersfunction i40e_can_reuse_rx_pagefunction i40e_rx_buffer_flipfunction i40e_put_rx_bufferfunction i40e_process_rx_buffsfunction i40e_is_non_eopfunction i40e_xmit_xdp_tx_ringfunction i40e_run_xdpfunction i40e_xdp_ring_update_tail
Annotated Snippet
switch (input->ipl4_proto) {
case IPPROTO_TCP:
ret = i40e_add_del_fdir_tcp(vsi, input, add, ipv4);
break;
case IPPROTO_UDP:
ret = i40e_add_del_fdir_udp(vsi, input, add, ipv4);
break;
case IPPROTO_SCTP:
ret = i40e_add_del_fdir_sctp(vsi, input, add, ipv4);
break;
case IPPROTO_IP:
ret = i40e_add_del_fdir_ip(vsi, input, add, ipv4);
break;
default:
/* We cannot support masking based on protocol */
dev_info(&pf->pdev->dev, "Unsupported IPv4 protocol 0x%02x\n",
input->ipl4_proto);
return -EINVAL;
}
break;
case IPV6_USER_FLOW:
switch (input->ipl4_proto) {
case IPPROTO_TCP:
ret = i40e_add_del_fdir_tcp(vsi, input, add, ipv6);
break;
case IPPROTO_UDP:
ret = i40e_add_del_fdir_udp(vsi, input, add, ipv6);
break;
case IPPROTO_SCTP:
ret = i40e_add_del_fdir_sctp(vsi, input, add, ipv6);
break;
case IPPROTO_IP:
ret = i40e_add_del_fdir_ip(vsi, input, add, ipv6);
break;
default:
/* We cannot support masking based on protocol */
dev_info(&pf->pdev->dev, "Unsupported IPv6 protocol 0x%02x\n",
input->ipl4_proto);
return -EINVAL;
}
break;
default:
dev_info(&pf->pdev->dev, "Unsupported flow type 0x%02x\n",
input->flow_type);
return -EINVAL;
}
/* The buffer allocated here will be normally be freed by
* i40e_clean_fdir_tx_irq() as it reclaims resources after transmit
* completion. In the event of an error adding the buffer to the FDIR
* ring, it will immediately be freed. It may also be freed by
* i40e_clean_tx_ring() when closing the VSI.
*/
return ret;
}
/**
* i40e_fd_handle_status - check the Programming Status for FD
* @rx_ring: the Rx ring for this descriptor
* @qword0_raw: qword0
* @qword1: qword1 after le_to_cpu
* @prog_id: the id originally used for programming
*
* This is used to verify if the FD programming or invalidation
* requested by SW to the HW is successful or not and take actions accordingly.
**/
static void i40e_fd_handle_status(struct i40e_ring *rx_ring, u64 qword0_raw,
u64 qword1, u8 prog_id)
{
struct i40e_pf *pf = rx_ring->vsi->back;
struct pci_dev *pdev = pf->pdev;
struct i40e_16b_rx_wb_qw0 *qw0;
u32 fcnt_prog, fcnt_avail;
u32 error;
qw0 = (struct i40e_16b_rx_wb_qw0 *)&qword0_raw;
error = FIELD_GET(I40E_RX_PROG_STATUS_DESC_QW1_ERROR_MASK, qword1);
if (error == BIT(I40E_RX_PROG_STATUS_DESC_FD_TBL_FULL_SHIFT)) {
pf->fd_inv = le32_to_cpu(qw0->hi_dword.fd_id);
if (qw0->hi_dword.fd_id != 0 ||
(I40E_DEBUG_FD & pf->hw.debug_mask))
dev_warn(&pdev->dev, "ntuple filter loc = %d, could not be added\n",
pf->fd_inv);
/* Check if the programming error is for ATR.
* If so, auto disable ATR and set a state for
* flush in progress. Next time we come here if flush is in
* progress do nothing, once flush is complete the state will
* be cleared.
Annotation
- Immediate include surface: `linux/bpf_trace.h`, `linux/net/intel/libie/pctype.h`, `linux/net/intel/libie/rx.h`, `linux/prefetch.h`, `linux/sctp.h`, `net/mpls.h`, `net/xdp.h`, `i40e_txrx_common.h`.
- Detected declarations: `enum ip_ver`, `function i40e_fdir`, `function i40e_program_fdir_filter`, `function i40e_create_dummy_udp_packet`, `function i40e_create_dummy_tcp_packet`, `function i40e_create_dummy_sctp_packet`, `function i40e_prepare_fdir_filter`, `function i40e_change_filter_num`, `function i40e_add_del_fdir_udp`, `function i40e_add_del_fdir_tcp`.
- 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.