Commit ab3c10e5 authored by WANG Cong's avatar WANG Cong Committed by Kleber Sacilotto de Souza

sch_prio: update backlog as well

BugLink: https://bugs.launchpad.net/bugs/1878232

commit 6529d75a upstream.

We need to update backlog too when we update qlen.

Joint work with Stas.
Reported-by: default avatarStas Nichiporovich <stasn77@gmail.com>
Tested-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>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarIan May <ian.may@canonical.com>
Signed-off-by: default avatarKleber Sacilotto de Souza <kleber.souza@canonical.com>
parent a561ae7b
...@@ -85,6 +85,7 @@ prio_enqueue(struct sk_buff *skb, struct Qdisc *sch) ...@@ -85,6 +85,7 @@ prio_enqueue(struct sk_buff *skb, struct Qdisc *sch)
ret = qdisc_enqueue(skb, qdisc); ret = qdisc_enqueue(skb, qdisc);
if (ret == NET_XMIT_SUCCESS) { if (ret == NET_XMIT_SUCCESS) {
qdisc_qstats_backlog_inc(sch, skb);
sch->q.qlen++; sch->q.qlen++;
return NET_XMIT_SUCCESS; return NET_XMIT_SUCCESS;
} }
...@@ -117,6 +118,7 @@ static struct sk_buff *prio_dequeue(struct Qdisc *sch) ...@@ -117,6 +118,7 @@ static struct sk_buff *prio_dequeue(struct Qdisc *sch)
struct sk_buff *skb = qdisc_dequeue_peeked(qdisc); struct sk_buff *skb = qdisc_dequeue_peeked(qdisc);
if (skb) { if (skb) {
qdisc_bstats_update(sch, skb); qdisc_bstats_update(sch, skb);
qdisc_qstats_backlog_dec(sch, skb);
sch->q.qlen--; sch->q.qlen--;
return skb; return skb;
} }
...@@ -135,6 +137,7 @@ static unsigned int prio_drop(struct Qdisc *sch) ...@@ -135,6 +137,7 @@ static unsigned int prio_drop(struct Qdisc *sch)
for (prio = q->bands-1; prio >= 0; prio--) { for (prio = q->bands-1; prio >= 0; prio--) {
qdisc = q->queues[prio]; qdisc = q->queues[prio];
if (qdisc->ops->drop && (len = qdisc->ops->drop(qdisc)) != 0) { if (qdisc->ops->drop && (len = qdisc->ops->drop(qdisc)) != 0) {
sch->qstats.backlog -= len;
sch->q.qlen--; sch->q.qlen--;
return len; return len;
} }
...@@ -151,6 +154,7 @@ prio_reset(struct Qdisc *sch) ...@@ -151,6 +154,7 @@ prio_reset(struct Qdisc *sch)
for (prio = 0; prio < q->bands; prio++) for (prio = 0; prio < q->bands; prio++)
qdisc_reset(q->queues[prio]); qdisc_reset(q->queues[prio]);
sch->qstats.backlog = 0;
sch->q.qlen = 0; sch->q.qlen = 0;
} }
......
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