@@ -521,11 +521,38 @@ static inline void qdisc_bstats_update(struct Qdisc *sch,
521521 bstats_update (& sch -> bstats , skb );
522522}
523523
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+
524551static inline int __qdisc_enqueue_tail (struct sk_buff * skb , struct Qdisc * sch ,
525552 struct sk_buff_head * list )
526553{
527554 __skb_queue_tail (list , skb );
528- sch -> qstats . backlog += qdisc_pkt_len ( skb );
555+ qdisc_qstats_backlog_inc ( sch , skb );
529556
530557 return NET_XMIT_SUCCESS ;
531558}
@@ -541,7 +568,7 @@ static inline struct sk_buff *__qdisc_dequeue_head(struct Qdisc *sch,
541568 struct sk_buff * skb = __skb_dequeue (list );
542569
543570 if (likely (skb != NULL )) {
544- sch -> qstats . backlog -= qdisc_pkt_len ( skb );
571+ qdisc_qstats_backlog_dec ( sch , skb );
545572 qdisc_bstats_update (sch , skb );
546573 }
547574
@@ -560,7 +587,7 @@ static inline unsigned int __qdisc_queue_drop_head(struct Qdisc *sch,
560587
561588 if (likely (skb != NULL )) {
562589 unsigned int len = qdisc_pkt_len (skb );
563- sch -> qstats . backlog -= len ;
590+ qdisc_qstats_backlog_dec ( sch , skb ) ;
564591 kfree_skb (skb );
565592 return len ;
566593 }
@@ -579,7 +606,7 @@ static inline struct sk_buff *__qdisc_dequeue_tail(struct Qdisc *sch,
579606 struct sk_buff * skb = __skb_dequeue_tail (list );
580607
581608 if (likely (skb != NULL ))
582- sch -> qstats . backlog -= qdisc_pkt_len ( skb );
609+ qdisc_qstats_backlog_dec ( sch , skb );
583610
584611 return skb ;
585612}
@@ -661,14 +688,14 @@ static inline unsigned int qdisc_queue_drop(struct Qdisc *sch)
661688static inline int qdisc_drop (struct sk_buff * skb , struct Qdisc * sch )
662689{
663690 kfree_skb (skb );
664- sch -> qstats . drops ++ ;
691+ qdisc_qstats_drop ( sch ) ;
665692
666693 return NET_XMIT_DROP ;
667694}
668695
669696static inline int qdisc_reshape_fail (struct sk_buff * skb , struct Qdisc * sch )
670697{
671- sch -> qstats . drops ++ ;
698+ qdisc_qstats_drop ( sch ) ;
672699
673700#ifdef CONFIG_NET_CLS_ACT
674701 if (sch -> reshape_fail == NULL || sch -> reshape_fail (skb , sch ))
0 commit comments