* [PATCH net v3 01/10] rxrpc: Fix incorrect unit conversion
[not found] <20261124161302.4044422-1-dhowells@redhat.com>
@ 2026-11-24 16:12 ` David Howells
2026-11-24 16:12 ` [PATCH net v3 02/10] rxrpc: Fix time unit conversion truncation David Howells
` (8 subsequent siblings)
9 siblings, 0 replies; 19+ messages in thread
From: David Howells @ 2026-11-24 16:12 UTC (permalink / raw)
To: netdev
Cc: David Howells, Marc Dionne, Jakub Kicinski, David S. Miller,
Eric Dumazet, Paolo Abeni, Simon Horman, linux-afs, linux-kernel,
Jeffrey Altman, stable
Fix a place in rxrpc_rack_update() where it's mixing a value in
microseconds with a value in nanoseconds.
Fixes: 7c482665931b ("rxrpc: Implement RACK/TLP to deal with transmission stalls [RFC8985]")
Link: https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261020201258.290827-1-dhowells%40redhat.com
Signed-off-by: David Howells <dhowells@redhat.com>
cc: Marc Dionne <marc.dionne@auristor.com>
cc: Jeffrey Altman <jaltman@auristor.com>
cc: Eric Dumazet <edumazet@google.com>
cc: "David S. Miller" <davem@davemloft.net>
cc: Jakub Kicinski <kuba@kernel.org>
cc: Paolo Abeni <pabeni@redhat.com>
cc: Simon Horman <horms@kernel.org>
cc: linux-afs@lists.infradead.org
cc: stable@vger.kernel.org
---
net/rxrpc/input_rack.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/rxrpc/input_rack.c b/net/rxrpc/input_rack.c
index 9eb109ffba56..edd0dee8ac32 100644
--- a/net/rxrpc/input_rack.c
+++ b/net/rxrpc/input_rack.c
@@ -75,7 +75,7 @@ static void rxrpc_rack_update(struct rxrpc_call *call,
/* Use Rx.serial instead of TCP.ACK.ts_option.echo_reply. */
if (before(call->acks_highest_serial, tq->segment_serial[ix]))
return;
- if (rtt < minmax_get(&call->min_rtt))
+ if (rtt < us_to_ktime(minmax_get(&call->min_rtt)))
return;
}
^ permalink raw reply related [flat|nested] 19+ messages in thread* [PATCH net v3 02/10] rxrpc: Fix time unit conversion truncation
[not found] <20261124161302.4044422-1-dhowells@redhat.com>
2026-11-24 16:12 ` [PATCH net v3 01/10] rxrpc: Fix incorrect unit conversion David Howells
@ 2026-11-24 16:12 ` David Howells
2026-11-27 10:13 ` netdev-bot+sashiko
2026-11-24 16:12 ` [PATCH net v3 03/10] rxrpc: Fix carrying of in-flight calc over retransmission David Howells
` (7 subsequent siblings)
9 siblings, 1 reply; 19+ messages in thread
From: David Howells @ 2026-11-24 16:12 UTC (permalink / raw)
To: netdev
Cc: David Howells, Marc Dionne, Jakub Kicinski, David S. Miller,
Eric Dumazet, Paolo Abeni, Simon Horman, linux-afs, linux-kernel,
Jeffrey Altman, stable
Fix three integer truncations on 32-bit arches in which a time unit
conversion is performed that multiplies a 32-bit microsecond value by a
largish number without first casting it to a 64-bit number.
One of these bugs was found by Sashiko and the other two by Claude-opus-5-5
run locally.
Fixes: 7c482665931b ("rxrpc: Implement RACK/TLP to deal with transmission stalls [RFC8985]")
Link: https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261020201258.290827-1-dhowells%40redhat.com
Signed-off-by: David Howells <dhowells@redhat.com>
cc: Marc Dionne <marc.dionne@auristor.com>
cc: Jeffrey Altman <jaltman@auristor.com>
cc: Eric Dumazet <edumazet@google.com>
cc: "David S. Miller" <davem@davemloft.net>
cc: Jakub Kicinski <kuba@kernel.org>
cc: Paolo Abeni <pabeni@redhat.com>
cc: Simon Horman <horms@kernel.org>
cc: linux-afs@lists.infradead.org
cc: stable@vger.kernel.org
---
net/rxrpc/call_event.c | 2 +-
net/rxrpc/input.c | 2 +-
net/rxrpc/input_rack.c | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/net/rxrpc/call_event.c b/net/rxrpc/call_event.c
index 21be9c86d7a7..b102a055c2e0 100644
--- a/net/rxrpc/call_event.c
+++ b/net/rxrpc/call_event.c
@@ -45,7 +45,7 @@ void rxrpc_propose_delay_ACK(struct rxrpc_call *call, rxrpc_serial_t serial,
trace_rxrpc_propose_ack(call, why, RXRPC_ACK_DELAY, serial);
if (call->srtt_us)
- delay = (call->srtt_us >> 3) * NSEC_PER_USEC;
+ delay = ns_to_ktime((u64)call->srtt_us * (NSEC_PER_USEC / 8));
else
delay = ms_to_ktime(READ_ONCE(rxrpc_soft_ack_delay));
ktime_add_ms(delay, call->tx_backoff);
diff --git a/net/rxrpc/input.c b/net/rxrpc/input.c
index 73cafe6bfa9f..bda6e7d77013 100644
--- a/net/rxrpc/input.c
+++ b/net/rxrpc/input.c
@@ -185,7 +185,7 @@ void rxrpc_congestion_degrade(struct rxrpc_call *call)
__rxrpc_call_state(call) == RXRPC_CALL_CLIENT_AWAIT_REPLY)
return;
- rtt = ns_to_ktime(call->srtt_us * (NSEC_PER_USEC / 8));
+ rtt = ns_to_ktime((u64)call->srtt_us * (NSEC_PER_USEC / 8));
now = ktime_get_real();
time_since = ktime_sub(now, call->tx_last_sent);
if (ktime_before(time_since, rtt))
diff --git a/net/rxrpc/input_rack.c b/net/rxrpc/input_rack.c
index edd0dee8ac32..24903eb722b9 100644
--- a/net/rxrpc/input_rack.c
+++ b/net/rxrpc/input_rack.c
@@ -296,7 +296,7 @@ ktime_t rxrpc_tlp_calc_pto(struct rxrpc_call *call, ktime_t now)
if (call->rtt_count > 0) {
/* Use 2*SRTT as the timeout. */
- pto = ns_to_ktime(call->srtt_us * NSEC_PER_USEC / 4);
+ pto = ns_to_ktime((u64)call->srtt_us * (NSEC_PER_USEC / 4));
if (flight_size)
pto = ktime_add(pto, call->tlp_max_ack_delay);
} else {
^ permalink raw reply related [flat|nested] 19+ messages in thread* Re: [PATCH net v3 02/10] rxrpc: Fix time unit conversion truncation
2026-11-24 16:12 ` [PATCH net v3 02/10] rxrpc: Fix time unit conversion truncation David Howells
@ 2026-11-27 10:13 ` netdev-bot+sashiko
0 siblings, 0 replies; 19+ messages in thread
From: netdev-bot+sashiko @ 2026-11-27 10:13 UTC (permalink / raw)
To: dhowells
Cc: netdev, marc.dionne, kuba, davem, edumazet, pabeni, horms,
linux-afs, linux-kernel, jaltman, stable
Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.
Low priority / nit picks for your consideration:
- [Low] The Fixes tag is incomplete, so stable backports of this fix will
miss some LTS trees.
--
rxrpc: Fix time unit conversion truncation
This commit adds u64 casts to the srtt_us conversions in
rxrpc_propose_delay_ACK(), rxrpc_congestion_degrade() and
rxrpc_tlp_calc_pto(). Without the cast, the multiply by an NSEC_PER_USEC
factor truncates on 32-bit arches.
Link: https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261020201258.290827-1-dhowells%40redhat.com
> Fixes: 7c482665931b ("rxrpc: Implement RACK/TLP to deal with transmission stalls [RFC8985]")
> Link: https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261020201258.290827-1-dhowells%40redhat.com
> Signed-off-by: David Howells <dhowells@redhat.com>
[ ... ]
> cc: stable@vger.kernel.org
[Severity: Low]
Should this patch carry more Fixes tags? Of the three hunks, only the
rxrpc_tlp_calc_pto() one in net/rxrpc/input_rack.c seems to come from
7c482665931b:
pto = ns_to_ktime(call->srtt_us * NSEC_PER_USEC / 4);
The conversion in rxrpc_congestion_degrade() in net/rxrpc/input.c seems
to go back to 5086d9a9dfec (v6.2), where it read:
rtt = ns_to_ktime(call->peer->srtt_us * (1000 / 8));
That multiply is u32 * int, so it truncates on 64-bit arches as well.
b40ef2b85a7d ("Manage RTT per-call rather than per-peer") later changed
it to the current form, which fixed 64-bit builds as a side effect.
The conversion in rxrpc_propose_delay_ACK() in net/rxrpc/call_event.c
seems to come from 153f90a066dd (v6.9):
delay = (call->peer->srtt_us >> 3) * NSEC_PER_USEC;
The patch is marked for stable but only names 7c482665931b. Will the
stable tooling then skip trees that have the older truncations but not
the RACK/TLP commit? For example, 6.12 has both of the older ones. 6.6
has the input.c one, which is broken on all arches there.
Those trees also use call->peer->srtt_us, so they would need a tailored
backport.
Could Fixes tags for 5086d9a9dfec and 153f90a066dd be added? If not,
could the commit message say what the older trees need?
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261124161302.4044422-1-dhowells%40redhat.com
^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH net v3 03/10] rxrpc: Fix carrying of in-flight calc over retransmission
[not found] <20261124161302.4044422-1-dhowells@redhat.com>
2026-11-24 16:12 ` [PATCH net v3 01/10] rxrpc: Fix incorrect unit conversion David Howells
2026-11-24 16:12 ` [PATCH net v3 02/10] rxrpc: Fix time unit conversion truncation David Howells
@ 2026-11-24 16:12 ` David Howells
2026-11-27 10:13 ` netdev-bot+sashiko
2026-11-24 16:12 ` [PATCH net v3 04/10] rxrpc: Fix ack parsing to mark reneged ACKs as lost for RACK-TLP David Howells
` (6 subsequent siblings)
9 siblings, 1 reply; 19+ messages in thread
From: David Howells @ 2026-11-24 16:12 UTC (permalink / raw)
To: netdev
Cc: David Howells, Marc Dionne, Jakub Kicinski, David S. Miller,
Eric Dumazet, Paolo Abeni, Simon Horman, linux-afs, linux-kernel,
Jeffrey Altman, stable
rxrpc_tlp_send_probe() calculates the in_flight value at the top of the
function and then doesn't use it till the bottom of the function - after it
may have done (re-)transmission, which would change the value (though it is
recalculated in one place).
Fix this by calculating that value at the point it is needed.
Fixes: 7c482665931b ("rxrpc: Implement RACK/TLP to deal with transmission stalls [RFC8985]")
Link: https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261020201258.290827-1-dhowells%40redhat.com
Signed-off-by: David Howells <dhowells@redhat.com>
cc: Marc Dionne <marc.dionne@auristor.com>
cc: Jeffrey Altman <jaltman@auristor.com>
cc: Eric Dumazet <edumazet@google.com>
cc: "David S. Miller" <davem@davemloft.net>
cc: Jakub Kicinski <kuba@kernel.org>
cc: Paolo Abeni <pabeni@redhat.com>
cc: Simon Horman <horms@kernel.org>
cc: linux-afs@lists.infradead.org
cc: stable@vger.kernel.org
---
net/rxrpc/input_rack.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/net/rxrpc/input_rack.c b/net/rxrpc/input_rack.c
index 24903eb722b9..87084cea88b1 100644
--- a/net/rxrpc/input_rack.c
+++ b/net/rxrpc/input_rack.c
@@ -313,8 +313,6 @@ ktime_t rxrpc_tlp_calc_pto(struct rxrpc_call *call, ktime_t now)
*/
void rxrpc_tlp_send_probe(struct rxrpc_call *call)
{
- unsigned int in_flight = rxrpc_tx_in_flight(call);
-
if (after_eq(call->acks_hard_ack, call->tx_transmitted))
return; /* Everything we transmitted has been acked. */
@@ -333,7 +331,6 @@ void rxrpc_tlp_send_probe(struct rxrpc_call *call)
call->tlp_serial = call->tx_last_serial;
call->tlp_seq = call->tx_transmitted;
trace_rxrpc_tlp_probe(call, rxrpc_tlp_probe_trace_transmit_new);
- in_flight = rxrpc_tx_in_flight(call);
} else {
/* Retransmit the highest-sequence DATA sent */
call->tx_last_serial = 0;
@@ -345,7 +342,7 @@ void rxrpc_tlp_send_probe(struct rxrpc_call *call)
trace_rxrpc_tlp_probe(call, rxrpc_tlp_probe_trace_busy);
}
- if (in_flight != 0) {
+ if (rxrpc_tx_in_flight(call) != 0) {
ktime_t rto = rxrpc_get_rto_backoff(call, false);
call->rack_timer_mode = RXRPC_CALL_RACKTIMER_RTO;
^ permalink raw reply related [flat|nested] 19+ messages in thread* Re: [PATCH net v3 03/10] rxrpc: Fix carrying of in-flight calc over retransmission
2026-11-24 16:12 ` [PATCH net v3 03/10] rxrpc: Fix carrying of in-flight calc over retransmission David Howells
@ 2026-11-27 10:13 ` netdev-bot+sashiko
0 siblings, 0 replies; 19+ messages in thread
From: netdev-bot+sashiko @ 2026-11-27 10:13 UTC (permalink / raw)
To: dhowells
Cc: netdev, marc.dionne, kuba, davem, edumazet, pabeni, horms,
linux-afs, linux-kernel, jaltman, stable
Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.
Low priority / nit picks for your consideration:
- [Low] The commit message for "rxrpc: Fix carrying of in-flight calc
over retransmission" explains the mechanism: in_flight was computed at…
--
rxrpc: Fix carrying of in-flight calc over retransmission
In rxrpc_tlp_send_probe(), this commit moves the rxrpc_tx_in_flight()
calculation to the point where the value is used. The value then reflects
any (re-)transmission done by the TLP probe. Before this patch it was only
refreshed after new data was sent, and not after the rxrpc_resend_tlp()
retransmit path.
Link: https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261020201258.290827-1-dhowells%40redhat.com
> rxrpc_tlp_send_probe() calculates the in_flight value at the top of the
> function and then doesn't use it till the bottom of the function - after it
> may have done (re-)transmission, which would change the value (though it is
> recalculated in one place).
>
> Fix this by calculating that value at the point it is needed.
[Severity: Low]
This isn't a bug, but could the commit message also say what goes wrong
because of the stale value? The patch is Cc'd to stable, and backporters
would find the user-visible impact useful.
In rxrpc_rack_timer_expired(), the timer mode is cleared before the probe
is sent:
net/rxrpc/input_rack.c:rxrpc_rack_timer_expired() {
...
call->rack_timer_mode = RXRPC_CALL_RACKTIMER_OFF;
switch (mode) {
...
case RXRPC_CALL_RACKTIMER_TLP_PTO:
rxrpc_tlp_send_probe(call);
break;
...
}
In the retransmit branch of rxrpc_tlp_send_probe(), the call to
rxrpc_resend_tlp() increments tx_nr_resent and may decrement tx_nr_lost.
Both raise rxrpc_tx_in_flight(), but that branch never refreshed
in_flight.
Suppose in_flight was 0 on entry: every outstanding segment had been
SACKed or marked lost, but acks_hard_ack was still before tx_transmitted.
After the retransmission, the old code then skipped this block:
if (in_flight != 0) {
ktime_t rto = rxrpc_get_rto_backoff(call, false);
call->rack_timer_mode = RXRPC_CALL_RACKTIMER_RTO;
That left the RACK timer at RXRPC_CALL_RACKTIMER_OFF with no RTO armed
behind the probe.
Could the message add something like "no RTO was armed after a TLP
retransmission, so the call could stall until another timer fired or an
ACK arrived"?
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261124161302.4044422-1-dhowells%40redhat.com
^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH net v3 04/10] rxrpc: Fix ack parsing to mark reneged ACKs as lost for RACK-TLP
[not found] <20261124161302.4044422-1-dhowells@redhat.com>
` (2 preceding siblings ...)
2026-11-24 16:12 ` [PATCH net v3 03/10] rxrpc: Fix carrying of in-flight calc over retransmission David Howells
@ 2026-11-24 16:12 ` David Howells
2026-11-27 10:13 ` netdev-bot+sashiko
2026-11-24 16:12 ` [PATCH net v3 05/10] rxrpc: Fix RTT processing for a presumed lost packet getting ACK'd David Howells
` (5 subsequent siblings)
9 siblings, 1 reply; 19+ messages in thread
From: David Howells @ 2026-11-24 16:12 UTC (permalink / raw)
To: netdev
Cc: David Howells, Marc Dionne, Jakub Kicinski, David S. Miller,
Eric Dumazet, Paolo Abeni, Simon Horman, linux-afs, linux-kernel,
Jeffrey Altman, stable
If an packet that was ACK'd becomes NAK'd (ie. the peer discarded it), the
now-missing packet is not picked up by the RACK-TLP implementation.
Fix this by marking reneged ACKs as lost immediately.
Fixes: 7c482665931b ("rxrpc: Implement RACK/TLP to deal with transmission stalls [RFC8985]")
Link: https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261020201258.290827-1-dhowells%40redhat.com
Signed-off-by: David Howells <dhowells@redhat.com>
cc: Marc Dionne <marc.dionne@auristor.com>
cc: Jeffrey Altman <jaltman@auristor.com>
cc: Eric Dumazet <edumazet@google.com>
cc: "David S. Miller" <davem@davemloft.net>
cc: Jakub Kicinski <kuba@kernel.org>
cc: Paolo Abeni <pabeni@redhat.com>
cc: Simon Horman <horms@kernel.org>
cc: linux-afs@lists.infradead.org
cc: stable@vger.kernel.org
---
net/rxrpc/ar-internal.h | 3 ++-
net/rxrpc/input.c | 6 +++---
net/rxrpc/input_rack.c | 11 ++++++++++-
3 files changed, 15 insertions(+), 5 deletions(-)
diff --git a/net/rxrpc/ar-internal.h b/net/rxrpc/ar-internal.h
index 865f05fe37ab..d88dd02b6ab5 100644
--- a/net/rxrpc/ar-internal.h
+++ b/net/rxrpc/ar-internal.h
@@ -1256,7 +1256,8 @@ void rxrpc_input_rack_one(struct rxrpc_call *call,
void rxrpc_input_rack(struct rxrpc_call *call,
struct rxrpc_ack_summary *summary,
struct rxrpc_txqueue *tq,
- unsigned long new_acks);
+ unsigned long new_acks,
+ unsigned long reneged_acks);
void rxrpc_rack_detect_loss_and_arm_timer(struct rxrpc_call *call,
struct rxrpc_ack_summary *summary);
ktime_t rxrpc_tlp_calc_pto(struct rxrpc_call *call, ktime_t now);
diff --git a/net/rxrpc/input.c b/net/rxrpc/input.c
index bda6e7d77013..9b02e36264aa 100644
--- a/net/rxrpc/input.c
+++ b/net/rxrpc/input.c
@@ -888,7 +888,7 @@ static void rxrpc_input_soft_ack_tq(struct rxrpc_call *call,
rxrpc_seq_t *lowest_nak)
{
unsigned long old_reported = 0, flipped, new_acks = 0;
- unsigned long a_to_n, n_to_a = 0;
+ unsigned long a_to_n = 0, n_to_a = 0;
int new, a, n;
if (tq->nr_reported_acks > 0)
@@ -951,8 +951,8 @@ static void rxrpc_input_soft_ack_tq(struct rxrpc_call *call,
rxrpc_input_soft_rtt(call, summary, tq);
new_acks |= n_to_a;
- if (new_acks)
- rxrpc_input_rack(call, summary, tq, new_acks);
+ if (new_acks || a_to_n)
+ rxrpc_input_rack(call, summary, tq, new_acks, a_to_n);
if (call->tlp_serial &&
rxrpc_seq_in_txq(tq, call->tlp_seq) &&
diff --git a/net/rxrpc/input_rack.c b/net/rxrpc/input_rack.c
index 87084cea88b1..c4276534f539 100644
--- a/net/rxrpc/input_rack.c
+++ b/net/rxrpc/input_rack.c
@@ -130,8 +130,17 @@ void rxrpc_input_rack_one(struct rxrpc_call *call,
void rxrpc_input_rack(struct rxrpc_call *call,
struct rxrpc_ack_summary *summary,
struct rxrpc_txqueue *tq,
- unsigned long new_acks)
+ unsigned long new_acks,
+ unsigned long reneged_acks)
{
+ /* Packets that got un-ACK'd get marked lost. */
+ while (reneged_acks) {
+ unsigned int ix = __ffs(reneged_acks);
+
+ __clear_bit(ix, &reneged_acks);
+ rxrpc_rack_mark_lost(call, tq, ix);
+ }
+
while (new_acks) {
unsigned int ix = __ffs(new_acks);
^ permalink raw reply related [flat|nested] 19+ messages in thread* Re: [PATCH net v3 04/10] rxrpc: Fix ack parsing to mark reneged ACKs as lost for RACK-TLP
2026-11-24 16:12 ` [PATCH net v3 04/10] rxrpc: Fix ack parsing to mark reneged ACKs as lost for RACK-TLP David Howells
@ 2026-11-27 10:13 ` netdev-bot+sashiko
0 siblings, 0 replies; 19+ messages in thread
From: netdev-bot+sashiko @ 2026-11-27 10:13 UTC (permalink / raw)
To: dhowells
Cc: netdev, marc.dionne, kuba, davem, edumazet, pabeni, horms,
linux-afs, linux-kernel, jaltman, stable
Thank you for your contribution! Sashiko AI review found 3 potential
issue(s) to consider.
Critical: 0 · High: 1 · Medium: 1 · Low: 1
If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).
- [High] The fix only finds reneged ACKs in txqueues that
rxrpc_input_soft_ack_tq() is actually called on.
- [Medium] Every ACK->NAK flip in the previously reported range now
counts as definite loss and is retransmitted at once, with no…
- [Low] The commit message overstates the bug.
--
rxrpc: Fix ack parsing to mark reneged ACKs as lost for RACK-TLP
This patch passes the ACK->NAK flip mask (a_to_n) from
rxrpc_input_soft_ack_tq() into rxrpc_input_rack(). rxrpc_input_rack() now
calls rxrpc_rack_mark_lost() on each reneged packet before it processes
the new ACKs. The aim is for RACK-TLP to pick up packets that the peer
discarded after soft-ACKing them.
Link: https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261020201258.290827-1-dhowells%40redhat.com
> If an packet that was ACK'd becomes NAK'd (ie. the peer discarded it), the
> now-missing packet is not picked up by the RACK-TLP implementation.
[Severity: Low]
Is this description accurate?
Before this patch, rxrpc_input_soft_ack_tq() already stored the new bitmap
in tq->segment_acked before RACK ran. After that, rxrpc_input_ack() calls
rxrpc_rack_detect_loss_and_arm_timer().
rxrpc_rack_detect_loss() takes its candidates from rxrpc_tq_nacks(), which
is ~segment_acked masked to nr_reported_acks. A reneged packet inside the
reported range is therefore included:
unsigned long nacks = rxrpc_tq_nacks(tq);
...
nacks &= ~tq->segment_lost | tq->segment_retransmitted;
rxrpc_rack_update() cleared segment_lost when the packet was first
soft-ACK'd, and segment_xmit_ts still holds the real send time. So
rxrpc_rack_sent_after() returns true for every reneged packet except two
kinds:
- the RACK.segment itself
- retransmitted packets whose RACK update was skipped
All the others were marked lost once xmit_ts + rack_rtt + reo_wnd had
passed, or the reorder timer was armed for them.
The real gap looks narrower than the message says. The patch also changes
the policy: reneged packets are now marked lost immediately and
unconditionally, with no reordering window.
Since this is Cc'd to stable, could the commit message say what was
actually being missed, and why skipping the reorder window is intended?
> diff --git a/net/rxrpc/input.c b/net/rxrpc/input.c
> index bda6e7d77013e..9b02e36264aa4 100644
> --- a/net/rxrpc/input.c
> +++ b/net/rxrpc/input.c
[ ... ]
> @@ -951,8 +951,8 @@ static void rxrpc_input_soft_ack_tq(struct rxrpc_call *call,
> rxrpc_input_soft_rtt(call, summary, tq);
>
> new_acks |= n_to_a;
> - if (new_acks)
> - rxrpc_input_rack(call, summary, tq, new_acks);
> + if (new_acks || a_to_n)
> + rxrpc_input_rack(call, summary, tq, new_acks, a_to_n);
[Severity: High]
Can reneged packets in a txqueue past the end of a shorter SACK table still
be missed?
rxrpc_input_soft_acks() only calls rxrpc_input_soft_ack_tq() for txqueues
that the current nr_acks covers. It calls it once at each full 64-slot
boundary, and once for the tail only when nr != 0:
if (nr) {
unsigned int nr_reported = seq & RXRPC_TXQ_MASK;
extracted >>= RXRPC_NR_TXQUEUE - nr_reported;
...
rxrpc_input_soft_ack_tq(call, summary, tq, extracted, nr_reported,
Consider this sequence:
- an earlier ACK soft-ACKs packets in txqueue N+1
- the peer discards them
- the peer sends an ACK with the same firstPacket whose table ends
inside txqueue N, or exactly on its boundary
In that case txqueue N+1 is never visited. At runtime, only
rxrpc_input_soft_ack_tq() writes tq->segment_acked and
tq->nr_reported_acks. So the stale ACK bits stay set, a_to_n is never
computed for that txqueue, and the new path in rxrpc_input_rack() never
runs for it.
The existing fallbacks work from the same stale bits, so they skip these
packets too:
rxrpc_tq_nacks():
unsigned long nacks = ~tq->segment_acked;
rxrpc_rack_mark_losses_on_rto():
unsigned long unacked = ~tq->segment_acked;
As far as I can tell, nothing marks these packets lost until a later ACK's
table reaches that txqueue again, for example after a TLP probe.
This also differs from the case where the table shrinks inside a single
txqueue. There, the tail shift zeroes the dropped slots and they get
marked lost immediately.
The comment in rxrpc_input_soft_acks() says the peer is permitted to drop
soft-acked packets and that the nack count can go down, so this case is
expected.
With the in_flight tracking at the end of this series, these packets are
also removed from tx_in_flight when first soft-ACK'd. If nothing else is in
flight, the tx_in_flight > 0 RTO rearm in rxrpc_input_call_event() won't
fire, so no timer may be left to drive recovery.
>
> if (call->tlp_serial &&
> rxrpc_seq_in_txq(tq, call->tlp_seq) &&
> diff --git a/net/rxrpc/input_rack.c b/net/rxrpc/input_rack.c
> index 87084cea88b1a..c4276534f5398 100644
> --- a/net/rxrpc/input_rack.c
> +++ b/net/rxrpc/input_rack.c
> @@ -130,8 +130,17 @@ void rxrpc_input_rack_one(struct rxrpc_call *call,
> void rxrpc_input_rack(struct rxrpc_call *call,
> struct rxrpc_ack_summary *summary,
> struct rxrpc_txqueue *tq,
> - unsigned long new_acks)
> + unsigned long new_acks,
> + unsigned long reneged_acks)
> {
> + /* Packets that got un-ACK'd get marked lost. */
> + while (reneged_acks) {
> + unsigned int ix = __ffs(reneged_acks);
> +
> + __clear_bit(ix, &reneged_acks);
> + rxrpc_rack_mark_lost(call, tq, ix);
[Severity: Medium]
Could this mark packets lost that the peer never actually reneged on?
rxrpc_input_soft_ack_tq() computes a_to_n from any flip within
old_reported:
flipped = (tq->segment_acked ^ extracted_acks) & old_reported;
if (flipped) {
n_to_a = ~tq->segment_acked & flipped; /* Old NAK -> ACK */
a_to_n = tq->segment_acked & flipped; /* Old ACK -> NAK */
Two cases seem to produce flips that are not reneging.
First, rxrpc_is_ack_valid() accepts an ACK whose firstPacket is unchanged
and whose previousPacket has regressed, as long as it stays within
base + tx_winsize:
if (after(prev_pkt, base + call->tx_winsize))
return false;
return true;
So a stale ACK that was reordered in the network is fully processed.
Packets that a newer ACK had soft-ACK'd then show up in a_to_n.
Second, for the tail txqueue, rxrpc_input_soft_acks() does:
extracted >>= RXRPC_NR_TXQUEUE - nr_reported;
This zeroes every bit at or above the new nr_reported, but old_reported
still covers the old, larger nr_reported_acks. When a later ACK has a
shorter SACK table, each slot that drops off the end counts as an a_to_n
flip.
Before this patch, in-range flips went through the RACK reorder window
(rack_rtt + reo_wnd). Slots beyond the new nr_reported were masked out by
rxrpc_tq_nacks() and left to the RTO.
Now rxrpc_rack_mark_lost() is called on all of them, which increments
tx_nr_lost and sets segment_xmit_ts to UINT_MAX. rxrpc_input_call_event()
then calls rxrpc_resend(), unless a newer ACK in the same batch reverses
the flip.
This conflicts with the comment above rxrpc_input_soft_acks(), which says
packets beyond the end of the ACK list are left to the timer because the
peer may not have processed them yet.
Is the extra retransmission on reordered or shortened ACKs intended?
> + }
> +
> while (new_acks) {
> unsigned int ix = __ffs(new_acks);
>
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261124161302.4044422-1-dhowells%40redhat.com
^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH net v3 05/10] rxrpc: Fix RTT processing for a presumed lost packet getting ACK'd
[not found] <20261124161302.4044422-1-dhowells@redhat.com>
` (3 preceding siblings ...)
2026-11-24 16:12 ` [PATCH net v3 04/10] rxrpc: Fix ack parsing to mark reneged ACKs as lost for RACK-TLP David Howells
@ 2026-11-24 16:12 ` David Howells
2026-11-27 10:13 ` netdev-bot+sashiko
2026-11-24 16:12 ` [PATCH net v3 06/10] rxrpc: Fix lost driving of congestion management retransmission timeout David Howells
` (4 subsequent siblings)
9 siblings, 1 reply; 19+ messages in thread
From: David Howells @ 2026-11-24 16:12 UTC (permalink / raw)
To: netdev
Cc: David Howells, Marc Dionne, Jakub Kicinski, David S. Miller,
Eric Dumazet, Paolo Abeni, Simon Horman, linux-afs, linux-kernel,
Jeffrey Altman, stable
With RACK-TLP, under some circumstances a packet that is presumed lost has
its xmit timestamp reset when it is marked lost. However, if an ACK then
turns up anyway, rxrpc_rack_update() sees a bad RTT calculation because the
xmit_ts is calculated as being KTIME_MAX.
Fix this by skipping the RTT processing in such a case.
Fixes: 7c482665931b ("rxrpc: Implement RACK/TLP to deal with transmission stalls [RFC8985]")
Signed-off-by: David Howells <dhowells@redhat.com>
cc: Marc Dionne <marc.dionne@auristor.com>
cc: Jeffrey Altman <jaltman@auristor.com>
cc: Eric Dumazet <edumazet@google.com>
cc: "David S. Miller" <davem@davemloft.net>
cc: Jakub Kicinski <kuba@kernel.org>
cc: Paolo Abeni <pabeni@redhat.com>
cc: Simon Horman <horms@kernel.org>
cc: linux-afs@lists.infradead.org
cc: stable@vger.kernel.org
---
net/rxrpc/input_rack.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/net/rxrpc/input_rack.c b/net/rxrpc/input_rack.c
index c4276534f539..e5288e5beb59 100644
--- a/net/rxrpc/input_rack.c
+++ b/net/rxrpc/input_rack.c
@@ -71,6 +71,12 @@ static void rxrpc_rack_update(struct rxrpc_call *call,
if (__test_and_clear_bit(ix, &tq->segment_lost))
call->tx_nr_lost--;
+ /* A packet may get marked lost and then ACK'd before we get to
+ * retransmitting which can result in xmit_ts having been reset.
+ */
+ if (tq->segment_xmit_ts[ix] == UINT_MAX)
+ return;
+
if (test_bit(ix, &tq->segment_retransmitted)) {
/* Use Rx.serial instead of TCP.ACK.ts_option.echo_reply. */
if (before(call->acks_highest_serial, tq->segment_serial[ix]))
^ permalink raw reply related [flat|nested] 19+ messages in thread* Re: [PATCH net v3 05/10] rxrpc: Fix RTT processing for a presumed lost packet getting ACK'd
2026-11-24 16:12 ` [PATCH net v3 05/10] rxrpc: Fix RTT processing for a presumed lost packet getting ACK'd David Howells
@ 2026-11-27 10:13 ` netdev-bot+sashiko
0 siblings, 0 replies; 19+ messages in thread
From: netdev-bot+sashiko @ 2026-11-27 10:13 UTC (permalink / raw)
To: dhowells
Cc: netdev, marc.dionne, kuba, davem, edumazet, pabeni, horms,
linux-afs, linux-kernel, jaltman, stable
Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.
Low priority / nit picks for your consideration:
- [Low] The commit message for "rxrpc: Fix RTT processing for a presumed
lost packet getting ACK'd" understates the impact of the bug.
--
rxrpc: Fix RTT processing for a presumed lost packet getting ACK'd
This patch makes rxrpc_rack_update() return early when the ACK'd segment
has had its segment_xmit_ts[] reset to UINT_MAX by rxrpc_rack_mark_lost().
Without this check, rxrpc_get_xmit_ts() returns KTIME_MAX and the RTT is
calculated from that value.
> With RACK-TLP, under some circumstances a packet that is presumed lost has
> its xmit timestamp reset when it is marked lost. However, if an ACK then
> turns up anyway, rxrpc_rack_update() sees a bad RTT calculation because the
> xmit_ts is calculated as being KTIME_MAX.
[Severity: Low]
The code change looks correct. Could the commit message say more about
what the bad calculation leads to? A single bad RTT sample is only part of
the effect.
Before this fix, take a segment that was never retransmitted. Its xmit_ts
is KTIME_MAX, so rtt = acks_latest_ts - KTIME_MAX is a large negative
value. Both update branches at the end of rxrpc_rack_update() then fire:
net/rxrpc/input_rack.c:rxrpc_rack_update() {
...
if (ktime_after(xmit_ts, call->rack_rtt_ts)) {
call->rack_rtt = rtt;
call->rack_rtt_ts = xmit_ts;
}
if (rxrpc_rack_sent_after(xmit_ts, seq, call->rack_xmit_ts, call->rack_end_seq)) {
call->rack_rtt = rtt;
call->rack_xmit_ts = xmit_ts;
...
}
This leaves call->rack_rtt_ts and call->rack_xmit_ts at KTIME_MAX and
call->rack_rtt negative. These fields are only written here and are never
reset. No real xmit_ts can be after KTIME_MAX, so the state stays this way
for the rest of the call.
After that, rxrpc_rack_detect_loss() computes lost_after from the negative
rack_rtt. Also, rxrpc_rack_sent_after(call->rack_xmit_ts, ...) is true for
every segment:
net/rxrpc/input_rack.c:rxrpc_rack_detect_loss() {
...
if (rxrpc_rack_sent_after(call->rack_xmit_ts, call->rack_end_seq,
xmit_ts, seq)) {
remaining = ktime_sub(ktime_add(xmit_ts, lost_after), now);
if (remaining <= 0) {
rxrpc_rack_mark_lost(call, tq, ix);
...
}
So remaining is always <= 0. On every later ACK, each segment that was
reported but not ACK'd is marked lost straight away, with no reordering
tolerance. This includes segments that were already retransmitted, and
the result is spurious retransmissions.
rxrpc_rack_mark_losses_on_rto() is affected too. With the corrupted
rack_rtt, deadline = now - lost_after can overflow, so loss marking on RTO
is also wrong.
Would it be worth describing this lasting loss-detection breakage in the
commit message?
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261124161302.4044422-1-dhowells%40redhat.com
^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH net v3 06/10] rxrpc: Fix lost driving of congestion management retransmission timeout
[not found] <20261124161302.4044422-1-dhowells@redhat.com>
` (4 preceding siblings ...)
2026-11-24 16:12 ` [PATCH net v3 05/10] rxrpc: Fix RTT processing for a presumed lost packet getting ACK'd David Howells
@ 2026-11-24 16:12 ` David Howells
2026-11-27 10:13 ` netdev-bot+sashiko
2026-11-24 16:12 ` [PATCH net v3 07/10] rxrpc: Fix limit on packets to be transmitted in one go David Howells
` (3 subsequent siblings)
9 siblings, 1 reply; 19+ messages in thread
From: David Howells @ 2026-11-24 16:12 UTC (permalink / raw)
To: netdev
Cc: David Howells, Marc Dionne, Jakub Kicinski, David S. Miller,
Eric Dumazet, Paolo Abeni, Simon Horman, linux-afs, linux-kernel,
Jeffrey Altman, stable
The implementation of RACK-TLP in AF_RXRPC lost the part that sets
RXRPC_CALL_RETRANS_TIMEOUT when the retransmission timeout expired (and if
there were unacked packets).
Fix this by moving the currently-unused congestion timeout code to its own
function and then calling it from the RTO handling function.
RXRPC_CALL_RETRANS_TIMEOUT is then repurposed to convey that this happened
in the rxrpc_congest tracepoint.
Fixes: 7c482665931b ("rxrpc: Implement RACK/TLP to deal with transmission stalls [RFC8985]")
Link: https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261020201258.290827-1-dhowells%40redhat.com
Signed-off-by: David Howells <dhowells@redhat.com>
cc: Marc Dionne <marc.dionne@auristor.com>
cc: Jeffrey Altman <jaltman@auristor.com>
cc: Eric Dumazet <edumazet@google.com>
cc: "David S. Miller" <davem@davemloft.net>
cc: Jakub Kicinski <kuba@kernel.org>
cc: Paolo Abeni <pabeni@redhat.com>
cc: Simon Horman <horms@kernel.org>
cc: linux-afs@lists.infradead.org
cc: stable@vger.kernel.org
---
net/rxrpc/ar-internal.h | 1 +
net/rxrpc/input.c | 27 +++++++++++++++++----------
net/rxrpc/input_rack.c | 2 +-
3 files changed, 19 insertions(+), 11 deletions(-)
diff --git a/net/rxrpc/ar-internal.h b/net/rxrpc/ar-internal.h
index d88dd02b6ab5..6e9fc996cd92 100644
--- a/net/rxrpc/ar-internal.h
+++ b/net/rxrpc/ar-internal.h
@@ -1243,6 +1243,7 @@ void rxrpc_unpublish_service_conn(struct rxrpc_connection *);
* input.c
*/
void rxrpc_congestion_degrade(struct rxrpc_call *);
+void rxrpc_congestion_timeout(struct rxrpc_call *call);
void rxrpc_input_call_packet(struct rxrpc_call *, struct sk_buff *);
void rxrpc_implicit_end_call(struct rxrpc_call *, struct sk_buff *);
diff --git a/net/rxrpc/input.c b/net/rxrpc/input.c
index 9b02e36264aa..63a0feae2081 100644
--- a/net/rxrpc/input.c
+++ b/net/rxrpc/input.c
@@ -35,17 +35,8 @@ static void rxrpc_congestion_management(struct rxrpc_call *call,
summary->change = rxrpc_cong_no_change;
summary->in_flight = rxrpc_tx_in_flight(call);
- if (test_and_clear_bit(RXRPC_CALL_RETRANS_TIMEOUT, &call->flags)) {
+ if (test_and_clear_bit(RXRPC_CALL_RETRANS_TIMEOUT, &call->flags))
summary->retrans_timeo = true;
- call->cong_ssthresh = umax(summary->in_flight / 2, 2);
- call->cong_cwnd = 1;
- if (call->cong_cwnd >= call->cong_ssthresh &&
- call->cong_ca_state == RXRPC_CA_SLOW_START) {
- call->cong_ca_state = RXRPC_CA_CONGEST_AVOIDANCE;
- call->cong_tstamp = call->acks_latest_ts;
- call->cong_cumul_acks = 0;
- }
- }
call->cong_cumul_acks += summary->nr_new_sacks;
call->cong_cumul_acks += summary->nr_new_hacks;
@@ -199,6 +190,22 @@ void rxrpc_congestion_degrade(struct rxrpc_call *call)
call->cong_cwnd = umax(call->cong_cwnd / 2, RXRPC_MIN_CWND);
}
+/*
+ * Handle congestion being detected by the retransmit timeout.
+ */
+void rxrpc_congestion_timeout(struct rxrpc_call *call)
+{
+ set_bit(RXRPC_CALL_RETRANS_TIMEOUT, &call->flags);
+ call->cong_ssthresh = umax(rxrpc_tx_in_flight(call) / 2, 2);
+ call->cong_cwnd = 1;
+ if (call->cong_cwnd >= call->cong_ssthresh &&
+ call->cong_ca_state == RXRPC_CA_SLOW_START) {
+ call->cong_ca_state = RXRPC_CA_CONGEST_AVOIDANCE;
+ call->cong_tstamp = call->acks_latest_ts;
+ call->cong_cumul_acks = 0;
+ }
+}
+
/*
* Add an RTT sample derived from an ACK'd DATA packet.
*/
diff --git a/net/rxrpc/input_rack.c b/net/rxrpc/input_rack.c
index e5288e5beb59..c652451cc9b5 100644
--- a/net/rxrpc/input_rack.c
+++ b/net/rxrpc/input_rack.c
@@ -420,7 +420,7 @@ void rxrpc_rack_timer_expired(struct rxrpc_call *call, ktime_t overran_by)
rxrpc_tlp_send_probe(call);
break;
case RXRPC_CALL_RACKTIMER_RTO:
- // Might need to poke the congestion algo in some way
+ rxrpc_congestion_timeout(call);
rxrpc_rack_mark_losses_on_rto(call);
break;
//case RXRPC_CALL_RACKTIMER_ZEROWIN:
^ permalink raw reply related [flat|nested] 19+ messages in thread* Re: [PATCH net v3 06/10] rxrpc: Fix lost driving of congestion management retransmission timeout
2026-11-24 16:12 ` [PATCH net v3 06/10] rxrpc: Fix lost driving of congestion management retransmission timeout David Howells
@ 2026-11-27 10:13 ` netdev-bot+sashiko
0 siblings, 0 replies; 19+ messages in thread
From: netdev-bot+sashiko @ 2026-11-27 10:13 UTC (permalink / raw)
To: dhowells
Cc: netdev, marc.dionne, kuba, davem, edumazet, pabeni, horms,
linux-afs, linux-kernel, jaltman, stable
Thank you for your contribution! Sashiko AI review found 2 potential
issue(s) to consider.
Critical: 0 · High: 0 · Medium: 2 · Low: 0
If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).
- [Medium] In rxrpc_rack_timer_expired() (net/rxrpc/input_rack.c), the
RXRPC_CALL_RACKTIMER_RTO case now calls rxrpc_congestion_timeout()…
- [Medium] The patch makes previously dead RTO congestion code live by
moving it unchanged into rxrpc_congestion_timeout()…
--
rxrpc: Fix lost driving of congestion management retransmission timeout
This moves the unused RTO congestion code out of
rxrpc_congestion_management() into a new rxrpc_congestion_timeout()
helper. The helper is called from the RXRPC_CALL_RACKTIMER_RTO case of
rxrpc_rack_timer_expired(). RXRPC_CALL_RETRANS_TIMEOUT now only marks
that this happened, for the rxrpc_congest tracepoint.
Link: https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261020201258.290827-1-dhowells%40redhat.com
> diff --git a/net/rxrpc/input.c b/net/rxrpc/input.c
> index 9b02e36264aa4..63a0feae2081d 100644
> --- a/net/rxrpc/input.c
> +++ b/net/rxrpc/input.c
[ ... ]
> @@ -199,6 +190,22 @@ void rxrpc_congestion_degrade(struct rxrpc_call *call)
> call->cong_cwnd = umax(call->cong_cwnd / 2, RXRPC_MIN_CWND);
> }
>
> +/*
> + * Handle congestion being detected by the retransmit timeout.
> + */
> +void rxrpc_congestion_timeout(struct rxrpc_call *call)
> +{
> + set_bit(RXRPC_CALL_RETRANS_TIMEOUT, &call->flags);
> + call->cong_ssthresh = umax(rxrpc_tx_in_flight(call) / 2, 2);
> + call->cong_cwnd = 1;
> + if (call->cong_cwnd >= call->cong_ssthresh &&
> + call->cong_ca_state == RXRPC_CA_SLOW_START) {
> + call->cong_ca_state = RXRPC_CA_CONGEST_AVOIDANCE;
> + call->cong_tstamp = call->acks_latest_ts;
> + call->cong_cumul_acks = 0;
> + }
> +}
[Severity: Medium]
Can this if block ever run? cong_cwnd has just been set to 1, and
cong_ssthresh is always at least 2, so the condition is always false.
cong_ca_state is left as it was.
At the baseline this code was dead, because RXRPC_CALL_RETRANS_TIMEOUT
was never set. This patch makes it live. After an RTO, though, the call
never moves into slow start, which RFC 5681 requires.
If the RTO fires in RXRPC_CA_CONGEST_AVOIDANCE, cwnd grows back from 1
by at most one packet per srtt:
rxrpc_congestion_management() {
...
case RXRPC_CA_CONGEST_AVOIDANCE:
...
if (call->cong_cumul_acks >= call->cong_cwnd)
call->cong_cwnd++;
...
}
In the usual tail-loss RTO case, the ACKs after the retransmission carry
no soft-NACKs. So the resume_normality path, which would choose
RXRPC_CA_SLOW_START because cwnd < ssthresh, is never taken.
If the RTO fires in RXRPC_CA_FAST_RETRANSMIT, the call stays in
recovery. The next new_low_snack ACK does this, which mostly undoes the
loss window:
call->cong_cwnd = call->cong_ssthresh;
By contrast, rxrpc_congestion_degrade() sets RXRPC_CA_SLOW_START
explicitly:
call->cong_ca_state = RXRPC_CA_SLOW_START;
Should rxrpc_congestion_timeout() also set cong_ca_state to
RXRPC_CA_SLOW_START (and reset cong_dup_acks and cong_extra)? The
behaviour is unchanged at the end of the series.
> /*
> * Add an RTT sample derived from an ACK'd DATA packet.
> */
> diff --git a/net/rxrpc/input_rack.c b/net/rxrpc/input_rack.c
> index e5288e5beb592..c652451cc9b55 100644
> --- a/net/rxrpc/input_rack.c
> +++ b/net/rxrpc/input_rack.c
> @@ -420,7 +420,7 @@ void rxrpc_rack_timer_expired(struct rxrpc_call *call, ktime_t overran_by)
> rxrpc_tlp_send_probe(call);
> break;
> case RXRPC_CALL_RACKTIMER_RTO:
> - // Might need to poke the congestion algo in some way
> + rxrpc_congestion_timeout(call);
> rxrpc_rack_mark_losses_on_rto(call);
> break;
[Severity: Medium]
Should this call be conditional on there being unacked packets? The
commit message describes the lost behaviour as setting the flag:
when the retransmission timeout expired (and if
there were unacked packets).
Before 7c482665931b, the call in net/rxrpc/call_event.c was guarded:
if (unacked)
rxrpc_congestion_timeout(call);
Here, rxrpc_congestion_timeout() runs on every RTO expiry.
The RTO is only armed in rxrpc_tlp_send_probe(), and only when
rxrpc_tx_in_flight(call) != 0. Could a stale RTO fire with nothing
outstanding, like this?
1. rxrpc_tlp_send_probe() arms RXRPC_CALL_RACKTIMER_RTO.
2. An ACK hard-ACKs everything transmitted, but RXRPC_CALL_TX_LAST is
not set (for example, a MSG_MORE sender waiting on the
application). rxrpc_end_tx_phase() therefore never cancels the
timer.
3. rxrpc_rack_detect_loss_and_arm_timer() only replaces the timer
when the reorder timeout is non-zero.
4. No new data is sent before the RTO elapses, and the timer fires.
rxrpc_congestion_timeout() would then set cong_cwnd to 1 and
cong_ssthresh to umax(0 / 2, 2) = 2, even though nothing was lost.
That low ssthresh also outlives the call. rxrpc_disconnect_call() copies
it to the peer:
call->peer->cong_ssthresh = call->cong_ssthresh;
Later client calls (rxrpc_connect_call() path in conn_client.c) and
service calls (call_accept.c) to the same peer inherit it:
call->cong_ssthresh = call->peer->cong_ssthresh;
This seems to still be present at the end of the series.
rxrpc_update_rack_rto_timer(), added by "rxrpc: Fix RACK-TLP
implementation", returns early when tx_in_flight == 0 without cancelling
the RTO, and rxrpc_congestion_timeout() still has no guard.
> //case RXRPC_CALL_RACKTIMER_ZEROWIN:
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261124161302.4044422-1-dhowells%40redhat.com
^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH net v3 07/10] rxrpc: Fix limit on packets to be transmitted in one go
[not found] <20261124161302.4044422-1-dhowells@redhat.com>
` (5 preceding siblings ...)
2026-11-24 16:12 ` [PATCH net v3 06/10] rxrpc: Fix lost driving of congestion management retransmission timeout David Howells
@ 2026-11-24 16:12 ` David Howells
2026-11-27 10:13 ` netdev-bot+sashiko
2026-11-24 16:12 ` [PATCH net v3 08/10] rxrpc: Fix detection of TLP probe response David Howells
` (2 subsequent siblings)
9 siblings, 1 reply; 19+ messages in thread
From: David Howells @ 2026-11-24 16:12 UTC (permalink / raw)
To: netdev
Cc: David Howells, Marc Dionne, Jakub Kicinski, David S. Miller,
Eric Dumazet, Paolo Abeni, Simon Horman, linux-afs, linux-kernel,
Jeffrey Altman, stable
Fix rxrpc_transmit_fresh_data() to honour the limit set on the number of
packets it can transmit in one go. The 'limit' variable is accidentally
shadowed by another variable calculating the limit dynamically.
This was spotted by Claude-opus-5-5 run locally.
Fixes: 7c482665931b ("rxrpc: Implement RACK/TLP to deal with transmission stalls [RFC8985]")
Signed-off-by: David Howells <dhowells@redhat.com>
cc: Marc Dionne <marc.dionne@auristor.com>
cc: Jeffrey Altman <jaltman@auristor.com>
cc: Eric Dumazet <edumazet@google.com>
cc: "David S. Miller" <davem@davemloft.net>
cc: Jakub Kicinski <kuba@kernel.org>
cc: Paolo Abeni <pabeni@redhat.com>
cc: Simon Horman <horms@kernel.org>
cc: linux-afs@lists.infradead.org
cc: stable@vger.kernel.org
---
net/rxrpc/call_event.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/net/rxrpc/call_event.c b/net/rxrpc/call_event.c
index b102a055c2e0..4def732352e9 100644
--- a/net/rxrpc/call_event.c
+++ b/net/rxrpc/call_event.c
@@ -189,7 +189,8 @@ static void rxrpc_close_tx_phase(struct rxrpc_call *call)
}
/*
- * Transmit some as-yet untransmitted data, to a maximum of the supplied limit.
+ * Transmit some as-yet untransmitted data, to a maximum of the supplied limit
+ * (UINT_MAX for no limit).
*/
static void rxrpc_transmit_fresh_data(struct rxrpc_call *call, unsigned int limit,
enum rxrpc_txdata_trace trace)
@@ -212,7 +213,8 @@ static void rxrpc_transmit_fresh_data(struct rxrpc_call *call, unsigned int limi
struct rxrpc_txqueue *tq;
struct rxrpc_txbuf *txb;
rxrpc_seq_t send_top, seq;
- int limit = min(space, max(call->peer->pmtud_jumbo, 1));
+ int jlimit = umin(umin(space, max(call->peer->pmtud_jumbo, 1)),
+ limit);
/* Order send_top before the contents of the new txbufs and
* txqueue pointers
@@ -242,7 +244,7 @@ static void rxrpc_transmit_fresh_data(struct rxrpc_call *call, unsigned int limi
req.n++;
if (!txb->jumboable)
break;
- } while (req.n < limit && before(seq, send_top));
+ } while (req.n < jlimit && before(seq, send_top));
if (__rxrpc_call_state(call) == RXRPC_CALL_CLIENT_PRE_SEND)
rxrpc_set_call_state(call, RXRPC_CALL_CLIENT_SEND_REQUEST);
@@ -255,6 +257,11 @@ static void rxrpc_transmit_fresh_data(struct rxrpc_call *call, unsigned int limi
space -= req.n;
rxrpc_send_data_packet(call, &req);
+ if (limit < UINT_MAX) {
+ limit -= req.n;
+ if (limit == 0)
+ break;
+ }
}
}
^ permalink raw reply related [flat|nested] 19+ messages in thread* Re: [PATCH net v3 07/10] rxrpc: Fix limit on packets to be transmitted in one go
2026-11-24 16:12 ` [PATCH net v3 07/10] rxrpc: Fix limit on packets to be transmitted in one go David Howells
@ 2026-11-27 10:13 ` netdev-bot+sashiko
0 siblings, 0 replies; 19+ messages in thread
From: netdev-bot+sashiko @ 2026-11-27 10:13 UTC (permalink / raw)
To: dhowells
Cc: netdev, marc.dionne, kuba, davem, edumazet, pabeni, horms,
linux-afs, linux-kernel, jaltman, stable
Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.
Low priority / nit picks for your consideration:
- [Low] The commit message for "rxrpc: Fix limit on packets to be
transmitted in one go" describes the mechanism correctly: the inner…
--
rxrpc: Fix limit on packets to be transmitted in one go
This commit makes rxrpc_transmit_fresh_data() honour its limit parameter.
A local variable of the same name, used for the jumbo packet limit, had
been shadowing it. The local is renamed to jlimit and clamped to limit.
The remaining limit is then decremented after each send, and the loop
breaks out once it reaches zero.
> rxrpc: Fix limit on packets to be transmitted in one go
>
> Fix rxrpc_transmit_fresh_data() to honour the limit set on the number of
> packets it can transmit in one go. The 'limit' variable is accidentally
> shadowed by another variable calculating the limit dynamically.
[Severity: Low]
This isn't a bug, but could the commit message also say what went wrong
because of the shadowing? The patch is Cc'd to stable, so the user-visible
impact would help backporters.
There are two callers of rxrpc_transmit_some_data().
rxrpc_input_call_event() passes UINT_MAX, so it was never affected. The
other caller is rxrpc_tlp_send_probe() in net/rxrpc/input_rack.c, which
asks for a single new-data loss probe:
net/rxrpc/input_rack.c:rxrpc_tlp_send_probe() {
...
/* Transmit the lowest-sequence unsent DATA */
call->tx_last_serial = 0;
rxrpc_transmit_some_data(call, 1, rxrpc_txdata_tlp_new_data);
call->tlp_serial = call->tx_last_serial;
call->tlp_seq = call->tx_transmitted;
...
}
Since the limit of 1 was ignored, a TLP new-data probe could send every
unsent packet that fit in rxrpc_tx_window_space(). It sent them in jumbo
groups of up to pmtud_jumbo, over several loop iterations.
rxrpc_prepare_data_packet() sets the serial of the last packet sent:
call->tx_last_serial = serial + req->n - 1;
As a result, tlp_serial and tlp_seq ended up pointing at the last packet
of the burst rather than at a single probe packet.
Would it be worth adding a sentence along the lines of "the TLP new-data
probe could send a burst of up to the whole Tx window instead of a single
packet"?
The code change itself looks correct. With limit == 1, jlimit becomes 1,
req.n becomes 1, limit drops to 0 and the loop breaks.
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261124161302.4044422-1-dhowells%40redhat.com
^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH net v3 08/10] rxrpc: Fix detection of TLP probe response
[not found] <20261124161302.4044422-1-dhowells@redhat.com>
` (6 preceding siblings ...)
2026-11-24 16:12 ` [PATCH net v3 07/10] rxrpc: Fix limit on packets to be transmitted in one go David Howells
@ 2026-11-24 16:12 ` David Howells
2026-11-27 10:13 ` netdev-bot+sashiko
2026-11-24 16:12 ` [PATCH net v3 09/10] rxrpc: Fix counting of in-flight transmitted packets David Howells
2026-11-24 16:12 ` [PATCH net v3 10/10] rxrpc: Fix RACK-TLP implementation David Howells
9 siblings, 1 reply; 19+ messages in thread
From: David Howells @ 2026-11-24 16:12 UTC (permalink / raw)
To: netdev
Cc: David Howells, Marc Dionne, Jakub Kicinski, David S. Miller,
Eric Dumazet, Paolo Abeni, Simon Horman, linux-afs, linux-kernel,
Jeffrey Altman, stable
Fix detection of the TLP probe response to include a check that
->tlp_serial is valid, otherwise it's possible to see an ACK of a packet
that matches an old value of ->tlp_seq as a probe response.
Also make sure that we check to see if an ACK is a TLP probe response -
even if we would otherwise discard it as being out of order.
Fixes: 7c482665931b ("rxrpc: Implement RACK/TLP to deal with transmission stalls [RFC8985]")
Signed-off-by: David Howells <dhowells@redhat.com>
cc: Marc Dionne <marc.dionne@auristor.com>
cc: Jeffrey Altman <jaltman@auristor.com>
cc: Eric Dumazet <edumazet@google.com>
cc: "David S. Miller" <davem@davemloft.net>
cc: Jakub Kicinski <kuba@kernel.org>
cc: Paolo Abeni <pabeni@redhat.com>
cc: Simon Horman <horms@kernel.org>
cc: linux-afs@lists.infradead.org
cc: stable@vger.kernel.org
---
net/rxrpc/input.c | 21 +++++++++++++++------
net/rxrpc/input_rack.c | 5 +++--
2 files changed, 18 insertions(+), 8 deletions(-)
diff --git a/net/rxrpc/input.c b/net/rxrpc/input.c
index 63a0feae2081..d01a8d95dc6d 100644
--- a/net/rxrpc/input.c
+++ b/net/rxrpc/input.c
@@ -275,7 +275,8 @@ static bool rxrpc_rotate_tx_window(struct rxrpc_call *call, rxrpc_seq_t to,
/* Packet directly hard ACK'd. */
tq->nr_reported_acks++;
rxrpc_input_rack_one(call, summary, tq, ix);
- if (seq == call->tlp_seq)
+ if (call->tlp_serial &&
+ seq == call->tlp_seq)
summary->tlp_probe_acked = true;
summary->nr_new_hacks++;
__set_bit(ix, &tq->segment_acked);
@@ -288,7 +289,8 @@ static bool rxrpc_rotate_tx_window(struct rxrpc_call *call, rxrpc_seq_t to,
/* Soft NAK -> hard ACK. */
call->acks_nr_snacks--;
rxrpc_input_rack_one(call, summary, tq, ix);
- if (seq == call->tlp_seq)
+ if (call->tlp_serial &&
+ seq == call->tlp_seq)
summary->tlp_probe_acked = true;
summary->nr_new_hacks++;
__set_bit(ix, &tq->segment_acked);
@@ -1139,7 +1141,7 @@ static void rxrpc_input_ack(struct rxrpc_call *call, struct sk_buff *skb)
/* Discard any out-of-order or duplicate ACKs (outside lock). */
if (!rxrpc_is_ack_valid(call, hard_ack, prev_pkt)) {
trace_rxrpc_rx_discard_ack(call, summary.ack_serial, hard_ack, prev_pkt);
- goto send_response; /* Still respond if requested. */
+ goto check_for_tlp_probe; /* Still respond if requested. */
}
trailer.maxMTU = 0;
@@ -1217,9 +1219,16 @@ static void rxrpc_input_ack(struct rxrpc_call *call, struct sk_buff *skb)
*/
rxrpc_congestion_management(call, &summary);
rxrpc_rack_detect_loss_and_arm_timer(call, &summary);
- rxrpc_tlp_process_ack(call, &summary);
- if (call->tlp_serial && after_eq(summary.acked_serial, call->tlp_serial))
- call->tlp_serial = 0;
+
+check_for_tlp_probe:
+ if (call->tlp_serial) {
+ /* Need to check to see if the ACK is a TLP probe response,
+ * even if the ACKs may have come out of order.
+ */
+ rxrpc_tlp_process_ack(call, &summary);
+ if (after_eq(summary.acked_serial, call->tlp_serial))
+ call->tlp_serial = 0;
+ }
send_response:
if (summary.ack_reason == RXRPC_ACK_PING)
diff --git a/net/rxrpc/input_rack.c b/net/rxrpc/input_rack.c
index c652451cc9b5..07972c85f256 100644
--- a/net/rxrpc/input_rack.c
+++ b/net/rxrpc/input_rack.c
@@ -368,11 +368,12 @@ void rxrpc_tlp_send_probe(struct rxrpc_call *call)
}
/*
- * Detect losses using the ACK of a TLP loss probe [RFC8958 7.4].
+ * Detect losses using the ACK of a TLP loss probe [RFC8958 7.4]. The caller
+ * must check ->tlp_serial != 0 before calling.
*/
void rxrpc_tlp_process_ack(struct rxrpc_call *call, struct rxrpc_ack_summary *summary)
{
- if (!call->tlp_serial || after(call->tlp_seq, call->acks_hard_ack))
+ if (after(call->tlp_seq, call->acks_hard_ack))
return;
if (!call->tlp_is_retrans) {
^ permalink raw reply related [flat|nested] 19+ messages in thread* Re: [PATCH net v3 08/10] rxrpc: Fix detection of TLP probe response
2026-11-24 16:12 ` [PATCH net v3 08/10] rxrpc: Fix detection of TLP probe response David Howells
@ 2026-11-27 10:13 ` netdev-bot+sashiko
0 siblings, 0 replies; 19+ messages in thread
From: netdev-bot+sashiko @ 2026-11-27 10:13 UTC (permalink / raw)
To: dhowells
Cc: netdev, marc.dionne, kuba, davem, edumazet, pabeni, horms,
linux-afs, linux-kernel, jaltman, stable
Thank you for your contribution! Sashiko AI review found 2 potential
issue(s) to consider.
Critical: 0 · High: 0 · Medium: 1 · Low: 1
If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).
- [Medium] The probe-completion test in rxrpc_input_ack(), `if
(after_eq(summary.acked_serial, call->tlp_serial)) call->tlp_serial =…
- [Low] The first paragraph of the commit message says the patch fixes a
bug: without a ->tlp_serial check, an ACK of a packet matching a stale…
--
rxrpc: Fix detection of TLP probe response
This commit adds a ->tlp_serial check before setting
summary->tlp_probe_acked in rxrpc_rotate_tx_window(), and moves the
->tlp_serial check out of rxrpc_tlp_process_ack() into its caller. It also
makes rxrpc_input_ack() check for a TLP probe response on ACKs that
rxrpc_is_ack_valid() discards as out of order or duplicate.
> diff --git a/net/rxrpc/input.c b/net/rxrpc/input.c
> index 63a0feae2081d..d01a8d95dc6db 100644
> --- a/net/rxrpc/input.c
> +++ b/net/rxrpc/input.c
> @@ -275,7 +275,8 @@ static bool rxrpc_rotate_tx_window(struct rxrpc_call *call, rxrpc_seq_t to,
> /* Packet directly hard ACK'd. */
> tq->nr_reported_acks++;
> rxrpc_input_rack_one(call, summary, tq, ix);
> - if (seq == call->tlp_seq)
> + if (call->tlp_serial &&
> + seq == call->tlp_seq)
> summary->tlp_probe_acked = true;
[Severity: Low]
The commit message says:
Fix detection of the TLP probe response to include a check that
->tlp_serial is valid, otherwise it's possible to see an ACK of a packet
that matches an old value of ->tlp_seq as a probe response.
Does this part of the patch change behaviour at this commit?
Only rxrpc_tlp_process_ack() reads summary->tlp_probe_acked. Before this
patch, that function already returned early when no probe was
outstanding:
if (!call->tlp_serial || after(call->tlp_seq, call->acks_hard_ack))
return;
Within one rxrpc_input_ack() call, call->tlp_serial can't go from zero to
non-zero between the rotation and rxrpc_tlp_process_ack(). Only
rxrpc_tlp_send_probe() and rxrpc_prepare_data_packet() set it, and both
run from the rack timer path. The summary is local to each ACK, and no
tracepoint records tlp_probe_acked.
So a stale tlp_probe_acked was already being ignored. The new guards here
and in the soft NAK branch look like they only move the existing check
into the callers.
The guard starts to matter with the later commit "rxrpc: Fix counting of
in-flight transmitted packets", which adds rxrpc_tlp_end_probe() to this
block. Could the commit message describe this part as preparation for that
change? Otherwise stable backporters may think they are getting two fixes.
[ ... ]
> @@ -1139,7 +1141,7 @@ static void rxrpc_input_ack(struct rxrpc_call *call, struct sk_buff *skb)
> /* Discard any out-of-order or duplicate ACKs (outside lock). */
> if (!rxrpc_is_ack_valid(call, hard_ack, prev_pkt)) {
> trace_rxrpc_rx_discard_ack(call, summary.ack_serial, hard_ack, prev_pkt);
> - goto send_response; /* Still respond if requested. */
> + goto check_for_tlp_probe; /* Still respond if requested. */
> }
>
> trailer.maxMTU = 0;
> @@ -1217,9 +1219,16 @@ static void rxrpc_input_ack(struct rxrpc_call *call, struct sk_buff *skb)
> */
> rxrpc_congestion_management(call, &summary);
> rxrpc_rack_detect_loss_and_arm_timer(call, &summary);
> - rxrpc_tlp_process_ack(call, &summary);
> - if (call->tlp_serial && after_eq(summary.acked_serial, call->tlp_serial))
> - call->tlp_serial = 0;
> +
> +check_for_tlp_probe:
> + if (call->tlp_serial) {
> + /* Need to check to see if the ACK is a TLP probe response,
> + * even if the ACKs may have come out of order.
> + */
> + rxrpc_tlp_process_ack(call, &summary);
> + if (after_eq(summary.acked_serial, call->tlp_serial))
> + call->tlp_serial = 0;
^^^^
[Severity: Medium]
Can this end an outstanding TLP probe because of an ACK that doesn't
respond to any packet?
An acked_serial of 0 means the ACK wasn't sent in reply to a particular
packet. Elsewhere, rxrpc_input_ack() checks if (summary.acked_serial)
before it uses the value, but after_eq() here treats 0 as a normal serial.
rxrpc_get_next_serial() hands out connection serials starting at 1 and
skips only 0:
serial = conn->tx_serial;
if (serial == 0)
serial = 1;
conn->tx_serial = serial + 1;
After a long-lived connection has used more than 2^31 serials, tlp_serial
will be above 0x80000000. At that point after_eq(0, tlp_serial) is true,
and any ACK with acked_serial == 0 clears tlp_serial.
Linux peers send these ACKs routinely. For example,
rxrpc_input_call_event() does:
rxrpc_send_ACK(call, RXRPC_ACK_DELAY, 0,
rxrpc_propose_ack_delayed_ack);
and it sends IDLE and PING ACKs with serial 0 as well.
The in-order ACK path had this problem before this patch. The new goto
check_for_tlp_probe on the rxrpc_is_ack_valid() failure path means that
discarded out-of-order and duplicate ACKs, including serial-0 ones, now
reach the same comparison.
If tlp_serial is cleared early, a later ACK that really covers tlp_seq
fails the call->tlp_serial tests in rxrpc_rotate_tx_window(). It also
skips rxrpc_tlp_process_ack(), so the RFC 8985 section 7.4 handling never
runs. rxrpc_tlp_send_probe() only checks !call->tlp_serial, so it can send
another probe on the next PTO.
The problem is still there at the end of the series. After the later
commit "rxrpc: Fix counting of in-flight transmitted packets", this line
calls rxrpc_tlp_end_probe(). That also clears tlp_in_flight and
decrements tx_in_flight while the probe packet is still unacknowledged.
Would requiring a non-zero acked_serial here help, something like:
if (summary.acked_serial &&
after_eq(summary.acked_serial, call->tlp_serial))
> + }
>
> send_response:
> if (summary.ack_reason == RXRPC_ACK_PING)
[ ... ]
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261124161302.4044422-1-dhowells%40redhat.com
^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH net v3 09/10] rxrpc: Fix counting of in-flight transmitted packets
[not found] <20261124161302.4044422-1-dhowells@redhat.com>
` (7 preceding siblings ...)
2026-11-24 16:12 ` [PATCH net v3 08/10] rxrpc: Fix detection of TLP probe response David Howells
@ 2026-11-24 16:12 ` David Howells
2026-11-27 10:13 ` netdev-bot+sashiko
2026-11-24 16:12 ` [PATCH net v3 10/10] rxrpc: Fix RACK-TLP implementation David Howells
9 siblings, 1 reply; 19+ messages in thread
From: David Howells @ 2026-11-24 16:12 UTC (permalink / raw)
To: netdev
Cc: David Howells, Marc Dionne, Jakub Kicinski, David S. Miller,
Eric Dumazet, Paolo Abeni, Simon Horman, linux-afs, linux-kernel,
Jeffrey Altman, stable
The RACK-TLP algorithm [RFC8985] makes use of the count of in-flight
packets in decisions (denoted as FlightSize). This is currently based on
an approximation derived from the sum of other values:
tx_nr_sent - (acks_nr_sacks + tx_nr_lost) + tx_nr_resent
This, however, turns out not to be very good here as the component counters
aren't updated together and this may lead to an incorrect estimate.
Fix counting of in-flight transmitted packets by tracking them directly
rather than deriving the value:
(1) On each rxrpc_txqueue struct, keep a bitmap of which packets (txbuf)
from the set managed by that txqueue are considered in-flight.
(2) A new counter, tx_in_flight, is then added to the rxrpc_call struct to
keep track of the number of packets considered to be in flight.
(3) Set a packet's bit when the packet is transmitted and if the bit
wasn't already set, increment tx_in_flight.
(4) Clear a packet's bit when an ACK is received for the packet or if the
packet is declared lost - and if the bit wasn't already cleared,
decrement tx_in_flight.
(5) Add special accounting for the TLP probe when the TLP probe is a
retransmission of a packet that has already been ACK'd. The ACK
parser doesn't update the in_flight status already-acked packets that
get re-ACK'd, so this is tracked separately in rxrpc_call. Also add
TLP probe loss detection and then have that cancel the TLP probe and
its special in-flight status too.
Note that Rx protocol can in theory do a bit better than TCP here as
the Rx ACK packet references exactly by serial number the DATA/ACK
packet that triggered it.
The value in tx_in_flight is then used instead of the approximation.
If a packet that was soft-ACK'd gets subsequently NACK'd, we don't add it
back to the tx_in_flight counter as we know it's not in flight. It does,
however, need retransmission and so gets marked lost.
To help make this work, a flag indicating that we're doing a TLP probe with
new data is passed down to rxrpc_prepare_data_packet() via
rxrpc_transmit_some_data() and the setting of call->tlp_serial, ->tlp_seq
and ->tlp_is_retrans is moved there.
The tx_nr_sent and tx_nr_resent counters are then removed and the
rxrpc_rack tracepoint updated. The tx_last_serial is now only ever set and
so removed also.
Fixes: 7c482665931b ("rxrpc: Implement RACK/TLP to deal with transmission stalls [RFC8985]")
Link: https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20260925191520.2206700-1-dhowells%40redhat.com
Link: https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261020201258.290827-1-dhowells%40redhat.com
Signed-off-by: David Howells <dhowells@redhat.com>
cc: Marc Dionne <marc.dionne@auristor.com>
cc: Jeffrey Altman <jaltman@auristor.com>
cc: Eric Dumazet <edumazet@google.com>
cc: "David S. Miller" <davem@davemloft.net>
cc: Jakub Kicinski <kuba@kernel.org>
cc: Paolo Abeni <pabeni@redhat.com>
cc: Simon Horman <horms@kernel.org>
cc: linux-afs@lists.infradead.org
cc: stable@vger.kernel.org
---
include/trace/events/rxrpc.h | 11 +++-----
net/rxrpc/ar-internal.h | 34 +++++++++++-------------
net/rxrpc/call_event.c | 17 ++++++------
net/rxrpc/input.c | 25 ++++++++++++------
net/rxrpc/input_rack.c | 51 ++++++++++++++++++++++++------------
net/rxrpc/output.c | 22 ++++++++++++----
6 files changed, 96 insertions(+), 64 deletions(-)
diff --git a/include/trace/events/rxrpc.h b/include/trace/events/rxrpc.h
index 56dc9b614071..67a5612cdc55 100644
--- a/include/trace/events/rxrpc.h
+++ b/include/trace/events/rxrpc.h
@@ -2584,9 +2584,8 @@ TRACE_EVENT(rxrpc_rack,
__field(rxrpc_serial_t, ack_serial)
__field(rxrpc_seq_t, seq)
__field(enum rxrpc_rack_timer_mode, mode)
- __field(unsigned short, nr_sent)
+ __field(unsigned short, in_flight)
__field(unsigned short, nr_lost)
- __field(unsigned short, nr_resent)
__field(unsigned short, nr_sacked)
__field(ktime_t, timo)
),
@@ -2596,18 +2595,16 @@ TRACE_EVENT(rxrpc_rack,
__entry->ack_serial = call->rx_serial;
__entry->seq = call->rack_end_seq;
__entry->mode = call->rack_timer_mode;
- __entry->nr_sent = call->tx_nr_sent;
+ __entry->in_flight = call->tx_in_flight;
__entry->nr_lost = call->tx_nr_lost;
- __entry->nr_resent = call->tx_nr_resent;
__entry->nr_sacked = call->acks_nr_sacks;
__entry->timo = timo;
),
- TP_printk("c=%08x r=%08x q=%08x %s slrs=%u,%u,%u,%u t=%lld",
+ TP_printk("c=%08x r=%08x q=%08x %s fls=%u,%u,%u t=%lld",
__entry->call, __entry->ack_serial, __entry->seq,
__print_symbolic(__entry->mode, rxrpc_rack_timer_modes),
- __entry->nr_sent, __entry->nr_lost,
- __entry->nr_resent, __entry->nr_sacked,
+ __entry->in_flight, __entry->nr_lost, __entry->nr_sacked,
ktime_to_us(__entry->timo))
);
diff --git a/net/rxrpc/ar-internal.h b/net/rxrpc/ar-internal.h
index 6e9fc996cd92..c0cb1c7e6680 100644
--- a/net/rxrpc/ar-internal.h
+++ b/net/rxrpc/ar-internal.h
@@ -780,11 +780,9 @@ struct rxrpc_call {
rxrpc_seq_t tx_bottom; /* First packet in buffer */
rxrpc_seq_t tx_transmitted; /* Highest packet transmitted */
rxrpc_seq_t tx_top; /* Highest Tx slot allocated. */
- rxrpc_serial_t tx_last_serial; /* Serial of last DATA transmitted */
u16 tx_backoff; /* Delay to insert due to Tx failure (ms) */
- u16 tx_nr_sent; /* Number of packets sent, but unacked */
+ u16 tx_in_flight; /* Number of packets considered "in flight" */
u16 tx_nr_lost; /* Number of packets marked lost */
- u16 tx_nr_resent; /* Number of packets resent, but unacked */
u16 tx_winsize; /* Maximum size of Tx window */
#define RXRPC_TX_MAX_WINDOW 128
u8 tx_jumbo_max; /* Maximum subpkts peer will accept */
@@ -832,11 +830,13 @@ struct rxrpc_call {
bool rack_dsack_round_none; /* T if dsack_round is "None" */
bool rack_reordering_seen; /* T if detected reordering event */
enum rxrpc_rack_timer_mode rack_timer_mode; /* Current mode of RACK timer */
+ bool tlp_in_flight; /* T if duplicate probe is in flight */
bool tlp_is_retrans; /* T if unacked TLP retransmission */
rxrpc_serial_t tlp_serial; /* Serial of TLP probe (or 0 if none in progress) */
rxrpc_seq_t tlp_seq; /* Sequence of TLP probe */
unsigned int tlp_rtt_taken; /* Last time RTT taken */
ktime_t tlp_max_ack_delay; /* Sender budget for max delayed ACK interval */
+ ktime_t tlp_xmit_ts; /* Transmission timestamp for TLP probe */
/* Receive-phase ACK management (ACKs we send). */
u8 ackr_reason; /* reason to ACK */
@@ -980,6 +980,7 @@ struct rxrpc_txqueue {
unsigned long segment_acked; /* Bit-per-buf: Set if ACK'd */
unsigned long segment_lost; /* Bit-per-buf: Set if declared lost */
unsigned long segment_retransmitted; /* Bit-per-buf: Set if retransmitted */
+ unsigned long in_flight; /* Bit-per-buf: Set if "in flight" */
unsigned long rtt_samples; /* Bit-per-buf: Set if available for RTT */
unsigned long ever_retransmitted; /* Bit-per-buf: Set if ever retransmitted */
@@ -1065,7 +1066,7 @@ void rxrpc_propose_delay_ACK(struct rxrpc_call *, rxrpc_serial_t,
enum rxrpc_propose_ack_trace);
void rxrpc_resend_tlp(struct rxrpc_call *call);
void rxrpc_transmit_some_data(struct rxrpc_call *call, unsigned int limit,
- enum rxrpc_txdata_trace trace);
+ bool tlp_probe, enum rxrpc_txdata_trace trace);
bool rxrpc_input_call_event(struct rxrpc_call *call);
/*
@@ -1266,10 +1267,19 @@ void rxrpc_tlp_send_probe(struct rxrpc_call *call);
void rxrpc_tlp_process_ack(struct rxrpc_call *call, struct rxrpc_ack_summary *summary);
void rxrpc_rack_timer_expired(struct rxrpc_call *call, ktime_t overran_by);
+static inline void rxrpc_tlp_end_probe(struct rxrpc_call *call)
+{
+ call->tlp_serial = 0;
+ if (call->tlp_in_flight) {
+ call->tlp_in_flight = false;
+ call->tx_in_flight--;
+ }
+}
+
/* Initialise TLP state [RFC8958 7.1]. */
static inline void rxrpc_tlp_init(struct rxrpc_call *call)
{
- call->tlp_serial = 0;
+ rxrpc_tlp_end_probe(call);
call->tlp_seq = call->acks_hard_ack;
call->tlp_is_retrans = false;
}
@@ -1603,20 +1613,6 @@ static inline unsigned int rxrpc_tx_window_space(const struct rxrpc_call *call)
return max(winsize - transmitted, 0);
}
-static inline unsigned int rxrpc_left_out(const struct rxrpc_call *call)
-{
- return call->acks_nr_sacks + call->tx_nr_lost;
-}
-
-/*
- * Calculate the number of transmitted DATA packets assumed to be in flight
- * [approx RFC6675].
- */
-static inline unsigned int rxrpc_tx_in_flight(const struct rxrpc_call *call)
-{
- return call->tx_nr_sent - rxrpc_left_out(call) + call->tx_nr_resent;
-}
-
/*
* debug tracing
*/
diff --git a/net/rxrpc/call_event.c b/net/rxrpc/call_event.c
index 4def732352e9..62e15b03c9c2 100644
--- a/net/rxrpc/call_event.c
+++ b/net/rxrpc/call_event.c
@@ -193,7 +193,7 @@ static void rxrpc_close_tx_phase(struct rxrpc_call *call)
* (UINT_MAX for no limit).
*/
static void rxrpc_transmit_fresh_data(struct rxrpc_call *call, unsigned int limit,
- enum rxrpc_txdata_trace trace)
+ bool tlp_probe, enum rxrpc_txdata_trace trace)
{
int space = rxrpc_tx_window_space(call);
@@ -205,10 +205,11 @@ static void rxrpc_transmit_fresh_data(struct rxrpc_call *call, unsigned int limi
while (space > 0) {
struct rxrpc_send_data_req req = {
- .now = ktime_get_real(),
- .seq = call->tx_transmitted + 1,
- .n = 0,
- .trace = trace,
+ .now = ktime_get_real(),
+ .seq = call->tx_transmitted + 1,
+ .n = 0,
+ .tlp_probe = tlp_probe,
+ .trace = trace,
};
struct rxrpc_txqueue *tq;
struct rxrpc_txbuf *txb;
@@ -266,7 +267,7 @@ static void rxrpc_transmit_fresh_data(struct rxrpc_call *call, unsigned int limi
}
void rxrpc_transmit_some_data(struct rxrpc_call *call, unsigned int limit,
- enum rxrpc_txdata_trace trace)
+ bool tlp_probe, enum rxrpc_txdata_trace trace)
{
switch (__rxrpc_call_state(call)) {
case RXRPC_CALL_SERVER_ACK_REQUEST:
@@ -284,7 +285,7 @@ void rxrpc_transmit_some_data(struct rxrpc_call *call, unsigned int limit,
rxrpc_inc_stat(call->rxnet, stat_tx_data_underflow);
return;
}
- rxrpc_transmit_fresh_data(call, limit, trace);
+ rxrpc_transmit_fresh_data(call, limit, tlp_probe, trace);
break;
default:
return;
@@ -408,7 +409,7 @@ bool rxrpc_input_call_event(struct rxrpc_call *call)
if (test_and_clear_bit(RXRPC_CALL_EV_INITIAL_PING, &call->events))
rxrpc_send_initial_ping(call);
- rxrpc_transmit_some_data(call, UINT_MAX, rxrpc_txdata_new_data);
+ rxrpc_transmit_some_data(call, UINT_MAX, false, rxrpc_txdata_new_data);
if (saw_ack)
rxrpc_congestion_degrade(call);
diff --git a/net/rxrpc/input.c b/net/rxrpc/input.c
index d01a8d95dc6d..66be37f21410 100644
--- a/net/rxrpc/input.c
+++ b/net/rxrpc/input.c
@@ -33,7 +33,7 @@ static void rxrpc_congestion_management(struct rxrpc_call *call,
struct rxrpc_ack_summary *summary)
{
summary->change = rxrpc_cong_no_change;
- summary->in_flight = rxrpc_tx_in_flight(call);
+ summary->in_flight = call->tx_in_flight;
if (test_and_clear_bit(RXRPC_CALL_RETRANS_TIMEOUT, &call->flags))
summary->retrans_timeo = true;
@@ -196,7 +196,7 @@ void rxrpc_congestion_degrade(struct rxrpc_call *call)
void rxrpc_congestion_timeout(struct rxrpc_call *call)
{
set_bit(RXRPC_CALL_RETRANS_TIMEOUT, &call->flags);
- call->cong_ssthresh = umax(rxrpc_tx_in_flight(call) / 2, 2);
+ call->cong_ssthresh = umax(call->tx_in_flight / 2, 2);
call->cong_cwnd = 1;
if (call->cong_cwnd >= call->cong_ssthresh &&
call->cong_ca_state == RXRPC_CA_SLOW_START) {
@@ -276,8 +276,10 @@ static bool rxrpc_rotate_tx_window(struct rxrpc_call *call, rxrpc_seq_t to,
tq->nr_reported_acks++;
rxrpc_input_rack_one(call, summary, tq, ix);
if (call->tlp_serial &&
- seq == call->tlp_seq)
+ seq == call->tlp_seq) {
summary->tlp_probe_acked = true;
+ rxrpc_tlp_end_probe(call);
+ }
summary->nr_new_hacks++;
__set_bit(ix, &tq->segment_acked);
trace_rxrpc_rotate(call, tq, summary, seq, rxrpc_rotate_trace_hack);
@@ -290,18 +292,20 @@ static bool rxrpc_rotate_tx_window(struct rxrpc_call *call, rxrpc_seq_t to,
call->acks_nr_snacks--;
rxrpc_input_rack_one(call, summary, tq, ix);
if (call->tlp_serial &&
- seq == call->tlp_seq)
+ seq == call->tlp_seq) {
summary->tlp_probe_acked = true;
+ rxrpc_tlp_end_probe(call);
+ }
summary->nr_new_hacks++;
__set_bit(ix, &tq->segment_acked);
trace_rxrpc_rotate(call, tq, summary, seq, rxrpc_rotate_trace_snak);
}
- call->tx_nr_sent--;
+ if (__test_and_clear_bit(ix, &tq->in_flight))
+ call->tx_in_flight--;
if (__test_and_clear_bit(ix, &tq->segment_lost))
call->tx_nr_lost--;
- if (__test_and_clear_bit(ix, &tq->segment_retransmitted))
- call->tx_nr_resent--;
+ __clear_bit(ix, &tq->segment_retransmitted);
__clear_bit(ix, &tq->ever_retransmitted);
rxrpc_put_txbuf(tq->bufs[ix], rxrpc_txbuf_put_rotated);
@@ -960,6 +964,11 @@ static void rxrpc_input_soft_ack_tq(struct rxrpc_call *call,
rxrpc_input_soft_rtt(call, summary, tq);
new_acks |= n_to_a;
+ if (new_acks & tq->in_flight) {
+ call->tx_in_flight -= hweight_long(new_acks & tq->in_flight);
+ tq->in_flight &= ~new_acks;
+ }
+
if (new_acks || a_to_n)
rxrpc_input_rack(call, summary, tq, new_acks, a_to_n);
@@ -1227,7 +1236,7 @@ static void rxrpc_input_ack(struct rxrpc_call *call, struct sk_buff *skb)
*/
rxrpc_tlp_process_ack(call, &summary);
if (after_eq(summary.acked_serial, call->tlp_serial))
- call->tlp_serial = 0;
+ rxrpc_tlp_end_probe(call);
}
send_response:
diff --git a/net/rxrpc/input_rack.c b/net/rxrpc/input_rack.c
index 07972c85f256..240362109a3b 100644
--- a/net/rxrpc/input_rack.c
+++ b/net/rxrpc/input_rack.c
@@ -23,12 +23,13 @@ static bool rxrpc_rack_sent_after(ktime_t t1, rxrpc_seq_t seq1,
static void rxrpc_rack_mark_lost(struct rxrpc_call *call,
struct rxrpc_txqueue *tq, unsigned int ix)
{
- if (__test_and_set_bit(ix, &tq->segment_lost)) {
- if (__test_and_clear_bit(ix, &tq->segment_retransmitted))
- call->tx_nr_resent--;
- } else {
+ if (__test_and_set_bit(ix, &tq->segment_lost))
+ __clear_bit(ix, &tq->segment_retransmitted);
+ else
call->tx_nr_lost++;
- }
+
+ if (__test_and_clear_bit(ix, &tq->in_flight))
+ call->tx_in_flight--;
tq->segment_xmit_ts[ix] = UINT_MAX;
}
@@ -304,7 +305,7 @@ static void rxrpc_rack_mark_losses_on_rto(struct rxrpc_call *call)
*/
ktime_t rxrpc_tlp_calc_pto(struct rxrpc_call *call, ktime_t now)
{
- unsigned int flight_size = rxrpc_tx_in_flight(call);
+ unsigned int flight_size = call->tx_in_flight;
ktime_t rto_at = ktime_add(call->tx_last_sent,
rxrpc_get_rto_backoff(call, false));
ktime_t pto;
@@ -341,23 +342,18 @@ void rxrpc_tlp_send_probe(struct rxrpc_call *call)
if (after(call->send_top, call->tx_transmitted) &&
rxrpc_tx_window_space(call) > 0) {
/* Transmit the lowest-sequence unsent DATA */
- call->tx_last_serial = 0;
- rxrpc_transmit_some_data(call, 1, rxrpc_txdata_tlp_new_data);
- call->tlp_serial = call->tx_last_serial;
- call->tlp_seq = call->tx_transmitted;
+ rxrpc_transmit_some_data(call, 1, true, rxrpc_txdata_tlp_new_data);
trace_rxrpc_tlp_probe(call, rxrpc_tlp_probe_trace_transmit_new);
} else {
/* Retransmit the highest-sequence DATA sent */
- call->tx_last_serial = 0;
rxrpc_resend_tlp(call);
- call->tlp_is_retrans = true;
trace_rxrpc_tlp_probe(call, rxrpc_tlp_probe_trace_retransmit);
}
} else {
trace_rxrpc_tlp_probe(call, rxrpc_tlp_probe_trace_busy);
}
- if (rxrpc_tx_in_flight(call) != 0) {
+ if (call->tx_in_flight != 0) {
ktime_t rto = rxrpc_get_rto_backoff(call, false);
call->rack_timer_mode = RXRPC_CALL_RACKTIMER_RTO;
@@ -379,16 +375,16 @@ void rxrpc_tlp_process_ack(struct rxrpc_call *call, struct rxrpc_ack_summary *su
if (!call->tlp_is_retrans) {
/* TLP of new data delivered */
trace_rxrpc_tlp_ack(call, summary, rxrpc_tlp_ack_trace_new_data);
- call->tlp_serial = 0;
+ rxrpc_tlp_end_probe(call);
} else if (summary->ack_reason == RXRPC_ACK_DUPLICATE &&
summary->acked_serial == call->tlp_serial) {
/* General Case: Detected packet losses using RACK [7.4.1] */
trace_rxrpc_tlp_ack(call, summary, rxrpc_tlp_ack_trace_dup_acked);
- call->tlp_serial = 0;
+ rxrpc_tlp_end_probe(call);
} else if (after(call->acks_hard_ack, call->tlp_seq)) {
/* Repaired the single loss */
trace_rxrpc_tlp_ack(call, summary, rxrpc_tlp_ack_trace_hard_beyond);
- call->tlp_serial = 0;
+ rxrpc_tlp_end_probe(call);
// TODO: Invoke congestion control to react to the loss
// event the probe has repaired
} else if (summary->tlp_probe_acked) {
@@ -396,12 +392,32 @@ void rxrpc_tlp_process_ack(struct rxrpc_call *call, struct rxrpc_ack_summary *su
/* Special Case: Detected a single loss repaired by the loss
* probe [7.4.2]
*/
- call->tlp_serial = 0;
+ rxrpc_tlp_end_probe(call);
} else {
trace_rxrpc_tlp_ack(call, summary, rxrpc_tlp_ack_trace_incomplete);
}
}
+/*
+ * Handle TLP probe loss.
+ */
+static void rxrpc_tlp_probe_loss(struct rxrpc_call *call)
+{
+ ktime_t lost_at, now;
+
+ if (!call->tlp_serial)
+ return;
+
+ lost_at = ktime_add(call->tlp_xmit_ts, rxrpc_get_rto_backoff(call, false));
+ now = ktime_get_real();
+
+ if (ktime_before(now, lost_at))
+ return;
+
+ /* Presume the probe to be lost. Cancel it so we can have a new one. */
+ rxrpc_tlp_end_probe(call);
+}
+
/*
* Handle RACK timer expiration; returns true to request a resend.
*/
@@ -423,6 +439,7 @@ void rxrpc_rack_timer_expired(struct rxrpc_call *call, ktime_t overran_by)
case RXRPC_CALL_RACKTIMER_RTO:
rxrpc_congestion_timeout(call);
rxrpc_rack_mark_losses_on_rto(call);
+ rxrpc_tlp_probe_loss(call);
break;
//case RXRPC_CALL_RACKTIMER_ZEROWIN:
default:
diff --git a/net/rxrpc/output.c b/net/rxrpc/output.c
index 88cad087f13b..e053db0c22e6 100644
--- a/net/rxrpc/output.c
+++ b/net/rxrpc/output.c
@@ -560,7 +560,6 @@ static size_t rxrpc_prepare_data_packet(struct rxrpc_call *call,
whdr->_rsvd = 0;
whdr->serviceId = htons(call->conn->service_id);
- call->tx_last_serial = serial + req->n - 1;
call->tx_last_sent = req->now;
xmit_ts = rxrpc_prepare_txqueue(tq, req);
prefetch(tq->next);
@@ -571,15 +570,26 @@ static size_t rxrpc_prepare_data_packet(struct rxrpc_call *call,
_debug("prep[%u] tq=%x q=%x", i, tq->qbase, seq);
+ if (req->tlp_probe && test_bit(ix, &tq->segment_acked)) {
+ /* Account re-transmission of an already ACK'd packet
+ * separately as the ACK parser ignores re-ACKs of
+ * already ACK'd packets.
+ */
+ if (!call->tlp_in_flight) {
+ call->tlp_in_flight = true;
+ call->tx_in_flight++;
+ }
+ } else if (!__test_and_set_bit(ix, &tq->in_flight)) {
+ call->tx_in_flight++;
+ }
+
/* Record (re-)transmission for RACK [RFC8985 6.1]. */
if (__test_and_clear_bit(ix, &tq->segment_lost))
call->tx_nr_lost--;
if (req->retrans) {
__set_bit(ix, &tq->ever_retransmitted);
__set_bit(ix, &tq->segment_retransmitted);
- call->tx_nr_resent++;
} else {
- call->tx_nr_sent++;
start_tlp = true;
}
tq->segment_xmit_ts[ix] = xmit_ts;
@@ -603,8 +613,10 @@ static size_t rxrpc_prepare_data_packet(struct rxrpc_call *call,
/* Set timeouts */
if (req->tlp_probe) {
/* Sending TLP loss probe [RFC8985 7.3]. */
- call->tlp_serial = serial - 1;
- call->tlp_seq = seq - 1;
+ call->tlp_serial = serial - 1;
+ call->tlp_seq = seq - 1;
+ call->tlp_xmit_ts = req->now;
+ call->tlp_is_retrans = req->retrans;
} else if (start_tlp) {
/* Schedule TLP loss probe [RFC8985 7.2]. */
ktime_t pto;
^ permalink raw reply related [flat|nested] 19+ messages in thread* Re: [PATCH net v3 09/10] rxrpc: Fix counting of in-flight transmitted packets
2026-11-24 16:12 ` [PATCH net v3 09/10] rxrpc: Fix counting of in-flight transmitted packets David Howells
@ 2026-11-27 10:13 ` netdev-bot+sashiko
0 siblings, 0 replies; 19+ messages in thread
From: netdev-bot+sashiko @ 2026-11-27 10:13 UTC (permalink / raw)
To: dhowells
Cc: netdev, marc.dionne, kuba, davem, edumazet, pabeni, horms,
linux-afs, linux-kernel, jaltman, stable
Thank you for your contribution! Sashiko AI review found 4 potential
issue(s) to consider.
Critical: 0 · High: 0 · Medium: 4 · Low: 0
If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).
- [Medium] rxrpc_rotate_tx_window() (net/rxrpc/input.c) now calls
rxrpc_tlp_end_probe() as soon as the probed sequence is hard-ACKed in…
- [Medium] The 'Soft ACK -> hard ACK' branch of rxrpc_rotate_tx_window()
(net/rxrpc/input.c:286-289) does not call rxrpc_tlp_end_probe().
- [Medium] rxrpc: tx_in_flight double-counted when soft-ACKed TLP probe
is reneged
- [Medium] rxrpc: TLP probe state not cleared on RTO in
rxrpc_tlp_probe_loss()
--
rxrpc: Fix counting of in-flight transmitted packets
This commit drops the derived FlightSize approximation. In its place it
tracks in-flight packets directly, using a per-txqueue in_flight bitmap
and a call->tx_in_flight counter. TLP probes that retransmit an
already-ACKed packet get separate accounting (tlp_in_flight), and RTO
expiry now also checks whether the TLP probe was lost.
Link: https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20260925191520.2206700-1-dhowells%40redhat.com
Link: https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261020201258.290827-1-dhowells%40redhat.com
> diff --git a/net/rxrpc/input.c b/net/rxrpc/input.c
> index d01a8d95dc6db..66be37f214105 100644
> --- a/net/rxrpc/input.c
> +++ b/net/rxrpc/input.c
[ ... ]
> @@ -276,8 +276,10 @@ static bool rxrpc_rotate_tx_window(struct rxrpc_call *call, rxrpc_seq_t to,
> tq->nr_reported_acks++;
> rxrpc_input_rack_one(call, summary, tq, ix);
> if (call->tlp_serial &&
> - seq == call->tlp_seq)
> + seq == call->tlp_seq) {
> summary->tlp_probe_acked = true;
> + rxrpc_tlp_end_probe(call);
> + }
> summary->nr_new_hacks++;
> __set_bit(ix, &tq->segment_acked);
> trace_rxrpc_rotate(call, tq, summary, seq, rxrpc_rotate_trace_hack);
[Severity: Medium]
Is the probe meant to be ended here, during rotation? The commit message
doesn't mention this change.
rxrpc_tlp_end_probe() sets call->tlp_serial to 0. rxrpc_rotate_tx_window()
runs before this check in rxrpc_input_ack():
check_for_tlp_probe:
if (call->tlp_serial) {
...
rxrpc_tlp_process_ack(call, &summary);
So whenever an ACK hard-ACKs call->tlp_seq, rxrpc_tlp_process_ack() is now
skipped. On the normal hard-ACK path, doesn't that bypass the RFC 8985
section 7.4 classification (new_data, dup_acked, hard_beyond, acked) and
every trace_rxrpc_tlp_ack() event?
summary->tlp_probe_acked is set just before rxrpc_tlp_end_probe(). Its
only consumer is this branch in rxrpc_tlp_process_ack():
} else if (summary->tlp_probe_acked) {
trace_rxrpc_tlp_ack(call, summary, rxrpc_tlp_ack_trace_acked);
The other place that sets it, rxrpc_input_soft_ack_tq(), only does so when
tlp_seq is beyond hard_ack. In that case rxrpc_tlp_process_ack() returns
early.
Does that make the 7.4.2 special case unreachable? It would also remove the
hook that the existing "TODO: Invoke congestion control to react to the
loss event the probe has repaired" comment depends on.
The soft-NAK -> hard-ACK branch gets the same change. The last patch in the
series, "rxrpc: Fix RACK-TLP implementation", doesn't seem to change any of
this.
These calls also don't cover the soft-ACK -> hard-ACK branch, which is the
case tlp_in_flight needs most. That is covered in the next comment.
[ ... ]
> diff --git a/net/rxrpc/output.c b/net/rxrpc/output.c
> index 88cad087f13bf..e053db0c22e6e 100644
> --- a/net/rxrpc/output.c
> +++ b/net/rxrpc/output.c
[ ... ]
> @@ -571,15 +570,26 @@ static size_t rxrpc_prepare_data_packet(struct rxrpc_call *call,
>
> _debug("prep[%u] tq=%x q=%x", i, tq->qbase, seq);
>
> + if (req->tlp_probe && test_bit(ix, &tq->segment_acked)) {
> + /* Account re-transmission of an already ACK'd packet
> + * separately as the ACK parser ignores re-ACKs of
> + * already ACK'd packets.
> + */
> + if (!call->tlp_in_flight) {
> + call->tlp_in_flight = true;
> + call->tx_in_flight++;
> + }
> + } else if (!__test_and_set_bit(ix, &tq->in_flight)) {
> + call->tx_in_flight++;
> + }
[Severity: Medium]
Doesn't this miss the TLP probe's in-flight count when a soft-ACK is
reneged?
When rxrpc_resend_tlp() retransmits call->tx_transmitted after it has
been soft-ACKed, rxrpc_prepare_data_packet() counts the probe only
through call->tlp_in_flight. The segment's bit in tq->in_flight was
already cleared by rxrpc_input_soft_ack_tq() when the soft-ACK
arrived.
Rx soft-ACKs are not binding, so a later ACK can turn that segment
back into a NAK. rxrpc_input_soft_ack_tq() then puts it in a_to_n and
rxrpc_input_rack() passes it here. The tq->in_flight bit is already
clear, so tx_in_flight is left alone, and call->tlp_in_flight stays
set.
Nothing else in rxrpc_input_ack() ends the probe either. tlp_seq is
still above the hard-ACK point, so rxrpc_tlp_process_ack() returns
early. If that ACK's acked_serial is below call->tlp_serial, the
check after it doesn't fire.
Because tx_nr_lost is now non-zero, rxrpc_input_call_event() calls
rxrpc_resend(). That retransmission has tlp_probe false and
segment_acked clear, so rxrpc_prepare_data_packet() sets the
tq->in_flight bit and increments tx_in_flight a second time. The one
segment is then counted twice, once in the bitmap and once through
tlp_in_flight.
The extra count stays until something calls rxrpc_tlp_end_probe().
Until then, these all see one more packet than is outstanding:
summary->in_flight in rxrpc_congestion_management(), cong_ssthresh in
rxrpc_congestion_timeout() and flight_size in rxrpc_tlp_calc_pto().
Should rxrpc_rack_mark_lost() end the probe, or at least drop the
tlp_in_flight count, when the segment being marked lost is
call->tlp_seq and tlp_in_flight is set?
[Severity: Medium]
Where is this extra count released once the probed segment is hard-ACKed?
tlp_in_flight is only set when the TLP retransmits a segment that is
already soft-ACKed. rxrpc_resend_tlp() does this when call->tx_transmitted
has been soft-ACKed.
When that segment is rotated later, rxrpc_rotate_tx_window() takes the
soft-ACK branch, which has no rxrpc_tlp_end_probe() call:
} else if (test_bit(ix, &tq->segment_acked)) {
/* Soft ACK -> hard ACK. */
call->acks_nr_sacks--;
trace_rxrpc_rotate(call, tq, summary, seq, rxrpc_rotate_trace_sack);
The in_flight bitmap can't drop the count either, because the probe never
set the segment's in_flight bit.
If that segment carries RXRPC_LAST_PACKET, rxrpc_input_ack() skips
check_for_tlp_probe entirely:
if (after(hard_ack, call->tx_bottom)) {
if (rxrpc_rotate_tx_window(call, hard_ack, &summary)) {
rxrpc_end_tx_phase(call, false, rxrpc_eproto_unexpected_ack);
goto send_response;
}
}
rxrpc_receiving_reply() also rotates the window and ends the tx phase with
no TLP cleanup.
Wouldn't this leave tlp_serial non-zero, tlp_in_flight true and
tx_in_flight at 1 with nothing outstanding?
After the final series patch ("rxrpc: Fix RACK-TLP implementation"),
rxrpc_input_call_event() re-arms the RTO whenever rack_timer_mode is OFF
and tx_in_flight > 0. Could the stale count arm a spurious RTO after
rxrpc_end_tx_phase()? That RTO would run rxrpc_congestion_timeout() and RTO
loss marking before rxrpc_tlp_probe_loss() clears the probe.
Without rot_last, the probe can still be classed as "incomplete" in
rxrpc_tlp_process_ack() when hard_ack == tlp_seq and acked_serial is below
tlp_serial. Until the probe's own ACK arrives, FlightSize is one too high
for rxrpc_tlp_calc_pto() and rxrpc_congestion_timeout(), and no new TLP
probe can be sent.
Would it close the gap to call rxrpc_tlp_end_probe() when
seq == call->tlp_seq in the soft-ACK branch, or on the rot_last path?
[ ... ]
> diff --git a/net/rxrpc/input_rack.c b/net/rxrpc/input_rack.c
> --- a/net/rxrpc/input_rack.c
> +++ b/net/rxrpc/input_rack.c
> @@ -396,12 +392,32 @@ void rxrpc_tlp_process_ack(struct rxrpc_call *call, struct rxrpc_ack_summary *su
> /* Special Case: Detected a single loss repaired by the loss
> * probe [7.4.2]
> */
> - call->tlp_serial = 0;
> + rxrpc_tlp_end_probe(call);
> } else {
> trace_rxrpc_tlp_ack(call, summary, rxrpc_tlp_ack_trace_incomplete);
> }
> }
>
> +/*
> + * Handle TLP probe loss.
> + */
> +static void rxrpc_tlp_probe_loss(struct rxrpc_call *call)
> +{
> + ktime_t lost_at, now;
> +
> + if (!call->tlp_serial)
> + return;
> +
> + lost_at = ktime_add(call->tlp_xmit_ts, rxrpc_get_rto_backoff(call, false));
> + now = ktime_get_real();
> +
> + if (ktime_before(now, lost_at))
> + return;
> +
> + /* Presume the probe to be lost. Cancel it so we can have a new one. */
> + rxrpc_tlp_end_probe(call);
> +}
> +
> /*
> * Handle RACK timer expiration; returns true to request a resend.
> */
[Severity: Medium]
Can this miss a lost probe because the RTO grew after the probe was
sent?
call->tlp_xmit_ts is recorded when the probe goes out, and
rxrpc_tlp_send_probe() arms the RTO using the rxrpc_get_rto_backoff()
value in effect at that time. Here, though, lost_at is rebuilt from
whatever backoff and rto_us are current when the timer fires.
In between, rxrpc_resend() can call rxrpc_get_rto_backoff(call, true)
and bump call->backoff. For example, an ACK for an earlier serial can
let RACK mark an earlier segment lost, and rxrpc_input_call_event()
then resends it. A new RTT sample can also raise call->rto_us.
Neither of these moves call->rack_timo_at.
When the RTO fires, rxrpc_rack_timer_expired() turns the RACK timer
off and runs rxrpc_congestion_timeout() and
rxrpc_rack_mark_losses_on_rto() before calling this function. If the
backoff has doubled, lost_at is roughly tlp_xmit_ts plus twice the
original RTO. Now is still before it, so the function returns without
calling rxrpc_tlp_end_probe().
call->tlp_serial then stays set, so rxrpc_tlp_send_probe() keeps
taking the busy path and no new probe can be sent. If the probe
retransmitted an already soft-ACKed segment, tlp_in_flight stays set
too and tx_in_flight remains one too high.
If the RTO is re-armed, the losses it marks lead to another
rxrpc_resend(). That raises the backoff again, so the next check can
fail the same way. The probe is only cleaned up once an ACK happens
to cover it.
Would it be safer to fix the probe's loss deadline when the probe is
sent, using the RTO in effect then, instead of recomputing it here
from the current backoff?
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261124161302.4044422-1-dhowells%40redhat.com
^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH net v3 10/10] rxrpc: Fix RACK-TLP implementation
[not found] <20261124161302.4044422-1-dhowells@redhat.com>
` (8 preceding siblings ...)
2026-11-24 16:12 ` [PATCH net v3 09/10] rxrpc: Fix counting of in-flight transmitted packets David Howells
@ 2026-11-24 16:12 ` David Howells
2026-11-27 10:13 ` netdev-bot+sashiko
9 siblings, 1 reply; 19+ messages in thread
From: David Howells @ 2026-11-24 16:12 UTC (permalink / raw)
To: netdev
Cc: David Howells, Marc Dionne, Jakub Kicinski, David S. Miller,
Eric Dumazet, Paolo Abeni, Simon Horman, linux-afs, linux-kernel,
Jeffrey Altman, stable
Fix the RACK-TLP implementation in the following ways:
(1) Move the "in Fast or RTO recovery" flag to the rxrpc_call struct
rather than rxrpc_ack_summary so that it persists beyond ACK parsing
to the next time rxrpc_congestion_management() happens (when the next
ACK is parsed). This allows that value to be accessed by RACK-TLP
when invoked by the Reorder timer expiring.
(2) In rxrpc_input_call_event(), rearm the RTO timer before the function
returns if no other timer is running and if DATA packets have been
sent but not yet ACK'd. This prevents us not having a timer set to
drive retransmission.
Further, update the RTO timer after new data has been ACK'd if the RTO
timer was running before the ACK was processed (but not if it has just
been started by the TLP probe dispatch as that set the timer for
itself).
(3) In rxrpc_congestion_management(), initialise the TLP state when
entering the FAST_RETRANSMIT congestion control state, not every time
we process that state.
(4) Don't reset segment_xmit_ts in rxrpc_rack_mark_lost() as that's called
from three places, one of which shouldn't do that. Instead, do it in
the calling function as appropriate.
(5) In rxrpc_tlp_calc_pto(), check flight_size is at most one jumbo
packet's worth of subpackets in size, not just any non-zero value
(RFC8985 7.2 has a comparison against 1, so this is approximated
because we'll be sending jumbo packets if possible).
Fixes: 7c482665931b ("rxrpc: Implement RACK/TLP to deal with transmission stalls [RFC8985]")
Signed-off-by: David Howells <dhowells@redhat.com>
cc: Marc Dionne <marc.dionne@auristor.com>
cc: Jeffrey Altman <jaltman@auristor.com>
cc: Eric Dumazet <edumazet@google.com>
cc: "David S. Miller" <davem@davemloft.net>
cc: Jakub Kicinski <kuba@kernel.org>
cc: Paolo Abeni <pabeni@redhat.com>
cc: Simon Horman <horms@kernel.org>
cc: linux-afs@lists.infradead.org
cc: stable@vger.kernel.org
---
net/rxrpc/ar-internal.h | 4 ++-
net/rxrpc/call_event.c | 22 ++++++++++++++++-
net/rxrpc/input.c | 10 +++++---
net/rxrpc/input_rack.c | 54 ++++++++++++++++++++++++++++++++++++++---
4 files changed, 82 insertions(+), 8 deletions(-)
diff --git a/net/rxrpc/ar-internal.h b/net/rxrpc/ar-internal.h
index c0cb1c7e6680..37e649f96efd 100644
--- a/net/rxrpc/ar-internal.h
+++ b/net/rxrpc/ar-internal.h
@@ -653,6 +653,7 @@ enum rxrpc_call_flag {
RXRPC_CALL_RX_IS_IDLE, /* recvmsg() is idle - send an ACK */
RXRPC_CALL_RECVMSG_READ_ALL, /* recvmsg() read all of the received data */
RXRPC_CALL_CONN_CHALLENGING, /* The connection is being challenged */
+ RXRPC_CALL_NEW_DATA_ACKED, /* New data has been ACK'd */
};
/*
@@ -810,6 +811,7 @@ struct rxrpc_call {
#define RXRPC_TX_SMSS RXRPC_JUMBO_DATALEN
#define RXRPC_MIN_CWND 4
enum rxrpc_ca_state cong_ca_state; /* Congestion control state */
+ bool cong_in_recovery; /* If we're in Fast retransmit recovery */
u8 cong_extra; /* Extra to send for congestion management */
u16 cong_cwnd; /* Congestion window size */
u16 cong_ssthresh; /* Slow-start threshold */
@@ -896,7 +898,6 @@ struct rxrpc_ack_summary {
bool retrans_timeo:1; /* T if reTx due to timeout happened */
bool need_retransmit:1; /* T if we need transmission */
bool rtt_sample_avail:1; /* T if RTT sample available */
- bool in_fast_or_rto_recovery:1;
bool exiting_fast_or_rto_recovery:1;
bool tlp_probe_acked:1; /* T if the TLP probe seq was acked */
u8 /*enum rxrpc_congest_change*/ change;
@@ -1266,6 +1267,7 @@ ktime_t rxrpc_tlp_calc_pto(struct rxrpc_call *call, ktime_t now);
void rxrpc_tlp_send_probe(struct rxrpc_call *call);
void rxrpc_tlp_process_ack(struct rxrpc_call *call, struct rxrpc_ack_summary *summary);
void rxrpc_rack_timer_expired(struct rxrpc_call *call, ktime_t overran_by);
+void rxrpc_update_rack_rto_timer(struct rxrpc_call *call);
static inline void rxrpc_tlp_end_probe(struct rxrpc_call *call)
{
diff --git a/net/rxrpc/call_event.c b/net/rxrpc/call_event.c
index 62e15b03c9c2..2b3bd5355a02 100644
--- a/net/rxrpc/call_event.c
+++ b/net/rxrpc/call_event.c
@@ -312,7 +312,7 @@ bool rxrpc_input_call_event(struct rxrpc_call *call)
{
struct sk_buff *skb;
ktime_t now, t;
- bool did_receive = false, saw_ack = false;
+ bool did_receive = false, saw_ack = false, in_rto = false;
s32 abort_code;
rxrpc_see_call(call, rxrpc_call_see_input);
@@ -330,6 +330,8 @@ bool rxrpc_input_call_event(struct rxrpc_call *call)
goto out;
}
+ clear_bit(RXRPC_CALL_NEW_DATA_ACKED, &call->flags);
+ in_rto = call->rack_timer_mode == RXRPC_CALL_RACKTIMER_RTO;
do {
skb = __skb_dequeue(&call->rx_queue);
if (skb) {
@@ -448,6 +450,24 @@ bool rxrpc_input_call_event(struct rxrpc_call *call)
rxrpc_propose_ack_input_data);
}
+ /* Need to rearm the RTO timer if we don't start the TLP-PTO
+ * timer [RFC8985 7.3].
+ */
+ if (call->rack_timer_mode == RXRPC_CALL_RACKTIMER_OFF &&
+ call->tx_in_flight > 0) {
+ ktime_t rto = rxrpc_get_rto_backoff(call, false);
+
+ call->rack_timer_mode = RXRPC_CALL_RACKTIMER_RTO;
+ call->rack_timo_at = ktime_add(ktime_get_real(), rto);
+ trace_rxrpc_rack_timer(call, rto, false);
+ trace_rxrpc_timer_set(call, rto, rxrpc_timer_trace_rack_rto);
+ } else if (call->rack_timer_mode == RXRPC_CALL_RACKTIMER_RTO &&
+ test_bit(RXRPC_CALL_NEW_DATA_ACKED, &call->flags) &&
+ in_rto) {
+ /* Update the RTO timer if we saw an ACK. */
+ rxrpc_update_rack_rto_timer(call);
+ }
+
/* Make sure the timer is restarted */
if (!__rxrpc_call_is_complete(call)) {
ktime_t next = READ_ONCE(call->expect_term_by), delay;
diff --git a/net/rxrpc/input.c b/net/rxrpc/input.c
index 66be37f21410..aa3af5a10c01 100644
--- a/net/rxrpc/input.c
+++ b/net/rxrpc/input.c
@@ -34,6 +34,7 @@ static void rxrpc_congestion_management(struct rxrpc_call *call,
{
summary->change = rxrpc_cong_no_change;
summary->in_flight = call->tx_in_flight;
+ call->cong_in_recovery = false;
if (test_and_clear_bit(RXRPC_CALL_RETRANS_TIMEOUT, &call->flags))
summary->retrans_timeo = true;
@@ -97,12 +98,12 @@ static void rxrpc_congestion_management(struct rxrpc_call *call,
call->cong_extra = 0;
call->cong_dup_acks = 0;
summary->need_retransmit = true;
- summary->in_fast_or_rto_recovery = true;
+ call->cong_in_recovery = true;
+ rxrpc_tlp_init(call);
goto out;
case RXRPC_CA_FAST_RETRANSMIT:
- rxrpc_tlp_init(call);
- summary->in_fast_or_rto_recovery = true;
+ call->cong_in_recovery = true;
if (!summary->new_low_snack) {
if (summary->nr_new_sacks == 0)
call->cong_cwnd += 1;
@@ -1217,6 +1218,9 @@ static void rxrpc_input_ack(struct rxrpc_call *call, struct sk_buff *skb)
rxrpc_input_soft_acks(call, &summary, skb);
}
+ if (summary.nr_new_hacks || summary.nr_new_sacks)
+ set_bit(RXRPC_CALL_NEW_DATA_ACKED, &call->flags);
+
if (test_bit(RXRPC_CALL_TX_LAST, &call->flags) &&
call->acks_nr_sacks == call->tx_top - hard_ack &&
rxrpc_is_client_call(call))
diff --git a/net/rxrpc/input_rack.c b/net/rxrpc/input_rack.c
index 240362109a3b..473046562b0b 100644
--- a/net/rxrpc/input_rack.c
+++ b/net/rxrpc/input_rack.c
@@ -30,7 +30,6 @@ static void rxrpc_rack_mark_lost(struct rxrpc_call *call,
if (__test_and_clear_bit(ix, &tq->in_flight))
call->tx_in_flight--;
- tq->segment_xmit_ts[ix] = UINT_MAX;
}
/*
@@ -146,6 +145,7 @@ void rxrpc_input_rack(struct rxrpc_call *call,
__clear_bit(ix, &reneged_acks);
rxrpc_rack_mark_lost(call, tq, ix);
+ tq->segment_xmit_ts[ix] = UINT_MAX;
}
while (new_acks) {
@@ -197,7 +197,7 @@ static ktime_t rxrpc_rack_update_reo_wnd(struct rxrpc_call *call,
}
if (!call->rack_reordering_seen) {
- if (summary->in_fast_or_rto_recovery)
+ if (call->cong_in_recovery)
return 0;
if (call->acks_nr_sacks >= dup_thresh)
return 0;
@@ -243,6 +243,7 @@ static ktime_t rxrpc_rack_detect_loss(struct rxrpc_call *call,
remaining = ktime_sub(ktime_add(xmit_ts, lost_after), now);
if (remaining <= 0) {
rxrpc_rack_mark_lost(call, tq, ix);
+ tq->segment_xmit_ts[ix] = UINT_MAX;
trace_rxrpc_rack_detect_loss(call, summary, seq);
} else {
timeout = max(remaining, timeout);
@@ -313,7 +314,7 @@ ktime_t rxrpc_tlp_calc_pto(struct rxrpc_call *call, ktime_t now)
if (call->rtt_count > 0) {
/* Use 2*SRTT as the timeout. */
pto = ns_to_ktime((u64)call->srtt_us * (NSEC_PER_USEC / 4));
- if (flight_size)
+ if (flight_size <= max(call->peer->pmtud_jumbo, 1))
pto = ktime_add(pto, call->tlp_max_ack_delay);
} else {
pto = NSEC_PER_SEC;
@@ -446,3 +447,50 @@ void rxrpc_rack_timer_expired(struct rxrpc_call *call, ktime_t overran_by)
pr_warn("Unexpected rack timer %u", mode);
}
}
+
+/*
+ * Update the RACK RTO timer after new data is ACK'd.
+ */
+void rxrpc_update_rack_rto_timer(struct rxrpc_call *call)
+{
+ struct rxrpc_txqueue *tq;
+ ktime_t earliest = KTIME_MAX, rto;
+
+ if (!call->tx_in_flight)
+ return;
+
+ for (tq = call->tx_queue; tq; tq = tq->next) {
+ unsigned long nacks = ~tq->segment_acked;
+ int nr_sent;
+
+ if (after(tq->qbase, call->tx_transmitted))
+ break;
+
+ nr_sent = (call->tx_transmitted - tq->qbase) + 1;
+ if (nr_sent < RXRPC_NR_TXQUEUE)
+ nacks &= (1UL << nr_sent) - 1;
+
+ while (nacks) {
+ unsigned int ix = __ffs(nacks);
+ ktime_t xmit_ts;
+
+ __clear_bit(ix, &nacks);
+
+ if (tq->segment_xmit_ts[ix] != UINT_MAX) {
+ xmit_ts = rxrpc_get_xmit_ts(tq, ix);
+ if (ktime_before(xmit_ts, earliest))
+ earliest = xmit_ts;
+ }
+ }
+ }
+
+ if (earliest != KTIME_MAX) {
+ rto = ktime_add(earliest, rxrpc_get_rto_backoff(call, false));
+ if (ktime_after(rto, call->rack_timo_at)) {
+ call->rack_timer_mode = RXRPC_CALL_RACKTIMER_RTO;
+ call->rack_timo_at = rto;
+ trace_rxrpc_rack_timer(call, rto, false);
+ trace_rxrpc_timer_set(call, rto, rxrpc_timer_trace_rack_rto);
+ }
+ }
+}
^ permalink raw reply related [flat|nested] 19+ messages in thread* Re: [PATCH net v3 10/10] rxrpc: Fix RACK-TLP implementation
2026-11-24 16:12 ` [PATCH net v3 10/10] rxrpc: Fix RACK-TLP implementation David Howells
@ 2026-11-27 10:13 ` netdev-bot+sashiko
0 siblings, 0 replies; 19+ messages in thread
From: netdev-bot+sashiko @ 2026-11-27 10:13 UTC (permalink / raw)
To: dhowells
Cc: netdev, marc.dionne, kuba, davem, edumazet, pabeni, horms,
linux-afs, linux-kernel, jaltman, stable
Thank you for your contribution! Sashiko AI review found 4 potential
issue(s) to consider.
Critical: 0 · High: 0 · Medium: 1 · Low: 3
If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).
- [Medium] rxrpc_update_rack_rto_timer() (net/rxrpc/input_rack.c) never
stops the RTO timer once every transmitted DATA packet has been ACK'd.
- [Low] In the new rxrpc_update_rack_rto_timer()
(net/rxrpc/input_rack.c), `rto = ktime_add(earliest,…
- [Low] The new RTO rearm in rxrpc_input_call_event()
(net/rxrpc/call_event.c:456-463) uses `rack_timer_mode == OFF &&…
- [Low] The new rxrpc_call::cong_in_recovery field is commented "If we're
in Fast retransmit recovery", but it stays true after the call leaves…
--
rxrpc: Fix RACK-TLP implementation
This patch fixes several parts of the rxrpc RACK-TLP implementation. It
moves the recovery flag from rxrpc_ack_summary into rxrpc_call, rearms or
extends the RTO timer at the end of rxrpc_input_call_event(), and
initialises the TLP state only on entry to FAST_RETRANSMIT. It also moves
the segment_xmit_ts reset out of rxrpc_rack_mark_lost() and changes the
flight_size check in rxrpc_tlp_calc_pto().
> diff --git a/net/rxrpc/call_event.c b/net/rxrpc/call_event.c
> index 62e15b03c9c2e..2b3bd5355a023 100644
> --- a/net/rxrpc/call_event.c
> +++ b/net/rxrpc/call_event.c
[ ... ]
> @@ -448,6 +450,24 @@ bool rxrpc_input_call_event(struct rxrpc_call *call)
> rxrpc_propose_ack_input_data);
> }
>
> + /* Need to rearm the RTO timer if we don't start the TLP-PTO
> + * timer [RFC8985 7.3].
> + */
> + if (call->rack_timer_mode == RXRPC_CALL_RACKTIMER_OFF &&
> + call->tx_in_flight > 0) {
> + ktime_t rto = rxrpc_get_rto_backoff(call, false);
> +
> + call->rack_timer_mode = RXRPC_CALL_RACKTIMER_RTO;
> + call->rack_timo_at = ktime_add(ktime_get_real(), rto);
> + trace_rxrpc_rack_timer(call, rto, false);
> + trace_rxrpc_timer_set(call, rto, rxrpc_timer_trace_rack_rto);
[Severity: Low]
Can tx_in_flight be non-zero here only because of a TLP probe, after the
Tx phase has already ended?
The commit message says the RTO is rearmed "if DATA packets have been sent
but not yet ACK'd". However, tx_in_flight also counts a TLP retransmission
of a segment that has already been soft-ACK'd:
net/rxrpc/output.c:rxrpc_send_data_packet() {
...
if (req->tlp_probe && test_bit(ix, &tq->segment_acked)) {
...
if (!call->tlp_in_flight) {
call->tlp_in_flight = true;
call->tx_in_flight++;
}
...
}
Suppose the final ACK then hard-ACKs the whole window. tlp_seq goes
through the soft ACK to hard ACK branch of rxrpc_rotate_tx_window(), and
that branch doesn't call rxrpc_tlp_end_probe():
} else if (test_bit(ix, &tq->segment_acked)) {
/* Soft ACK -> hard ACK. */
call->acks_nr_sacks--;
trace_rxrpc_rotate(call, tq, summary, seq, rxrpc_rotate_trace_sack);
}
rxrpc_input_ack() then calls rxrpc_end_tx_phase(), which sets
rack_timer_mode to RXRPC_CALL_RACKTIMER_OFF. It then jumps to send_response
and skips check_for_tlp_probe, so the probe isn't ended there either.
Back in rxrpc_input_call_event(), the mode is OFF and tx_in_flight is 1.
An RTO therefore gets armed on a call in CLIENT_AWAIT_REPLY or
CLIENT_RECV_REPLY. When it fires, rxrpc_rack_timer_expired() calls
rxrpc_congestion_timeout() even though nothing is outstanding.
rxrpc_tlp_probe_loss() may not clear the probe if rto_us has grown since
the probe was sent. In that case the mode goes back to OFF with
tx_in_flight still 1, and this block arms the RTO again.
Could this keep rearming the RTO on a call that has finished transmitting?
[ ... ]
> diff --git a/net/rxrpc/input.c b/net/rxrpc/input.c
> index 66be37f214105..aa3af5a10c015 100644
> --- a/net/rxrpc/input.c
> +++ b/net/rxrpc/input.c
[ ... ]
> @@ -97,12 +98,12 @@ static void rxrpc_congestion_management(struct rxrpc_call *call,
> call->cong_extra = 0;
> call->cong_dup_acks = 0;
> summary->need_retransmit = true;
> - summary->in_fast_or_rto_recovery = true;
> + call->cong_in_recovery = true;
> + rxrpc_tlp_init(call);
> goto out;
>
> case RXRPC_CA_FAST_RETRANSMIT:
> - rxrpc_tlp_init(call);
> - summary->in_fast_or_rto_recovery = true;
> + call->cong_in_recovery = true;
> if (!summary->new_low_snack) {
> if (summary->nr_new_sacks == 0)
> call->cong_cwnd += 1;
[Severity: Low]
Does cong_in_recovery stay true after the call has left recovery?
The new field is commented "If we're in Fast retransmit recovery". On the
exit ACK, though, this case sets it to true and then leaves recovery:
} else {
summary->change = rxrpc_cong_progress;
call->cong_cwnd = call->cong_ssthresh;
if (call->acks_nr_snacks == 0) {
summary->exiting_fast_or_rto_recovery = true;
goto resume_normality;
}
}
resume_normality moves cong_ca_state to SLOW_START or CONGEST_AVOIDANCE
but doesn't clear cong_in_recovery.
The flag now outlives the ACK, so a reorder timer that fires before the
next ACK can still see it:
rxrpc_rack_timer_expired()
rxrpc_rack_detect_loss_and_arm_timer()
rxrpc_rack_update_reo_wnd()
Here cong_in_recovery is true while cong_ca_state says recovery is over.
With !rack_reordering_seen, rack_reo_wnd is set to 0, and a later RTO
uses that value in rxrpc_rack_mark_losses_on_rto().
The reorder path itself can't declare new losses, because acks_nr_snacks
is 0 at exit.
Would clearing cong_in_recovery in resume_normality keep the field
consistent with cong_ca_state and with its comment?
[ ... ]
> diff --git a/net/rxrpc/input_rack.c b/net/rxrpc/input_rack.c
> index 240362109a3b3..473046562b0bd 100644
> --- a/net/rxrpc/input_rack.c
> +++ b/net/rxrpc/input_rack.c
[ ... ]
> @@ -446,3 +447,50 @@ void rxrpc_rack_timer_expired(struct rxrpc_call *call, ktime_t overran_by)
> pr_warn("Unexpected rack timer %u", mode);
> }
> }
> +
> +/*
> + * Update the RACK RTO timer after new data is ACK'd.
> + */
> +void rxrpc_update_rack_rto_timer(struct rxrpc_call *call)
> +{
> + struct rxrpc_txqueue *tq;
> + ktime_t earliest = KTIME_MAX, rto;
> +
> + if (!call->tx_in_flight)
> + return;
[Severity: Medium]
Should the RTO be stopped here when nothing is in flight, instead of
returning with the old deadline still set?
After this early return, rack_timer_mode is still
RXRPC_CALL_RACKTIMER_RTO and rack_timo_at keeps its old value. The new
block in rxrpc_input_call_event() can only arm the RTO or move it later,
so nothing cancels it.
Here is one way to reach this:
1. The RTO is armed when rxrpc_input_call_event() starts, so in_rto is
true.
2. An ACK hard-ACKs everything that has been transmitted. The last packet
hasn't been sent yet, so rxrpc_end_tx_phase() isn't called.
3. rxrpc_rotate_tx_window() drops tx_in_flight to 0, and
RXRPC_CALL_NEW_DATA_ACKED gets set.
4. Nothing new is queued, so no TLP-PTO replaces the RTO, and this
function returns early.
The timer is still rearmed through set(call->rack_timo_at). When it
fires, rxrpc_rack_timer_expired() calls rxrpc_congestion_timeout():
set_bit(RXRPC_CALL_RETRANS_TIMEOUT, &call->flags);
call->cong_ssthresh = umax(call->tx_in_flight / 2, 2);
call->cong_cwnd = 1;
This sets cwnd to 1 and ssthresh to 2 even though nothing was lost.
RFC 6298 section 5.2, which RFC 8985 uses for the RTO, says to turn off
the retransmission timer once all outstanding data has been acknowledged.
The new arm-on-OFF code also makes this more likely. It now arms an RTO
after RTO-driven resends and after the reorder timer fires, where
previously no timer was set.
[ ... ]
> + if (earliest != KTIME_MAX) {
> + rto = ktime_add(earliest, rxrpc_get_rto_backoff(call, false));
> + if (ktime_after(rto, call->rack_timo_at)) {
> + call->rack_timer_mode = RXRPC_CALL_RACKTIMER_RTO;
> + call->rack_timo_at = rto;
> + trace_rxrpc_rack_timer(call, rto, false);
> + trace_rxrpc_timer_set(call, rto, rxrpc_timer_trace_rack_rto);
[Severity: Low]
Is rto the right value to pass to these tracepoints?
Here rto is an absolute CLOCK_REALTIME deadline, because earliest comes
from rxrpc_get_xmit_ts(). Storing it in rack_timo_at is correct. However,
trace_rxrpc_rack_timer() and trace_rxrpc_timer_set() take a ktime_t delay
and print it as to=%lld via ktime_to_us().
The other rack_rto trace site added by this patch, in
rxrpc_input_call_event(), passes a relative rto:
call->rack_timo_at = ktime_add(ktime_get_real(), rto);
trace_rxrpc_rack_timer(call, rto, false);
trace_rxrpc_timer_set(call, rto, rxrpc_timer_trace_rack_rto);
Traces from this path will therefore show the wall-clock time since the
epoch in microseconds, not the time left until the RTO fires.
Should a relative delay be passed here, as the other callers do?
[ ... ]
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261124161302.4044422-1-dhowells%40redhat.com
^ permalink raw reply [flat|nested] 19+ messages in thread