Skip to content

Commit

Permalink
Merge branch 'devlink-trivial-names-cleanup'
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
kuba-moo committed Feb 1, 2023
2 parents dd25cfa + 8589ba4 commit 074dd3b
Show file tree
Hide file tree
Showing 3 changed files with 73 additions and 74 deletions.
41 changes: 20 additions & 21 deletions net/devlink/devl_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
};
Expand All @@ -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)
Expand All @@ -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,
Expand Down Expand Up @@ -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 *
Expand Down
64 changes: 32 additions & 32 deletions net/devlink/leftover.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};

Expand Down Expand Up @@ -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,
};

Expand Down Expand Up @@ -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,
};

Expand Down Expand Up @@ -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,
};

Expand Down Expand Up @@ -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,
};

Expand Down Expand Up @@ -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,
};

Expand Down Expand Up @@ -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,
};

Expand Down Expand Up @@ -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,
};

Expand Down Expand Up @@ -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,
};

Expand Down Expand Up @@ -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,
};

Expand Down Expand Up @@ -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,
};

Expand Down Expand Up @@ -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,
};

Expand Down Expand Up @@ -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,
};

Expand Down Expand Up @@ -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,
};

Expand Down Expand Up @@ -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,
};

Expand Down Expand Up @@ -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,
};

Expand Down Expand Up @@ -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 */
},
Expand All @@ -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 */
},
Expand Down Expand Up @@ -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 */
},
Expand All @@ -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 */
},
{
Expand All @@ -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 */
},
Expand All @@ -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 */
},
Expand Down Expand Up @@ -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 */
},
{
Expand Down Expand Up @@ -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,
},
{
Expand All @@ -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 */
},
Expand Down Expand Up @@ -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 */
},
{
Expand All @@ -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 */
},
{
Expand All @@ -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 */
},
{
Expand All @@ -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 */
},
{
Expand Down

0 comments on commit 074dd3b

Please sign in to comment.