netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jacob Keller <jacob.e.keller@intel.com>
To: netdev@vger.kernel.org
Cc: valex@mellanox.com, jiri@resnulli.us,
	Jacob Keller <jacob.e.keller@intel.com>
Subject: [PATCH v2 1/1] devlink: add support for DEVLINK_CMD_REGION_TRIGGER
Date: Thu,  9 Jan 2020 11:33:09 -0800	[thread overview]
Message-ID: <20200109193311.1352330-3-jacob.e.keller@intel.com> (raw)
In-Reply-To: <20200109193311.1352330-1-jacob.e.keller@intel.com>

Add support for the devlink command to trigger a snapshot if the region
supports it.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
---
 devlink/devlink.c            | 20 ++++++++++++++++++++
 include/uapi/linux/devlink.h |  2 ++
 2 files changed, 22 insertions(+)

diff --git a/devlink/devlink.c b/devlink/devlink.c
index 95f05a0b..3a473531 100644
--- a/devlink/devlink.c
+++ b/devlink/devlink.c
@@ -4200,6 +4200,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_TRIGGER:
 		return "region";
 	case DEVLINK_CMD_FLASH_UPDATE:
 	case DEVLINK_CMD_FLASH_UPDATE_END:
@@ -6362,12 +6363,28 @@ static int cmd_region_read(struct dl *dl)
 	return err;
 }
 
+static int cmd_region_trigger(struct dl *dl)
+{
+	struct nlmsghdr *nlh;
+	int err;
+
+	nlh = mnlg_msg_prepare(dl->nlg, DEVLINK_CMD_REGION_TRIGGER,
+			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 trigger DEV/REGION\n");
 }
 
 static int cmd_region(struct dl *dl)
@@ -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, "trigger")) {
+		dl_arg_inc(dl);
+		return cmd_region_trigger(dl);
 	}
 	pr_err("Command \"%s\" not found\n", dl_argv(dl));
 	return -ENOENT;
diff --git a/include/uapi/linux/devlink.h b/include/uapi/linux/devlink.h
index 3f82dedd..37348f84 100644
--- a/include/uapi/linux/devlink.h
+++ b/include/uapi/linux/devlink.h
@@ -117,6 +117,8 @@ enum devlink_command {
 	DEVLINK_CMD_TRAP_GROUP_NEW,
 	DEVLINK_CMD_TRAP_GROUP_DEL,
 
+	DEVLINK_CMD_REGION_TRIGGER_SNAPSHOT,
+
 	/* add new commands above here */
 	__DEVLINK_CMD_MAX,
 	DEVLINK_CMD_MAX = __DEVLINK_CMD_MAX - 1
-- 
2.21.0


  parent reply	other threads:[~2020-01-09 19:33 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-09 19:33 [PATCH v2 0/3] devlink region trigger support Jacob Keller
2020-01-09 19:33 ` [PATCH v2 1/3] devlink: add callback to trigger region snapshots Jacob Keller
2020-01-09 19:33 ` Jacob Keller [this message]
2020-01-09 19:33 ` [PATCH v2 2/3] devlink: introduce command to trigger region snapshot Jacob Keller
2020-01-09 19:33 ` [PATCH v2 3/3] netdevsim: support triggering snapshot through devlink Jacob Keller
2020-01-09 20:13 ` [PATCH v2 0/3] devlink region trigger support Jacob Keller
2020-01-10  4:10 ` Yunsheng Lin
2020-01-10 17:52   ` Jacob Keller
2020-01-11  1:51     ` Yunsheng Lin
2020-01-12 20:45       ` Jakub Kicinski
2020-01-12 21:18         ` Alex Vesker
2020-01-13  1:39           ` Yunsheng Lin
2020-01-13 11:34             ` Jakub Kicinski
2020-01-13 18:16               ` Jacob Keller
2020-01-13 18:33                 ` Jiri Pirko
2020-01-13 16:58       ` Jiri Pirko
2020-01-13 18:22         ` Jacob Keller
2020-01-13 18:33           ` Jiri Pirko
2020-01-14  8:33           ` Yunsheng Lin
2020-01-14 20:04             ` Jacob Keller
2020-01-15  8:36               ` Yunsheng Lin
2020-01-10  9:40 ` Jiri Pirko
2020-01-10 17:54   ` Jacob Keller
2020-01-10 18:47     ` Jakub Kicinski
2020-01-10 18:57       ` Jacob Keller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200109193311.1352330-3-jacob.e.keller@intel.com \
    --to=jacob.e.keller@intel.com \
    --cc=jiri@resnulli.us \
    --cc=netdev@vger.kernel.org \
    --cc=valex@mellanox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).