From 2c6865d3aedcd5d9636a1dfd9d91769ddade96f3 Mon Sep 17 00:00:00 2001 From: Lang Cheng Date: Wed, 11 Sep 2019 20:36:28 +0800 Subject: [PATCH] RDMA/hns: Remove unnecessary structures hns_roce_sqp driver inclusion category: bugfix bugzilla: NA CVE: NA Special QP has not any special. This patch remove related definitions and just use hns_roce_qp. Feature or Bugfix:Bugfix Signed-off-by: Lang Cheng Reviewed-by: zhangjiaran Reviewed-by: oulijun Reviewed-by: liuyixian Reviewed-by: Yang Yingliang Signed-off-by: Yang Yingliang --- drivers/infiniband/hw/hns/hns_roce_device.h | 9 --------- drivers/infiniband/hw/hns/hns_roce_hw_v1.c | 11 +++-------- drivers/infiniband/hw/hns/hns_roce_hw_v2.c | 6 +----- drivers/infiniband/hw/hns/hns_roce_qp.c | 8 +++----- 4 files changed, 7 insertions(+), 27 deletions(-) diff --git a/drivers/infiniband/hw/hns/hns_roce_device.h b/drivers/infiniband/hw/hns/hns_roce_device.h index a13f3c052b80..ef90f49d6e05 100644 --- a/drivers/infiniband/hw/hns/hns_roce_device.h +++ b/drivers/infiniband/hw/hns/hns_roce_device.h @@ -803,10 +803,6 @@ struct hns_roce_qp { u32 dfx_cnt[HNS_ROCE_QP_DFX_TOTAL]; }; -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]; @@ -1293,11 +1289,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 bf108adea9ac..6c0086beebaf 100644 --- a/drivers/infiniband/hw/hns/hns_roce_hw_v1.c +++ b/drivers/infiniband/hw/hns/hns_roce_hw_v1.c @@ -3938,13 +3938,11 @@ static void hns_roce_v1_destroy_qp_work_fn(struct work_struct *work) hns_roce_qp_remove(hr_dev, hr_qp); hns_roce_qp_free(hr_dev, hr_qp); - if (hr_qp->ibqp.qp_type == IB_QPT_RC) { - /* RC QP, release QPN */ + /* RC QP, release QPN */ + if (hr_qp->ibqp.qp_type == IB_QPT_RC) hns_roce_release_range_qp(hr_dev, qpn, 1); - kfree(hr_qp); - } else - kfree(hr_to_hr_sqp(hr_qp)); + kfree(hr_qp); kfree(qp_work_entry); dev_dbg(dev, "Accomplished destroy QP(0x%lx) work.\n", qpn); @@ -4002,10 +4000,7 @@ int hns_roce_v1_destroy_qp(struct ib_qp *ibqp) } if (!is_timeout) { - if (hr_qp->ibqp.qp_type == IB_QPT_RC) kfree(hr_qp); - else - kfree(hr_to_hr_sqp(hr_qp)); } else { qp_work = kzalloc(sizeof(*qp_work), GFP_KERNEL); if (!qp_work) diff --git a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c index e5928844e7df..b5f9a6d63986 100644 --- a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c +++ b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c @@ -5551,11 +5551,7 @@ static int hns_roce_v2_destroy_qp(struct ib_qp *ibqp) dev_err(hr_dev->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 c081002fe74d..ee2b0f3112c1 100644 --- a/drivers/infiniband/hw/hns/hns_roce_qp.c +++ b/drivers/infiniband/hw/hns/hns_roce_qp.c @@ -1146,7 +1146,6 @@ struct ib_qp *hns_roce_create_qp(struct ib_pd *pd, struct hns_roce_dev *hr_dev = pd ? to_hr_dev(pd->device) : to_hr_dev(init_attr->xrcd->device); struct device *dev = hr_dev->dev; - struct hns_roce_sqp *hr_sqp; struct hns_roce_qp *hr_qp; u16 xrcdn = 0; int ret; @@ -1189,11 +1188,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]; @@ -1208,7 +1206,7 @@ struct ib_qp *hns_roce_create_qp(struct ib_pd *pd, hr_qp->ibqp.qp_num, hr_qp); if (ret) { dev_err(dev, "Create GSI QP failed(%d)!\n", ret); - kfree(hr_sqp); + kfree(hr_qp); return ERR_PTR(ret); } -- GitLab