Skip to content

Commit

Permalink
dcb: Use rtnl_register_many().
Browse files Browse the repository at this point in the history
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@amazon.com>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Link: https://patch.msgid.link/20241014201828.91221-10-kuniyu@amazon.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
  • Loading branch information
Kuniyuki Iwashima authored and Jakub Kicinski committed Oct 16, 2024
1 parent 3ac84e3 commit c82b031
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions net/dcb/dcbnl.c
Original file line number Diff line number Diff line change
Expand Up @@ -2408,6 +2408,11 @@ static struct notifier_block dcbnl_nb __read_mostly = {
.notifier_call = dcbnl_netdevice_event,
};

static const struct rtnl_msg_handler dcbnl_rtnl_msg_handlers[] __initconst = {
{.msgtype = RTM_GETDCB, .doit = dcb_doit},
{.msgtype = RTM_SETDCB, .doit = dcb_doit},
};

static int __init dcbnl_init(void)
{
int err;
Expand All @@ -2416,8 +2421,7 @@ static int __init dcbnl_init(void)
if (err)
return err;

rtnl_register(PF_UNSPEC, RTM_GETDCB, dcb_doit, NULL, 0);
rtnl_register(PF_UNSPEC, RTM_SETDCB, dcb_doit, NULL, 0);
rtnl_register_many(dcbnl_rtnl_msg_handlers);

return 0;
}
Expand Down

0 comments on commit c82b031

Please sign in to comment.