mlx5dv_create_mk...5dv_destroy_mkey(3)

πŸ’– NAME πŸ’–

mlx5dv_create_mk...5dv_destroy_mkey(3) β€” okay bestie, welcome to the mlx5dv manual page for indirect mkeys. It’s giving create/destroy energy, and the facts are staying exactly where they belong. ✨

  • mlx5dv_create_mkey β€” Creates an indirect mkey πŸ’…
  • mlx5dv_destroy_mkey β€” Destroys an indirect mkey πŸŽ€

🌈 SYNOPSIS 🌈

#include <infiniband/mlx5dv.h>

struct mlx5dv_mkey_init_attr {
    struct ibv_pd   *pd;
    uint32_t    create_flags;
    uint16_t    max_entries;
};

struct mlx5dv_mkey {
    uint32_t    lkey;
    uint32_t    rkey;
};

struct mlx5dv_mkey *
mlx5dv_create_mkey(struct mlx5dv_mkey_init_attr *mkey_init_attr);

int mlx5dv_destroy_mkey(struct mlx5dv_mkey *mkey);

πŸ¦‹ DESCRIPTION πŸ¦‹

Create / destroy an indirect mkey.

Create an indirect mkey so an application can use its specific device functionality. That’s the whole point, bestie β€” it unlocks your app’s specific device functionality.


πŸŽ€ ARGUMENTS πŸŽ€

mkey_init_attr

  • pd β€” ibv protection domain. Your PD, your people.
  • create_flags β€” the flags, and yes there are several. Here’s the whole menu:
    • MLX5DV_MKEY_INIT_ATTR_FLAGS_INDIRECT β€” Indirect mkey is being created. πŸ¦‹
    • MLX5DV_MKEY_INIT_ATTR_FLAGS_BLOCK_SIGNATURE β€” Enable block signature offload support for mkey.
    • MLX5DV_MKEY_INIT_ATTR_FLAGS_CRYPTO β€” Enable crypto offload support for mkey. Setting this flag means that crypto operations will be done and hence, must be configured. I.e. if this flag is set and the MKey was not configured for crypto properties using mlx5dv_wr_set_mkey_crypto(), then running traffic with the MKey will fail, generating a CQE with error. 😭
    • MLX5DV_MKEY_INIT_ATTR_FLAGS_UPDATE_TAG β€” Enable update tag support for mkey. Setting this flag allows an application to set the mkey tag post of creating the mkey. If the kernel does not support updating the mkey tag, mkey creation will fail. πŸ’€
    • MLX5DV_MKEY_INIT_ATTR_FLAGS_REMOTE_INVALIDATE β€” Enable remote invalidation support for mkey.
  • max_entries β€” Requested max number of pointed entries by this indirect mkey. The function will update mkey_init_attr->max_entries with the actual mkey value that was created; it will be greater than or equal to the value requested. So you ask for a number, and it comes back with at least that. Slay.

⭐ RETURN VALUE ⭐

  • mlx5dv_create_mkey β€” upon success, returns a new struct mlx5dv_mkey; on error, NULL is returned and errno will be set.
  • mlx5dv_destroy_mkey β€” upon success, 0 is returned; on failure, the value of errno.

🌸 Notes 🌸

Heads up, bestie: to let this functionality work, a DEVX context should be opened by using mlx5dv_open_device.
  • The created indirect mkey can’t work with the scatter to CQE feature. For small messages, consider mlx5dv_create_qp() with MLX5DV_QP_CREATE_DISABLE_SCATTER_TO_CQE.

πŸ”₯ SEE ALSO πŸ”₯

#AUTHOR

Yishai Hadas <yishaih@mellanox.com> 🫢

πŸ’– That’s the page, bestie. Cute little sign-off: the footer/source label is mlx5dv_create_mk...5dv_destroy_mkey(3), and the original doesn’t show a separate version or date line beyond that. πŸŽ€

πŸ“¦ where this page comes from