aboutsummaryrefslogtreecommitdiffstats
path: root/include/net/sch_generic.h
diff options
context:
space:
mode:
authorEric Dumazet <edumazet@google.com>2015-07-06 08:18:03 -0400
committerDavid S. Miller <davem@davemloft.net>2015-07-08 16:50:41 -0400
commit24ea591d2201c3257d666466e8fac50a6cf3c52f (patch)
tree95ae7d3d430f95955c2ab0a19cfffe37d478c4a1 /include/net/sch_generic.h
parent0a6d4245691173eb953c440b8c6fc0b1688e6b25 (diff)
net: sched: extend percpu stats helpers
qdisc_bstats_update_cpu() and other helpers were added to support percpu stats for qdisc. We want to add percpu stats for tc action, so this patch add common helpers. qdisc_bstats_update_cpu() is renamed to qdisc_bstats_cpu_update() qdisc_qstats_drop_cpu() is renamed to qdisc_qstats_cpu_drop() Signed-off-by: Eric Dumazet <edumazet@google.com> Cc: Alexei Starovoitov <ast@plumgrid.com> Acked-by: Jamal Hadi Salim <jhs@mojatatu.com> Acked-by: John Fastabend <john.fastabend@gmail.com> Acked-by: Alexei Starovoitov <ast@plumgrid.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.h31
1 files changed, 21 insertions, 10 deletions
diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h
index 2738f6f87908..2eab08c38e32 100644
--- a/include/net/sch_generic.h
+++ b/include/net/sch_generic.h
@@ -513,17 +513,20 @@ static inline void bstats_update(struct gnet_stats_basic_packed *bstats,
513 bstats->packets += skb_is_gso(skb) ? skb_shinfo(skb)->gso_segs : 1; 513 bstats->packets += skb_is_gso(skb) ? skb_shinfo(skb)->gso_segs : 1;
514} 514}
515 515
516static inline void qdisc_bstats_update_cpu(struct Qdisc *sch, 516static inline void bstats_cpu_update(struct gnet_stats_basic_cpu *bstats,
517 const struct sk_buff *skb) 517 const struct sk_buff *skb)
518{ 518{
519 struct gnet_stats_basic_cpu *bstats =
520 this_cpu_ptr(sch->cpu_bstats);
521
522 u64_stats_update_begin(&bstats->syncp); 519 u64_stats_update_begin(&bstats->syncp);
523 bstats_update(&bstats->bstats, skb); 520 bstats_update(&bstats->bstats, skb);
524 u64_stats_update_end(&bstats->syncp); 521 u64_stats_update_end(&bstats->syncp);
525} 522}
526 523
524static inline void qdisc_bstats_cpu_update(struct Qdisc *sch,
525 const struct sk_buff *skb)
526{
527 bstats_cpu_update(this_cpu_ptr(sch->cpu_bstats), skb);
528}
529
527static inline void qdisc_bstats_update(struct Qdisc *sch, 530static inline void qdisc_bstats_update(struct Qdisc *sch,
528 const struct sk_buff *skb) 531 const struct sk_buff *skb)
529{ 532{
@@ -547,16 +550,24 @@ static inline void __qdisc_qstats_drop(struct Qdisc *sch, int count)
547 sch->qstats.drops += count; 550 sch->qstats.drops += count;
548} 551}
549 552
550static inline void qdisc_qstats_drop(struct Qdisc *sch) 553static inline void qstats_drop_inc(struct gnet_stats_queue *qstats)
551{ 554{
552 sch->qstats.drops++; 555 qstats->drops++;
553} 556}
554 557
555static inline void qdisc_qstats_drop_cpu(struct Qdisc *sch) 558static inline void qstats_overlimit_inc(struct gnet_stats_queue *qstats)
556{ 559{
557 struct gnet_stats_queue *qstats = this_cpu_ptr(sch->cpu_qstats); 560 qstats->overlimits++;
561}
558 562
559 qstats->drops++; 563static inline void qdisc_qstats_drop(struct Qdisc *sch)
564{
565 qstats_drop_inc(&sch->qstats);
566}
567
568static inline void qdisc_qstats_cpu_drop(struct Qdisc *sch)
569{
570 qstats_drop_inc(this_cpu_ptr(sch->cpu_qstats));
560} 571}
561 572
562static inline void qdisc_qstats_overlimit(struct Qdisc *sch) 573static inline void qdisc_qstats_overlimit(struct Qdisc *sch)