Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1487499

[PATCH V2 for-next 19/19] IB/hns: Fix for removal of redundant code

From Salil Mehta <salil.mehta@huawei.com>
Newsgroups linux.kernel
Subject [PATCH V2 for-next 19/19] IB/hns: Fix for removal of redundant code
Date 2016-09-20 18:20 +0200
Message-ID <sjvW2-5lT-25@gated-at.bofh.it> (permalink)
References <sjvMm-5fH-15@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


This patch removes the redundant code lines present in the
functions get_send_wqe() and get_recv_wqe(). This also fixes
the error in calculating the SQ WQE.

Signed-off-by: Lijun Ou <oulijun@huawei.com>
Reviewed-by:  Wei Hu (Xavier) <xavier.huwei@huawei.com>
Signed-off-by: Salil Mehta <salil.mehta@huawei.com>
---
PATCH V1: This has been create to address the Leon
          Romanovsky's comment provided in below patches:
	  Link: https://lkml.org/lkml/2016/9/15/117
	  Link: https://lkml.org/lkml/2016/9/13/54
---
 drivers/infiniband/hw/hns/hns_roce_hw_v1.c |  3 ++-
 drivers/infiniband/hw/hns/hns_roce_qp.c    | 18 ------------------
 2 files changed, 2 insertions(+), 19 deletions(-)

diff --git a/drivers/infiniband/hw/hns/hns_roce_hw_v1.c b/drivers/infiniband/hw/hns/hns_roce_hw_v1.c
index d52eeda..71232e5 100644
--- a/drivers/infiniband/hw/hns/hns_roce_hw_v1.c
+++ b/drivers/infiniband/hw/hns/hns_roce_hw_v1.c
@@ -1552,7 +1552,8 @@ static int hns_roce_v1_poll_one(struct hns_roce_cq *hr_cq,
 		/* SQ conrespond to CQE */
 		sq_wqe = get_send_wqe(*cur_qp, roce_get_field(cqe->cqe_byte_4,
 						CQE_BYTE_4_WQE_INDEX_M,
-						CQE_BYTE_4_WQE_INDEX_S));
+						CQE_BYTE_4_WQE_INDEX_S)&
+						((*cur_qp)->sq.wqe_cnt-1));
 		switch (sq_wqe->flag & HNS_ROCE_WQE_OPCODE_MASK) {
 		case HNS_ROCE_WQE_OPCODE_SEND:
 			wc->opcode = IB_WC_SEND;
diff --git a/drivers/infiniband/hw/hns/hns_roce_qp.c b/drivers/infiniband/hw/hns/hns_roce_qp.c
index 6a38909..e86dd8d 100644
--- a/drivers/infiniband/hw/hns/hns_roce_qp.c
+++ b/drivers/infiniband/hw/hns/hns_roce_qp.c
@@ -784,29 +784,11 @@ static void *get_wqe(struct hns_roce_qp *hr_qp, int offset)
 
 void *get_recv_wqe(struct hns_roce_qp *hr_qp, int n)
 {
-	struct ib_qp *ibqp = &hr_qp->ibqp;
-	struct hns_roce_dev *hr_dev = to_hr_dev(ibqp->device);
-
-	if ((n < 0) || (n > hr_qp->rq.wqe_cnt)) {
-		dev_err(&hr_dev->pdev->dev, "rq wqe index:%d,rq wqe cnt:%d\r\n",
-			n, hr_qp->rq.wqe_cnt);
-		return NULL;
-	}
-
 	return get_wqe(hr_qp, hr_qp->rq.offset + (n << hr_qp->rq.wqe_shift));
 }
 
 void *get_send_wqe(struct hns_roce_qp *hr_qp, int n)
 {
-	struct ib_qp *ibqp = &hr_qp->ibqp;
-	struct hns_roce_dev *hr_dev = to_hr_dev(ibqp->device);
-
-	if ((n < 0) || (n > hr_qp->sq.wqe_cnt)) {
-		dev_err(&hr_dev->pdev->dev, "sq wqe index:%d,sq wqe cnt:%d\r\n",
-			n, hr_qp->sq.wqe_cnt);
-		return NULL;
-	}
-
 	return get_wqe(hr_qp, hr_qp->sq.offset + (n << hr_qp->sq.wqe_shift));
 }
 
-- 
1.9.1

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH V2 for-next 00/19] IB/hns: Fixes for various misc. bugs Salil Mehta <salil.mehta@huawei.com> - 2016-09-20 18:10 +0200
  [PATCH V2 for-next 05/19] IB/hns: Remove unused parameter named qp_type Salil Mehta <salil.mehta@huawei.com> - 2016-09-20 18:10 +0200
  [PATCH V2 for-next 03/19] IB/hns: Fix bug of using uninit refcount and free Salil Mehta <salil.mehta@huawei.com> - 2016-09-20 18:10 +0200
  [PATCH V2 for-next 06/19] IB/hns: Fix bug of clear hem Salil Mehta <salil.mehta@huawei.com> - 2016-09-20 18:10 +0200
  [PATCH V2 for-next 11/19] IB/hns: Return bad wr while post send failed Salil Mehta <salil.mehta@huawei.com> - 2016-09-20 18:20 +0200
  [PATCH V2 for-next 13/19] IB/hns: Some items of qpc need to take user param Salil Mehta <salil.mehta@huawei.com> - 2016-09-20 18:20 +0200
  [PATCH V2 for-next 17/19] IB/hns: Fix the bug when platform_get_resource() exec fail Salil Mehta <salil.mehta@huawei.com> - 2016-09-20 18:20 +0200
  [PATCH V2 for-next 18/19] IB/hns: Delete the redundant lines in hns_roce_v1_m_qp() Salil Mehta <salil.mehta@huawei.com> - 2016-09-20 18:20 +0200
  [PATCH V2 for-next 12/19] IB/hns: The Ack timeout need a lower limit value Salil Mehta <salil.mehta@huawei.com> - 2016-09-20 18:20 +0200
  [PATCH V2 for-next 16/19] IB/hns: Update the rq head when modify qp state Salil Mehta <salil.mehta@huawei.com> - 2016-09-20 18:20 +0200
  [PATCH V2 for-next 10/19] IB/hns: Fix bug of memory leakage for registering user mr Salil Mehta <salil.mehta@huawei.com> - 2016-09-20 18:20 +0200
  [PATCH V2 for-next 02/19] IB/hns: Remove parameters of resize cq Salil Mehta <salil.mehta@huawei.com> - 2016-09-20 18:20 +0200
  [PATCH V2 for-next 01/19] IB/hns: Remove unused parameters in some functions Salil Mehta <salil.mehta@huawei.com> - 2016-09-20 18:20 +0200
  [PATCH V2 for-next 19/19] IB/hns: Fix for removal of redundant code Salil Mehta <salil.mehta@huawei.com> - 2016-09-20 18:20 +0200
  [PATCH V2 for-next 15/19] IB/hns: Cq has not been freed Salil Mehta <salil.mehta@huawei.com> - 2016-09-20 18:20 +0200
  [PATCH V2 for-next 14/19] IB/hns: Validate mtu when modified qp Salil Mehta <salil.mehta@huawei.com> - 2016-09-20 18:20 +0200
  Re: [PATCH V2 for-next 00/19] IB/hns: Fixes for various misc. bugs Leon Romanovsky <leon@kernel.org> - 2016-09-22 15:40 +0200

csiph-web