.\" Title: nvme-set-feature
.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.78.1 <http://docbook.sf.net/>
-.\" Date: 05/16/2016
+.\" Date: 06/27/2016
.\" Manual: NVMe Manual
.\" Source: NVMe
.\" Language: English
.\"
-.TH "NVME\-SET\-FEATURE" "1" "05/16/2016" "NVMe" "NVMe Manual"
+.TH "NVME\-SET\-FEATURE" "1" "06/27/2016" "NVMe" "NVMe Manual"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
.sp
.nf
\fInvme set\-feature\fR <device> [\-\-namespace\-id=<nsid> | \-n <nsid>]
- [\-\-feature\-id=<fid> | \-f <fid>] [\-\-value=<value>]
+ [\-\-feature\-id=<fid> | \-f <fid>] [\-\-value=<value> | \-v <value>]
[\-\-data\-len=<data\-len> | \-l <data\-len>]
[\-\-data=<data\-file> | \-d <data\-file>]
- [\-\-raw\-binary | \-b]
+ [\-\-save| \-s]
.fi
.SH "DESCRIPTION"
.sp
-Submits an NVMe Get Feature admin command and returns the applicable results\&. This may be the feature\(cqs value, or may also include a feature structure if the feature requires it (ex: LBA Range Type)\&.
+Submits an NVMe Set Feature admin command and returns the applicable results\&. This may be the feature\(cqs value, or may also include a feature structure if the feature requires it (ex: LBA Range Type)\&.
.sp
The <device> parameter is mandatory and may be either the NVMe character device (ex: /dev/nvme0), or a namespace block device (ex: /dev/nvme0n1)\&.
.sp
-On success, the returned feature\(cqs structure (if applicable) may be returned in one of several ways depending on the option flags; the structure may parsed by the program and printed in a readable format if it is a known structure, displayed in hex, or the raw buffer may be printed to stdout for another program to parse\&.
+On success, the value sent to the device is displayed
.SH "OPTIONS"
.PP
\-n <nsid>, \-\-namespace\-id=<nsid>
.RS 4
-Retrieve the feature for the given nsid\&. This is optional and most features do not use this value\&.
+Sets the feature for the given nsid\&. This is optional and most features do not use this value\&.
.RE
.PP
\-f <fid>, \-\-feature\-id=<fid>
The data file for the buffer submitted for this feature\&. Most known features do not use this value\&. The exceptions is LBA Range Type and host identifier\&. This defaults to STDIN so files and echo can be piped\&.
.RE
.PP
-\-\-value=<value>
+\-v <value>, \-\-value=<value>
.RS 4
The value for command dword 11, the value you want to set the feature to\&.
.RE
-.SH "EXAMPLES"
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
-Retrieves the feature for Number of Queues, or feature id 7:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-# nvme set\-feature /dev/nvme0 \-f 7
-.fi
-.if n \{\
-.RE
-.\}
-.RE
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
-The following retrieves the feature for the LBA Range Type, which implicitly requires a buffer and will be printed to the screen in human readable format:
-.sp
-.if n \{\
+.PP
+\-s, \-\-save
.RS 4
-.\}
-.nf
-# nvme set\-feature /dev/nvme0 \-f 3
-.fi
-.if n \{\
-.RE
-.\}
+Save the attribute so that it persists through all power states and resets\&.
.RE
+.SH "EXAMPLES"
.sp
.RS 4
.ie n \{\
.sp -1
.IP \(bu 2.3
.\}
-Retrieves the feature for the some vendor specific feature and specifically requesting a buffer be allocate for this feature, which will be displayed to the user in as a hex dump:
+Sets the Power State (PS) to 1 in feature id 2:
.sp
.if n \{\
.RS 4
.\}
.nf
-# nvme set\-feature /dev/nvme0 \-f 0xc0 \-l 512
+# nvme set\-feature /dev/nvme0 \-f 2 /dev/nvme0n1 \-v 0x1
.fi
.if n \{\
.RE
.RE
.\}
.RE
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
-The following retrieves the feature for the LBA Range Type, which implicitly requires a buffer and will be saved to a file in its raw format:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-# nvme set\-feature /dev/nvme0 \-f 3 \-\-raw\-binary > lba_range\&.raw
-.fi
-.if n \{\
-.RE
-.\}
-.sp
-It is probably a bad idea to not redirect stdout when using this mode\&.
-.RE
.SH "NVME"
.sp
Part of the nvme\-user suite
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">\r
<head>\r
<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8" />\r
-<meta name="generator" content="AsciiDoc 8.6.7" />\r
+<meta name="generator" content="AsciiDoc 8.6.9" />\r
<title>nvme-set-feature(1)</title>\r
<style type="text/css">\r
/* Shared CSS for AsciiDoc xhtml11 and html5 backends */\r
ul > li { color: #aaa; }\r
ul > li > * { color: black; }\r
\r
-pre {\r
+.monospaced, code, pre {\r
+ font-family: "Courier New", Courier, monospace;\r
+ font-size: inherit;\r
+ color: navy;\r
padding: 0;\r
margin: 0;\r
}\r
+pre {\r
+ white-space: pre-wrap;\r
+}\r
\r
#author {\r
color: #527bbd;\r
}\r
\r
div.imageblock div.content { padding-left: 0; }\r
-span.image img { border-style: none; }\r
+span.image img { border-style: none; vertical-align: text-bottom; }\r
a.image:visited { color: white; }\r
\r
dl {\r
*\r
* */\r
\r
-tt {\r
- font-family: "Courier New", Courier, monospace;\r
- font-size: inherit;\r
- color: navy;\r
-}\r
-\r
div.tableblock {\r
margin-top: 1.0em;\r
margin-bottom: 1.5em;\r
p.table {\r
margin-top: 0;\r
}\r
-/* Because the table frame attribute is overridden by CSS in most browsers. */\r
+/* Because the table frame attribute is overriden by CSS in most browsers. */\r
div.tableblock > table[frame="void"] {\r
border-style: none;\r
}\r
*\r
* */\r
\r
-.monospaced {\r
- font-family: "Courier New", Courier, monospace;\r
- font-size: inherit;\r
- color: navy;\r
-}\r
-\r
table.tableblock {\r
margin-top: 1.0em;\r
margin-bottom: 1.5em;\r
@media print {\r
body.manpage div#toc { display: none; }\r
}\r
+\r
+\r
</style>\r
<script type="text/javascript">\r
/*<![CDATA[*/\r
<div class="sectionbody">\r
<div class="verseblock">\r
<pre class="content"><em>nvme set-feature</em> <device> [--namespace-id=<nsid> | -n <nsid>]\r
- [--feature-id=<fid> | -f <fid>] [--value=<value>]\r
+ [--feature-id=<fid> | -f <fid>] [--value=<value> | -v <value>]\r
[--data-len=<data-len> | -l <data-len>]\r
[--data=<data-file> | -d <data-file>]\r
- [--raw-binary | -b]</pre>\r
+ [--save| -s]</pre>\r
<div class="attribution">\r
</div></div>\r
</div>\r
<div class="sect1">\r
<h2 id="_description">DESCRIPTION</h2>\r
<div class="sectionbody">\r
-<div class="paragraph"><p>Submits an NVMe Get Feature admin command and returns the applicable\r
+<div class="paragraph"><p>Submits an NVMe Set Feature admin command and returns the applicable\r
results. This may be the feature’s value, or may also include a feature\r
structure if the feature requires it (ex: LBA Range Type).</p></div>\r
<div class="paragraph"><p>The <device> parameter is mandatory and may be either the NVMe character\r
device (ex: /dev/nvme0), or a namespace block device (ex: /dev/nvme0n1).</p></div>\r
-<div class="paragraph"><p>On success, the returned feature’s structure (if applicable) may be\r
-returned in one of several ways depending on the option flags; the\r
-structure may parsed by the program and printed in a readable format\r
-if it is a known structure, displayed in hex, or the raw buffer may be\r
-printed to stdout for another program to parse.</p></div>\r
+<div class="paragraph"><p>On success, the value sent to the device is displayed</p></div>\r
</div>\r
</div>\r
<div class="sect1">\r
</dt>\r
<dd>\r
<p>\r
- Retrieve the feature for the given nsid. This is optional and\r
+ Sets the feature for the given nsid. This is optional and\r
most features do not use this value.\r
</p>\r
</dd>\r
</p>\r
</dd>\r
<dt class="hdlist1">\r
+-v <value>\r
+</dt>\r
+<dt class="hdlist1">\r
--value=<value>\r
</dt>\r
<dd>\r
feature to.\r
</p>\r
</dd>\r
+<dt class="hdlist1">\r
+-s\r
+</dt>\r
+<dt class="hdlist1">\r
+--save\r
+</dt>\r
+<dd>\r
+<p>\r
+ Save the attribute so that it persists through all power states and resets.\r
+</p>\r
+</dd>\r
</dl></div>\r
</div>\r
</div>\r
<div class="ulist"><ul>\r
<li>\r
<p>\r
-Retrieves the feature for Number of Queues, or feature id 7:\r
-</p>\r
-<div class="listingblock">\r
-<div class="content">\r
-<pre><tt># nvme set-feature /dev/nvme0 -f 7</tt></pre>\r
-</div></div>\r
-</li>\r
-<li>\r
-<p>\r
-The following retrieves the feature for the LBA Range Type, which\r
-implicitly requires a buffer and will be printed to the screen in human\r
-readable format:\r
-</p>\r
-<div class="listingblock">\r
-<div class="content">\r
-<pre><tt># nvme set-feature /dev/nvme0 -f 3</tt></pre>\r
-</div></div>\r
-</li>\r
-<li>\r
-<p>\r
-Retrieves the feature for the some vendor specific feature and\r
-specifically requesting a buffer be allocate for this feature, which\r
-will be displayed to the user in as a hex dump:\r
+Sets the Power State (PS) to 1 in feature id 2:\r
</p>\r
<div class="listingblock">\r
<div class="content">\r
-<pre><tt># nvme set-feature /dev/nvme0 -f 0xc0 -l 512</tt></pre>\r
+<pre><code># nvme set-feature /dev/nvme0 -f 2 /dev/nvme0n1 -v 0x1</code></pre>\r
</div></div>\r
</li>\r
<li>\r
</p>\r
<div class="listingblock">\r
<div class="content">\r
-<pre><tt># echo "abcdefgh" | nvme set-feature /dev/nvme0 -f 0x81 -l 8</tt></pre>\r
-</div></div>\r
-</li>\r
-<li>\r
-<p>\r
-The following retrieves the feature for the LBA Range Type, which\r
-implicitly requires a buffer and will be saved to a file in its raw\r
-format:\r
-</p>\r
-<div class="listingblock">\r
-<div class="content">\r
-<pre><tt># nvme set-feature /dev/nvme0 -f 3 --raw-binary > lba_range.raw</tt></pre>\r
+<pre><code># echo "abcdefgh" | nvme set-feature /dev/nvme0 -f 0x81 -l 8</code></pre>\r
</div></div>\r
-<div class="paragraph"><p>It is probably a bad idea to not redirect stdout when using this mode.</p></div>\r
</li>\r
</ul></div>\r
</div>\r
<div id="footnotes"><hr /></div>\r
<div id="footer">\r
<div id="footer-text">\r
-Last updated 2016-02-26 08:29:25 MST\r
+Last updated 2016-06-27 09:18:46 PDT\r
</div>\r
</div>\r
</body>\r
--------
[verse]
'nvme set-feature' <device> [--namespace-id=<nsid> | -n <nsid>]
- [--feature-id=<fid> | -f <fid>] [--value=<value>]
+ [--feature-id=<fid> | -f <fid>] [--value=<value> | -v <value>]
[--data-len=<data-len> | -l <data-len>]
[--data=<data-file> | -d <data-file>]
- [--raw-binary | -b]
+ [--save| -s]
DESCRIPTION
-----------
-Submits an NVMe Get Feature admin command and returns the applicable
+Submits an NVMe Set Feature admin command and returns the applicable
results. This may be the feature's value, or may also include a feature
structure if the feature requires it (ex: LBA Range Type).
The <device> parameter is mandatory and may be either the NVMe character
device (ex: /dev/nvme0), or a namespace block device (ex: /dev/nvme0n1).
-On success, the returned feature's structure (if applicable) may be
-returned in one of several ways depending on the option flags; the
-structure may parsed by the program and printed in a readable format
-if it is a known structure, displayed in hex, or the raw buffer may be
-printed to stdout for another program to parse.
+On success, the value sent to the device is displayed
OPTIONS
-------
-n <nsid>::
--namespace-id=<nsid>::
- Retrieve the feature for the given nsid. This is optional and
+ Sets the feature for the given nsid. This is optional and
most features do not use this value.
-f <fid>::
Range Type and host identifier. This defaults to STDIN so files
and echo can be piped.
+-v <value>::
--value=<value>::
The value for command dword 11, the value you want to set the
feature to.
+-s::
+--save::
+ Save the attribute so that it persists through all power states and resets.
EXAMPLES
--------
-* Retrieves the feature for Number of Queues, or feature id 7:
+* Sets the Power State (PS) to 1 in feature id 2:
+
------------
-# nvme set-feature /dev/nvme0 -f 7
-------------
-+
-
-* The following retrieves the feature for the LBA Range Type, which
-implicitly requires a buffer and will be printed to the screen in human
-readable format:
-+
-------------
-# nvme set-feature /dev/nvme0 -f 3
-------------
-+
-
-* Retrieves the feature for the some vendor specific feature and
-specifically requesting a buffer be allocate for this feature, which
-will be displayed to the user in as a hex dump:
-+
-------------
-# nvme set-feature /dev/nvme0 -f 0xc0 -l 512
+# nvme set-feature /dev/nvme0 -f 2 /dev/nvme0n1 -v 0x1
------------
+
------------
# echo "abcdefgh" | nvme set-feature /dev/nvme0 -f 0x81 -l 8
------------
-+
-
-* The following retrieves the feature for the LBA Range Type, which
-implicitly requires a buffer and will be saved to a file in its raw
-format:
-+
-------------
-# nvme set-feature /dev/nvme0 -f 3 --raw-binary > lba_range.raw
-------------
-+
-It is probably a bad idea to not redirect stdout when using this mode.
NVME
----
__u32 feature_id;
__u32 value;
__u32 data_len;
- bool save;
+ int save;
};
struct config cfg = {
.feature_id = 0,
.value = 0,
.data_len = 0,
- .save = false,
+ .save = 0,
};
const struct argconfig_commandline_options command_line_options[] = {