diff options
author | John Fastabend <john.fastabend@gmail.com> | 2014-09-28 14:53:29 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-09-30 01:02:26 -0400 |
commit | 25331d6ce42bcf4b34b6705fce4da15c3fabe62f (patch) | |
tree | 1c2d92a220f90f155de62a435753f09ff0c9ce91 /net/sched/sch_sfq.c | |
parent | 22e0f8b9322cb1a48b1357e8f4ae6f5a9eca8cfa (diff) |
net: sched: implement qstat helper routines
This adds helpers to manipulate qstats logic and replaces locations
that touch the counters directly. This simplifies future patches
to push qstats onto per cpu counters.
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_sfq.c')
-rw-r--r-- | net/sched/sch_sfq.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/net/sched/sch_sfq.c b/net/sched/sch_sfq.c index 80c36bd54abc..158dfa641d18 100644 --- a/net/sched/sch_sfq.c +++ b/net/sched/sch_sfq.c | |||
@@ -331,8 +331,8 @@ drop: | |||
331 | sfq_dec(q, x); | 331 | sfq_dec(q, x); |
332 | kfree_skb(skb); | 332 | kfree_skb(skb); |
333 | sch->q.qlen--; | 333 | sch->q.qlen--; |
334 | sch->qstats.drops++; | 334 | qdisc_qstats_drop(sch); |
335 | sch->qstats.backlog -= len; | 335 | qdisc_qstats_backlog_dec(sch, skb); |
336 | return len; | 336 | return len; |
337 | } | 337 | } |
338 | 338 | ||
@@ -379,7 +379,7 @@ sfq_enqueue(struct sk_buff *skb, struct Qdisc *sch) | |||
379 | hash = sfq_classify(skb, sch, &ret); | 379 | hash = sfq_classify(skb, sch, &ret); |
380 | if (hash == 0) { | 380 | if (hash == 0) { |
381 | if (ret & __NET_XMIT_BYPASS) | 381 | if (ret & __NET_XMIT_BYPASS) |
382 | sch->qstats.drops++; | 382 | qdisc_qstats_drop(sch); |
383 | kfree_skb(skb); | 383 | kfree_skb(skb); |
384 | return ret; | 384 | return ret; |
385 | } | 385 | } |
@@ -409,7 +409,7 @@ sfq_enqueue(struct sk_buff *skb, struct Qdisc *sch) | |||
409 | break; | 409 | break; |
410 | 410 | ||
411 | case RED_PROB_MARK: | 411 | case RED_PROB_MARK: |
412 | sch->qstats.overlimits++; | 412 | qdisc_qstats_overlimit(sch); |
413 | if (sfq_prob_mark(q)) { | 413 | if (sfq_prob_mark(q)) { |
414 | /* We know we have at least one packet in queue */ | 414 | /* We know we have at least one packet in queue */ |
415 | if (sfq_headdrop(q) && | 415 | if (sfq_headdrop(q) && |
@@ -426,7 +426,7 @@ sfq_enqueue(struct sk_buff *skb, struct Qdisc *sch) | |||
426 | goto congestion_drop; | 426 | goto congestion_drop; |
427 | 427 | ||
428 | case RED_HARD_MARK: | 428 | case RED_HARD_MARK: |
429 | sch->qstats.overlimits++; | 429 | qdisc_qstats_overlimit(sch); |
430 | if (sfq_hard_mark(q)) { | 430 | if (sfq_hard_mark(q)) { |
431 | /* We know we have at least one packet in queue */ | 431 | /* We know we have at least one packet in queue */ |
432 | if (sfq_headdrop(q) && | 432 | if (sfq_headdrop(q) && |
@@ -461,7 +461,7 @@ congestion_drop: | |||
461 | } | 461 | } |
462 | 462 | ||
463 | enqueue: | 463 | enqueue: |
464 | sch->qstats.backlog += qdisc_pkt_len(skb); | 464 | qdisc_qstats_backlog_inc(sch, skb); |
465 | slot->backlog += qdisc_pkt_len(skb); | 465 | slot->backlog += qdisc_pkt_len(skb); |
466 | slot_queue_add(slot, skb); | 466 | slot_queue_add(slot, skb); |
467 | sfq_inc(q, x); | 467 | sfq_inc(q, x); |
@@ -520,7 +520,7 @@ next_slot: | |||
520 | sfq_dec(q, a); | 520 | sfq_dec(q, a); |
521 | qdisc_bstats_update(sch, skb); | 521 | qdisc_bstats_update(sch, skb); |
522 | sch->q.qlen--; | 522 | sch->q.qlen--; |
523 | sch->qstats.backlog -= qdisc_pkt_len(skb); | 523 | qdisc_qstats_backlog_dec(sch, skb); |
524 | slot->backlog -= qdisc_pkt_len(skb); | 524 | slot->backlog -= qdisc_pkt_len(skb); |
525 | /* Is the slot empty? */ | 525 | /* Is the slot empty? */ |
526 | if (slot->qlen == 0) { | 526 | if (slot->qlen == 0) { |
@@ -586,7 +586,8 @@ static void sfq_rehash(struct Qdisc *sch) | |||
586 | if (x == SFQ_EMPTY_SLOT) { | 586 | if (x == SFQ_EMPTY_SLOT) { |
587 | x = q->dep[0].next; /* get a free slot */ | 587 | x = q->dep[0].next; /* get a free slot */ |
588 | if (x >= SFQ_MAX_FLOWS) { | 588 | if (x >= SFQ_MAX_FLOWS) { |
589 | drop: sch->qstats.backlog -= qdisc_pkt_len(skb); | 589 | drop: |
590 | qdisc_qstats_backlog_dec(sch, skb); | ||
590 | kfree_skb(skb); | 591 | kfree_skb(skb); |
591 | dropped++; | 592 | dropped++; |
592 | continue; | 593 | continue; |