IBV_OPEN_XRCD(3)

πŸ’– IBV_OPEN_XRCD β€” bestie, we're opening (and closing) XRC protection domains πŸ’–

okay so this is from the Libibverbs Programmer's Manual, and we're talking about ibv_open_xrcd and ibv_close_xrcd β€” the two functions that open or close an XRC protection domain (XRCDs, bestie, say it with me). πŸ¦‹


✨ NAME ✨

ibv_open_xrcd, ibv_close_xrcd β€” open or close an XRC protection domain (XRCDs) πŸ’…


🌸 SYNOPSIS 🌸

#include <infiniband/verbs.h>

struct ibv_xrcd *ibv_open_xrcd(struct ibv_context *context,
                               struct ibv_xrcd_init_attr *xrcd_init_attr);

int ibv_close_xrcd(struct ibv_xrcd *xrcd);

πŸŽ€ DESCRIPTION πŸŽ€

So ibv_open_xrcd() opens an XRC domain for the RDMA device context context. And xrcd_init_attr is an ibv_xrcd_init_attr struct, which is defined in <infiniband/verbs.h>. Iconic. ✨

struct ibv_xrcd_init_attr {
        uint32_t         comp_mask;  /* Identifies valid fields */
        int              fd;
        int              oflag;

fd is the file descriptor to associate with the XRCD, no cap. 🫢 And oflag describes the desired creation attributes β€” it's a bitwise OR of zero or more of these flags, bestie:

  • O_CREAT β€” says that an XRCD should be created and associated with the inode referenced by the given fd. If the XRCD already exists, this flag has no effect except as noted under O_EXCL below. (so it's giving "sure, whatever, already got one" energy πŸ’€)
  • O_EXCL β€” if O_EXCL and O_CREAT are both set, open will fail if an XRCD associated with the inode already exists. not the vibe you want, but it's a thing. 😭

Also important: if fd equals -1, no inode is associated with the XRCD. To indicate that the XRCD should be created, use oflag = O_CREAT. periodt. πŸ‘‘

ibv_close_xrcd() closes the XRCD xrcd. And if this is the last reference, the XRCD will be destroyed. rest in peace, queen. 🌈


πŸ’œ RETURN VALUE πŸ’œ

  • ibv_open_xrcd() returns a pointer to the opened XRCD, or NULL if the request fails. πŸ™ˆ
  • ibv_close_xrcd() returns 0 on success, or the value of errno on failure (which indicates the failure reason). πŸ“

⭐ NOTES ⭐

ibv_close_xrcd() may fail if any other resource is still associated with the XRCD being closed. so like… make sure everybody's left the party before you lock up. πŸšͺ✨

🧚 SEE ALSO 🧚

ibv_create_srq_ex(3), ibv_create_qp_ex(3),


πŸ‘‘ AUTHORS πŸ‘‘

Sean Hefty <sean.hefty@intel.com>


and that's the whole page, bestie β€” go forth and XRCD responsibly πŸ’–

this lil masterpiece comes to you from libibverbs, dated 2011-06-17, filed under IBV_OPEN_XRCD(3). slay. πŸ’…βœ¨

πŸ“¦ where this page comes from