drivers/net/ethernet/intel/ice/ice_xsk.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/intel/ice/ice_xsk.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/intel/ice/ice_xsk.c- Extension
.c- Size
- 24551 bytes
- Lines
- 942
- 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/unroll.hnet/libeth/xdp.hnet/xdp_sock_drv.hnet/xdp.hice.hice_base.hice_type.hice_xsk.hice_txrx.hice_txrx_lib.hice_lib.h
Detected Declarations
function ice_qvec_toggle_napifunction ice_qvec_dis_irqfunction ice_qvec_cfg_msixfunction ice_qvec_ena_irqfunction ice_xsk_pool_disablefunction ice_xsk_pool_enablefunction ice_realloc_rx_xdp_bufsfunction ice_xsk_pool_setupfunction ice_fill_rx_descsfunction __ice_alloc_rx_bufs_zcfunction ice_alloc_rx_bufs_zcfunction ice_clean_xdp_irq_zcfunction cpu_to_le64function xsk_buff_freefunction ice_run_xdp_zcfunction ice_clean_rx_irq_zcfunction ice_xmit_pktfunction ice_xmit_pkt_batchfunction ice_fill_tx_hw_ringfunction ice_xmit_zcfunction ice_xsk_wakeupfunction ice_xsk_any_rx_ring_enafunction ice_for_each_rxqfunction ice_xsk_clean_rx_ringfunction ice_xsk_clean_xdp_ring
Annotated Snippet
if (ret) {
netdev_err(vsi->netdev, "ice_qp_dis error = %d\n", ret);
goto xsk_pool_if_up;
}
ret = ice_realloc_rx_xdp_bufs(rx_ring, pool_present);
if (ret)
goto xsk_pool_if_up;
}
pool_failure = pool_present ? ice_xsk_pool_enable(vsi, pool, qid) :
ice_xsk_pool_disable(vsi, qid);
xsk_pool_if_up:
if (if_running) {
ret = ice_qp_ena(vsi, qid);
if (!ret && pool_present)
napi_schedule(&vsi->rx_rings[qid]->xdp_ring->q_vector->napi);
else if (ret)
netdev_err(vsi->netdev, "ice_qp_ena error = %d\n", ret);
}
failure:
if (pool_failure) {
netdev_err(vsi->netdev, "Could not %sable buffer pool, error = %d\n",
pool_present ? "en" : "dis", pool_failure);
return pool_failure;
}
return ret;
}
/**
* ice_fill_rx_descs - pick buffers from XSK buffer pool and use it
* @pool: XSK Buffer pool to pull the buffers from
* @xdp: SW ring of xdp_buff that will hold the buffers
* @rx_desc: Pointer to Rx descriptors that will be filled
* @count: The number of buffers to allocate
*
* This function allocates a number of Rx buffers from the fill ring
* or the internal recycle mechanism and places them on the Rx ring.
*
* Note that ring wrap should be handled by caller of this function.
*
* Returns the amount of allocated Rx descriptors
*/
static u16 ice_fill_rx_descs(struct xsk_buff_pool *pool, struct xdp_buff **xdp,
union ice_32b_rx_flex_desc *rx_desc, u16 count)
{
dma_addr_t dma;
u16 buffs;
int i;
buffs = xsk_buff_alloc_batch(pool, xdp, count);
for (i = 0; i < buffs; i++) {
dma = xsk_buff_xdp_get_dma(*xdp);
rx_desc->read.pkt_addr = cpu_to_le64(dma);
rx_desc->wb.status_error0 = 0;
rx_desc++;
xdp++;
}
return buffs;
}
/**
* __ice_alloc_rx_bufs_zc - allocate a number of Rx buffers
* @rx_ring: Rx ring
* @xsk_pool: XSK buffer pool to pick buffers to be filled by HW
* @count: The number of buffers to allocate
*
* Place the @count of descriptors onto Rx ring. Handle the ring wrap
* for case where space from next_to_use up to the end of ring is less
* than @count. Finally do a tail bump.
*
* Returns true if all allocations were successful, false if any fail.
*/
static bool __ice_alloc_rx_bufs_zc(struct ice_rx_ring *rx_ring,
struct xsk_buff_pool *xsk_pool, u16 count)
{
u32 nb_buffs_extra = 0, nb_buffs = 0;
union ice_32b_rx_flex_desc *rx_desc;
u16 ntu = rx_ring->next_to_use;
u16 total_count = count;
struct xdp_buff **xdp;
rx_desc = ICE_RX_DESC(rx_ring, ntu);
xdp = ice_xdp_buf(rx_ring, ntu);
Annotation
- Immediate include surface: `linux/bpf_trace.h`, `linux/unroll.h`, `net/libeth/xdp.h`, `net/xdp_sock_drv.h`, `net/xdp.h`, `ice.h`, `ice_base.h`, `ice_type.h`.
- Detected declarations: `function ice_qvec_toggle_napi`, `function ice_qvec_dis_irq`, `function ice_qvec_cfg_msix`, `function ice_qvec_ena_irq`, `function ice_xsk_pool_disable`, `function ice_xsk_pool_enable`, `function ice_realloc_rx_xdp_bufs`, `function ice_xsk_pool_setup`, `function ice_fill_rx_descs`, `function __ice_alloc_rx_bufs_zc`.
- 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.