From: David Howells <dhowells@redhat.com>
To: netdev@vger.kernel.org
Cc: David Howells <dhowells@redhat.com>,
Marc Dionne <marc.dionne@auristor.com>,
Jakub Kicinski <kuba@kernel.org>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Paolo Abeni <pabeni@redhat.com>, Simon Horman <horms@kernel.org>,
linux-afs@lists.infradead.org, linux-kernel@vger.kernel.org,
Jeffrey Altman <jaltman@auristor.com>,
stable@vger.kernel.org
Subject: [PATCH net v3 10/10] rxrpc: Fix RACK-TLP implementation
Date: Tue, 24 Nov 2026 16:12:58 +0000 [thread overview]
Message-ID: <20261124161302.4044422-11-dhowells@redhat.com> (raw)
In-Reply-To: <20261124161302.4044422-1-dhowells@redhat.com>
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);
+ }
+ }
+}
prev parent reply other threads:[~2026-11-24 16:14 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
[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 ` [PATCH net v3 03/10] rxrpc: Fix carrying of in-flight calc over retransmission 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
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 ` [PATCH net v3 06/10] rxrpc: Fix lost driving of congestion management retransmission timeout 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
2026-11-24 16:12 ` [PATCH net v3 08/10] rxrpc: Fix detection of TLP probe response 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 ` David Howells [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261124161302.4044422-11-dhowells@redhat.com \
--to=dhowells@redhat.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=jaltman@auristor.com \
--cc=kuba@kernel.org \
--cc=linux-afs@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=marc.dionne@auristor.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox