mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Chia-Yu Chang (Nokia)" <chia-yu.chang@nokia-bell-labs.com>
To: Eric Dumazet <edumazet@kernel.org>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"kuba@kernel.org" <kuba@kernel.org>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"pabeni@redhat.com" <pabeni@redhat.com>,
	"davem@davemloft.net" <davem@davemloft.net>,
	"kuniyu@google.com" <kuniyu@google.com>,
	"ij@kernel.org" <ij@kernel.org>,
	"ncardwell@google.com" <ncardwell@google.com>,
	"koen0607@gmail.com" <koen0607@gmail.com>,
	"g.white@cablelabs.com" <g.white@cablelabs.com>,
	"ingemar.s.johansson@ericsson.com"
	<ingemar.s.johansson@ericsson.com>,
	"mirja.kuehlewind@ericsson.com" <mirja.kuehlewind@ericsson.com>,
	"cheshire@apple.com" <cheshire@apple.com>,
	"rs.ietf@gmx.at" <rs.ietf@gmx.at>,
	"Jason_Livingood@comcast.com" <Jason_Livingood@comcast.com>,
	"vidhi_goel@apple.com" <vidhi_goel@apple.com>,
	"Mike_Rudolph@comcast.com" <Mike_Rudolph@comcast.com>,
	"Jeff_Howe@comcast.com" <Jeff_Howe@comcast.com>,
	"srichard@netapp.com" <srichard@netapp.com>
Subject: RE: [PATCH net-next v4 3/4] tcp: add TCP_ECN_SEND_ECT_1 flag for congestion control
Date: Sun, 29 Nov 2026 16:50:34 +0000	[thread overview]
Message-ID: <AS2PR07MB9123AEBAA756F332B2F93029A34F2@AS2PR07MB9123.eurprd07.prod.outlook.com> (raw)
In-Reply-To: <CAL4WiirxeYg37=0U0T+9jWttebQbrsTbK9GRNed0tUCw5w11sA@mail.gmail.com>

> -----Original Message-----
> From: Eric Dumazet <edumazet@kernel.org> 
> Sent: Thursday, November 19, 2026 7:48 PM
> To: Chia-Yu Chang (Nokia) <chia-yu.chang@nokia-bell-labs.com>
> Cc: linux-kernel@vger.kernel.org; kuba@kernel.org; netdev@vger.kernel.org; pabeni@redhat.com; davem@davemloft.net; kuniyu@google.com; ij@kernel.org; ncardwell@google.com; koen0607@gmail.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; Mike_Rudolph@comcast.com; Jeff_Howe@comcast.com; srichard@netapp.com
> Subject: Re: [PATCH net-next v4 3/4] tcp: add TCP_ECN_SEND_ECT_1 flag for congestion control
> 
> 
> CAUTION: This is an external email. Please be very careful when clicking links or opening attachments. See the URL nok.it/ext for additional information.
> 
> 
> 
> Le jeu. 19 nov. 2026 à 19:01, <chia-yu.chang@nokia-bell-labs.com> a écrit :
> >
> > From: Chia-Yu Chang <chia-yu.chang@nokia-bell-labs.com>
> >
> > This patch introduces the new TCP_ECN_SEND_ECT_1 bit, which enables a 
> > congestion control module to control whether the connection transmits 
> > using ECT(1) (if the bit is set) or ECT(0) (otherwise), when 
> > congestion control is initialized after ECN negotiation.
> >
> > A congestion control module, such as the upcoming TCP Prague using L4S 
> > ECN, can set this new TCP_ECN_SEND_ECT_1 bit if it wants to send the 
> > ECT(1) code point in outgoing IP headers.
> >
> > Signed-off-by: Chia-Yu Chang <chia-yu.chang@nokia-bell-labs.com>
> >
> > --
> > v3:
> > - Update commit message
> > - Update flag name and helper function name to eliminate confusion
> > ---
> >  include/net/tcp.h     | 1 +
> >  include/net/tcp_ecn.h | 6 ++++++
> >  net/ipv4/tcp_cong.c   | 4 +++-
> >  net/ipv4/tcp_output.c | 2 +-
> >  4 files changed, 11 insertions(+), 2 deletions(-)
> >
> > diff --git a/include/net/tcp.h b/include/net/tcp.h index 
> > 4b1159e6c125..0242fd6bbb07 100644
> > --- a/include/net/tcp.h
> > +++ b/include/net/tcp.h
> > @@ -428,6 +428,7 @@ static inline void tcp_dec_quickack_mode(struct sock *sk)
> >  #define        TCP_ECN_DEMAND_CWR      BIT(2)
> >  #define        TCP_ECN_SEEN            BIT(3)
> >  #define        TCP_ECN_MODE_ACCECN     BIT(4)
> > +#define        TCP_ECN_SEND_ECT_1      BIT(5)
> 
> Who clears this bit ?
> 
> The only place where tp->ecn_flags is reset is tcp_ecn_send_syn().
> 
> If a module sets the bit, and the user later switches to another congestion control with setsockopt(TCP_CONGESTION) on an AccECN flow, tcp_ecn_send() will keep sending ECT(1) on every packet, with a classic congestion response.
> 
> I do not think we should rely on each module ->release() to clear it. tcp_reinit_congestion_control() should do it.

Hi Eric,

You are right, I will add the corresponding reset and comments in tcp_reinit_congestion_control().
> 
> >
> >  #define        TCP_ECN_DISABLED        0
> >  #define        TCP_ECN_MODE_PENDING    (TCP_ECN_MODE_RFC3168 | TCP_ECN_MODE_ACCECN)
> > diff --git a/include/net/tcp_ecn.h b/include/net/tcp_ecn.h index 
> > 9ca016d98972..ff402cdb988d 100644
> > --- a/include/net/tcp_ecn.h
> > +++ b/include/net/tcp_ecn.h
> > @@ -38,6 +38,12 @@ static inline void INET_ECN_xmit_negotiation_ect(struct sock *sk)
> >         __INET_ECN_xmit(sk, tcp_ca_ect_1_negotiation(sk));  }
> >
> > +/* Apply either ECT(0) or ECT(1) based on TCP_ECN_SEND_ECT_1 flag */ 
> > +static inline void INET_ECN_xmit_established_ect(struct sock *sk) {
> > +       __INET_ECN_xmit(sk, tcp_sk(sk)->ecn_flags & 
> > +TCP_ECN_SEND_ECT_1); }
> > +
> >  static inline void tcp_ecn_queue_cwr(struct tcp_sock *tp)  {
> >         /* Do not set CWR if in AccECN mode! */ diff --git 
> > a/net/ipv4/tcp_cong.c b/net/ipv4/tcp_cong.c index 
> > 3331679c81d7..43b0634f7673 100644
> > --- a/net/ipv4/tcp_cong.c
> > +++ b/net/ipv4/tcp_cong.c
> > @@ -240,7 +240,9 @@ void tcp_init_congestion_control(struct sock *sk)
> >         tcp_sk(sk)->prior_ssthresh = 0;
> >         if (icsk->icsk_ca_ops->init)
> >                 icsk->icsk_ca_ops->init(sk);
> > -       if (tcp_ca_needs_ecn(sk))
> > +       if (tcp_ca_needs_accecn(sk))
> > +               INET_ECN_xmit_established_ect(sk);
> > +       else if (tcp_ca_needs_ecn(sk))
> >                 INET_ECN_xmit(sk);
> 
> This only looks at the module flag, not at what was negotiated.
> 
> If AccECN negotiation failed (RFC 3168 fallback, or no ECN at all), we still set ECT(0)/ECT(1) here. Is the module expected to handle all the fallbacks from its ->init(), like DCTCP does ? If so, please add a comment, and say it in the changelog.
> 

Yes, I add new comments above the code to explain that "each module is responsible for handling fallback cases when negotiation did not succeed."

Thanks.
Chia-Yu

  reply	other threads:[~2026-11-29 16:50 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-19 18:01 [PATCH net-next v4 0/4] TCP Prague preparation series chia-yu.chang
2026-11-19 18:01 ` [PATCH net-next v4 1/4] tcp: export CE count in rate_sample chia-yu.chang
2026-11-19 18:46   ` Eric Dumazet
2026-11-29 16:50     ` Chia-Yu Chang (Nokia)
2026-11-19 18:01 ` [PATCH net-next v4 2/4] tcp: rename ECN transmit helper function chia-yu.chang
2026-11-19 18:59   ` Eric Dumazet
2026-11-29 16:50     ` Chia-Yu Chang (Nokia)
2026-11-19 18:01 ` [PATCH net-next v4 3/4] tcp: add TCP_ECN_SEND_ECT_1 flag for congestion control chia-yu.chang
2026-11-19 18:48   ` Eric Dumazet
2026-11-29 16:50     ` Chia-Yu Chang (Nokia) [this message]
2026-11-19 18:01 ` [PATCH net-next v4 4/4] tcp: add MSS ceiling callback " chia-yu.chang
2026-11-19 18:54   ` Eric Dumazet
2026-11-29 16:50     ` Chia-Yu Chang (Nokia)
2026-11-19 18:41 ` [PATCH net-next v4 0/4] TCP Prague preparation series Eric Dumazet

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=AS2PR07MB9123AEBAA756F332B2F93029A34F2@AS2PR07MB9123.eurprd07.prod.outlook.com \
    --to=chia-yu.chang@nokia-bell-labs.com \
    --cc=Jason_Livingood@comcast.com \
    --cc=Jeff_Howe@comcast.com \
    --cc=Mike_Rudolph@comcast.com \
    --cc=cheshire@apple.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=g.white@cablelabs.com \
    --cc=ij@kernel.org \
    --cc=ingemar.s.johansson@ericsson.com \
    --cc=koen0607@gmail.com \
    --cc=kuba@kernel.org \
    --cc=kuniyu@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mirja.kuehlewind@ericsson.com \
    --cc=ncardwell@google.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=rs.ietf@gmx.at \
    --cc=srichard@netapp.com \
    --cc=vidhi_goel@apple.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

all inboxes | Powered by JetHome®