diff options
author | Eric Dumazet <eric.dumazet@gmail.com> | 2011-01-21 02:31:33 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-01-21 02:31:33 -0500 |
commit | 9190b3b3208d052d98cb601fcc192f3f71a5658b (patch) | |
tree | b642a00320a1b35e33741fcd162072724f228fbf /net/sched/sch_cbq.c | |
parent | b30532515f0a62bfe17207ab00883dd262497006 (diff) |
net_sched: accurate bytes/packets stats/rates
In commit 44b8288308ac9d (net_sched: pfifo_head_drop problem), we fixed
a problem with pfifo_head drops that incorrectly decreased
sch->bstats.bytes and sch->bstats.packets
Several qdiscs (CHOKe, SFQ, pfifo_head, ...) are able to drop a
previously enqueued packet, and bstats cannot be changed, so
bstats/rates are not accurate (over estimated)
This patch changes the qdisc_bstats updates to be done at dequeue() time
instead of enqueue() time. bstats counters no longer account for dropped
frames, and rates are more correct, since enqueue() bursts dont have
effect on dequeue() rate.
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Acked-by: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sched/sch_cbq.c')
-rw-r--r-- | net/sched/sch_cbq.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/net/sched/sch_cbq.c b/net/sched/sch_cbq.c index c80d1c210c5d..5f63ec58942c 100644 --- a/net/sched/sch_cbq.c +++ b/net/sched/sch_cbq.c | |||
@@ -390,7 +390,6 @@ cbq_enqueue(struct sk_buff *skb, struct Qdisc *sch) | |||
390 | ret = qdisc_enqueue(skb, cl->q); | 390 | ret = qdisc_enqueue(skb, cl->q); |
391 | if (ret == NET_XMIT_SUCCESS) { | 391 | if (ret == NET_XMIT_SUCCESS) { |
392 | sch->q.qlen++; | 392 | sch->q.qlen++; |
393 | qdisc_bstats_update(sch, skb); | ||
394 | cbq_mark_toplevel(q, cl); | 393 | cbq_mark_toplevel(q, cl); |
395 | if (!cl->next_alive) | 394 | if (!cl->next_alive) |
396 | cbq_activate_class(cl); | 395 | cbq_activate_class(cl); |
@@ -649,7 +648,6 @@ static int cbq_reshape_fail(struct sk_buff *skb, struct Qdisc *child) | |||
649 | ret = qdisc_enqueue(skb, cl->q); | 648 | ret = qdisc_enqueue(skb, cl->q); |
650 | if (ret == NET_XMIT_SUCCESS) { | 649 | if (ret == NET_XMIT_SUCCESS) { |
651 | sch->q.qlen++; | 650 | sch->q.qlen++; |
652 | qdisc_bstats_update(sch, skb); | ||
653 | if (!cl->next_alive) | 651 | if (!cl->next_alive) |
654 | cbq_activate_class(cl); | 652 | cbq_activate_class(cl); |
655 | return 0; | 653 | return 0; |
@@ -971,6 +969,7 @@ cbq_dequeue(struct Qdisc *sch) | |||
971 | 969 | ||
972 | skb = cbq_dequeue_1(sch); | 970 | skb = cbq_dequeue_1(sch); |
973 | if (skb) { | 971 | if (skb) { |
972 | qdisc_bstats_update(sch, skb); | ||
974 | sch->q.qlen--; | 973 | sch->q.qlen--; |
975 | sch->flags &= ~TCQ_F_THROTTLED; | 974 | sch->flags &= ~TCQ_F_THROTTLED; |
976 | return skb; | 975 | return skb; |