Commit 3015f822 authored by Jakub Kicinski's avatar Jakub Kicinski

devlink: use an explicit structure for dump context

Create a dump context structure instead of using cb->args
as an unsigned long array. This is a pure conversion which
is intended to be as much of a noop as possible.
Subsequent changes will use this to simplify the code.

The two non-trivial parts are:
 - devlink_nl_cmd_health_reporter_dump_get_dumpit() checks args[0]
   to see if devlink_fmsg_dumpit() has already been called (whether
   this is the first msg), but doesn't use the exact value, so we
   can drop the local variable there already
 - devlink_nl_cmd_region_read_dumpit() uses args[0] for address
   but we'll use args[1] now, shouldn't matter
Reviewed-by: default avatarJacob Keller <jacob.e.keller@intel.com>
Reviewed-by: default avatarJiri Pirko <jiri@nvidia.com>
Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 2c7bc10d
...@@ -107,6 +107,21 @@ enum devlink_multicast_groups { ...@@ -107,6 +107,21 @@ enum devlink_multicast_groups {
DEVLINK_MCGRP_CONFIG, DEVLINK_MCGRP_CONFIG,
}; };
/* state held across netlink dumps */
struct devlink_nl_dump_state {
int idx;
union {
/* DEVLINK_CMD_REGION_READ */
struct {
u64 start_offset;
};
/* DEVLINK_CMD_HEALTH_REPORTER_DUMP_GET */
struct {
u64 dump_ts;
};
};
};
extern const struct genl_small_ops devlink_nl_ops[56]; extern const struct genl_small_ops devlink_nl_ops[56];
struct devlink *devlink_get_from_attrs(struct net *net, struct nlattr **attrs); struct devlink *devlink_get_from_attrs(struct net *net, struct nlattr **attrs);
...@@ -114,6 +129,14 @@ struct devlink *devlink_get_from_attrs(struct net *net, struct nlattr **attrs); ...@@ -114,6 +129,14 @@ struct devlink *devlink_get_from_attrs(struct net *net, struct nlattr **attrs);
void devlink_notify_unregister(struct devlink *devlink); void devlink_notify_unregister(struct devlink *devlink);
void devlink_notify_register(struct devlink *devlink); void devlink_notify_register(struct devlink *devlink);
static inline struct devlink_nl_dump_state *
devlink_dump_state(struct netlink_callback *cb)
{
NL_ASSET_DUMP_CTX_FITS(struct devlink_nl_dump_state);
return (struct devlink_nl_dump_state *)cb->ctx;
}
/* Ports */ /* Ports */
int devlink_port_netdevice_event(struct notifier_block *nb, int devlink_port_netdevice_event(struct notifier_block *nb,
unsigned long event, void *ptr); unsigned long event, void *ptr);
......
This diff is collapsed.
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