]> www.infradead.org Git - users/hch/misc.git/commitdiff
tcp: reorganize SYN ECN code
authorIlpo Järvinen <ij@kernel.org>
Thu, 11 Sep 2025 11:06:29 +0000 (13:06 +0200)
committerJakub Kicinski <kuba@kernel.org>
Mon, 15 Sep 2025 23:26:33 +0000 (16:26 -0700)
Prepare for AccECN that needs to have access here on IP ECN
field value which is only available after INET_ECN_xmit().

No functional changes.

Signed-off-by: Ilpo Järvinen <ij@kernel.org>
Signed-off-by: Chia-Yu Chang <chia-yu.chang@nokia-bell-labs.com>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Link: https://patch.msgid.link/20250911110642.87529-2-chia-yu.chang@nokia-bell-labs.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/ipv4/tcp_output.c

index e180364b8ddad4baa9978418ffd9c8b871342cb9..54b8faa3ad9535453d1569d2e6f036ef8c1ea921 100644 (file)
@@ -350,10 +350,11 @@ static void tcp_ecn_send_syn(struct sock *sk, struct sk_buff *skb)
        tp->ecn_flags = 0;
 
        if (use_ecn) {
-               TCP_SKB_CB(skb)->tcp_flags |= TCPHDR_ECE | TCPHDR_CWR;
-               tcp_ecn_mode_set(tp, TCP_ECN_MODE_RFC3168);
                if (tcp_ca_needs_ecn(sk) || bpf_needs_ecn)
                        INET_ECN_xmit(sk);
+
+               TCP_SKB_CB(skb)->tcp_flags |= TCPHDR_ECE | TCPHDR_CWR;
+               tcp_ecn_mode_set(tp, TCP_ECN_MODE_RFC3168);
        }
 }