diff options
Diffstat (limited to 'drivers/net/hyperv/netvsc.c')
-rw-r--r-- | drivers/net/hyperv/netvsc.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/drivers/net/hyperv/netvsc.c b/drivers/net/hyperv/netvsc.c index 8b919471472f..0c569831db5a 100644 --- a/drivers/net/hyperv/netvsc.c +++ b/drivers/net/hyperv/netvsc.c | |||
@@ -42,6 +42,7 @@ static struct netvsc_device *alloc_net_device(struct hv_device *device) | |||
42 | if (!net_device) | 42 | if (!net_device) |
43 | return NULL; | 43 | return NULL; |
44 | 44 | ||
45 | init_waitqueue_head(&net_device->wait_drain); | ||
45 | net_device->start_remove = false; | 46 | net_device->start_remove = false; |
46 | net_device->destroy = false; | 47 | net_device->destroy = false; |
47 | net_device->dev = device; | 48 | net_device->dev = device; |
@@ -387,12 +388,8 @@ int netvsc_device_remove(struct hv_device *device) | |||
387 | spin_unlock_irqrestore(&device->channel->inbound_lock, flags); | 388 | spin_unlock_irqrestore(&device->channel->inbound_lock, flags); |
388 | 389 | ||
389 | /* Wait for all send completions */ | 390 | /* Wait for all send completions */ |
390 | while (atomic_read(&net_device->num_outstanding_sends)) { | 391 | wait_event(net_device->wait_drain, |
391 | dev_info(&device->device, | 392 | atomic_read(&net_device->num_outstanding_sends) == 0); |
392 | "waiting for %d requests to complete...\n", | ||
393 | atomic_read(&net_device->num_outstanding_sends)); | ||
394 | udelay(100); | ||
395 | } | ||
396 | 393 | ||
397 | netvsc_disconnect_vsp(net_device); | 394 | netvsc_disconnect_vsp(net_device); |
398 | 395 | ||
@@ -486,6 +483,9 @@ static void netvsc_send_completion(struct hv_device *device, | |||
486 | num_outstanding_sends = | 483 | num_outstanding_sends = |
487 | atomic_dec_return(&net_device->num_outstanding_sends); | 484 | atomic_dec_return(&net_device->num_outstanding_sends); |
488 | 485 | ||
486 | if (net_device->destroy && num_outstanding_sends == 0) | ||
487 | wake_up(&net_device->wait_drain); | ||
488 | |||
489 | if (netif_queue_stopped(ndev) && !net_device->start_remove && | 489 | if (netif_queue_stopped(ndev) && !net_device->start_remove && |
490 | (hv_ringbuf_avail_percent(&device->channel->outbound) | 490 | (hv_ringbuf_avail_percent(&device->channel->outbound) |
491 | > RING_AVAIL_PERCENT_HIWATER || | 491 | > RING_AVAIL_PERCENT_HIWATER || |