]> git.ipfire.org Git - people/arne_f/kernel.git/commitdiff
arp_notify: allow drivers to explicitly request a notification event.
authorIan Campbell <Ian.Campbell@citrix.com>
Wed, 26 May 2010 00:09:42 +0000 (00:09 +0000)
committerGreg Kroah-Hartman <gregkh@suse.de>
Fri, 13 Aug 2010 20:19:49 +0000 (13:19 -0700)
commit 06c4648d46d1b757d6b9591a86810be79818b60c upstream.

Currently such notifications are only generated when the device comes up or the
address changes. However one use case for these notifications is to enable
faster network recovery after a virtual machine migration (by causing switches
to relearn their MAC tables). A migration appears to the network stack as a
temporary loss of carrier and therefore does not trigger either of the current
conditions. Rather than adding carrier up as a trigger (which can cause issues
when interfaces a flapping) simply add an interface which the driver can use
to explicitly trigger the notification.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Cc: Stephen Hemminger <shemminger@linux-foundation.org>
Cc: Jeremy Fitzhardinge <jeremy@goop.org>
Cc: David S. Miller <davem@davemloft.net>
Cc: netdev@vger.kernel.org
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
include/linux/netdevice.h
include/linux/notifier.h
net/ipv4/devinet.c
net/sched/sch_generic.c

index 812a5f3c2abe90da914e7c998b7b7d8e509b0e38..ec12f8c247705225e3143397d37d4f0917ad8269 100644 (file)
@@ -1560,6 +1560,8 @@ extern void netif_carrier_on(struct net_device *dev);
 
 extern void netif_carrier_off(struct net_device *dev);
 
+extern void netif_notify_peers(struct net_device *dev);
+
 /**
  *     netif_dormant_on - mark device as dormant.
  *     @dev: network device
index 44428d247dbe6e3b52e9b71798eff99735ae4319..b1302a6bdd2207c16e67566f57569e1c0f53b02d 100644 (file)
@@ -201,6 +201,7 @@ static inline int notifier_to_errno(int ret)
 #define NETDEV_PRE_UP          0x000D
 #define NETDEV_BONDING_OLDTYPE  0x000E
 #define NETDEV_BONDING_NEWTYPE  0x000F
+#define NETDEV_NOTIFY_PEERS    0x0012
 
 #define SYS_DOWN       0x0001  /* Notify of system down */
 #define SYS_RESTART    SYS_DOWN
index cc35645d910ad24b78d4419e948a6ce56cf0613b..f84f6dd0a3255a8d83148fd35cd46e689324bca2 100644 (file)
@@ -1076,6 +1076,7 @@ static int inetdev_event(struct notifier_block *this, unsigned long event,
                }
                ip_mc_up(in_dev);
                /* fall through */
+       case NETDEV_NOTIFY_PEERS:
        case NETDEV_CHANGEADDR:
                /* Send gratuitous ARP to notify of link change */
                if (IN_DEV_ARP_NOTIFY(in_dev)) {
index 4ae6aa562f2bbfd6b90e7d40a43eba1ced694ad3..30280017b05505fe3630b4451cca547309c49fae 100644 (file)
@@ -330,6 +330,24 @@ void netif_carrier_off(struct net_device *dev)
 }
 EXPORT_SYMBOL(netif_carrier_off);
 
+/**
+ *     netif_notify_peers - notify network peers about existence of @dev
+ *     @dev: network device
+ *
+ * Generate traffic such that interested network peers are aware of
+ * @dev, such as by generating a gratuitous ARP. This may be used when
+ * a device wants to inform the rest of the network about some sort of
+ * reconfiguration such as a failover event or virtual machine
+ * migration.
+ */
+void netif_notify_peers(struct net_device *dev)
+{
+       rtnl_lock();
+       call_netdevice_notifiers(NETDEV_NOTIFY_PEERS, dev);
+       rtnl_unlock();
+}
+EXPORT_SYMBOL(netif_notify_peers);
+
 /* "NOOP" scheduler: the best scheduler, recommended for all interfaces
    under all circumstances. It is difficult to invent anything faster or
    cheaper.