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 thelibmlx4internal method. you're swapping out the default, no cap.freeβ the function used to free buffers allocated by theallocfunction. they're a matching set, don't separate them πdataβ metadata that can be used by theallocandfreefunctions. 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
- alpine 3.24: rdma-core-doc 61.0-r0 Β· GPL-2.0-only OR BSD-2-Clause
- centos-stream 10: rdma-core-devel 62.0-3.el10 Β· GPLv2 or BSD
- centos-stream 9: rdma-core-devel 61.0-3.el9 Β· GPLv2 or BSD
- centos-stream 9: rdma-core-devel 61.0-3.el9 Β· GPLv2 or BSD
- ubuntu jammy: libibverbs-dev 39.0-1 Β· BSD-MIT OR GPL-2.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms