[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CANn89iLhMM9BJLYMg9N0iDfLg-iTjjSof8djopYQfMdbbLeZLA@mail.gmail.com>
Date: Mon, 14 Oct 2024 10:01:54 +0200
From: Eric Dumazet <edumazet@...gle.com>
To: Kuniyuki Iwashima <kuniyu@...zon.com>
Cc: "David S. Miller" <davem@...emloft.net>, Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>, Kuniyuki Iwashima <kuni1840@...il.com>, netdev@...r.kernel.org
Subject: Re: [PATCH v1 net-next 03/11] neighbour: Use rtnl_register_many().
On Sat, Oct 12, 2024 at 12:06 AM Kuniyuki Iwashima <kuniyu@...zon.com> wrote:
>
> We will remove rtnl_register() in favour of rtnl_register_many().
>
> When it succeeds, rtnl_register_many() guarantees all rtnetlink types
> in the passed array are supported, and there is no chance that a part
> of message types is not supported.
>
> Let's use rtnl_register_many() instead.
>
> Signed-off-by: Kuniyuki Iwashima <kuniyu@...zon.com>
> ---
> net/core/neighbour.c | 19 ++++++++++---------
> 1 file changed, 10 insertions(+), 9 deletions(-)
>
> diff --git a/net/core/neighbour.c b/net/core/neighbour.c
> index 77b819cd995b..f6137ee80965 100644
> --- a/net/core/neighbour.c
> +++ b/net/core/neighbour.c
> @@ -3886,17 +3886,18 @@ EXPORT_SYMBOL(neigh_sysctl_unregister);
>
> #endif /* CONFIG_SYSCTL */
>
> +static const struct rtnl_msg_handler neigh_rtnl_msg_handlers[] = {
> + {NULL, PF_UNSPEC, RTM_NEWNEIGH, neigh_add, NULL, 0},
> + {NULL, PF_UNSPEC, RTM_DELNEIGH, neigh_delete, NULL, 0},
> + {NULL, PF_UNSPEC, RTM_GETNEIGH, neigh_get, neigh_dump_info,
> + RTNL_FLAG_DUMP_UNLOCKED},
> + {NULL, PF_UNSPEC, RTM_GETNEIGHTBL, NULL, neightbl_dump_info, 0},
> + {NULL, PF_UNSPEC, RTM_SETNEIGHTBL, neightbl_set, NULL, 0},
> +};
> +
Please add __initconst qualifier.
Also C99 initializations look better to me.
+static const struct rtnl_msg_handler neigh_rtnl_msg_handlers[] __initconst = {
+ {.msgtype = RTM_NEWNEIGH, .doit = neigh_add},
+ {.msgtype = RTM_DELNEIGH, .doit = neigh_delete},
+ {.msgtype = RTM_GETNEIGH, .doit = neigh_get,
+ .dumpit = neigh_dump_info, .flags = RTNL_FLAG_DUMP_UNLOCKED},
+ {.msgtype = RTM_GETNEIGHTBL, .dumpit = neightbl_dump_info},
+ {.msgtype = RTM_SETNEIGHTBL, .doit = neightbl_set},
+};
+
Powered by blists - more mailing lists