* [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; 10+ 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] 10+ 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-24 16:12 ` [PATCH net v3 03/10] rxrpc: Fix carrying of in-flight calc over retransmission David Howells
` (7 subsequent siblings)
9 siblings, 0 replies; 10+ 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] 10+ 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-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, 0 replies; 10+ 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] 10+ 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-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, 0 replies; 10+ 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] 10+ 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-24 16:12 ` [PATCH net v3 06/10] rxrpc: Fix lost driving of congestion management retransmission timeout David Howells
` (4 subsequent siblings)
9 siblings, 0 replies; 10+ 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] 10+ 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-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, 0 replies; 10+ 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] 10+ 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-24 16:12 ` [PATCH net v3 08/10] rxrpc: Fix detection of TLP probe response David Howells
` (2 subsequent siblings)
9 siblings, 0 replies; 10+ 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] 10+ 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-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, 0 replies; 10+ 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] 10+ 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-24 16:12 ` [PATCH net v3 10/10] rxrpc: Fix RACK-TLP implementation David Howells
9 siblings, 0 replies; 10+ 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] 10+ 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
9 siblings, 0 replies; 10+ 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] 10+ messages in thread