@@ -665,6 +665,26 @@ static void mlx5e_rq_free_shampo(struct mlx5e_rq *rq)
665
665
mlx5e_rq_shampo_hd_free (rq );
666
666
}
667
667
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
+
668
688
static int mlx5e_alloc_rq (struct mlx5e_params * params ,
669
689
struct mlx5e_xsk_param * xsk ,
670
690
struct mlx5e_rq_param * rqp ,
@@ -829,8 +849,7 @@ static int mlx5e_alloc_rq(struct mlx5e_params *params,
829
849
/* check if num_frags is not a pow of two */
830
850
if (rq -> wqe .info .num_frags < (1 << rq -> wqe .info .log_num_frags )) {
831
851
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 );
834
853
wqe -> data [f ].addr = 0 ;
835
854
}
836
855
}
0 commit comments