drivers/net/ethernet/intel/igb/igb_xsk.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/intel/igb/igb_xsk.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/intel/igb/igb_xsk.c- Extension
.c- Size
- 14266 bytes
- Lines
- 585
- 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.hnet/xdp_sock_drv.hnet/xdp.he1000_hw.higb.h
Detected Declarations
function igb_realloc_rx_buffer_infofunction igb_txrx_ring_disablefunction igb_txrx_ring_enablefunction igb_xsk_pool_enablefunction igb_xsk_pool_disablefunction igb_xsk_pool_setupfunction igb_fill_rx_descsfunction igb_alloc_rx_buffers_zcfunction igb_clean_rx_ring_zcfunction igb_run_xdp_zcfunction igb_clean_rx_irq_zcfunction igb_xmit_zcfunction igb_sw_irq_prepfunction igb_xsk_wakeup
Annotated Snippet
if (!err) {
igb_txrx_ring_enable(adapter, qid);
/* Kick start the NAPI context so that receiving will start */
err = igb_xsk_wakeup(adapter->netdev, qid, XDP_WAKEUP_RX);
}
if (err) {
xsk_pool_dma_unmap(pool, IGB_RX_DMA_ATTR);
return err;
}
}
return 0;
}
static int igb_xsk_pool_disable(struct igb_adapter *adapter, u16 qid)
{
struct xsk_buff_pool *pool;
struct igb_ring *rx_ring;
bool if_running;
int err;
pool = xsk_get_pool_from_qid(adapter->netdev, qid);
if (!pool)
return -EINVAL;
rx_ring = adapter->rx_ring[qid];
if_running = netif_running(adapter->netdev) && igb_xdp_is_enabled(adapter);
if (if_running)
igb_txrx_ring_disable(adapter, qid);
xsk_pool_dma_unmap(pool, IGB_RX_DMA_ATTR);
if (if_running) {
err = igb_realloc_rx_buffer_info(rx_ring, false);
if (err)
return err;
igb_txrx_ring_enable(adapter, qid);
}
return 0;
}
int igb_xsk_pool_setup(struct igb_adapter *adapter,
struct xsk_buff_pool *pool,
u16 qid)
{
return pool ? igb_xsk_pool_enable(adapter, pool, qid) :
igb_xsk_pool_disable(adapter, qid);
}
static u16 igb_fill_rx_descs(struct xsk_buff_pool *pool, struct xdp_buff **xdp,
union e1000_adv_rx_desc *rx_desc, u16 count)
{
dma_addr_t dma;
u16 buffs;
int i;
/* nothing to do */
if (!count)
return 0;
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.upper.length = 0;
rx_desc++;
xdp++;
}
return buffs;
}
bool igb_alloc_rx_buffers_zc(struct igb_ring *rx_ring,
struct xsk_buff_pool *xsk_pool, u16 count)
{
u32 nb_buffs_extra = 0, nb_buffs = 0;
union e1000_adv_rx_desc *rx_desc;
u16 ntu = rx_ring->next_to_use;
u16 total_count = count;
struct xdp_buff **xdp;
rx_desc = IGB_RX_DESC(rx_ring, ntu);
xdp = &rx_ring->rx_buffer_info_zc[ntu];
if (ntu + count >= rx_ring->count) {
nb_buffs_extra = igb_fill_rx_descs(xsk_pool, xdp, rx_desc,
Annotation
- Immediate include surface: `linux/bpf_trace.h`, `net/xdp_sock_drv.h`, `net/xdp.h`, `e1000_hw.h`, `igb.h`.
- Detected declarations: `function igb_realloc_rx_buffer_info`, `function igb_txrx_ring_disable`, `function igb_txrx_ring_enable`, `function igb_xsk_pool_enable`, `function igb_xsk_pool_disable`, `function igb_xsk_pool_setup`, `function igb_fill_rx_descs`, `function igb_alloc_rx_buffers_zc`, `function igb_clean_rx_ring_zc`, `function igb_run_xdp_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.