diff options
author | Erez Shitrit <erezsh@mellanox.com> | 2017-04-10 11:22:26 +0300 |
---|---|---|
committer | Doug Ledford <dledford@redhat.com> | 2017-04-20 15:19:42 -0400 |
commit | 515ed4f3aab4e8a0855d0cdfd9753a419ccfb297 (patch) | |
tree | b67d0439302dcd909f46144b3f54131c8e8dd883 /drivers/infiniband/ulp/ipoib/ipoib_ib.c | |
parent | f0ad83ac58468e3807e72e929317519b69bcde1c (diff) | |
download | linux-515ed4f3aab4e8a0855d0cdfd9753a419ccfb297.tar.bz2 |
IB/IPoIB: Separate control and data related initializations
This patch prepares init and teardown flows so we can call them
through ipoib_options function pointers.
It arranges that area of code as the following:
* All operations which deal with the resource allocation/deletion
are performed in one place.
* All operations that are control oriented, meaning that they are not
connected to a specific hardware, are performed in a separate place.
The operations for allocation of hardware resources are now in the
function ipoib_dev_init_default, and the deletion of all the resources
are in ipoib_dev_uninit_default
The only exception is the creation of the PD object,
which is used both for resource allocation (create QP etc.)
and for control flows like creating AH.
It also does:
* Move creation of rx_ring and tx_ring to be in the resources
allocation area.
* Move the function ipoib_ib_dev_open that does the open device
to the control area instead of the dev_init which creates resources.
Signed-off-by: Erez Shitrit <erezsh@mellanox.com>
Reviewed-by: Alex Vesker <valex@mellanox.com>
Signed-off-by: Leon Romanovsky <leon@kernel.org>
Signed-off-by: Doug Ledford <dledford@redhat.com>
Diffstat (limited to 'drivers/infiniband/ulp/ipoib/ipoib_ib.c')
-rw-r--r-- | drivers/infiniband/ulp/ipoib/ipoib_ib.c | 38 |
1 files changed, 9 insertions, 29 deletions
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_ib.c b/drivers/infiniband/ulp/ipoib/ipoib_ib.c index 12c4f84a6639..f9dd2bb676aa 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_ib.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_ib.c @@ -692,7 +692,7 @@ static void ipoib_stop_ah(struct net_device *dev) ipoib_flush_ah(dev); } -static void ipoib_ib_tx_timer_func(unsigned long ctx) +void ipoib_ib_tx_timer_func(unsigned long ctx) { drain_tx_cq((struct net_device *)ctx); } @@ -913,32 +913,6 @@ timeout: ib_req_notify_cq(priv->recv_cq, IB_CQ_NEXT_COMP); } -int ipoib_ib_dev_init(struct net_device *dev, struct ib_device *ca, int port) -{ - struct ipoib_dev_priv *priv = netdev_priv(dev); - - priv->ca = ca; - priv->port = port; - priv->qp = NULL; - - if (ipoib_transport_dev_init(dev, ca)) { - printk(KERN_WARNING "%s: ipoib_transport_dev_init failed\n", ca->name); - return -ENODEV; - } - - setup_timer(&priv->poll_timer, ipoib_ib_tx_timer_func, - (unsigned long) dev); - - if (dev->flags & IFF_UP) { - if (ipoib_ib_dev_open(dev)) { - ipoib_transport_dev_cleanup(dev); - return -ENODEV; - } - } - - return 0; -} - /* * Takes whatever value which is in pkey index 0 and updates priv->pkey * returns 0 if the pkey value was changed. @@ -1236,7 +1210,13 @@ void ipoib_ib_dev_cleanup(struct net_device *dev) */ ipoib_stop_ah(dev); - ipoib_transport_dev_cleanup(dev); -} + clear_bit(IPOIB_PKEY_ASSIGNED, &priv->flags); + + ipoib_dev_uninit_default(dev); + if (priv->pd) { + ib_dealloc_pd(priv->pd); + priv->pd = NULL; + } +} |