From df5c4cbd8f6fc9eaccd140ad298df6bce9ede98d Mon Sep 17 00:00:00 2001 From: Chia-Yu Chang Date: Sun, 25 Aug 2024 10:27:50 +0200 Subject: [PATCH] Update --- include/linux/tcp.h | 3 ++- net/ipv4/tcp.c | 1 + net/ipv4/tcp_input.c | 12 +++++++++--- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/include/linux/tcp.h b/include/linux/tcp.h index af509652f59d..94e9ee76a024 100644 --- a/include/linux/tcp.h +++ b/include/linux/tcp.h @@ -389,7 +389,8 @@ struct tcp_sock { u8 dup_ack_counter:2, tlp_retrans:1, /* TLP is a retransmission */ syn_ect_snt:2, /* AccECN ECT memory, only */ - syn_ect_rcv:2; /* ... needed durign 3WHS + first seqno */ + syn_ect_rcv:2, /* ... needed durign 3WHS + first seqno */ + wait_third_ack:1; /* Need 3rd ack in simultaneous ope nfor AccECN */ u8 accecn_fail_mode:4, /* AccECN failure handling */ saw_accecn_opt:2, /* An AccECN option was seen */ first_data_ack:1; /* Check for first data ack */ diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index fa8882e0eda3..723a7295c608 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c @@ -3079,6 +3079,7 @@ int tcp_disconnect(struct sock *sk, int flags) tp->window_clamp = 0; tp->delivered = 0; tp->delivered_ce = 0; + tp->wait_third_ack = 0; tp->accecn_fail_mode = 0; tp->saw_accecn_opt = TCP_ACCECN_OPT_NOT_SEEN; tp->first_data_ack = 0; diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index 0ddb0099eac9..5a236cc57e44 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c @@ -6492,8 +6492,10 @@ static bool tcp_validate_incoming(struct sock *sk, struct sk_buff *skb, TCP_SKB_CB(skb)->seq + 1 == TCP_SKB_CB(skb)->end_seq && TCP_SKB_CB(skb)->seq + 1 == tp->rcv_nxt && TCP_SKB_CB(skb)->ack_seq == tp->snd_nxt) { - if (!tcp_ecn_disabled(tp)) + if (!tcp_ecn_disabled(tp)) { + tp->wait_third_ack = true; __tcp_send_ack(sk, tp->rcv_nxt, tcp_accecn_reflector_flags(tp->syn_ect_rcv)); + } goto pass; } @@ -6712,6 +6714,10 @@ void tcp_rcv_established(struct sock *sk, struct sk_buff *skb) return; step5: + if (tcp_ecn_mode_accecn(tp) && tp->wait_third_ack) { + tp->wait_third_ack = false; + tcp_accecn_third_ack(sk, skb, tp->syn_ect_snt); + } tcp_ecn_received_counters(sk, skb, len - th->doff * 4); reason = tcp_ack(sk, skb, FLAG_SLOWPATH | FLAG_UPDATE_TS_RECENT); @@ -7322,13 +7328,13 @@ tcp_rcv_state_process(struct sock *sk, struct sk_buff *skb) tp->lsndtime = tcp_jiffies32; tcp_initialize_rcv_mss(sk); - if (tcp_ecn_mode_accecn(tp)) + if (tcp_ecn_mode_accecn(tp) && !tp->wait_third_ack) tcp_accecn_third_ack(sk, skb, tp->syn_ect_snt); tcp_fast_path_on(tp); if (sk->sk_shutdown & SEND_SHUTDOWN) tcp_shutdown(sk, SEND_SHUTDOWN); - if (sk->sk_socket) + if (sk->sk_socket && !tp->wait_third_ack) goto consume; break;