Skip to contentSkip to conversation

net: sched: factorize code (qdisc_drop())

PATCH Applied Eric Dumazet 2 participants 2 messages May 4, 2012

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: sched: factorize code (qdisc_drop())

From: Eric Dumazet <[email protected]>

Use qdisc_drop() helper where possible.

---
 net/sched/sch_choke.c  |    8 +++-----
 net/sched/sch_dsmark.c |    3 +--
 net/sched/sch_htb.c    |    4 +---
 net/sched/sch_teql.c   |    4 +---
 4 files changed, 6 insertions(+), 13 deletions(-)
net/sched/sch_choke.c +3 -5
index 81445cc..cc37dd5 100644
@@ -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);
net/sched/sch_dsmark.c +1 -2
index 389b856..3886365 100644
@@ -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;
 }
 
net/sched/sch_htb.c +1 -3
index 2ea6f19..acae5b0 100644
@@ -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) {
net/sched/sch_teql.c +1 -3
index 4532659..ca0c296 100644
@@ -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 *