rvt_lkey_ok(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… rvt_lkey_ok β€” the kernel API manual, bestie edition ✨

okay so before we even start: this is a page from the Kernel API Manual, and it's called rvt_lkey_ok(9). yes, the (9) means "kernel interfaces," we love a section-9 moment. πŸŽ€


✨ NAME ✨

rvt_lkey_ok β€” check IB SGE for validity and initialize πŸ‘‘

like literally, that's the whole job. it checks stuff and then it initializes stuff. main character behaviour fr fr.


🌸 SYNOPSIS 🌸

int rvt_lkey_ok (struct rvt_lkey_table *rkt , struct rvt_pd *pd , struct
rvt_sge *isge , struct rvt_sge *last_sge , struct ib_sge *sge , int acc
);

look at that signature. six arguments. she's thorough. πŸ’…


πŸ¦‹ ARGUMENTS πŸ¦‹

  • rkt β€” the table that contains the lkey we're checking the SGE against. your lookup source, your reference point, your girl.
  • pd β€” protection domain. yes queen, protect it. πŸ›‘οΈ
  • isge β€” the outgoing internal SGE. this is ours, bestie.
  • last_sge β€” the last outgoing SGE that got written. keeping track of the previous one, respectful. 🫢
  • sge β€” the SGE to check. the one on trial. vibe check time.
  • acc β€” access flags. permissions, boundaries, all of it. πŸ”₯

πŸ’– DESCRIPTION πŸ’–

so what does she actually do? she checks the IB SGE for validity and then initializes our internal version of it. that's it. that's the arc. ✨

and here's the detail you can't skip: she increments the reference count when a new sge is stored. not me being obsessed with refcounts 😭 but like, this matters. count goes up, sge is stored:

  • new sge gets stored β†’ reference count goes ⬆️

periodt. no leaks, no drama. πŸ’…


🌈 RETURN 🌈

  • 0 β€” if compressed 🫧
  • 1 β€” if added πŸŽ€
  • otherwise β€” returns -errno 😭 (translation: something went wrong, go read the errno)

🧚 SEE ALSO 🧚

all the sisters in the family, no cap, they're all here:

kernel file ./drivers/infiniband/sw/rdmavt/mr.c, plus rvt_driver_mr_init(9), rvt_mr_exit(9), rvt_alloc_lkey(9), rvt_free_lkey(9), rvt_get_dma_mr(9), rvt_reg_user_mr(9), rvt_dereg_clean_qp_cb(9), rvt_dereg_clean_qps(9), rvt_check_refs(9), rvt_mr_has_lkey(9), rvt_ss_has_lkey(9), rvt_dereg_mr(9), rvt_alloc_mr(9), rvt_set_page(9), rvt_map_mr_sg(9), rvt_fast_reg_mr(9), rvt_invalidate_rkey(9), rvt_sge_adjacent(9), rvt_rkey_ok(9)

like, the whole friend group showed up to the function. iykyk 🌸

if you're reading rvt_lkey_ok(9) you should probably also read rvt_rkey_ok(9) β€” they're literally siblings, don't be weird about it πŸ™ˆ

and that's the page!! πŸŽ€ sourced from ./drivers/infiniband/sw/rdmavt, version vibes dated October 2026 β€” stay slaying, kernel besties, mwah πŸ’–βœ¨πŸ‘‘

πŸ“¦ where this page comes from