mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-08-21 11:09:26 -04:00
devlink: Migrate from info->user_ptr to info->ctx
Replace deprecated info->user_ptr[0]/[1] with a typed devlink_nl_ctx struct stored in info->ctx. The struct aliases the same union memory, so the migration is safe. There are no functionality changes here. Signed-off-by: Cosmin Ratiu <cratiu@nvidia.com> Reviewed-by: Jiri Pirko <jiri@nvidia.com> Signed-off-by: Tariq Toukan <tariqt@nvidia.com> Link: https://patch.msgid.link/20260701073254.754518-4-tariqt@nvidia.com Signed-off-by: Paolo Abeni <pabeni@redhat.com>
This commit is contained in:
committed by
Paolo Abeni
parent
9f2d908cc3
commit
e48abacd6e
@@ -222,7 +222,7 @@ static void devlink_notify(struct devlink *devlink, enum devlink_command cmd)
|
||||
|
||||
int devlink_nl_get_doit(struct sk_buff *skb, struct genl_info *info)
|
||||
{
|
||||
struct devlink *devlink = info->user_ptr[0];
|
||||
struct devlink *devlink = devlink_nl_ctx(info)->devlink;
|
||||
struct sk_buff *msg;
|
||||
int err;
|
||||
|
||||
@@ -519,7 +519,7 @@ devlink_nl_reload_actions_performed_snd(struct devlink *devlink, u32 actions_per
|
||||
|
||||
int devlink_nl_reload_doit(struct sk_buff *skb, struct genl_info *info)
|
||||
{
|
||||
struct devlink *devlink = info->user_ptr[0];
|
||||
struct devlink *devlink = devlink_nl_ctx(info)->devlink;
|
||||
enum devlink_reload_action action;
|
||||
enum devlink_reload_limit limit;
|
||||
struct net *dest_net = NULL;
|
||||
@@ -683,7 +683,7 @@ static int devlink_nl_eswitch_fill(struct sk_buff *msg, struct devlink *devlink,
|
||||
|
||||
int devlink_nl_eswitch_get_doit(struct sk_buff *skb, struct genl_info *info)
|
||||
{
|
||||
struct devlink *devlink = info->user_ptr[0];
|
||||
struct devlink *devlink = devlink_nl_ctx(info)->devlink;
|
||||
struct sk_buff *msg;
|
||||
int err;
|
||||
|
||||
@@ -704,7 +704,7 @@ int devlink_nl_eswitch_get_doit(struct sk_buff *skb, struct genl_info *info)
|
||||
|
||||
int devlink_nl_eswitch_set_doit(struct sk_buff *skb, struct genl_info *info)
|
||||
{
|
||||
struct devlink *devlink = info->user_ptr[0];
|
||||
struct devlink *devlink = devlink_nl_ctx(info)->devlink;
|
||||
const struct devlink_ops *ops = devlink->ops;
|
||||
enum devlink_eswitch_encap_mode encap_mode;
|
||||
u8 inline_mode;
|
||||
@@ -906,7 +906,7 @@ devlink_nl_info_fill(struct sk_buff *msg, struct devlink *devlink,
|
||||
|
||||
int devlink_nl_info_get_doit(struct sk_buff *skb, struct genl_info *info)
|
||||
{
|
||||
struct devlink *devlink = info->user_ptr[0];
|
||||
struct devlink *devlink = devlink_nl_ctx(info)->devlink;
|
||||
struct sk_buff *msg;
|
||||
int err;
|
||||
|
||||
@@ -1134,7 +1134,7 @@ int devlink_nl_flash_update_doit(struct sk_buff *skb, struct genl_info *info)
|
||||
{
|
||||
struct nlattr *nla_overwrite_mask, *nla_file_name;
|
||||
struct devlink_flash_update_params params = {};
|
||||
struct devlink *devlink = info->user_ptr[0];
|
||||
struct devlink *devlink = devlink_nl_ctx(info)->devlink;
|
||||
const char *file_name;
|
||||
u32 supported_params;
|
||||
int ret;
|
||||
@@ -1302,7 +1302,7 @@ devlink_nl_selftests_fill(struct sk_buff *msg, struct devlink *devlink,
|
||||
|
||||
int devlink_nl_selftests_get_doit(struct sk_buff *skb, struct genl_info *info)
|
||||
{
|
||||
struct devlink *devlink = info->user_ptr[0];
|
||||
struct devlink *devlink = devlink_nl_ctx(info)->devlink;
|
||||
struct sk_buff *msg;
|
||||
int err;
|
||||
|
||||
@@ -1372,7 +1372,7 @@ static const struct nla_policy devlink_selftest_nl_policy[DEVLINK_ATTR_SELFTEST_
|
||||
int devlink_nl_selftests_run_doit(struct sk_buff *skb, struct genl_info *info)
|
||||
{
|
||||
struct nlattr *tb[DEVLINK_ATTR_SELFTEST_ID_MAX + 1];
|
||||
struct devlink *devlink = info->user_ptr[0];
|
||||
struct devlink *devlink = devlink_nl_ctx(info)->devlink;
|
||||
struct nlattr *attrs, *selftests;
|
||||
struct sk_buff *msg;
|
||||
void *hdr;
|
||||
|
||||
@@ -151,6 +151,19 @@ int devlink_rel_devlink_handle_put(struct sk_buff *msg, struct devlink *devlink,
|
||||
bool *msg_updated);
|
||||
|
||||
/* Netlink */
|
||||
struct devlink_nl_ctx {
|
||||
struct devlink *devlink;
|
||||
struct devlink_port *devlink_port;
|
||||
};
|
||||
|
||||
static inline struct devlink_nl_ctx *
|
||||
devlink_nl_ctx(struct genl_info *info)
|
||||
{
|
||||
BUILD_BUG_ON(sizeof(struct devlink_nl_ctx) >
|
||||
sizeof_field(struct genl_info, ctx));
|
||||
return (struct devlink_nl_ctx *)info->ctx;
|
||||
}
|
||||
|
||||
enum devlink_multicast_groups {
|
||||
DEVLINK_MCGRP_CONFIG,
|
||||
};
|
||||
|
||||
@@ -213,7 +213,7 @@ static int devlink_dpipe_tables_fill(struct genl_info *info,
|
||||
struct list_head *dpipe_tables,
|
||||
const char *table_name)
|
||||
{
|
||||
struct devlink *devlink = info->user_ptr[0];
|
||||
struct devlink *devlink = devlink_nl_ctx(info)->devlink;
|
||||
struct devlink_dpipe_table *table;
|
||||
struct nlattr *tables_attr;
|
||||
struct sk_buff *skb = NULL;
|
||||
@@ -290,7 +290,7 @@ static int devlink_dpipe_tables_fill(struct genl_info *info,
|
||||
|
||||
int devlink_nl_dpipe_table_get_doit(struct sk_buff *skb, struct genl_info *info)
|
||||
{
|
||||
struct devlink *devlink = info->user_ptr[0];
|
||||
struct devlink *devlink = devlink_nl_ctx(info)->devlink;
|
||||
const char *table_name = NULL;
|
||||
|
||||
if (info->attrs[DEVLINK_ATTR_DPIPE_TABLE_NAME])
|
||||
@@ -478,7 +478,7 @@ int devlink_dpipe_entry_ctx_prepare(struct devlink_dpipe_dump_ctx *dump_ctx)
|
||||
if (!dump_ctx->hdr)
|
||||
goto nla_put_failure;
|
||||
|
||||
devlink = dump_ctx->info->user_ptr[0];
|
||||
devlink = devlink_nl_ctx(dump_ctx->info)->devlink;
|
||||
if (devlink_nl_put_handle(dump_ctx->skb, devlink))
|
||||
goto nla_put_failure;
|
||||
dump_ctx->nest = nla_nest_start_noflag(dump_ctx->skb,
|
||||
@@ -563,7 +563,7 @@ static int devlink_dpipe_entries_fill(struct genl_info *info,
|
||||
int devlink_nl_dpipe_entries_get_doit(struct sk_buff *skb,
|
||||
struct genl_info *info)
|
||||
{
|
||||
struct devlink *devlink = info->user_ptr[0];
|
||||
struct devlink *devlink = devlink_nl_ctx(info)->devlink;
|
||||
struct devlink_dpipe_table *table;
|
||||
const char *table_name;
|
||||
|
||||
@@ -650,7 +650,7 @@ static int devlink_dpipe_headers_fill(struct genl_info *info,
|
||||
struct devlink_dpipe_headers *
|
||||
dpipe_headers)
|
||||
{
|
||||
struct devlink *devlink = info->user_ptr[0];
|
||||
struct devlink *devlink = devlink_nl_ctx(info)->devlink;
|
||||
struct nlattr *headers_attr;
|
||||
struct sk_buff *skb = NULL;
|
||||
struct nlmsghdr *nlh;
|
||||
@@ -713,7 +713,7 @@ static int devlink_dpipe_headers_fill(struct genl_info *info,
|
||||
int devlink_nl_dpipe_headers_get_doit(struct sk_buff *skb,
|
||||
struct genl_info *info)
|
||||
{
|
||||
struct devlink *devlink = info->user_ptr[0];
|
||||
struct devlink *devlink = devlink_nl_ctx(info)->devlink;
|
||||
|
||||
if (!devlink->dpipe_headers)
|
||||
return -EOPNOTSUPP;
|
||||
@@ -747,7 +747,7 @@ static int devlink_dpipe_table_counters_set(struct devlink *devlink,
|
||||
int devlink_nl_dpipe_table_counters_set_doit(struct sk_buff *skb,
|
||||
struct genl_info *info)
|
||||
{
|
||||
struct devlink *devlink = info->user_ptr[0];
|
||||
struct devlink *devlink = devlink_nl_ctx(info)->devlink;
|
||||
const char *table_name;
|
||||
bool counters_enable;
|
||||
|
||||
|
||||
@@ -358,7 +358,7 @@ devlink_health_reporter_get_from_info(struct devlink *devlink,
|
||||
int devlink_nl_health_reporter_get_doit(struct sk_buff *skb,
|
||||
struct genl_info *info)
|
||||
{
|
||||
struct devlink *devlink = info->user_ptr[0];
|
||||
struct devlink *devlink = devlink_nl_ctx(info)->devlink;
|
||||
struct devlink_health_reporter *reporter;
|
||||
struct sk_buff *msg;
|
||||
int err;
|
||||
@@ -456,7 +456,7 @@ int devlink_nl_health_reporter_get_dumpit(struct sk_buff *skb,
|
||||
int devlink_nl_health_reporter_set_doit(struct sk_buff *skb,
|
||||
struct genl_info *info)
|
||||
{
|
||||
struct devlink *devlink = info->user_ptr[0];
|
||||
struct devlink *devlink = devlink_nl_ctx(info)->devlink;
|
||||
struct devlink_health_reporter *reporter;
|
||||
|
||||
reporter = devlink_health_reporter_get_from_info(devlink, info);
|
||||
@@ -715,7 +715,7 @@ EXPORT_SYMBOL_GPL(devlink_health_reporter_state_update);
|
||||
int devlink_nl_health_reporter_recover_doit(struct sk_buff *skb,
|
||||
struct genl_info *info)
|
||||
{
|
||||
struct devlink *devlink = info->user_ptr[0];
|
||||
struct devlink *devlink = devlink_nl_ctx(info)->devlink;
|
||||
struct devlink_health_reporter *reporter;
|
||||
|
||||
reporter = devlink_health_reporter_get_from_info(devlink, info);
|
||||
@@ -1157,7 +1157,7 @@ static int devlink_fmsg_dumpit(struct devlink_fmsg *fmsg, struct sk_buff *skb,
|
||||
int devlink_nl_health_reporter_diagnose_doit(struct sk_buff *skb,
|
||||
struct genl_info *info)
|
||||
{
|
||||
struct devlink *devlink = info->user_ptr[0];
|
||||
struct devlink *devlink = devlink_nl_ctx(info)->devlink;
|
||||
struct devlink_health_reporter *reporter;
|
||||
struct devlink_fmsg *fmsg;
|
||||
int err;
|
||||
@@ -1252,7 +1252,7 @@ int devlink_nl_health_reporter_dump_get_dumpit(struct sk_buff *skb,
|
||||
int devlink_nl_health_reporter_dump_clear_doit(struct sk_buff *skb,
|
||||
struct genl_info *info)
|
||||
{
|
||||
struct devlink *devlink = info->user_ptr[0];
|
||||
struct devlink *devlink = devlink_nl_ctx(info)->devlink;
|
||||
struct devlink_health_reporter *reporter;
|
||||
|
||||
reporter = devlink_health_reporter_get_from_info(devlink, info);
|
||||
@@ -1269,7 +1269,7 @@ int devlink_nl_health_reporter_dump_clear_doit(struct sk_buff *skb,
|
||||
int devlink_nl_health_reporter_test_doit(struct sk_buff *skb,
|
||||
struct genl_info *info)
|
||||
{
|
||||
struct devlink *devlink = info->user_ptr[0];
|
||||
struct devlink *devlink = devlink_nl_ctx(info)->devlink;
|
||||
struct devlink_health_reporter *reporter;
|
||||
|
||||
reporter = devlink_health_reporter_get_from_info(devlink, info);
|
||||
|
||||
@@ -171,7 +171,7 @@ void devlink_linecards_notify_unregister(struct devlink *devlink)
|
||||
|
||||
int devlink_nl_linecard_get_doit(struct sk_buff *skb, struct genl_info *info)
|
||||
{
|
||||
struct devlink *devlink = info->user_ptr[0];
|
||||
struct devlink *devlink = devlink_nl_ctx(info)->devlink;
|
||||
struct devlink_linecard *linecard;
|
||||
struct sk_buff *msg;
|
||||
int err;
|
||||
@@ -371,7 +371,7 @@ static int devlink_linecard_type_unset(struct devlink_linecard *linecard,
|
||||
int devlink_nl_linecard_set_doit(struct sk_buff *skb, struct genl_info *info)
|
||||
{
|
||||
struct netlink_ext_ack *extack = info->extack;
|
||||
struct devlink *devlink = info->user_ptr[0];
|
||||
struct devlink *devlink = devlink_nl_ctx(info)->devlink;
|
||||
struct devlink_linecard *linecard;
|
||||
int err;
|
||||
|
||||
|
||||
@@ -252,18 +252,18 @@ static int __devlink_nl_pre_doit(struct sk_buff *skb, struct genl_info *info,
|
||||
if (IS_ERR(devlink))
|
||||
return PTR_ERR(devlink);
|
||||
|
||||
info->user_ptr[0] = devlink;
|
||||
devlink_nl_ctx(info)->devlink = devlink;
|
||||
if (flags & DEVLINK_NL_FLAG_NEED_PORT) {
|
||||
devlink_port = devlink_port_get_from_info(devlink, info);
|
||||
if (IS_ERR(devlink_port)) {
|
||||
err = PTR_ERR(devlink_port);
|
||||
goto unlock;
|
||||
}
|
||||
info->user_ptr[1] = devlink_port;
|
||||
devlink_nl_ctx(info)->devlink_port = devlink_port;
|
||||
} else if (flags & DEVLINK_NL_FLAG_NEED_DEVLINK_OR_PORT) {
|
||||
devlink_port = devlink_port_get_from_info(devlink, info);
|
||||
if (!IS_ERR(devlink_port))
|
||||
info->user_ptr[1] = devlink_port;
|
||||
devlink_nl_ctx(info)->devlink_port = devlink_port;
|
||||
}
|
||||
return 0;
|
||||
|
||||
@@ -304,7 +304,7 @@ static void __devlink_nl_post_doit(struct sk_buff *skb, struct genl_info *info,
|
||||
bool dev_lock = flags & DEVLINK_NL_FLAG_NEED_DEV_LOCK;
|
||||
struct devlink *devlink;
|
||||
|
||||
devlink = info->user_ptr[0];
|
||||
devlink = devlink_nl_ctx(info)->devlink;
|
||||
devl_dev_unlock(devlink, dev_lock);
|
||||
devlink_put(devlink);
|
||||
}
|
||||
|
||||
@@ -627,7 +627,7 @@ devlink_param_get_from_info(struct xarray *params, struct genl_info *info)
|
||||
int devlink_nl_param_get_doit(struct sk_buff *skb,
|
||||
struct genl_info *info)
|
||||
{
|
||||
struct devlink *devlink = info->user_ptr[0];
|
||||
struct devlink *devlink = devlink_nl_ctx(info)->devlink;
|
||||
struct devlink_param_item *param_item;
|
||||
struct sk_buff *msg;
|
||||
int err;
|
||||
@@ -728,7 +728,7 @@ static int __devlink_nl_cmd_param_set_doit(struct devlink *devlink,
|
||||
|
||||
int devlink_nl_param_set_doit(struct sk_buff *skb, struct genl_info *info)
|
||||
{
|
||||
struct devlink *devlink = info->user_ptr[0];
|
||||
struct devlink *devlink = devlink_nl_ctx(info)->devlink;
|
||||
|
||||
return __devlink_nl_cmd_param_set_doit(devlink, 0, &devlink->params,
|
||||
info, DEVLINK_CMD_PARAM_NEW);
|
||||
|
||||
@@ -594,7 +594,7 @@ void devlink_ports_notify_unregister(struct devlink *devlink)
|
||||
|
||||
int devlink_nl_port_get_doit(struct sk_buff *skb, struct genl_info *info)
|
||||
{
|
||||
struct devlink_port *devlink_port = info->user_ptr[1];
|
||||
struct devlink_port *devlink_port = devlink_nl_ctx(info)->devlink_port;
|
||||
struct sk_buff *msg;
|
||||
int err;
|
||||
|
||||
@@ -830,7 +830,7 @@ static int devlink_port_function_set(struct devlink_port *port,
|
||||
|
||||
int devlink_nl_port_set_doit(struct sk_buff *skb, struct genl_info *info)
|
||||
{
|
||||
struct devlink_port *devlink_port = info->user_ptr[1];
|
||||
struct devlink_port *devlink_port = devlink_nl_ctx(info)->devlink_port;
|
||||
int err;
|
||||
|
||||
if (info->attrs[DEVLINK_ATTR_PORT_TYPE]) {
|
||||
@@ -856,8 +856,8 @@ int devlink_nl_port_set_doit(struct sk_buff *skb, struct genl_info *info)
|
||||
|
||||
int devlink_nl_port_split_doit(struct sk_buff *skb, struct genl_info *info)
|
||||
{
|
||||
struct devlink_port *devlink_port = info->user_ptr[1];
|
||||
struct devlink *devlink = info->user_ptr[0];
|
||||
struct devlink_port *devlink_port = devlink_nl_ctx(info)->devlink_port;
|
||||
struct devlink *devlink = devlink_nl_ctx(info)->devlink;
|
||||
u32 count;
|
||||
|
||||
if (GENL_REQ_ATTR_CHECK(info, DEVLINK_ATTR_PORT_SPLIT_COUNT))
|
||||
@@ -887,8 +887,8 @@ int devlink_nl_port_split_doit(struct sk_buff *skb, struct genl_info *info)
|
||||
|
||||
int devlink_nl_port_unsplit_doit(struct sk_buff *skb, struct genl_info *info)
|
||||
{
|
||||
struct devlink_port *devlink_port = info->user_ptr[1];
|
||||
struct devlink *devlink = info->user_ptr[0];
|
||||
struct devlink_port *devlink_port = devlink_nl_ctx(info)->devlink_port;
|
||||
struct devlink *devlink = devlink_nl_ctx(info)->devlink;
|
||||
|
||||
if (!devlink_port->ops->port_unsplit)
|
||||
return -EOPNOTSUPP;
|
||||
@@ -899,7 +899,7 @@ int devlink_nl_port_new_doit(struct sk_buff *skb, struct genl_info *info)
|
||||
{
|
||||
struct netlink_ext_ack *extack = info->extack;
|
||||
struct devlink_port_new_attrs new_attrs = {};
|
||||
struct devlink *devlink = info->user_ptr[0];
|
||||
struct devlink *devlink = devlink_nl_ctx(info)->devlink;
|
||||
struct devlink_port *devlink_port;
|
||||
struct sk_buff *msg;
|
||||
int err;
|
||||
@@ -961,9 +961,9 @@ int devlink_nl_port_new_doit(struct sk_buff *skb, struct genl_info *info)
|
||||
|
||||
int devlink_nl_port_del_doit(struct sk_buff *skb, struct genl_info *info)
|
||||
{
|
||||
struct devlink_port *devlink_port = info->user_ptr[1];
|
||||
struct devlink_port *devlink_port = devlink_nl_ctx(info)->devlink_port;
|
||||
struct netlink_ext_ack *extack = info->extack;
|
||||
struct devlink *devlink = info->user_ptr[0];
|
||||
struct devlink *devlink = devlink_nl_ctx(info)->devlink;
|
||||
|
||||
if (!devlink_port->ops->port_del)
|
||||
return -EOPNOTSUPP;
|
||||
|
||||
@@ -239,7 +239,7 @@ int devlink_nl_rate_get_dumpit(struct sk_buff *skb, struct netlink_callback *cb)
|
||||
|
||||
int devlink_nl_rate_get_doit(struct sk_buff *skb, struct genl_info *info)
|
||||
{
|
||||
struct devlink *devlink = info->user_ptr[0];
|
||||
struct devlink *devlink = devlink_nl_ctx(info)->devlink;
|
||||
struct devlink_rate *devlink_rate;
|
||||
struct sk_buff *msg;
|
||||
int err;
|
||||
@@ -588,7 +588,7 @@ static bool devlink_rate_set_ops_supported(const struct devlink_ops *ops,
|
||||
|
||||
int devlink_nl_rate_set_doit(struct sk_buff *skb, struct genl_info *info)
|
||||
{
|
||||
struct devlink *devlink = info->user_ptr[0];
|
||||
struct devlink *devlink = devlink_nl_ctx(info)->devlink;
|
||||
struct devlink_rate *devlink_rate;
|
||||
const struct devlink_ops *ops;
|
||||
int err;
|
||||
@@ -610,7 +610,7 @@ int devlink_nl_rate_set_doit(struct sk_buff *skb, struct genl_info *info)
|
||||
|
||||
int devlink_nl_rate_new_doit(struct sk_buff *skb, struct genl_info *info)
|
||||
{
|
||||
struct devlink *devlink = info->user_ptr[0];
|
||||
struct devlink *devlink = devlink_nl_ctx(info)->devlink;
|
||||
struct devlink_rate *rate_node;
|
||||
const struct devlink_ops *ops;
|
||||
int err;
|
||||
@@ -666,7 +666,7 @@ int devlink_nl_rate_new_doit(struct sk_buff *skb, struct genl_info *info)
|
||||
|
||||
int devlink_nl_rate_del_doit(struct sk_buff *skb, struct genl_info *info)
|
||||
{
|
||||
struct devlink *devlink = info->user_ptr[0];
|
||||
struct devlink *devlink = devlink_nl_ctx(info)->devlink;
|
||||
struct devlink_rate *rate_node;
|
||||
int err;
|
||||
|
||||
|
||||
@@ -469,7 +469,7 @@ static void devlink_region_snapshot_del(struct devlink_region *region,
|
||||
|
||||
int devlink_nl_region_get_doit(struct sk_buff *skb, struct genl_info *info)
|
||||
{
|
||||
struct devlink *devlink = info->user_ptr[0];
|
||||
struct devlink *devlink = devlink_nl_ctx(info)->devlink;
|
||||
struct devlink_port *port = NULL;
|
||||
struct devlink_region *region;
|
||||
const char *region_name;
|
||||
@@ -588,7 +588,7 @@ int devlink_nl_region_get_dumpit(struct sk_buff *skb,
|
||||
|
||||
int devlink_nl_region_del_doit(struct sk_buff *skb, struct genl_info *info)
|
||||
{
|
||||
struct devlink *devlink = info->user_ptr[0];
|
||||
struct devlink *devlink = devlink_nl_ctx(info)->devlink;
|
||||
struct devlink_snapshot *snapshot;
|
||||
struct devlink_port *port = NULL;
|
||||
struct devlink_region *region;
|
||||
@@ -633,7 +633,7 @@ int devlink_nl_region_del_doit(struct sk_buff *skb, struct genl_info *info)
|
||||
|
||||
int devlink_nl_region_new_doit(struct sk_buff *skb, struct genl_info *info)
|
||||
{
|
||||
struct devlink *devlink = info->user_ptr[0];
|
||||
struct devlink *devlink = devlink_nl_ctx(info)->devlink;
|
||||
struct devlink_snapshot *snapshot;
|
||||
struct devlink_port *port = NULL;
|
||||
struct nlattr *snapshot_id_attr;
|
||||
|
||||
@@ -117,7 +117,7 @@ devlink_resource_validate_size(struct devlink_resource *resource, u64 size,
|
||||
|
||||
int devlink_nl_resource_set_doit(struct sk_buff *skb, struct genl_info *info)
|
||||
{
|
||||
struct devlink *devlink = info->user_ptr[0];
|
||||
struct devlink *devlink = devlink_nl_ctx(info)->devlink;
|
||||
struct devlink_resource *resource;
|
||||
u64 resource_id;
|
||||
u64 size;
|
||||
@@ -251,8 +251,9 @@ static int devlink_resource_list_fill(struct sk_buff *skb,
|
||||
static int devlink_resource_fill(struct genl_info *info,
|
||||
enum devlink_command cmd, int flags)
|
||||
{
|
||||
struct devlink_port *devlink_port = info->user_ptr[1];
|
||||
struct devlink *devlink = info->user_ptr[0];
|
||||
struct devlink_nl_ctx *ctx = devlink_nl_ctx(info);
|
||||
struct devlink *devlink = ctx->devlink;
|
||||
struct devlink_port *devlink_port;
|
||||
struct devlink_resource *resource;
|
||||
struct list_head *resource_list;
|
||||
struct nlattr *resources_attr;
|
||||
@@ -263,6 +264,7 @@ static int devlink_resource_fill(struct genl_info *info,
|
||||
int i;
|
||||
int err;
|
||||
|
||||
devlink_port = ctx->devlink_port;
|
||||
resource_list = devlink_port ?
|
||||
&devlink_port->resource_list : &devlink->resource_list;
|
||||
resource = list_first_entry(resource_list,
|
||||
@@ -326,10 +328,12 @@ static int devlink_resource_fill(struct genl_info *info,
|
||||
|
||||
int devlink_nl_resource_dump_doit(struct sk_buff *skb, struct genl_info *info)
|
||||
{
|
||||
struct devlink_port *devlink_port = info->user_ptr[1];
|
||||
struct devlink *devlink = info->user_ptr[0];
|
||||
struct devlink_nl_ctx *ctx = devlink_nl_ctx(info);
|
||||
struct devlink *devlink = ctx->devlink;
|
||||
struct devlink_port *devlink_port;
|
||||
struct list_head *resource_list;
|
||||
|
||||
devlink_port = ctx->devlink_port;
|
||||
if (info->attrs[DEVLINK_ATTR_PORT_INDEX] && !devlink_port)
|
||||
return -ENODEV;
|
||||
|
||||
|
||||
@@ -204,7 +204,7 @@ static int devlink_nl_sb_fill(struct sk_buff *msg, struct devlink *devlink,
|
||||
|
||||
int devlink_nl_sb_get_doit(struct sk_buff *skb, struct genl_info *info)
|
||||
{
|
||||
struct devlink *devlink = info->user_ptr[0];
|
||||
struct devlink *devlink = devlink_nl_ctx(info)->devlink;
|
||||
struct devlink_sb *devlink_sb;
|
||||
struct sk_buff *msg;
|
||||
int err;
|
||||
@@ -306,7 +306,7 @@ static int devlink_nl_sb_pool_fill(struct sk_buff *msg, struct devlink *devlink,
|
||||
|
||||
int devlink_nl_sb_pool_get_doit(struct sk_buff *skb, struct genl_info *info)
|
||||
{
|
||||
struct devlink *devlink = info->user_ptr[0];
|
||||
struct devlink *devlink = devlink_nl_ctx(info)->devlink;
|
||||
struct devlink_sb *devlink_sb;
|
||||
struct sk_buff *msg;
|
||||
u16 pool_index;
|
||||
@@ -415,7 +415,7 @@ static int devlink_sb_pool_set(struct devlink *devlink, unsigned int sb_index,
|
||||
|
||||
int devlink_nl_sb_pool_set_doit(struct sk_buff *skb, struct genl_info *info)
|
||||
{
|
||||
struct devlink *devlink = info->user_ptr[0];
|
||||
struct devlink *devlink = devlink_nl_ctx(info)->devlink;
|
||||
enum devlink_sb_threshold_type threshold_type;
|
||||
struct devlink_sb *devlink_sb;
|
||||
u16 pool_index;
|
||||
@@ -506,7 +506,7 @@ static int devlink_nl_sb_port_pool_fill(struct sk_buff *msg,
|
||||
int devlink_nl_sb_port_pool_get_doit(struct sk_buff *skb,
|
||||
struct genl_info *info)
|
||||
{
|
||||
struct devlink_port *devlink_port = info->user_ptr[1];
|
||||
struct devlink_port *devlink_port = devlink_nl_ctx(info)->devlink_port;
|
||||
struct devlink *devlink = devlink_port->devlink;
|
||||
struct devlink_sb *devlink_sb;
|
||||
struct sk_buff *msg;
|
||||
@@ -624,8 +624,8 @@ static int devlink_sb_port_pool_set(struct devlink_port *devlink_port,
|
||||
int devlink_nl_sb_port_pool_set_doit(struct sk_buff *skb,
|
||||
struct genl_info *info)
|
||||
{
|
||||
struct devlink_port *devlink_port = info->user_ptr[1];
|
||||
struct devlink *devlink = info->user_ptr[0];
|
||||
struct devlink_port *devlink_port = devlink_nl_ctx(info)->devlink_port;
|
||||
struct devlink *devlink = devlink_nl_ctx(info)->devlink;
|
||||
struct devlink_sb *devlink_sb;
|
||||
u16 pool_index;
|
||||
u32 threshold;
|
||||
@@ -716,7 +716,7 @@ devlink_nl_sb_tc_pool_bind_fill(struct sk_buff *msg, struct devlink *devlink,
|
||||
int devlink_nl_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_port *devlink_port = devlink_nl_ctx(info)->devlink_port;
|
||||
struct devlink *devlink = devlink_port->devlink;
|
||||
struct devlink_sb *devlink_sb;
|
||||
struct sk_buff *msg;
|
||||
@@ -864,8 +864,8 @@ static int devlink_sb_tc_pool_bind_set(struct devlink_port *devlink_port,
|
||||
int devlink_nl_sb_tc_pool_bind_set_doit(struct sk_buff *skb,
|
||||
struct genl_info *info)
|
||||
{
|
||||
struct devlink_port *devlink_port = info->user_ptr[1];
|
||||
struct devlink *devlink = info->user_ptr[0];
|
||||
struct devlink_port *devlink_port = devlink_nl_ctx(info)->devlink_port;
|
||||
struct devlink *devlink = devlink_nl_ctx(info)->devlink;
|
||||
enum devlink_sb_pool_type pool_type;
|
||||
struct devlink_sb *devlink_sb;
|
||||
u16 tc_index;
|
||||
@@ -902,7 +902,7 @@ int devlink_nl_sb_tc_pool_bind_set_doit(struct sk_buff *skb,
|
||||
|
||||
int devlink_nl_sb_occ_snapshot_doit(struct sk_buff *skb, struct genl_info *info)
|
||||
{
|
||||
struct devlink *devlink = info->user_ptr[0];
|
||||
struct devlink *devlink = devlink_nl_ctx(info)->devlink;
|
||||
const struct devlink_ops *ops = devlink->ops;
|
||||
struct devlink_sb *devlink_sb;
|
||||
|
||||
@@ -918,7 +918,7 @@ int devlink_nl_sb_occ_snapshot_doit(struct sk_buff *skb, struct genl_info *info)
|
||||
int devlink_nl_sb_occ_max_clear_doit(struct sk_buff *skb,
|
||||
struct genl_info *info)
|
||||
{
|
||||
struct devlink *devlink = info->user_ptr[0];
|
||||
struct devlink *devlink = devlink_nl_ctx(info)->devlink;
|
||||
const struct devlink_ops *ops = devlink->ops;
|
||||
struct devlink_sb *devlink_sb;
|
||||
|
||||
|
||||
@@ -302,7 +302,7 @@ static int devlink_nl_trap_fill(struct sk_buff *msg, struct devlink *devlink,
|
||||
int devlink_nl_trap_get_doit(struct sk_buff *skb, struct genl_info *info)
|
||||
{
|
||||
struct netlink_ext_ack *extack = info->extack;
|
||||
struct devlink *devlink = info->user_ptr[0];
|
||||
struct devlink *devlink = devlink_nl_ctx(info)->devlink;
|
||||
struct devlink_trap_item *trap_item;
|
||||
struct sk_buff *msg;
|
||||
int err;
|
||||
@@ -412,7 +412,7 @@ static int devlink_trap_action_set(struct devlink *devlink,
|
||||
int devlink_nl_trap_set_doit(struct sk_buff *skb, struct genl_info *info)
|
||||
{
|
||||
struct netlink_ext_ack *extack = info->extack;
|
||||
struct devlink *devlink = info->user_ptr[0];
|
||||
struct devlink *devlink = devlink_nl_ctx(info)->devlink;
|
||||
struct devlink_trap_item *trap_item;
|
||||
|
||||
if (list_empty(&devlink->trap_list))
|
||||
@@ -511,7 +511,7 @@ devlink_nl_trap_group_fill(struct sk_buff *msg, struct devlink *devlink,
|
||||
int devlink_nl_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];
|
||||
struct devlink *devlink = devlink_nl_ctx(info)->devlink;
|
||||
struct devlink_trap_group_item *group_item;
|
||||
struct sk_buff *msg;
|
||||
int err;
|
||||
@@ -682,7 +682,7 @@ static int devlink_trap_group_set(struct devlink *devlink,
|
||||
int devlink_nl_trap_group_set_doit(struct sk_buff *skb, struct genl_info *info)
|
||||
{
|
||||
struct netlink_ext_ack *extack = info->extack;
|
||||
struct devlink *devlink = info->user_ptr[0];
|
||||
struct devlink *devlink = devlink_nl_ctx(info)->devlink;
|
||||
struct devlink_trap_group_item *group_item;
|
||||
bool modified = false;
|
||||
int err;
|
||||
@@ -804,7 +804,7 @@ int devlink_nl_trap_policer_get_doit(struct sk_buff *skb,
|
||||
{
|
||||
struct devlink_trap_policer_item *policer_item;
|
||||
struct netlink_ext_ack *extack = info->extack;
|
||||
struct devlink *devlink = info->user_ptr[0];
|
||||
struct devlink *devlink = devlink_nl_ctx(info)->devlink;
|
||||
struct sk_buff *msg;
|
||||
int err;
|
||||
|
||||
@@ -924,7 +924,7 @@ int devlink_nl_trap_policer_set_doit(struct sk_buff *skb,
|
||||
{
|
||||
struct devlink_trap_policer_item *policer_item;
|
||||
struct netlink_ext_ack *extack = info->extack;
|
||||
struct devlink *devlink = info->user_ptr[0];
|
||||
struct devlink *devlink = devlink_nl_ctx(info)->devlink;
|
||||
|
||||
if (list_empty(&devlink->trap_policer_list))
|
||||
return -EOPNOTSUPP;
|
||||
|
||||
Reference in New Issue
Block a user