IBV_BIND_MW(3)

πŸ“¦
version 65.0 Β· 2 versions
  • 65.0 Β· alpine 3.24, arch rolling, centos-stream 10, centos-stream 9, debian bookworm, debian trixie, fedora 43, fedora 44, nixos 26.05, nixpkgs unstable, opensuse-leap 16.0, ubuntu jammy, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking (latest)
  • 15.1 Β· freebsd 14.5, freebsd 15.1
, in alpine 3.24, arch rolling, centos-stream 10, centos-stream 9, debian bookworm, debian trixie, fedora 43, fedora 44, nixos 26.05, nixpkgs unstable, opensuse-leap 16.0, ubuntu jammy, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking

✨ IBV_BIND_MW ✨

okay bestie, welcome to the ibv_bind_mw page from the Libibverbs Programmer's Manual πŸ’– pull up a chair, we're binding type 1 memory windows today and honestly? it's giving main character energy.


🌸 NAME 🌸

ibv_bind_mw β€” post a request to bind a type 1 memory window to a memory region


πŸŽ€ SYNOPSIS πŸŽ€

#include <infiniband/verbs.h>

int ibv_bind_mw(struct ibv_qp *qp, struct ibv_mw *mw,
                struct ibv_mw_bind *mw_bind);

πŸ’… DESCRIPTION πŸ’…

so ibv_bind_mw() posts to the queue pair qp a request to bind the memory window mw according to the details in mw_bind. that's the whole vibe. you're telling the QP "hey, hook this window up like this" and then you move on with your life.

the argument mw_bind is an ibv_mw_bind struct, as defined in <infiniband/verbs.h>. and she looks like this:

struct ibv_mw_bind {
        uint64_t                     wr_id;           /* User defined WR ID */
        unsigned int                 send_flags;      /* Use ibv_send_flags */
        struct ibv_mw_bind_info      bind_info;       /* MW bind information */
}

and nested inside her, the bind info:

struct ibv_mw_bind_info {
        struct ibv_mr                *mr;             /* The MR to bind the MW to */
        uint64_t                     addr;            /* The address the MW should start at */
        uint64_t                     length;          /* The length (in bytes) the MW should span */
        unsigned int                 mw_access_flags; /* Access flags to the MW. Use ibv_access_flags */
};
🚨 important: the QP Transport Service Type must be either UC, RC or XRC_SEND for bind operations. no other type, no exceptions, don't even try it.

⭐ the send_flags moment ⭐

the attribute send_flags describes the properties of the WR. it is either 0 or the bitwise OR of one or more of the following flags:

  • IBV_SEND_FENCE β€” set the fence indicator.
  • IBV_SEND_SIGNALED β€” set the completion notification indicator. relevant only if the QP was created with sq_sig_all=0.

πŸ¦‹ the mw_access_flags moment πŸ¦‹

the mw_access_flags define the allowed access to the MW after the bind completes successfully. it is either 0 or the bitwise OR of one or more of the following flags:

  • IBV_ACCESS_REMOTE_WRITE β€” enable Remote Write Access. requires local write access to the MR.
  • IBV_ACCESS_REMOTE_READ β€” enable Remote Read Access.
  • IBV_ACCESS_REMOTE_ATOMIC β€” enable Remote Atomic Operation Access (if supported). requires local write access to the MR.
  • IBV_ACCESS_ZERO_BASED β€” if set, the address set on the 'remote_addr' field on the WR will be an offset from the MW's start address.

πŸ’– RETURN VALUE πŸ’–

ibv_bind_mw() returns 0 on success, or the value of errno on failure (which indicates the failure reason).

and in case of a success, the R_key of the memory window after the bind is returned in the mw_bind->mw->rkey field. cute, right? that's your prize. πŸ†


πŸ‘‘ NOTES πŸ‘‘

okay this part actually matters, listen up:

the bind does not complete when the function returns β€” it is merely posted to the QP. so do not go assuming it's done, bestie, it is not. 😭

the user should keep a copy of the old R_key, and fix the mw structure if the subsequent CQE for the bind operation indicates a failure.

the user may safely send the R_key using a send request on the same QP (based on QP ordering rules: a send after a bind request on the same QP are always ordered), but must not transfer it to the remote in any other manner before reading a successful CQE.

🚨 also: note that for type 2 MW, one should directly post bind WR to the QP, using ibv_post_send.

🌈 SEE ALSO 🌈

ibv_alloc_mw(3), ibv_post_send(3), ibv_poll_cq(3) ibv_reg_mr(3),


🫢 AUTHORS 🫢

Majd Dibbiny <majd@mellanox.com>

Yishai Hadas <yishaih@mellanox.com>


and that's the whole page, bestie πŸ’œ this one came straight out of libibverbs, dated 2016-02-02, and it's the IBV_BIND_MW(3) manual page β€” go bind something responsibly, mwah πŸ’…βœ¨

πŸ“¦ where this page comes from