* [PATCH net] net_sched: sch_fq: fix pacing delay underflow with pacing offload
@ 2026-08-20 12:06 Willem de Bruijn
0 siblings, 0 replies; only message in thread
From: Willem de Bruijn @ 2026-08-20 12:06 UTC (permalink / raw)
To: netdev; +Cc: davem, kuba, edumazet, pabeni, horms, Willem de Bruijn
From: Eric Dumazet <edumazet@google.com>
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).
Fixes: f26080d47007 ("net_sched: sch_fq: add the ability to offload pacing")
Reported-by: Willem de Bruijn <willemb@google.com>
Closes: https://lore.kernel.org/netdev/CANn89iK6O7ujR9zCJzd04MNLQoDi3mA+HWsR-hgQWYzLS3gZfw@mail.gmail.com/
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Willem de Bruijn <willemb@google.com>
---
net/sched/sch_fq.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/net/sched/sch_fq.c b/net/sched/sch_fq.c
index 7cae082a9847..4b5f6d896c6d 100644
--- a/net/sched/sch_fq.c
+++ b/net/sched/sch_fq.c
@@ -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:
--
2.55.0.766.g2966f0265a-goog
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-08-20 12:07 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-20 12:06 [PATCH net] net_sched: sch_fq: fix pacing delay underflow with pacing offload Willem de Bruijn
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox