netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [iproute2 v3] devlink: add support for DEVLINK_CMD_REGION_NEW
@ 2020-04-28 20:43 Jacob Keller
  2020-04-29  0:17 ` Jakub Kicinski
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Jacob Keller @ 2020-04-28 20:43 UTC (permalink / raw)
  To: netdev; +Cc: Jakub Kicinski, Jacob Keller

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>
---
 devlink/devlink.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/devlink/devlink.c b/devlink/devlink.c
index 67e6e64181f9..827ee74a2015 100644
--- a/devlink/devlink.c
+++ b/devlink/devlink.c
@@ -6362,10 +6362,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");
 }
@@ -6389,6 +6406,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;
-- 
2.25.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [iproute2 v3] devlink: add support for DEVLINK_CMD_REGION_NEW
  2020-04-28 20:43 [iproute2 v3] devlink: add support for DEVLINK_CMD_REGION_NEW Jacob Keller
@ 2020-04-29  0:17 ` Jakub Kicinski
  2020-04-29  6:44 ` Jiri Pirko
  2020-04-30  5:33 ` Stephen Hemminger
  2 siblings, 0 replies; 4+ messages in thread
From: Jakub Kicinski @ 2020-04-29  0:17 UTC (permalink / raw)
  To: Jacob Keller; +Cc: netdev

On Tue, 28 Apr 2020 13:43:24 -0700 Jacob Keller wrote:
> 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-and-tested-by: Jakub Kicinski <kuba@kernel.org>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [iproute2 v3] devlink: add support for DEVLINK_CMD_REGION_NEW
  2020-04-28 20:43 [iproute2 v3] devlink: add support for DEVLINK_CMD_REGION_NEW Jacob Keller
  2020-04-29  0:17 ` Jakub Kicinski
@ 2020-04-29  6:44 ` Jiri Pirko
  2020-04-30  5:33 ` Stephen Hemminger
  2 siblings, 0 replies; 4+ messages in thread
From: Jiri Pirko @ 2020-04-29  6:44 UTC (permalink / raw)
  To: Jacob Keller; +Cc: netdev, Jakub Kicinski

Tue, Apr 28, 2020 at 10:43:24PM CEST, jacob.e.keller@intel.com wrote:
>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>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [iproute2 v3] devlink: add support for DEVLINK_CMD_REGION_NEW
  2020-04-28 20:43 [iproute2 v3] devlink: add support for DEVLINK_CMD_REGION_NEW Jacob Keller
  2020-04-29  0:17 ` Jakub Kicinski
  2020-04-29  6:44 ` Jiri Pirko
@ 2020-04-30  5:33 ` Stephen Hemminger
  2 siblings, 0 replies; 4+ messages in thread
From: Stephen Hemminger @ 2020-04-30  5:33 UTC (permalink / raw)
  To: Jacob Keller; +Cc: netdev, Jakub Kicinski

On Tue, 28 Apr 2020 13:43:24 -0700
Jacob Keller <jacob.e.keller@intel.com> wrote:

> 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>

Looks good applied.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-04-30  5:33 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-28 20:43 [iproute2 v3] devlink: add support for DEVLINK_CMD_REGION_NEW Jacob Keller
2020-04-29  0:17 ` Jakub Kicinski
2020-04-29  6:44 ` Jiri Pirko
2020-04-30  5:33 ` Stephen Hemminger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).