Skip to contentSkip to conversation

net_sched: sch_fq: fix pacing delay underflow with pacing offload

PATCH Applied Willem de Bruijn 2 participants 2 messages Aug 20 – Aug 22

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

PATCH 1/1 net_sched: sch_fq: fix pacing delay underflow with pacing offload

From: Eric Dumazet <[email protected]>

When pacing offload is enabled (q->offload_horizon > 0), FQ can dequeue packets early (now < f->time_next_packet).

In this case, the drift calculation (now - f->time_next_packet) underflows to a large unsigned value.

min(len/2, now - f->time_next_packet) then evaluates to len/2, incorrectly halving the pacing delay for the next packet.

Fix this by only applying drift compensation if now > f->time_next_packet.

This bug was triggered when flow_max_rate was set on the qdisc or for non EDT packets (packets with a zero skb->tstamp).

---
 net/sched/sch_fq.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
net/sched/sch_fq.c +6 -2
index 7cae082a9847..4b5f6d896c6d 100644
@@ -828,8 +828,12 @@ static struct sk_buff *fq_dequeue(struct Qdisc *sch)
 		 * f->time_next_packet was set when prior packet was sent,
 		 * and current time (@now) can be too late by tens of us.
 		 */
-		if (f->time_next_packet)
-			len -= min(len/2, now - f->time_next_packet);
+		if (f->time_next_packet) {
+			s64 drift = now - f->time_next_packet;
+
+			if (drift > 0)
+				len -= min_t(u64, len / 2, drift);
+		}
 		f->time_next_packet = now + len;
 	}
 out:
Signature · 1 line
2.55.0.766.g2966f0265a-goog
#1 lore raw
This patch was applied to netdev/net.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <[email protected]>:

Quoted 9 lines · On Thu, 20 Aug 2026 08:06:25 -0400 you wrote:

From: Eric Dumazet <[email protected]>

When pacing offload is enabled (q->offload_horizon > 0), FQ can dequeue packets early (now < f->time_next_packet).

In this case, the drift calculation (now - f->time_next_packet) underflows to a large unsigned value.

[...]

Here is the summary with links:
- [net] net_sched: sch_fq: fix pacing delay underflow with pacing offload

    https://git.kernel.org/netdev/net/c/137b8ae233ca

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html