RE: [PATCH net-next v4 4/4] tcp: add MSS ceiling callback for congestion control
From: Chia-Yu Chang (Nokia)
Date: Sun Nov 29 2026 - 11:50:54 EST
> -----Original Message-----
> From: Eric Dumazet <edumazet@xxxxxxxxxx>
> Sent: Thursday, November 19, 2026 7:55 PM
> To: Chia-Yu Chang (Nokia) <chia-yu.chang@xxxxxxxxxxxxxxxxxxx>
> Cc: linux-kernel@xxxxxxxxxxxxxxx; kuba@xxxxxxxxxx; netdev@xxxxxxxxxxxxxxx; pabeni@xxxxxxxxxx; davem@xxxxxxxxxxxxx; kuniyu@xxxxxxxxxx; ij@xxxxxxxxxx; ncardwell@xxxxxxxxxx; koen0607@xxxxxxxxx; g.white@xxxxxxxxxxxxx; ingemar.s.johansson@xxxxxxxxxxxx; mirja.kuehlewind@xxxxxxxxxxxx; cheshire@xxxxxxxxx; rs.ietf@xxxxxx; Jason_Livingood@xxxxxxxxxxx; vidhi_goel@xxxxxxxxx; Mike_Rudolph@xxxxxxxxxxx; Jeff_Howe@xxxxxxxxxxx; srichard@xxxxxxxxxx
> 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@xxxxxxxxxxxxxxxxxxx> a écrit :
> >
> > From: Chia-Yu Chang <chia-yu.chang@xxxxxxxxxxxxxxxxxxx>
> >
> > 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@xxxxxxxxxxxxxxxxxxx>
> >
> > --
> > 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