Commit 6e067d0c authored by Jiri Pirko's avatar Jiri Pirko Committed by Jakub Kicinski

devlink: use generated split ops and remove duplicated commands from small ops

Do the switch and use generated split ops for get and info_get commands.
Remove those from small ops array.
Signed-off-by: default avatarJiri Pirko <jiri@nvidia.com>
Reviewed-by: default avatarJakub Kicinski <kuba@kernel.org>
Link: https://lore.kernel.org/r/20230803111340.1074067-13-jiri@resnulli.usSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent b2551b15
...@@ -124,7 +124,7 @@ struct devlink_cmd { ...@@ -124,7 +124,7 @@ struct devlink_cmd {
devlink_nl_dump_one_func_t *dump_one; devlink_nl_dump_one_func_t *dump_one;
}; };
extern const struct genl_small_ops devlink_nl_small_ops[56]; extern const struct genl_small_ops devlink_nl_small_ops[54];
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);
......
...@@ -6278,14 +6278,7 @@ static int devlink_nl_cmd_trap_policer_set_doit(struct sk_buff *skb, ...@@ -6278,14 +6278,7 @@ static int devlink_nl_cmd_trap_policer_set_doit(struct sk_buff *skb,
return devlink_trap_policer_set(devlink, policer_item, info); return devlink_trap_policer_set(devlink, policer_item, info);
} }
const struct genl_small_ops devlink_nl_small_ops[56] = { const struct genl_small_ops devlink_nl_small_ops[54] = {
{
.cmd = DEVLINK_CMD_GET,
.validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
.doit = devlink_nl_get_doit,
.dumpit = devlink_nl_get_dumpit,
/* can be retrieved by unprivileged users */
},
{ {
.cmd = DEVLINK_CMD_PORT_GET, .cmd = DEVLINK_CMD_PORT_GET,
.validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
...@@ -6533,13 +6526,6 @@ const struct genl_small_ops devlink_nl_small_ops[56] = { ...@@ -6533,13 +6526,6 @@ const struct genl_small_ops devlink_nl_small_ops[56] = {
.dumpit = devlink_nl_cmd_region_read_dumpit, .dumpit = devlink_nl_cmd_region_read_dumpit,
.flags = GENL_ADMIN_PERM, .flags = GENL_ADMIN_PERM,
}, },
{
.cmd = DEVLINK_CMD_INFO_GET,
.validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
.doit = devlink_nl_info_get_doit,
.dumpit = devlink_nl_info_get_dumpit,
/* can be retrieved by unprivileged users */
},
{ {
.cmd = DEVLINK_CMD_HEALTH_REPORTER_GET, .cmd = DEVLINK_CMD_HEALTH_REPORTER_GET,
.validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
......
...@@ -248,6 +248,8 @@ struct genl_family devlink_nl_family __ro_after_init = { ...@@ -248,6 +248,8 @@ struct genl_family devlink_nl_family __ro_after_init = {
.module = THIS_MODULE, .module = THIS_MODULE,
.small_ops = devlink_nl_small_ops, .small_ops = devlink_nl_small_ops,
.n_small_ops = ARRAY_SIZE(devlink_nl_small_ops), .n_small_ops = ARRAY_SIZE(devlink_nl_small_ops),
.split_ops = devlink_nl_ops,
.n_split_ops = ARRAY_SIZE(devlink_nl_ops),
.resv_start_op = DEVLINK_CMD_SELFTESTS_RUN + 1, .resv_start_op = DEVLINK_CMD_SELFTESTS_RUN + 1,
.mcgrps = devlink_nl_mcgrps, .mcgrps = devlink_nl_mcgrps,
.n_mcgrps = ARRAY_SIZE(devlink_nl_mcgrps), .n_mcgrps = ARRAY_SIZE(devlink_nl_mcgrps),
......
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