Commit 71179ac5 authored by Jiri Pirko's avatar Jiri Pirko Committed by Jakub Kicinski

devlink: move devlink_notify_register/unregister() to dev.c

At last, move the last bits out of leftover.c,
the devlink_notify_register/unregister() functions to dev.c
Signed-off-by: default avatarJiri Pirko <jiri@nvidia.com>
Link: https://lore.kernel.org/r/20230828061657.300667-16-jiri@resnulli.usSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 29a390d1
# SPDX-License-Identifier: GPL-2.0 # SPDX-License-Identifier: GPL-2.0
obj-y := leftover.o core.o netlink.o netlink_gen.o dev.o port.o sb.o dpipe.o \ obj-y := core.o netlink.o netlink_gen.o dev.o port.o sb.o dpipe.o \
resource.o param.o region.o health.o trap.o rate.o linecard.o resource.o param.o region.o health.o trap.o rate.o linecard.o
...@@ -174,7 +174,7 @@ static int devlink_nl_fill(struct sk_buff *msg, struct devlink *devlink, ...@@ -174,7 +174,7 @@ static int devlink_nl_fill(struct sk_buff *msg, struct devlink *devlink,
return -EMSGSIZE; return -EMSGSIZE;
} }
void devlink_notify(struct devlink *devlink, enum devlink_command cmd) static void devlink_notify(struct devlink *devlink, enum devlink_command cmd)
{ {
struct sk_buff *msg; struct sk_buff *msg;
int err; int err;
...@@ -230,6 +230,32 @@ int devlink_nl_get_dumpit(struct sk_buff *msg, struct netlink_callback *cb) ...@@ -230,6 +230,32 @@ int devlink_nl_get_dumpit(struct sk_buff *msg, struct netlink_callback *cb)
return devlink_nl_dumpit(msg, cb, devlink_nl_get_dump_one); return devlink_nl_dumpit(msg, cb, devlink_nl_get_dump_one);
} }
void devlink_notify_register(struct devlink *devlink)
{
devlink_notify(devlink, DEVLINK_CMD_NEW);
devlink_linecards_notify_register(devlink);
devlink_ports_notify_register(devlink);
devlink_trap_policers_notify_register(devlink);
devlink_trap_groups_notify_register(devlink);
devlink_traps_notify_register(devlink);
devlink_rates_notify_register(devlink);
devlink_regions_notify_register(devlink);
devlink_params_notify_register(devlink);
}
void devlink_notify_unregister(struct devlink *devlink)
{
devlink_params_notify_unregister(devlink);
devlink_regions_notify_unregister(devlink);
devlink_rates_notify_unregister(devlink);
devlink_traps_notify_unregister(devlink);
devlink_trap_groups_notify_unregister(devlink);
devlink_trap_policers_notify_unregister(devlink);
devlink_ports_notify_unregister(devlink);
devlink_linecards_notify_unregister(devlink);
devlink_notify(devlink, DEVLINK_CMD_DEL);
}
static void devlink_reload_failed_set(struct devlink *devlink, static void devlink_reload_failed_set(struct devlink *devlink,
bool reload_failed) bool reload_failed)
{ {
......
...@@ -124,9 +124,6 @@ typedef int devlink_nl_dump_one_func_t(struct sk_buff *msg, ...@@ -124,9 +124,6 @@ typedef int devlink_nl_dump_one_func_t(struct sk_buff *msg,
struct devlink * struct devlink *
devlink_get_from_attrs_lock(struct net *net, struct nlattr **attrs); devlink_get_from_attrs_lock(struct net *net, struct nlattr **attrs);
void devlink_notify_unregister(struct devlink *devlink);
void devlink_notify_register(struct devlink *devlink);
int devlink_nl_dumpit(struct sk_buff *msg, struct netlink_callback *cb, int devlink_nl_dumpit(struct sk_buff *msg, struct netlink_callback *cb,
devlink_nl_dump_one_func_t *dump_one); devlink_nl_dump_one_func_t *dump_one);
...@@ -151,7 +148,8 @@ devlink_nl_put_handle(struct sk_buff *msg, struct devlink *devlink) ...@@ -151,7 +148,8 @@ devlink_nl_put_handle(struct sk_buff *msg, struct devlink *devlink)
int devlink_nl_msg_reply_and_new(struct sk_buff **msg, struct genl_info *info); int devlink_nl_msg_reply_and_new(struct sk_buff **msg, struct genl_info *info);
/* Notify */ /* Notify */
void devlink_notify(struct devlink *devlink, enum devlink_command cmd); void devlink_notify_register(struct devlink *devlink);
void devlink_notify_unregister(struct devlink *devlink);
void devlink_ports_notify_register(struct devlink *devlink); void devlink_ports_notify_register(struct devlink *devlink);
void devlink_ports_notify_unregister(struct devlink *devlink); void devlink_ports_notify_unregister(struct devlink *devlink);
void devlink_params_notify_register(struct devlink *devlink); void devlink_params_notify_register(struct devlink *devlink);
......
// SPDX-License-Identifier: GPL-2.0-or-later
/*
* net/core/devlink.c - Network physical/parent device Netlink interface
*
* Heavily inspired by net/wireless/
* Copyright (c) 2016 Mellanox Technologies. All rights reserved.
* Copyright (c) 2016 Jiri Pirko <jiri@mellanox.com>
*/
#include <linux/etherdevice.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/types.h>
#include <linux/slab.h>
#include <linux/gfp.h>
#include <linux/device.h>
#include <linux/list.h>
#include <linux/netdevice.h>
#include <linux/spinlock.h>
#include <linux/refcount.h>
#include <linux/workqueue.h>
#include <linux/u64_stats_sync.h>
#include <linux/timekeeping.h>
#include <rdma/ib_verbs.h>
#include <net/netlink.h>
#include <net/genetlink.h>
#include <net/rtnetlink.h>
#include <net/net_namespace.h>
#include <net/sock.h>
#include <net/devlink.h>
#include "devl_internal.h"
void devlink_notify_register(struct devlink *devlink)
{
devlink_notify(devlink, DEVLINK_CMD_NEW);
devlink_linecards_notify_register(devlink);
devlink_ports_notify_register(devlink);
devlink_trap_policers_notify_register(devlink);
devlink_trap_groups_notify_register(devlink);
devlink_traps_notify_register(devlink);
devlink_rates_notify_register(devlink);
devlink_regions_notify_register(devlink);
devlink_params_notify_register(devlink);
}
void devlink_notify_unregister(struct devlink *devlink)
{
devlink_params_notify_unregister(devlink);
devlink_regions_notify_unregister(devlink);
devlink_rates_notify_unregister(devlink);
devlink_traps_notify_unregister(devlink);
devlink_trap_groups_notify_unregister(devlink);
devlink_trap_policers_notify_unregister(devlink);
devlink_ports_notify_unregister(devlink);
devlink_linecards_notify_unregister(devlink);
devlink_notify(devlink, DEVLINK_CMD_DEL);
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment