pkt_sched: Simplify dev_requeue_skb and dequeue_skb
qdisc->requeue was planned to universally replace all requeuing code, but at the top level we never requeue more than one skb, so qdisc-> gso_skb is enough for this. qdisc->requeue would be used on the lower levels only for one level deep requeuing (like in sch_hfsc) after finishing all the changes. Signed-off-by: Jarek Poplawski <jarkao2@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
committed by
David S. Miller
parent
554794de79
commit
6252352d16
@@ -44,12 +44,9 @@ static inline int qdisc_qlen(struct Qdisc *q)
|
|||||||
|
|
||||||
static inline int dev_requeue_skb(struct sk_buff *skb, struct Qdisc *q)
|
static inline int dev_requeue_skb(struct sk_buff *skb, struct Qdisc *q)
|
||||||
{
|
{
|
||||||
if (unlikely(skb->next))
|
q->gso_skb = skb;
|
||||||
q->gso_skb = skb;
|
|
||||||
else
|
|
||||||
__skb_queue_head(&q->requeue, skb);
|
|
||||||
|
|
||||||
__netif_schedule(q);
|
__netif_schedule(q);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -57,24 +54,16 @@ static inline struct sk_buff *dequeue_skb(struct Qdisc *q)
|
|||||||
{
|
{
|
||||||
struct sk_buff *skb = q->gso_skb;
|
struct sk_buff *skb = q->gso_skb;
|
||||||
|
|
||||||
if (!skb)
|
|
||||||
skb = skb_peek(&q->requeue);
|
|
||||||
|
|
||||||
if (unlikely(skb)) {
|
if (unlikely(skb)) {
|
||||||
struct net_device *dev = qdisc_dev(q);
|
struct net_device *dev = qdisc_dev(q);
|
||||||
struct netdev_queue *txq;
|
struct netdev_queue *txq;
|
||||||
|
|
||||||
/* check the reason of requeuing without tx lock first */
|
/* check the reason of requeuing without tx lock first */
|
||||||
txq = netdev_get_tx_queue(dev, skb_get_queue_mapping(skb));
|
txq = netdev_get_tx_queue(dev, skb_get_queue_mapping(skb));
|
||||||
if (!netif_tx_queue_stopped(txq) &&
|
if (!netif_tx_queue_stopped(txq) && !netif_tx_queue_frozen(txq))
|
||||||
!netif_tx_queue_frozen(txq)) {
|
q->gso_skb = NULL;
|
||||||
if (q->gso_skb)
|
else
|
||||||
q->gso_skb = NULL;
|
|
||||||
else
|
|
||||||
__skb_unlink(skb, &q->requeue);
|
|
||||||
} else {
|
|
||||||
skb = NULL;
|
skb = NULL;
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
skb = q->dequeue(q);
|
skb = q->dequeue(q);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user