net: sched: factorize code (qdisc_drop())
authorEric Dumazet <edumazet@google.com>
Fri, 4 May 2012 04:37:21 +0000 (04:37 +0000)
committerDavid S. Miller <davem@davemloft.net>
Fri, 4 May 2012 15:50:05 +0000 (11:50 -0400)
Use qdisc_drop() helper where possible.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/sched/sch_choke.c
net/sched/sch_dsmark.c
net/sched/sch_htb.c
net/sched/sch_teql.c

index 81445cc8196f72c3ad7f3d06ef99e4016be1854f..cc37dd52ecf95dfd7d396fcea2ffc618e11a5101 100644 (file)
@@ -332,15 +332,13 @@ static int choke_enqueue(struct sk_buff *skb, struct Qdisc *sch)
        }
 
        q->stats.pdrop++;
-       sch->qstats.drops++;
-       kfree_skb(skb);
-       return NET_XMIT_DROP;
+       return qdisc_drop(skb, sch);
 
- congestion_drop:
+congestion_drop:
        qdisc_drop(skb, sch);
        return NET_XMIT_CN;
 
- other_drop:
+other_drop:
        if (ret & __NET_XMIT_BYPASS)
                sch->qstats.drops++;
        kfree_skb(skb);
index 389b856c66537eb14b2b7fe0aae49883c503d18f..3886365cc207d139a21efdad996f71b033f3a09a 100644 (file)
@@ -265,8 +265,7 @@ static int dsmark_enqueue(struct sk_buff *skb, struct Qdisc *sch)
        return NET_XMIT_SUCCESS;
 
 drop:
-       kfree_skb(skb);
-       sch->qstats.drops++;
+       qdisc_drop(skb, sch);
        return NET_XMIT_SUCCESS | __NET_XMIT_BYPASS;
 }
 
index 2ea6f196e3c823bcf6760af88b554248d93f165a..acae5b0e3849daf2c8ff411723570e5d5bc83168 100644 (file)
@@ -558,9 +558,7 @@ static int htb_enqueue(struct sk_buff *skb, struct Qdisc *sch)
                        __skb_queue_tail(&q->direct_queue, skb);
                        q->direct_pkts++;
                } else {
-                       kfree_skb(skb);
-                       sch->qstats.drops++;
-                       return NET_XMIT_DROP;
+                       return qdisc_drop(skb, sch);
                }
 #ifdef CONFIG_NET_CLS_ACT
        } else if (!cl) {
index 45326599fda37786e7ac2104e77bbd1bfa2b5083..ca0c29695d51ce9412542c8913484b03845dc025 100644 (file)
@@ -88,9 +88,7 @@ teql_enqueue(struct sk_buff *skb, struct Qdisc *sch)
                return NET_XMIT_SUCCESS;
        }
 
-       kfree_skb(skb);
-       sch->qstats.drops++;
-       return NET_XMIT_DROP;
+       return qdisc_drop(skb, sch);
 }
 
 static struct sk_buff *