ib_sg_to_pages(9)
π ib_sg_to_pages(9) β the Kernel API Manual, bestie edition π
okay so picture this: you're deep in the Kernel API Manual (the 9 is the section, iykyk) and you've got a scatterlist that's way too long and a page vector that's way too empty. This little icon right here is the glow-up in between β¨
π¦ NAME π¦
ib_sg_to_pages β converts the largest prefix of a sg list into a page vector. literally that's the whole job, and she ate π
πΈ SYNOPSIS πΈ
int ib_sg_to_pages (struct ib_mr *mr , struct scatterlist *sgl , int
sg_nents , unsigned int *sg_offset_p , int (*set_page)(struct ib_mr *,
u64) );
π ARGUMENTS π
mrβ the memory region, bestie. that's the main character of this function πsglβ a dma mapped scatterlist π¦sg_nentsβ how many entries are in the sg. the count. the census. the roster count πsg_offset_pβ a pointer to an offset, and she's both an input and an output, so pay attention:- IN β start offset in bytes into
sgπΈ - OUT β offset in bytes for element n of the sg of the first byte that has not been processed, where n is the return value of this function π
- IN β start offset in bytes into
set_pageβ the driver's page assignment function pointer π₯
β¨ DESCRIPTION β¨
So this is a core service helper, right? For drivers π«Ά Her whole thing is converting the largest prefix of a given sg list into a page vector. And when I say "the largest prefix," I mean the prefix that meets the requirements of ib_map_mr_sg β no cap, that's the exact bar she's clearing π―
She returns the number of sg elements that were assigned to a page vector. that's it, that's the return value, that's the vibe check β
ngl bestie, if you were hoping for a whole separate RETURN VALUE section β she doesn't have one. the return value lives right here in DESCRIPTION and we respect her choices π
π SEE ALSO π
Kernel file ./drivers/infiniband/core/verbs.c β go read the source, it's giving main character energy π And while you're in there, these besties are all in the same friend group:
__ib_alloc_pd(9)ib_dealloc_pd_user(9)rdma_copy_ah_attr(9)rdma_replace_ah_attr(9)rdma_move_ah_attr(9)rdma_create_ah(9)rdma_create_user_ah(9)rdma_move_grh_sgid_attr(9)rdma_destroy_ah_attr(9)ib_create_srq_user(9)ib_create_qp_user(9)ib_resolve_eth_dmac(9)ib_modify_qp_with_udata(9)ib_alloc_mr(9)ib_alloc_mr_integrity(9)ib_alloc_xrcd_user(9)ib_dealloc_xrcd_user(9)ib_create_wq(9)ib_destroy_wq_user(9)ib_map_mr_sg_pi(9)ib_map_mr_sg(9)ib_drain_sq(9)ib_drain_rq(9)ib_drain_qp(9)rdma_alloc_hw_stats_struct(9)rdma_free_hw_stats_struct(9)
and that's the page, bestie π§ this cutie lives in ./drivers/infiniband/core and she's dated October 2026 β so she's fresh, she's current, she's iconic πβ stay hydrated and go map some sg lists π
π¦ 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