All of lore.kernel.org
 help / color / mirror / Atom feed
From: Matthieu Baerts <matttbe@kernel.org>
To: Geliang Tang <geliang@kernel.org>, mptcp@lists.linux.dev
Cc: Geliang Tang <tanggeliang@kylinos.cn>
Subject: Re: [PATCH mptcp-next v7 08/11] mptcp: pm: drop pm_type in mptcp_pm_data
Date: Mon, 3 Mar 2025 11:57:13 +0100	[thread overview]
Message-ID: <483d687d-5377-47fc-bf11-2e18eacce8d9@kernel.org> (raw)
In-Reply-To: <599fa718f11e3311f95deaaeac0534889698c66d.1740975633.git.tanggeliang@kylinos.cn>

Hi Geliang,

On 03/03/2025 05:22, Geliang Tang wrote:
> From: Geliang Tang <tanggeliang@kylinos.cn>
> 
> Now pm->pm_type can be replaced by pm->ops->name, then "pm_type" filed
> of struct mptcp_pm_data can be dropped.
> 
> Signed-off-by: Geliang Tang <tanggeliang@kylinos.cn>
> ---
>  net/mptcp/pm.c       | 4 +---
>  net/mptcp/protocol.h | 5 ++---
>  2 files changed, 3 insertions(+), 6 deletions(-)
> 
> diff --git a/net/mptcp/pm.c b/net/mptcp/pm.c
> index e8b34f2ecb35..1ce58d16370a 100644
> --- a/net/mptcp/pm.c
> +++ b/net/mptcp/pm.c
> @@ -979,7 +979,6 @@ void mptcp_pm_destroy(struct mptcp_sock *msk)
>  void mptcp_pm_data_reset(struct mptcp_sock *msk)
>  {
>  	const char *path_manager = mptcp_get_path_manager(sock_net((struct sock *)msk));
> -	u8 pm_type = mptcp_get_pm_type(sock_net((struct sock *)msk));
>  	struct mptcp_pm_data *pm = &msk->pm;
>  	int ret;
>  
> @@ -989,7 +988,6 @@ void mptcp_pm_data_reset(struct mptcp_sock *msk)
>  	pm->subflows = 0;
>  	pm->rm_list_tx.nr = 0;
>  	pm->rm_list_rx.nr = 0;
> -	WRITE_ONCE(pm->pm_type, pm_type);
>  
>  	rcu_read_lock();
>  	ret = mptcp_pm_initialize(msk, mptcp_pm_find(path_manager));
> @@ -997,7 +995,7 @@ void mptcp_pm_data_reset(struct mptcp_sock *msk)
>  	if (ret)
>  		return;
>  
> -	if (pm_type == MPTCP_PM_TYPE_KERNEL) {
> +	if (mptcp_pm_is_kernel(msk)) {

The code here could be done in the new init() callback maybe? So what
you introduced in the previous patch 7/11.

>  		bool subflows_allowed = !!mptcp_pm_get_subflows_max(msk);
>  
>  		/* pm->work_pending must be only be set to 'true' when
> diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h
> index 172450455c2a..56eeee1cbccc 100644
> --- a/net/mptcp/protocol.h
> +++ b/net/mptcp/protocol.h
> @@ -233,7 +233,6 @@ struct mptcp_pm_data {
>  	u8		add_addr_signaled;
>  	u8		add_addr_accepted;
>  	u8		local_addr_used;
> -	u8		pm_type;
>  	u8		subflows;
>  	u8		status;
>  	DECLARE_BITMAP(id_avail_bitmap, MPTCP_PM_MAX_ADDR_ID + 1);
> @@ -1101,12 +1100,12 @@ static inline bool mptcp_pm_should_rm_signal(struct mptcp_sock *msk)
>  
>  static inline bool mptcp_pm_is_userspace(const struct mptcp_sock *msk)
>  {
> -	return READ_ONCE(msk->pm.pm_type) == MPTCP_PM_TYPE_USERSPACE;
> +	return !strncmp(msk->pm.ops->name, "userspace", MPTCP_PM_NAME_MAX);

Please don't do a string comparison here.

I think it is better to drop msk->pm.pm_type when mptcp_pm_is_userspace
and mptcp_pm_is_kernel are both dropped, no?

If you want to drop pm_type before, then you could compare &msk->pm.ops,
but I think that's something that should be done later. I guess
mptcp_pm_is_userspace() will still be needed, but only from
pm_userspace.c with mptcp_userspace_pm_get_sock(). No?

Same for mptcp_pm_is_kernel(), only from pm_kernel.c when iterating over
all connections.  Except if you use introduce a new macro like
mptcp_pm_for_each_msk() taking in argument "&mptcp_pm_kernel"?

Cheers,
Matt
-- 
Sponsored by the NGI0 Core fund.


  reply	other threads:[~2025-03-03 10:57 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-03  4:22 [PATCH mptcp-next v7 00/11] BPF path manager, part 5 Geliang Tang
2025-03-03  4:22 ` [PATCH mptcp-next v7 01/11] mptcp: pm: define struct mptcp_pm_ops Geliang Tang
2025-03-03 10:39   ` Matthieu Baerts
2025-03-03  4:22 ` [PATCH mptcp-next v7 02/11] mptcp: sysctl: new sysctl to set path manager by name Geliang Tang
2025-03-03 10:40   ` Matthieu Baerts
2025-03-03  4:22 ` [PATCH mptcp-next v7 03/11] mptcp: sysctl: map pm_type to path_manager Geliang Tang
2025-03-03 10:40   ` Matthieu Baerts
2025-03-03  4:22 ` [PATCH mptcp-next v7 04/11] mptcp: sysctl: add available_path_managers Geliang Tang
2025-03-03 10:41   ` Matthieu Baerts
2025-03-03  4:22 ` [PATCH mptcp-next v7 05/11] mptcp: pm: in-kernel: register mptcp_kernel_pm Geliang Tang
2025-03-03 10:42   ` Matthieu Baerts
2025-03-03  4:22 ` [PATCH mptcp-next v7 06/11] mptcp: pm: userspace: register mptcp_userspace_pm Geliang Tang
2025-03-03 10:52   ` Matthieu Baerts
2025-03-03  4:22 ` [PATCH mptcp-next v7 07/11] mptcp: pm: initialize and release mptcp_pm_ops Geliang Tang
2025-03-03 10:53   ` Matthieu Baerts
2025-03-03  4:22 ` [PATCH mptcp-next v7 08/11] mptcp: pm: drop pm_type in mptcp_pm_data Geliang Tang
2025-03-03 10:57   ` Matthieu Baerts [this message]
2025-03-03  4:22 ` [PATCH mptcp-next v7 09/11] mptcp: sysctl: drop get_pm_type helper Geliang Tang
2025-03-03 10:57   ` Matthieu Baerts
2025-03-03  4:22 ` [PATCH mptcp-next v7 10/11] mptcp: pm: make get_local_id helpers static Geliang Tang
2025-03-03 10:58   ` Matthieu Baerts
2025-03-03  4:22 ` [PATCH mptcp-next v7 11/11] mptcp: pm: make is_backup " Geliang Tang
2025-03-03  5:32 ` [PATCH mptcp-next v7 00/11] BPF path manager, part 5 MPTCP CI
2025-03-03 10:38 ` Matthieu Baerts

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=483d687d-5377-47fc-bf11-2e18eacce8d9@kernel.org \
    --to=matttbe@kernel.org \
    --cc=geliang@kernel.org \
    --cc=mptcp@lists.linux.dev \
    --cc=tanggeliang@kylinos.cn \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.