Skip to content

Commit 0232fc2

Browse files
ayalevinSaeed Mahameed
authored andcommitted
net/mlx5: Reset mkey index on creation
Reset only the index part of the mkey and keep the variant part. On devlink reload, driver recreates mkeys, so the mkey index may change. Trying to preserve the variant part of the mkey, driver mistakenly merged the mkey index with current value. In case of a devlink reload, current value of index part is dirty, so the index may be corrupted. Fixes: 54c62e1 ("{IB,net}/mlx5: Setup mkey variant before mr create command invocation") Signed-off-by: Aya Levin <[email protected]> Signed-off-by: Amir Tzin <[email protected]> Reviewed-by: Tariq Toukan <[email protected]> Signed-off-by: Saeed Mahameed <[email protected]>
1 parent a5ae8fc commit 0232fc2

File tree

1 file changed

+1
-1
lines changed
  • drivers/net/ethernet/mellanox/mlx5/core

1 file changed

+1
-1
lines changed

drivers/net/ethernet/mellanox/mlx5/core/mr.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ int mlx5_core_create_mkey(struct mlx5_core_dev *dev,
5454
mkey_index = MLX5_GET(create_mkey_out, lout, mkey_index);
5555
mkey->iova = MLX5_GET64(mkc, mkc, start_addr);
5656
mkey->size = MLX5_GET64(mkc, mkc, len);
57-
mkey->key |= mlx5_idx_to_mkey(mkey_index);
57+
mkey->key = (u32)mlx5_mkey_variant(mkey->key) | mlx5_idx_to_mkey(mkey_index);
5858
mkey->pd = MLX5_GET(mkc, mkc, pd);
5959
init_waitqueue_head(&mkey->wait);
6060

0 commit comments

Comments
 (0)