diff options
author | Eric Dumazet <eric.dumazet@gmail.com> | 2009-10-02 06:32:18 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-10-07 04:07:42 -0400 |
commit | d250a5f90e53f5e150618186230795352d154c88 (patch) | |
tree | 1c95ec673ce613f346db300d3f5539f018066081 /net/sched | |
parent | 92d326f61b553250780786e9dd8609d4b32f8de7 (diff) |
pkt_sched: gen_estimator: Dont report fake rate estimators
Jarek Poplawski a écrit :
>
>
> Hmm... So you made me to do some "real" work here, and guess what?:
> there is one serious checkpatch warning! ;-) Plus, this new parameter
> should be added to the function description. Otherwise:
> Signed-off-by: Jarek Poplawski <jarkao2@gmail.com>
>
> Thanks,
> Jarek P.
>
> PS: I guess full "Don't" would show we really mean it...
Okay :) Here is the last round, before the night !
Thanks again
[RFC] pkt_sched: gen_estimator: Don't report fake rate estimators
We currently send TCA_STATS_RATE_EST elements to netlink users, even if no estimator
is running.
# tc -s -d qdisc
qdisc pfifo_fast 0: dev eth0 root bands 3 priomap 1 2 2 2 1 2 0 0 1 1 1 1 1 1 1 1
Sent 112833764978 bytes 1495081739 pkt (dropped 0, overlimits 0 requeues 0)
rate 0bit 0pps backlog 0b 0p requeues 0
User has no way to tell if the "rate 0bit 0pps" is a real estimation, or a fake
one (because no estimator is active)
After this patch, tc command output is :
$ tc -s -d qdisc
qdisc pfifo_fast 0: dev eth0 root bands 3 priomap 1 2 2 2 1 2 0 0 1 1 1 1 1 1 1 1
Sent 561075 bytes 1196 pkt (dropped 0, overlimits 0 requeues 0)
backlog 0b 0p requeues 0
We add a parameter to gnet_stats_copy_rate_est() function so that
it can use gen_estimator_active(bstats, r), as suggested by Jarek.
This parameter can be NULL if check is not necessary, (htb for
example has a mandatory rate estimator)
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: Jarek Poplawski <jarkao2@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sched')
-rw-r--r-- | net/sched/act_api.c | 3 | ||||
-rw-r--r-- | net/sched/sch_api.c | 2 | ||||
-rw-r--r-- | net/sched/sch_cbq.c | 2 | ||||
-rw-r--r-- | net/sched/sch_drr.c | 2 | ||||
-rw-r--r-- | net/sched/sch_hfsc.c | 2 | ||||
-rw-r--r-- | net/sched/sch_htb.c | 2 |
6 files changed, 7 insertions, 6 deletions
diff --git a/net/sched/act_api.c b/net/sched/act_api.c index 2dfb3e7a040d..ca2e1fd2bf69 100644 --- a/net/sched/act_api.c +++ b/net/sched/act_api.c | |||
@@ -618,7 +618,8 @@ int tcf_action_copy_stats(struct sk_buff *skb, struct tc_action *a, | |||
618 | goto errout; | 618 | goto errout; |
619 | 619 | ||
620 | if (gnet_stats_copy_basic(&d, &h->tcf_bstats) < 0 || | 620 | if (gnet_stats_copy_basic(&d, &h->tcf_bstats) < 0 || |
621 | gnet_stats_copy_rate_est(&d, &h->tcf_rate_est) < 0 || | 621 | gnet_stats_copy_rate_est(&d, &h->tcf_bstats, |
622 | &h->tcf_rate_est) < 0 || | ||
622 | gnet_stats_copy_queue(&d, &h->tcf_qstats) < 0) | 623 | gnet_stats_copy_queue(&d, &h->tcf_qstats) < 0) |
623 | goto errout; | 624 | goto errout; |
624 | 625 | ||
diff --git a/net/sched/sch_api.c b/net/sched/sch_api.c index 903e4188b6ca..1acfd29cc826 100644 --- a/net/sched/sch_api.c +++ b/net/sched/sch_api.c | |||
@@ -1179,7 +1179,7 @@ static int tc_fill_qdisc(struct sk_buff *skb, struct Qdisc *q, u32 clid, | |||
1179 | goto nla_put_failure; | 1179 | goto nla_put_failure; |
1180 | 1180 | ||
1181 | if (gnet_stats_copy_basic(&d, &q->bstats) < 0 || | 1181 | if (gnet_stats_copy_basic(&d, &q->bstats) < 0 || |
1182 | gnet_stats_copy_rate_est(&d, &q->rate_est) < 0 || | 1182 | gnet_stats_copy_rate_est(&d, &q->bstats, &q->rate_est) < 0 || |
1183 | gnet_stats_copy_queue(&d, &q->qstats) < 0) | 1183 | gnet_stats_copy_queue(&d, &q->qstats) < 0) |
1184 | goto nla_put_failure; | 1184 | goto nla_put_failure; |
1185 | 1185 | ||
diff --git a/net/sched/sch_cbq.c b/net/sched/sch_cbq.c index 5b132c473264..3846d65bc03e 100644 --- a/net/sched/sch_cbq.c +++ b/net/sched/sch_cbq.c | |||
@@ -1609,7 +1609,7 @@ cbq_dump_class_stats(struct Qdisc *sch, unsigned long arg, | |||
1609 | cl->xstats.undertime = cl->undertime - q->now; | 1609 | cl->xstats.undertime = cl->undertime - q->now; |
1610 | 1610 | ||
1611 | if (gnet_stats_copy_basic(d, &cl->bstats) < 0 || | 1611 | if (gnet_stats_copy_basic(d, &cl->bstats) < 0 || |
1612 | gnet_stats_copy_rate_est(d, &cl->rate_est) < 0 || | 1612 | gnet_stats_copy_rate_est(d, &cl->bstats, &cl->rate_est) < 0 || |
1613 | gnet_stats_copy_queue(d, &cl->qstats) < 0) | 1613 | gnet_stats_copy_queue(d, &cl->qstats) < 0) |
1614 | return -1; | 1614 | return -1; |
1615 | 1615 | ||
diff --git a/net/sched/sch_drr.c b/net/sched/sch_drr.c index 5a888af7e5da..a65604f8f2b8 100644 --- a/net/sched/sch_drr.c +++ b/net/sched/sch_drr.c | |||
@@ -280,7 +280,7 @@ static int drr_dump_class_stats(struct Qdisc *sch, unsigned long arg, | |||
280 | } | 280 | } |
281 | 281 | ||
282 | if (gnet_stats_copy_basic(d, &cl->bstats) < 0 || | 282 | if (gnet_stats_copy_basic(d, &cl->bstats) < 0 || |
283 | gnet_stats_copy_rate_est(d, &cl->rate_est) < 0 || | 283 | gnet_stats_copy_rate_est(d, &cl->bstats, &cl->rate_est) < 0 || |
284 | gnet_stats_copy_queue(d, &cl->qdisc->qstats) < 0) | 284 | gnet_stats_copy_queue(d, &cl->qdisc->qstats) < 0) |
285 | return -1; | 285 | return -1; |
286 | 286 | ||
diff --git a/net/sched/sch_hfsc.c b/net/sched/sch_hfsc.c index 2c5c76be18f8..b38b39c60752 100644 --- a/net/sched/sch_hfsc.c +++ b/net/sched/sch_hfsc.c | |||
@@ -1375,7 +1375,7 @@ hfsc_dump_class_stats(struct Qdisc *sch, unsigned long arg, | |||
1375 | xstats.rtwork = cl->cl_cumul; | 1375 | xstats.rtwork = cl->cl_cumul; |
1376 | 1376 | ||
1377 | if (gnet_stats_copy_basic(d, &cl->bstats) < 0 || | 1377 | if (gnet_stats_copy_basic(d, &cl->bstats) < 0 || |
1378 | gnet_stats_copy_rate_est(d, &cl->rate_est) < 0 || | 1378 | gnet_stats_copy_rate_est(d, &cl->bstats, &cl->rate_est) < 0 || |
1379 | gnet_stats_copy_queue(d, &cl->qstats) < 0) | 1379 | gnet_stats_copy_queue(d, &cl->qstats) < 0) |
1380 | return -1; | 1380 | return -1; |
1381 | 1381 | ||
diff --git a/net/sched/sch_htb.c b/net/sched/sch_htb.c index 85acab9dc6fd..2e38d1abd830 100644 --- a/net/sched/sch_htb.c +++ b/net/sched/sch_htb.c | |||
@@ -1105,7 +1105,7 @@ htb_dump_class_stats(struct Qdisc *sch, unsigned long arg, struct gnet_dump *d) | |||
1105 | cl->xstats.ctokens = cl->ctokens; | 1105 | cl->xstats.ctokens = cl->ctokens; |
1106 | 1106 | ||
1107 | if (gnet_stats_copy_basic(d, &cl->bstats) < 0 || | 1107 | if (gnet_stats_copy_basic(d, &cl->bstats) < 0 || |
1108 | gnet_stats_copy_rate_est(d, &cl->rate_est) < 0 || | 1108 | gnet_stats_copy_rate_est(d, NULL, &cl->rate_est) < 0 || |
1109 | gnet_stats_copy_queue(d, &cl->qstats) < 0) | 1109 | gnet_stats_copy_queue(d, &cl->qstats) < 0) |
1110 | return -1; | 1110 | return -1; |
1111 | 1111 | ||