Skip to content

Commit 6da06c6

Browse files
Weihang Lijgunthorpe
authored andcommitted
Revert "RDMA/hns: Reserve one sge in order to avoid local length error"
This patch caused some issues on SEND operation, and it should be reverted to make the drivers work correctly. There will be a better solution that has been tested carefully to solve the original problem. This reverts commit 711195e. Fixes: 711195e ("RDMA/hns: Reserve one sge in order to avoid local length error") Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Weihang Li <[email protected]> Signed-off-by: Jason Gunthorpe <[email protected]>
1 parent b25e8e8 commit 6da06c6

File tree

5 files changed

+8
-14
lines changed

5 files changed

+8
-14
lines changed

drivers/infiniband/hw/hns/hns_roce_device.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,6 @@
6565
#define HNS_ROCE_CQE_WCMD_EMPTY_BIT 0x2
6666
#define HNS_ROCE_MIN_CQE_CNT 16
6767

68-
#define HNS_ROCE_RESERVED_SGE 1
69-
7068
#define HNS_ROCE_MAX_IRQ_NUM 128
7169

7270
#define HNS_ROCE_SGE_IN_WQE 2

drivers/infiniband/hw/hns/hns_roce_hw_v2.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -633,7 +633,7 @@ static int hns_roce_v2_post_recv(struct ib_qp *ibqp,
633633

634634
wqe_idx = (hr_qp->rq.head + nreq) & (hr_qp->rq.wqe_cnt - 1);
635635

636-
if (unlikely(wr->num_sge >= hr_qp->rq.max_gs)) {
636+
if (unlikely(wr->num_sge > hr_qp->rq.max_gs)) {
637637
ibdev_err(ibdev, "rq:num_sge=%d >= qp->sq.max_gs=%d\n",
638638
wr->num_sge, hr_qp->rq.max_gs);
639639
ret = -EINVAL;
@@ -653,7 +653,6 @@ static int hns_roce_v2_post_recv(struct ib_qp *ibqp,
653653
if (wr->num_sge < hr_qp->rq.max_gs) {
654654
dseg->lkey = cpu_to_le32(HNS_ROCE_INVALID_LKEY);
655655
dseg->addr = 0;
656-
dseg->len = cpu_to_le32(HNS_ROCE_INVALID_SGE_LENGTH);
657656
}
658657

659658
/* rq support inline data */
@@ -787,8 +786,8 @@ static int hns_roce_v2_post_srq_recv(struct ib_srq *ibsrq,
787786
}
788787

789788
if (wr->num_sge < srq->max_gs) {
790-
dseg[i].len = cpu_to_le32(HNS_ROCE_INVALID_SGE_LENGTH);
791-
dseg[i].lkey = cpu_to_le32(HNS_ROCE_INVALID_LKEY);
789+
dseg[i].len = 0;
790+
dseg[i].lkey = cpu_to_le32(0x100);
792791
dseg[i].addr = 0;
793792
}
794793

@@ -5070,7 +5069,7 @@ static int hns_roce_v2_query_srq(struct ib_srq *ibsrq, struct ib_srq_attr *attr)
50705069

50715070
attr->srq_limit = limit_wl;
50725071
attr->max_wr = srq->wqe_cnt - 1;
5073-
attr->max_sge = srq->max_gs - HNS_ROCE_RESERVED_SGE;
5072+
attr->max_sge = srq->max_gs;
50745073

50755074
out:
50765075
hns_roce_free_cmd_mailbox(hr_dev, mailbox);

drivers/infiniband/hw/hns/hns_roce_hw_v2.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,7 @@
9292
#define HNS_ROCE_V2_CQC_TIMER_ENTRY_SZ PAGE_SIZE
9393
#define HNS_ROCE_V2_PAGE_SIZE_SUPPORTED 0xFFFFF000
9494
#define HNS_ROCE_V2_MAX_INNER_MTPT_NUM 2
95-
#define HNS_ROCE_INVALID_LKEY 0x0
96-
#define HNS_ROCE_INVALID_SGE_LENGTH 0x80000000
97-
95+
#define HNS_ROCE_INVALID_LKEY 0x100
9896
#define HNS_ROCE_CMQ_TX_TIMEOUT 30000
9997
#define HNS_ROCE_V2_UC_RC_SGE_NUM_IN_WQE 2
10098
#define HNS_ROCE_V2_RSV_QPS 8

drivers/infiniband/hw/hns/hns_roce_qp.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -386,8 +386,7 @@ static int set_rq_size(struct hns_roce_dev *hr_dev, struct ib_qp_cap *cap,
386386
return -EINVAL;
387387
}
388388

389-
hr_qp->rq.max_gs = roundup_pow_of_two(max(1U, cap->max_recv_sge) +
390-
HNS_ROCE_RESERVED_SGE);
389+
hr_qp->rq.max_gs = roundup_pow_of_two(max(1U, cap->max_recv_sge));
391390

392391
if (hr_dev->caps.max_rq_sg <= HNS_ROCE_SGE_IN_WQE)
393392
hr_qp->rq.wqe_shift = ilog2(hr_dev->caps.max_rq_desc_sz);
@@ -402,7 +401,7 @@ static int set_rq_size(struct hns_roce_dev *hr_dev, struct ib_qp_cap *cap,
402401
hr_qp->rq_inl_buf.wqe_cnt = 0;
403402

404403
cap->max_recv_wr = cnt;
405-
cap->max_recv_sge = hr_qp->rq.max_gs - HNS_ROCE_RESERVED_SGE;
404+
cap->max_recv_sge = hr_qp->rq.max_gs;
406405

407406
return 0;
408407
}

drivers/infiniband/hw/hns/hns_roce_srq.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ int hns_roce_create_srq(struct ib_srq *ib_srq,
297297
spin_lock_init(&srq->lock);
298298

299299
srq->wqe_cnt = roundup_pow_of_two(init_attr->attr.max_wr + 1);
300-
srq->max_gs = init_attr->attr.max_sge + HNS_ROCE_RESERVED_SGE;
300+
srq->max_gs = init_attr->attr.max_sge;
301301

302302
if (udata) {
303303
ret = ib_copy_from_udata(&ucmd, udata, sizeof(ucmd));

0 commit comments

Comments
 (0)