mlx4dv_set_context_attr(3)

πŸ’… mlx4dv_set_context_attr β€” set context attrs, bestie

okay so this is a page from section 3 of the manual (mlx4dv_set_context_attr(3)), and it's genuinely so useful. sit down, grab a strawberry drink πŸ“, and let me tell you about setting vendor-specific attributes on your RDMA context.


✨ NAME ✨

mlx4dv_set_context_attr β€” literally just "Set context attributes". That's the whole vibe. πŸ’«


🌸 SYNOPSIS 🌸

#include <infiniband/mlx4dv.h>

int mlx4dv_set_context_attr(struct ibv_context *context,
                            enum mlx4dv_set_ctx_attr_type attr_type,
                            void *attr);

πŸ¦‹ DESCRIPTION πŸ¦‹

so mlx4dv_set_context_attr gives you the ability to set vendor specific attributes on the RDMA context. that's it, that's the whole function, and honestly? iconic. πŸ‘‘


πŸŽ€ ARGUMENTS πŸŽ€

  • context β€” the RDMA device context you want to work on. your main character context, if you will.
  • attr_type β€” the type of the attribute you're handing over. (details below, keep reading bestie πŸ‘‡)
  • attr β€” pointer to the attribute to be set. just a pointer, no big deal, but like... it matters. πŸ’…

🌈 attr_type

enum mlx4dv_set_ctx_attr_type {
    /* Attribute type uint8_t */
    MLX4DV_SET_CTX_ATTR_LOG_WQS_RANGE_SZ    = 0,
    MLX4DV_SET_CTX_ATTR_BUF_ALLOCATORS  = 1,
};
  • MLX4DV_SET_CTX_ATTR_LOG_WQS_RANGE_SZ β€” change the LOG WQs Range size for RSS. yes, that's the actual description and yes it's very serious business πŸ”₯
  • MLX4DV_SET_CTX_ATTR_BUF_ALLOCATORS β€” provide an external buffer allocator. you're bringing your own allocator to the party, love that for you 🫢
struct mlx4dv_ctx_allocators {
    void *(*alloc)(size_t size, void *priv_data);
    void (*free)(void *ptr, void *priv_data);
    void *data;
};
  • alloc β€” the function used for buffer allocation instead of the libmlx4 internal method. you're swapping out the default, no cap.
  • free β€” the function used to free buffers allocated by the alloc function. they're a matching set, don't separate them 😭
  • data β€” metadata that can be used by the alloc and free functions. your little stash of context, passing it along πŸŽ€

⭐ RETURN VALUE ⭐

Returns 0 on success, or the value of errno on failure (which indicates the failure reason). so like, zero = slay, anything else = read your errno and figure out what went wrong, bestie πŸ’€


πŸ‘‘ AUTHOR πŸ‘‘

Majd Dibbiny <majd@mellanox.com>


and that's the tea, fr fr πŸ§šπŸ’œ this whole thing came from the mlx4dv_set_context_attr(3) page β€” same title on the header and the footer, no extra version line or date to report, so just know it's the mlx4dv_set_context_attr(3) manual and go set those attributes. periodt. πŸŽ€

πŸ“¦ where this page comes from