ib_drain_rq(9)
π ib_drain_rq(9) β a Kernel API Manual moment β¨
okay so bestie, welcome to the Kernel API Manual page for ib_drain_rq(9) π this one's short and sweet, and it's lowkey a little diva about the conditions you have to meet before it'll work for you. let's get into it π¦
β¨ NAME β¨
ib_drain_rq β block until all RQ CQEs have been consumed by the application π like, it literally just sits there and waits. no cap. it's giving "i'm not leaving until every last completion is handled" energy.
πΈ SYNOPSIS πΈ
void ib_drain_rq (struct ib_qp *qp );
that's it. that's the whole function. one void, one qp, zero drama (mostly). π
π ARGUMENTS π
qpβ the queue pair to drain. this is the QP whose RQ you're waiting on, bestie. that's the whole argument. icon behavior honestly π«Ά
π DESCRIPTION π
so here's the vibe check: if the device has a provider-specific drain function, then call that. otherwise, call the generic drain function __ib_drain_rq. that's the fork in the road, iykyk π
but before any of that, the caller must do their homework. and by "homework" i mean all of the following, no skipping, fr fr π
- ensure there is room in the CQ and RQ for the drain work request and completion. like, please make sure there's space?? don't set yourself up for failure π
- allocate the CQ using
ib_alloc_cq. non-negotiable, bestie πΈ - ensure that there are no other contexts that are posting WRs concurrently. Otherwise the drain is not guaranteed. so like... do not have other contexts posting WRs at the same time. that's the whole rule. if you do, the drain isn't guaranteed and that's not a vibe π
β οΈ real talk: that last one is a genuine caveat, not just me being dramatic. concurrent WR posting from other contexts = the drain is not guaranteed. periodt π
π¦ SEE ALSO π¦
Kernel file ./drivers/infiniband/core/verbs.c β and here's the full squad of sibling functions, all of them, in order, no cap β¨
__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_sg_to_pages(9)ib_drain_sq(9)ib_drain_qp(9)rdma_alloc_hw_stats_struct(9)rdma_free_hw_stats_struct(9)
like, that's a whole friend group right there π go say hi to ib_drain_sq(9) and ib_drain_qp(9), they're literally cousins π§
and that's the page!! π sign-off time: this iconic little number lives over in ./drivers/infiniband/core, and it's dated October 2026 β yes, the future, she's booked and busy β mwah, thanks for reading, go drain 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