__libeth_xdp_run_pass(9)
π
__libeth_xdp_run_pass(9) β like, the whole Kernel API Manual but make it make sense β¨
okay bestie, so this is a page straight out of the Kernel API Manual, and it's about one very specific little helper. no cap, it's a good one. let's get into it π«Ά
πΈ NAME πΈ
__libeth_xdp_run_pass β the helper that runs your XDP program and deals with whatever chaotic verdict comes back. it's giving "you run it, i'll handle the fallout" energy π
β¨ SYNOPSIS β¨
void __libeth_xdp_run_pass (struct libeth_xdp_buff *xdp , struct
libeth_xdp_tx_bulk *bq , struct napi_struct *napi , struct
libeth_rq_napi_stats *rs , const void *md , void (*prep)(struct
libeth_xdp_buff *xdp, const void *md) , bool (*run)(struct
libeth_xdp_buff *xdp, struct libeth_xdp_tx_bulk *bq) , bool
(*populate)(struct sk_buff *skb, const struct libeth_xdp_buff *xdp,
struct libeth_rq_napi_stats *rs) );
like yes, that's a lot of parameters. breathe. we go through every single one below π
π ARGUMENTS π
xdpβ the XDP buffer we're processing. the main character of this whole function tbh πbqβ the XDP Tx bulk, where thoseXDP_TXframes get queued up. it's the outbox π€napiβ the NAPI instance, used to build an skb and pass it up the stackrsβ onstack libeth RQ stats. like, the stats live right there on the stack, comfy ποΈmdβ the metadata that should get filled into the XDP bufferprepβ callback for filling in that metadatarunβ the driver wrapper that actually runs the XDP programpopulateβ driver callback that populates an skb with the HW descriptor data
π¦ DESCRIPTION π¦
so this is an inline abstraction, and here's literally everything it does β this is the non-XSk path, iykyk:
- adds frame size and frag number (if needed) to the onstack stats;
- fills the descriptor metadata into the onstack
libeth_xdp_buff; - runs the XDP program if present;
- handles all possible verdicts;
- on
`XDP_PASS`, builds an skb from the buffer; - populates it with the descriptor metadata;
- passes it up the stack.
and here's the lowkey important part π β in most cases, step number 2 just means writing the pointer to the HW descriptor into the XDP buffer. and if that's all you need? please use the LIBETH_XDP_DEFINE_RUN{,_PASS}() wrappers to build a driver function. that's the slay move, don't hand-roll it π
fr fr, step 2 being "just write a pointer" is the common case, and the wrappers exist exactly so you don't have to write this whole thing out yourself.
π SEE ALSO π
okay this list is long long, but every single one of these is iconic in its own way, so we're listing them all β no skips, periodt π
- kernel file:
./include/net/libeth/xdp.hβ plusstruct libeth_xdp_buff(9),__LIBETH_XDP_ONSTACK_BUFF(9),LIBETH_XDP_ONSTACK_BUFF(9)
the xdpsq girlies π
libeth_xdpsq_num(9),libeth_xdpsq_shared(9),libeth_xdpsq_id(9),libeth_xdpsq_get(9),libeth_xdpsq_put(9),libeth_xdpsq_lock(9),libeth_xdpsq_unlock(9)
timers & queues β°
mystery enums (yes, twice) π
enum (anonymous)(9),enum (anonymous)(9)
the structs π§
struct libeth_xdp_tx_frame(9),struct libeth_xdp_tx_bulk(9),LIBETH_XDP_ONSTACK_BULK(9),struct libeth_xdpsq(9),struct libeth_xdp_tx_desc(9)
pointer shuffling π«Ά
the TX squad π₯
libeth_xdp_tx_xmit_bulk(9),libeth_xdp_tx_queue_head(9),libeth_xdp_tx_queue_frag(9),libeth_xdp_tx_queue_bulk(9),libeth_xdp_tx_fill_stats(9),libeth_xdp_tx_fill_buf(9),__libeth_xdp_tx_flush_bulk(9),libeth_xdp_tx_flush_bulk(9),libeth_xdp_tx_init_bulk(9)
the XMIT squad β
libeth_xdp_xmit_init_bulk(9),libeth_xdp_xmit_frame_dma(9),libeth_xdp_xmit_queue_head(9),libeth_xdp_xmit_queue_frag(9),libeth_xdp_xmit_queue_bulk(9),libeth_xdp_xmit_fill_buf(9),libeth_xdp_xmit_flush_bulk(9),__libeth_xdp_xmit_do_bulk(9),libeth_xdp_xmit_do_bulk(9)
buff management, aka self-care πΈ
libeth_xdp_init_buff(9),libeth_xdp_save_buff(9),libeth_xdp_return_stash(9),libeth_xdp_return_buff(9),libeth_xdp_prepare_buff(9),libeth_xdp_process_buff(9),libeth_xdp_buff_stats_frags(9)
running the program (our cousins) π
finalize & hashing π¦
the wrapper macros (use these, bestie) π
LIBETH_XDP_DEFINE_TIMER(9),LIBETH_XDP_DEFINE_FLUSH_TX(9),LIBETH_XDP_DEFINE_FLUSH_XMIT(9),LIBETH_XDP_DEFINE_RUN_PROG(9),LIBETH_XDP_DEFINE_RUN_PASS(9),LIBETH_XDP_DEFINE_RUN(9),LIBETH_XDP_DEFINE_FINALIZE(9)
odds & ends π
and that's the page!! π it lives at ./include/net/libeth, and this version is dated October 2026 β ty for reading, mwah, go use the wrappers πππ¦
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms