summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorJakub Kicinski <kuba@kernel.org>2020-12-16 22:43:52 +0300
committerJakub Kicinski <kuba@kernel.org>2020-12-16 22:44:48 +0300
commit023cae857b347b6f5577eebade21a843f3621f85 (patch)
treedad6c05bbe3b456011d2088eeec8bf716f3f6ee0 /net
parent322e53d1e2529ae9d501f5e0f20604a79b873aef (diff)
parent935d8a0a43e3f928e3243ae22bc53cd7a014d515 (diff)
downloadlinux-023cae857b347b6f5577eebade21a843f3621f85.tar.xz
Merge branch 'locked-version-of-netdev_notify_peers'
Lijun Pan says: ==================== add a locked version of netdev_notify_peers This series introduce the lockless version of netdev_notify_peers and then apply it to the relevant drivers. In v1, a more appropriate name __netdev_notify_peers is used; netdev_notify_peers is converted to call the new helper. In v2, patch 3 calls the new helper where notify variable used to be set true. ==================== Link: https://lore.kernel.org/r/20201214211930.80778-1-ljp@linux.ibm.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'net')
-rw-r--r--net/core/dev.c22
1 files changed, 20 insertions, 2 deletions
diff --git a/net/core/dev.c b/net/core/dev.c
index a46334906c94..8fa739259041 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -1457,6 +1457,25 @@ void netdev_state_change(struct net_device *dev)
EXPORT_SYMBOL(netdev_state_change);
/**
+ * __netdev_notify_peers - notify network peers about existence of @dev,
+ * to be called when rtnl lock is already held.
+ * @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 __netdev_notify_peers(struct net_device *dev)
+{
+ ASSERT_RTNL();
+ call_netdevice_notifiers(NETDEV_NOTIFY_PEERS, dev);
+ call_netdevice_notifiers(NETDEV_RESEND_IGMP, dev);
+}
+EXPORT_SYMBOL(__netdev_notify_peers);
+
+/**
* netdev_notify_peers - notify network peers about existence of @dev
* @dev: network device
*
@@ -1469,8 +1488,7 @@ EXPORT_SYMBOL(netdev_state_change);
void netdev_notify_peers(struct net_device *dev)
{
rtnl_lock();
- call_netdevice_notifiers(NETDEV_NOTIFY_PEERS, dev);
- call_netdevice_notifiers(NETDEV_RESEND_IGMP, dev);
+ __netdev_notify_peers(dev);
rtnl_unlock();
}
EXPORT_SYMBOL(netdev_notify_peers);