net: move and rename netif_notify_peers()

I believe net/core/dev.c is a better place for netif_notify_peers(),
because other net event notify functions also stay in this file.

And rename it to netdev_notify_peers().

Cc: David S. Miller <davem@davemloft.net>
Cc: Ian Campbell <Ian.Campbell@citrix.com>
Signed-off-by: Cong Wang <amwang@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Amerigo Wang
2012-08-09 22:14:56 +00:00
committed by David S. Miller
parent 0f48917b93
commit ee89bab14e
6 changed files with 22 additions and 23 deletions

View File

@@ -400,7 +400,7 @@ static void netvsc_send_garp(struct work_struct *w)
ndev_ctx = container_of(w, struct net_device_context, dwork.work); ndev_ctx = container_of(w, struct net_device_context, dwork.work);
net_device = hv_get_drvdata(ndev_ctx->device_ctx); net_device = hv_get_drvdata(ndev_ctx->device_ctx);
net = net_device->ndev; net = net_device->ndev;
netif_notify_peers(net); netdev_notify_peers(net);
} }

View File

@@ -993,7 +993,7 @@ static void virtnet_config_changed_work(struct work_struct *work)
goto done; goto done;
if (v & VIRTIO_NET_S_ANNOUNCE) { if (v & VIRTIO_NET_S_ANNOUNCE) {
netif_notify_peers(vi->dev); netdev_notify_peers(vi->dev);
virtnet_ack_link_announce(vi); virtnet_ack_link_announce(vi);
} }

View File

@@ -1731,7 +1731,7 @@ static void netback_changed(struct xenbus_device *dev,
break; break;
case XenbusStateConnected: case XenbusStateConnected:
netif_notify_peers(netdev); netdev_notify_peers(netdev);
break; break;
case XenbusStateClosing: case XenbusStateClosing:

View File

@@ -2246,8 +2246,6 @@ extern void netif_carrier_on(struct net_device *dev);
extern void netif_carrier_off(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. * netif_dormant_on - mark device as dormant.
* @dev: network device * @dev: network device
@@ -2596,6 +2594,7 @@ extern void __dev_set_rx_mode(struct net_device *dev);
extern int dev_set_promiscuity(struct net_device *dev, int inc); extern int dev_set_promiscuity(struct net_device *dev, int inc);
extern int dev_set_allmulti(struct net_device *dev, int inc); extern int dev_set_allmulti(struct net_device *dev, int inc);
extern void netdev_state_change(struct net_device *dev); extern void netdev_state_change(struct net_device *dev);
extern void netdev_notify_peers(struct net_device *dev);
extern int netdev_bonding_change(struct net_device *dev, extern int netdev_bonding_change(struct net_device *dev,
unsigned long event); unsigned long event);
extern void netdev_features_change(struct net_device *dev); extern void netdev_features_change(struct net_device *dev);

View File

@@ -1106,6 +1106,24 @@ void netdev_state_change(struct net_device *dev)
} }
EXPORT_SYMBOL(netdev_state_change); EXPORT_SYMBOL(netdev_state_change);
/**
* netdev_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 netdev_notify_peers(struct net_device *dev)
{
rtnl_lock();
call_netdevice_notifiers(NETDEV_NOTIFY_PEERS, dev);
rtnl_unlock();
}
EXPORT_SYMBOL(netdev_notify_peers);
int netdev_bonding_change(struct net_device *dev, unsigned long event) int netdev_bonding_change(struct net_device *dev, unsigned long event)
{ {
return call_netdevice_notifiers(event, dev); return call_netdevice_notifiers(event, dev);

View File

@@ -324,24 +324,6 @@ void netif_carrier_off(struct net_device *dev)
} }
EXPORT_SYMBOL(netif_carrier_off); 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 /* "NOOP" scheduler: the best scheduler, recommended for all interfaces
under all circumstances. It is difficult to invent anything faster or under all circumstances. It is difficult to invent anything faster or
cheaper. cheaper.