public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: Moni Shoua <monis@voltaire•com>
To: rdreier@cisco•com,  davem@davemloft•net,  fubar@us•ibm.com
Cc: netdev@vger•kernel.org, general@lists•openfabrics.org
Subject: [ofa-general] [PATCH V4 2/10] IB/ipoib: Notify the world before doing unregister
Date: Mon, 20 Aug 2007 18:43:43 +0300	[thread overview]
Message-ID: <46C9B6AF.5030402@voltaire.com> (raw)
In-Reply-To: <46C9B474.5020202@voltaire.com>

When the bonding device enslaves IPoIB devices it takes pointers to
functions in the ib_ipoib module. This is fine as long as the ib_ipoib
nodule remains loaded while the references to its functions exist.
So, to help bonding do a cleanup on time, when the IPoIB net device is a 
slave of a bonding master, let the master know that the IPoIB device is
about to unregister (but before calling unregister).

Signed-off-by: Moni Shoua <monis@voltaire•com>
---
 drivers/infiniband/ulp/ipoib/ipoib_main.c |   15 +++++++++++++++
 1 files changed, 15 insertions(+)

Index: net-2.6/drivers/infiniband/ulp/ipoib/ipoib_main.c
===================================================================
--- net-2.6.orig/drivers/infiniband/ulp/ipoib/ipoib_main.c	2007-08-20 14:29:29.522209580 +0300
+++ net-2.6/drivers/infiniband/ulp/ipoib/ipoib_main.c	2007-08-20 14:43:03.432162133 +0300
@@ -48,6 +48,7 @@
 #include <linux/in.h>
 
 #include <net/dst.h>
+#include <linux/netdevice.h>
 
 MODULE_AUTHOR("Roland Dreier");
 MODULE_DESCRIPTION("IP-over-InfiniBand net driver");
@@ -772,6 +773,18 @@ static void ipoib_timeout(struct net_dev
 	/* XXX reset QP, etc. */
 }
 
+static int ipoib_slave_detach(struct net_device *dev)
+{
+	int ret = 0;
+	if (dev->flags & IFF_SLAVE) {
+		dev->priv_flags |= IFF_SLAVE_DETACH;
+		rtnl_lock();
+		ret = call_netdevice_notifiers(NETDEV_CHANGE, dev);
+		rtnl_unlock();
+	}
+	return ret;
+}
+
 static int ipoib_hard_header(struct sk_buff *skb,
 			     struct net_device *dev,
 			     unsigned short type,
@@ -921,6 +934,7 @@ void ipoib_dev_cleanup(struct net_device
 
 	/* Delete any child interfaces first */
 	list_for_each_entry_safe(cpriv, tcpriv, &priv->child_intfs, list) {
+		ipoib_slave_detach(cpriv->dev);
 		unregister_netdev(cpriv->dev);
 		ipoib_dev_cleanup(cpriv->dev);
 		free_netdev(cpriv->dev);
@@ -1208,6 +1222,7 @@ static void ipoib_remove_one(struct ib_d
 		ib_unregister_event_handler(&priv->event_handler);
 		flush_scheduled_work();
 
+		ipoib_slave_detach(priv->dev);
 		unregister_netdev(priv->dev);
 		ipoib_dev_cleanup(priv->dev);
 		free_netdev(priv->dev);

  parent reply	other threads:[~2007-08-20 15:43 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-20 15:34 [PATCH V4 0/10] net/bonding: ADD IPoIB support for the bonding driver Moni Shoua
2007-08-20 15:42 ` [ofa-general] [PATCH V4 1/10] IB/ipoib: Export call to call_netdevice_notifiers and add new private flag Moni Shoua
2007-08-20 15:43 ` Moni Shoua [this message]
2007-08-20 15:44 ` [ofa-general] [PATCH V4 3/10] IB/ipoib: Bound the net device to the ipoib_neigh structue Moni Shoua
2007-08-20 15:46 ` [PATCH V4 4/10] IB/ipoib: Verify address handle validity on send Moni Shoua
2007-08-20 15:48 ` [PATCH V4 5/10] net/bonding: Enable bonding to enslave non ARPHRD_ETHER Moni Shoua
2007-08-20 15:49 ` [PATCH V4 6/10] net/bonding: Enable bonding to enslave netdevices not supporting set_mac_address() Moni Shoua
2007-08-20 15:51 ` [PATCH V4 7/10] net/bonding: Enable IP multicast for bonding IPoIB devices Moni Shoua
2007-08-20 15:52 ` [PATCH V4 8/10] net/bonding: Handlle wrong assumptions that slave is always an Ethernet device Moni Shoua
     [not found]   ` <416.1188343604@death>
2007-08-29 13:37     ` [ofa-general] " Moni Shoua
2007-08-20 15:53 ` [ofa-general] PATCH V4 9/10] net/bonding: Delay sending of gratuitous ARP to avoid failure Moni Shoua
2007-08-20 15:58 ` [PATCH V4 10/10] net/bonding: Destroy bonding master when last slave is gone Moni Shoua
     [not found]   ` <3403.1188343986@death>
2007-08-29 14:06     ` [ofa-general] " Moni Shoua
2007-08-29 19:50       ` Jay Vosburgh
2007-09-02 11:32         ` Moni Shoua
2007-09-01 20:19 ` [ofa-general] [PATCH V4 0/10] net/bonding: ADD IPoIB support for the bonding driver Or Gerlitz
2007-09-10 14:31 ` Moni Shoua

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=46C9B6AF.5030402@voltaire.com \
    --to=monis@voltaire$(echo .)com \
    --cc=davem@davemloft$(echo .)net \
    --cc=fubar@us$(echo .)ibm.com \
    --cc=general@lists$(echo .)openfabrics.org \
    --cc=netdev@vger$(echo .)kernel.org \
    --cc=rdreier@cisco$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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