Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 41655
b: refs/heads/master
c: 93ec2c7
h: refs/heads/master
i:
  41653: c8e9018
  41651: 98afa21
  41647: cf1e89f
v: v3
  • Loading branch information
Stephen Hemminger authored and David S. Miller committed Dec 3, 2006
1 parent ae99239 commit be260e7
Show file tree
Hide file tree
Showing 3 changed files with 21 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: a1bcfacd0577ff477e934731d4ceb3d26eab947d
refs/heads/master: 93ec2c723e3f8a216dde2899aeb85c648672bc6b
1 change: 1 addition & 0 deletions trunk/include/linux/netpoll.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ struct netpoll {
};

struct netpoll_info {
atomic_t refcnt;
spinlock_t poll_lock;
int poll_owner;
int tries;
Expand Down
25 changes: 19 additions & 6 deletions trunk/net/core/netpoll.c
Original file line number Diff line number Diff line change
Expand Up @@ -658,8 +658,11 @@ int netpoll_setup(struct netpoll *np)
npinfo->tries = MAX_RETRIES;
spin_lock_init(&npinfo->rx_lock);
skb_queue_head_init(&npinfo->arp_tx);
} else
atomic_set(&npinfo->refcnt, 1);
} else {
npinfo = ndev->npinfo;
atomic_inc(&npinfo->refcnt);
}

if (!ndev->poll_controller) {
printk(KERN_ERR "%s: %s doesn't support polling, aborting.\n",
Expand Down Expand Up @@ -766,12 +769,22 @@ void netpoll_cleanup(struct netpoll *np)

if (np->dev) {
npinfo = np->dev->npinfo;
if (npinfo && npinfo->rx_np == np) {
spin_lock_irqsave(&npinfo->rx_lock, flags);
npinfo->rx_np = NULL;
npinfo->rx_flags &= ~NETPOLL_RX_ENABLED;
spin_unlock_irqrestore(&npinfo->rx_lock, flags);
if (npinfo) {
if (npinfo->rx_np == np) {
spin_lock_irqsave(&npinfo->rx_lock, flags);
npinfo->rx_np = NULL;
npinfo->rx_flags &= ~NETPOLL_RX_ENABLED;
spin_unlock_irqrestore(&npinfo->rx_lock, flags);
}

np->dev->npinfo = NULL;
if (atomic_dec_and_test(&npinfo->refcnt)) {
skb_queue_purge(&npinfo->arp_tx);

kfree(npinfo);
}
}

dev_put(np->dev);
}

Expand Down

0 comments on commit be260e7

Please sign in to comment.