include/net/libeth/xsk.h
Source file repositories/reference/linux-study-clean/include/net/libeth/xsk.h
File Facts
- System
- Linux kernel
- Corpus path
include/net/libeth/xsk.h- Extension
.h- Size
- 20993 bytes
- Lines
- 689
- 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/libeth/xdp.hnet/xdp_sock_drv.h
Detected Declarations
struct libeth_xskfqfunction libeth_xsk_tx_queue_headfunction libeth_xsk_tx_queue_fragfunction libeth_xsk_tx_queue_bulkfunction libeth_xsk_tx_fill_buffunction LIBETH_XSK_DEFINE_FLUSH_TXfunction __libeth_xsk_xmit_fill_buffunction __libeth_xsk_xmit_fill_buffunction presencefunction libeth_xsk_xmit_do_bulkfunction libeth_xsk_process_bufffunction __libeth_xsk_run_progfunction __libeth_xsk_run_passfunction libeth_xskfqe_alloc
Annotated Snippet
struct libeth_xskfq {
struct_group_tagged(libeth_xskfq_fp, fp,
struct xsk_buff_pool *pool;
struct libeth_xdp_buff **fqes;
void *descs;
u32 ntu;
u32 count;
);
/* Cold fields */
u32 pending;
u32 thresh;
u32 buf_len;
u32 truesize;
int nid;
};
int libeth_xskfq_create(struct libeth_xskfq *fq);
void libeth_xskfq_destroy(struct libeth_xskfq *fq);
/**
* libeth_xsk_buff_xdp_get_dma - get DMA address of XSk &libeth_xdp_buff
* @xdp: buffer to get the DMA addr for
*/
#define libeth_xsk_buff_xdp_get_dma(xdp) \
xsk_buff_xdp_get_dma(&(xdp)->base)
/**
* libeth_xskfqe_alloc - allocate @n XSk Rx buffers
* @fq: hotpath part of the XSkFQ, usually onstack
* @n: number of buffers to allocate
* @fill: driver callback to write DMA addresses to HW descriptors
*
* Note that @fq->ntu gets updated, but ::pending must be recalculated
* by the caller.
*
* Return: number of buffers refilled.
*/
static __always_inline u32
libeth_xskfqe_alloc(struct libeth_xskfq_fp *fq, u32 n,
void (*fill)(const struct libeth_xskfq_fp *fq, u32 i))
{
u32 this, ret, done = 0;
struct xdp_buff **xskb;
this = fq->count - fq->ntu;
if (likely(this > n))
this = n;
again:
xskb = (typeof(xskb))&fq->fqes[fq->ntu];
ret = xsk_buff_alloc_batch(fq->pool, xskb, this);
for (u32 i = 0, ntu = fq->ntu; likely(i < ret); i++)
fill(fq, ntu + i);
done += ret;
fq->ntu += ret;
if (likely(fq->ntu < fq->count) || unlikely(ret < this))
goto out;
fq->ntu = 0;
if (this < n) {
this = n - this;
goto again;
}
out:
return done;
}
/* .ndo_xsk_wakeup */
void libeth_xsk_init_wakeup(call_single_data_t *csd, struct napi_struct *napi);
void libeth_xsk_wakeup(call_single_data_t *csd, u32 qid);
/* Pool setup */
int libeth_xsk_setup_pool(struct net_device *dev, u32 qid, bool enable);
#endif /* __LIBETH_XSK_H */
Annotation
- Immediate include surface: `net/libeth/xdp.h`, `net/xdp_sock_drv.h`.
- Detected declarations: `struct libeth_xskfq`, `function libeth_xsk_tx_queue_head`, `function libeth_xsk_tx_queue_frag`, `function libeth_xsk_tx_queue_bulk`, `function libeth_xsk_tx_fill_buf`, `function LIBETH_XSK_DEFINE_FLUSH_TX`, `function __libeth_xsk_xmit_fill_buf`, `function __libeth_xsk_xmit_fill_buf`, `function presence`, `function libeth_xsk_xmit_do_bulk`.
- 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.