diff mbox series

[for-next,4/9] RDMA/hns: Fix wrong assignment of SRQ's max_wr

Message ID 1588931159-56875-5-git-send-email-liweihang@huawei.com (mailing list archive)
State Mainlined
Commit 6968aeb5aa64a46175f408fa91e49c19e9558428
Delegated to: Jason Gunthorpe
Headers show
Series RDMA/hns: Various fixes and cleanups | expand

Commit Message

Weihang Li May 8, 2020, 9:45 a.m. UTC
srq's attribute max_wr should be 1 less than the total count of wqe.

Fixes: ffb1308b88b6 ("RDMA/hns: Move SRQ code to the reasonable place")
Signed-off-by: Weihang Li <liweihang@huawei.com>
---
 drivers/infiniband/hw/hns/hns_roce_hw_v2.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c
index 3039896..61c6bb3 100644
--- a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c
+++ b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c
@@ -5041,8 +5041,8 @@  static int hns_roce_v2_query_srq(struct ib_srq *ibsrq, struct ib_srq_attr *attr)
 				  SRQC_BYTE_8_SRQ_LIMIT_WL_S);
 
 	attr->srq_limit = limit_wl;
-	attr->max_wr    = srq->wqe_cnt;
-	attr->max_sge   = srq->max_gs;
+	attr->max_wr = srq->wqe_cnt - 1;
+	attr->max_sge = srq->max_gs;
 
 	memcpy(srq_context, mailbox->buf, sizeof(*srq_context));