Skip to content

Commit

Permalink
libhns: Bugfix for wrong timing of modifying ibv_qp state to err
Browse files Browse the repository at this point in the history
[ Upstream commit 886cf76 ]

Currently the QPC state in HW is modified inside the critical section
of spinlock but the ibv_qp state is modified outside. There will be
a short period when QPC state has been modified to err with ibv_qp
state still remaining RTS. WQEs during this period will still be
post-send by RTS-state ibv_qp but then dropped by err-state HW with
no flush CQEs generated.

To fix this problem, the QPC state in HW and ibv_qp state should be
both modified to err inside the critical section of spinlock.

Fixes: f1a80cc ("libhns: Bugfix for flush cqe in case multi-process")
Signed-off-by: Yangyang Li <liyangyang20@huawei.com>
Signed-off-by: Junxian Huang <huangjunxian6@hisilicon.com>
Signed-off-by: Nicolas Morey <nmorey@suse.com>
  • Loading branch information
l00436852 authored and nmorey committed Jan 17, 2024
1 parent bc14258 commit f3c8154
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions providers/hns/hns_roce_u_hw_v2.c
Expand Up @@ -1552,6 +1552,8 @@ static int hns_roce_u_v2_modify_qp(struct ibv_qp *qp, struct ibv_qp_attr *attr,
ret = ibv_cmd_modify_qp(qp, attr, attr_mask, &cmd, sizeof(cmd));

if (flag) {
if (!ret)
qp->state = IBV_QPS_ERR;
pthread_spin_unlock(&hr_qp->rq.lock);
pthread_spin_unlock(&hr_qp->sq.lock);
}
Expand Down

0 comments on commit f3c8154

Please sign in to comment.