drivers/net/ethernet/intel/ixgbe/ixgbe_xsk.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/intel/ixgbe/ixgbe_xsk.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/intel/ixgbe/ixgbe_xsk.c- Extension
.c- Size
- 13124 bytes
- Lines
- 567
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/bpf_trace.hnet/xdp_sock_drv.hnet/xdp.hixgbe.hixgbe_txrx_common.h
Detected Declarations
function ixgbe_xsk_pool_enablefunction ixgbe_xsk_pool_disablefunction ixgbe_xsk_pool_setupfunction ixgbe_run_xdp_zcfunction ixgbe_alloc_rx_buffers_zcfunction ixgbe_inc_ntcfunction ixgbe_clean_rx_irq_zcfunction ixgbe_xsk_clean_rx_ringfunction ixgbe_xmit_zcfunction ixgbe_clean_xdp_tx_bufferfunction ixgbe_clean_xdp_tx_irqfunction ixgbe_xsk_wakeupfunction ixgbe_xsk_clean_tx_ring
Annotated Snippet
if (err) {
clear_bit(qid, adapter->af_xdp_zc_qps);
xsk_pool_dma_unmap(pool, IXGBE_RX_DMA_ATTR);
return err;
}
}
return 0;
}
static int ixgbe_xsk_pool_disable(struct ixgbe_adapter *adapter, u16 qid)
{
struct xsk_buff_pool *pool;
bool if_running;
pool = xsk_get_pool_from_qid(adapter->netdev, qid);
if (!pool)
return -EINVAL;
if_running = netif_running(adapter->netdev) &&
ixgbe_enabled_xdp_adapter(adapter);
if (if_running)
ixgbe_txrx_ring_disable(adapter, qid);
clear_bit(qid, adapter->af_xdp_zc_qps);
xsk_pool_dma_unmap(pool, IXGBE_RX_DMA_ATTR);
if (if_running)
ixgbe_txrx_ring_enable(adapter, qid);
return 0;
}
int ixgbe_xsk_pool_setup(struct ixgbe_adapter *adapter,
struct xsk_buff_pool *pool,
u16 qid)
{
return pool ? ixgbe_xsk_pool_enable(adapter, pool, qid) :
ixgbe_xsk_pool_disable(adapter, qid);
}
static int ixgbe_run_xdp_zc(struct ixgbe_adapter *adapter,
struct ixgbe_ring *rx_ring,
struct xdp_buff *xdp)
{
int err, result = IXGBE_XDP_PASS;
struct bpf_prog *xdp_prog;
struct ixgbe_ring *ring;
struct xdp_frame *xdpf;
u32 act;
xdp_prog = READ_ONCE(rx_ring->xdp_prog);
act = bpf_prog_run_xdp(xdp_prog, xdp);
if (likely(act == XDP_REDIRECT)) {
err = xdp_do_redirect(rx_ring->netdev, xdp, xdp_prog);
if (!err)
return IXGBE_XDP_REDIR;
if (xsk_uses_need_wakeup(rx_ring->xsk_pool) && err == -ENOBUFS)
result = IXGBE_XDP_EXIT;
else
result = IXGBE_XDP_CONSUMED;
goto out_failure;
}
switch (act) {
case XDP_PASS:
break;
case XDP_TX:
xdpf = xdp_convert_buff_to_frame(xdp);
if (unlikely(!xdpf))
goto out_failure;
ring = ixgbe_determine_xdp_ring(adapter);
if (static_branch_unlikely(&ixgbe_xdp_locking_key))
spin_lock(&ring->tx_lock);
result = ixgbe_xmit_xdp_ring(ring, xdpf);
if (static_branch_unlikely(&ixgbe_xdp_locking_key))
spin_unlock(&ring->tx_lock);
if (result == IXGBE_XDP_CONSUMED)
goto out_failure;
break;
case XDP_DROP:
result = IXGBE_XDP_CONSUMED;
break;
default:
bpf_warn_invalid_xdp_action(rx_ring->netdev, xdp_prog, act);
fallthrough;
case XDP_ABORTED:
result = IXGBE_XDP_CONSUMED;
Annotation
- Immediate include surface: `linux/bpf_trace.h`, `net/xdp_sock_drv.h`, `net/xdp.h`, `ixgbe.h`, `ixgbe_txrx_common.h`.
- Detected declarations: `function ixgbe_xsk_pool_enable`, `function ixgbe_xsk_pool_disable`, `function ixgbe_xsk_pool_setup`, `function ixgbe_run_xdp_zc`, `function ixgbe_alloc_rx_buffers_zc`, `function ixgbe_inc_ntc`, `function ixgbe_clean_rx_irq_zc`, `function ixgbe_xsk_clean_rx_ring`, `function ixgbe_xmit_zc`, `function ixgbe_clean_xdp_tx_buffer`.
- 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.
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.