]> www.infradead.org Git - users/jedix/linux-maple.git/commit
IB/mad: Check available slots before posting receive WRs
authorMaher Sanalla <msanalla@nvidia.com>
Thu, 13 Mar 2025 14:20:17 +0000 (16:20 +0200)
committerLeon Romanovsky <leon@kernel.org>
Wed, 19 Mar 2025 08:43:03 +0000 (04:43 -0400)
commit37826f0a8c2f6b6add5179003b8597e32a445362
treeb47a0a7a82b303c4eef9fab2b9a22ce05627c910
parent0c55174524227a174c1a367889cd704212d15b45
IB/mad: Check available slots before posting receive WRs

The ib_post_receive_mads() function handles posting receive work
requests (WRs) to MAD QPs and is called in two cases:
1) When a MAD port is opened.
2) When a receive WQE is consumed upon receiving a new MAD.

Whereas, if MADs arrive during the port open phase, a race condition
might cause an extra WR to be posted, exceeding the QP’s capacity.
This leads to failures such as:
infiniband mlx5_0: ib_post_recv failed: -12
infiniband mlx5_0: Couldn't post receive WRs
infiniband mlx5_0: Couldn't start port
infiniband mlx5_0: Couldn't open port 1

Fix this by checking the current receive count before posting a new WR.
If the QP’s receive queue is full, do not post additional WRs.

Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Signed-off-by: Maher Sanalla <msanalla@nvidia.com>
Link: https://patch.msgid.link/c4984ba3c3a98a5711a558bccefcad789587ecf1.1741875592.git.leon@kernel.org
Signed-off-by: Leon Romanovsky <leon@kernel.org>
drivers/infiniband/core/mad.c