staging: hv: Fix GARP not sent after Quick Migration
Subsystems (2)
PATCH 1/1 staging: hv: Fix GARP not sent after Quick Migration
After Quick Migration, the network is not immediately operational in the current context when receiving RNDIS_STATUS_MEDIA_CONNECT event. So, I put the netif_notify_peers() into a scheduled work, otherwise GARP packet will not be sent after quick migration, and cause network disconnection.
Thanks to Mike Surcouf <[email protected]> for reporting the bug and testing the patch.
This patch should also be backported to stable kernel 2.6.32 and later.
--- drivers/staging/hv/netvsc_drv.c | 17 ++++++++++++++++- 1 files changed, 16 insertions(+), 1 deletions(-)
drivers/staging/hv/netvsc_drv.c +16 -1
@@ -46,6 +46,7 @@ struct net_device_context {/* point back to our device context */ struct hv_device *device_ctx;unsigned long avail; +struct work_struct work; };
@@ -219,6 +220,7 @@ static void netvsc_linkstatus_callback(struct hv_device *device_obj, unsigned int status) {struct net_device *net =dev_get_drvdata (&device_obj->device); +struct net_device_context *ndev_ctx;if (!net) { DPRINT_ERR(NETVSC_DRV, "got link status but net device "
@@ -229,7 +231,8 @@ static void netvsc_linkstatus_callback(struct hv_device *device_obj,if (status ==1 ) {netif_carrier_on (net);netif_wake_queue (net); -netif_notify_peers (net); + ndev_ctx =netdev_priv (net); +schedule_work (&ndev_ctx->work); }else {netif_carrier_off (net);netif_stop_queue (net);
@@ -328,6 +331,17 @@ static const struct net_device_ops device_ops = { .ndo_set_mac_address = eth_mac_addr, }; +static void netvsc_send_garp (struct work_struct *w) +{ +struct net_device_context *ndev_ctx; +struct net_device *net; + + ndev_ctx = container_of(w, struct net_device_context, work); + net =dev_get_drvdata (&ndev_ctx->device_ctx->device); +netif_notify_peers (net); +} + +static int netvsc_probe (struct device *device) { struct hv_driver *drv =
@@ -353,6 +367,7 @@ static int netvsc_probe(struct device *device) net_device_ctx->device_ctx = device_obj; net_device_ctx->avail = ring_size;dev_set_drvdata (device, net); +INIT_WORK (&net_device_ctx->work, netvsc_send_garp);/* Notify the netvsc driver of the new device */ ret = net_drv_obj->base.dev_add (device_obj, &device_info);
Signature · 1 line
1.6.3.2
Quoted 4 lines · Haiyang Zhang
After Quick Migration, the network is not immediately operational in the current context when receiving
RNDIS_STATUS_MEDIA_CONNECTevent. So, I put thenetif_notify_peers()into a scheduled work, otherwise GARP packet will not be sent after quick migration, and cause network disconnection.
But that's a hypervisor bug, right? It shouldn't be sending a "connect" event on the ethernet device if the network really isn't present. How about getting it fixed there, which will resolve the issues for all guest operating systems, not just Linux.
Or, if this is something that the hyperv developers are not going to fix, we need to document it in the code itself so that people don't try to remove it in a few years as an "optimization".
thanks,
greg k-h
Quoted 11 lines
-----Original Message-----
From: Greg KH [mailto:[email protected]]
Sent: Tuesday, April 05, 2011 11:42 AM
But that's a hypervisor bug, right? It shouldn't be sending a "connect" event on the ethernet device if the network really isn't present. How about getting it fixed there, which will resolve the issues for all guest operating systems, not just Linux.Or, if this is something that the hyperv developers are not going to fix, we need to document it in the code itself so that people don't try to remove it in a few years as an "optimization".
Fix on the Hyper-V side is not available for now at least. I will add the comments into code.
Thanks,
- Haiyang
Quoted 8 lines · Haiyang Zhang
Quoted 8 lines
-----Original Message-----
From: Greg KH [mailto:[email protected]]
Sent: Tuesday, April 05, 2011 11:42 AM
But that's a hypervisor bug, right? It shouldn't be sending a "connect" event on the ethernet device if the network really isn't present. How about getting it fixed there, which will resolve the issues for all guest operating systems, not just Linux.
Quoted 6 lines
Quoted 3 lines
Or, if this is something that the hyperv developers are not going to fix, we need to document it in the code itself so that people don't try to remove it in a few years as an "optimization".
Fix on the Hyper-V side is not available for now at least. I will add the comments into code.
What happens when the hyperv code is fixed? Will this be removed? Or will all guests have this delay in them for no reason and the older "unfixed" guests suddenly work faster? That seems odd...
thanks,
greg k-h