Skip to content

Commit

Permalink
net: move and rename netif_notify_peers()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Amerigo Wang authored and David S. Miller committed Aug 14, 2012
1 parent 0f48917 commit ee89bab
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 23 deletions.
2 changes: 1 addition & 1 deletion drivers/net/hyperv/netvsc_drv.c
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ static void netvsc_send_garp(struct work_struct *w)
ndev_ctx = container_of(w, struct net_device_context, dwork.work);
net_device = hv_get_drvdata(ndev_ctx->device_ctx);
net = net_device->ndev;
netif_notify_peers(net);
netdev_notify_peers(net);
}


Expand Down
2 changes: 1 addition & 1 deletion drivers/net/virtio_net.c
Original file line number Diff line number Diff line change
Expand Up @@ -993,7 +993,7 @@ static void virtnet_config_changed_work(struct work_struct *work)
goto done;

if (v & VIRTIO_NET_S_ANNOUNCE) {
netif_notify_peers(vi->dev);
netdev_notify_peers(vi->dev);
virtnet_ack_link_announce(vi);
}

Expand Down
2 changes: 1 addition & 1 deletion drivers/net/xen-netfront.c
Original file line number Diff line number Diff line change
Expand Up @@ -1731,7 +1731,7 @@ static void netback_changed(struct xenbus_device *dev,
break;

case XenbusStateConnected:
netif_notify_peers(netdev);
netdev_notify_peers(netdev);
break;

case XenbusStateClosing:
Expand Down
3 changes: 1 addition & 2 deletions include/linux/netdevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -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_notify_peers(struct net_device *dev);

/**
* netif_dormant_on - mark device as dormant.
* @dev: network device
Expand Down Expand Up @@ -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_allmulti(struct net_device *dev, int inc);
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,
unsigned long event);
extern void netdev_features_change(struct net_device *dev);
Expand Down
18 changes: 18 additions & 0 deletions net/core/dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -1106,6 +1106,24 @@ void netdev_state_change(struct net_device *dev)
}
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)
{
return call_netdevice_notifiers(event, dev);
Expand Down
18 changes: 0 additions & 18 deletions net/sched/sch_generic.c
Original file line number Diff line number Diff line change
Expand Up @@ -324,24 +324,6 @@ 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.
Expand Down

0 comments on commit ee89bab

Please sign in to comment.