Skip to content

Commit 085a1b4

Browse files
wenglianfarleon
authored andcommitted
RDMA/hns: Fix querying wrong SCC context for DIP algorithm
When using DIP algorithm, all QPs establishing connections with the same destination IP share the same SCC, which is indexed by dip_idx, but dip_idx isn't necessarily equal to qpn. Therefore, dip_idx should be used to query SCC context instead of qpn. Fixes: 124a9fb ("RDMA/hns: Append SCC context to the raw dump of QPC") Signed-off-by: wenglianfa <wenglianfa@huawei.com> Signed-off-by: Junxian Huang <huangjunxian6@hisilicon.com> Link: https://patch.msgid.link/20250726075345.846957-1-huangjunxian6@hisilicon.com Reviewed-by: Zhu Yanjun <yanjun.zhu@linux.dev> Signed-off-by: Leon Romanovsky <leon@kernel.org>
1 parent d4ac86b commit 085a1b4

2 files changed

Lines changed: 10 additions & 3 deletions

File tree

drivers/infiniband/hw/hns/hns_roce_hw_v2.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5476,7 +5476,7 @@ static int hns_roce_v2_query_srqc(struct hns_roce_dev *hr_dev, u32 srqn,
54765476
return ret;
54775477
}
54785478

5479-
static int hns_roce_v2_query_sccc(struct hns_roce_dev *hr_dev, u32 qpn,
5479+
static int hns_roce_v2_query_sccc(struct hns_roce_dev *hr_dev, u32 sccn,
54805480
void *buffer)
54815481
{
54825482
struct hns_roce_v2_scc_context *context;
@@ -5488,7 +5488,7 @@ static int hns_roce_v2_query_sccc(struct hns_roce_dev *hr_dev, u32 qpn,
54885488
return PTR_ERR(mailbox);
54895489

54905490
ret = hns_roce_cmd_mbox(hr_dev, 0, mailbox->dma, HNS_ROCE_CMD_QUERY_SCCC,
5491-
qpn);
5491+
sccn);
54925492
if (ret)
54935493
goto out;
54945494

drivers/infiniband/hw/hns/hns_roce_restrack.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ int hns_roce_fill_res_qp_entry_raw(struct sk_buff *msg, struct ib_qp *ib_qp)
100100
struct hns_roce_v2_qp_context qpc;
101101
struct hns_roce_v2_scc_context sccc;
102102
} context = {};
103+
u32 sccn = hr_qp->qpn;
103104
int ret;
104105

105106
if (!hr_dev->hw->query_qpc)
@@ -116,7 +117,13 @@ int hns_roce_fill_res_qp_entry_raw(struct sk_buff *msg, struct ib_qp *ib_qp)
116117
!hr_dev->hw->query_sccc)
117118
goto out;
118119

119-
ret = hr_dev->hw->query_sccc(hr_dev, hr_qp->qpn, &context.sccc);
120+
if (hr_qp->cong_type == CONG_TYPE_DIP) {
121+
if (!hr_qp->dip)
122+
goto out;
123+
sccn = hr_qp->dip->dip_idx;
124+
}
125+
126+
ret = hr_dev->hw->query_sccc(hr_dev, sccn, &context.sccc);
120127
if (ret)
121128
ibdev_warn_ratelimited(&hr_dev->ib_dev,
122129
"failed to query SCCC, ret = %d.\n",

0 commit comments

Comments
 (0)