All of lore.kernel.org
 help / color / mirror / Atom feed
From: Moni Shoua <monis@voltaire.com>
Cc: netdev@vger.kernel.org, Roland Dreier <rdreier@cisco.com>,
	Jay Vosburgh <fubar@us.ibm.com>,
	OpenFabrics General <general@lists.openfabrics.org>
Subject: [ofa-general] [PATCH V5 1/11] net/core: add a netdev notification for slave detach
Date: Thu, 20 Sep 2007 16:39:25 +0300	[thread overview]
Message-ID: <46F2780D.5090702@voltaire.com> (raw)
In-Reply-To: <46F27692.3070404@voltaire.com>

A slave of a bonding master that wants to send a notification before
going down should call netdev_slave_detach(). The handling of this notification
will be done outside the context of unregister_netdevice() which is sometimes
necessary, as with IPoIB slave for example.

Signed-off-by: Moni Shoua <monis at voltaire.com>
---
 include/linux/if.h |    1 +
 net/core/dev.c     |   20 ++++++++++++++++++++
 2 files changed, 21 insertions(+)

Index: net-2.6/net/core/dev.c
===================================================================
--- net-2.6.orig/net/core/dev.c	2007-09-20 08:04:47.164051688 +0200
+++ net-2.6/net/core/dev.c	2007-09-20 09:20:21.493060579 +0200
@@ -2588,6 +2588,25 @@ int netdev_set_master(struct net_device 
 	return 0;
 }
 
+/**
+ *	netdev_slave_detach	-	notify that slave is about to detach from master
+ *	@slave: slave device
+ *
+ *	Raise a flag that slave is about to detach from master
+ *	and notify the netdev  chain.
+ *	The caller must hold the rtnl_mutex.
+ */
+
+int netdev_slave_detach(struct net_device *slave)
+{
+	int ret = 0;
+	if (slave->flags & IFF_SLAVE) {
+		slave->priv_flags |= IFF_SLAVE_DETACH;
+		ret = call_netdevice_notifiers(NETDEV_CHANGE, slave);
+	}
+	return ret;
+}
+
 static void __dev_set_promiscuity(struct net_device *dev, int inc)
 {
 	unsigned short old_flags = dev->flags;
@@ -4120,6 +4139,7 @@ EXPORT_SYMBOL(dev_set_mac_address);
 EXPORT_SYMBOL(free_netdev);
 EXPORT_SYMBOL(netdev_boot_setup_check);
 EXPORT_SYMBOL(netdev_set_master);
+EXPORT_SYMBOL(netdev_slave_detach);
 EXPORT_SYMBOL(netdev_state_change);
 EXPORT_SYMBOL(netif_receive_skb);
 EXPORT_SYMBOL(netif_rx);
Index: net-2.6/include/linux/if.h
===================================================================
--- net-2.6.orig/include/linux/if.h	2007-09-20 08:04:47.164051688 +0200
+++ net-2.6/include/linux/if.h	2007-09-20 08:15:29.577729301 +0200
@@ -61,6 +61,7 @@
 #define IFF_MASTER_ALB	0x10		/* bonding master, balance-alb.	*/
 #define IFF_BONDING	0x20		/* bonding master or slave	*/
 #define IFF_SLAVE_NEEDARP 0x40		/* need ARPs for validation	*/
+#define IFF_SLAVE_DETACH 0x80		/* slave is about to unregister */
 
 #define IF_GET_IFACE	0x0001		/* for querying only */
 #define IF_GET_PROTO	0x0002

  reply	other threads:[~2007-09-20 13:39 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-09-20 13:33 [PATCH V5 0/11] net/bonding: ADD IPoIB support for the bonding driver Moni Shoua
2007-09-20 13:39 ` Moni Shoua [this message]
2007-09-20 13:40 ` [PATCH V5 2/11] IB/ipoib: Notify the world before doing unregister Moni Shoua
2007-09-20 16:20   ` [ofa-general] " Roland Dreier
2007-09-23  7:55     ` Moni Shoua
2007-09-23 16:34       ` Roland Dreier
2007-09-24 13:56         ` Moni Shoua
2007-09-20 13:41 ` [ofa-general] [PATCH V5 3/11] IB/ipoib: Bound the net device to the ipoib_neigh structue Moni Shoua
2007-09-20 13:42 ` [PATCH V5 4/11] IB/ipoib: Verify address handle validity on send Moni Shoua
2007-09-20 13:43 ` [ofa-general] [PATCH V5 5/11] net/bonding: Enable bonding to enslave non ARPHRD_ETHER Moni Shoua
2007-09-20 13:45 ` [PATCH V5 6/11] net/bonding: Enable bonding to enslave netdevices not supporting set_mac_address() Moni Shoua
2007-09-20 13:58 ` [ofa-general] [PATCH V5 7/11] net/bonding: Enable IP multicast for bonding IPoIB devices Moni Shoua
2007-09-20 14:00 ` [ofa-general] [PATCH V5 8/11] net/bonding: Handlle wrong assumptions that slave is always an Ethernet device Moni Shoua
2007-09-20 14:02 ` [ofa-general] PATCH V5 9/11] net/bonding: Delay sending of gratuitous ARP to avoid failure Moni Shoua
2007-09-20 14:04 ` [PATCH V5 10/11] net/bonding: Destroy bonding master when last slave is gone Moni Shoua
2007-09-20 14:06 ` [PATCH V5 5/11] net/bonding: Enable bonding to enslave non ARPHRD_ETHER Moni Shoua
2007-09-20 14:07 ` [PATCH 11/11] bonding: Optionally allow ethernet slaves to keep own MAC 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=46F2780D.5090702@voltaire.com \
    --to=monis@voltaire.com \
    --cc=fubar@us.ibm.com \
    --cc=general@lists.openfabrics.org \
    --cc=netdev@vger.kernel.org \
    --cc=rdreier@cisco.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.