Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 268043
b: refs/heads/master
c: c38b9c7
h: refs/heads/master
i:
  268041: d5807ff
  268039: dc8fd12
v: v3
  • Loading branch information
K. Y. Srinivasan authored and Greg Kroah-Hartman committed Aug 29, 2011
1 parent 14779fb commit 0d9ef1d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 509ee3878b8f0f8908892579d679c123084f5ac5
refs/heads/master: c38b9c7118b95aa48bfa38d3bcd241dba3d23c10
1 change: 1 addition & 0 deletions trunk/drivers/staging/hv/hyperv_net.h
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,7 @@ struct netvsc_device {

atomic_t refcnt;
atomic_t num_outstanding_sends;
bool destroy;
/*
* List of free preallocated hv_netvsc_packet to represent receive
* packet
Expand Down
6 changes: 6 additions & 0 deletions trunk/drivers/staging/hv/netvsc.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ static struct netvsc_device *alloc_net_device(struct hv_device *device)
/* Set to 2 to allow both inbound and outbound traffic */
atomic_set(&net_device->refcnt, 2);

net_device->destroy = false;
net_device->dev = device;
device->ext = net_device;

Expand Down Expand Up @@ -396,6 +397,7 @@ int netvsc_device_remove(struct hv_device *device)
{
struct netvsc_device *net_device;
struct hv_netvsc_packet *netvsc_packet, *pos;
unsigned long flags;

/* Stop outbound traffic ie sends and receives completions */
net_device = release_outbound_net_device(device);
Expand All @@ -404,6 +406,10 @@ int netvsc_device_remove(struct hv_device *device)
return -ENODEV;
}

spin_lock_irqsave(&device->channel->inbound_lock, flags);
net_device->destroy = true;
spin_unlock_irqrestore(&device->channel->inbound_lock, flags);

/* Wait for all send completions */
while (atomic_read(&net_device->num_outstanding_sends)) {
dev_err(&device->device,
Expand Down

0 comments on commit 0d9ef1d

Please sign in to comment.