include/net/xdp_sock_drv.h
Source file repositories/reference/linux-study-clean/include/net/xdp_sock_drv.h
File Facts
- System
- Linux kernel
- Corpus path
include/net/xdp_sock_drv.h- Extension
.h- Size
- 11827 bytes
- Lines
- 502
- Domain
- Networking Core
- Bucket
- Sockets, Protocols, Packet Path, And Network Policy
- Inferred role
- Networking Core: implementation source
- Status
- source implementation candidate
Why This File Exists
Networking stack implementation surface: socket APIs, protocol dispatch, packet flow, routing, filtering, and network namespaces.
- Networking stack implementation surface: socket APIs, protocol dispatch, packet flow, routing, filtering, and network namespaces.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
net/xdp_sock.hnet/xsk_buff_pool.h
Detected Declarations
struct xsk_cb_descfunction xsk_pool_get_headroomfunction xsk_pool_get_tailroomfunction xsk_pool_get_chunk_sizefunction __xsk_pool_get_rx_frame_sizefunction xsk_pool_get_rx_frame_sizefunction xsk_pool_get_rx_frag_stepfunction xsk_pool_set_rxq_infofunction xsk_pool_fill_cbfunction xsk_pool_dma_unmapfunction xsk_pool_dma_mapfunction xsk_buff_xdp_get_dmafunction xsk_buff_xdp_get_frame_dmafunction xsk_is_eop_descfunction xsk_buff_alloc_batchfunction xsk_buff_can_allocfunction xsk_buff_freefunction list_for_each_entry_safefunction xsk_buff_add_fragfunction xsk_buff_del_fragfunction xsk_buff_set_sizefunction xsk_buff_raw_get_dmafunction xp_raw_get_ctxfunction xsk_buff_valid_tx_metadatafunction __xsk_buff_get_metadatafunction xsk_buff_get_metadatafunction xsk_buff_dma_sync_for_cpufunction xsk_buff_raw_dma_sync_for_devicefunction xsk_tx_completedfunction xsk_tx_peek_release_desc_batchfunction xsk_tx_releasefunction xsk_set_rx_need_wakeupfunction xsk_pool_get_headroomfunction xsk_pool_get_chunk_sizefunction xsk_pool_get_rx_frame_sizefunction xsk_pool_get_rx_frag_stepfunction xsk_pool_set_rxq_infofunction xsk_buff_xdp_get_dmafunction xsk_buff_xdp_get_frame_dmafunction xsk_is_eop_descfunction xsk_buff_alloc_batchfunction xsk_buff_can_allocfunction xsk_buff_freefunction xsk_buff_del_fragfunction xsk_buff_set_sizefunction xsk_buff_raw_get_ctxfunction xsk_buff_valid_tx_metadatafunction __xsk_buff_get_metadata
Annotated Snippet
struct xsk_cb_desc {
void *src;
u8 off;
u8 bytes;
};
#ifdef CONFIG_XDP_SOCKETS
void xsk_tx_completed(struct xsk_buff_pool *pool, u32 nb_entries);
bool xsk_tx_peek_desc(struct xsk_buff_pool *pool, struct xdp_desc *desc);
u32 xsk_tx_peek_release_desc_batch(struct xsk_buff_pool *pool, u32 max);
void xsk_tx_release(struct xsk_buff_pool *pool);
struct xsk_buff_pool *xsk_get_pool_from_qid(struct net_device *dev,
u16 queue_id);
void xsk_set_rx_need_wakeup(struct xsk_buff_pool *pool);
void xsk_set_tx_need_wakeup(struct xsk_buff_pool *pool);
void xsk_clear_rx_need_wakeup(struct xsk_buff_pool *pool);
void xsk_clear_tx_need_wakeup(struct xsk_buff_pool *pool);
bool xsk_uses_need_wakeup(struct xsk_buff_pool *pool);
static inline u32 xsk_pool_get_headroom(struct xsk_buff_pool *pool)
{
return XDP_PACKET_HEADROOM + pool->headroom;
}
static inline u32 xsk_pool_get_tailroom(bool mbuf)
{
return mbuf ? SKB_DATA_ALIGN(sizeof(struct skb_shared_info)) : 0;
}
static inline u32 xsk_pool_get_chunk_size(struct xsk_buff_pool *pool)
{
return pool->chunk_size;
}
static inline u32 __xsk_pool_get_rx_frame_size(struct xsk_buff_pool *pool)
{
return xsk_pool_get_chunk_size(pool) - xsk_pool_get_headroom(pool);
}
static inline u32 xsk_pool_get_rx_frame_size(struct xsk_buff_pool *pool)
{
u32 frame_size = __xsk_pool_get_rx_frame_size(pool);
struct xdp_umem *umem = pool->umem;
bool mbuf;
/* Reserve tailroom only for zero-copy pools that opted into
* multi-buffer. The reserved area is used for skb_shared_info,
* matching the XDP core's xdp_data_hard_end() layout.
*/
mbuf = pool->dev && (umem->flags & XDP_UMEM_SG_FLAG);
frame_size -= xsk_pool_get_tailroom(mbuf);
return ALIGN_DOWN(frame_size, 128);
}
static inline u32 xsk_pool_get_rx_frag_step(struct xsk_buff_pool *pool)
{
return pool->unaligned ? 0 : xsk_pool_get_chunk_size(pool);
}
static inline void xsk_pool_set_rxq_info(struct xsk_buff_pool *pool,
struct xdp_rxq_info *rxq)
{
xp_set_rxq_info(pool, rxq);
}
static inline void xsk_pool_fill_cb(struct xsk_buff_pool *pool,
struct xsk_cb_desc *desc)
{
xp_fill_cb(pool, desc);
}
static inline void xsk_pool_dma_unmap(struct xsk_buff_pool *pool,
unsigned long attrs)
{
xp_dma_unmap(pool, attrs);
}
static inline int xsk_pool_dma_map(struct xsk_buff_pool *pool,
struct device *dev, unsigned long attrs)
{
struct xdp_umem *umem = pool->umem;
return xp_dma_map(pool, dev, attrs, umem->pgs, umem->npgs);
}
static inline dma_addr_t xsk_buff_xdp_get_dma(struct xdp_buff *xdp)
{
struct xdp_buff_xsk *xskb = container_of(xdp, struct xdp_buff_xsk, xdp);
Annotation
- Immediate include surface: `net/xdp_sock.h`, `net/xsk_buff_pool.h`.
- Detected declarations: `struct xsk_cb_desc`, `function xsk_pool_get_headroom`, `function xsk_pool_get_tailroom`, `function xsk_pool_get_chunk_size`, `function __xsk_pool_get_rx_frame_size`, `function xsk_pool_get_rx_frame_size`, `function xsk_pool_get_rx_frag_step`, `function xsk_pool_set_rxq_info`, `function xsk_pool_fill_cb`, `function xsk_pool_dma_unmap`.
- Atlas domain: Networking Core / Sockets, Protocols, Packet Path, And Network Policy.
- Implementation status: source implementation candidate.
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.