* [PATCH rdma-next] RDMA/mlx5: Don't compare mkey tags in DEVX indirect mkey
@ 2022-07-31 8:26 Leon Romanovsky
2022-08-16 12:19 ` Leon Romanovsky
0 siblings, 1 reply; 2+ messages in thread
From: Leon Romanovsky @ 2022-07-31 8:26 UTC (permalink / raw)
To: Jason Gunthorpe; +Cc: Aharon Landau, linux-rdma
From: Aharon Landau <aharonl@nvidia.com>
According to the ib spec:
If the CI supports the Base Memory Management Extensions defined in this
specification, the L_Key format must consist of:
24 bit index in the most significant bits of the R_Key, and
8 bit key in the least significant bits of the R_Key
Through a successful Allocate L_Key verb invocation, the CI must let the
consumer own the key portion of the returned R_Key
Therefore, when creating a mkey using DEVX, the consumer is allowed to
change the key part. The kernel should compare only the index part of a
R_Key to determine equality with another R_Key.
Adding capability in order not to break backward compatibility.
Fixes: 534fd7aac56a ("IB/mlx5: Manage indirection mkey upon DEVX flow for ODP")
Signed-off-by: Aharon Landau <aharonl@nvidia.com>
Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
---
drivers/infiniband/hw/mlx5/main.c | 3 +++
drivers/infiniband/hw/mlx5/odp.c | 3 ++-
include/uapi/rdma/mlx5-abi.h | 1 +
3 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c
index fc94a1b25485..a7d88713dfdd 100644
--- a/drivers/infiniband/hw/mlx5/main.c
+++ b/drivers/infiniband/hw/mlx5/main.c
@@ -1826,6 +1826,9 @@ static int set_ucontext_resp(struct ib_ucontext *uctx,
if (MLX5_CAP_GEN(dev->mdev, drain_sigerr))
resp->comp_mask |= MLX5_IB_ALLOC_UCONTEXT_RESP_MASK_SQD2RTS;
+ resp->comp_mask |=
+ MLX5_IB_ALLOC_UCONTEXT_RESP_MASK_MKEY_UPDATE_TAG;
+
return 0;
}
diff --git a/drivers/infiniband/hw/mlx5/odp.c b/drivers/infiniband/hw/mlx5/odp.c
index e305bf1dc6c2..901a8b030236 100644
--- a/drivers/infiniband/hw/mlx5/odp.c
+++ b/drivers/infiniband/hw/mlx5/odp.c
@@ -795,7 +795,8 @@ static bool mkey_is_eq(struct mlx5_ib_mkey *mmkey, u32 key)
{
if (!mmkey)
return false;
- if (mmkey->type == MLX5_MKEY_MW)
+ if (mmkey->type == MLX5_MKEY_MW ||
+ mmkey->type == MLX5_MKEY_INDIRECT_DEVX)
return mlx5_base_mkey(mmkey->key) == mlx5_base_mkey(key);
return mmkey->key == key;
}
diff --git a/include/uapi/rdma/mlx5-abi.h b/include/uapi/rdma/mlx5-abi.h
index 86be4a92b67b..a96b7d2770e1 100644
--- a/include/uapi/rdma/mlx5-abi.h
+++ b/include/uapi/rdma/mlx5-abi.h
@@ -104,6 +104,7 @@ enum mlx5_ib_alloc_ucontext_resp_mask {
MLX5_IB_ALLOC_UCONTEXT_RESP_MASK_ECE = 1UL << 2,
MLX5_IB_ALLOC_UCONTEXT_RESP_MASK_SQD2RTS = 1UL << 3,
MLX5_IB_ALLOC_UCONTEXT_RESP_MASK_REAL_TIME_TS = 1UL << 4,
+ MLX5_IB_ALLOC_UCONTEXT_RESP_MASK_MKEY_UPDATE_TAG = 1UL << 5,
};
enum mlx5_user_cmds_supp_uhw {
--
2.37.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH rdma-next] RDMA/mlx5: Don't compare mkey tags in DEVX indirect mkey
2022-07-31 8:26 [PATCH rdma-next] RDMA/mlx5: Don't compare mkey tags in DEVX indirect mkey Leon Romanovsky
@ 2022-08-16 12:19 ` Leon Romanovsky
0 siblings, 0 replies; 2+ messages in thread
From: Leon Romanovsky @ 2022-08-16 12:19 UTC (permalink / raw)
To: Jason Gunthorpe; +Cc: Aharon Landau, linux-rdma
On Sun, Jul 31, 2022 at 11:26:36AM +0300, Leon Romanovsky wrote:
> From: Aharon Landau <aharonl@nvidia.com>
>
> According to the ib spec:
> If the CI supports the Base Memory Management Extensions defined in this
> specification, the L_Key format must consist of:
> 24 bit index in the most significant bits of the R_Key, and
> 8 bit key in the least significant bits of the R_Key
> Through a successful Allocate L_Key verb invocation, the CI must let the
> consumer own the key portion of the returned R_Key
>
> Therefore, when creating a mkey using DEVX, the consumer is allowed to
> change the key part. The kernel should compare only the index part of a
> R_Key to determine equality with another R_Key.
>
> Adding capability in order not to break backward compatibility.
>
> Fixes: 534fd7aac56a ("IB/mlx5: Manage indirection mkey upon DEVX flow for ODP")
> Signed-off-by: Aharon Landau <aharonl@nvidia.com>
> Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
> ---
> drivers/infiniband/hw/mlx5/main.c | 3 +++
> drivers/infiniband/hw/mlx5/odp.c | 3 ++-
> include/uapi/rdma/mlx5-abi.h | 1 +
> 3 files changed, 6 insertions(+), 1 deletion(-)
>
Thanks, applied
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-08-16 12:20 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-31 8:26 [PATCH rdma-next] RDMA/mlx5: Don't compare mkey tags in DEVX indirect mkey Leon Romanovsky
2022-08-16 12:19 ` Leon Romanovsky
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).