drivers/net/ethernet/intel/idpf/idpf_singleq_txrx.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/intel/idpf/idpf_singleq_txrx.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/intel/idpf/idpf_singleq_txrx.c- Extension
.c- Size
- 32552 bytes
- Lines
- 1184
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
net/libeth/xdp.hidpf.h
Detected Declarations
function errorfunction idpf_tx_singleq_dma_map_errorfunction idpf_tx_singleq_mapfunction idpf_tx_singleq_get_ctx_descfunction idpf_tx_singleq_build_ctx_descfunction idpf_tx_singleq_framefunction IDPF_DESC_UNUSEDfunction idpf_tx_singleq_cleanfunction idpf_tx_singleq_clean_allfunction idpf_rx_singleq_test_staterrfunction idpf_rx_singleq_is_non_eopfunction idpf_rx_singleq_csumfunction idpf_rx_singleq_base_csumfunction idpf_rx_singleq_flex_csumfunction idpf_rx_singleq_base_hashfunction idpf_rx_singleq_flex_hashfunction __idpf_rx_singleq_process_skb_fieldsfunction idpf_rx_buf_hw_updatefunction idpf_rx_singleq_buf_hw_alloc_allfunction idpf_rx_singleq_extract_base_fieldsfunction idpf_rx_singleq_extract_flex_fieldsfunction idpf_rx_singleq_extract_fieldsfunction idpf_rx_singleq_process_skb_fieldsfunction idpf_xdp_run_passfunction idpf_rx_singleq_cleanfunction idpf_rx_singleq_clean_allfunction idpf_vport_singleq_napi_poll
Annotated Snippet
if (off->tx_flags & IDPF_TX_FLAGS_IPV4) {
/* The stack computes the IP header already, the only
* time we need the hardware to recompute it is in the
* case of TSO.
*/
tunnel |= is_tso ?
IDPF_TX_CTX_EXT_IP_IPV4 :
IDPF_TX_CTX_EXT_IP_IPV4_NO_CSUM;
l4_proto = ip.v4->protocol;
} else if (off->tx_flags & IDPF_TX_FLAGS_IPV6) {
tunnel |= IDPF_TX_CTX_EXT_IP_IPV6;
l4_proto = ip.v6->nexthdr;
if (ipv6_ext_hdr(l4_proto))
ipv6_skip_exthdr(skb, skb_network_offset(skb) +
sizeof(*ip.v6),
&l4_proto, &frag_off);
}
/* define outer transport */
switch (l4_proto) {
case IPPROTO_UDP:
tunnel |= IDPF_TXD_CTX_UDP_TUNNELING;
break;
case IPPROTO_GRE:
tunnel |= IDPF_TXD_CTX_GRE_TUNNELING;
break;
case IPPROTO_IPIP:
case IPPROTO_IPV6:
l4.hdr = skb_inner_network_header(skb);
break;
default:
if (is_tso)
return -1;
skb_checksum_help(skb);
return 0;
}
off->tx_flags |= IDPF_TX_FLAGS_TUNNEL;
/* compute outer L3 header size */
tunnel |= FIELD_PREP(IDPF_TXD_CTX_QW0_TUNN_EXT_IPLEN_M,
(l4.hdr - ip.hdr) / 4);
/* switch IP header pointer from outer to inner header */
ip.hdr = skb_inner_network_header(skb);
/* compute tunnel header size */
tunnel |= FIELD_PREP(IDPF_TXD_CTX_QW0_TUNN_NATLEN_M,
(ip.hdr - l4.hdr) / 2);
/* indicate if we need to offload outer UDP header */
if (is_tso &&
!(skb_shinfo(skb)->gso_type & SKB_GSO_PARTIAL) &&
(skb_shinfo(skb)->gso_type & SKB_GSO_UDP_TUNNEL_CSUM))
tunnel |= IDPF_TXD_CTX_QW0_TUNN_L4T_CS_M;
/* record tunnel offload values */
off->cd_tunneling |= tunnel;
/* switch L4 header pointer from outer to inner */
l4.hdr = skb_inner_transport_header(skb);
l4_proto = 0;
/* reset type as we transition from outer to inner headers */
off->tx_flags &= ~(IDPF_TX_FLAGS_IPV4 | IDPF_TX_FLAGS_IPV6);
if (ip.v4->version == 4)
off->tx_flags |= IDPF_TX_FLAGS_IPV4;
if (ip.v6->version == 6)
off->tx_flags |= IDPF_TX_FLAGS_IPV6;
}
/* Enable IP checksum offloads */
if (off->tx_flags & IDPF_TX_FLAGS_IPV4) {
l4_proto = ip.v4->protocol;
/* See comment above regarding need for HW to recompute IP
* header checksum in the case of TSO.
*/
if (is_tso)
cmd |= IDPF_TX_DESC_CMD_IIPT_IPV4_CSUM;
else
cmd |= IDPF_TX_DESC_CMD_IIPT_IPV4;
} else if (off->tx_flags & IDPF_TX_FLAGS_IPV6) {
cmd |= IDPF_TX_DESC_CMD_IIPT_IPV6;
l4_proto = ip.v6->nexthdr;
if (ipv6_ext_hdr(l4_proto))
ipv6_skip_exthdr(skb, skb_network_offset(skb) +
Annotation
- Immediate include surface: `net/libeth/xdp.h`, `idpf.h`.
- Detected declarations: `function error`, `function idpf_tx_singleq_dma_map_error`, `function idpf_tx_singleq_map`, `function idpf_tx_singleq_get_ctx_desc`, `function idpf_tx_singleq_build_ctx_desc`, `function idpf_tx_singleq_frame`, `function IDPF_DESC_UNUSED`, `function idpf_tx_singleq_clean`, `function idpf_tx_singleq_clean_all`, `function idpf_rx_singleq_test_staterr`.
- 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.