MPTCP Linux Development
 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 v2 5/8] mptcp: change info of get_addr as const
Date: Mon, 30 Dec 2024 17:29:52 +0100	[thread overview]
Message-ID: <2792bb58-644c-44f1-9a0e-54af8b9bdafe@kernel.org> (raw)
In-Reply-To: <42a61bb9dc5ab239e65723b0d5322e5684565ca5.1734074788.git.tanggeliang@kylinos.cn>

Hi Geliang,

On 13/12/2024 08:35, Geliang Tang wrote:
> From: Geliang Tang <tanggeliang@kylinos.cn>
> 
> get_addr() interfaces will be invoked by dump_addr(), which using const
> parameters 'info', so this patch changes 'info' parameters of get_addr()
> as const too.
> 
> Some adaptations are also needed. No longer use genl_info_pm_nl() because
> it doesn't accept a 'const' variable, but that's OK to get pernet via
> genl_info_net().

(...)

> --- a/net/mptcp/pm_netlink.c
> +++ b/net/mptcp/pm_netlink.c
> @@ -1763,12 +1763,15 @@ int mptcp_nl_fill_addr(struct sk_buff *skb,
>  }
>  
>  int mptcp_pm_nl_get_addr(u8 id, struct mptcp_pm_addr_entry *addr,
> -			 struct genl_info *info)
> +			 const struct genl_info *info)
>  {
> -	struct pm_nl_pernet *pernet = genl_info_pm_nl(info);
> +	struct net *net = genl_info_net(info);
>  	struct mptcp_pm_addr_entry *entry;
> +	struct pm_nl_pernet *pernet;
>  	int ret = -EINVAL;
>  
> +	pernet = pm_nl_get_pernet(net);

A small detail if you have something anything to change: maybe the 'net'
variable is not needed, and instead of 3 lines, you can have it in 1:

  struct pm_nl_pernet *pernet = pm_nl_get_pernet(genl_info_net(info));

> +
>  	rcu_read_lock();
>  	entry = __lookup_addr_by_id(pernet, id);
>  	if (entry) {

(...)

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


  reply	other threads:[~2024-12-30 16:29 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-13  7:35 [PATCH mptcp-next v2 0/8] BPF path manager, part 2 Geliang Tang
2024-12-13  7:35 ` [PATCH mptcp-next v2 1/8] mptcp: make three pm wrappers static Geliang Tang
2024-12-13  7:35 ` [PATCH mptcp-next v2 2/8] mptcp: drop skb parameter of get_addr Geliang Tang
2024-12-13  7:35 ` [PATCH mptcp-next v2 3/8] mptcp: add id parameter for get_addr Geliang Tang
2024-12-30 16:29   ` Matthieu Baerts
2024-12-13  7:35 ` [PATCH mptcp-next v2 4/8] mptcp: reuse sending nlmsg code in get_addr Geliang Tang
2024-12-13  7:35 ` [PATCH mptcp-next v2 5/8] mptcp: change info of get_addr as const Geliang Tang
2024-12-30 16:29   ` Matthieu Baerts [this message]
2024-12-13  7:35 ` [PATCH mptcp-next v2 6/8] mptcp: add info parameter for dump_addr Geliang Tang
2024-12-13  7:35 ` [PATCH mptcp-next v2 7/8] mptcp: add mptcp_pm_addr_id_bitmap_t type Geliang Tang
2024-12-30 16:30   ` Matthieu Baerts
2025-01-09  4:15     ` Geliang Tang
2025-01-09 15:37       ` Matthieu Baerts
2024-12-13  7:35 ` [PATCH mptcp-next v2 8/8] mptcp: reuse sending nlmsg code in dump_addr Geliang Tang
2024-12-30 16:33   ` Matthieu Baerts
2024-12-30 16:27 ` [PATCH mptcp-next v2 0/8] BPF path manager, part 2 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=2792bb58-644c-44f1-9a0e-54af8b9bdafe@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox