aboutsummaryrefslogtreecommitdiffstats
path: root/net/sched/sch_api.c
diff options
context:
space:
mode:
authorJohn Fastabend <john.fastabend@gmail.com>2014-09-28 14:54:24 -0400
committerDavid S. Miller <davem@davemloft.net>2014-09-30 01:02:26 -0400
commitb0ab6f92752b9f9d8da980506e9df3bd9dcd7ed3 (patch)
treee8dc1bb9dc3bdce6a62b785b1828efded9f87205 /net/sched/sch_api.c
parent6401585366326fc0ecbc372ec60d1a15cd8be2f5 (diff)
net: sched: enable per cpu qstats
After previous patches to simplify qstats the qstats can be made per cpu with a packed union in Qdisc struct. 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.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/net/sched/sch_api.c b/net/sched/sch_api.c
index ca00ea8e84dc..aa8329508dba 100644
--- a/net/sched/sch_api.c
+++ b/net/sched/sch_api.c
@@ -947,6 +947,10 @@ qdisc_create(struct net_device *dev, struct netdev_queue *dev_queue,
947 alloc_percpu(struct gnet_stats_basic_cpu); 947 alloc_percpu(struct gnet_stats_basic_cpu);
948 if (!sch->cpu_bstats) 948 if (!sch->cpu_bstats)
949 goto err_out4; 949 goto err_out4;
950
951 sch->cpu_qstats = alloc_percpu(struct gnet_stats_queue);
952 if (!sch->cpu_qstats)
953 goto err_out4;
950 } 954 }
951 955
952 if (tca[TCA_STAB]) { 956 if (tca[TCA_STAB]) {
@@ -995,6 +999,7 @@ err_out:
995 999
996err_out4: 1000err_out4:
997 free_percpu(sch->cpu_bstats); 1001 free_percpu(sch->cpu_bstats);
1002 free_percpu(sch->cpu_qstats);
998 /* 1003 /*
999 * Any broken qdiscs that would require a ops->reset() here? 1004 * Any broken qdiscs that would require a ops->reset() here?
1000 * The qdisc was never in action so it shouldn't be necessary. 1005 * The qdisc was never in action so it shouldn't be necessary.
@@ -1313,6 +1318,7 @@ static int tc_fill_qdisc(struct sk_buff *skb, struct Qdisc *q, u32 clid,
1313 u32 portid, u32 seq, u16 flags, int event) 1318 u32 portid, u32 seq, u16 flags, int event)
1314{ 1319{
1315 struct gnet_stats_basic_cpu __percpu *cpu_bstats = NULL; 1320 struct gnet_stats_basic_cpu __percpu *cpu_bstats = NULL;
1321 struct gnet_stats_queue __percpu *cpu_qstats = NULL;
1316 struct tcmsg *tcm; 1322 struct tcmsg *tcm;
1317 struct nlmsghdr *nlh; 1323 struct nlmsghdr *nlh;
1318 unsigned char *b = skb_tail_pointer(skb); 1324 unsigned char *b = skb_tail_pointer(skb);
@@ -1349,12 +1355,14 @@ static int tc_fill_qdisc(struct sk_buff *skb, struct Qdisc *q, u32 clid,
1349 if (q->ops->dump_stats && q->ops->dump_stats(q, &d) < 0) 1355 if (q->ops->dump_stats && q->ops->dump_stats(q, &d) < 0)
1350 goto nla_put_failure; 1356 goto nla_put_failure;
1351 1357
1352 if (qdisc_is_percpu_stats(q)) 1358 if (qdisc_is_percpu_stats(q)) {
1353 cpu_bstats = q->cpu_bstats; 1359 cpu_bstats = q->cpu_bstats;
1360 cpu_qstats = q->cpu_qstats;
1361 }
1354 1362
1355 if (gnet_stats_copy_basic(&d, cpu_bstats, &q->bstats) < 0 || 1363 if (gnet_stats_copy_basic(&d, cpu_bstats, &q->bstats) < 0 ||
1356 gnet_stats_copy_rate_est(&d, &q->bstats, &q->rate_est) < 0 || 1364 gnet_stats_copy_rate_est(&d, &q->bstats, &q->rate_est) < 0 ||
1357 gnet_stats_copy_queue(&d, &q->qstats, qlen) < 0) 1365 gnet_stats_copy_queue(&d, cpu_qstats, &q->qstats, qlen) < 0)
1358 goto nla_put_failure; 1366 goto nla_put_failure;
1359 1367
1360 if (gnet_stats_finish_copy(&d) < 0) 1368 if (gnet_stats_finish_copy(&d) < 0)