linux-rdma.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dennis Dalessandro <dennis.dalessandro-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
To: dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org
Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Ira Weiny <ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Subject: [PATCH 30/31] staging/rdma/hfi1: Remove create and free mad agents
Date: Tue, 19 Jan 2016 14:44:11 -0800	[thread overview]
Message-ID: <20160119224411.32765.60291.stgit@scvm10.sc.intel.com> (raw)
In-Reply-To: <20160119223610.32765.10571.stgit-9QXIwq+3FY+1XWohqUldA0EOCMrvLtNR@public.gmane.org>

Get rid of create and free mad agent from the driver and use rdmavt
version.

Reviewed-by: Ira Weiny <ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Signed-off-by: Dennis Dalessandro <dennis.dalessandro-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
---
 drivers/staging/rdma/hfi1/mad.c   |   76 +++----------------------------------
 drivers/staging/rdma/hfi1/verbs.c |   14 +------
 drivers/staging/rdma/hfi1/verbs.h |    4 --
 3 files changed, 8 insertions(+), 86 deletions(-)

diff --git a/drivers/staging/rdma/hfi1/mad.c b/drivers/staging/rdma/hfi1/mad.c
index 6daf277..9cadf77 100644
--- a/drivers/staging/rdma/hfi1/mad.c
+++ b/drivers/staging/rdma/hfi1/mad.c
@@ -129,7 +129,7 @@ static void send_trap(struct hfi1_ibport *ibp, void *data, unsigned len)
 	memcpy(smp->route.lid.data, data, len);
 
 	spin_lock_irqsave(&ibp->rvp.lock, flags);
-	if (!ibp->sm_ah) {
+	if (!ibp->rvp.sm_ah) {
 		if (ibp->rvp.sm_lid != be16_to_cpu(IB_LID_PERMISSIVE)) {
 			struct ib_ah *ah;
 
@@ -138,13 +138,13 @@ static void send_trap(struct hfi1_ibport *ibp, void *data, unsigned len)
 				ret = PTR_ERR(ah);
 			else {
 				send_buf->ah = ah;
-				ibp->sm_ah = ibah_to_rvtah(ah);
+				ibp->rvp.sm_ah = ibah_to_rvtah(ah);
 				ret = 0;
 			}
 		} else
 			ret = -EINVAL;
 	} else {
-		send_buf->ah = &ibp->sm_ah->ibah;
+		send_buf->ah = &ibp->rvp.sm_ah->ibah;
 		ret = 0;
 	}
 	spin_unlock_irqrestore(&ibp->rvp.lock, flags);
@@ -1138,11 +1138,11 @@ static int __subn_set_opa_portinfo(struct opa_smp *smp, u32 am, u8 *data,
 	} else if (smlid != ibp->rvp.sm_lid || msl != ibp->rvp.sm_sl) {
 		pr_warn("SubnSet(OPA_PortInfo) smlid 0x%x\n", smlid);
 		spin_lock_irqsave(&ibp->rvp.lock, flags);
-		if (ibp->sm_ah) {
+		if (ibp->rvp.sm_ah) {
 			if (smlid != ibp->rvp.sm_lid)
-				ibp->sm_ah->attr.dlid = smlid;
+				ibp->rvp.sm_ah->attr.dlid = smlid;
 			if (msl != ibp->rvp.sm_sl)
-				ibp->sm_ah->attr.sl = msl;
+				ibp->rvp.sm_ah->attr.sl = msl;
 		}
 		spin_unlock_irqrestore(&ibp->rvp.lock, flags);
 		if (smlid != ibp->rvp.sm_lid)
@@ -4157,67 +4157,3 @@ int hfi1_process_mad(struct ib_device *ibdev, int mad_flags, u8 port,
 
 	return IB_MAD_RESULT_FAILURE;
 }
-
-static void send_handler(struct ib_mad_agent *agent,
-			 struct ib_mad_send_wc *mad_send_wc)
-{
-	ib_free_send_mad(mad_send_wc->send_buf);
-}
-
-int hfi1_create_agents(struct hfi1_ibdev *dev)
-{
-	struct hfi1_devdata *dd = dd_from_dev(dev);
-	struct ib_mad_agent *agent;
-	struct hfi1_ibport *ibp;
-	int p;
-	int ret;
-
-	for (p = 0; p < dd->num_pports; p++) {
-		ibp = &dd->pport[p].ibport_data;
-		agent = ib_register_mad_agent(&dev->rdi.ibdev, p + 1,
-					      IB_QPT_SMI,
-					      NULL, 0, send_handler,
-					      NULL, NULL, 0);
-		if (IS_ERR(agent)) {
-			ret = PTR_ERR(agent);
-			goto err;
-		}
-
-		ibp->rvp.send_agent = agent;
-	}
-
-	return 0;
-
-err:
-	for (p = 0; p < dd->num_pports; p++) {
-		ibp = &dd->pport[p].ibport_data;
-		if (ibp->rvp.send_agent) {
-			agent = ibp->rvp.send_agent;
-			ibp->rvp.send_agent = NULL;
-			ib_unregister_mad_agent(agent);
-		}
-	}
-
-	return ret;
-}
-
-void hfi1_free_agents(struct hfi1_ibdev *dev)
-{
-	struct hfi1_devdata *dd = dd_from_dev(dev);
-	struct ib_mad_agent *agent;
-	struct hfi1_ibport *ibp;
-	int p;
-
-	for (p = 0; p < dd->num_pports; p++) {
-		ibp = &dd->pport[p].ibport_data;
-		if (ibp->rvp.send_agent) {
-			agent = ibp->rvp.send_agent;
-			ibp->rvp.send_agent = NULL;
-			ib_unregister_mad_agent(agent);
-		}
-		if (ibp->sm_ah) {
-			ib_destroy_ah(&ibp->sm_ah->ibah);
-			ibp->sm_ah = NULL;
-		}
-	}
-}
diff --git a/drivers/staging/rdma/hfi1/verbs.c b/drivers/staging/rdma/hfi1/verbs.c
index 6799915..68f4045 100644
--- a/drivers/staging/rdma/hfi1/verbs.c
+++ b/drivers/staging/rdma/hfi1/verbs.c
@@ -1590,27 +1590,19 @@ int hfi1_register_ib_device(struct hfi1_devdata *dd)
 
 	ret = rvt_register_device(&dd->verbs_dev.rdi);
 	if (ret)
-		goto err_reg;
-
-	ret = hfi1_create_agents(dev);
-	if (ret)
-		goto err_agents;
+		goto err_verbs_txreq;
 
 	ret = hfi1_verbs_register_sysfs(dd);
 	if (ret)
 		goto err_class;
 
-	goto bail;
+	return ret;
 
 err_class:
-	hfi1_free_agents(dev);
-err_agents:
 	rvt_unregister_device(&dd->verbs_dev.rdi);
-err_reg:
 err_verbs_txreq:
 	kmem_cache_destroy(dev->verbs_txreq_cache);
 	dd_dev_err(dd, "cannot register verbs: %d!\n", -ret);
-bail:
 	return ret;
 }
 
@@ -1620,8 +1612,6 @@ void hfi1_unregister_ib_device(struct hfi1_devdata *dd)
 
 	hfi1_verbs_unregister_sysfs(dd);
 
-	hfi1_free_agents(dev);
-
 	rvt_unregister_device(&dd->verbs_dev.rdi);
 
 	if (!list_empty(&dev->txwait))
diff --git a/drivers/staging/rdma/hfi1/verbs.h b/drivers/staging/rdma/hfi1/verbs.h
index f2c8a21..c845514 100644
--- a/drivers/staging/rdma/hfi1/verbs.h
+++ b/drivers/staging/rdma/hfi1/verbs.h
@@ -247,8 +247,6 @@ static inline void inc_opstats(
 struct hfi1_ibport {
 	struct rvt_qp __rcu *qp[2];
 	struct rvt_ibport rvp;
-	struct rvt_ah *sm_ah;
-	struct rvt_ah *smi_ah;
 
 	__be64 guids[HFI1_GUIDS_PER_PORT	- 1];	/* writable GUIDs */
 
@@ -340,8 +338,6 @@ int hfi1_process_mad(struct ib_device *ibdev, int mad_flags, u8 port,
 		     const struct ib_mad_hdr *in_mad, size_t in_mad_size,
 		     struct ib_mad_hdr *out_mad, size_t *out_mad_size,
 		     u16 *out_mad_pkey_index);
-int hfi1_create_agents(struct hfi1_ibdev *dev);
-void hfi1_free_agents(struct hfi1_ibdev *dev);
 
 /*
  * The PSN_MASK and PSN_SHIFT allow for

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2016-01-19 22:44 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-19 22:41 [PATCH 00/31] staging/rdma/hfi1: Add rdmavt support to hfi1 Dennis Dalessandro
     [not found] ` <20160119223610.32765.10571.stgit-9QXIwq+3FY+1XWohqUldA0EOCMrvLtNR@public.gmane.org>
2016-01-19 22:41   ` [PATCH 01/31] staging/rdma/hfi1: Begin to use rdmavt for verbs Dennis Dalessandro
2016-01-19 22:41   ` [PATCH 02/31] staging/rdma/hfi1: Add basic rdmavt capability flags for hfi1 Dennis Dalessandro
2016-01-19 22:41   ` [PATCH 03/31] staging/rdma/hfi1: Consolidate dma ops " Dennis Dalessandro
2016-01-19 22:41   ` [PATCH 04/31] staging/rdma/hfi1: Use rdmavt protection domain Dennis Dalessandro
2016-01-19 22:41   ` [PATCH 05/31] staging/rdma/hfi1: Remove MR data structures from hfi1 Dennis Dalessandro
2016-01-19 22:42   ` [PATCH 06/31] staging/rdma/hfi1: Remove driver specific members from hfi1 qp type Dennis Dalessandro
2016-01-19 22:42   ` [PATCH 07/31] staging/rdma/hfi1: Add device specific info prints Dennis Dalessandro
2016-01-19 22:42   ` [PATCH 08/31] staging/rdma/hfi1: Use correct rdmavt header files after move Dennis Dalessandro
2016-01-19 22:42   ` [PATCH 09/31] staging/rdma/hfi1: Use address handle in rdmavt and remove from hfi1 Dennis Dalessandro
2016-01-19 22:42   ` [PATCH 10/31] staging/rdma/hfi1: Implement hfi1 support for AH notification Dennis Dalessandro
2016-01-19 22:42   ` [PATCH 11/31] staging/rdma/hfi1: Remove hfi1 MR and hfi1 specific qp type Dennis Dalessandro
2016-01-19 22:42   ` [PATCH 12/31] staging/rdma/hfi1: Remove srq from hfi1 Dennis Dalessandro
2016-01-19 22:42   ` [PATCH 13/31] staging/rdma/hfi1: Remove ibport and use rdmavt version Dennis Dalessandro
2016-01-19 22:42   ` [PATCH 14/31] staging/rdma/hfi1: Remove mmap from hfi1 Dennis Dalessandro
2016-01-19 22:42   ` [PATCH 15/31] staging/rdma/hfi1: Use rdmavt pkey verbs function Dennis Dalessandro
2016-01-19 22:42   ` [PATCH 16/31] staging/rdma/hfi1: Remove user context allocation and de-alloction functions Dennis Dalessandro
2016-01-19 22:43   ` [PATCH 17/31] staging/rdma/hfi1: Use rdmavt send flags and recv flags Dennis Dalessandro
2016-01-19 22:43   ` [PATCH 18/31] staging/rdma/hfi1: Remove qpdev and qpn table from hfi1 Dennis Dalessandro
2016-01-19 22:43   ` [PATCH 19/31] staging/rdma/hfi1: Remove create_qp functionality Dennis Dalessandro
2016-01-19 22:43   ` [PATCH 20/31] staging/rdma/hfi1: Remove query_device function Dennis Dalessandro
2016-01-19 22:43   ` [PATCH 21/31] staging/rdma/hfi1: Remove CQ data structures and functions from hfi1 Dennis Dalessandro
2016-01-19 22:43   ` [PATCH 22/31] staging/rdma/hfi1: Clean up return handling Dennis Dalessandro
2016-01-19 22:43   ` [PATCH 23/31] staging/rdma/hfi1: Use rdmavt version of post_send Dennis Dalessandro
2016-01-19 22:43   ` [PATCH 24/31] staging/rdma/hfi1: Remove multicast verbs functions Dennis Dalessandro
2016-01-19 22:43   ` [PATCH 25/31] staging/rdma/hfi1: Remove modify queue pair from hfi1 Dennis Dalessandro
2016-01-19 22:43   ` [PATCH 26/31] staging/rdma/hfi1: Remove destroy qp verb Dennis Dalessandro
2016-01-19 22:43   ` [PATCH 27/31] staging/rdma/hfi1: Remove post_recv and use rdmavt version Dennis Dalessandro
2016-01-19 22:44   ` [PATCH 28/31] staging/rdma/hfi1: Clean up register device Dennis Dalessandro
2016-01-19 22:44   ` [PATCH 29/31] staging/rdma/hfi1: Use rdmavt device allocation function Dennis Dalessandro
2016-01-19 22:44   ` Dennis Dalessandro [this message]
2016-01-19 22:44   ` [PATCH 31/31] staging/rdma/hfi1: Remove hfi1_query_qp function Dennis Dalessandro

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=20160119224411.32765.60291.stgit@scvm10.sc.intel.com \
    --to=dennis.dalessandro-ral2jqcrhueavxtiumwx3w@public.gmane.org \
    --cc=dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    --cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    /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).