Re: [PATCH] sched: QFQ - quick fair queue scheduler (v2)

Eric Dumazet
2011-03-03T16:05:05Z

Le lundi 28 février 2011 à 17:17 -0800, Stephen Hemminger a écrit :

> +static int qfq_dump_class_stats(struct Qdisc *sch, unsigned long arg,
> + struct gnet_dump *d)
> +{
> + struct qfq_class *cl = (struct qfq_class *)arg;
> + struct tc_qfq_stats xstats;
> +
> + memset(&xstats, 0, sizeof(xstats));
> +
> + xstats.weight = ONE_FP/cl->inv_w;
> + xstats.lmax = cl->lmax;
> +

cl->qdisc->qstats.qlen = cl->qdisc->q.qlen;

> + if (gnet_stats_copy_basic(d, &cl->bstats) < 0 ||
> + gnet_stats_copy_rate_est(d, NULL, &cl->rate_est) < 0 ||
> + gnet_stats_copy_queue(d, &cl->qdisc->qstats) < 0)
> + return -1;
> +
> + return gnet_stats_copy_app(d, &xstats, sizeof(xstats));
> +}
> +

using
gnet_stats_copy_rate_est(d, &cl->bstats, &cl->rate_est) < 0

is better : We avoid dumping null rate estimation, if admin never asked
a rate estimation...