BPF List
 help / color / mirror / Atom feed
From: netdev-bot+sashiko@kernel.org
To: chia-yu.chang@nokia-bell-labs.com
Cc: ihor.solodrai@linux.dev, john.fastabend@gmail.com,
	jakub@cloudflare.com, jiayuan.chen@linux.dev,
	netdev@vger.kernel.org, bpf@vger.kernel.org, ast@kernel.org,
	daniel@iogearbox.net, andrii@kernel.org, eddyz87@gmail.com,
	martin.lau@linux.dev, song@kernel.org, yonghong.song@linux.dev,
	jolsa@kernel.org, emil@etsalapatis.com,
	linux-kselftest@vger.kernel.org, shuah@kernel.org,
	horms@kernel.org, dsahern@kernel.org, pabeni@redhat.com,
	jhs@mojatatu.com, stephen@networkplumber.org,
	davem@davemloft.net, edumazet@google.com, andrew+netdev@lunn.ch,
	donald.hunter@gmail.com, kuniyu@google.com, 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, Mike_Rudolph@comcast.com,
	Jeff_Howe@comcast.com, srichard@netapp.com, kuba@kernel.org
Subject: Re: [net-next,v9,1/2] tcp: Replace min_tso_segs() with tso_segs() CC callback
Date: Thu, 03 Sep 2026 19:57:13 +0000	[thread overview]
Message-ID: <178846543301.3394541.455246755221753943@kernel.org> (raw)
In-Reply-To: <20260831165230.2696893-2-chia-yu.chang@nokia-bell-labs.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider:

Critical: 0 · High: 0 · Medium: 1 · Low: 0

- [Medium] The patch silently removes the `bbr_min_tso_segs` BPF kfunc
  without a deprecation window and without mentioning it in the commit…

--

tcp: Replace min_tso_segs() with tso_segs() CC callback

The min_tso_segs() congestion control callback is replaced by a new
tso_segs() callback that takes mss_now and returns the final TSO segment
count, bypassing tcp_tso_autosize().  tcp_tso_autosize() is exported so
modules can still do the autosizing themselves, and BBR is converted to
the new callback.

> diff --git a/include/net/tcp.h b/include/net/tcp.h

[ ... ]

> diff --git a/net/ipv4/tcp_bbr.c b/net/ipv4/tcp_bbr.c
> index 82378a2bfd1e1..ecf11be46f382 100644
> --- a/net/ipv4/tcp_bbr.c
> +++ b/net/ipv4/tcp_bbr.c
> @@ -297,11 +297,18 @@ static void bbr_set_pacing_rate(struct sock *sk, u32 bw, int gain)
>  }
>  
>  /* override sysctl_tcp_min_tso_segs */
> -__bpf_kfunc static u32 bbr_min_tso_segs(struct sock *sk)
> +static u32 bbr_min_tso_segs(struct sock *sk)
>  {
>  	return READ_ONCE(sk->sk_pacing_rate) < (bbr_min_tso_rate >> 3) ? 1 : 2;
>  }
>  
> +__bpf_kfunc static u32 bbr_tso_segs(struct sock *sk, u32 mss_now)
> +{
> +	if (unlikely(!mss_now))
> +		return bbr_min_tso_segs(sk);
> +	return tcp_tso_autosize(sk, mss_now, bbr_min_tso_segs(sk));
> +}
> +

[ ... ]

> @@ -1163,7 +1170,7 @@ BTF_ID_FLAGS(func, bbr_sndbuf_expand)
>  BTF_ID_FLAGS(func, bbr_undo_cwnd)
>  BTF_ID_FLAGS(func, bbr_cwnd_event_tx_start)
>  BTF_ID_FLAGS(func, bbr_ssthresh)
> -BTF_ID_FLAGS(func, bbr_min_tso_segs)
> +BTF_ID_FLAGS(func, bbr_tso_segs)
>  BTF_ID_FLAGS(func, bbr_set_state)
>  BTF_KFUNCS_END(tcp_bbr_check_kfunc_ids)

[Severity: Medium]
Dropping the __bpf_kfunc annotation from bbr_min_tso_segs() and replacing its
BTF_ID_FLAGS() entry with bbr_tso_segs() takes the bbr_min_tso_segs kfunc out
of the kernel BTF kfunc set in one step.  Should this go through a
deprecation release instead?

Any out-of-tree BPF congestion control containing:

    extern u32 bbr_min_tso_segs(struct sock *sk) __ksym;

now fails to load with "kernel function bbr_min_tso_segs not found in kernel
BTF", and that applies to programs calling it from any callback, not only
from the renamed one.

The helper is still present and still called internally, both from
bbr_tso_segs() and from bbr_tso_segs_goal():

net/ipv4/tcp_bbr.c:bbr_tso_segs_goal() {
    ...
	segs = max_t(u32, bytes / tp->mss_cache, bbr_min_tso_segs(sk));
    ...
}

so would keeping the BTF_ID_FLAGS(func, bbr_min_tso_segs, KF_DEPRECATED)
entry for a release work here?  Documentation/bpf/kfuncs.rst says "It's
expected that the common case will be that kfuncs will go through a
deprecation period rather than being changed or removed without warning".

The v8 changelog of this submission said "Deprecate bbr_min_tso_segs() kfunc
instead of removing it", and v9 said "Remove deprecated flag on
bbr_min_tso_segs()", so the deprecation flag appears to have been dropped
again between revisions.  Was that intentional?

The commit message lists the BPF struct_ops impacts as:

    - The callback is renamed from min_tso_segs() to tso_segs()
    - The signature gains an extra u32 mss_now argument
    - The return value semantics is changed from "floor value passed into
      tcp_tso_autosize()" to "final tso_segs value", bypassing autosizing

Could the disappearance of the bbr_min_tso_segs kfunc be added to that list?

On the replacement side, the follow-up commit in this series, "bpf: make
tcp_tso_autosize() available to BPF congestion controls", marks
tcp_tso_autosize() as __bpf_kfunc and adds it to bpf_tcp_ca_check_kfunc_ids,
so a BPF congestion control can reproduce the old "raise the floor, keep
autosizing" behaviour by calling tcp_tso_autosize(sk, mss_now, my_floor)
from there on.  At this commit alone that kfunc is not yet registered, so
bbr_tso_segs() with BBR's hardcoded 1-or-2 floor is the only substitute.

In-tree users were updated in
tools/testing/selftests/bpf/progs/tcp_ca_kfunc.c and no other in-tree
reference to the old kfunc remains.

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20260831165230.2696893-1-chia-yu.chang%40nokia-bell-labs.com

  reply	other threads:[~2026-09-03 19:57 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-31 16:52 [PATCH net-next v9 0/2] Explicit TSO segment count chia-yu.chang
2026-08-31 16:52 ` [PATCH net-next v9 1/2] tcp: Replace min_tso_segs() with tso_segs() CC callback chia-yu.chang
2026-09-03 19:57   ` netdev-bot+sashiko [this message]
2026-08-31 16:52 ` [PATCH net-next v9 2/2] bpf: make tcp_tso_autosize() available to BPF congestion controls chia-yu.chang
2026-09-01 16:52   ` sashiko-bot
2026-09-03 19:57   ` [net-next,v9,2/2] " netdev-bot+sashiko
2026-09-05 18:40 ` [PATCH net-next v9 0/2] Explicit TSO segment count patchwork-bot+netdevbpf

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=178846543301.3394541.455246755221753943@kernel.org \
    --to=netdev-bot+sashiko@kernel.org \
    --cc=Jason_Livingood@comcast.com \
    --cc=Jeff_Howe@comcast.com \
    --cc=Mike_Rudolph@comcast.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=cheshire@apple.com \
    --cc=chia-yu.chang@nokia-bell-labs.com \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=donald.hunter@gmail.com \
    --cc=dsahern@kernel.org \
    --cc=eddyz87@gmail.com \
    --cc=edumazet@google.com \
    --cc=emil@etsalapatis.com \
    --cc=g.white@cablelabs.com \
    --cc=horms@kernel.org \
    --cc=ihor.solodrai@linux.dev \
    --cc=ij@kernel.org \
    --cc=ingemar.s.johansson@ericsson.com \
    --cc=jakub@cloudflare.com \
    --cc=jhs@mojatatu.com \
    --cc=jiayuan.chen@linux.dev \
    --cc=john.fastabend@gmail.com \
    --cc=jolsa@kernel.org \
    --cc=koen.de_schepper@nokia-bell-labs.com \
    --cc=kuba@kernel.org \
    --cc=kuniyu@google.com \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=martin.lau@linux.dev \
    --cc=mirja.kuehlewind@ericsson.com \
    --cc=ncardwell@google.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=rs.ietf@gmx.at \
    --cc=shuah@kernel.org \
    --cc=song@kernel.org \
    --cc=srichard@netapp.com \
    --cc=stephen@networkplumber.org \
    --cc=vidhi_goel@apple.com \
    --cc=yonghong.song@linux.dev \
    /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