All of lore.kernel.org
 help / color / mirror / Atom feed
From: Florian Westphal <fw@strlen.de>
To: Geliang Tang <geliang.tang@suse.com>
Cc: mptcp@lists.linux.dev
Subject: Re: [PATCH mptcp-next] mptcp: add pm_nl_get_pernet helper
Date: Wed, 23 Mar 2022 11:06:44 +0100	[thread overview]
Message-ID: <20220323100644.GH24574@breakpoint.cc> (raw)
In-Reply-To: <44d42216864c1ec295ddf7098327fe5603dfc448.1648029714.git.geliang.tang@suse.com>

Geliang Tang <geliang.tang@suse.com> wrote:
> This patch added a new helper pm_nl_get_pernet(). Ues it instead of
> using pm_nl_pernet_id directly.

If you're already touching this, then ...

> +static struct pm_nl_pernet *pm_nl_get_pernet(const struct net *net)
> +{
> +	return net_generic(net, pm_nl_pernet_id);
> +}
> +

It would make sense to add a second helper that returns pm_nl_pernet
struct given 'struct mptcp_sock *'.

>  static bool addresses_equal(const struct mptcp_addr_info *a,
>  			    const struct mptcp_addr_info *b, bool use_port)
>  {
> @@ -208,7 +213,7 @@ unsigned int mptcp_pm_get_add_addr_signal_max(const struct mptcp_sock *msk)
>  {
>  	const struct pm_nl_pernet *pernet;
>  
> -	pernet = net_generic(sock_net((const struct sock *)msk), pm_nl_pernet_id);
> +	pernet = pm_nl_get_pernet(sock_net((const struct sock *)msk));

This would avoid all these cast.

Something like

> +	pernet = pm_nl_get_pernet_from_msk(msk);

... or similar.

  reply	other threads:[~2022-03-23 10:22 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-23 10:03 [PATCH mptcp-next] mptcp: add pm_nl_get_pernet helper Geliang Tang
2022-03-23 10:06 ` Florian Westphal [this message]
2022-03-23 18:03 ` mptcp: add pm_nl_get_pernet helper: Tests Results MPTCP CI

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=20220323100644.GH24574@breakpoint.cc \
    --to=fw@strlen.de \
    --cc=geliang.tang@suse.com \
    --cc=mptcp@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 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.