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 v5 8/9] mptcp: pm: drop get_local_id helpers
Date: Fri, 21 Feb 2025 18:23:47 +0100 [thread overview]
Message-ID: <60914d20-36df-4128-a062-4f4e1030367a@kernel.org> (raw)
In-Reply-To: <69747874cdc72593caadf51725cf8835bc45661b.1740019794.git.tanggeliang@kylinos.cn>
On 20/02/2025 03:57, Geliang Tang wrote:
> From: Geliang Tang <tanggeliang@kylinos.cn>
>
> Now mptcp_pm_nl_get_local_id() and mptcp_userspace_pm_get_local_id()
> helpers can be dropped, and mptcp_pm_get_local_id() can directly invoke
> get_local_id() interface through "ops" of "msk->pm".
>
> Signed-off-by: Geliang Tang <tanggeliang@kylinos.cn>
> ---
> net/mptcp/pm.c | 6 +++---
> net/mptcp/pm_netlink.c | 4 ++--
> net/mptcp/pm_userspace.c | 4 ++--
> net/mptcp/protocol.h | 4 ----
> 4 files changed, 7 insertions(+), 11 deletions(-)
>
> diff --git a/net/mptcp/pm.c b/net/mptcp/pm.c
> index 9d42aed440a0..d2cc93e21bee 100644
> --- a/net/mptcp/pm.c
> +++ b/net/mptcp/pm.c
> @@ -438,10 +438,10 @@ int mptcp_pm_get_local_id(struct mptcp_sock *msk, struct sock_common *skc)
> skc_local.addr.id = 0;
> skc_local.flags = MPTCP_PM_ADDR_FLAG_IMPLICIT;
>
> + if (!msk->pm.ops || !msk->pm.ops->get_local_id)
Mmh, do we really need to check the "no pm ops" case? If we have to deal
with that, that might be annoying.
Should we not impose the implementation of get_local_id()?
> + return -ENOTSUPP;
> mptcp_pm_param_set_contexts(¶m, &skc_local, NULL);
> - if (mptcp_pm_is_userspace(msk))
> - return mptcp_userspace_pm_get_local_id(msk, ¶m);
> - return mptcp_pm_nl_get_local_id(msk, ¶m);
> + return msk->pm.ops->get_local_id(msk, ¶m);
> }
>
> bool mptcp_pm_is_backup(struct mptcp_sock *msk, struct sock_common *skc)
> diff --git a/net/mptcp/pm_netlink.c b/net/mptcp/pm_netlink.c
> index e0f8754e261e..33b19ff7a313 100644
> --- a/net/mptcp/pm_netlink.c
> +++ b/net/mptcp/pm_netlink.c
> @@ -1139,8 +1139,8 @@ static int mptcp_pm_nl_create_listen_socket(struct sock *sk,
> return err;
> }
>
> -int mptcp_pm_nl_get_local_id(struct mptcp_sock *msk,
> - struct mptcp_pm_param *param)
> +static int mptcp_pm_nl_get_local_id(struct mptcp_sock *msk,
> + struct mptcp_pm_param *param)
> {
> struct mptcp_pm_addr_entry *skc = ¶m->entry;
> struct mptcp_pm_addr_entry *entry;
> diff --git a/net/mptcp/pm_userspace.c b/net/mptcp/pm_userspace.c
> index 6e51335c8bc1..b233d8469a48 100644
> --- a/net/mptcp/pm_userspace.c
> +++ b/net/mptcp/pm_userspace.c
> @@ -130,8 +130,8 @@ mptcp_userspace_pm_lookup_addr_by_id(struct mptcp_sock *msk, unsigned int id)
> return NULL;
> }
>
> -int mptcp_userspace_pm_get_local_id(struct mptcp_sock *msk,
> - struct mptcp_pm_param *param)
> +static int mptcp_userspace_pm_get_local_id(struct mptcp_sock *msk,
> + struct mptcp_pm_param *param)
> {
> __be16 msk_sport = ((struct inet_sock *)
> inet_sk((struct sock *)msk))->inet_sport;
> diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h
> index cddb919fc120..d06add105df5 100644
> --- a/net/mptcp/protocol.h
> +++ b/net/mptcp/protocol.h
> @@ -1129,10 +1129,6 @@ void mptcp_pm_param_set_contexts(struct mptcp_pm_param *param,
> const struct mptcp_pm_addr_entry *entry,
> const struct mptcp_addr_info *addr);
> int mptcp_pm_get_local_id(struct mptcp_sock *msk, struct sock_common *skc);
> -int mptcp_pm_nl_get_local_id(struct mptcp_sock *msk,
> - struct mptcp_pm_param *param);
> -int mptcp_userspace_pm_get_local_id(struct mptcp_sock *msk,
> - struct mptcp_pm_param *param);
> bool mptcp_pm_is_backup(struct mptcp_sock *msk, struct sock_common *skc);
> bool mptcp_pm_nl_is_backup(struct mptcp_sock *msk, struct mptcp_addr_info *skc);
> bool mptcp_userspace_pm_is_backup(struct mptcp_sock *msk, struct mptcp_addr_info *skc);
Cheers,
Matt
--
Sponsored by the NGI0 Core fund.
next prev parent reply other threads:[~2025-02-21 17:23 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-20 2:57 [PATCH mptcp-next v5 0/9] BPF path manager, part 4 Geliang Tang
2025-02-20 2:57 ` [PATCH mptcp-next v5 1/9] mptcp: pm: use addr entry for get_local_id Geliang Tang
2025-02-21 17:23 ` Matthieu Baerts
2025-02-20 2:57 ` [PATCH mptcp-next v5 2/9] mptcp: pm: add struct mptcp_pm_param Geliang Tang
2025-02-21 17:23 ` Matthieu Baerts
2025-02-20 2:57 ` [PATCH mptcp-next v5 3/9] mptcp: pm: pass pm_param to get_local_id Geliang Tang
2025-02-20 2:57 ` [PATCH mptcp-next v5 4/9] mptcp: pm: define struct mptcp_pm_ops Geliang Tang
2025-02-21 17:23 ` Matthieu Baerts
2025-02-24 6:54 ` Geliang Tang
2025-02-24 8:26 ` Matthieu Baerts
2025-02-24 9:11 ` Geliang Tang
2025-02-24 10:24 ` Matthieu Baerts
2025-02-20 2:57 ` [PATCH mptcp-next v5 5/9] mptcp: pm: in-kernel: register mptcp_netlink_pm Geliang Tang
2025-02-20 2:57 ` [PATCH mptcp-next v5 6/9] mptcp: pm: userspace: register mptcp_userspace_pm Geliang Tang
2025-02-20 2:57 ` [PATCH mptcp-next v5 7/9] mptcp: pm: initialize and release mptcp_pm_ops Geliang Tang
2025-02-20 2:57 ` [PATCH mptcp-next v5 8/9] mptcp: pm: drop get_local_id helpers Geliang Tang
2025-02-21 17:23 ` Matthieu Baerts [this message]
2025-02-20 2:57 ` [PATCH mptcp-next v5 9/9] mptcp: pm: drop is_backup helpers Geliang Tang
2025-02-20 4:12 ` [PATCH mptcp-next v5 0/9] BPF path manager, part 4 MPTCP CI
2025-02-21 17:23 ` 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=60914d20-36df-4128-a062-4f4e1030367a@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.