IBV_UNIMPORT_PD(3)

πŸ’… ibv_import_pd β€” bestie edition

okay so first things first, the manual name is ibv_impor...import_pd(3) (yes it's truncated like that, it's giving "name too long for the header" energy) and it lives in the Libibverbs Programmer's Manual. two functions in this house: ibv_import_pd and ibv_unimport_pd. one imports a PD, the other un-imports it. iconic symmetry, no notes. ✨


🌸 NAME 🌸

  • ibv_import_pd β€” import a PD from a given ibv_context
  • ibv_unimport_pd β€” unimport a PD

πŸŽ€ SYNOPSIS πŸŽ€

#include <infiniband/verbs.h>

struct ibv_pd *ibv_import_pd(struct ibv_context *context, uint32_t pd_handle);
void ibv_unimport_pd(struct ibv_pd *pd)

(yes, the second one is missing a semicolon in the original and yes we are keeping it exactly like that πŸ’€ do not come for me, that's literally what it says)


πŸ¦‹ DESCRIPTION πŸ¦‹

so ibv_import_pd() returns a protection domain (PD) that's associated with the given pd_handle in the given context. that's the whole vibe. 🫢

the input pd_handle value must be a valid kernel handle for a PD object in that given context β€” like, non-negotiable. and how do you get one? you grab it from the original PD by getting its ibv_pd->handle member value. that's the hookup, iykyk. πŸ”‘

the returned ibv_pd can be used in all verbs that get a protection domain. all of them. every single one. main character PD energy honestly πŸ‘‘

now ibv_unimport_pd() β€” it unimports the PD. once the PD usage has ended, ibv_dealloc_pd() or ibv_unimport_pd() should be called. and here's the tea on the difference β˜•:

  • the first one (ibv_dealloc_pd()) will go to the kernel to destroy the object once the second one does its thing
  • the second one (ibv_unimport_pd()) just cleans up whatever is needed β€” literally the opposite of the import β€” without calling the kernel
🚨 bestie listen. it is the responsibility of the application to coordinate between all ibv_context(s) that use this PD. once destroy is done, no other process can touch the object except for unimport. all users of the context must collaborate to ensure this. collaborate. as a team. fr fr 🀝

⭐ RETURN VALUE ⭐

ibv_import_pd() returns a pointer to the allocated PD, or NULL if the request fails. that's it. that's the whole return value. simple, clean, slay πŸ’–


🌈 SEE ALSO 🌈

ibv_alloc_pd(3), ibv_dealloc_pd(3),


πŸ‘‘ AUTHOR πŸ‘‘

Yishai Hadas <yishaih@mellanox.com>


and that's the page bestie!! brought to you by libibverbs, dated 2020-5-3 β€” yes it's an oldie but a goodie πŸ•°οΈβœ¨ go forth and import responsibly, mwah πŸ’‹

πŸ“¦ where this page comes from