summaryrefslogtreecommitdiffstats
path: root/drivers/staging/rdma/hfi1/mad.c
diff options
context:
space:
mode:
authorDennis Dalessandro2016-01-19 23:44:11 +0100
committerDoug Ledford2016-03-11 02:37:44 +0100
commit9c4a311e6ca03db4e16c4c06bb37a1189ba0bc03 (patch)
tree9b841bcb3335104d0dc715faf090e85492deb716 /drivers/staging/rdma/hfi1/mad.c
parentstaging/rdma/hfi1: Use rdmavt device allocation function (diff)
downloadkernel-qcow2-linux-9c4a311e6ca03db4e16c4c06bb37a1189ba0bc03.tar.gz
kernel-qcow2-linux-9c4a311e6ca03db4e16c4c06bb37a1189ba0bc03.tar.xz
kernel-qcow2-linux-9c4a311e6ca03db4e16c4c06bb37a1189ba0bc03.zip
staging/rdma/hfi1: Remove create and free mad agents
Get rid of create and free mad agent from the driver and use rdmavt version. Reviewed-by: Ira Weiny <ira.weiny@intel.com> Signed-off-by: Dennis Dalessandro <dennis.dalessandro@intel.com> Signed-off-by: Doug Ledford <dledford@redhat.com>
Diffstat (limited to 'drivers/staging/rdma/hfi1/mad.c')
-rw-r--r--drivers/staging/rdma/hfi1/mad.c76
1 files changed, 6 insertions, 70 deletions
diff --git a/drivers/staging/rdma/hfi1/mad.c b/drivers/staging/rdma/hfi1/mad.c
index 6daf2770cc56..9cadf77427a2 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;
- }
- }
-}