diff options
Diffstat (limited to 'include/net/sch_generic.h')
-rw-r--r-- | include/net/sch_generic.h | 39 |
1 files changed, 33 insertions, 6 deletions
diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h index 4b9351120fd8..23a0f0fc83d8 100644 --- a/include/net/sch_generic.h +++ b/include/net/sch_generic.h | |||
@@ -521,11 +521,38 @@ static inline void qdisc_bstats_update(struct Qdisc *sch, | |||
521 | bstats_update(&sch->bstats, skb); | 521 | bstats_update(&sch->bstats, skb); |
522 | } | 522 | } |
523 | 523 | ||
524 | static inline void qdisc_qstats_backlog_dec(struct Qdisc *sch, | ||
525 | const struct sk_buff *skb) | ||
526 | { | ||
527 | sch->qstats.backlog -= qdisc_pkt_len(skb); | ||
528 | } | ||
529 | |||
530 | static inline void qdisc_qstats_backlog_inc(struct Qdisc *sch, | ||
531 | const struct sk_buff *skb) | ||
532 | { | ||
533 | sch->qstats.backlog += qdisc_pkt_len(skb); | ||
534 | } | ||
535 | |||
536 | static inline void __qdisc_qstats_drop(struct Qdisc *sch, int count) | ||
537 | { | ||
538 | sch->qstats.drops += count; | ||
539 | } | ||
540 | |||
541 | static inline void qdisc_qstats_drop(struct Qdisc *sch) | ||
542 | { | ||
543 | sch->qstats.drops++; | ||
544 | } | ||
545 | |||
546 | static inline void qdisc_qstats_overlimit(struct Qdisc *sch) | ||
547 | { | ||
548 | sch->qstats.overlimits++; | ||
549 | } | ||
550 | |||
524 | static inline int __qdisc_enqueue_tail(struct sk_buff *skb, struct Qdisc *sch, | 551 | static inline int __qdisc_enqueue_tail(struct sk_buff *skb, struct Qdisc *sch, |
525 | struct sk_buff_head *list) | 552 | struct sk_buff_head *list) |
526 | { | 553 | { |
527 | __skb_queue_tail(list, skb); | 554 | __skb_queue_tail(list, skb); |
528 | sch->qstats.backlog += qdisc_pkt_len(skb); | 555 | qdisc_qstats_backlog_inc(sch, skb); |
529 | 556 | ||
530 | return NET_XMIT_SUCCESS; | 557 | return NET_XMIT_SUCCESS; |
531 | } | 558 | } |
@@ -541,7 +568,7 @@ static inline struct sk_buff *__qdisc_dequeue_head(struct Qdisc *sch, | |||
541 | struct sk_buff *skb = __skb_dequeue(list); | 568 | struct sk_buff *skb = __skb_dequeue(list); |
542 | 569 | ||
543 | if (likely(skb != NULL)) { | 570 | if (likely(skb != NULL)) { |
544 | sch->qstats.backlog -= qdisc_pkt_len(skb); | 571 | qdisc_qstats_backlog_dec(sch, skb); |
545 | qdisc_bstats_update(sch, skb); | 572 | qdisc_bstats_update(sch, skb); |
546 | } | 573 | } |
547 | 574 | ||
@@ -560,7 +587,7 @@ static inline unsigned int __qdisc_queue_drop_head(struct Qdisc *sch, | |||
560 | 587 | ||
561 | if (likely(skb != NULL)) { | 588 | if (likely(skb != NULL)) { |
562 | unsigned int len = qdisc_pkt_len(skb); | 589 | unsigned int len = qdisc_pkt_len(skb); |
563 | sch->qstats.backlog -= len; | 590 | qdisc_qstats_backlog_dec(sch, skb); |
564 | kfree_skb(skb); | 591 | kfree_skb(skb); |
565 | return len; | 592 | return len; |
566 | } | 593 | } |
@@ -579,7 +606,7 @@ static inline struct sk_buff *__qdisc_dequeue_tail(struct Qdisc *sch, | |||
579 | struct sk_buff *skb = __skb_dequeue_tail(list); | 606 | struct sk_buff *skb = __skb_dequeue_tail(list); |
580 | 607 | ||
581 | if (likely(skb != NULL)) | 608 | if (likely(skb != NULL)) |
582 | sch->qstats.backlog -= qdisc_pkt_len(skb); | 609 | qdisc_qstats_backlog_dec(sch, skb); |
583 | 610 | ||
584 | return skb; | 611 | return skb; |
585 | } | 612 | } |
@@ -661,14 +688,14 @@ static inline unsigned int qdisc_queue_drop(struct Qdisc *sch) | |||
661 | static inline int qdisc_drop(struct sk_buff *skb, struct Qdisc *sch) | 688 | static inline int qdisc_drop(struct sk_buff *skb, struct Qdisc *sch) |
662 | { | 689 | { |
663 | kfree_skb(skb); | 690 | kfree_skb(skb); |
664 | sch->qstats.drops++; | 691 | qdisc_qstats_drop(sch); |
665 | 692 | ||
666 | return NET_XMIT_DROP; | 693 | return NET_XMIT_DROP; |
667 | } | 694 | } |
668 | 695 | ||
669 | static inline int qdisc_reshape_fail(struct sk_buff *skb, struct Qdisc *sch) | 696 | static inline int qdisc_reshape_fail(struct sk_buff *skb, struct Qdisc *sch) |
670 | { | 697 | { |
671 | sch->qstats.drops++; | 698 | qdisc_qstats_drop(sch); |
672 | 699 | ||
673 | #ifdef CONFIG_NET_CLS_ACT | 700 | #ifdef CONFIG_NET_CLS_ACT |
674 | if (sch->reshape_fail == NULL || sch->reshape_fail(skb, sch)) | 701 | if (sch->reshape_fail == NULL || sch->reshape_fail(skb, sch)) |