Skip to content

Commit d5e4173

Browse files
committed
mlx5: ignore QP max_recv_wr when SRQ is used
According to the manual, max_recv_wr and max_recv_sge are ignored by `ibv_create_qp` if the QP is to be associated with an SRQ. Fix the bug where `ibv_create_qp` may fail due to uninitialized `max_recv_wr`. Signed-off-by: ZHOU Huaping <[email protected]>
1 parent 6fc7569 commit d5e4173

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

providers/mlx5/verbs.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1770,6 +1770,12 @@ static int mlx5_get_max_recv_wr(struct mlx5_context *ctx,
17701770
struct mlx5dv_qp_init_attr *mlx5_qp_attr,
17711771
uint32_t *max_recv_wr)
17721772
{
1773+
/* Ignore max_recv_wr when SRQ is used. */
1774+
if (attr->srq) {
1775+
*max_recv_wr = 0;
1776+
return 0;
1777+
}
1778+
17731779
if (mlx5_qp_attr && (mlx5_qp_attr->create_flags & MLX5DV_QP_CREATE_OOO_DP) &&
17741780
attr->cap.max_recv_wr > 1) {
17751781
uint32_t max_recv_wr_cap = 0;

0 commit comments

Comments
 (0)