Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

rxrpc: Fix RTT determination to use any ACK as a source

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
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

David Howells and committed by
David S. Miller
3798680f 75a50c4f

+17 -20
+1 -1
include/trace/events/rxrpc.h
··· 328 328 E_(rxrpc_rtt_tx_ping, "PING") 329 329 330 330 #define rxrpc_rtt_rx_traces \ 331 - EM(rxrpc_rtt_rx_cancel, "CNCL") \ 331 + EM(rxrpc_rtt_rx_other_ack, "OACK") \ 332 332 EM(rxrpc_rtt_rx_obsolete, "OBSL") \ 333 333 EM(rxrpc_rtt_rx_lost, "LOST") \ 334 334 EM(rxrpc_rtt_rx_ping_response, "PONG") \
+16 -19
net/rxrpc/input.c
··· 643 643 clear_bit(i + RXRPC_CALL_RTT_PEND_SHIFT, &call->rtt_avail); 644 644 smp_mb(); /* Read data before setting avail bit */ 645 645 set_bit(i, &call->rtt_avail); 646 - if (type != rxrpc_rtt_rx_cancel) 647 - rxrpc_peer_add_rtt(call, type, i, acked_serial, ack_serial, 648 - sent_at, resp_time); 649 - else 650 - trace_rxrpc_rtt_rx(call, rxrpc_rtt_rx_cancel, i, 651 - orig_serial, acked_serial, 0, 0); 646 + rxrpc_peer_add_rtt(call, type, i, acked_serial, ack_serial, 647 + sent_at, resp_time); 652 648 matched = true; 653 649 } 654 650 ··· 797 801 summary.ack_reason, nr_acks); 798 802 rxrpc_inc_stat(call->rxnet, stat_rx_acks[ack.reason]); 799 803 800 - switch (ack.reason) { 801 - case RXRPC_ACK_PING_RESPONSE: 802 - rxrpc_complete_rtt_probe(call, skb->tstamp, acked_serial, ack_serial, 803 - rxrpc_rtt_rx_ping_response); 804 - break; 805 - case RXRPC_ACK_REQUESTED: 806 - rxrpc_complete_rtt_probe(call, skb->tstamp, acked_serial, ack_serial, 807 - rxrpc_rtt_rx_requested_ack); 808 - break; 809 - default: 810 - if (acked_serial != 0) 804 + if (acked_serial != 0) { 805 + switch (ack.reason) { 806 + case RXRPC_ACK_PING_RESPONSE: 811 807 rxrpc_complete_rtt_probe(call, skb->tstamp, acked_serial, ack_serial, 812 - rxrpc_rtt_rx_cancel); 813 - break; 808 + rxrpc_rtt_rx_ping_response); 809 + break; 810 + case RXRPC_ACK_REQUESTED: 811 + rxrpc_complete_rtt_probe(call, skb->tstamp, acked_serial, ack_serial, 812 + rxrpc_rtt_rx_requested_ack); 813 + break; 814 + default: 815 + rxrpc_complete_rtt_probe(call, skb->tstamp, acked_serial, ack_serial, 816 + rxrpc_rtt_rx_other_ack); 817 + break; 818 + } 814 819 } 815 820 816 821 if (ack.reason == RXRPC_ACK_PING) {