summaryrefslogtreecommitdiff
path: root/net/devlink/devl_internal.h
diff options
context:
space:
mode:
authorJiri Pirko <jiri@nvidia.com>2023-08-03 13:13:35 +0200
committerJakub Kicinski <kuba@kernel.org>2023-08-04 14:03:01 -0700
commit491a24872a64cbb8edf996b6113a97586702e5ca (patch)
tree532612ebb70d3de4ee1a47f8f780a1dab224b755 /net/devlink/devl_internal.h
parentd61aedcf628ef7467d69638c3b3e5e33cafd75aa (diff)
devlink: introduce couple of dumpit callbacks for split ops
Introduce couple of dumpit callbacks for generated split ops. Have them as a thin wrapper around iteration function and allow to pass dump_one() function pointer directly without need to store in devlink_cmd structs. Signed-off-by: Jiri Pirko <jiri@nvidia.com> Reviewed-by: Jakub Kicinski <kuba@kernel.org> Link: https://lore.kernel.org/r/20230803111340.1074067-8-jiri@resnulli.us Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'net/devlink/devl_internal.h')
-rw-r--r--net/devlink/devl_internal.h17
1 files changed, 11 insertions, 6 deletions
diff --git a/net/devlink/devl_internal.h b/net/devlink/devl_internal.h
index d32a32705430..7d0a9dd1aceb 100644
--- a/net/devlink/devl_internal.h
+++ b/net/devlink/devl_internal.h
@@ -114,9 +114,12 @@ struct devlink_nl_dump_state {
};
};
+typedef int devlink_nl_dump_one_func_t(struct sk_buff *msg,
+ struct devlink *devlink,
+ struct netlink_callback *cb);
+
struct devlink_cmd {
- int (*dump_one)(struct sk_buff *msg, struct devlink *devlink,
- struct netlink_callback *cb);
+ devlink_nl_dump_one_func_t *dump_one;
};
extern const struct genl_small_ops devlink_nl_small_ops[56];
@@ -127,8 +130,9 @@ 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_instance_iter_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);
+int devlink_nl_instance_iter_dumpit(struct sk_buff *msg, struct netlink_callback *cb);
static inline struct devlink_nl_dump_state *
devlink_dump_state(struct netlink_callback *cb)
@@ -149,7 +153,6 @@ devlink_nl_put_handle(struct sk_buff *msg, struct devlink *devlink)
}
/* Commands */
-extern const struct devlink_cmd devl_cmd_get;
extern const struct devlink_cmd devl_cmd_port_get;
extern const struct devlink_cmd devl_cmd_sb_get;
extern const struct devlink_cmd devl_cmd_sb_pool_get;
@@ -157,7 +160,6 @@ extern const struct devlink_cmd devl_cmd_sb_port_pool_get;
extern const struct devlink_cmd devl_cmd_sb_tc_pool_bind_get;
extern const struct devlink_cmd devl_cmd_param_get;
extern const struct devlink_cmd devl_cmd_region_get;
-extern const struct devlink_cmd devl_cmd_info_get;
extern const struct devlink_cmd devl_cmd_health_reporter_get;
extern const struct devlink_cmd devl_cmd_trap_get;
extern const struct devlink_cmd devl_cmd_trap_group_get;
@@ -215,10 +217,13 @@ devlink_rate_node_get_from_info(struct devlink *devlink,
struct genl_info *info);
/* Devlink nl cmds */
int devlink_nl_get_doit(struct sk_buff *skb, struct genl_info *info);
+int devlink_nl_get_dumpit(struct sk_buff *skb, struct netlink_callback *cb);
int devlink_nl_cmd_reload(struct sk_buff *skb, struct genl_info *info);
int devlink_nl_cmd_eswitch_get_doit(struct sk_buff *skb, struct genl_info *info);
int devlink_nl_cmd_eswitch_set_doit(struct sk_buff *skb, struct genl_info *info);
int devlink_nl_info_get_doit(struct sk_buff *skb, struct genl_info *info);
+int devlink_nl_info_get_dumpit(struct sk_buff *skb,
+ struct netlink_callback *cb);
int devlink_nl_cmd_flash_update(struct sk_buff *skb, struct genl_info *info);
int devlink_nl_cmd_selftests_get_doit(struct sk_buff *skb, struct genl_info *info);
int devlink_nl_cmd_selftests_run(struct sk_buff *skb, struct genl_info *info);