rdma_rw_ctx_init_bvec(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸŽ€ NAME πŸŽ€

rdma_rw_ctx_init_bvec β€” bestie, this is the one that initializes a RDMA READ/WRITE context straight from a bio_vec. πŸ’–

Quick vibe check: we're in the Kernel API Manual, section 9, so like… kernel-internals territory. Buckle up, it's giving low-level but make it cute. ✨


✨ SYNOPSIS ✨

int rdma_rw_ctx_init_bvec (struct rdma_rw_ctx *ctx , struct ib_qp *qp ,
u32 port_num , const struct bio_vec *bvecs , u32 nr_bvec , struct
bvec_iter iter , u64 remote_addr , u32 rkey , enum dma_data_direction
dir );

No cap, that's a whole lot of arguments. Let's break each one down so you're not just nodding along πŸ’…


🌸 ARGUMENTS 🌸

  • ctx β€” the context you're initializing. This is the main character of the whole operation, honestly. πŸ‘‘
  • qp β€” the queue pair you're operating on. The literal connection vessel, iykyk.
  • port_num β€” the port number that this connection is bound to. 🫢
  • bvecs β€” the bio_vec array you're gonna READ from / WRITE to. The data's in there.
  • nr_bvec β€” how many entries live in bvecs. Just the count, nothing spicy.
  • iter β€” a bvec iterator that describes the offset and the length. It's the little map telling everyone where the good stuff is πŸ—ΊοΈ
  • remote_addr β€” the remote address to read/write, and yes it's relative to rkey (important, don't forget that part).
  • rkey β€” the remote key you're operating on. πŸ”‘
  • dir β€” the direction, and this one's specific: DMA_TO_DEVICE for an RDMA WRITE, DMA_FROM_DEVICE for an RDMA READ. Getting this backwards is not it, bestie 😭

πŸ¦‹ DESCRIPTION πŸ¦‹

Okay so here's the slay: this thing maps the bio_vec array directly, which means it skips the intermediate scatterlist conversion entirely. No middleman, no extra steps, we love efficiency. ⚑

It also supports MR registration for iWARP devices and for force_mr mode. 🌈

On success it returns the number of WQEs that will be needed on the workqueue. On failure it hands you back a negative error code:

  • -EINVAL β€” either nr_bvec is zero, or iter.bi_size is zero. (i.e. you gave it nothing to work with πŸ™ˆ)
  • -ENOMEM β€” DMA mapping or memory allocation failed. Memory said "no" πŸ’€
Heads up bestie: those two error codes are the only ones documented here. Don't go inventing new ones, fr fr.

πŸ’œ SEE ALSO πŸ’œ

Kernel file ./drivers/infiniband/core/rw.c and its whole friend group:


And that's the whole page, bestie β€” go init some contexts responsibly 🫢✨

Sign-off time πŸŽ€: this one lives in ./drivers/infiniband/core, it's dated October 2026, and the page itself is rdma_rw_ctx_init_bvec(9). Periodt. πŸ’…

πŸ“¦ where this page comes from