From a632d3111055086cd4e5cd047f1d2c6935a4acf3 Mon Sep 17 00:00:00 2001 From: Gollu Appalanaidu Date: Thu, 8 Jul 2021 21:55:22 +0530 Subject: [PATCH] nvme: add CDW2 and CDW3 support for Write Zeroes and Verify Command 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 [dwagner: removed nvme-ioctl.c changes, these are part of libnvme] Signed-off-by: Daniel Wagner --- Documentation/nvme-verify.1 | 10 ++++++-- Documentation/nvme-verify.html | 17 +++++++++++-- Documentation/nvme-verify.txt | 6 +++++ Documentation/nvme-write-zeroes.1 | 28 ++++++++++------------ Documentation/nvme-write-zeroes.html | 36 ++++++++++++++++++++-------- Documentation/nvme-write-zeroes.txt | 7 +++++- nvme.c | 14 +++++++++-- 7 files changed, 85 insertions(+), 33 deletions(-) diff --git a/Documentation/nvme-verify.1 b/Documentation/nvme-verify.1 index 94126213..c6ddd89d 100644 --- a/Documentation/nvme-verify.1 +++ b/Documentation/nvme-verify.1 @@ -2,12 +2,12 @@ .\" Title: nvme-verify .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.79.1 -.\" 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= | \-r ] [\-\-app\-tag\-mask= | \-m ] [\-\-app\-tag= | \-a ] + [\-\-storage\-tag | \-S ] .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=, \-S +.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\&. diff --git a/Documentation/nvme-verify.html b/Documentation/nvme-verify.html index 53feb4ba..787541df 100644 --- a/Documentation/nvme-verify.html +++ b/Documentation/nvme-verify.html @@ -757,7 +757,8 @@ nvme-verify(1) Manual Page [--prinfo=<prinfo> | -p <prinfo>] [--ref-tag=<reftag> | -r <reftag>] [--app-tag-mask=<appmask> | -m <appmask>] - [--app-tag=<apptag> | -a <apptag>] + [--app-tag=<apptag> | -a <apptag>] + [--storage-tag<storage-tag> | -S <storage-tag>]
@@ -909,6 +910,18 @@ metadata is passes.

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

+
@@ -929,7 +942,7 @@ metadata is passes.

diff --git a/Documentation/nvme-verify.txt b/Documentation/nvme-verify.txt index 80d69430..8fa1ce07 100644 --- a/Documentation/nvme-verify.txt +++ b/Documentation/nvme-verify.txt @@ -17,6 +17,7 @@ SYNOPSIS [--ref-tag= | -r ] [--app-tag-mask= | -m ] [--app-tag= | -a ] + [--storage-tag | -S ] DESCRIPTION ----------- @@ -73,6 +74,11 @@ metadata is passes. -a :: Optional application tag when used with protection information. +--storage-tag=:: +-S :: + 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/Documentation/nvme-write-zeroes.1 b/Documentation/nvme-write-zeroes.1 index d32e3cab..de99f12f 100644 --- a/Documentation/nvme-write-zeroes.1 +++ b/Documentation/nvme-write-zeroes.1 @@ -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 -.\" Date: 10/20/2020 +.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] +.\" Generator: DocBook XSL Stylesheets v1.79.1 +.\" 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= | \-n ] + [\-\-storage\-tag | \-S ] .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=, \-n .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 diff --git a/Documentation/nvme-write-zeroes.html b/Documentation/nvme-write-zeroes.html index f3a38388..064150ca 100644 --- a/Documentation/nvme-write-zeroes.html +++ b/Documentation/nvme-write-zeroes.html @@ -758,7 +758,8 @@ nvme-zeroes(1) Manual Page [--deac | -d] [--limited-retry | -l] [--force-unit-access | -f] - [--namespace-id=<nsid> | -n <nsid>] + [--namespace-id=<nsid> | -n <nsid>] + [--storage-tag<storage-tag> | -S <storage-tag>]
@@ -920,15 +921,30 @@ metadata is passes.

Namespace ID use in the command.

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

-
-
-
No examples yet.
-
-NVME
-
+ + +
+

EXAMPLES

+
+

No examples yet.

+
+
+
+

NVME

+

Part of the nvme-user suite

@@ -937,7 +953,7 @@ NVME diff --git a/Documentation/nvme-write-zeroes.txt b/Documentation/nvme-write-zeroes.txt index 02adee1e..2ef4da75 100644 --- a/Documentation/nvme-write-zeroes.txt +++ b/Documentation/nvme-write-zeroes.txt @@ -18,6 +18,7 @@ SYNOPSIS [--limited-retry | -l] [--force-unit-access | -f] [--namespace-id= | -n ] + [--storage-tag | -S ] DESCRIPTION ----------- @@ -77,7 +78,11 @@ metadata is passes. -n :: Namespace ID use in the command. -EXAMPLES +--storage-tag=:: +-n :: + 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 c738a2e5..5101cf28 100644 --- 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) -- 2.50.1