drivers/net/ethernet/intel/libeth/xsk.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/intel/libeth/xsk.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/intel/libeth/xsk.c- Extension
.c- Size
- 6893 bytes
- Lines
- 273
- Domain
- Driver Families
- Bucket
- drivers/net
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/export.hnet/libeth/xsk.hpriv.h
Detected Declarations
function libeth_xsk_tx_return_bulkfunction xsk_buff_freefunction libeth_xsk_process_bufffunction __libeth_xsk_run_passfunction __libeth_xsk_run_progfunction libeth_xsk_prog_exceptionfunction libeth_xskfq_createfunction libeth_xskfq_destroyfunction libeth_xsk_napi_schedfunction libeth_xsk_init_wakeupfunction libeth_xsk_wakeupfunction libeth_xsk_setup_poolexport libeth_xsk_buff_free_slowexport libeth_xsk_buff_add_fragexport libeth_xsk_buff_stats_fragsexport __libeth_xsk_run_prog_slowexport libeth_xskfq_createexport libeth_xskfq_destroyexport libeth_xsk_init_wakeupexport libeth_xsk_wakeupexport libeth_xsk_setup_pool
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0-only
/* Copyright (C) 2025 Intel Corporation */
#define DEFAULT_SYMBOL_NAMESPACE "LIBETH_XDP"
#include <linux/export.h>
#include <net/libeth/xsk.h>
#include "priv.h"
/* ``XDP_TX`` bulking */
void __cold libeth_xsk_tx_return_bulk(const struct libeth_xdp_tx_frame *bq,
u32 count)
{
for (u32 i = 0; i < count; i++)
libeth_xsk_buff_free_slow(bq[i].xsk);
}
/* XSk TMO */
const struct xsk_tx_metadata_ops libeth_xsktmo_slow = {
.tmo_request_checksum = libeth_xsktmo_req_csum,
};
/* Rx polling path */
/**
* libeth_xsk_buff_free_slow - free an XSk Rx buffer
* @xdp: buffer to free
*
* Slowpath version of xsk_buff_free() to be used on exceptions, cleanups etc.
* to avoid unwanted inlining.
*/
void libeth_xsk_buff_free_slow(struct libeth_xdp_buff *xdp)
{
xsk_buff_free(&xdp->base);
}
EXPORT_SYMBOL_GPL(libeth_xsk_buff_free_slow);
/**
* libeth_xsk_buff_add_frag - add frag to XSk Rx buffer
* @head: head buffer
* @xdp: frag buffer
*
* External helper used by libeth_xsk_process_buff(), do not call directly.
* Frees both main and frag buffers on error.
*
* Return: main buffer with attached frag on success, %NULL on error (no space
* for a new frag).
*/
struct libeth_xdp_buff *libeth_xsk_buff_add_frag(struct libeth_xdp_buff *head,
struct libeth_xdp_buff *xdp)
{
if (!xsk_buff_add_frag(&head->base, &xdp->base))
goto free;
return head;
free:
libeth_xsk_buff_free_slow(xdp);
libeth_xsk_buff_free_slow(head);
return NULL;
}
EXPORT_SYMBOL_GPL(libeth_xsk_buff_add_frag);
/**
* libeth_xsk_buff_stats_frags - update onstack RQ stats with XSk frags info
* @rs: onstack stats to update
* @xdp: buffer to account
*
* External helper used by __libeth_xsk_run_pass(), do not call directly.
* Adds buffer's frags count and total len to the onstack stats.
*/
void libeth_xsk_buff_stats_frags(struct libeth_rq_napi_stats *rs,
const struct libeth_xdp_buff *xdp)
{
libeth_xdp_buff_stats_frags(rs, xdp);
}
EXPORT_SYMBOL_GPL(libeth_xsk_buff_stats_frags);
/**
* __libeth_xsk_run_prog_slow - process the non-``XDP_REDIRECT`` verdicts
* @xdp: buffer to process
* @bq: Tx bulk for queueing on ``XDP_TX``
* @act: verdict to process
* @ret: error code if ``XDP_REDIRECT`` failed
*
Annotation
- Immediate include surface: `linux/export.h`, `net/libeth/xsk.h`, `priv.h`.
- Detected declarations: `function libeth_xsk_tx_return_bulk`, `function xsk_buff_free`, `function libeth_xsk_process_buff`, `function __libeth_xsk_run_pass`, `function __libeth_xsk_run_prog`, `function libeth_xsk_prog_exception`, `function libeth_xskfq_create`, `function libeth_xskfq_destroy`, `function libeth_xsk_napi_sched`, `function libeth_xsk_init_wakeup`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: integration 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.