[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200130225913.1671982-18-jacob.e.keller@intel.com>
Date: Thu, 30 Jan 2020 14:59:12 -0800
From: Jacob Keller <jacob.e.keller@...el.com>
To: netdev@...r.kernel.org
Cc: jiri@...nulli.us, valex@...lanox.com, linyunsheng@...wei.com,
lihong.yang@...el.com, Jacob Keller <jacob.e.keller@...el.com>
Subject: [RFC PATCH 2/3] devlink: add support for DEVLINK_CMD_REGION_TAKE_SNAPSHOT
Add support to request an immediate snapshot of a devlink region. This
enables the devlink program to obtain a snapshot of the region if the
driver for the region supports immediate snapshots.
Signed-off-by: Jacob Keller <jacob.e.keller@...el.com>
---
devlink/devlink.c | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/devlink/devlink.c b/devlink/devlink.c
index 73ce98654fd8..ac1ad8aa0769 100644
--- a/devlink/devlink.c
+++ b/devlink/devlink.c
@@ -4163,6 +4163,7 @@ static const char *cmd_obj(uint8_t cmd)
case DEVLINK_CMD_REGION_SET:
case DEVLINK_CMD_REGION_NEW:
case DEVLINK_CMD_REGION_DEL:
+ case DEVLINK_CMD_REGION_TAKE_SNAPSHOT:
return "region";
case DEVLINK_CMD_FLASH_UPDATE:
case DEVLINK_CMD_FLASH_UPDATE_END:
@@ -6345,12 +6346,28 @@ static int cmd_region_read(struct dl *dl)
return err;
}
+static int cmd_region_take_snapshot(struct dl *dl)
+{
+ struct nlmsghdr *nlh;
+ int err;
+
+ nlh = mnlg_msg_prepare(dl->nlg, DEVLINK_CMD_REGION_TAKE_SNAPSHOT,
+ NLM_F_REQUEST | NLM_F_ACK);
+
+ err = dl_argv_parse_put(nlh, dl, DL_OPT_HANDLE_REGION, 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 dump DEV/REGION [ snapshot SNAPSHOT_ID ]\n");
pr_err(" devlink region read DEV/REGION [ snapshot SNAPSHOT_ID ] address ADDRESS length LENGTH\n");
+ pr_err(" devlink region snapshot DEV/REGION\n");
}
static int cmd_region(struct dl *dl)
@@ -6372,6 +6389,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, "snapshot")) {
+ dl_arg_inc(dl);
+ return cmd_region_take_snapshot(dl);
}
pr_err("Command \"%s\" not found\n", dl_argv(dl));
return -ENOENT;
--
2.25.0.rc1
Powered by blists - more mailing lists