File 0010-nvme-cli-add-support-of-RAE.patch of Package nvme-cli.12152

From: Alexey Timofeyev <alexey.timofeyev@sk.com>
Date: Thu, 28 Jun 2018 17:33:05 +0000
Subject: [PATCH] nvme-cli: add support of RAE

Git-commit: 97ca8c0d1008aa640e848d7606e85e0828c1cf2d
References: bsc#1099018

Currently telemetry-log cannot retain content of corresponding log page as RAE is not set.
This patch adds RAE bit support into routines to retrieve log pages.

Signed-off-by: Alexey Timofeyev <alexey.timofeyev@sk.com>
---
 Documentation/nvme-get-log.1    | 26 +++++++++++++++++----
 Documentation/nvme-get-log.html | 51 +++++++++++++++++++++++++++++++++++++----
 Documentation/nvme-get-log.txt  | 16 +++++++++++++
 nvme-ioctl.c                    |  6 ++---
 nvme-ioctl.h                    |  2 +-
 nvme.c                          |  8 +++++--
 6 files changed, 94 insertions(+), 15 deletions(-)

diff --git a/Documentation/nvme-get-log.1 b/Documentation/nvme-get-log.1
index 7dc38bf..5cd47d6 100644
--- a/Documentation/nvme-get-log.1
+++ b/Documentation/nvme-get-log.1
@@ -1,13 +1,13 @@
 '\" t
 .\"     Title: nvme-get-log
-.\"    Author: [FIXME: author] [see http://docbook.sf.net/el/author]
-.\" Generator: DocBook XSL Stylesheets v1.79.1 <http://docbook.sf.net/>
-.\"      Date: 12/10/2017
+.\"    Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author]
+.\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/>
+.\"      Date: 06/28/2018
 .\"    Manual: NVMe Manual
 .\"    Source: NVMe
 .\"  Language: English
 .\"
-.TH "NVME\-GET\-LOG" "1" "12/10/2017" "NVMe" "NVMe Manual"
+.TH "NVME\-GET\-LOG" "1" "06/28/2018" "NVMe" "NVMe Manual"
 .\" -----------------------------------------------------------------
 .\" * Define some portability stuff
 .\" -----------------------------------------------------------------
@@ -37,6 +37,9 @@ nvme-get-log \- Retrieves a log page from an NVMe device
                       [\-\-aen=<aen> | \-a <aen>]
                       [\-\-namespace\-id=<nsid> | \-n <nsid>]
                       [\-\-raw\-binary | \-b]
+                      [\-\-lpo=<offset> | \-o <offset>]
+                      [\-\-lsp=<field> | \-s <field>]
+                      [\-\-rae | \-r]
 .fi
 .SH "DESCRIPTION"
 .sp
@@ -71,6 +74,21 @@ Sets the command\(cqs nsid value to the given nsid\&. Defaults to 0xffffffff if
 .RS 4
 Print the raw log buffer to stdout\&.
 .RE
+.PP
+\-o <offset>, \-\-lpo=<offset>
+.RS 4
+The log page offset specifies the location within a log page to start returning data from\&. It\(cqs Dword\-aligned and 64\-bits\&.
+.RE
+.PP
+\-s <field>, \-\-lsp=<field>
+.RS 4
+The log specified field of LID\&.
+.RE
+.PP
+\-r, \-\-rae
+.RS 4
+Retain an Asynchronous Event\&.
+.RE
 .SH "EXAMPLES"
 .sp
 .RS 4
diff --git a/Documentation/nvme-get-log.html b/Documentation/nvme-get-log.html
index b4ee9a9..0efb56b 100644
--- a/Documentation/nvme-get-log.html
+++ b/Documentation/nvme-get-log.html
@@ -1,9 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
     "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
 <head>
 <meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8" />
-<meta name="generator" content="AsciiDoc 8.6.8" />
+<meta name="generator" content="AsciiDoc 8.6.10" />
 <title>nvme-get-log(1)</title>
 <style type="text/css">
 /* Shared CSS for AsciiDoc xhtml11 and html5 backends */
@@ -94,7 +95,9 @@ ul > li > * { color: black; }
   padding: 0;
   margin: 0;
 }
-
+pre {
+  white-space: pre-wrap;
+}
 
 #author {
   color: #527bbd;
@@ -223,7 +226,7 @@ div.exampleblock > div.content {
 }
 
 div.imageblock div.content { padding-left: 0; }
-span.image img { border-style: none; }
+span.image img { border-style: none; vertical-align: text-bottom; }
 a.image:visited { color: white; }
 
 dl {
@@ -750,7 +753,10 @@ nvme-get-log(1) Manual Page
                       [--log-len=&lt;log-len&gt; | -l &lt;log-len&gt;]
                       [--aen=&lt;aen&gt; | -a &lt;aen&gt;]
                       [--namespace-id=&lt;nsid&gt; | -n &lt;nsid&gt;]
-                      [--raw-binary | -b]</pre>
+                      [--raw-binary | -b]
+                      [--lpo=&lt;offset&gt; | -o &lt;offset&gt;]
+                      [--lsp=&lt;field&gt; | -s &lt;field&gt;]
+                      [--rae | -r]</pre>
 <div class="attribution">
 </div></div>
 </div>
@@ -834,6 +840,40 @@ program to parse.</p></div>
         Print the raw log buffer to stdout.
 </p>
 </dd>
+<dt class="hdlist1">
+-o &lt;offset&gt;
+</dt>
+<dt class="hdlist1">
+--lpo=&lt;offset&gt;
+</dt>
+<dd>
+<p>
+        The log page offset specifies the location within a log page to start
+        returning data from. It&#8217;s Dword-aligned and 64-bits.
+</p>
+</dd>
+<dt class="hdlist1">
+-s &lt;field&gt;
+</dt>
+<dt class="hdlist1">
+--lsp=&lt;field&gt;
+</dt>
+<dd>
+<p>
+        The log specified field of LID.
+</p>
+</dd>
+<dt class="hdlist1">
+-r
+</dt>
+<dt class="hdlist1">
+--rae
+</dt>
+<dd>
+<p>
+        Retain an Asynchronous Event.
+</p>
+</dd>
 </dl></div>
 </div>
 </div>
@@ -877,7 +917,8 @@ Have the program return the raw log page in binary:
 <div id="footnotes"><hr /></div>
 <div id="footer">
 <div id="footer-text">
-Last updated 2017-10-20 15:09:05 MDT
+Last updated
+ 2018-06-28 16:56:55 UTC
 </div>
 </div>
 </body>
diff --git a/Documentation/nvme-get-log.txt b/Documentation/nvme-get-log.txt
index 55ba5af..301fb81 100644
--- a/Documentation/nvme-get-log.txt
+++ b/Documentation/nvme-get-log.txt
@@ -13,6 +13,9 @@ SYNOPSIS
 		      [--aen=<aen> | -a <aen>]
 		      [--namespace-id=<nsid> | -n <nsid>]
 		      [--raw-binary | -b]
+		      [--lpo=<offset> | -o <offset>]
+		      [--lsp=<field> | -s <field>]
+		      [--rae | -r]
 
 DESCRIPTION
 -----------
@@ -56,6 +59,19 @@ OPTIONS
 --raw-binary::
 	Print the raw log buffer to stdout.
 
+-o <offset>::
+--lpo=<offset>::
+	The log page offset specifies the location within a log page to start
+	returning data from. It's Dword-aligned and 64-bits.
+
+-s <field>::
+--lsp=<field>::
+	The log specified field of LID.
+
+-r::
+--rae::
+	Retain an Asynchronous Event.
+
 EXAMPLES
 --------
 * Get 512 bytes from log page 2
diff --git a/nvme-ioctl.c b/nvme-ioctl.c
index 4166e23..780ee50 100644
--- a/nvme-ioctl.c
+++ b/nvme-ioctl.c
@@ -382,7 +382,7 @@ int nvme_identify_ns_descs(int fd, __u32 nsid, void *data)
 }
 
 int nvme_get_log13(int fd, __u32 nsid, __u8 log_id, __u8 lsp, __u64 lpo,
-                 __u32 data_len, void *data)
+                 __u16 lsi, bool rae, __u32 data_len, void *data)
 {
 	struct nvme_admin_cmd cmd = {
 		.opcode		= nvme_admin_get_log_page,
@@ -393,7 +393,7 @@ int nvme_get_log13(int fd, __u32 nsid, __u8 log_id, __u8 lsp, __u64 lpo,
 	__u32 numd = (data_len >> 2) - 1;
 	__u16 numdu = numd >> 16, numdl = numd & 0xffff;
 
-	cmd.cdw10 = log_id | (numdl << 16);
+	cmd.cdw10 = log_id | (numdl << 16) | (rae ? 1 << 15 : 0);
 	if (lsp)
                 cmd.cdw10 |= lsp << 8;
 
@@ -408,7 +408,7 @@ int nvme_get_log13(int fd, __u32 nsid, __u8 log_id, __u8 lsp, __u64 lpo,
 int nvme_get_log(int fd, __u32 nsid, __u8 log_id, __u32 data_len, void *data)
 {
 	return nvme_get_log13(fd, nsid, log_id, NVME_NO_LOG_LSP, NVME_NO_LOG_LPO,
-			      data_len, data);
+			      0, 0, data_len, data);
 }
 
 int nvme_fw_log(int fd, struct nvme_firmware_log_page *fw_log)
diff --git a/nvme-ioctl.h b/nvme-ioctl.h
index 3507e8a..1f804c2 100644
--- a/nvme-ioctl.h
+++ b/nvme-ioctl.h
@@ -79,7 +79,7 @@ int nvme_identify_ns_list(int fd, __u32 nsid, bool all, void *data);
 int nvme_identify_ctrl_list(int fd, __u32 nsid, __u16 cntid, void *data);
 int nvme_identify_ns_descs(int fd, __u32 nsid, void *data);
 int nvme_get_log13(int fd, __u32 nsid, __u8 log_id, __u8 lsp, __u64 lpo,
-		   __u32 data_len, void *data);
+		   __u16 group_id, bool rae, __u32 data_len, void *data);
 int nvme_get_log(int fd, __u32 nsid, __u8 log_id, __u32 data_len, void *data);
 
 
diff --git a/nvme.c b/nvme.c
index 6a40ee3..274871a 100644
--- a/nvme.c
+++ b/nvme.c
@@ -398,6 +398,7 @@ static int get_log(int argc, char **argv, struct command *cmd, struct plugin *pl
 	const char *aen = "result of the aen, use to override log id";
 	const char *lsp = "log specific field";
 	const char *lpo = "log page offset specifies the location within a log page from where to start returning data";
+	const char *rae = "retain an asynchronous event";
 	const char *raw_binary = "output in raw format";
 	int err, fd;
 
@@ -408,6 +409,7 @@ static int get_log(int argc, char **argv, struct command *cmd, struct plugin *pl
 		__u32 aen;
 		__u64 lpo;
 		__u8  lsp;
+		int   rae;
 		int   raw_binary;
 	};
 
@@ -417,6 +419,7 @@ static int get_log(int argc, char **argv, struct command *cmd, struct plugin *pl
 		.log_len      = 0,
 		.lpo          = NVME_NO_LOG_LPO,
 		.lsp          = NVME_NO_LOG_LSP,
+		.rae          = 0,
 	};
 
 	const struct argconfig_commandline_options command_line_options[] = {
@@ -427,6 +430,7 @@ static int get_log(int argc, char **argv, struct command *cmd, struct plugin *pl
 		{"raw-binary",   'b', "",    CFG_NONE,     &cfg.raw_binary,   no_argument,       raw_binary},
 		{"lpo",          'o', "NUM", CFG_LONG,     &cfg.lpo,          required_argument, lpo},
 		{"lsp",          's', "NUM", CFG_BYTE,     &cfg.lsp,          required_argument, lsp},
+		{"rae",          'r', "",    CFG_NONE,     &cfg.rae,          no_argument,       rae},
 		{NULL}
 	};
 
@@ -459,7 +463,7 @@ static int get_log(int argc, char **argv, struct command *cmd, struct plugin *pl
 		}
 
 		err = nvme_get_log13(fd, cfg.namespace_id, cfg.log_id,
-				     cfg.lsp, cfg.lpo,
+				     cfg.lsp, cfg.lpo, 0, cfg.rae,
 				     cfg.log_len, log);
 		if (!err) {
 			if (!cfg.raw_binary) {
@@ -2283,7 +2287,7 @@ static int set_feature(int argc, char **argv, struct command *cmd, struct plugin
 		{"value",        'v', "NUM",  CFG_POSITIVE, &cfg.value,        required_argument, value},
 		{"data-len",     'l', "NUM",  CFG_POSITIVE, &cfg.data_len,     required_argument, data_len},
 		{"data",         'd', "FILE", CFG_STRING,   &cfg.file,         required_argument, data},
-		{"save",         's', "",     CFG_NONE,     &cfg.save,         no_argument, save},
+		{"save",         's', "",     CFG_NONE,     &cfg.save,         no_argument,       save},
 		{NULL}
 	};
 
-- 
2.13.7
openSUSE Build Service is sponsored by