From 297cc2c6323514a69b57aeeb5207cf63e5e2549b Mon Sep 17 00:00:00 2001 From: Bodong Wang Date: Tue, 27 Oct 2020 08:59:02 -0500 Subject: [PATCH] mlx5: DR, Create NC UAR as default but fall-back to WC if failed [ Upstream commit 40b8e48792a423da1ceeaf58ac8eee81e9e0194a ] Some devices may only support either NC or WC UAR. To handle such devices, first try to create NC, then try WC if NC failed. Fixes: 84ac5272a05a ("mlx5: Enhance mlx5dv_devx_alloc_uar() functionality") Signed-off-by: Bodong Wang Signed-off-by: Yishai Hadas Signed-off-by: Nicolas Morey-Chaisemartin --- providers/mlx5/dr_domain.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/providers/mlx5/dr_domain.c b/providers/mlx5/dr_domain.c index b47c5841f624..5b8739dca2ef 100644 --- a/providers/mlx5/dr_domain.c +++ b/providers/mlx5/dr_domain.c @@ -50,7 +50,13 @@ static int dr_domain_init_resources(struct mlx5dv_dr_domain *dmn) return ret; } - dmn->uar = mlx5dv_devx_alloc_uar(dmn->ctx, 0); + dmn->uar = mlx5dv_devx_alloc_uar(dmn->ctx, + MLX5_IB_UAPI_UAR_ALLOC_TYPE_NC); + + if (!dmn->uar) + dmn->uar = mlx5dv_devx_alloc_uar(dmn->ctx, + MLX5_IB_UAPI_UAR_ALLOC_TYPE_BF); + if (!dmn->uar) { dr_dbg(dmn, "Can't allocate UAR\n"); goto clean_pd; -- 2.25.4