tcp: Pass flags to __tcp_send_ack
authorIlpo Järvinen <ij@kernel.org>
Wed, 5 Mar 2025 22:38:52 +0000 (23:38 +0100)
committerDavid S. Miller <davem@davemloft.net>
Mon, 17 Mar 2025 13:56:38 +0000 (13:56 +0000)
Accurate ECN needs to send custom flags to handle IP-ECN
field reflection during handshake.

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>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/net/tcp.h
net/ipv4/bpf_tcp_ca.c
net/ipv4/tcp_dctcp.h
net/ipv4/tcp_output.c

index c6bdd3d6315982dafa2d7f0f8fcf3134cc3f8b42..d08fbf90495de69b157d3c87c50e82d781a365df 100644 (file)
@@ -707,7 +707,7 @@ void tcp_send_active_reset(struct sock *sk, gfp_t priority,
                           enum sk_rst_reason reason);
 int tcp_send_synack(struct sock *);
 void tcp_push_one(struct sock *, unsigned int mss_now);
-void __tcp_send_ack(struct sock *sk, u32 rcv_nxt);
+void __tcp_send_ack(struct sock *sk, u32 rcv_nxt, u16 flags);
 void tcp_send_ack(struct sock *sk);
 void tcp_send_delayed_ack(struct sock *sk);
 void tcp_send_loss_probe(struct sock *sk);
index 554804774628e4b3d03bc3b19b96d717a581439e..e01492234b0b349498f8e56c2f07d8bba092c00e 100644 (file)
@@ -121,7 +121,7 @@ static int bpf_tcp_ca_btf_struct_access(struct bpf_verifier_log *log,
 BPF_CALL_2(bpf_tcp_send_ack, struct tcp_sock *, tp, u32, rcv_nxt)
 {
        /* bpf_tcp_ca prog cannot have NULL tp */
-       __tcp_send_ack((struct sock *)tp, rcv_nxt);
+       __tcp_send_ack((struct sock *)tp, rcv_nxt, 0);
        return 0;
 }
 
index d69a77cbd0c75fb6562ba1970ed0bc552b2570b1..4b0259111d816610ca9459a3909f5ee8d0a05d50 100644 (file)
@@ -28,7 +28,7 @@ static inline void dctcp_ece_ack_update(struct sock *sk, enum tcp_ca_event evt,
                 */
                if (inet_csk(sk)->icsk_ack.pending & ICSK_ACK_TIMER) {
                        dctcp_ece_ack_cwr(sk, *ce_state);
-                       __tcp_send_ack(sk, *prior_rcv_nxt);
+                       __tcp_send_ack(sk, *prior_rcv_nxt, 0);
                }
                inet_csk(sk)->icsk_ack.pending |= ICSK_ACK_NOW;
        }
index fffbd3ee44edc5991a0db02dfca1a9d4c73b8216..e0a4e5432399a3874e471f2d908bf976350f2696 100644 (file)
@@ -4240,7 +4240,7 @@ void tcp_send_delayed_ack(struct sock *sk)
 }
 
 /* This routine sends an ack and also updates the window. */
-void __tcp_send_ack(struct sock *sk, u32 rcv_nxt)
+void __tcp_send_ack(struct sock *sk, u32 rcv_nxt, u16 flags)
 {
        struct sk_buff *buff;
 
@@ -4269,7 +4269,7 @@ void __tcp_send_ack(struct sock *sk, u32 rcv_nxt)
 
        /* Reserve space for headers and prepare control bits. */
        skb_reserve(buff, MAX_TCP_HEADER);
-       tcp_init_nondata_skb(buff, tcp_acceptable_seq(sk), TCPHDR_ACK);
+       tcp_init_nondata_skb(buff, tcp_acceptable_seq(sk), TCPHDR_ACK | flags);
 
        /* We do not want pure acks influencing TCP Small Queues or fq/pacing
         * too much.
@@ -4284,7 +4284,7 @@ EXPORT_SYMBOL_GPL(__tcp_send_ack);
 
 void tcp_send_ack(struct sock *sk)
 {
-       __tcp_send_ack(sk, tcp_sk(sk)->rcv_nxt);
+       __tcp_send_ack(sk, tcp_sk(sk)->rcv_nxt, 0);
 }
 
 /* This routine sends a packet with an out of date sequence