All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lijun Ou <oulijun@huawei.com>
To: <dledford@redhat.com>, <jgg@ziepe.ca>
Cc: <linux-rdma@vger.kernel.org>, <linuxarm@huawei.com>
Subject: [PATCH for-next 7/9] RDMA/hns: Remove if-else judgment statements for creating srq
Date: Wed, 21 Aug 2019 21:14:34 +0800	[thread overview]
Message-ID: <1566393276-42555-8-git-send-email-oulijun@huawei.com> (raw)
In-Reply-To: <1566393276-42555-1-git-send-email-oulijun@huawei.com>

From: Wenpeng Liang <liangwenpeng@huawei.com>

Because if the value of srqwqe_buf_pg_sz is zero, npages and
ib_umem_page_count are equivalent, page_shif and PAGE_SHIFT
are equivalent in hns_roce_create_srq. Here remove it.

Signed-off-by: Wenpeng Liang <liangwenpeng@huawei.com>
Signed-off-by: Lijun Ou <oulijun@huawei.com>
---
 drivers/infiniband/hw/hns/hns_roce_srq.c | 29 +++++++----------------------
 1 file changed, 7 insertions(+), 22 deletions(-)

diff --git a/drivers/infiniband/hw/hns/hns_roce_srq.c b/drivers/infiniband/hw/hns/hns_roce_srq.c
index c011422..1a42172 100644
--- a/drivers/infiniband/hw/hns/hns_roce_srq.c
+++ b/drivers/infiniband/hw/hns/hns_roce_srq.c
@@ -191,15 +191,11 @@ static int create_user_srq(struct hns_roce_srq *srq, struct ib_udata *udata,
 	if (IS_ERR(srq->umem))
 		return PTR_ERR(srq->umem);
 
-	if (hr_dev->caps.srqwqe_buf_pg_sz) {
-		npages = (ib_umem_page_count(srq->umem) +
-			 (1 << hr_dev->caps.srqwqe_buf_pg_sz) - 1) /
-			 (1 << hr_dev->caps.srqwqe_buf_pg_sz);
-		page_shift = PAGE_SHIFT + hr_dev->caps.srqwqe_buf_pg_sz;
-		ret = hns_roce_mtt_init(hr_dev, npages, page_shift, &srq->mtt);
-	} else
-		ret = hns_roce_mtt_init(hr_dev, ib_umem_page_count(srq->umem),
-					PAGE_SHIFT, &srq->mtt);
+	npages = (ib_umem_page_count(srq->umem) +
+		(1 << hr_dev->caps.srqwqe_buf_pg_sz) - 1) /
+		(1 << hr_dev->caps.srqwqe_buf_pg_sz);
+	page_shift = PAGE_SHIFT + hr_dev->caps.srqwqe_buf_pg_sz;
+	ret = hns_roce_mtt_init(hr_dev, npages, page_shift, &srq->mtt);
 	if (ret)
 		goto err_user_buf;
 
@@ -216,19 +212,8 @@ static int create_user_srq(struct hns_roce_srq *srq, struct ib_udata *udata,
 		goto err_user_srq_mtt;
 	}
 
-	if (hr_dev->caps.idx_buf_pg_sz) {
-		npages = (ib_umem_page_count(srq->idx_que.umem) +
-			 (1 << hr_dev->caps.idx_buf_pg_sz) - 1) /
-			 (1 << hr_dev->caps.idx_buf_pg_sz);
-		page_shift = PAGE_SHIFT + hr_dev->caps.idx_buf_pg_sz;
-		ret = hns_roce_mtt_init(hr_dev, npages, page_shift,
-					&srq->idx_que.mtt);
-	} else {
-		ret = hns_roce_mtt_init(hr_dev,
-					ib_umem_page_count(srq->idx_que.umem),
-					PAGE_SHIFT,
-					&srq->idx_que.mtt);
-	}
+	ret = hns_roce_mtt_init(hr_dev, ib_umem_page_count(srq->idx_que.umem),
+				PAGE_SHIFT, &srq->idx_que.mtt);
 
 	if (ret) {
 		dev_err(hr_dev->dev, "hns_roce_mtt_init error for idx que\n");
-- 
2.8.1


  parent reply	other threads:[~2019-08-21 13:17 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-21 13:14 [PATCH for-next 0/9] Fixes for hip08 driver Lijun Ou
2019-08-21 13:14 ` [PATCH for-next 1/9] RDMA/hns: Refactor cmd init and mode selection for hip08 Lijun Ou
2019-08-21 17:19   ` Leon Romanovsky
2019-08-26  8:43     ` liweihang
2019-08-21 13:14 ` [PATCH for-next 2/9] RDMA/hns: Refactor the codes of creating qp Lijun Ou
2019-08-28 15:19   ` Doug Ledford
2019-08-29  0:56     ` oulijun
2019-08-21 13:14 ` [PATCH for-next 3/9] RDMA/hns: Modify the data structure of hns_roce_av Lijun Ou
2019-08-21 13:14 ` [PATCH for-next 4/9] RDMA/hns: Remove the some magic number Lijun Ou
2019-08-21 13:14 ` [PATCH for-next 5/9] RDMA/hns: Fix cast from or to restricted __le32 for driver Lijun Ou
2019-08-21 13:14 ` [PATCH for-next 6/9] RDMA/hns: Add reset process for function-clear Lijun Ou
2019-08-21 13:14 ` Lijun Ou [this message]
2019-08-21 13:14 ` [PATCH for-next 8/9] RDMA/hns: Delete the not-used lines Lijun Ou
2019-08-21 13:14 ` [PATCH for-next 9/9] RDMA/hns: Fix wrong assignment of qp_access_flags Lijun Ou
2019-08-28 15:31 ` [PATCH for-next 0/9] Fixes for hip08 driver Doug Ledford

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=1566393276-42555-8-git-send-email-oulijun@huawei.com \
    --to=oulijun@huawei.com \
    --cc=dledford@redhat.com \
    --cc=jgg@ziepe.ca \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.