Skip to content

Commit

Permalink
net: sched: factorize code (qdisc_drop())
Browse files Browse the repository at this point in the history
Use qdisc_drop() helper where possible.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Eric Dumazet authored and David S. Miller committed May 4, 2012
1 parent 041441d commit 1704575
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 13 deletions.
8 changes: 3 additions & 5 deletions net/sched/sch_choke.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
3 changes: 1 addition & 2 deletions net/sched/sch_dsmark.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
4 changes: 1 addition & 3 deletions net/sched/sch_htb.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
4 changes: 1 addition & 3 deletions net/sched/sch_teql.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 *
Expand Down

0 comments on commit 1704575

Please sign in to comment.