public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
From: Weihang Li <liweihang@hisilicon.com>
To: <dledford@redhat.com>, <jgg@ziepe.ca>
Cc: <linux-rdma@vger.kernel.org>, <linuxarm@huawei.com>
Subject: [PATCH v2 for-next 2/9] RDMA/hns: Remove unnecessary structure hns_roce_sqp
Date: Tue, 5 Nov 2019 19:07:55 +0800	[thread overview]
Message-ID: <1572952082-6681-3-git-send-email-liweihang@hisilicon.com> (raw)
In-Reply-To: <1572952082-6681-1-git-send-email-liweihang@hisilicon.com>

From: Lang Cheng <chenglang@huawei.com>

Special QP have no differences with normal qp in data structure, so
definition of struct hns_roce_sqp should be removed and replaced by
struct hns_roce_qp.

Signed-off-by: Lang Cheng <chenglang@huawei.com>
Signed-off-by: Weihang Li <liweihang@hisilicon.com>
---
 drivers/infiniband/hw/hns/hns_roce_device.h | 9 ---------
 drivers/infiniband/hw/hns/hns_roce_hw_v1.c  | 5 +----
 drivers/infiniband/hw/hns/hns_roce_hw_v2.c  | 5 +----
 drivers/infiniband/hw/hns/hns_roce_qp.c     | 8 +++-----
 4 files changed, 5 insertions(+), 22 deletions(-)

diff --git a/drivers/infiniband/hw/hns/hns_roce_device.h b/drivers/infiniband/hw/hns/hns_roce_device.h
index 3ed6b9e..3529e27 100644
--- a/drivers/infiniband/hw/hns/hns_roce_device.h
+++ b/drivers/infiniband/hw/hns/hns_roce_device.h
@@ -694,10 +694,6 @@ struct hns_roce_qp {
 	struct hns_roce_rinl_buf rq_inl_buf;
 };
 
-struct hns_roce_sqp {
-	struct hns_roce_qp	hr_qp;
-};
-
 struct hns_roce_ib_iboe {
 	spinlock_t		lock;
 	struct net_device      *netdevs[HNS_ROCE_MAX_PORTS];
@@ -1091,11 +1087,6 @@ static inline struct hns_roce_srq *to_hr_srq(struct ib_srq *ibsrq)
 	return container_of(ibsrq, struct hns_roce_srq, ibsrq);
 }
 
-static inline struct hns_roce_sqp *hr_to_hr_sqp(struct hns_roce_qp *hr_qp)
-{
-	return container_of(hr_qp, struct hns_roce_sqp, hr_qp);
-}
-
 static inline void hns_roce_write64_k(__le32 val[2], void __iomem *dest)
 {
 	__raw_writeq(*(u64 *) val, dest);
diff --git a/drivers/infiniband/hw/hns/hns_roce_hw_v1.c b/drivers/infiniband/hw/hns/hns_roce_hw_v1.c
index 5f74bf5..bfe9cee 100644
--- a/drivers/infiniband/hw/hns/hns_roce_hw_v1.c
+++ b/drivers/infiniband/hw/hns/hns_roce_hw_v1.c
@@ -3644,10 +3644,7 @@ int hns_roce_v1_destroy_qp(struct ib_qp *ibqp, struct ib_udata *udata)
 		hns_roce_buf_free(hr_dev, hr_qp->buff_size, &hr_qp->hr_buf);
 	}
 
-	if (hr_qp->ibqp.qp_type == IB_QPT_RC)
-		kfree(hr_qp);
-	else
-		kfree(hr_to_hr_sqp(hr_qp));
+	kfree(hr_qp);
 	return 0;
 }
 
diff --git a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c
index 14e24b4..9b6b046 100644
--- a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c
+++ b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c
@@ -4727,10 +4727,7 @@ static int hns_roce_v2_destroy_qp(struct ib_qp *ibqp, struct ib_udata *udata)
 		ibdev_err(&hr_dev->ib_dev, "Destroy qp 0x%06lx failed(%d)\n",
 			  hr_qp->qpn, ret);
 
-	if (hr_qp->ibqp.qp_type == IB_QPT_GSI)
-		kfree(hr_to_hr_sqp(hr_qp));
-	else
-		kfree(hr_qp);
+	kfree(hr_qp);
 
 	return 0;
 }
diff --git a/drivers/infiniband/hw/hns/hns_roce_qp.c b/drivers/infiniband/hw/hns/hns_roce_qp.c
index 071e9bc..ecfa875 100644
--- a/drivers/infiniband/hw/hns/hns_roce_qp.c
+++ b/drivers/infiniband/hw/hns/hns_roce_qp.c
@@ -1017,7 +1017,6 @@ struct ib_qp *hns_roce_create_qp(struct ib_pd *pd,
 {
 	struct hns_roce_dev *hr_dev = to_hr_dev(pd->device);
 	struct ib_device *ibdev = &hr_dev->ib_dev;
-	struct hns_roce_sqp *hr_sqp;
 	struct hns_roce_qp *hr_qp;
 	int ret;
 
@@ -1047,11 +1046,10 @@ struct ib_qp *hns_roce_create_qp(struct ib_pd *pd,
 			return ERR_PTR(-EINVAL);
 		}
 
-		hr_sqp = kzalloc(sizeof(*hr_sqp), GFP_KERNEL);
-		if (!hr_sqp)
+		hr_qp = kzalloc(sizeof(*hr_qp), GFP_KERNEL);
+		if (!hr_qp)
 			return ERR_PTR(-ENOMEM);
 
-		hr_qp = &hr_sqp->hr_qp;
 		hr_qp->port = init_attr->port_num - 1;
 		hr_qp->phy_port = hr_dev->iboe.phy_port[hr_qp->port];
 
@@ -1066,7 +1064,7 @@ struct ib_qp *hns_roce_create_qp(struct ib_pd *pd,
 						hr_qp->ibqp.qp_num, hr_qp);
 		if (ret) {
 			ibdev_err(ibdev, "Create GSI QP failed!\n");
-			kfree(hr_sqp);
+			kfree(hr_qp);
 			return ERR_PTR(ret);
 		}
 
-- 
2.8.1


  parent reply	other threads:[~2019-11-05 11:11 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-05 11:07 [PATCH v2 for-next 0/9] RDMA/hns: Cleanups for hip08 Weihang Li
2019-11-05 11:07 ` [PATCH v2 for-next 1/9] RDMA/hns: Delete unnecessary variable max_post Weihang Li
2019-11-05 11:07 ` Weihang Li [this message]
2019-11-05 11:07 ` [PATCH v2 for-next 3/9] RDMA/hns: Delete unnecessary uar from hns_roce_cq Weihang Li
2019-11-05 11:07 ` [PATCH v2 for-next 4/9] RDMA/hns: Modify fields of struct hns_roce_srq Weihang Li
2019-11-05 11:07 ` [PATCH v2 for-next 5/9] RDMA/hns: Replace not intuitive function/macro names Weihang Li
2019-11-05 11:07 ` [PATCH v2 for-next 6/9] RDMA/hns: Simplify doorbell initialization code Weihang Li
2019-11-05 11:08 ` [PATCH v2 for-next 7/9] RDMA/hns: Modify hns_roce_hw_v2_get_cfg to simplify the code Weihang Li
2019-11-05 11:08 ` [PATCH v2 for-next 8/9] RDMA/hns: Fix non-standard error codes Weihang Li
2019-11-05 17:00   ` Leon Romanovsky
2019-11-06 10:44     ` Weihang Li
2019-11-06 15:43       ` Leon Romanovsky
2019-11-08  8:11         ` Weihang Li
2019-11-05 11:08 ` [PATCH v2 for-next 9/9] RDMA/hns: Modify appropriate printings Weihang Li
2019-11-08 20:45 ` [PATCH v2 for-next 0/9] RDMA/hns: Cleanups for hip08 Jason Gunthorpe
2019-11-09  2:18   ` Weihang Li

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=1572952082-6681-3-git-send-email-liweihang@hisilicon.com \
    --to=liweihang@hisilicon.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox