summaryrefslogtreecommitdiff
path: root/net/devlink/netlink.c
diff options
context:
space:
mode:
authorJakub Kicinski <kuba@kernel.org>2023-01-05 07:05:31 +0300
committerJakub Kicinski <kuba@kernel.org>2023-01-06 09:13:40 +0300
commit5ce76d78b99650c0b22f466060d8b75df9123511 (patch)
treed40bbd8361fe6fa0b66d5fcc3169b46387b55ee2 /net/devlink/netlink.c
parent07f3af66089e20fe439b219d3c9d3e68d964193f (diff)
downloadlinux-5ce76d78b99650c0b22f466060d8b75df9123511.tar.xz
devlink: convert remaining dumps to the by-instance scheme
Soon we'll have to check if a devlink instance is alive after locking it. Convert to the by-instance dumping scheme to make refactoring easier. Most of the subobject code no longer has to worry about any devlink locking / lifetime rules (the only ones that still do are the two subject types which stubbornly use their own locking). Both dump and do callbacks are given a devlink instance which is already locked and good-to-access (do from the .pre_doit handler, dump from the new dump indirection). Note that we'll now check presence of an op (e.g. for sb_pool_get) under the devlink instance lock, that will soon be necessary anyway, because we don't hold refs on the driver modules so the memory in which ops live may be gone for a dead instance, after upcoming locking changes. Reviewed-by: Jacob Keller <jacob.e.keller@intel.com> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'net/devlink/netlink.c')
-rw-r--r--net/devlink/netlink.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/net/devlink/netlink.c b/net/devlink/netlink.c
index 82ee5621bd9c..a552e723f4a6 100644
--- a/net/devlink/netlink.c
+++ b/net/devlink/netlink.c
@@ -179,7 +179,20 @@ static void devlink_nl_post_doit(const struct genl_split_ops *ops,
}
static const struct devlink_gen_cmd *devl_gen_cmds[] = {
+ [DEVLINK_CMD_GET] = &devl_gen_inst,
+ [DEVLINK_CMD_PORT_GET] = &devl_gen_port,
+ [DEVLINK_CMD_SB_GET] = &devl_gen_sb,
+ [DEVLINK_CMD_SB_POOL_GET] = &devl_gen_sb_pool,
+ [DEVLINK_CMD_SB_PORT_POOL_GET] = &devl_gen_sb_port_pool,
+ [DEVLINK_CMD_SB_TC_POOL_BIND_GET] = &devl_gen_sb_tc_pool_bind,
+ [DEVLINK_CMD_PARAM_GET] = &devl_gen_param,
+ [DEVLINK_CMD_REGION_GET] = &devl_gen_region,
+ [DEVLINK_CMD_INFO_GET] = &devl_gen_info,
[DEVLINK_CMD_RATE_GET] = &devl_gen_rate_get,
+ [DEVLINK_CMD_TRAP_GET] = &devl_gen_trap,
+ [DEVLINK_CMD_TRAP_GROUP_GET] = &devl_gen_trap_group,
+ [DEVLINK_CMD_TRAP_POLICER_GET] = &devl_gen_trap_policer,
+ [DEVLINK_CMD_SELFTESTS_GET] = &devl_gen_selftests,
};
int devlink_nl_instance_iter_dump(struct sk_buff *msg,