Skip to content

Commit c4f9697

Browse files
EdwardSrorleon
authored andcommitted
RDMA/mlx5: Fix UMR modifying of mkey page size
When changing the page size on an mkey, the driver needs to set the appropriate bits in the mkey mask to indicate which fields are being modified. The 6th bit of a page size in mlx5 driver is considered an extension, and this bit has a dedicated capability and mask bits. Previously, the driver was not setting this mask in the mkey mask when performing page size changes, regardless of its hardware support, potentially leading to an incorrect page size updates. This fixes the issue by setting the relevant bit in the mkey mask when performing page size changes on an mkey and the 6th bit of this field is supported by the hardware. Fixes: cef7dde ("net/mlx5: Expand mkey page size to support 6 bits") Signed-off-by: Edward Srouji <[email protected]> Reviewed-by: Michael Guralnik <[email protected]> Link: https://patch.msgid.link/9f43a9c73bf2db6085a99dc836f7137e76579f09.1751979184.git.leon@kernel.org Signed-off-by: Leon Romanovsky <[email protected]>
1 parent 8feaf98 commit c4f9697

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

drivers/infiniband/hw/mlx5/umr.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,15 @@ static __be64 get_umr_disable_mr_mask(void)
3232
return cpu_to_be64(result);
3333
}
3434

35-
static __be64 get_umr_update_translation_mask(void)
35+
static __be64 get_umr_update_translation_mask(struct mlx5_ib_dev *dev)
3636
{
3737
u64 result;
3838

3939
result = MLX5_MKEY_MASK_LEN |
4040
MLX5_MKEY_MASK_PAGE_SIZE |
4141
MLX5_MKEY_MASK_START_ADDR;
42+
if (MLX5_CAP_GEN_2(dev->mdev, umr_log_entity_size_5))
43+
result |= MLX5_MKEY_MASK_PAGE_SIZE_5;
4244

4345
return cpu_to_be64(result);
4446
}
@@ -654,7 +656,7 @@ static void mlx5r_umr_final_update_xlt(struct mlx5_ib_dev *dev,
654656
flags & MLX5_IB_UPD_XLT_ENABLE || flags & MLX5_IB_UPD_XLT_ADDR;
655657

656658
if (update_translation) {
657-
wqe->ctrl_seg.mkey_mask |= get_umr_update_translation_mask();
659+
wqe->ctrl_seg.mkey_mask |= get_umr_update_translation_mask(dev);
658660
if (!mr->ibmr.length)
659661
MLX5_SET(mkc, &wqe->mkey_seg, length64, 1);
660662
}

include/linux/mlx5/device.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,7 @@ enum {
280280
MLX5_MKEY_MASK_SMALL_FENCE = 1ull << 23,
281281
MLX5_MKEY_MASK_RELAXED_ORDERING_WRITE = 1ull << 25,
282282
MLX5_MKEY_MASK_FREE = 1ull << 29,
283+
MLX5_MKEY_MASK_PAGE_SIZE_5 = 1ull << 42,
283284
MLX5_MKEY_MASK_RELAXED_ORDERING_READ = 1ull << 47,
284285
};
285286

0 commit comments

Comments
 (0)