* [PATCH 3/3 v2] ifb: use the lockless variants of skb_queue
@ 2010-12-05 1:01 Changli Gao
2010-12-05 14:26 ` jamal
0 siblings, 1 reply; 3+ messages in thread
From: Changli Gao @ 2010-12-05 1:01 UTC (permalink / raw)
To: jamal; +Cc: netdev, Jarek Poplawski, Changli Gao
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>
---
drivers/net/ifb.c | 14 ++++++--------
1 file changed, 6 insertions(+), 8 deletions(-)
diff --git a/drivers/net/ifb.c b/drivers/net/ifb.c
index d1e362a..9825f11 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 */
@@ -161,7 +159,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);
@@ -176,8 +174,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;
}
@@ -186,8 +184,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;
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 3/3 v2] ifb: use the lockless variants of skb_queue
2010-12-05 1:01 [PATCH 3/3 v2] ifb: use the lockless variants of skb_queue Changli Gao
@ 2010-12-05 14:26 ` jamal
2010-12-10 22:35 ` David Miller
0 siblings, 1 reply; 3+ messages in thread
From: jamal @ 2010-12-05 14:26 UTC (permalink / raw)
To: Changli Gao; +Cc: netdev, Jarek Poplawski
On Sun, 2010-12-05 at 09:01 +0800, Changli Gao wrote:
> 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>
cheers,
jamal
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 3/3 v2] ifb: use the lockless variants of skb_queue
2010-12-05 14:26 ` jamal
@ 2010-12-10 22:35 ` David Miller
0 siblings, 0 replies; 3+ messages in thread
From: David Miller @ 2010-12-10 22:35 UTC (permalink / raw)
To: hadi; +Cc: xiaosuo, netdev, jarkao2
From: jamal <hadi@cyberus.ca>
Date: Sun, 05 Dec 2010 09:26:20 -0500
> On Sun, 2010-12-05 at 09:01 +0800, Changli Gao wrote:
>> 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>
I've applied the most up to date versions of all 3 of
Changli's IFB patches, thanks!
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-12-10 22:34 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-12-05 1:01 [PATCH 3/3 v2] ifb: use the lockless variants of skb_queue Changli Gao
2010-12-05 14:26 ` jamal
2010-12-10 22:35 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).