static int devlink_nl_cmd_rate_get_dumpit(struct sk_buff *msg,
struct netlink_callback *cb)
{
+ struct devlink_nl_dump_state *state = devlink_dump_state(cb);
struct devlink_rate *devlink_rate;
struct devlink *devlink;
- int start = cb->args[0];
+ int start = state->idx;
unsigned long index;
int idx = 0;
int err = 0;
if (err != -EMSGSIZE)
return err;
- cb->args[0] = idx;
+ state->idx = idx;
return msg->len;
}
static int devlink_nl_cmd_get_dumpit(struct sk_buff *msg,
struct netlink_callback *cb)
{
+ struct devlink_nl_dump_state *state = devlink_dump_state(cb);
struct devlink *devlink;
- int start = cb->args[0];
+ int start = state->idx;
unsigned long index;
int idx = 0;
int err;
idx++;
}
out:
- cb->args[0] = idx;
+ state->idx = idx;
return msg->len;
}
static int devlink_nl_cmd_port_get_dumpit(struct sk_buff *msg,
struct netlink_callback *cb)
{
+ struct devlink_nl_dump_state *state = devlink_dump_state(cb);
struct devlink *devlink;
struct devlink_port *devlink_port;
unsigned long index, port_index;
- int start = cb->args[0];
+ int start = state->idx;
int idx = 0;
int err;
devlink_put(devlink);
}
out:
- cb->args[0] = idx;
+ state->idx = idx;
return msg->len;
}
static int devlink_nl_cmd_linecard_get_dumpit(struct sk_buff *msg,
struct netlink_callback *cb)
{
+ struct devlink_nl_dump_state *state = devlink_dump_state(cb);
struct devlink_linecard *linecard;
struct devlink *devlink;
- int start = cb->args[0];
+ int start = state->idx;
unsigned long index;
int idx = 0;
int err;
devlink_put(devlink);
}
out:
- cb->args[0] = idx;
+ state->idx = idx;
return msg->len;
}
static int devlink_nl_cmd_sb_get_dumpit(struct sk_buff *msg,
struct netlink_callback *cb)
{
+ struct devlink_nl_dump_state *state = devlink_dump_state(cb);
struct devlink *devlink;
struct devlink_sb *devlink_sb;
- int start = cb->args[0];
+ int start = state->idx;
unsigned long index;
int idx = 0;
int err;
devlink_put(devlink);
}
out:
- cb->args[0] = idx;
+ state->idx = idx;
return msg->len;
}
static int devlink_nl_cmd_sb_pool_get_dumpit(struct sk_buff *msg,
struct netlink_callback *cb)
{
+ struct devlink_nl_dump_state *state = devlink_dump_state(cb);
struct devlink *devlink;
struct devlink_sb *devlink_sb;
- int start = cb->args[0];
+ int start = state->idx;
unsigned long index;
int idx = 0;
int err = 0;
if (err != -EMSGSIZE)
return err;
- cb->args[0] = idx;
+ state->idx = idx;
return msg->len;
}
static int devlink_nl_cmd_sb_port_pool_get_dumpit(struct sk_buff *msg,
struct netlink_callback *cb)
{
+ struct devlink_nl_dump_state *state = devlink_dump_state(cb);
struct devlink *devlink;
struct devlink_sb *devlink_sb;
- int start = cb->args[0];
+ int start = state->idx;
unsigned long index;
int idx = 0;
int err = 0;
if (err != -EMSGSIZE)
return err;
- cb->args[0] = idx;
+ state->idx = idx;
return msg->len;
}
devlink_nl_cmd_sb_tc_pool_bind_get_dumpit(struct sk_buff *msg,
struct netlink_callback *cb)
{
+ struct devlink_nl_dump_state *state = devlink_dump_state(cb);
struct devlink *devlink;
struct devlink_sb *devlink_sb;
- int start = cb->args[0];
+ int start = state->idx;
unsigned long index;
int idx = 0;
int err = 0;
if (err != -EMSGSIZE)
return err;
- cb->args[0] = idx;
+ state->idx = idx;
return msg->len;
}
static int devlink_nl_cmd_selftests_get_dumpit(struct sk_buff *msg,
struct netlink_callback *cb)
{
+ struct devlink_nl_dump_state *state = devlink_dump_state(cb);
struct devlink *devlink;
- int start = cb->args[0];
+ int start = state->idx;
unsigned long index;
int idx = 0;
int err = 0;
if (err != -EMSGSIZE)
return err;
- cb->args[0] = idx;
+ state->idx = idx;
return msg->len;
}
static int devlink_nl_cmd_param_get_dumpit(struct sk_buff *msg,
struct netlink_callback *cb)
{
+ struct devlink_nl_dump_state *state = devlink_dump_state(cb);
struct devlink_param_item *param_item;
struct devlink *devlink;
- int start = cb->args[0];
+ int start = state->idx;
unsigned long index;
int idx = 0;
int err = 0;
if (err != -EMSGSIZE)
return err;
- cb->args[0] = idx;
+ state->idx = idx;
return msg->len;
}
static int devlink_nl_cmd_region_get_dumpit(struct sk_buff *msg,
struct netlink_callback *cb)
{
+ struct devlink_nl_dump_state *state = devlink_dump_state(cb);
struct devlink *devlink;
- int start = cb->args[0];
+ int start = state->idx;
unsigned long index;
int idx = 0;
int err = 0;
goto out;
}
out:
- cb->args[0] = idx;
+ state->idx = idx;
return msg->len;
}
struct netlink_callback *cb)
{
const struct genl_dumpit_info *info = genl_dumpit_info(cb);
+ struct devlink_nl_dump_state *state = devlink_dump_state(cb);
struct nlattr *chunks_attr, *region_attr, *snapshot_attr;
u64 ret_offset, start_offset, end_offset = U64_MAX;
struct nlattr **attrs = info->attrs;
void *hdr;
int err;
- start_offset = *((u64 *)&cb->args[0]);
+ start_offset = state->start_offset;
devlink = devlink_get_from_attrs(sock_net(cb->skb->sk), attrs);
if (IS_ERR(devlink))
goto nla_put_failure;
}
- *((u64 *)&cb->args[0]) = ret_offset;
+ state->start_offset = ret_offset;
nla_nest_end(skb, chunks_attr);
genlmsg_end(skb, hdr);
static int devlink_nl_cmd_info_get_dumpit(struct sk_buff *msg,
struct netlink_callback *cb)
{
+ struct devlink_nl_dump_state *state = devlink_dump_state(cb);
struct devlink *devlink;
- int start = cb->args[0];
+ int start = state->idx;
unsigned long index;
int idx = 0;
int err = 0;
if (err != -EMSGSIZE)
return err;
- cb->args[0] = idx;
+ state->idx = idx;
return msg->len;
}
struct netlink_callback *cb,
enum devlink_command cmd)
{
- int index = cb->args[0];
+ struct devlink_nl_dump_state *state = devlink_dump_state(cb);
+ int index = state->idx;
int tmp_index = index;
void *hdr;
int err;
if ((err && err != -EMSGSIZE) || tmp_index == index)
goto nla_put_failure;
- cb->args[0] = index;
+ state->idx = index;
genlmsg_end(skb, hdr);
return skb->len;
devlink_nl_cmd_health_reporter_get_dumpit(struct sk_buff *msg,
struct netlink_callback *cb)
{
+ struct devlink_nl_dump_state *state = devlink_dump_state(cb);
struct devlink_health_reporter *reporter;
unsigned long index, port_index;
struct devlink_port *port;
struct devlink *devlink;
- int start = cb->args[0];
+ int start = state->idx;
int idx = 0;
int err;
devlink_put(devlink);
}
out:
- cb->args[0] = idx;
+ state->idx = idx;
return msg->len;
}
devlink_nl_cmd_health_reporter_dump_get_dumpit(struct sk_buff *skb,
struct netlink_callback *cb)
{
+ struct devlink_nl_dump_state *state = devlink_dump_state(cb);
struct devlink_health_reporter *reporter;
- u64 start = cb->args[0];
int err;
reporter = devlink_health_reporter_get_from_cb(cb);
goto out;
}
mutex_lock(&reporter->dump_lock);
- if (!start) {
+ if (!state->idx) {
err = devlink_health_do_dump(reporter, NULL, cb->extack);
if (err)
goto unlock;
- cb->args[1] = reporter->dump_ts;
+ state->dump_ts = reporter->dump_ts;
}
- if (!reporter->dump_fmsg || cb->args[1] != reporter->dump_ts) {
+ if (!reporter->dump_fmsg || state->dump_ts != reporter->dump_ts) {
NL_SET_ERR_MSG_MOD(cb->extack, "Dump trampled, please retry");
err = -EAGAIN;
goto unlock;
static int devlink_nl_cmd_trap_get_dumpit(struct sk_buff *msg,
struct netlink_callback *cb)
{
+ struct devlink_nl_dump_state *state = devlink_dump_state(cb);
struct devlink_trap_item *trap_item;
struct devlink *devlink;
- int start = cb->args[0];
+ int start = state->idx;
unsigned long index;
int idx = 0;
int err;
devlink_put(devlink);
}
out:
- cb->args[0] = idx;
+ state->idx = idx;
return msg->len;
}
static int devlink_nl_cmd_trap_group_get_dumpit(struct sk_buff *msg,
struct netlink_callback *cb)
{
+ struct devlink_nl_dump_state *state = devlink_dump_state(cb);
enum devlink_command cmd = DEVLINK_CMD_TRAP_GROUP_NEW;
struct devlink_trap_group_item *group_item;
u32 portid = NETLINK_CB(cb->skb).portid;
struct devlink *devlink;
- int start = cb->args[0];
+ int start = state->idx;
unsigned long index;
int idx = 0;
int err;
devlink_put(devlink);
}
out:
- cb->args[0] = idx;
+ state->idx = idx;
return msg->len;
}
static int devlink_nl_cmd_trap_policer_get_dumpit(struct sk_buff *msg,
struct netlink_callback *cb)
{
+ struct devlink_nl_dump_state *state = devlink_dump_state(cb);
enum devlink_command cmd = DEVLINK_CMD_TRAP_POLICER_NEW;
struct devlink_trap_policer_item *policer_item;
u32 portid = NETLINK_CB(cb->skb).portid;
struct devlink *devlink;
- int start = cb->args[0];
+ int start = state->idx;
unsigned long index;
int idx = 0;
int err;
devlink_put(devlink);
}
out:
- cb->args[0] = idx;
+ state->idx = idx;
return msg->len;
}