Skip to content

Commit

Permalink
libhns: Fix no locking in the exception branch of wr start()
Browse files Browse the repository at this point in the history
[ Upstream commit d1d0ac5 ]

According to the man page ibv_wr_post.3.md,
"The provider should provide locking to ensure that ibv_wr_start()
and ibv_wr_complete()/abort() form a per-QP critical section
where no other threads can enter."

Currently the exception branch of wr_start() is not locked, add
a lock here.

Fixes: 36446a5 ("libhns: Extended QP supports the new post send mechanism")
Signed-off-by: wenglianfa <wenglianfa@huawei.com>
Signed-off-by: Junxian Huang <huangjunxian6@hisilicon.com>
Signed-off-by: Nicolas Morey <nmorey@suse.com>
  • Loading branch information
wenglianfa authored and nmorey committed Aug 5, 2024
1 parent 3848b88 commit 08aed8a
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions providers/hns/hns_roce_u_hw_v2.c
Original file line number Diff line number Diff line change
Expand Up @@ -2530,6 +2530,7 @@ static void wr_start(struct ibv_qp_ex *ibv_qp)
if (state == IBV_QPS_RESET ||
state == IBV_QPS_INIT ||
state == IBV_QPS_RTR) {
pthread_spin_lock(&qp->sq.lock);
qp->err = EINVAL;
return;
}
Expand Down

0 comments on commit 08aed8a

Please sign in to comment.