Skip to content

Commit 52c13a4

Browse files
wenglianfagregkh
authored andcommitted
RDMA/hns: Fix querying wrong SCC context for DIP algorithm
[ Upstream commit 085a1b4 ] 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> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent a473adc commit 52c13a4

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

drivers/infiniband/hw/hns/hns_roce_hw_v2.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5514,7 +5514,7 @@ static int hns_roce_v2_query_srqc(struct hns_roce_dev *hr_dev, u32 srqn,
55145514
return ret;
55155515
}
55165516

5517-
static int hns_roce_v2_query_sccc(struct hns_roce_dev *hr_dev, u32 qpn,
5517+
static int hns_roce_v2_query_sccc(struct hns_roce_dev *hr_dev, u32 sccn,
55185518
void *buffer)
55195519
{
55205520
struct hns_roce_v2_scc_context *context;
@@ -5526,7 +5526,7 @@ static int hns_roce_v2_query_sccc(struct hns_roce_dev *hr_dev, u32 qpn,
55265526
return PTR_ERR(mailbox);
55275527

55285528
ret = hns_roce_cmd_mbox(hr_dev, 0, mailbox->dma, HNS_ROCE_CMD_QUERY_SCCC,
5529-
qpn);
5529+
sccn);
55305530
if (ret)
55315531
goto out;
55325532

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)