* [PATCH net 0/2] rxrpc: ACK handling fixes
@ 2023-11-16 13:12 David Howells
2023-11-16 13:12 ` [PATCH net 1/2] rxrpc: Fix RTT determination to use any ACK as a source David Howells
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: David Howells @ 2023-11-16 13:12 UTC (permalink / raw)
To: netdev
Cc: David Howells, Marc Dionne, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, linux-afs, linux-kernel
Here are a couple of patches to fix ACK handling in AF_RXRPC:
(1) Allow RTT determination to use an ACK of any type as the response from
which to calculate RTT, provided ack.serial matches the serial number
of the outgoing packet.
(2) Defer the response to a PING ACK packet (or any ACK with the
REQUEST_ACK flag set) until after we've parsed the packet so that we
carry up to date information if the Tx or Rx rings are advanced.
David
---
The patches can be found here also:
http://git.kernel.org/cgit/linux/kernel/git/dhowells/linux-fs.git/log/?h=rxrpc-fixes
David Howells (2):
rxrpc: Fix RTT determination to use any ACK as a source
rxrpc: Defer the response to a PING ACK until we've parsed it
include/trace/events/rxrpc.h | 2 +-
net/rxrpc/input.c | 61 +++++++++++++++++-------------------
2 files changed, 30 insertions(+), 33 deletions(-)
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH net 1/2] rxrpc: Fix RTT determination to use any ACK as a source
2023-11-16 13:12 [PATCH net 0/2] rxrpc: ACK handling fixes David Howells
@ 2023-11-16 13:12 ` David Howells
2023-11-17 6:02 ` Jeffrey E Altman
2023-11-16 13:12 ` [PATCH net 2/2] rxrpc: Defer the response to a PING ACK until we've parsed it David Howells
2023-11-17 3:00 ` [PATCH net 0/2] rxrpc: ACK handling fixes patchwork-bot+netdevbpf
2 siblings, 1 reply; 6+ messages in thread
From: David Howells @ 2023-11-16 13:12 UTC (permalink / raw)
To: netdev
Cc: David Howells, Marc Dionne, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, linux-afs, linux-kernel
Fix RTT determination to be able to use any type of ACK as the response
from which RTT can be calculated provided its ack.serial is non-zero and
matches the serial number of an outgoing DATA or ACK packet. This
shouldn't be limited to REQUESTED-type ACKs as these can have other types
substituted for them for things like duplicate or out-of-order packets.
Fixes: 4700c4d80b7b ("rxrpc: Fix loss of RTT samples due to interposed ACK")
Signed-off-by: David Howells <dhowells@redhat.com>
cc: Marc Dionne <marc.dionne@auristor.com>
cc: "David S. Miller" <davem@davemloft.net>
cc: Eric Dumazet <edumazet@google.com>
cc: Jakub Kicinski <kuba@kernel.org>
cc: Paolo Abeni <pabeni@redhat.com>
cc: linux-afs@lists.infradead.org
cc: netdev@vger.kernel.org
---
include/trace/events/rxrpc.h | 2 +-
net/rxrpc/input.c | 35 ++++++++++++++++-------------------
2 files changed, 17 insertions(+), 20 deletions(-)
diff --git a/include/trace/events/rxrpc.h b/include/trace/events/rxrpc.h
index 4c53a5ef6257..f7e537f64db4 100644
--- a/include/trace/events/rxrpc.h
+++ b/include/trace/events/rxrpc.h
@@ -328,7 +328,7 @@
E_(rxrpc_rtt_tx_ping, "PING")
#define rxrpc_rtt_rx_traces \
- EM(rxrpc_rtt_rx_cancel, "CNCL") \
+ EM(rxrpc_rtt_rx_other_ack, "OACK") \
EM(rxrpc_rtt_rx_obsolete, "OBSL") \
EM(rxrpc_rtt_rx_lost, "LOST") \
EM(rxrpc_rtt_rx_ping_response, "PONG") \
diff --git a/net/rxrpc/input.c b/net/rxrpc/input.c
index 030d64f282f3..3f9594d12519 100644
--- a/net/rxrpc/input.c
+++ b/net/rxrpc/input.c
@@ -643,12 +643,8 @@ static void rxrpc_complete_rtt_probe(struct rxrpc_call *call,
clear_bit(i + RXRPC_CALL_RTT_PEND_SHIFT, &call->rtt_avail);
smp_mb(); /* Read data before setting avail bit */
set_bit(i, &call->rtt_avail);
- if (type != rxrpc_rtt_rx_cancel)
- rxrpc_peer_add_rtt(call, type, i, acked_serial, ack_serial,
- sent_at, resp_time);
- else
- trace_rxrpc_rtt_rx(call, rxrpc_rtt_rx_cancel, i,
- orig_serial, acked_serial, 0, 0);
+ rxrpc_peer_add_rtt(call, type, i, acked_serial, ack_serial,
+ sent_at, resp_time);
matched = true;
}
@@ -801,20 +797,21 @@ static void rxrpc_input_ack(struct rxrpc_call *call, struct sk_buff *skb)
summary.ack_reason, nr_acks);
rxrpc_inc_stat(call->rxnet, stat_rx_acks[ack.reason]);
- switch (ack.reason) {
- case RXRPC_ACK_PING_RESPONSE:
- rxrpc_complete_rtt_probe(call, skb->tstamp, acked_serial, ack_serial,
- rxrpc_rtt_rx_ping_response);
- break;
- case RXRPC_ACK_REQUESTED:
- rxrpc_complete_rtt_probe(call, skb->tstamp, acked_serial, ack_serial,
- rxrpc_rtt_rx_requested_ack);
- break;
- default:
- if (acked_serial != 0)
+ if (acked_serial != 0) {
+ switch (ack.reason) {
+ case RXRPC_ACK_PING_RESPONSE:
rxrpc_complete_rtt_probe(call, skb->tstamp, acked_serial, ack_serial,
- rxrpc_rtt_rx_cancel);
- break;
+ rxrpc_rtt_rx_ping_response);
+ break;
+ case RXRPC_ACK_REQUESTED:
+ rxrpc_complete_rtt_probe(call, skb->tstamp, acked_serial, ack_serial,
+ rxrpc_rtt_rx_requested_ack);
+ break;
+ default:
+ rxrpc_complete_rtt_probe(call, skb->tstamp, acked_serial, ack_serial,
+ rxrpc_rtt_rx_other_ack);
+ break;
+ }
}
if (ack.reason == RXRPC_ACK_PING) {
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH net 2/2] rxrpc: Defer the response to a PING ACK until we've parsed it
2023-11-16 13:12 [PATCH net 0/2] rxrpc: ACK handling fixes David Howells
2023-11-16 13:12 ` [PATCH net 1/2] rxrpc: Fix RTT determination to use any ACK as a source David Howells
@ 2023-11-16 13:12 ` David Howells
2023-11-17 6:04 ` Jeffrey E Altman
2023-11-17 3:00 ` [PATCH net 0/2] rxrpc: ACK handling fixes patchwork-bot+netdevbpf
2 siblings, 1 reply; 6+ messages in thread
From: David Howells @ 2023-11-16 13:12 UTC (permalink / raw)
To: netdev
Cc: David Howells, Marc Dionne, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, linux-afs, linux-kernel
Defer the generation of a PING RESPONSE ACK in response to a PING ACK until
we've parsed the PING ACK so that we pick up any changes to the packet
queue so that we can update ackinfo.
This is also applied to an ACK generated in response to an ACK with the
REQUEST_ACK flag set.
Note that whilst the problem was added in commit 248f219cb8bc, it didn't
really matter at that point because the ACK was proposed in softirq mode
and generated asynchronously later in process context, taking the latest
values at the time. But this fix is only needed since the move to parse
incoming packets in an I/O thread rather than in softirq and generate the
ACK at point of proposal (b0346843b1076b34a0278ff601f8f287535cb064).
Fixes: 248f219cb8bc ("rxrpc: Rewrite the data and ack handling code")
Signed-off-by: David Howells <dhowells@redhat.com>
cc: Marc Dionne <marc.dionne@auristor.com>
cc: "David S. Miller" <davem@davemloft.net>
cc: Eric Dumazet <edumazet@google.com>
cc: Jakub Kicinski <kuba@kernel.org>
cc: Paolo Abeni <pabeni@redhat.com>
cc: linux-afs@lists.infradead.org
cc: netdev@vger.kernel.org
---
net/rxrpc/input.c | 26 +++++++++++++-------------
1 file changed, 13 insertions(+), 13 deletions(-)
diff --git a/net/rxrpc/input.c b/net/rxrpc/input.c
index 3f9594d12519..92495e73b869 100644
--- a/net/rxrpc/input.c
+++ b/net/rxrpc/input.c
@@ -814,14 +814,6 @@ static void rxrpc_input_ack(struct rxrpc_call *call, struct sk_buff *skb)
}
}
- if (ack.reason == RXRPC_ACK_PING) {
- rxrpc_send_ACK(call, RXRPC_ACK_PING_RESPONSE, ack_serial,
- rxrpc_propose_ack_respond_to_ping);
- } else if (sp->hdr.flags & RXRPC_REQUEST_ACK) {
- rxrpc_send_ACK(call, RXRPC_ACK_REQUESTED, ack_serial,
- rxrpc_propose_ack_respond_to_ack);
- }
-
/* If we get an EXCEEDS_WINDOW ACK from the server, it probably
* indicates that the client address changed due to NAT. The server
* lost the call because it switched to a different peer.
@@ -832,7 +824,7 @@ static void rxrpc_input_ack(struct rxrpc_call *call, struct sk_buff *skb)
rxrpc_is_client_call(call)) {
rxrpc_set_call_completion(call, RXRPC_CALL_REMOTELY_ABORTED,
0, -ENETRESET);
- return;
+ goto send_response;
}
/* If we get an OUT_OF_SEQUENCE ACK from the server, that can also
@@ -846,7 +838,7 @@ static void rxrpc_input_ack(struct rxrpc_call *call, struct sk_buff *skb)
rxrpc_is_client_call(call)) {
rxrpc_set_call_completion(call, RXRPC_CALL_REMOTELY_ABORTED,
0, -ENETRESET);
- return;
+ goto send_response;
}
/* Discard any out-of-order or duplicate ACKs (outside lock). */
@@ -854,7 +846,7 @@ static void rxrpc_input_ack(struct rxrpc_call *call, struct sk_buff *skb)
trace_rxrpc_rx_discard_ack(call->debug_id, ack_serial,
first_soft_ack, call->acks_first_seq,
prev_pkt, call->acks_prev_seq);
- return;
+ goto send_response;
}
info.rxMTU = 0;
@@ -894,7 +886,7 @@ static void rxrpc_input_ack(struct rxrpc_call *call, struct sk_buff *skb)
case RXRPC_CALL_SERVER_AWAIT_ACK:
break;
default:
- return;
+ goto send_response;
}
if (before(hard_ack, call->acks_hard_ack) ||
@@ -906,7 +898,7 @@ static void rxrpc_input_ack(struct rxrpc_call *call, struct sk_buff *skb)
if (after(hard_ack, call->acks_hard_ack)) {
if (rxrpc_rotate_tx_window(call, hard_ack, &summary)) {
rxrpc_end_tx_phase(call, false, rxrpc_eproto_unexpected_ack);
- return;
+ goto send_response;
}
}
@@ -924,6 +916,14 @@ static void rxrpc_input_ack(struct rxrpc_call *call, struct sk_buff *skb)
rxrpc_propose_ack_ping_for_lost_reply);
rxrpc_congestion_management(call, skb, &summary, acked_serial);
+
+send_response:
+ if (ack.reason == RXRPC_ACK_PING)
+ rxrpc_send_ACK(call, RXRPC_ACK_PING_RESPONSE, ack_serial,
+ rxrpc_propose_ack_respond_to_ping);
+ else if (sp->hdr.flags & RXRPC_REQUEST_ACK)
+ rxrpc_send_ACK(call, RXRPC_ACK_REQUESTED, ack_serial,
+ rxrpc_propose_ack_respond_to_ack);
}
/*
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH net 0/2] rxrpc: ACK handling fixes
2023-11-16 13:12 [PATCH net 0/2] rxrpc: ACK handling fixes David Howells
2023-11-16 13:12 ` [PATCH net 1/2] rxrpc: Fix RTT determination to use any ACK as a source David Howells
2023-11-16 13:12 ` [PATCH net 2/2] rxrpc: Defer the response to a PING ACK until we've parsed it David Howells
@ 2023-11-17 3:00 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 6+ messages in thread
From: patchwork-bot+netdevbpf @ 2023-11-17 3:00 UTC (permalink / raw)
To: David Howells
Cc: netdev, marc.dionne, davem, edumazet, kuba, pabeni, linux-afs,
linux-kernel
Hello:
This series was applied to netdev/net.git (main)
by David S. Miller <davem@davemloft.net>:
On Thu, 16 Nov 2023 13:12:57 +0000 you wrote:
> Here are a couple of patches to fix ACK handling in AF_RXRPC:
>
> (1) Allow RTT determination to use an ACK of any type as the response from
> which to calculate RTT, provided ack.serial matches the serial number
> of the outgoing packet.
>
> (2) Defer the response to a PING ACK packet (or any ACK with the
> REQUEST_ACK flag set) until after we've parsed the packet so that we
> carry up to date information if the Tx or Rx rings are advanced.
>
> [...]
Here is the summary with links:
- [net,1/2] rxrpc: Fix RTT determination to use any ACK as a source
https://git.kernel.org/netdev/net/c/3798680f2fbb
- [net,2/2] rxrpc: Defer the response to a PING ACK until we've parsed it
https://git.kernel.org/netdev/net/c/1a01319feef7
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH net 1/2] rxrpc: Fix RTT determination to use any ACK as a source
2023-11-16 13:12 ` [PATCH net 1/2] rxrpc: Fix RTT determination to use any ACK as a source David Howells
@ 2023-11-17 6:02 ` Jeffrey E Altman
0 siblings, 0 replies; 6+ messages in thread
From: Jeffrey E Altman @ 2023-11-17 6:02 UTC (permalink / raw)
To: David Howells, netdev
Cc: Marc Dionne, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, linux-afs, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 874 bytes --]
On 11/16/2023 8:12 AM, David Howells wrote:
> Fix RTT determination to be able to use any type of ACK as the response
> from which RTT can be calculated provided its ack.serial is non-zero and
> matches the serial number of an outgoing DATA or ACK packet. This
> shouldn't be limited to REQUESTED-type ACKs as these can have other types
> substituted for them for things like duplicate or out-of-order packets.
>
> Fixes: 4700c4d80b7b ("rxrpc: Fix loss of RTT samples due to interposed ACK")
> Signed-off-by: David Howells <dhowells@redhat.com>
> cc: Marc Dionne <marc.dionne@auristor.com>
> cc: "David S. Miller" <davem@davemloft.net>
> cc: Eric Dumazet <edumazet@google.com>
> cc: Jakub Kicinski <kuba@kernel.org>
> cc: Paolo Abeni <pabeni@redhat.com>
> cc: linux-afs@lists.infradead.org
> cc: netdev@vger.kernel.org
Reviewed-by: Jeffrey Altman <jaltman@auristor.com>
[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4039 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH net 2/2] rxrpc: Defer the response to a PING ACK until we've parsed it
2023-11-16 13:12 ` [PATCH net 2/2] rxrpc: Defer the response to a PING ACK until we've parsed it David Howells
@ 2023-11-17 6:04 ` Jeffrey E Altman
0 siblings, 0 replies; 6+ messages in thread
From: Jeffrey E Altman @ 2023-11-17 6:04 UTC (permalink / raw)
To: David Howells, netdev
Cc: Marc Dionne, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, linux-afs, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 1238 bytes --]
On 11/16/2023 8:12 AM, David Howells wrote:
> Defer the generation of a PING RESPONSE ACK in response to a PING ACK until
> we've parsed the PING ACK so that we pick up any changes to the packet
> queue so that we can update ackinfo.
>
> This is also applied to an ACK generated in response to an ACK with the
> REQUEST_ACK flag set.
>
> Note that whilst the problem was added in commit 248f219cb8bc, it didn't
> really matter at that point because the ACK was proposed in softirq mode
> and generated asynchronously later in process context, taking the latest
> values at the time. But this fix is only needed since the move to parse
> incoming packets in an I/O thread rather than in softirq and generate the
> ACK at point of proposal (b0346843b1076b34a0278ff601f8f287535cb064).
>
> Fixes: 248f219cb8bc ("rxrpc: Rewrite the data and ack handling code")
> Signed-off-by: David Howells <dhowells@redhat.com>
> cc: Marc Dionne <marc.dionne@auristor.com>
> cc: "David S. Miller" <davem@davemloft.net>
> cc: Eric Dumazet <edumazet@google.com>
> cc: Jakub Kicinski <kuba@kernel.org>
> cc: Paolo Abeni <pabeni@redhat.com>
> cc: linux-afs@lists.infradead.org
> cc: netdev@vger.kernel.org
Reviewed-by: Jeffrey Altman <jaltman@auristor.com>
[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4039 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2023-11-17 6:04 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-16 13:12 [PATCH net 0/2] rxrpc: ACK handling fixes David Howells
2023-11-16 13:12 ` [PATCH net 1/2] rxrpc: Fix RTT determination to use any ACK as a source David Howells
2023-11-17 6:02 ` Jeffrey E Altman
2023-11-16 13:12 ` [PATCH net 2/2] rxrpc: Defer the response to a PING ACK until we've parsed it David Howells
2023-11-17 6:04 ` Jeffrey E Altman
2023-11-17 3:00 ` [PATCH net 0/2] rxrpc: ACK handling fixes patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).