Commit 0af90c04 authored by Stephen Hemminger's avatar Stephen Hemminger Committed by David S. Miller

[PKT_SCHED]: Need delayed packet limit in sch_netem.

The netem scheduler needs to limit its delayed packet queue to prevent
a application burst from chewing up too much memory.
Signed-off-by: default avatarStephen Hemminger <shemminger@osdl.org>
Signed-off-by: default avatarDavid S. Miller <davem@redhat.com>
parent 7b4b6d02
...@@ -643,11 +643,17 @@ static int netem_enqueue(struct sk_buff *skb, struct Qdisc *sch) ...@@ -643,11 +643,17 @@ static int netem_enqueue(struct sk_buff *skb, struct Qdisc *sch)
PSCHED_TADD2(now, delay, cb->time_to_send); PSCHED_TADD2(now, delay, cb->time_to_send);
/* Always queue at tail to keep packets in order */ /* Always queue at tail to keep packets in order */
__skb_queue_tail(&q->delayed, skb); if (likely(q->delayed.qlen < q->limit)) {
sch->q.qlen++; __skb_queue_tail(&q->delayed, skb);
sch->stats.bytes += skb->len; sch->q.qlen++;
sch->stats.packets++; sch->stats.bytes += skb->len;
return 0; sch->stats.packets++;
return 0;
}
sch->stats.drops++;
kfree_skb(skb);
return NET_XMIT_DROP;
} }
/* Requeue packets but don't change time stamp */ /* Requeue packets but don't change time stamp */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment