]> www.infradead.org Git - users/sagi/nvme-cli.git/commitdiff
nvme: add CDW2 and CDW3 support for Write Zeroes and Verify Command
authorGollu Appalanaidu <anaidu.gollu@samsung.com>
Thu, 8 Jul 2021 16:25:22 +0000 (21:55 +0530)
committerDaniel Wagner <dwagner@suse.de>
Mon, 15 Nov 2021 11:06:28 +0000 (12:06 +0100)
Added support for the Variable Sized Expected Logical Block Storage Tag(ELBST)
and Expected Logical Block Reference Tag (ELBRT), CDW2 and CDW3 (00:47) bits
for NVM commands Write Zeroes and Verify commands.

Signed-off-by: Gollu Appalanaidu <anaidu.gollu@samsung.com>
[dwagner: removed nvme-ioctl.c changes, these are part of libnvme]
Signed-off-by: Daniel Wagner <dwagner@suse.de>
Documentation/nvme-verify.1
Documentation/nvme-verify.html
Documentation/nvme-verify.txt
Documentation/nvme-write-zeroes.1
Documentation/nvme-write-zeroes.html
Documentation/nvme-write-zeroes.txt
nvme.c

index 941262131ccef5b71043bf9e2ed5aaea498101e3..c6ddd89d20a8bc1a0ba6785e1c5c20d30ce9faa8 100644 (file)
@@ -2,12 +2,12 @@
 .\"     Title: nvme-verify
 .\"    Author: [FIXME: author] [see http://docbook.sf.net/el/author]
 .\" Generator: DocBook XSL Stylesheets v1.79.1 <http://docbook.sf.net/>
-.\"      Date: 07/07/2021
+.\"      Date: 07/08/2021
 .\"    Manual: NVMe Manual
 .\"    Source: NVMe
 .\"  Language: English
 .\"
-.TH "NVME\-VERIFY" "1" "07/07/2021" "NVMe" "NVMe Manual"
+.TH "NVME\-VERIFY" "1" "07/08/2021" "NVMe" "NVMe Manual"
 .\" -----------------------------------------------------------------
 .\" * Define some portability stuff
 .\" -----------------------------------------------------------------
@@ -41,6 +41,7 @@ nvme-verify \- Send an NVMe Verify command, return results
             [\-\-ref\-tag=<reftag> | \-r <reftag>]
             [\-\-app\-tag\-mask=<appmask> | \-m <appmask>]
             [\-\-app\-tag=<apptag> | \-a <apptag>]
+            [\-\-storage\-tag<storage\-tag> | \-S <storage\-tag>]
 .fi
 .SH "DESCRIPTION"
 .sp
@@ -131,6 +132,11 @@ Optional application tag mask when used with protection information\&.
 .RS 4
 Optional application tag when used with protection information\&.
 .RE
+.PP
+\-\-storage\-tag=<storage\-tag>, \-S <storage\-tag>
+.RS 4
+Variable Sized Expected Logical Block Storage Tag(ELBST) and Expected Logical Block Reference Tag (ELBRT), CDW2 and CDW3 (00:47) bits\&.
+.RE
 .SH "EXAMPLES"
 .sp
 No examples yet\&.
index 53feb4ba33f1f6fbee429e3e900d0276205a5009..787541dfd1e30e17a3e940bf80a588204e8d74f8 100644 (file)
@@ -757,7 +757,8 @@ nvme-verify(1) Manual Page
             [--prinfo=&lt;prinfo&gt; | -p &lt;prinfo&gt;]\r
             [--ref-tag=&lt;reftag&gt; | -r &lt;reftag&gt;]\r
             [--app-tag-mask=&lt;appmask&gt; | -m &lt;appmask&gt;]\r
-            [--app-tag=&lt;apptag&gt; | -a &lt;apptag&gt;]</pre>\r
+            [--app-tag=&lt;apptag&gt; | -a &lt;apptag&gt;]\r
+            [--storage-tag&lt;storage-tag&gt; | -S &lt;storage-tag&gt;]</pre>\r
 <div class="attribution">\r
 </div></div>\r
 </div>\r
@@ -909,6 +910,18 @@ metadata is passes.</p></td>
         Optional application tag when used with protection information.\r
 </p>\r
 </dd>\r
+<dt class="hdlist1">\r
+--storage-tag=&lt;storage-tag&gt;\r
+</dt>\r
+<dt class="hdlist1">\r
+-S &lt;storage-tag&gt;\r
+</dt>\r
+<dd>\r
+<p>\r
+        Variable Sized Expected Logical Block Storage Tag(ELBST) and Expected Logical\r
+        Block Reference Tag (ELBRT), CDW2 and CDW3 (00:47) bits.\r
+</p>\r
+</dd>\r
 </dl></div>\r
 </div>\r
 </div>\r
@@ -929,7 +942,7 @@ metadata is passes.</p></td>
 <div id="footer">\r
 <div id="footer-text">\r
 Last updated\r
- 2021-07-07 01:41:43 IST\r
+ 2021-07-07 23:04:31 IST\r
 </div>\r
 </div>\r
 </body>\r
index 80d69430a6dac3ba9916a366f135519c7bb37326..8fa1ce075898edb04839c453ea13ef474f277000 100644 (file)
@@ -17,6 +17,7 @@ SYNOPSIS
             [--ref-tag=<reftag> | -r <reftag>]
             [--app-tag-mask=<appmask> | -m <appmask>]
             [--app-tag=<apptag> | -a <apptag>]
+            [--storage-tag<storage-tag> | -S <storage-tag>]
 
 DESCRIPTION
 -----------
@@ -73,6 +74,11 @@ metadata is passes.
 -a <apptag>::
        Optional application tag when used with protection information.
 
+--storage-tag=<storage-tag>::
+-S <storage-tag>::
+       Variable Sized Expected Logical Block Storage Tag(ELBST) and Expected Logical
+       Block Reference Tag (ELBRT), CDW2 and CDW3 (00:47) bits.
+
 EXAMPLES
 --------
 No examples yet.
index d32e3cab99fa2f96a4f6234d968d40e5c90df41e..de99f12fdc6aec554921d4ea7c2c59b42fdbf436 100644 (file)
@@ -1,13 +1,13 @@
 '\" t
 .\"     Title: nvme-zeroes
-.\"    Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author]
-.\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/>
-.\"      Date: 10/20/2020
+.\"    Author: [FIXME: author] [see http://docbook.sf.net/el/author]
+.\" Generator: DocBook XSL Stylesheets v1.79.1 <http://docbook.sf.net/>
+.\"      Date: 07/08/2021
 .\"    Manual: NVMe Manual
 .\"    Source: NVMe
 .\"  Language: English
 .\"
-.TH "NVME\-ZEROES" "1" "10/20/2020" "NVMe" "NVMe Manual"
+.TH "NVME\-ZEROES" "1" "07/08/2021" "NVMe" "NVMe Manual"
 .\" -----------------------------------------------------------------
 .\" * Define some portability stuff
 .\" -----------------------------------------------------------------
@@ -42,6 +42,7 @@ nvme-write-zeroes \- Send an NVMe write zeroes command, return results
                         [\-\-limited\-retry | \-l]
                         [\-\-force\-unit\-access | \-f]
                         [\-\-namespace\-id=<nsid> | \-n <nsid>]
+                        [\-\-storage\-tag<storage\-tag> | \-S <storage\-tag>]
 .fi
 .SH "DESCRIPTION"
 .sp
@@ -137,19 +138,14 @@ Set the force\-unit access flag\&.
 .RS 4
 Namespace ID use in the command\&.
 .RE
-.sp
-EXAMPLES EXAMPLES
-.sp
-.if n \{\
+.PP
+\-\-storage\-tag=<storage\-tag>, \-n <storage\-tag>
 .RS 4
-.\}
-.nf
-No examples yet\&.
-
-NVME
-.fi
-.if n \{\
+Variable Sized Expected Logical Block Storage Tag(ELBST) and Expected Logical Block Reference Tag (ELBRT), CDW2 and CDW3 (00:47) bits\&.
 .RE
-.\}
+.SH "EXAMPLES"
+.sp
+No examples yet\&.
+.SH "NVME"
 .sp
 Part of the nvme\-user suite
index f3a3838851061456e3a71a00e48d4841c347d06d..064150ca6b0269ca47da95c8faff545f18dc48a2 100644 (file)
@@ -758,7 +758,8 @@ nvme-zeroes(1) Manual Page
                         [--deac | -d]\r
                         [--limited-retry | -l]\r
                         [--force-unit-access | -f]\r
-                        [--namespace-id=&lt;nsid&gt; | -n &lt;nsid&gt;]</pre>\r
+                        [--namespace-id=&lt;nsid&gt; | -n &lt;nsid&gt;]\r
+                        [--storage-tag&lt;storage-tag&gt; | -S &lt;storage-tag&gt;]</pre>\r
 <div class="attribution">\r
 </div></div>\r
 </div>\r
@@ -920,15 +921,30 @@ metadata is passes.</p></td>
         Namespace ID use in the command.\r
 </p>\r
 </dd>\r
+<dt class="hdlist1">\r
+--storage-tag=&lt;storage-tag&gt;\r
+</dt>\r
+<dt class="hdlist1">\r
+-n &lt;storage-tag&gt;\r
+</dt>\r
+<dd>\r
+<p>\r
+        Variable Sized Expected Logical Block Storage Tag(ELBST) and Expected Logical\r
+        Block Reference Tag (ELBRT), CDW2 and CDW3 (00:47) bits.\r
+</p>\r
+</dd>\r
 </dl></div>\r
-<div class="paragraph"><p>EXAMPLES\r
-EXAMPLES</p></div>\r
-<div class="listingblock">\r
-<div class="content">\r
-<pre><code>No examples yet.\r
-\r
-NVME</code></pre>\r
-</div></div>\r
+</div>\r
+</div>\r
+<div class="sect1">\r
+<h2 id="_examples">EXAMPLES</h2>\r
+<div class="sectionbody">\r
+<div class="paragraph"><p>No examples yet.</p></div>\r
+</div>\r
+</div>\r
+<div class="sect1">\r
+<h2 id="_nvme">NVME</h2>\r
+<div class="sectionbody">\r
 <div class="paragraph"><p>Part of the nvme-user suite</p></div>\r
 </div>\r
 </div>\r
@@ -937,7 +953,7 @@ NVME</code></pre>
 <div id="footer">\r
 <div id="footer-text">\r
 Last updated\r
- 2019-09-18 00:00:58 JST\r
+ 2021-07-07 01:54:21 IST\r
 </div>\r
 </div>\r
 </body>\r
index 02adee1e68e7b46fb15d8329fa61275a71996916..2ef4da755ec9ff6dec79f205a4337ba436c365a3 100644 (file)
@@ -18,6 +18,7 @@ SYNOPSIS
                        [--limited-retry | -l]
                        [--force-unit-access | -f]
                        [--namespace-id=<nsid> | -n <nsid>]
+                       [--storage-tag<storage-tag> | -S <storage-tag>]
 
 DESCRIPTION
 -----------
@@ -77,7 +78,11 @@ metadata is passes.
 -n <nsid>::
        Namespace ID use in the command.
 
-EXAMPLES
+--storage-tag=<storage-tag>::
+-n <storage-tag>::
+       Variable Sized Expected Logical Block Storage Tag(ELBST) and Expected Logical
+       Block Reference Tag (ELBRT), CDW2 and CDW3 (00:47) bits.
+
 EXAMPLES
 --------
 No examples yet.
diff --git a/nvme.c b/nvme.c
index c738a2e5f3028abe37e31f15a3a86b6b35df85eb..5101cf28cb4250fa32ecbfc138b3ab698f8c42a4 100644 (file)
--- a/nvme.c
+++ b/nvme.c
@@ -4290,6 +4290,8 @@ static int write_zeroes(int argc, char **argv, struct command *cmd, struct plugi
        const char *ref_tag = "reference tag (for end to end PI)";
        const char *app_tag_mask = "app tag mask (for end to end PI)";
        const char *app_tag = "app tag (for end to end PI)";
+       const char *storage_tag = "storage tag, CDW2 and CDW3 (00:47) bits "\
+               "(for end to end PI)";
        const char *deac = "Set DEAC bit, requesting controller to deallocate specified logical blocks";
 
        struct config {
@@ -4300,6 +4302,7 @@ static int write_zeroes(int argc, char **argv, struct command *cmd, struct plugi
                __u16 app_tag_mask;
                __u16 block_count;
                __u8  prinfo;
+               __u64 storage_tag;
                int   deac;
                int   limited_retry;
                int   force_unit_access;
@@ -4312,6 +4315,7 @@ static int write_zeroes(int argc, char **argv, struct command *cmd, struct plugi
                .ref_tag         = 0,
                .app_tag_mask    = 0,
                .app_tag         = 0,
+               .storage_tag     = 0,
        };
 
        OPT_ARGS(opts) = {
@@ -4325,6 +4329,7 @@ static int write_zeroes(int argc, char **argv, struct command *cmd, struct plugi
                OPT_UINT("ref-tag",           'r', &cfg.ref_tag,           ref_tag),
                OPT_SHRT("app-tag-mask",      'm', &cfg.app_tag_mask,      app_tag_mask),
                OPT_SHRT("app-tag",           'a', &cfg.app_tag,           app_tag),
+               OPT_SUFFIX("storage-tag",     'S', &cfg.storage_tag,       storage_tag),
                OPT_END()
        };
 
@@ -4353,7 +4358,7 @@ static int write_zeroes(int argc, char **argv, struct command *cmd, struct plugi
        }
 
        err = nvme_write_zeros(fd, cfg.namespace_id, cfg.start_block, cfg.block_count,
-                       control, cfg.ref_tag, cfg.app_tag, cfg.app_tag_mask);
+                       control, cfg.ref_tag, cfg.app_tag, cfg.app_tag_mask, cfg.storage_tag);
        if (err < 0)
                perror("write-zeroes");
        else if (err != 0)
@@ -5286,6 +5291,8 @@ static int verify_cmd(int argc, char **argv, struct command *cmd, struct plugin
        const char *ref_tag = "reference tag (for end to end PI)";
        const char *app_tag_mask = "app tag mask (for end to end PI)";
        const char *app_tag = "app tag (for end to end PI)";
+       const char *storage_tag = "storage tag, CDW2 and CDW3 (00:47) bits "\
+               "(for end to end PI)";
 
        struct config {
                __u64 start_block;
@@ -5295,6 +5302,7 @@ static int verify_cmd(int argc, char **argv, struct command *cmd, struct plugin
                __u16 app_tag_mask;
                __u16 block_count;
                __u8  prinfo;
+               __u64 storage_tag;
                int   limited_retry;
                int   force_unit_access;
        };
@@ -5309,6 +5317,7 @@ static int verify_cmd(int argc, char **argv, struct command *cmd, struct plugin
                .app_tag_mask      = 0,
                .limited_retry     = 0,
                .force_unit_access = 0,
+               .storage_tag       = 0,
        };
 
        OPT_ARGS(opts) = {
@@ -5321,6 +5330,7 @@ static int verify_cmd(int argc, char **argv, struct command *cmd, struct plugin
                OPT_UINT("ref-tag",           'r', &cfg.ref_tag,           ref_tag),
                OPT_SHRT("app-tag",           'a', &cfg.app_tag,           app_tag),
                OPT_SHRT("app-tag-mask",      'm', &cfg.app_tag_mask,      app_tag_mask),
+               OPT_SUFFIX("storage-tag",     'S', &cfg.storage_tag,       storage_tag),
                OPT_END()
        };
 
@@ -5348,7 +5358,7 @@ static int verify_cmd(int argc, char **argv, struct command *cmd, struct plugin
        }
 
        err = nvme_verify(fd, cfg.namespace_id, cfg.start_block, cfg.block_count,
-                               control, cfg.ref_tag, cfg.app_tag, cfg.app_tag_mask);
+                               control, cfg.ref_tag, cfg.app_tag, cfg.app_tag_mask, cfg.storage_tag);
        if (err < 0)
                perror("verify");
        else if (err != 0)