Commit 085a1b42 authored by wenglianfa's avatar wenglianfa Committed by Leon Romanovsky
Browse files

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: 124a9fbe ("RDMA/hns: Append SCC context to the raw dump of QPC")
Signed-off-by: default avatarwenglianfa <wenglianfa@huawei.com>
Signed-off-by: default avatarJunxian Huang <huangjunxian6@hisilicon.com>
Link: https://patch.msgid.link/20250726075345.846957-1-huangjunxian6@hisilicon.com


Reviewed-by: default avatarZhu Yanjun <yanjun.zhu@linux.dev>
Signed-off-by: default avatarLeon Romanovsky <leon@kernel.org>
parent d4ac86b4
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -5476,7 +5476,7 @@ static int hns_roce_v2_query_srqc(struct hns_roce_dev *hr_dev, u32 srqn,
	return ret;
}

static int hns_roce_v2_query_sccc(struct hns_roce_dev *hr_dev, u32 qpn,
static int hns_roce_v2_query_sccc(struct hns_roce_dev *hr_dev, u32 sccn,
				  void *buffer)
{
	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,
		return PTR_ERR(mailbox);

	ret = hns_roce_cmd_mbox(hr_dev, 0, mailbox->dma, HNS_ROCE_CMD_QUERY_SCCC,
				qpn);
				sccn);
	if (ret)
		goto out;

+8 −1
Original line number Diff line number Diff line
@@ -100,6 +100,7 @@ int hns_roce_fill_res_qp_entry_raw(struct sk_buff *msg, struct ib_qp *ib_qp)
		struct hns_roce_v2_qp_context qpc;
		struct hns_roce_v2_scc_context sccc;
	} context = {};
	u32 sccn = hr_qp->qpn;
	int ret;

	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)
	    !hr_dev->hw->query_sccc)
		goto out;

	ret = hr_dev->hw->query_sccc(hr_dev, hr_qp->qpn, &context.sccc);
	if (hr_qp->cong_type == CONG_TYPE_DIP) {
		if (!hr_qp->dip)
			goto out;
		sccn = hr_qp->dip->dip_idx;
	}

	ret = hr_dev->hw->query_sccc(hr_dev, sccn, &context.sccc);
	if (ret)
		ibdev_warn_ratelimited(&hr_dev->ib_dev,
				       "failed to query SCCC, ret = %d.\n",