SDMA PSM VERBS API(9)
π sdma PSM/verbs API π
okay so this is a page from the Kernel API Manual (section 9, bestie, we're in kernel-land now β¨) and it's all about the sdma API β which is literally designed to be used by both PSM and verbs to feed packets to the SDMA ring. two besties, one ring, we love to see it π«Ά
πΈ the whole usage vibe, step by step πΈ
ok so here's how you actually use this thing:
- First up: embed a
struct iowaitin the QP or the PQ. thatiowaitneeds to be initialized with a call toiowait_init. no skipping, bestie π - Then you (the user of the API) gotta create an allocation method for your version of the
txreq. slabs? pre-allocated lists? dma pools? all valid, pick your fighter β¨ - Once your overload of the
sdma_txreqhas been allocated, thesdma_txreqmember must be initialized withsdma_txinitorsdma_txinit_ahg. - and listen β the
txreqmust be declared with thesdma_txreqfirst. that's the rule, periodt π
π¦ adding memory locations π¦
once the tx request is initialized, you manipulate it with calls to sdma_txadd_daddr, sdma_txadd_page, or sdma_txadd_kvaddr for each disjoint memory location.
it is your responsibility (yes, yours, main character π) to understand the packet boundaries and page boundaries so you do the appropriate number of sdma_txadd_* calls.
also you gotta be prepared to deal with failures from these routines β they can fail from either memory allocation or dma_mapping failures. no cap, plan for it π
The mapping specifics for each memory location get recorded in the tx. Memory locations added with sdma_txadd_page and sdma_txadd_kvaddr are automatically mapped when they're added to the tx, and then nmapped (that's literally what the page says, i'm not fixing it π) as part of the progress processing in the SDMA interrupt handling.
sdma_txadd_daddr is the one you use to add a dma_addr_t memory to the tx. a classic use case? a pre-allocated set of headers allocated via dma_pool_alloc or dma_alloc_coherent. but heads up: for these memory locations, it's on you to handle that unmapping. (usually that'd be at an unload or job termination.) π
π§ sending it π
The routine sdma_send_txreq is what you use to submit a tx to the ring β after you've done the appropriate number of sdma_txadd_* calls.
Wanna send a whole burst of sdma_txreqs? sdma_send_txlist is right there, girlie β use it to submit a list of packets. slay π₯
π the freebies π
The user is free to use the link overhead in the struct sdma_txreq β as long as the tx isn't in flight. that's the whole condition, iykyk β
And the extreme degenerate case where the number of descriptors exceeds the ring size? automatically handled as memory locations are added. An overflow of the descriptor array that's part of the sdma_txreq? also automatically handled. iconic behaviour honestly, it just deals with it π
β¨ SEE ALSO β¨
- Kernel file
./drivers/infiniband/hw/hfi1/sdma.h - sdma exported routines(9)
- Infrastructure calls(9)
struct sdma_engine(9)sdma_empty(9)sdma_running(9)sdma_txinit_ahg(9)sdma_txinit(9)sdma_txadd_page(9)sdma_txadd_daddr(9)sdma_txadd_kvaddr(9)sdma_progress(9)struct sdma_map_elem(9)sdma_engine_progress_schedule(9)
okay that's the whole page, bestie π this lives down in ./drivers/infiniband/hw/hfi1, and the footer is dated October 2026 β so yeah, future vibes only πΈ bye, go map some pages responsibly π
π¦ 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