diff options
author | Changli Gao <xiaosuo@gmail.com> | 2010-12-04 15:01:52 +0000 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-12-10 14:34:34 -0800 |
commit | 957fca95e3521e471aac4c2e4cfbc21f399bdd84 (patch) | |
tree | b76b95933dda9b9b4319ee8711b555be2c28c23d /drivers/net | |
parent | c6350362cbb19882ba0eb3578cc1abc07e6ea204 (diff) |
ifb: use the lockless variants of skb_queue
rq and tq are both protected by tx queue lock, so we can simply use
the lockless variants of skb_queue.
skb_queue_splice_tail_init() is used instead of the open coded and slow
one.
Signed-off-by: Changli Gao <xiaosuo@gmail.com>
Signed-off-by: Jamal Hadi Salim <hadi@cyberus.ca>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/ifb.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/drivers/net/ifb.c b/drivers/net/ifb.c index d58c4f74f01..bfa03db6669 100644 --- a/drivers/net/ifb.c +++ b/drivers/net/ifb.c @@ -63,9 +63,7 @@ static void ri_tasklet(unsigned long dev) txq = netdev_get_tx_queue(_dev, 0); if ((skb = skb_peek(&dp->tq)) == NULL) { if (__netif_tx_trylock(txq)) { - while ((skb = skb_dequeue(&dp->rq)) != NULL) { - skb_queue_tail(&dp->tq, skb); - } + skb_queue_splice_tail_init(&dp->rq, &dp->tq); __netif_tx_unlock(txq); } else { /* reschedule */ @@ -163,7 +161,7 @@ static netdev_tx_t ifb_xmit(struct sk_buff *skb, struct net_device *dev) netif_stop_queue(dev); } - skb_queue_tail(&dp->rq, skb); + __skb_queue_tail(&dp->rq, skb); if (!dp->tasklet_pending) { dp->tasklet_pending = 1; tasklet_schedule(&dp->ifb_tasklet); @@ -178,8 +176,8 @@ static int ifb_close(struct net_device *dev) tasklet_kill(&dp->ifb_tasklet); netif_stop_queue(dev); - skb_queue_purge(&dp->rq); - skb_queue_purge(&dp->tq); + __skb_queue_purge(&dp->rq); + __skb_queue_purge(&dp->tq); return 0; } @@ -188,8 +186,8 @@ static int ifb_open(struct net_device *dev) struct ifb_private *dp = netdev_priv(dev); tasklet_init(&dp->ifb_tasklet, ri_tasklet, (unsigned long)dev); - skb_queue_head_init(&dp->rq); - skb_queue_head_init(&dp->tq); + __skb_queue_head_init(&dp->rq); + __skb_queue_head_init(&dp->tq); netif_start_queue(dev); return 0; |