net: sched: restrict use of qstats qlen
This removes the use of qstats->qlen variable from the classifiers and makes it an explicit argument to gnet_stats_copy_queue(). The qlen represents the qdisc queue length and is packed into the qstats at the last moment before passnig to user space. By handling it explicitely we avoid, in the percpu stats case, having to figure out which per_cpu variable to put it in. It would probably be best to remove it from qstats completely but qstats is a user space ABI and can't be broken. A future patch could make an internal only qstats structure that would avoid having to allocate an additional u32 variable on the Qdisc struct. This would make the qstats struct 128bits instead of 128+32. Signed-off-by: John Fastabend <john.r.fastabend@intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:

committed by
David S. Miller

parent
25331d6ce4
commit
6401585366
@@ -1138,15 +1138,16 @@ static int
|
||||
htb_dump_class_stats(struct Qdisc *sch, unsigned long arg, struct gnet_dump *d)
|
||||
{
|
||||
struct htb_class *cl = (struct htb_class *)arg;
|
||||
__u32 qlen = 0;
|
||||
|
||||
if (!cl->level && cl->un.leaf.q)
|
||||
cl->qstats.qlen = cl->un.leaf.q->q.qlen;
|
||||
qlen = cl->un.leaf.q->q.qlen;
|
||||
cl->xstats.tokens = PSCHED_NS2TICKS(cl->tokens);
|
||||
cl->xstats.ctokens = PSCHED_NS2TICKS(cl->ctokens);
|
||||
|
||||
if (gnet_stats_copy_basic(d, NULL, &cl->bstats) < 0 ||
|
||||
gnet_stats_copy_rate_est(d, NULL, &cl->rate_est) < 0 ||
|
||||
gnet_stats_copy_queue(d, &cl->qstats) < 0)
|
||||
gnet_stats_copy_queue(d, &cl->qstats, qlen) < 0)
|
||||
return -1;
|
||||
|
||||
return gnet_stats_copy_app(d, &cl->xstats, sizeof(cl->xstats));
|
||||
|
Reference in New Issue
Block a user