diff options
author | Changli Gao <xiaosuo@gmail.com> | 2010-12-04 10:01:52 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-12-10 17:34:34 -0500 |
commit | 957fca95e3521e471aac4c2e4cfbc21f399bdd84 (patch) | |
tree | b76b95933dda9b9b4319ee8711b555be2c28c23d /drivers/net/ifb.c | |
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/ifb.c')
-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 d58c4f74f01a..bfa03db66691 100644 --- a/drivers/net/ifb.c +++ b/drivers/net/ifb.c | |||
@@ -63,9 +63,7 @@ static void ri_tasklet(unsigned long dev) | |||
63 | txq = netdev_get_tx_queue(_dev, 0); | 63 | txq = netdev_get_tx_queue(_dev, 0); |
64 | if ((skb = skb_peek(&dp->tq)) == NULL) { | 64 | if ((skb = skb_peek(&dp->tq)) == NULL) { |
65 | if (__netif_tx_trylock(txq)) { | 65 | if (__netif_tx_trylock(txq)) { |
66 | while ((skb = skb_dequeue(&dp->rq)) != NULL) { | 66 | skb_queue_splice_tail_init(&dp->rq, &dp->tq); |
67 | skb_queue_tail(&dp->tq, skb); | ||
68 | } | ||
69 | __netif_tx_unlock(txq); | 67 | __netif_tx_unlock(txq); |
70 | } else { | 68 | } else { |
71 | /* reschedule */ | 69 | /* reschedule */ |
@@ -163,7 +161,7 @@ static netdev_tx_t ifb_xmit(struct sk_buff *skb, struct net_device *dev) | |||
163 | netif_stop_queue(dev); | 161 | netif_stop_queue(dev); |
164 | } | 162 | } |
165 | 163 | ||
166 | skb_queue_tail(&dp->rq, skb); | 164 | __skb_queue_tail(&dp->rq, skb); |
167 | if (!dp->tasklet_pending) { | 165 | if (!dp->tasklet_pending) { |
168 | dp->tasklet_pending = 1; | 166 | dp->tasklet_pending = 1; |
169 | tasklet_schedule(&dp->ifb_tasklet); | 167 | tasklet_schedule(&dp->ifb_tasklet); |
@@ -178,8 +176,8 @@ static int ifb_close(struct net_device *dev) | |||
178 | 176 | ||
179 | tasklet_kill(&dp->ifb_tasklet); | 177 | tasklet_kill(&dp->ifb_tasklet); |
180 | netif_stop_queue(dev); | 178 | netif_stop_queue(dev); |
181 | skb_queue_purge(&dp->rq); | 179 | __skb_queue_purge(&dp->rq); |
182 | skb_queue_purge(&dp->tq); | 180 | __skb_queue_purge(&dp->tq); |
183 | return 0; | 181 | return 0; |
184 | } | 182 | } |
185 | 183 | ||
@@ -188,8 +186,8 @@ static int ifb_open(struct net_device *dev) | |||
188 | struct ifb_private *dp = netdev_priv(dev); | 186 | struct ifb_private *dp = netdev_priv(dev); |
189 | 187 | ||
190 | tasklet_init(&dp->ifb_tasklet, ri_tasklet, (unsigned long)dev); | 188 | tasklet_init(&dp->ifb_tasklet, ri_tasklet, (unsigned long)dev); |
191 | skb_queue_head_init(&dp->rq); | 189 | __skb_queue_head_init(&dp->rq); |
192 | skb_queue_head_init(&dp->tq); | 190 | __skb_queue_head_init(&dp->tq); |
193 | netif_start_queue(dev); | 191 | netif_start_queue(dev); |
194 | 192 | ||
195 | return 0; | 193 | return 0; |