aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Ward <david.ward@ll.mit.edu>2012-09-13 01:22:34 -0400
committerDavid S. Miller <davem@davemloft.net>2012-09-13 16:10:13 -0400
commit1fe37b106b039d9358fd1211c39b1fa199e547a8 (patch)
treec7b84405616fc88087f174f4e4934a65a483032e
parentc22e464022f935b0cbd8724b1d99d800d49518a9 (diff)
net_sched: gred: fix qave reporting via netlink
q->vars.qavg is a Wlog scaled value, but q->backlog is not. In order to pass q->vars.qavg as the backlog value, we need to un-scale it. Additionally, the qave value returned via netlink should not be Wlog scaled, so we need to un-scale the result of red_calc_qavg(). This caused artificially high values for "Average Queue" to be shown by 'tc -s -d qdisc', but did not affect the actual operation of GRED. Signed-off-by: David Ward <david.ward@ll.mit.edu> Acked-by: Jamal Hadi Salim <jhs@mojatatu.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--net/sched/sch_gred.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/net/sched/sch_gred.c b/net/sched/sch_gred.c
index e19d4ebfea1c..b2570b59d85e 100644
--- a/net/sched/sch_gred.c
+++ b/net/sched/sch_gred.c
@@ -534,6 +534,7 @@ static int gred_dump(struct Qdisc *sch, struct sk_buff *skb)
534 for (i = 0; i < MAX_DPs; i++) { 534 for (i = 0; i < MAX_DPs; i++) {
535 struct gred_sched_data *q = table->tab[i]; 535 struct gred_sched_data *q = table->tab[i];
536 struct tc_gred_qopt opt; 536 struct tc_gred_qopt opt;
537 unsigned long qavg;
537 538
538 memset(&opt, 0, sizeof(opt)); 539 memset(&opt, 0, sizeof(opt));
539 540
@@ -565,7 +566,9 @@ static int gred_dump(struct Qdisc *sch, struct sk_buff *skb)
565 if (gred_wred_mode(table)) 566 if (gred_wred_mode(table))
566 gred_load_wred_set(table, q); 567 gred_load_wred_set(table, q);
567 568
568 opt.qave = red_calc_qavg(&q->parms, &q->vars, q->vars.qavg); 569 qavg = red_calc_qavg(&q->parms, &q->vars,
570 q->vars.qavg >> q->parms.Wlog);
571 opt.qave = qavg >> q->parms.Wlog;
569 572
570append_opt: 573append_opt:
571 if (nla_append(skb, sizeof(opt), &opt) < 0) 574 if (nla_append(skb, sizeof(opt), &opt) < 0)