Thread View: linux.kernel.netdev
1 messages
1 total messages
Started by Eric Dumazet
Thu, 19 Nov 2026 18:54
Re: [PATCH net-next v4 4/4] tcp: add MSS ceiling callback for congestion control
Author: Eric Dumazet
Date: Thu, 19 Nov 2026 18:54
Date: Thu, 19 Nov 2026 18:54
154 lines
14905 bytes
14905 bytes
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.
> 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.
> /* 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.
> +
> /* RFC2861, slow part. Adjust cwnd, after it was not full during one rto.
> * As additional protections, we do not touch cwnd in retransmission phases,
> * and if application hit its sndbuf limit recently.
> --
> 2.34.1
>
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads