linux-rdma.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Weihang Li <liweihang@huawei.com>
To: <dledford@redhat.com>, <jgg@ziepe.ca>
Cc: <leon@kernel.org>, <linux-rdma@vger.kernel.org>, <linuxarm@huawei.com>
Subject: [PATCH for-next] RDMA/hns: Support to set mininum depth of qp to 0
Date: Mon, 2 Mar 2020 17:22:17 +0800	[thread overview]
Message-ID: <1583140937-2223-1-git-send-email-liweihang@huawei.com> (raw)

From: Lang Cheng <chenglang@huawei.com>

Minimum depth of qp should be allowed to be set to 0 according to the
firmware configuration. And when qp is changed from reset to reset, the
capability of minimum qp depth was used to identify hardware of hip06,
it should be changed into a more readable form.

Signed-off-by: Lang Cheng <chenglang@huawei.com>
Signed-off-by: Weihang Li <liweihang@huawei.com>
---
 drivers/infiniband/hw/hns/hns_roce_qp.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/drivers/infiniband/hw/hns/hns_roce_qp.c b/drivers/infiniband/hw/hns/hns_roce_qp.c
index 2a75355..10c4354 100644
--- a/drivers/infiniband/hw/hns/hns_roce_qp.c
+++ b/drivers/infiniband/hw/hns/hns_roce_qp.c
@@ -382,10 +382,10 @@ static int set_rq_size(struct hns_roce_dev *hr_dev,
 			return -EINVAL;
 		}
 
-		if (hr_dev->caps.min_wqes)
+		if (cap->max_recv_wr)
 			max_cnt = max(cap->max_recv_wr, hr_dev->caps.min_wqes);
 		else
-			max_cnt = cap->max_recv_wr;
+			max_cnt = 0;
 
 		hr_qp->rq.wqe_cnt = roundup_pow_of_two(max_cnt);
 
@@ -652,10 +652,10 @@ static int set_kernel_sq_size(struct hns_roce_dev *hr_dev,
 
 	hr_qp->sq.wqe_shift = ilog2(hr_dev->caps.max_sq_desc_sz);
 
-	if (hr_dev->caps.min_wqes)
+	if (cap->max_send_wr)
 		max_cnt = max(cap->max_send_wr, hr_dev->caps.min_wqes);
 	else
-		max_cnt = cap->max_send_wr;
+		max_cnt = 0;
 
 	hr_qp->sq.wqe_cnt = roundup_pow_of_two(max_cnt);
 	if ((u32)hr_qp->sq.wqe_cnt > hr_dev->caps.max_wqes) {
@@ -1394,11 +1394,10 @@ int hns_roce_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr,
 		goto out;
 
 	if (cur_state == new_state && cur_state == IB_QPS_RESET) {
-		if (hr_dev->caps.min_wqes) {
+		if (hr_dev->hw_rev == HNS_ROCE_HW_VER1) {
 			ret = -EPERM;
 			ibdev_err(&hr_dev->ib_dev,
-				"cur_state=%d new_state=%d\n", cur_state,
-				new_state);
+				  "Unsupport to modify qp from reset to reset\n");
 		} else {
 			ret = 0;
 		}
-- 
2.8.1


             reply	other threads:[~2020-03-02  9:26 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-02  9:22 Weihang Li [this message]
2020-03-09 15:18 ` [PATCH for-next] RDMA/hns: Support to set mininum depth of qp to 0 Leon Romanovsky
2020-03-10 10:34   ` Lang Cheng
2020-03-10 12:39     ` Leon Romanovsky
2020-03-11  1:21       ` Lang Cheng

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1583140937-2223-1-git-send-email-liweihang@huawei.com \
    --to=liweihang@huawei.com \
    --cc=dledford@redhat.com \
    --cc=jgg@ziepe.ca \
    --cc=leon@kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=linuxarm@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).