diff options
author | John Fastabend <john.fastabend@gmail.com> | 2014-09-28 14:54:24 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-09-30 01:02:26 -0400 |
commit | b0ab6f92752b9f9d8da980506e9df3bd9dcd7ed3 (patch) | |
tree | e8dc1bb9dc3bdce6a62b785b1828efded9f87205 /include/net/sch_generic.h | |
parent | 6401585366326fc0ecbc372ec60d1a15cd8be2f5 (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 'include/net/sch_generic.h')
-rw-r--r-- | include/net/sch_generic.h | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h index 23a0f0fc83d8..f12669819d1a 100644 --- a/include/net/sch_generic.h +++ b/include/net/sch_generic.h | |||
@@ -90,7 +90,10 @@ struct Qdisc { | |||
90 | struct gnet_stats_basic_cpu __percpu *cpu_bstats; | 90 | struct gnet_stats_basic_cpu __percpu *cpu_bstats; |
91 | } __packed; | 91 | } __packed; |
92 | unsigned int __state; | 92 | unsigned int __state; |
93 | struct gnet_stats_queue qstats; | 93 | union { |
94 | struct gnet_stats_queue qstats; | ||
95 | struct gnet_stats_queue __percpu *cpu_qstats; | ||
96 | } __packed; | ||
94 | struct rcu_head rcu_head; | 97 | struct rcu_head rcu_head; |
95 | int padded; | 98 | int padded; |
96 | atomic_t refcnt; | 99 | atomic_t refcnt; |
@@ -543,6 +546,13 @@ static inline void qdisc_qstats_drop(struct Qdisc *sch) | |||
543 | sch->qstats.drops++; | 546 | sch->qstats.drops++; |
544 | } | 547 | } |
545 | 548 | ||
549 | static inline void qdisc_qstats_drop_cpu(struct Qdisc *sch) | ||
550 | { | ||
551 | struct gnet_stats_queue *qstats = this_cpu_ptr(sch->cpu_qstats); | ||
552 | |||
553 | qstats->drops++; | ||
554 | } | ||
555 | |||
546 | static inline void qdisc_qstats_overlimit(struct Qdisc *sch) | 556 | static inline void qdisc_qstats_overlimit(struct Qdisc *sch) |
547 | { | 557 | { |
548 | sch->qstats.overlimits++; | 558 | sch->qstats.overlimits++; |