Hi Geliang,
On 14/04/2023 11:11, Geliang Tang wrote:
> Increase pm subflows counter on both server side and client side when
> userspace pm creates a new subflow, and decrease the counter when it
> closes a subflow.
Do you mind adding:
Fixes: 702c2f646d42 ("mptcp: netlink: allow userspace-driven subflow
establishment")
Closes: https://github.com/multipath-tcp/mptcp_net-next/issues/329
Same here, it looks like a bug: we forgot to update existing counters in
this new mode.
Also, may you also add that this modification is similar to how the
in-kernel PM is updating the counter: when additional subflows are
created/removed?
> Signed-off-by: Geliang Tang <geliang.tang@suse.com>
> ---
> net/mptcp/pm.c | 21 +++++++++++++++++----
> net/mptcp/pm_userspace.c | 1 +
> 2 files changed, 18 insertions(+), 4 deletions(-)
>
> diff --git a/net/mptcp/pm.c b/net/mptcp/pm.c
> index 4ed4d29d9c11..bb01f15d8e0a 100644
> --- a/net/mptcp/pm.c
> +++ b/net/mptcp/pm.c
> @@ -87,8 +87,15 @@ bool mptcp_pm_allow_new_subflow(struct mptcp_sock *msk)
> unsigned int subflows_max;
> int ret = 0;
>
> - if (mptcp_pm_is_userspace(msk))
> - return mptcp_userspace_pm_active(msk);
> + if (mptcp_pm_is_userspace(msk)) {
> + if (mptcp_userspace_pm_active(msk)) {
> + spin_lock_bh(&pm->lock);
> + pm->subflows++;
> + spin_unlock_bh(&pm->lock);
> + return true;
> + }
> + return false;
> + }
>
> subflows_max = mptcp_pm_get_subflows_max(msk);
>
> @@ -181,8 +188,14 @@ void mptcp_pm_subflow_check_next(struct mptcp_sock *msk, const struct sock *ssk,
> struct mptcp_pm_data *pm = &msk->pm;
> bool update_subflows;
>
> - update_subflows = (subflow->request_join || subflow->mp_join) &&
> - mptcp_pm_is_kernel(msk);
> + if (mptcp_pm_is_userspace(msk)) {
> + spin_lock_bh(&pm->lock);
> + pm->subflows--;
> + spin_unlock_bh(&pm->lock);
> + return;
> + }
> +
> + update_subflows = (subflow->request_join || subflow->mp_join);
Should you not also decrement the counter only if one of these
conditions is met to keep the same behaviour as what is done with the
in-kernel PM: 'subflows' counter only look at the additional subflows?
Cheers,
Matt
--
Tessares | Belgium | Hybrid Access Solutions
www.tessares.net