devlink: add support for DEVLINK_CMD_REGION_NEW
Add support to request that a new snapshot be taken immediately for a devlink region. To avoid confusion, the desired snapshot id must be provided. Note that if a region does not support snapshots on demand, the kernel will reject the request with -EOPNOTSUP. Signed-off-by: Jacob Keller <jacob.e.keller@intel.com> Reviewed-by: Jiri Pirko <jiri@mellanox.com> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
This commit is contained in:
parent
2b93f66863
commit
7ae84fedcb
|
|
@ -6464,10 +6464,27 @@ static int cmd_region_read(struct dl *dl)
|
|||
return err;
|
||||
}
|
||||
|
||||
static int cmd_region_snapshot_new(struct dl *dl)
|
||||
{
|
||||
struct nlmsghdr *nlh;
|
||||
int err;
|
||||
|
||||
nlh = mnlg_msg_prepare(dl->nlg, DEVLINK_CMD_REGION_NEW,
|
||||
NLM_F_REQUEST | NLM_F_ACK);
|
||||
|
||||
err = dl_argv_parse_put(nlh, dl, DL_OPT_HANDLE_REGION |
|
||||
DL_OPT_REGION_SNAPSHOT_ID, 0);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
return _mnlg_socket_sndrcv(dl->nlg, nlh, NULL, NULL);
|
||||
}
|
||||
|
||||
static void cmd_region_help(void)
|
||||
{
|
||||
pr_err("Usage: devlink region show [ DEV/REGION ]\n");
|
||||
pr_err(" devlink region del DEV/REGION snapshot SNAPSHOT_ID\n");
|
||||
pr_err(" devlink region new DEV/REGION snapshot SNAPSHOT_ID\n");
|
||||
pr_err(" devlink region dump DEV/REGION [ snapshot SNAPSHOT_ID ]\n");
|
||||
pr_err(" devlink region read DEV/REGION [ snapshot SNAPSHOT_ID ] address ADDRESS length LENGTH\n");
|
||||
}
|
||||
|
|
@ -6491,6 +6508,9 @@ static int cmd_region(struct dl *dl)
|
|||
} else if (dl_argv_match(dl, "read")) {
|
||||
dl_arg_inc(dl);
|
||||
return cmd_region_read(dl);
|
||||
} else if (dl_argv_match(dl, "new")) {
|
||||
dl_arg_inc(dl);
|
||||
return cmd_region_snapshot_new(dl);
|
||||
}
|
||||
pr_err("Command \"%s\" not found\n", dl_argv(dl));
|
||||
return -ENOENT;
|
||||
|
|
|
|||
Loading…
Reference in New Issue