Skip to content

Commit 1b1e486

Browse files
ohartoovjgunthorpe
authored andcommitted
net/mlx5e: Use query_special_contexts for mkeys
Use query_sepcial_contexts in order to get the correct value of terminate_scatter_list_mkey, as FW will change it for certain configurations. Link: https://lore.kernel.org/r/fff70d94258233effb0e34f3d62cb08a692f5af5.1673960981.git.leon@kernel.org Signed-off-by: Or Har-Toov <[email protected]> Reviewed-by: Michael Guralnik <[email protected]> Signed-off-by: Leon Romanovsky <[email protected]> Signed-off-by: Jason Gunthorpe <[email protected]>
1 parent a419bfb commit 1b1e486

File tree

1 file changed

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

1 file changed

+21
-2
lines changed

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

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -665,6 +665,26 @@ static void mlx5e_rq_free_shampo(struct mlx5e_rq *rq)
665665
mlx5e_rq_shampo_hd_free(rq);
666666
}
667667

668+
static __be32 mlx5e_get_terminate_scatter_list_mkey(struct mlx5_core_dev *dev)
669+
{
670+
u32 out[MLX5_ST_SZ_DW(query_special_contexts_out)] = {};
671+
u32 in[MLX5_ST_SZ_DW(query_special_contexts_in)] = {};
672+
int res;
673+
674+
if (!MLX5_CAP_GEN(dev, terminate_scatter_list_mkey))
675+
return MLX5_TERMINATE_SCATTER_LIST_LKEY;
676+
677+
MLX5_SET(query_special_contexts_in, in, opcode,
678+
MLX5_CMD_OP_QUERY_SPECIAL_CONTEXTS);
679+
res = mlx5_cmd_exec_inout(dev, query_special_contexts, in, out);
680+
if (res)
681+
return MLX5_TERMINATE_SCATTER_LIST_LKEY;
682+
683+
res = MLX5_GET(query_special_contexts_out, out,
684+
terminate_scatter_list_mkey);
685+
return cpu_to_be32(res);
686+
}
687+
668688
static int mlx5e_alloc_rq(struct mlx5e_params *params,
669689
struct mlx5e_xsk_param *xsk,
670690
struct mlx5e_rq_param *rqp,
@@ -829,8 +849,7 @@ static int mlx5e_alloc_rq(struct mlx5e_params *params,
829849
/* check if num_frags is not a pow of two */
830850
if (rq->wqe.info.num_frags < (1 << rq->wqe.info.log_num_frags)) {
831851
wqe->data[f].byte_count = 0;
832-
wqe->data[f].lkey =
833-
MLX5_TERMINATE_SCATTER_LIST_LKEY;
852+
wqe->data[f].lkey = mlx5e_get_terminate_scatter_list_mkey(mdev);
834853
wqe->data[f].addr = 0;
835854
}
836855
}

0 commit comments

Comments
 (0)