Hi Geliang,
On 21/03/2025 02:45, Geliang Tang wrote:
> From: Geliang Tang <tanggeliang@kylinos.cn>
>
> In mptcp_pm_subflow_check_next(), instead of reducing "pm->subflows"
> for the in-kernel PM in __mptcp_pm_close_subflow(), this patch moves
> "pm->subflows--;" forward to let it be used by both the userspace PM
> and the in-kernel PM. Then mptcp_pm_is_userspace() here can be dropped.
>
> Signed-off-by: Geliang Tang <tanggeliang@kylinos.cn>
> ---
> net/mptcp/pm.c | 15 ++++++---------
> 1 file changed, 6 insertions(+), 9 deletions(-)
>
> diff --git a/net/mptcp/pm.c b/net/mptcp/pm.c
> index bb456e203665..a3fcb335c717 100644
> --- a/net/mptcp/pm.c
> +++ b/net/mptcp/pm.c
> @@ -531,13 +531,10 @@ void mptcp_pm_subflow_check_next(struct mptcp_sock *msk,
> bool update_subflows;
>
> update_subflows = subflow->request_join || subflow->mp_join;
> - if (mptcp_pm_is_userspace(msk)) {
> - if (update_subflows) {
> - spin_lock_bh(&pm->lock);
> - pm->subflows--;
> - spin_unlock_bh(&pm->lock);
> - }
> - return;
> + if (update_subflows) {
> + spin_lock_bh(&pm->lock);
> + pm->subflows--;
> + spin_unlock_bh(&pm->lock);
Should we not simply call mptcp_pm_close_subflow() instead? It should be
fine to call it for the userspace or BPF PMs as well, no?
> }
>
> if (!pm->ops->subflow_established)
> @@ -547,8 +544,8 @@ void mptcp_pm_subflow_check_next(struct mptcp_sock *msk,
> return;
>
> spin_lock_bh(&pm->lock);
> - if (update_subflows)
> - __mptcp_pm_close_subflow(msk);
> + if (update_subflows && msk->pm.subflows < mptcp_pm_get_subflows_max(msk))
> + WRITE_ONCE(msk->pm.accept_subflow, true);
>
> /* Even if this subflow is not really established, tell the PM to try
> * to pick the next ones, if possible.
Cheers,
Matt
--
Sponsored by the NGI0 Core fund.