MPTCP Linux Development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Kalpan Jani" <kalpan.jani@mpiricsoftware.com>, mptcp@lists.linux.dev
Subject: Re: [PATCH mptcp-next v6 1/2] mptcp: sched: add subflow avoid flag and enforce it in default sched
Date: Mon, 23 Nov 2026 10:18:31 +0000	[thread overview]
Message-ID: <sashiko-outbox-229032@kernel.org> (raw)
In-Reply-To: <20261123100821.2228839-2-kalpan.jani@mpiricsoftware.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] mptcp: sched: unreachable subflow->avoid checks in default
  scheduler
--

commit 581a16fad32148d403da6646a8629a080cac8614
Author: Kalpan Jani <kalpan.jani@mpiricsoftware.com>

mptcp: sched: add subflow avoid flag and enforce it in default sched

This commit adds an avoid flag to mptcp_subflow_context, exposes
mptcp_subflow_set_avoid() as a BPF kfunc for custom packet schedulers,
reports the flag via MPTCP diag, and skips avoided subflows in
mptcp_subflow_get_send() and mptcp_subflow_get_retrans().

Link: https://github.com/multipath-tcp/mptcp_net-next/issues/349

[ ... ]

> diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
> index be23768b6d051..8a2894293e70c 100644
> --- a/net/mptcp/protocol.c
> +++ b/net/mptcp/protocol.c
> @@ -1650,7 +1650,7 @@ struct sock *mptcp_subflow_get_send(struct mptcp_sock *msk)
>  
>  		trace_mptcp_subflow_get_send(subflow);
>  		ssk =  mptcp_subflow_tcp_sock(subflow);
> -		if (!mptcp_subflow_active(subflow))
> +		if (!mptcp_subflow_active(subflow) || READ_ONCE(subflow->avoid))
>  			continue;
>  
>  		tout = max(tout, mptcp_timeout_from_subflow(subflow));
> @@ -2575,7 +2575,7 @@ struct sock *mptcp_subflow_get_retrans(struct mptcp_sock *msk)
>  	mptcp_for_each_subflow(msk, subflow) {
>  		struct sock *ssk = mptcp_subflow_tcp_sock(subflow);
>  
> -		if (!__mptcp_subflow_active(subflow))
> +		if (!__mptcp_subflow_active(subflow) || READ_ONCE(subflow->avoid))
>  			continue;
>  
>  		/* still data outstanding at TCP level? skip this */

[Severity: Medium]
Can subflow->avoid ever be true in mptcp_subflow_get_send() or
mptcp_subflow_get_retrans()?

mptcp_subflow_set_avoid() has no in-kernel callers and
bpf_mptcp_common_kfunc_filter() restricts it to bpf_mptcp_sched_ops
programs.  An MPTCP socket binds msk->sched once at creation and only
clears it in mptcp_release_sched().  When a custom BPF scheduler is
attached, mptcp_sched_get_send() and mptcp_sched_get_retrans() dispatch to
msk->sched->get_send() and msk->sched->get_retrans() rather than the
default scheduler, and neither mptcp_subflow_get_send() nor
mptcp_subflow_get_retrans() is exported as a BPF kfunc.  Conversely, when
msk->sched is &mptcp_sched_default, no bpf_mptcp_sched_ops program runs on
the socket to set subflow->avoid, making both checks unreachable dead
code.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261123100821.2228839-1-kalpan.jani@mpiricsoftware.com?part=1

  reply	other threads:[~2026-11-23 10:18 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-23 10:08 [PATCH mptcp-next v6 0/2] mptcp: add scheduler-owned subflow avoid flag Kalpan Jani
2026-11-23 10:08 ` [PATCH mptcp-next v6 1/2] mptcp: sched: add subflow avoid flag and enforce it in default sched Kalpan Jani
2026-11-23 10:18   ` sashiko-bot [this message]
2026-11-23 10:08 ` [PATCH mptcp-next v6 2/2] selftests: mptcp: bpf: exercise the subflow avoid flag across rounds Kalpan Jani

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=sashiko-outbox-229032@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=kalpan.jani@mpiricsoftware.com \
    --cc=mptcp@lists.linux.dev \
    --cc=sashiko-reviews@lists.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