Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 310710
b: refs/heads/master
c: dc5cd89
h: refs/heads/master
v: v3
  • Loading branch information
Haiyang Zhang authored and David S. Miller committed Jun 4, 2012
1 parent 1d4fee6 commit 7a7a743
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 9ec0db71af04f4560e27a3c2f5a0411ba3155198
refs/heads/master: dc5cd894cace7bda4a743487a9f87d59a3f0a095
1 change: 1 addition & 0 deletions trunk/drivers/net/hyperv/hyperv_net.h
Original file line number Diff line number Diff line change
Expand Up @@ -478,6 +478,7 @@ struct netvsc_device {
u32 nvsp_version;

atomic_t num_outstanding_sends;
wait_queue_head_t wait_drain;
bool start_remove;
bool destroy;
/*
Expand Down
12 changes: 6 additions & 6 deletions trunk/drivers/net/hyperv/netvsc.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ static struct netvsc_device *alloc_net_device(struct hv_device *device)
if (!net_device)
return NULL;

init_waitqueue_head(&net_device->wait_drain);
net_device->start_remove = false;
net_device->destroy = false;
net_device->dev = device;
Expand Down Expand Up @@ -387,12 +388,8 @@ int netvsc_device_remove(struct hv_device *device)
spin_unlock_irqrestore(&device->channel->inbound_lock, flags);

/* Wait for all send completions */
while (atomic_read(&net_device->num_outstanding_sends)) {
dev_info(&device->device,
"waiting for %d requests to complete...\n",
atomic_read(&net_device->num_outstanding_sends));
udelay(100);
}
wait_event(net_device->wait_drain,
atomic_read(&net_device->num_outstanding_sends) == 0);

netvsc_disconnect_vsp(net_device);

Expand Down Expand Up @@ -486,6 +483,9 @@ static void netvsc_send_completion(struct hv_device *device,
num_outstanding_sends =
atomic_dec_return(&net_device->num_outstanding_sends);

if (net_device->destroy && num_outstanding_sends == 0)
wake_up(&net_device->wait_drain);

if (netif_queue_stopped(ndev) && !net_device->start_remove &&
(hv_ringbuf_avail_percent(&device->channel->outbound)
> RING_AVAIL_PERCENT_HIWATER ||
Expand Down

0 comments on commit 7a7a743

Please sign in to comment.