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 4/4] tcp: add MSS ceiling callback for congestion control
Date: Sun, 29 Nov 2026 16:50:38 +0000	[thread overview]
Message-ID: <AS2PR07MB9123E7DA67DD8797FEE8B870A34F2@AS2PR07MB9123.eurprd07.prod.outlook.com> (raw)
In-Reply-To: <CAL4Wiip6JFsVH_WAn4HmrXCiuKEJCoZR9nUv9X7RZU73_YJyzw@mail.gmail.com>

> -----Original Message-----
> From: Eric Dumazet <edumazet@kernel.org> 
> Sent: Thursday, November 19, 2026 7:55 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 4/4] tcp: add MSS ceiling callback 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>
> >
> > Allow congestion control modules to provide an optional MSS ceiling 
> > through the new mss_ceiling() callback. The TCP stack derives MSS from 
> > PMTU discovery and existing MSS constraints, while the congestion 
> > control may further reduce the effective MSS when needed. The ceiling 
> > is applied during MSS calculation and remains subject to existing PMTU 
> > updates.
> >
> 
> I dunno. What references can you provide?
> 
> I am guessing this has been adopted by IETF?
> 
> This is very suspect to me, this will bring many bugs for a benefit that has to be demonstrated.
> 

Hi Eric,

This is related to Prague IETF draft and the motivation for this facility and its performance impact on low-rate traffic are in: https://dl.acm.org/doi/10.1145/3822163.3827934

A corresponding version on UDP-Prague can be found in https://github.com/L4STeam/udp_prague/

As for TCP, we would like to impost a CC-based upper bound on mss_cache, and I will corresponding update the comment to clarify it.

And you are right, it is better to make the change in tcp_sync_mss and I am preparing the next version based on your feedback.

> > Also, tcp_update_mss() is added to allow congestion control modules to 
> > request immediate MSS recomputation after changing their MSS ceiling.
> > This will be used by upcoming congestion controls, e.g., TCP Prague, 
> > that perform fine-grained rate control at very low rates, e.g., below 
> > 1Mbps, and benefit from reducing the effective MSS while still 
> > preserving normal PMTU handling.
> >
> > Signed-off-by: Chia-Yu Chang <chia-yu.chang@nokia-bell-labs.com>
> >
> > --
> > v3:
> > - Replace mss_cache_set_by_cca with mss_ceiling() callback
> > - Add tcp_update_mss() helper for immediate MSS recomputation
> > ---
> >  include/net/tcp.h     |  4 ++++
> >  net/ipv4/tcp_output.c | 16 ++++++++++++++++
> >  2 files changed, 20 insertions(+)
> >
> > diff --git a/include/net/tcp.h b/include/net/tcp.h index 
> > 0242fd6bbb07..9d398ae09015 100644
> > --- a/include/net/tcp.h
> > +++ b/include/net/tcp.h
> > @@ -858,6 +858,7 @@ static inline void tcp_clear_xmit_timers(struct 
> > sock *sk)
> >
> >  unsigned int tcp_sync_mss(struct sock *sk, u32 pmtu);  unsigned int 
> > tcp_current_mss(struct sock *sk);
> > +unsigned int tcp_update_mss(struct sock *sk);
> >  u32 tcp_clamp_probe0_to_user_timeout(const struct sock *sk, u32 
> > when);
> >
> >  u32 tcp_tso_autosize(const struct sock *sk, unsigned int mss_now, @@ 
> > -1417,6 +1418,9 @@ struct tcp_congestion_ops {
> >         /* returns the multiplier used in tcp_sndbuf_expand (optional) */
> >         u32 (*sndbuf_expand)(struct sock *sk);
> >
> > +       /* returns the MSS upper bound (optional) */
> > +       u32 (*mss_ceiling)(struct sock *sk);
> > +
> >  /* control/slow paths put last */
> >         /* get info for inet_diag (optional) */
> >         size_t (*get_info)(struct sock *sk, u32 ext, int *attr, diff 
> > --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c index 
> > 7b694479095e..f70dddd7283b 100644
> > --- a/net/ipv4/tcp_output.c
> > +++ b/net/ipv4/tcp_output.c
> > @@ -2062,6 +2062,10 @@ static inline int __tcp_mtu_to_mss(struct sock 
> > *sk, int pmtu)
> >
> >         mss_now -= psp_sk_overhead(sk);
> >
> > +       /* Apply MSS ceiling from congestion control module, if any */
> > +       if (icsk->icsk_ca_ops->mss_ceiling)
> > +               mss_now = min_t(u32, mss_now, 
> > + icsk->icsk_ca_ops->mss_ceiling(sk));
> > +
> 
> I do not think this is the right place.
> 
> __tcp_mtu_to_mss() is a conversion helper, used by many callers which have nothing to do with mss_cache :
> 
> - tcp_v6_mtu_reduced() ignores a Packet Too Big if
>   tcp_mtu_to_mss(sk, mtu) >= tp->mss_cache. With a ceiling in place,
>   valid PMTU reductions above the ceiling are dropped, and the flow
>   is left with a stale PMTU when the module raises the ceiling later.
> 
> - tcp_mtu_probing() recomputes icsk_mtup.search_low from
>   tcp_mtu_to_mss(sk, search_low), so search_low collapses to the
>   ceiling and never recovers.
> 
> - tcp_mtu_probe() gets a probe_size equal to the current mss.
> 
> - tcp_send_syn_data() uses it to size the Fast Open payload.
> 
> If a ceiling is needed, it should be applied in tcp_sync_mss(), next to the icsk_mtup.search_low clamp.
> 
> Also the callback is invoked before ->init() :
> tcp_connect_init() and tcp_v4_syn_recv_sock() call tcp_sync_mss() before tcp_init_congestion_control(). icsk_ca_priv is zeroed at this point, or copied from the listener when icsk_ca_setsockopt is set. This should be gated on icsk->icsk_ca_initialized.
> 
> What does the returned value mean exactly ? It is applied before icsk_ext_hdr_len and the TCP options are subtracted, so mss_cache ends up smaller than what the module asked for.

I will add "icsk->icsk_ca_initialized" gate as you suggested.

The return value shall be the final mss_cache, as this mss_cache update may not be successful (e.g., if CC provie a value of 0 or a value smaller than sysctl_tcp_min_snd_mss).

> 
> >         /* Clamp it (mss_clamp does not include tcp options) */
> >         if (mss_now > tp->rx_opt.mss_clamp)
> >                 mss_now = tp->rx_opt.mss_clamp; @@ -2082,6 +2086,7 @@ 
> > int tcp_mtu_to_mss(struct sock *sk, int pmtu)
> >         return __tcp_mtu_to_mss(sk, pmtu) -
> >                (tcp_sk(sk)->tcp_header_len - sizeof(struct tcphdr));  
> > }
> > +EXPORT_SYMBOL(tcp_mtu_to_mss);
> >
> >  /* Inverse of above */
> >  int tcp_mss_to_mtu(struct sock *sk, int mss) @@ -2190,6 +2195,17 @@ 
> > unsigned int tcp_current_mss(struct sock *sk)
> >         return mss_now;
> >  }
> >
> > +unsigned int tcp_update_mss(struct sock *sk) {
> > +       struct dst_entry *dst = __sk_dst_get(sk);
> > +       struct tcp_sock *tp = tcp_sk(sk);
> > +
> > +       if (!dst)
> > +               return tp->mss_cache;
> > +       return tcp_sync_mss(sk, dst_mtu(dst)); } 
> > +EXPORT_SYMBOL_GPL(tcp_update_mss);
> 
> 
> No need for the dst lookup, existing code uses :
> 
>         tcp_sync_mss(sk, icsk->icsk_pmtu_cookie);
> 
> Finally, tcp_congestion_ops is a BPF struct_ops. Without a stub in __bpf_ops_tcp_congestion_ops (net/ipv4/bpf_tcp_ca.c), BPF programs can not implement mss_ceiling(). Please add one, or explain why this is not wanted.

I will try to add some corresponding BPF changes in the next version, while if there are still something missing, please let me know.

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)
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) [this message]
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=AS2PR07MB9123E7DA67DD8797FEE8B870A34F2@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®