Skip to content

Commit fbe0c9b

Browse files
David Morleyopsiff
authored andcommitted
tcp: change data receiver flowlabel after one dup
mainline inclusion from mainline-v6.7-rc1 category: performance This commit changes the data receiver repath behavior to occur after receiving a single duplicate. This can help recover ACK connectivity quicker if a TLP was sent along a nonworking path. For instance, consider the case where we have an initially nonworking forward path and reverse path and subsequently switch to only working forward paths. Before this patch we would have the following behavior. +---------+--------+--------+----------+----------+----------+ | Event | For FL | Rev FL | FP Works | RP Works | Data Del | +---------+--------+--------+----------+----------+----------+ | Initial | A | 1 | N | N | 0 | +---------+--------+--------+----------+----------+----------+ | TLP | A | 1 | N | N | 0 | +---------+--------+--------+----------+----------+----------+ | RTO 1 | B | 1 | Y | N | 1 | +---------+--------+--------+----------+----------+----------+ | RTO 2 | C | 1 | Y | N | 2 | +---------+--------+--------+----------+----------+----------+ | RTO 3 | D | 2 | Y | Y | 3 | +---------+--------+--------+----------+----------+----------+ This patch gets rid of at least RTO 3, avoiding additional unnecessary repaths of a working forward path to a (potentially) nonworking one. In addition, this commit changes the behavior to avoid repathing upon rx of duplicate data if the local endpoint is in CA_Loss (in which case the RTOs will already be changing the outgoing flowlabel). Signed-off-by: David Morley <morleyd@google.com> Signed-off-by: Neal Cardwell <ncardwell@google.com> Signed-off-by: Yuchung Cheng <ycheng@google.com> Tested-by: David Morley <morleyd@google.com> Reviewed-by: Eric Dumazet <edumazet@google.com> Signed-off-by: Paolo Abeni <pabeni@redhat.com> (cherry picked from commit 9394630) Signed-off-by: Wentao Guan <guanwentao@uniontech.com>
1 parent b8e4001 commit fbe0c9b

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

net/ipv4/tcp_input.c

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4613,15 +4613,23 @@ static void tcp_rcv_spurious_retrans(struct sock *sk, const struct sk_buff *skb)
46134613
{
46144614
/* When the ACK path fails or drops most ACKs, the sender would
46154615
* timeout and spuriously retransmit the same segment repeatedly.
4616-
* The receiver remembers and reflects via DSACKs. Leverage the
4617-
* DSACK state and change the txhash to re-route speculatively.
4616+
* If it seems our ACKs are not reaching the other side,
4617+
* based on receiving a duplicate data segment with new flowlabel
4618+
* (suggesting the sender suffered an RTO), and we are not already
4619+
* repathing due to our own RTO, then rehash the socket to repath our
4620+
* packets.
46184621
*/
4619-
if (TCP_SKB_CB(skb)->seq == tcp_sk(sk)->duplicate_sack[0].start_seq &&
4622+
#if IS_ENABLED(CONFIG_IPV6)
4623+
if (inet_csk(sk)->icsk_ca_state != TCP_CA_Loss &&
4624+
skb->protocol == htons(ETH_P_IPV6) &&
4625+
(tcp_sk(sk)->inet_conn.icsk_ack.lrcv_flowlabel !=
4626+
ntohl(ip6_flowlabel(ipv6_hdr(skb)))) &&
46204627
sk_rethink_txhash(sk))
46214628
NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPDUPLICATEDATAREHASH);
46224629

46234630
/* Save last flowlabel after a spurious retrans. */
46244631
tcp_save_lrcv_flowlabel(sk, skb);
4632+
#endif
46254633
}
46264634

46274635
static void tcp_send_dupack(struct sock *sk, const struct sk_buff *skb)

0 commit comments

Comments
 (0)