/* * Send GARP packet to network peers after migrations. * After Quick Migration, the network is not immediately operational in the * current context when receiving RNDIS_STATUS_MEDIA_CONNECT event. So, add * another netif_notify_peers() into a delayed work, otherwise GARP packet * will not be sent after quick migration, and cause network disconnection. * Also, we update the carrier status here. */ static void netvsc_link_change(struct work_struct *w) { struct net_device_context *ndev_ctx; struct net_device *net; struct netvsc_device *net_device; struct rndis_device *rdev; bool notify; rtnl_lock(); ndev_ctx = container_of(w, struct net_device_context, dwork.work); net_device = hv_get_drvdata(ndev_ctx->device_ctx); rdev = net_device->extension; net = net_device->ndev; if (rdev->link_state) { netif_carrier_off(net); notify = false; } else { netif_carrier_on(net); notify = true; } rtnl_unlock(); if (notify) netdev_notify_peers(net); }
/* * Send GARP packet to network peers after migrations. * After Quick Migration, the network is not immediately operational in the * current context when receiving RNDIS_STATUS_MEDIA_CONNECT event. So, add * another netif_notify_peers() into a delayed work, otherwise GARP packet * will not be sent after quick migration, and cause network disconnection. * Also, we update the carrier status here. */ static void netvsc_link_change(struct work_struct *w) { struct net_device_context *ndev_ctx; struct net_device *net; struct netvsc_device *net_device; struct rndis_device *rdev; bool notify, refresh = false; char *argv[] = { "/etc/init.d/network", "restart", NULL }; char *envp[] = { "HOME=/", "PATH=/sbin:/usr/sbin:/bin:/usr/bin", NULL }; rtnl_lock(); ndev_ctx = container_of(w, struct net_device_context, dwork.work); net_device = hv_get_drvdata(ndev_ctx->device_ctx); rdev = net_device->extension; net = net_device->ndev; if (rdev->link_state) { netif_carrier_off(net); notify = false; } else { netif_carrier_on(net); notify = true; if (rdev->link_change) { rdev->link_change = false; refresh = true; } } rtnl_unlock(); if (refresh) call_usermodehelper(argv[0], argv, envp, UMH_WAIT_EXEC); if (notify) netdev_notify_peers(net); }