blob: 0437125dbb08f3c78208f0bc470cc14d23898869 [file] [log] [blame]
From ea1f7f45630c2bbe53cd65583524d954eeb5d91f Mon Sep 17 00:00:00 2001
From: Vinicius Costa Gomes <>
Date: Mon, 14 Oct 2019 13:38:22 -0700
Subject: [PATCH] sched: etf: Fix ordering of packets with same txtime
commit 28aa7c86c2b49f659c8460a89e53b506c45979bb upstream.
When a application sends many packets with the same txtime, they may
be transmitted out of order (different from the order in which they
were enqueued).
This happens because when inserting elements into the tree, when the
txtime of two packets are the same, the new packet is inserted at the
left side of the tree, causing the reordering. The only effect of this
change should be that packets with the same txtime will be transmitted
in the order they are enqueued.
The application in question (the AVTP GStreamer plugin, still in
development) is sending video traffic, in which each video frame have
a single presentation time, the problem is that when packetizing,
multiple packets end up with the same txtime.
The receiving side was rejecting packets because they were being
received out of order.
Fixes: 25db26a91364 ("net/sched: Introduce the ETF Qdisc")
Reported-by: Ederson de Souza <>
Signed-off-by: Vinicius Costa Gomes <>
Signed-off-by: David S. Miller <>
Signed-off-by: Paul Gortmaker <>
diff --git a/net/sched/sch_etf.c b/net/sched/sch_etf.c
index db0c2ba1d156..b244881d2b9a 100644
--- a/net/sched/sch_etf.c
+++ b/net/sched/sch_etf.c
@@ -171,7 +171,7 @@ static int etf_enqueue_timesortedlist(struct sk_buff *nskb, struct Qdisc *sch,
parent = *p;
skb = rb_to_skb(parent);
- if (ktime_after(txtime, skb->tstamp)) {
+ if (ktime_compare(txtime, skb->tstamp) >= 0) {
p = &parent->rb_right;
leftmost = false;
} else {