[PATCH rdma-core 1/1] mlx5: Account for at least 1 medium bfreg in low_lat_uuars check

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The calculation of need_uuar_lock rightly accounts for at least 1 medium
bfreg. However, the user can wrongly request for all but one uuars to be
low latency uuars.

For example, setting MLX5_TOTAL_UUARS=16 and MLX5_NUM_LOW_LAT_UUARS=15
doesn't throw any error but the user gets only 14 low latency uuars;
need_lock for bf_1 evaluates to 1. In this case, the first QP of the
context is mapped to bf_1 which is not a low latency uuar.

Signed-off-by: Rohit Zambre <rzambre@xxxxxxx>
---
 providers/mlx5/mlx5.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/providers/mlx5/mlx5.c b/providers/mlx5/mlx5.c
index 5590241..2a09a95 100644
--- a/providers/mlx5/mlx5.c
+++ b/providers/mlx5/mlx5.c
@@ -1026,7 +1026,8 @@ static struct verbs_context *mlx5_alloc_context(struct ibv_device *ibdev,
 		goto err_free;
 	}
 
-	if (low_lat_uuars > tot_uuars - 1) {
+	/* account for at least 1 med bfreg and the 0th uuar */
+	if (low_lat_uuars > tot_uuars - 2) {
 		errno = ENOMEM;
 		goto err_free;
 	}
-- 
1.8.3.1

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux