aboutsummaryrefslogtreecommitdiffstats
path: root/net/sched/sch_api.c
diff options
context:
space:
mode:
authorJohn Fastabend <john.fastabend@gmail.com>2014-09-28 14:53:57 -0400
committerDavid S. Miller <davem@davemloft.net>2014-09-30 01:02:26 -0400
commit6401585366326fc0ecbc372ec60d1a15cd8be2f5 (patch)
treec3e8f777a579ee8b912e98d06ceb2aa1ffbb6a8b /net/sched/sch_api.c
parent25331d6ce42bcf4b34b6705fce4da15c3fabe62f (diff)
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>
Diffstat (limited to 'net/sched/sch_api.c')
-rw-r--r--net/sched/sch_api.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/net/sched/sch_api.c b/net/sched/sch_api.c
index 2862bc61a358..ca00ea8e84dc 100644
--- a/net/sched/sch_api.c
+++ b/net/sched/sch_api.c
@@ -1318,6 +1318,7 @@ static int tc_fill_qdisc(struct sk_buff *skb, struct Qdisc *q, u32 clid,
1318 unsigned char *b = skb_tail_pointer(skb); 1318 unsigned char *b = skb_tail_pointer(skb);
1319 struct gnet_dump d; 1319 struct gnet_dump d;
1320 struct qdisc_size_table *stab; 1320 struct qdisc_size_table *stab;
1321 __u32 qlen;
1321 1322
1322 cond_resched(); 1323 cond_resched();
1323 nlh = nlmsg_put(skb, portid, seq, event, sizeof(*tcm), flags); 1324 nlh = nlmsg_put(skb, portid, seq, event, sizeof(*tcm), flags);
@@ -1335,7 +1336,7 @@ static int tc_fill_qdisc(struct sk_buff *skb, struct Qdisc *q, u32 clid,
1335 goto nla_put_failure; 1336 goto nla_put_failure;
1336 if (q->ops->dump && q->ops->dump(q, skb) < 0) 1337 if (q->ops->dump && q->ops->dump(q, skb) < 0)
1337 goto nla_put_failure; 1338 goto nla_put_failure;
1338 q->qstats.qlen = q->q.qlen; 1339 qlen = q->q.qlen;
1339 1340
1340 stab = rtnl_dereference(q->stab); 1341 stab = rtnl_dereference(q->stab);
1341 if (stab && qdisc_dump_stab(skb, stab) < 0) 1342 if (stab && qdisc_dump_stab(skb, stab) < 0)
@@ -1353,7 +1354,7 @@ static int tc_fill_qdisc(struct sk_buff *skb, struct Qdisc *q, u32 clid,
1353 1354
1354 if (gnet_stats_copy_basic(&d, cpu_bstats, &q->bstats) < 0 || 1355 if (gnet_stats_copy_basic(&d, cpu_bstats, &q->bstats) < 0 ||
1355 gnet_stats_copy_rate_est(&d, &q->bstats, &q->rate_est) < 0 || 1356 gnet_stats_copy_rate_est(&d, &q->bstats, &q->rate_est) < 0 ||
1356 gnet_stats_copy_queue(&d, &q->qstats) < 0) 1357 gnet_stats_copy_queue(&d, &q->qstats, qlen) < 0)
1357 goto nla_put_failure; 1358 goto nla_put_failure;
1358 1359
1359 if (gnet_stats_finish_copy(&d) < 0) 1360 if (gnet_stats_finish_copy(&d) < 0)