Commit ebf05982 authored by Jarek Poplawski's avatar Jarek Poplawski Committed by David S. Miller

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: default avatarJarek Poplawski <jarkao2@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent f0876520
...@@ -52,11 +52,21 @@ static inline int dev_requeue_skb(struct sk_buff *skb, struct Qdisc *q) ...@@ -52,11 +52,21 @@ static inline int dev_requeue_skb(struct sk_buff *skb, struct Qdisc *q)
static inline struct sk_buff *dequeue_skb(struct Qdisc *q) static inline struct sk_buff *dequeue_skb(struct Qdisc *q)
{ {
struct sk_buff *skb; struct sk_buff *skb = skb_peek(&q->requeue);
if (unlikely(skb)) {
struct net_device *dev = qdisc_dev(q);
struct netdev_queue *txq;
skb = __skb_dequeue(&q->requeue); /* check the reason of requeuing without tx lock first */
if (!skb) txq = netdev_get_tx_queue(dev, skb_get_queue_mapping(skb));
if (!netif_tx_queue_stopped(txq) && !netif_tx_queue_frozen(txq))
__skb_unlink(skb, &q->requeue);
else
skb = NULL;
} else {
skb = q->dequeue(q); skb = q->dequeue(q);
}
return skb; return skb;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment