Skip to content

Commit 58caa2a

Browse files
Chengchang Tangjgunthorpe
authored andcommitted
RDMA/hns: Fix timeout attr in query qp for HIP08
On HIP08, the queried timeout attr is different from the timeout attr configured by the user. It is found by rdma-core testcase test_rdmacm_async_traffic: ====================================================================== FAIL: test_rdmacm_async_traffic (tests.test_rdmacm.CMTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "./tests/test_rdmacm.py", line 33, in test_rdmacm_async_traffic self.two_nodes_rdmacm_traffic(CMAsyncConnection, self.rdmacm_traffic, File "./tests/base.py", line 382, in two_nodes_rdmacm_traffic raise(res) AssertionError Fixes: 926a01d ("RDMA/hns: Add QP operations support for hip08 SoC") Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Chengchang Tang <[email protected]> Signed-off-by: Junxian Huang <[email protected]> Signed-off-by: Jason Gunthorpe <[email protected]>
1 parent 866422c commit 58caa2a

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

drivers/infiniband/hw/hns/hns_roce_hw_v2.c

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5012,7 +5012,6 @@ static int hns_roce_v2_set_abs_fields(struct ib_qp *ibqp,
50125012
static bool check_qp_timeout_cfg_range(struct hns_roce_dev *hr_dev, u8 *timeout)
50135013
{
50145014
#define QP_ACK_TIMEOUT_MAX_HIP08 20
5015-
#define QP_ACK_TIMEOUT_OFFSET 10
50165015
#define QP_ACK_TIMEOUT_MAX 31
50175016

50185017
if (hr_dev->pci_dev->revision == PCI_REVISION_ID_HIP08) {
@@ -5021,7 +5020,7 @@ static bool check_qp_timeout_cfg_range(struct hns_roce_dev *hr_dev, u8 *timeout)
50215020
"local ACK timeout shall be 0 to 20.\n");
50225021
return false;
50235022
}
5024-
*timeout += QP_ACK_TIMEOUT_OFFSET;
5023+
*timeout += HNS_ROCE_V2_QP_ACK_TIMEOUT_OFS_HIP08;
50255024
} else if (hr_dev->pci_dev->revision > PCI_REVISION_ID_HIP08) {
50265025
if (*timeout > QP_ACK_TIMEOUT_MAX) {
50275026
ibdev_warn(&hr_dev->ib_dev,
@@ -5307,6 +5306,18 @@ static int hns_roce_v2_query_qpc(struct hns_roce_dev *hr_dev, u32 qpn,
53075306
return ret;
53085307
}
53095308

5309+
static u8 get_qp_timeout_attr(struct hns_roce_dev *hr_dev,
5310+
struct hns_roce_v2_qp_context *context)
5311+
{
5312+
u8 timeout;
5313+
5314+
timeout = (u8)hr_reg_read(context, QPC_AT);
5315+
if (hr_dev->pci_dev->revision == PCI_REVISION_ID_HIP08)
5316+
timeout -= HNS_ROCE_V2_QP_ACK_TIMEOUT_OFS_HIP08;
5317+
5318+
return timeout;
5319+
}
5320+
53105321
static int hns_roce_v2_query_qp(struct ib_qp *ibqp, struct ib_qp_attr *qp_attr,
53115322
int qp_attr_mask,
53125323
struct ib_qp_init_attr *qp_init_attr)
@@ -5384,7 +5395,7 @@ static int hns_roce_v2_query_qp(struct ib_qp *ibqp, struct ib_qp_attr *qp_attr,
53845395
qp_attr->max_dest_rd_atomic = 1 << hr_reg_read(&context, QPC_RR_MAX);
53855396

53865397
qp_attr->min_rnr_timer = (u8)hr_reg_read(&context, QPC_MIN_RNR_TIME);
5387-
qp_attr->timeout = (u8)hr_reg_read(&context, QPC_AT);
5398+
qp_attr->timeout = get_qp_timeout_attr(hr_dev, &context);
53885399
qp_attr->retry_cnt = hr_reg_read(&context, QPC_RETRY_NUM_INIT);
53895400
qp_attr->rnr_retry = hr_reg_read(&context, QPC_RNR_NUM_INIT);
53905401

drivers/infiniband/hw/hns/hns_roce_hw_v2.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@
4444
#define HNS_ROCE_V2_MAX_XRCD_NUM 0x1000000
4545
#define HNS_ROCE_V2_RSV_XRCD_NUM 0
4646

47+
#define HNS_ROCE_V2_QP_ACK_TIMEOUT_OFS_HIP08 10
48+
4749
#define HNS_ROCE_V3_SCCC_SZ 64
4850
#define HNS_ROCE_V3_GMV_ENTRY_SZ 32
4951

0 commit comments

Comments
 (0)