[PATCH rdma-next 01/15] RDMA/mlx5: Allow optional access flags in DM registration

From: Michael Gur

Date: Sun Jul 26 2026 - 05:32:05 EST


The uverbs ABI reserves the optional access flags range as best-effort:
drivers should accept any flag in this range and treat the actual support
as opportunistic, never failing registration when an optional flag is
requested.

Add the optional access flag to the allow-lists of DM registrations.
Uverbs users can now request any optional access flag on DM registrations
and mlx5 will apply the flag's effect on a best-effort basis when
supported.

Fixes: 68d384b906cf ("RDMA/core: Add optional access flags range")
Cc: stable@xxxxxxxxxxxxxxx
Reviewed-by: Yishai Hadas <yishaih@xxxxxxxxxx>
Signed-off-by: Michael Gur <michaelgur@xxxxxxxxxx>
---
drivers/infiniband/hw/mlx5/mlx5_ib.h | 2 ++
1 file changed, 2 insertions(+)

diff --git a/drivers/infiniband/hw/mlx5/mlx5_ib.h b/drivers/infiniband/hw/mlx5/mlx5_ib.h
index 522984d958bb..427e7f706c8a 100644
--- a/drivers/infiniband/hw/mlx5/mlx5_ib.h
+++ b/drivers/infiniband/hw/mlx5/mlx5_ib.h
@@ -660,11 +660,13 @@ struct mlx5_ib_mkey {
IB_ACCESS_REMOTE_WRITE |\
IB_ACCESS_REMOTE_READ |\
IB_ACCESS_REMOTE_ATOMIC |\
+ IB_ACCESS_OPTIONAL |\
IB_ZERO_BASED)

#define MLX5_IB_DM_SW_ICM_ALLOWED_ACCESS (IB_ACCESS_LOCAL_WRITE |\
IB_ACCESS_REMOTE_WRITE |\
IB_ACCESS_REMOTE_READ |\
+ IB_ACCESS_OPTIONAL |\
IB_ZERO_BASED)

#define mlx5_update_odp_stats(mr, counter_name, value) \
--
2.52.0