Commit a27758ff authored by WANG Cong's avatar WANG Cong Committed by David S. Miller

net_sched: keep backlog updated with qlen

For gso_skb we only update qlen, backlog should be updated too.

Note, it is correct to just update these stats at one layer,
because the gso_skb is cached there.
Reported-by: default avatarStas Nichiporovich <stasn77@gmail.com>
Fixes: 2ccccf5f ("net_sched: update hierarchical backlog too")
Cc: Jamal Hadi Salim <jhs@mojatatu.com>
Signed-off-by: default avatarCong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 19575988
...@@ -691,10 +691,12 @@ static inline struct sk_buff *qdisc_peek_dequeued(struct Qdisc *sch) ...@@ -691,10 +691,12 @@ static inline struct sk_buff *qdisc_peek_dequeued(struct Qdisc *sch)
/* we can reuse ->gso_skb because peek isn't called for root qdiscs */ /* we can reuse ->gso_skb because peek isn't called for root qdiscs */
if (!sch->gso_skb) { if (!sch->gso_skb) {
sch->gso_skb = sch->dequeue(sch); sch->gso_skb = sch->dequeue(sch);
if (sch->gso_skb) if (sch->gso_skb) {
/* it's still part of the queue */ /* it's still part of the queue */
qdisc_qstats_backlog_inc(sch, sch->gso_skb);
sch->q.qlen++; sch->q.qlen++;
} }
}
return sch->gso_skb; return sch->gso_skb;
} }
...@@ -706,6 +708,7 @@ static inline struct sk_buff *qdisc_dequeue_peeked(struct Qdisc *sch) ...@@ -706,6 +708,7 @@ static inline struct sk_buff *qdisc_dequeue_peeked(struct Qdisc *sch)
if (skb) { if (skb) {
sch->gso_skb = NULL; sch->gso_skb = NULL;
qdisc_qstats_backlog_dec(sch, skb);
sch->q.qlen--; sch->q.qlen--;
} else { } else {
skb = sch->dequeue(sch); skb = sch->dequeue(sch);
......
...@@ -49,6 +49,7 @@ static inline int dev_requeue_skb(struct sk_buff *skb, struct Qdisc *q) ...@@ -49,6 +49,7 @@ static inline int dev_requeue_skb(struct sk_buff *skb, struct Qdisc *q)
{ {
q->gso_skb = skb; q->gso_skb = skb;
q->qstats.requeues++; q->qstats.requeues++;
qdisc_qstats_backlog_inc(q, skb);
q->q.qlen++; /* it's still part of the queue */ q->q.qlen++; /* it's still part of the queue */
__netif_schedule(q); __netif_schedule(q);
...@@ -92,6 +93,7 @@ static struct sk_buff *dequeue_skb(struct Qdisc *q, bool *validate, ...@@ -92,6 +93,7 @@ static struct sk_buff *dequeue_skb(struct Qdisc *q, bool *validate,
txq = skb_get_tx_queue(txq->dev, skb); txq = skb_get_tx_queue(txq->dev, skb);
if (!netif_xmit_frozen_or_stopped(txq)) { if (!netif_xmit_frozen_or_stopped(txq)) {
q->gso_skb = NULL; q->gso_skb = NULL;
qdisc_qstats_backlog_dec(q, skb);
q->q.qlen--; q->q.qlen--;
} else } else
skb = NULL; skb = NULL;
......
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