diff options
author | Jakub Kicinski <kuba@kernel.org> | 2023-02-01 10:57:03 -0800 |
---|---|---|
committer | Jakub Kicinski <kuba@kernel.org> | 2023-02-01 10:57:04 -0800 |
commit | 074dd3b35aaa4807306268c1654200d3608ebbf3 (patch) | |
tree | 57599bc3079d2b5d0ffffebdd68b58d1f2094f84 | |
parent | dd25cfab16e6bff1bbd75b42b8334c4419c90a4f (diff) | |
parent | 8589ba4e642aa257fa46ee82c975921e19db47d5 (diff) |
Merge branch 'devlink-trivial-names-cleanup'
Jiri Pirko says:
====================
devlink: trivial names cleanup
This is a follow-up to Jakub's devlink code split and dump iteration
helper patchset. No functional changes, just couple of renames to makes
things consistent and perhaps easier to follow.
====================
Link: https://lore.kernel.org/r/20230131090613.2131740-1-jiri@resnulli.us
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
-rw-r--r-- | net/devlink/devl_internal.h | 41 | ||||
-rw-r--r-- | net/devlink/leftover.c | 64 | ||||
-rw-r--r-- | net/devlink/netlink.c | 42 |
3 files changed, 73 insertions, 74 deletions
diff --git a/net/devlink/devl_internal.h b/net/devlink/devl_internal.h index ba161de4120e..bdd7ad25c7e8 100644 --- a/net/devlink/devl_internal.h +++ b/net/devlink/devl_internal.h @@ -115,7 +115,7 @@ struct devlink_nl_dump_state { }; }; -struct devlink_gen_cmd { +struct devlink_cmd { int (*dump_one)(struct sk_buff *msg, struct devlink *devlink, struct netlink_callback *cb); }; @@ -128,8 +128,8 @@ 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_dump(struct sk_buff *msg, - struct netlink_callback *cb); +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) @@ -139,22 +139,23 @@ devlink_dump_state(struct netlink_callback *cb) return (struct devlink_nl_dump_state *)cb->ctx; } -/* gen cmds */ -extern const struct devlink_gen_cmd devl_gen_inst; -extern const struct devlink_gen_cmd devl_gen_port; -extern const struct devlink_gen_cmd devl_gen_sb; -extern const struct devlink_gen_cmd devl_gen_sb_pool; -extern const struct devlink_gen_cmd devl_gen_sb_port_pool; -extern const struct devlink_gen_cmd devl_gen_sb_tc_pool_bind; -extern const struct devlink_gen_cmd devl_gen_selftests; -extern const struct devlink_gen_cmd devl_gen_param; -extern const struct devlink_gen_cmd devl_gen_region; -extern const struct devlink_gen_cmd devl_gen_info; -extern const struct devlink_gen_cmd devl_gen_health_reporter; -extern const struct devlink_gen_cmd devl_gen_trap; -extern const struct devlink_gen_cmd devl_gen_trap_group; -extern const struct devlink_gen_cmd devl_gen_trap_policer; -extern const struct devlink_gen_cmd devl_gen_linecard; +/* 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; +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; +extern const struct devlink_cmd devl_cmd_trap_policer_get; +extern const struct devlink_cmd devl_cmd_rate_get; +extern const struct devlink_cmd devl_cmd_linecard_get; +extern const struct devlink_cmd devl_cmd_selftests_get; /* Ports */ int devlink_port_netdevice_event(struct notifier_block *nb, @@ -182,8 +183,6 @@ struct devlink_linecard * devlink_linecard_get_from_info(struct devlink *devlink, struct genl_info *info); /* Rates */ -extern const struct devlink_gen_cmd devl_gen_rate_get; - struct devlink_rate * devlink_rate_get_from_info(struct devlink *devlink, struct genl_info *info); struct devlink_rate * diff --git a/net/devlink/leftover.c b/net/devlink/leftover.c index 92210587d349..056d9ca14a3d 100644 --- a/net/devlink/leftover.c +++ b/net/devlink/leftover.c @@ -1236,7 +1236,7 @@ devlink_nl_cmd_rate_get_dump_one(struct sk_buff *msg, struct devlink *devlink, return err; } -const struct devlink_gen_cmd devl_gen_rate_get = { +const struct devlink_cmd devl_cmd_rate_get = { .dump_one = devlink_nl_cmd_rate_get_dump_one, }; @@ -1303,7 +1303,7 @@ devlink_nl_cmd_get_dump_one(struct sk_buff *msg, struct devlink *devlink, cb->nlh->nlmsg_seq, NLM_F_MULTI); } -const struct devlink_gen_cmd devl_gen_inst = { +const struct devlink_cmd devl_cmd_get = { .dump_one = devlink_nl_cmd_get_dump_one, }; @@ -1359,7 +1359,7 @@ devlink_nl_cmd_port_get_dump_one(struct sk_buff *msg, struct devlink *devlink, return err; } -const struct devlink_gen_cmd devl_gen_port = { +const struct devlink_cmd devl_cmd_port_get = { .dump_one = devlink_nl_cmd_port_get_dump_one, }; @@ -2137,7 +2137,7 @@ static int devlink_nl_cmd_linecard_get_dump_one(struct sk_buff *msg, return err; } -const struct devlink_gen_cmd devl_gen_linecard = { +const struct devlink_cmd devl_cmd_linecard_get = { .dump_one = devlink_nl_cmd_linecard_get_dump_one, }; @@ -2392,7 +2392,7 @@ devlink_nl_cmd_sb_get_dump_one(struct sk_buff *msg, struct devlink *devlink, return err; } -const struct devlink_gen_cmd devl_gen_sb = { +const struct devlink_cmd devl_cmd_sb_get = { .dump_one = devlink_nl_cmd_sb_get_dump_one, }; @@ -2530,7 +2530,7 @@ devlink_nl_cmd_sb_pool_get_dump_one(struct sk_buff *msg, return err; } -const struct devlink_gen_cmd devl_gen_sb_pool = { +const struct devlink_cmd devl_cmd_sb_pool_get = { .dump_one = devlink_nl_cmd_sb_pool_get_dump_one, }; @@ -2738,7 +2738,7 @@ devlink_nl_cmd_sb_port_pool_get_dump_one(struct sk_buff *msg, return err; } -const struct devlink_gen_cmd devl_gen_sb_port_pool = { +const struct devlink_cmd devl_cmd_sb_port_pool_get = { .dump_one = devlink_nl_cmd_sb_port_pool_get_dump_one, }; @@ -2973,7 +2973,7 @@ devlink_nl_cmd_sb_tc_pool_bind_get_dump_one(struct sk_buff *msg, return err; } -const struct devlink_gen_cmd devl_gen_sb_tc_pool_bind = { +const struct devlink_cmd devl_cmd_sb_tc_pool_bind_get = { .dump_one = devlink_nl_cmd_sb_tc_pool_bind_get_dump_one, }; @@ -4785,7 +4785,7 @@ devlink_nl_cmd_selftests_get_dump_one(struct sk_buff *msg, cb->extack); } -const struct devlink_gen_cmd devl_gen_selftests = { +const struct devlink_cmd devl_cmd_selftests_get = { .dump_one = devlink_nl_cmd_selftests_get_dump_one, }; @@ -5271,7 +5271,7 @@ devlink_nl_cmd_param_get_dump_one(struct sk_buff *msg, struct devlink *devlink, return err; } -const struct devlink_gen_cmd devl_gen_param = { +const struct devlink_cmd devl_cmd_param_get = { .dump_one = devlink_nl_cmd_param_get_dump_one, }; @@ -5978,7 +5978,7 @@ devlink_nl_cmd_region_get_dump_one(struct sk_buff *msg, struct devlink *devlink, return 0; } -const struct devlink_gen_cmd devl_gen_region = { +const struct devlink_cmd devl_cmd_region_get = { .dump_one = devlink_nl_cmd_region_get_dump_one, }; @@ -6625,7 +6625,7 @@ devlink_nl_cmd_info_get_dump_one(struct sk_buff *msg, struct devlink *devlink, return err; } -const struct devlink_gen_cmd devl_gen_info = { +const struct devlink_cmd devl_cmd_info_get = { .dump_one = devlink_nl_cmd_info_get_dump_one, }; @@ -7793,7 +7793,7 @@ devlink_nl_cmd_health_reporter_get_dump_one(struct sk_buff *msg, return 0; } -const struct devlink_gen_cmd devl_gen_health_reporter = { +const struct devlink_cmd devl_cmd_health_reporter_get = { .dump_one = devlink_nl_cmd_health_reporter_get_dump_one, }; @@ -8311,7 +8311,7 @@ devlink_nl_cmd_trap_get_dump_one(struct sk_buff *msg, struct devlink *devlink, return err; } -const struct devlink_gen_cmd devl_gen_trap = { +const struct devlink_cmd devl_cmd_trap_get = { .dump_one = devlink_nl_cmd_trap_get_dump_one, }; @@ -8524,7 +8524,7 @@ devlink_nl_cmd_trap_group_get_dump_one(struct sk_buff *msg, return err; } -const struct devlink_gen_cmd devl_gen_trap_group = { +const struct devlink_cmd devl_cmd_trap_group_get = { .dump_one = devlink_nl_cmd_trap_group_get_dump_one, }; @@ -8817,7 +8817,7 @@ devlink_nl_cmd_trap_policer_get_dump_one(struct sk_buff *msg, return err; } -const struct devlink_gen_cmd devl_gen_trap_policer = { +const struct devlink_cmd devl_cmd_trap_policer_get = { .dump_one = devlink_nl_cmd_trap_policer_get_dump_one, }; @@ -8898,14 +8898,14 @@ const struct genl_small_ops devlink_nl_ops[56] = { .cmd = DEVLINK_CMD_GET, .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, .doit = devlink_nl_cmd_get_doit, - .dumpit = devlink_nl_instance_iter_dump, + .dumpit = devlink_nl_instance_iter_dumpit, /* can be retrieved by unprivileged users */ }, { .cmd = DEVLINK_CMD_PORT_GET, .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, .doit = devlink_nl_cmd_port_get_doit, - .dumpit = devlink_nl_instance_iter_dump, + .dumpit = devlink_nl_instance_iter_dumpit, .internal_flags = DEVLINK_NL_FLAG_NEED_PORT, /* can be retrieved by unprivileged users */ }, @@ -8919,7 +8919,7 @@ const struct genl_small_ops devlink_nl_ops[56] = { { .cmd = DEVLINK_CMD_RATE_GET, .doit = devlink_nl_cmd_rate_get_doit, - .dumpit = devlink_nl_instance_iter_dump, + .dumpit = devlink_nl_instance_iter_dumpit, .internal_flags = DEVLINK_NL_FLAG_NEED_RATE, /* can be retrieved by unprivileged users */ }, @@ -8967,7 +8967,7 @@ const struct genl_small_ops devlink_nl_ops[56] = { { .cmd = DEVLINK_CMD_LINECARD_GET, .doit = devlink_nl_cmd_linecard_get_doit, - .dumpit = devlink_nl_instance_iter_dump, + .dumpit = devlink_nl_instance_iter_dumpit, .internal_flags = DEVLINK_NL_FLAG_NEED_LINECARD, /* can be retrieved by unprivileged users */ }, @@ -8981,14 +8981,14 @@ const struct genl_small_ops devlink_nl_ops[56] = { .cmd = DEVLINK_CMD_SB_GET, .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, .doit = devlink_nl_cmd_sb_get_doit, - .dumpit = devlink_nl_instance_iter_dump, + .dumpit = devlink_nl_instance_iter_dumpit, /* can be retrieved by unprivileged users */ }, { .cmd = DEVLINK_CMD_SB_POOL_GET, .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, .doit = devlink_nl_cmd_sb_pool_get_doit, - .dumpit = devlink_nl_instance_iter_dump, + .dumpit = devlink_nl_instance_iter_dumpit, /* can be retrieved by unprivileged users */ }, { @@ -9001,7 +9001,7 @@ const struct genl_small_ops devlink_nl_ops[56] = { .cmd = DEVLINK_CMD_SB_PORT_POOL_GET, .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, .doit = devlink_nl_cmd_sb_port_pool_get_doit, - .dumpit = devlink_nl_instance_iter_dump, + .dumpit = devlink_nl_instance_iter_dumpit, .internal_flags = DEVLINK_NL_FLAG_NEED_PORT, /* can be retrieved by unprivileged users */ }, @@ -9016,7 +9016,7 @@ const struct genl_small_ops devlink_nl_ops[56] = { .cmd = DEVLINK_CMD_SB_TC_POOL_BIND_GET, .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, .doit = devlink_nl_cmd_sb_tc_pool_bind_get_doit, - .dumpit = devlink_nl_instance_iter_dump, + .dumpit = devlink_nl_instance_iter_dumpit, .internal_flags = DEVLINK_NL_FLAG_NEED_PORT, /* can be retrieved by unprivileged users */ }, @@ -9097,7 +9097,7 @@ const struct genl_small_ops devlink_nl_ops[56] = { .cmd = DEVLINK_CMD_PARAM_GET, .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, .doit = devlink_nl_cmd_param_get_doit, - .dumpit = devlink_nl_instance_iter_dump, + .dumpit = devlink_nl_instance_iter_dumpit, /* can be retrieved by unprivileged users */ }, { @@ -9125,7 +9125,7 @@ const struct genl_small_ops devlink_nl_ops[56] = { .cmd = DEVLINK_CMD_REGION_GET, .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, .doit = devlink_nl_cmd_region_get_doit, - .dumpit = devlink_nl_instance_iter_dump, + .dumpit = devlink_nl_instance_iter_dumpit, .flags = GENL_ADMIN_PERM, }, { @@ -9151,14 +9151,14 @@ const struct genl_small_ops devlink_nl_ops[56] = { .cmd = DEVLINK_CMD_INFO_GET, .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, .doit = devlink_nl_cmd_info_get_doit, - .dumpit = devlink_nl_instance_iter_dump, + .dumpit = devlink_nl_instance_iter_dumpit, /* can be retrieved by unprivileged users */ }, { .cmd = DEVLINK_CMD_HEALTH_REPORTER_GET, .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, .doit = devlink_nl_cmd_health_reporter_get_doit, - .dumpit = devlink_nl_instance_iter_dump, + .dumpit = devlink_nl_instance_iter_dumpit, .internal_flags = DEVLINK_NL_FLAG_NEED_DEVLINK_OR_PORT, /* can be retrieved by unprivileged users */ }, @@ -9213,7 +9213,7 @@ const struct genl_small_ops devlink_nl_ops[56] = { { .cmd = DEVLINK_CMD_TRAP_GET, .doit = devlink_nl_cmd_trap_get_doit, - .dumpit = devlink_nl_instance_iter_dump, + .dumpit = devlink_nl_instance_iter_dumpit, /* can be retrieved by unprivileged users */ }, { @@ -9224,7 +9224,7 @@ const struct genl_small_ops devlink_nl_ops[56] = { { .cmd = DEVLINK_CMD_TRAP_GROUP_GET, .doit = devlink_nl_cmd_trap_group_get_doit, - .dumpit = devlink_nl_instance_iter_dump, + .dumpit = devlink_nl_instance_iter_dumpit, /* can be retrieved by unprivileged users */ }, { @@ -9235,7 +9235,7 @@ const struct genl_small_ops devlink_nl_ops[56] = { { .cmd = DEVLINK_CMD_TRAP_POLICER_GET, .doit = devlink_nl_cmd_trap_policer_get_doit, - .dumpit = devlink_nl_instance_iter_dump, + .dumpit = devlink_nl_instance_iter_dumpit, /* can be retrieved by unprivileged users */ }, { @@ -9246,7 +9246,7 @@ const struct genl_small_ops devlink_nl_ops[56] = { { .cmd = DEVLINK_CMD_SELFTESTS_GET, .doit = devlink_nl_cmd_selftests_get_doit, - .dumpit = devlink_nl_instance_iter_dump, + .dumpit = devlink_nl_instance_iter_dumpit, /* can be retrieved by unprivileged users */ }, { diff --git a/net/devlink/netlink.c b/net/devlink/netlink.c index 3f44633af01c..7a332eb70f70 100644 --- a/net/devlink/netlink.c +++ b/net/devlink/netlink.c @@ -177,35 +177,35 @@ static void devlink_nl_post_doit(const struct genl_split_ops *ops, devlink_put(devlink); } -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_HEALTH_REPORTER_GET] = &devl_gen_health_reporter, - [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_LINECARD_GET] = &devl_gen_linecard, - [DEVLINK_CMD_SELFTESTS_GET] = &devl_gen_selftests, +static const struct devlink_cmd *devl_cmds[] = { + [DEVLINK_CMD_GET] = &devl_cmd_get, + [DEVLINK_CMD_PORT_GET] = &devl_cmd_port_get, + [DEVLINK_CMD_SB_GET] = &devl_cmd_sb_get, + [DEVLINK_CMD_SB_POOL_GET] = &devl_cmd_sb_pool_get, + [DEVLINK_CMD_SB_PORT_POOL_GET] = &devl_cmd_sb_port_pool_get, + [DEVLINK_CMD_SB_TC_POOL_BIND_GET] = &devl_cmd_sb_tc_pool_bind_get, + [DEVLINK_CMD_PARAM_GET] = &devl_cmd_param_get, + [DEVLINK_CMD_REGION_GET] = &devl_cmd_region_get, + [DEVLINK_CMD_INFO_GET] = &devl_cmd_info_get, + [DEVLINK_CMD_HEALTH_REPORTER_GET] = &devl_cmd_health_reporter_get, + [DEVLINK_CMD_TRAP_GET] = &devl_cmd_trap_get, + [DEVLINK_CMD_TRAP_GROUP_GET] = &devl_cmd_trap_group_get, + [DEVLINK_CMD_TRAP_POLICER_GET] = &devl_cmd_trap_policer_get, + [DEVLINK_CMD_RATE_GET] = &devl_cmd_rate_get, + [DEVLINK_CMD_LINECARD_GET] = &devl_cmd_linecard_get, + [DEVLINK_CMD_SELFTESTS_GET] = &devl_cmd_selftests_get, }; -int devlink_nl_instance_iter_dump(struct sk_buff *msg, - struct netlink_callback *cb) +int devlink_nl_instance_iter_dumpit(struct sk_buff *msg, + struct netlink_callback *cb) { const struct genl_dumpit_info *info = genl_dumpit_info(cb); struct devlink_nl_dump_state *state = devlink_dump_state(cb); - const struct devlink_gen_cmd *cmd; + const struct devlink_cmd *cmd; struct devlink *devlink; int err = 0; - cmd = devl_gen_cmds[info->op.cmd]; + cmd = devl_cmds[info->op.cmd]; while ((devlink = devlinks_xa_find_get(sock_net(msg->sk), &state->instance))) { |