diff options
author | Jarek Poplawski <jarkao2@gmail.com> | 2008-09-23 01:16:23 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-09-23 01:16:23 -0400 |
commit | ebf059821ed8a36acd706484b719d14d212ada32 (patch) | |
tree | 44b2ee2887113ea5d90b35f4c4ae1a376f38e94f /net/sched/sch_generic.c | |
parent | f0876520b0b721bedafd9cec3b1b0624ae566eee (diff) |
pkt_sched: Check the state of tx_queue in dequeue_skb()
Check in dequeue_skb() the state of tx_queue for requeued skb to save
on locking and re-requeuing, and possibly remove the current check in
qdisc_run(). Based on the idea of Alexander Duyck.
Signed-off-by: Jarek Poplawski <jarkao2@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sched/sch_generic.c')
-rw-r--r-- | net/sched/sch_generic.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/net/sched/sch_generic.c b/net/sched/sch_generic.c index 1b508bd1c06c..5e7e0bd38fe8 100644 --- a/net/sched/sch_generic.c +++ b/net/sched/sch_generic.c | |||
@@ -52,11 +52,21 @@ static inline int dev_requeue_skb(struct sk_buff *skb, struct Qdisc *q) | |||
52 | 52 | ||
53 | static inline struct sk_buff *dequeue_skb(struct Qdisc *q) | 53 | static inline struct sk_buff *dequeue_skb(struct Qdisc *q) |
54 | { | 54 | { |
55 | struct sk_buff *skb; | 55 | struct sk_buff *skb = skb_peek(&q->requeue); |
56 | 56 | ||
57 | skb = __skb_dequeue(&q->requeue); | 57 | if (unlikely(skb)) { |
58 | if (!skb) | 58 | struct net_device *dev = qdisc_dev(q); |
59 | struct netdev_queue *txq; | ||
60 | |||
61 | /* check the reason of requeuing without tx lock first */ | ||
62 | txq = netdev_get_tx_queue(dev, skb_get_queue_mapping(skb)); | ||
63 | if (!netif_tx_queue_stopped(txq) && !netif_tx_queue_frozen(txq)) | ||
64 | __skb_unlink(skb, &q->requeue); | ||
65 | else | ||
66 | skb = NULL; | ||
67 | } else { | ||
59 | skb = q->dequeue(q); | 68 | skb = q->dequeue(q); |
69 | } | ||
60 | 70 | ||
61 | return skb; | 71 | return skb; |
62 | } | 72 | } |