@@ -116,7 +116,7 @@ struct devlink_cmd {
struct netlink_callback *cb);
};
-extern const struct genl_small_ops devlink_nl_ops[52];
+extern const struct genl_small_ops devlink_nl_ops[40];
struct devlink *
devlink_get_from_attrs_lock(struct net *net, struct nlattr **attrs);
@@ -124,9 +124,6 @@ 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);
-
static inline struct devlink_nl_dump_state *
devlink_dump_state(struct netlink_callback *cb)
{
@@ -211,8 +208,15 @@ int devlink_nl_cmd_selftests_get_doit(struct sk_buff *skb, struct genl_info *inf
int devlink_nl_cmd_selftests_run(struct sk_buff *skb, struct genl_info *info);
int devlink_nl_cmd_port_get_doit(struct sk_buff *skb,
struct genl_info *info);
+int devlink_nl_cmd_sb_get_doit(struct sk_buff *skb, struct genl_info *info);
+int devlink_nl_cmd_sb_pool_get_doit(struct sk_buff *skb, struct genl_info *info);
+int devlink_nl_cmd_sb_port_pool_get_doit(struct sk_buff *skb,
+ struct genl_info *info);
+int devlink_nl_cmd_sb_tc_pool_bind_get_doit(struct sk_buff *skb,
+ struct genl_info *info);
int devlink_nl_cmd_param_get_doit(struct sk_buff *skb,
struct genl_info *info);
+int devlink_nl_cmd_region_get_doit(struct sk_buff *skb, struct genl_info *info);
int devlink_nl_cmd_health_reporter_get_doit(struct sk_buff *skb,
struct genl_info *info);
int devlink_nl_cmd_health_reporter_set_doit(struct sk_buff *skb,
@@ -227,4 +231,11 @@ int devlink_nl_cmd_health_reporter_dump_clear_doit(struct sk_buff *skb,
struct genl_info *info);
int devlink_nl_cmd_health_reporter_test_doit(struct sk_buff *skb,
struct genl_info *info);
+int devlink_nl_cmd_rate_get_doit(struct sk_buff *skb, struct genl_info *info);
+int devlink_nl_cmd_linecard_get_doit(struct sk_buff *skb,
+ struct genl_info *info);
int devlink_nl_cmd_trap_get_doit(struct sk_buff *skb, struct genl_info *info);
+int devlink_nl_cmd_trap_group_get_doit(struct sk_buff *skb,
+ struct genl_info *info);
+int devlink_nl_cmd_trap_policer_get_doit(struct sk_buff *skb,
+ struct genl_info *info);
@@ -1038,8 +1038,7 @@ const struct devlink_cmd devl_cmd_rate_get = {
.dump_one = devlink_nl_cmd_rate_get_dump_one,
};
-static int devlink_nl_cmd_rate_get_doit(struct sk_buff *skb,
- struct genl_info *info)
+int devlink_nl_cmd_rate_get_doit(struct sk_buff *skb, struct genl_info *info)
{
struct devlink *devlink = info->user_ptr[0];
struct devlink_rate *devlink_rate;
@@ -1825,8 +1824,8 @@ static void devlink_linecard_notify(struct devlink_linecard *linecard,
msg, 0, DEVLINK_MCGRP_CONFIG, GFP_KERNEL);
}
-static int devlink_nl_cmd_linecard_get_doit(struct sk_buff *skb,
- struct genl_info *info)
+int devlink_nl_cmd_linecard_get_doit(struct sk_buff *skb,
+ struct genl_info *info)
{
struct devlink *devlink = info->user_ptr[0];
struct devlink_linecard *linecard;
@@ -2091,8 +2090,7 @@ static int devlink_nl_sb_fill(struct sk_buff *msg, struct devlink *devlink,
return -EMSGSIZE;
}
-static int devlink_nl_cmd_sb_get_doit(struct sk_buff *skb,
- struct genl_info *info)
+int devlink_nl_cmd_sb_get_doit(struct sk_buff *skb, struct genl_info *info)
{
struct devlink *devlink = info->user_ptr[0];
struct devlink_sb *devlink_sb;
@@ -2194,8 +2192,7 @@ static int devlink_nl_sb_pool_fill(struct sk_buff *msg, struct devlink *devlink,
return -EMSGSIZE;
}
-static int devlink_nl_cmd_sb_pool_get_doit(struct sk_buff *skb,
- struct genl_info *info)
+int devlink_nl_cmd_sb_pool_get_doit(struct sk_buff *skb, struct genl_info *info)
{
struct devlink *devlink = info->user_ptr[0];
struct devlink_sb *devlink_sb;
@@ -2394,8 +2391,8 @@ static int devlink_nl_sb_port_pool_fill(struct sk_buff *msg,
return err;
}
-static int devlink_nl_cmd_sb_port_pool_get_doit(struct sk_buff *skb,
- struct genl_info *info)
+int devlink_nl_cmd_sb_port_pool_get_doit(struct sk_buff *skb,
+ struct genl_info *info)
{
struct devlink_port *devlink_port = info->user_ptr[1];
struct devlink *devlink = devlink_port->devlink;
@@ -2603,8 +2600,8 @@ devlink_nl_sb_tc_pool_bind_fill(struct sk_buff *msg, struct devlink *devlink,
return -EMSGSIZE;
}
-static int devlink_nl_cmd_sb_tc_pool_bind_get_doit(struct sk_buff *skb,
- struct genl_info *info)
+int devlink_nl_cmd_sb_tc_pool_bind_get_doit(struct sk_buff *skb,
+ struct genl_info *info)
{
struct devlink_port *devlink_port = info->user_ptr[1];
struct devlink *devlink = devlink_port->devlink;
@@ -4793,8 +4790,7 @@ static void devlink_region_snapshot_del(struct devlink_region *region,
kfree(snapshot);
}
-static int devlink_nl_cmd_region_get_doit(struct sk_buff *skb,
- struct genl_info *info)
+int devlink_nl_cmd_region_get_doit(struct sk_buff *skb, struct genl_info *info)
{
struct devlink *devlink = info->user_ptr[0];
struct devlink_port *port = NULL;
@@ -5865,8 +5861,8 @@ devlink_nl_trap_group_fill(struct sk_buff *msg, struct devlink *devlink,
return -EMSGSIZE;
}
-static int devlink_nl_cmd_trap_group_get_doit(struct sk_buff *skb,
- struct genl_info *info)
+int devlink_nl_cmd_trap_group_get_doit(struct sk_buff *skb,
+ struct genl_info *info)
{
struct netlink_ext_ack *extack = info->extack;
struct devlink *devlink = info->user_ptr[0];
@@ -6159,8 +6155,8 @@ devlink_nl_trap_policer_fill(struct sk_buff *msg, struct devlink *devlink,
return -EMSGSIZE;
}
-static int devlink_nl_cmd_trap_policer_get_doit(struct sk_buff *skb,
- struct genl_info *info)
+int devlink_nl_cmd_trap_policer_get_doit(struct sk_buff *skb,
+ struct genl_info *info)
{
struct devlink_trap_policer_item *policer_item;
struct netlink_ext_ack *extack = info->extack;
@@ -6300,14 +6296,7 @@ static int devlink_nl_cmd_trap_policer_set_doit(struct sk_buff *skb,
return devlink_trap_policer_set(devlink, policer_item, info);
}
-const struct genl_small_ops devlink_nl_ops[52] = {
- {
- .cmd = DEVLINK_CMD_GET,
- .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
- .doit = devlink_nl_cmd_get_doit,
- .dumpit = devlink_nl_instance_iter_dumpit,
- /* can be retrieved by unprivileged users */
- },
+const struct genl_small_ops devlink_nl_ops[40] = {
{
.cmd = DEVLINK_CMD_PORT_SET,
.validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
@@ -6315,12 +6304,6 @@ const struct genl_small_ops devlink_nl_ops[52] = {
.flags = GENL_ADMIN_PERM,
.internal_flags = DEVLINK_NL_FLAG_NEED_PORT,
},
- {
- .cmd = DEVLINK_CMD_RATE_GET,
- .doit = devlink_nl_cmd_rate_get_doit,
- .dumpit = devlink_nl_instance_iter_dumpit,
- /* can be retrieved by unprivileged users */
- },
{
.cmd = DEVLINK_CMD_RATE_SET,
.doit = devlink_nl_cmd_rate_set_doit,
@@ -6361,45 +6344,17 @@ const struct genl_small_ops devlink_nl_ops[52] = {
.flags = GENL_ADMIN_PERM,
.internal_flags = DEVLINK_NL_FLAG_NEED_PORT,
},
- {
- .cmd = DEVLINK_CMD_LINECARD_GET,
- .doit = devlink_nl_cmd_linecard_get_doit,
- .dumpit = devlink_nl_instance_iter_dumpit,
- /* can be retrieved by unprivileged users */
- },
{
.cmd = DEVLINK_CMD_LINECARD_SET,
.doit = devlink_nl_cmd_linecard_set_doit,
.flags = GENL_ADMIN_PERM,
},
- {
- .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_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_dumpit,
- /* can be retrieved by unprivileged users */
- },
{
.cmd = DEVLINK_CMD_SB_POOL_SET,
.validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
.doit = devlink_nl_cmd_sb_pool_set_doit,
.flags = GENL_ADMIN_PERM,
},
- {
- .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_dumpit,
- .internal_flags = DEVLINK_NL_FLAG_NEED_PORT,
- /* can be retrieved by unprivileged users */
- },
{
.cmd = DEVLINK_CMD_SB_PORT_POOL_SET,
.validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
@@ -6407,14 +6362,6 @@ const struct genl_small_ops devlink_nl_ops[52] = {
.flags = GENL_ADMIN_PERM,
.internal_flags = DEVLINK_NL_FLAG_NEED_PORT,
},
- {
- .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_dumpit,
- .internal_flags = DEVLINK_NL_FLAG_NEED_PORT,
- /* can be retrieved by unprivileged users */
- },
{
.cmd = DEVLINK_CMD_SB_TC_POOL_BIND_SET,
.validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
@@ -6509,13 +6456,6 @@ const struct genl_small_ops devlink_nl_ops[52] = {
.flags = GENL_ADMIN_PERM,
.internal_flags = DEVLINK_NL_FLAG_NEED_PORT,
},
- {
- .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_dumpit,
- .flags = GENL_ADMIN_PERM,
- },
{
.cmd = DEVLINK_CMD_REGION_NEW,
.validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
@@ -6535,13 +6475,6 @@ const struct genl_small_ops devlink_nl_ops[52] = {
.dumpit = devlink_nl_cmd_region_read_dumpit,
.flags = GENL_ADMIN_PERM,
},
- {
- .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_dumpit,
- /* can be retrieved by unprivileged users */
- },
{
.cmd = DEVLINK_CMD_HEALTH_REPORTER_SET,
.validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
@@ -6595,34 +6528,16 @@ const struct genl_small_ops devlink_nl_ops[52] = {
.doit = devlink_nl_cmd_trap_set_doit,
.flags = GENL_ADMIN_PERM,
},
- {
- .cmd = DEVLINK_CMD_TRAP_GROUP_GET,
- .doit = devlink_nl_cmd_trap_group_get_doit,
- .dumpit = devlink_nl_instance_iter_dumpit,
- /* can be retrieved by unprivileged users */
- },
{
.cmd = DEVLINK_CMD_TRAP_GROUP_SET,
.doit = devlink_nl_cmd_trap_group_set_doit,
.flags = GENL_ADMIN_PERM,
},
- {
- .cmd = DEVLINK_CMD_TRAP_POLICER_GET,
- .doit = devlink_nl_cmd_trap_policer_get_doit,
- .dumpit = devlink_nl_instance_iter_dumpit,
- /* can be retrieved by unprivileged users */
- },
{
.cmd = DEVLINK_CMD_TRAP_POLICER_SET,
.doit = devlink_nl_cmd_trap_policer_set_doit,
.flags = GENL_ADMIN_PERM,
},
- {
- .cmd = DEVLINK_CMD_SELFTESTS_GET,
- .doit = devlink_nl_cmd_selftests_get_doit,
- .dumpit = devlink_nl_instance_iter_dumpit,
- /* can be retrieved by unprivileged users */
- },
{
.cmd = DEVLINK_CMD_SELFTESTS_RUN,
.doit = devlink_nl_cmd_selftests_run,
@@ -195,8 +195,8 @@ static const struct devlink_cmd *devl_cmds[] = {
[DEVLINK_CMD_SELFTESTS_GET] = &devl_cmd_selftests_get,
};
-int devlink_nl_instance_iter_dumpit(struct sk_buff *msg,
- struct netlink_callback *cb)
+static 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);
@@ -286,15 +286,39 @@ int devlink_nl_instance_iter_dumpit(struct sk_buff *msg,
__DEVL_NL_OP_DUMP(cmd_subname, 0, maxattr, policy)
static const struct genl_split_ops devlink_nl_split_ops[] = {
+ DEVL_NL_OP_LEGACY_DO(GET, get, simple),
+ DEVL_NL_OP_LEGACY_DUMP(GET),
DEVL_NL_OP_LEGACY_DO(PORT_GET, port_get, port),
DEVL_NL_OP_LEGACY_DUMP(PORT_GET),
+ DEVL_NL_OP_LEGACY_DO(SB_GET, sb_get, simple),
+ DEVL_NL_OP_LEGACY_DUMP(SB_GET),
+ DEVL_NL_OP_LEGACY_DO(SB_POOL_GET, sb_pool_get, simple),
+ DEVL_NL_OP_LEGACY_DUMP(SB_POOL_GET),
+ DEVL_NL_OP_LEGACY_DO(SB_PORT_POOL_GET, sb_port_pool_get, simple),
+ DEVL_NL_OP_LEGACY_DUMP(SB_PORT_POOL_GET),
+ DEVL_NL_OP_LEGACY_DO(SB_TC_POOL_BIND_GET, sb_tc_pool_bind_get, simple),
+ DEVL_NL_OP_LEGACY_DUMP(SB_TC_POOL_BIND_GET),
DEVL_NL_OP_LEGACY_DO(PARAM_GET, param_get, simple),
DEVL_NL_OP_LEGACY_DUMP(PARAM_GET),
+ DEVL_NL_OP_LEGACY_DO(REGION_GET, region_get, simple),
+ DEVL_NL_OP_LEGACY_DUMP(REGION_GET),
+ DEVL_NL_OP_LEGACY_DO(INFO_GET, info_get, simple),
+ DEVL_NL_OP_LEGACY_DUMP(INFO_GET),
DEVL_NL_OP_LEGACY_DO(HEALTH_REPORTER_GET, health_reporter_get,
port_optional),
DEVL_NL_OP_LEGACY_DUMP(HEALTH_REPORTER_GET),
DEVL_NL_OP_LEGACY_STRICT_DO(TRAP_GET, trap_get, simple),
DEVL_NL_OP_LEGACY_STRICT_DUMP(TRAP_GET),
+ DEVL_NL_OP_LEGACY_STRICT_DO(TRAP_GROUP_GET, trap_group_get, simple),
+ DEVL_NL_OP_LEGACY_STRICT_DUMP(TRAP_GROUP_GET),
+ DEVL_NL_OP_LEGACY_STRICT_DO(TRAP_POLICER_GET, trap_policer_get, simple),
+ DEVL_NL_OP_LEGACY_STRICT_DUMP(TRAP_POLICER_GET),
+ DEVL_NL_OP_LEGACY_DO(RATE_GET, rate_get, simple),
+ DEVL_NL_OP_LEGACY_DUMP(RATE_GET),
+ DEVL_NL_OP_LEGACY_DO(LINECARD_GET, linecard_get, simple),
+ DEVL_NL_OP_LEGACY_DUMP(LINECARD_GET),
+ DEVL_NL_OP_LEGACY_STRICT_DO(SELFTESTS_GET, selftests_get, simple),
+ DEVL_NL_OP_LEGACY_STRICT_DUMP(SELFTESTS_GET),
/* For every newly added command put above this line the set of macros
* DEVL_NL_OP_DO and DEVL_NL_OP_DUMP should be used. Note that
* there is an exception with non-iterator dump implementation.