Commit a42b4799 authored by Vijay Subramanian's avatar Vijay Subramanian Committed by David S. Miller

netem: Fix off-by-one bug in reordering

With netem reordering, a gap of N is supposed to reorder every Nth packet with
given reorder probability.  However, the code currently skips N packets and
reorders every (N+1)th packet.
Signed-off-by: default avatarVijay Subramanian <subramanian.vijay@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 803143fb
...@@ -419,7 +419,7 @@ static int netem_enqueue(struct sk_buff *skb, struct Qdisc *sch) ...@@ -419,7 +419,7 @@ static int netem_enqueue(struct sk_buff *skb, struct Qdisc *sch)
cb = netem_skb_cb(skb); cb = netem_skb_cb(skb);
if (q->gap == 0 || /* not doing reordering */ if (q->gap == 0 || /* not doing reordering */
q->counter < q->gap || /* inside last reordering gap */ q->counter < q->gap - 1 || /* inside last reordering gap */
q->reorder < get_crandom(&q->reorder_cor)) { q->reorder < get_crandom(&q->reorder_cor)) {
psched_time_t now; psched_time_t now;
psched_tdiff_t delay; psched_tdiff_t delay;
......
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