netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eric Dumazet <edumazet@google.com>
To: chia-yu.chang@nokia-bell-labs.com
Cc: pabeni@redhat.com, linux-doc@vger.kernel.org, corbet@lwn.net,
	 horms@kernel.org, dsahern@kernel.org, kuniyu@amazon.com,
	bpf@vger.kernel.org,  netdev@vger.kernel.org,
	dave.taht@gmail.com, jhs@mojatatu.com,  kuba@kernel.org,
	stephen@networkplumber.org, xiyou.wangcong@gmail.com,
	 jiri@resnulli.us, davem@davemloft.net, andrew+netdev@lunn.ch,
	 donald.hunter@gmail.com, ast@fiberby.net, liuhangbin@gmail.com,
	 shuah@kernel.org, linux-kselftest@vger.kernel.org,
	ij@kernel.org,  ncardwell@google.com,
	koen.de_schepper@nokia-bell-labs.com,  g.white@cablelabs.com,
	ingemar.s.johansson@ericsson.com,  mirja.kuehlewind@ericsson.com,
	cheshire@apple.com, rs.ietf@gmx.at,  Jason_Livingood@comcast.com,
	vidhi_goel@apple.com,
	 Olivier Tilmans <olivier.tilmans@nokia.com>
Subject: Re: [PATCH v15 net-next 06/14] tcp: accecn: AccECN negotiation
Date: Thu, 21 Aug 2025 05:22:10 -0700	[thread overview]
Message-ID: <CANn89iKAUB4JOoHDPrxsRDeBTXPEF8Fu4ab2O_w2QTnRNXJvzg@mail.gmail.com> (raw)
In-Reply-To: <20250815083930.10547-7-chia-yu.chang@nokia-bell-labs.com>

On Fri, Aug 15, 2025 at 1:39 AM <chia-yu.chang@nokia-bell-labs.com> wrote:
>
> From: Ilpo Järvinen <ij@kernel.org>
>
> Accurate ECN negotiation parts based on the specification:
>   https://tools.ietf.org/id/draft-ietf-tcpm-accurate-ecn-28.txt
>
> Accurate ECN is negotiated using ECE, CWR and AE flags in the
> TCP header. TCP falls back into using RFC3168 ECN if one of the
> ends supports only RFC3168-style ECN.
>
> The AccECN negotiation includes reflecting IP ECN field value
> seen in SYN and SYNACK back using the same bits as negotiation
> to allow responding to SYN CE marks and to detect ECN field
> mangling. CE marks should not occur currently because SYN=1
> segments are sent with Non-ECT in IP ECN field (but proposal
> exists to remove this restriction).
>
> Reflecting SYN IP ECN field in SYNACK is relatively simple.
> Reflecting SYNACK IP ECN field in the final/third ACK of
> the handshake is more challenging. Linux TCP code is not well
> prepared for using the final/third ACK a signalling channel
> which makes things somewhat complicated here.
>
> tcp_ecn sysctl can be used to select the highest ECN variant
> (Accurate ECN, ECN, No ECN) that is attemped to be negotiated and
> requested for incoming connection and outgoing connection:
> TCP_ECN_IN_NOECN_OUT_NOECN, TCP_ECN_IN_ECN_OUT_ECN,
> TCP_ECN_IN_ECN_OUT_NOECN, TCP_ECN_IN_ACCECN_OUT_ACCECN,
> TCP_ECN_IN_ACCECN_OUT_ECN, and TCP_ECN_IN_ACCECN_OUT_NOECN.
>
> After this patch, the size of tcp_request_sock remains unchanged
> and no new holes are added. Below are the pahole outcomes before
> and after this patch:
>
>

> Signed-off-by: Ilpo Järvinen <ij@kernel.org>
> Co-developed-by: Olivier Tilmans <olivier.tilmans@nokia.com>
> Signed-off-by: Olivier Tilmans <olivier.tilmans@nokia.com>
> Co-developed-by: Chia-Yu Chang <chia-yu.chang@nokia-bell-labs.com>
> Signed-off-by: Chia-Yu Chang <chia-yu.chang@nokia-bell-labs.com>
> Acked-by: Paolo Abeni <pabeni@redhat.com>
>


> +       if (tp->ecn_flags & TCP_ECN_MODE_ACCECN) {
> +               TCP_SKB_CB(skb)->tcp_flags &= ~TCPHDR_ACE;
> +               TCP_SKB_CB(skb)->tcp_flags |=
> +                       tcp_accecn_reflector_flags(tp->syn_ect_rcv);
> +               tp->syn_ect_snt = inet_sk(sk)->tos & INET_ECN_MASK;
> +       }
>  }
>
>  /* Packet ECN state for a SYN.  */
> @@ -125,8 +377,20 @@ static inline void tcp_ecn_send_syn(struct sock *sk, struct sk_buff *skb)
>  {
>         struct tcp_sock *tp = tcp_sk(sk);
>         bool bpf_needs_ecn = tcp_bpf_ca_needs_ecn(sk);
> -       bool use_ecn = READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_ecn) == 1 ||
> -               tcp_ca_needs_ecn(sk) || bpf_needs_ecn;
> +       bool use_ecn, use_accecn;
> +       u8 tcp_ecn = READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_ecn);
> +
> +       /* +================+===========================+
> +        * | tcp_ecn values |    Outgoing connections   |
> +        * +================+===========================+
> +        * |     0,2,5      |     Do not request ECN    |
> +        * |      1,4       |   Request ECN connection  |
> +        * |       3        | Request AccECN connection |
> +        * +================+===========================+
> +        */

You have nice macros, maybe use them ?

      TCP_ECN_IN_NOECN_OUT_NOECN = 0,
       TCP_ECN_IN_ECN_OUT_ECN = 1,
       TCP_ECN_IN_ECN_OUT_NOECN = 2,
       TCP_ECN_IN_ACCECN_OUT_ACCECN = 3,
       TCP_ECN_IN_ACCECN_OUT_ECN = 4,
       TCP_ECN_IN_ACCECN_OUT_NOECN = 5,

This can be done later, no need to respin.

Reviewed-by: Eric Dumazet <edumazet@google.com>

  reply	other threads:[~2025-08-21 12:22 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-15  8:39 [PATCH v15 net-next 00/14] AccECN protocol patch series chia-yu.chang
2025-08-15  8:39 ` [PATCH v15 net-next 01/14] tcp: reorganize SYN ECN code chia-yu.chang
2025-08-15  8:39 ` [PATCH v15 net-next 02/14] tcp: fast path functions later chia-yu.chang
2025-08-15  8:39 ` [PATCH v15 net-next 03/14] tcp: reorganize tcp_sock_write_txrx group for variables later chia-yu.chang
2025-08-15  8:39 ` [PATCH v15 net-next 04/14] tcp: ecn functions in separated include file chia-yu.chang
2025-08-21  8:53   ` Eric Dumazet
2025-08-15  8:39 ` [PATCH v15 net-next 05/14] tcp: AccECN core chia-yu.chang
2025-08-15  8:39 ` [PATCH v15 net-next 06/14] tcp: accecn: AccECN negotiation chia-yu.chang
2025-08-21 12:22   ` Eric Dumazet [this message]
2025-08-15  8:39 ` [PATCH v15 net-next 07/14] tcp: accecn: add AccECN rx byte counters chia-yu.chang
2025-08-21  8:57   ` Eric Dumazet
2025-08-15  8:39 ` [PATCH v15 net-next 08/14] tcp: accecn: AccECN needs to know delivered bytes chia-yu.chang
2025-08-21 12:24   ` Eric Dumazet
2025-08-21 14:33     ` Chia-Yu Chang (Nokia)
2025-08-15  8:39 ` [PATCH v15 net-next 09/14] tcp: sack option handling improvements chia-yu.chang
2025-08-15  8:39 ` [PATCH v15 net-next 10/14] tcp: accecn: AccECN option chia-yu.chang
2025-08-21 12:29   ` Eric Dumazet
2025-08-21 14:58     ` Chia-Yu Chang (Nokia)
2025-08-21 17:32       ` Ilpo Järvinen
2025-08-21 17:46       ` Eric Dumazet
2025-09-02 12:23         ` Chia-Yu Chang (Nokia)
2025-08-15  8:39 ` [PATCH v15 net-next 11/14] tcp: accecn: AccECN option send control chia-yu.chang
2025-08-21 12:46   ` Eric Dumazet
2025-08-15  8:39 ` [PATCH v15 net-next 12/14] tcp: accecn: AccECN option failure handling chia-yu.chang
2025-08-21 12:55   ` Eric Dumazet
2025-08-22 10:00     ` Chia-Yu Chang (Nokia)
2025-08-15  8:39 ` [PATCH v15 net-next 13/14] tcp: accecn: AccECN option ceb/cep and ACE field multi-wrap heuristics chia-yu.chang
2025-08-15  8:39 ` [PATCH v15 net-next 14/14] tcp: accecn: try to fit AccECN option with SACK chia-yu.chang
2025-08-21 13:04   ` Eric Dumazet
2025-08-22 10:08     ` Chia-Yu Chang (Nokia)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CANn89iKAUB4JOoHDPrxsRDeBTXPEF8Fu4ab2O_w2QTnRNXJvzg@mail.gmail.com \
    --to=edumazet@google.com \
    --cc=Jason_Livingood@comcast.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=ast@fiberby.net \
    --cc=bpf@vger.kernel.org \
    --cc=cheshire@apple.com \
    --cc=chia-yu.chang@nokia-bell-labs.com \
    --cc=corbet@lwn.net \
    --cc=dave.taht@gmail.com \
    --cc=davem@davemloft.net \
    --cc=donald.hunter@gmail.com \
    --cc=dsahern@kernel.org \
    --cc=g.white@cablelabs.com \
    --cc=horms@kernel.org \
    --cc=ij@kernel.org \
    --cc=ingemar.s.johansson@ericsson.com \
    --cc=jhs@mojatatu.com \
    --cc=jiri@resnulli.us \
    --cc=koen.de_schepper@nokia-bell-labs.com \
    --cc=kuba@kernel.org \
    --cc=kuniyu@amazon.com \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=liuhangbin@gmail.com \
    --cc=mirja.kuehlewind@ericsson.com \
    --cc=ncardwell@google.com \
    --cc=netdev@vger.kernel.org \
    --cc=olivier.tilmans@nokia.com \
    --cc=pabeni@redhat.com \
    --cc=rs.ietf@gmx.at \
    --cc=shuah@kernel.org \
    --cc=stephen@networkplumber.org \
    --cc=vidhi_goel@apple.com \
    --cc=xiyou.wangcong@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).