Bart Van Assche [Tue, 18 Jun 2019 16:13:52 +0000 (09:13 -0700)]
nvme-cli: Report the NVMe 1.4 NPWG, NPWA, NPDG, NPDA and NOWS fields
From the NVMe 1.4 paragraph about NSFEAT:
"Bit 4 if set to 1: indicates that the fields NPWG, NPWA, NPDG, NPDA, and
NOWS are defined for this namespace and should be used by the host for I/O
optimization; and NOWS defined for this namespace shall adhere to Optimal
Write Size field setting defined in NVM Sets Attributes Entry (refer to
Figure 251) for the NVM Set with which this namespace is associated."
Hence only report these fields if bit 4 in NSFEAT has been set.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Bart Van Assche [Tue, 18 Jun 2019 16:07:27 +0000 (09:07 -0700)]
Introduce NVMe 1.4 Identify Namespace fields in struct nvme_id_ns
Several new fields have been introduced in version 1.4 of the NVMe spec
at offsets that were defined as reserved in version 1.3d of the NVMe
spec. Update the definition of the nvme_id_ns data structure such that
it is in sync with version 1.4 of the NVMe spec. This change preserves
backwards compatibility.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Bart Van Assche [Wed, 19 Jun 2019 17:09:54 +0000 (10:09 -0700)]
nvme-cli: Skip properties that are not supported
Instead of causing the show-regs command to fail if a property is
encountered that is not supported by the target side, do not display
the property. With this patch applied the following output is displayed
for the Linux NVMf target:
$ nvme show-regs /dev/nvme0
cap : f0003ff
version : 10300
cc : 460001
csts : 1
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Bart Van Assche [Wed, 19 Jun 2019 15:07:50 +0000 (08:07 -0700)]
nvme-cli: Rework the code for getting and setting NVMf properties
The current nvme_property() implementation is much harder to read
because it uses an nvme_admin_cmd structure to represent the
nvmf_property_get_command and nvmf_property_set_command data structures.
Verifying the implementation of nvme_property() requires to compare the
offsets of members of nvme_admin_cmd with the offsets of members of
nvmf_property_[gs]et_command. Make the code easier to read by using the
nvmf_property_get_command and nvmf_property_set data structures directly.
This patch fixes the sparse complaints about endianness mismatches in the
nvme_property(), nvme_get_property() and nvme_set_property() functions.
Cc: Eyal Ben David <eyalbe@il.ibm.com> Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Bart Van Assche [Tue, 18 Jun 2019 17:15:06 +0000 (10:15 -0700)]
wdc: Fix endianness bugs
Insert le16_to_cpu() / le32_to_cpu() where required.
Cc: Dong Ho <Dong.Ho@wdc.com> Fixes: 6bd8ab436693 ("wdc: Add data area extraction for DUI command"). Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Bart Van Assche [Wed, 19 Jun 2019 15:30:47 +0000 (08:30 -0700)]
lightnvm: Fix an endianness issue
This patch avoids that sparse reports the following:
nvme-lightnvm.c:497:35: warning: incorrect type in initializer (different base types)
nvme-lightnvm.c:497:35: expected unsigned int [usertype] data_len
nvme-lightnvm.c:497:35: got restricted __le32 [usertype]
Cc: Matias Bjorling <m@bjorling.me> Signed-off-by: Bart Van Assche <bvanassche@acm.org>
According to the le64toh() man page, the return type of that function
is uint64_t. Hence drop the cast from (uint64_t)le64_to_cpu(x)
expressions. This patch has been generated as follows:
git ls-tree --name-only -r HEAD |
while read f; do
[ -f "$f" ] && sed -i 's/(uint64_t)le64_to_cpu(/le64_to_cpu(/g' "$f"
done
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
yongxing [Mon, 10 Jun 2019 14:56:33 +0000 (22:56 +0800)]
NVMe-Cli Shannon Plugin-add support for shannon systems.
Hello,current NVMe-Cli tools hasn't supprot for shannon systems, we want to add it.
May we add some specific commands?
We add four NVMe commands for shannon temporarily,smart-log-add, get-feature-add, set-feature-add,
and id-ctrl.
Max Gurtovoy [Thu, 30 May 2019 09:43:23 +0000 (12:43 +0300)]
nvme: update description for "nvme list" command
The "nvme list" command doesn't get any device handle as an input
argument. This operation prints out a basic information for all NVMe
namespaces in the system.
Reviewed-by: Minwoo Im <minwoo.im@samsung.com> Signed-off-by: Max Gurtovoy <maxg@mellanox.com>
Max Gurtovoy [Thu, 30 May 2019 09:43:22 +0000 (12:43 +0300)]
nvme: update list-ns nsid option
This commit updates the optional nsid argument to define the wanted
nsid for start, instead of starting from nsid + 1. E.g. in case we've
wanted to get the list of namespaces starting from 1, before this
commit, we used the "--namespace-id=0" option. Nsid 0 is not valid in
NVMe spec, thus change it to start counting from the given nsid.
Reviewed-by: Minwoo Im <minwoo.im@samsung.com> Signed-off-by: Max Gurtovoy <maxg@mellanox.com>
Minwoo Im [Thu, 16 May 2019 17:23:49 +0000 (10:23 -0700)]
nvme-cli: don't try to disconnect for ctrl with pcie transport
If a host system has both pcie and fabrics controllers, the following
nvme-cli disconnect-all command will might not be working because
contrlller with pcie transport does not have delete_controller in sysfs.
root@target:~# nvme list
Node SN Model Namespace Usage Format FW Rev
---------------- -------------------- ---------------------------------------- --------- -------------------------- ---------------- --------
/dev/nvme0n1 foo QEMU NVMe Ctrl 1 536.87 MB / 536.87 MB 512 B + 0 B 1.0
/dev/nvme1n1 b92326b9b2323bf0 Linux 1 134.22 MB / 134.22 MB 512 B + 0 B 5.1.0-rc
/dev/nvme2n1 65fa04eddd9bbac0 Linux 1 134.22 MB / 134.22 MB 512 B + 0 B 5.1.0-rc
root@target:~/nvme-cli.git# nvme disconnect-all
Failed to open /sys/class/nvme/nvme0/delete_controller: No such file or directory
This patch checks the transport type of the controller in iteration.
Keith Busch [Thu, 23 May 2019 21:04:56 +0000 (15:04 -0600)]
Fix sprintf truncate
Buffer was 16k, __builtin___snprintf_chk says it may require 18834. Up
to 20k. Note, we'd usually prefer dynamic buffers for such strings:
asprintf is your friend.
Kenneth Heitke [Fri, 10 May 2019 21:55:57 +0000 (15:55 -0600)]
nvme-print: remove Virtual Management support from ONCS
Revert commit 096fd4d which mistakenly reported Virtual Management
support in the ONCS field of the Identify Controller data structure.
Virtual Management support is part of OACS instead of ONCS and was
already correctly being displayed.
Kenneth Heitke [Wed, 8 May 2019 17:13:29 +0000 (11:13 -0600)]
nvme-print: update self-test log to include 'aborted due to sanitize'
TP 4022 states that when a sanitize operation is started, self-test
operations in progress shall be aborted. The device-self test log page
includes a new result code that indicates if a self-test was aborted due
to a sanitize operation.
Dominique Leuenberger [Wed, 8 May 2019 16:48:02 +0000 (18:48 +0200)]
DOC: Move to DocBook 5 when using asciidoctor
DocBook 5 has been released about a decade ago. Newer versions of
asciidoctor (since version 2.x) no longer support the previously
used DocBook 4.x format, so it is about time for us to switch too.
Minwoo Im [Sun, 5 May 2019 11:58:59 +0000 (20:58 +0900)]
property: Fit print size for a property
We may or may not be able to see the following output in nvme-loop env.
# nvme get-property /dev/nvme0 -o 0x14
property: 0x14 (Controller Configuration), value: 7f7800460001
The register CC is not in 64bit, but the upper bits are showing some values
even it's reserved in spec.
This patch makes this print size to fit to its own size of register.
Minwoo Im [Sun, 5 May 2019 11:52:40 +0000 (20:52 +0900)]
property: Remove unnecessary wrapper function
nvme_get_property_helper() used to be an actual function who is getting the
value of the given property with offset. But, Now we don't have any 'advance'
argument to get back to the caller so that we can remove the helper function by
making it nvme_get_property() which is more intuitive.
Minwoo Im [Sun, 5 May 2019 11:46:39 +0000 (20:46 +0900)]
property: Introduce inline function to check 64bit reg
This patch removes 'advance' argument used in get_property_helper() to tell
the register of the given offset is whether 64bit or not, instead introduce a
inline function to check it simply.
This kind of check might be needed at the print module to figure out if given
register should be printed out in 32bit format or 64bit format.
spec, Makefile: add /etc/nvme files to package files
This way it can automatically be removed upon uninstallation
and we don't need %preun target. Also, this will also allow
to get these files on manual installation from sources.
Also, don't settle on the "file exists" check, use the '-s'
to check that it is not empty as well.
Lastly, in order to have hostnqn and hostid updated upon pkg
install, we have install-spec target that would omit hostnqn and
hostid files, and let the rpm %post do it (otherwise we
use the normal install target).
Reviewed-by: Minwoo Im <minwoo.im.dev@gmail.com> Signed-off-by: Sagi Grimberg <sagi@grimberg.me>
Minwoo Im [Thu, 25 Apr 2019 12:40:14 +0000 (21:40 +0900)]
print: Introduce show_nvme_status to print nvme status
We have so many subcommands so that we need to have a function in
common to print out status of nvme command.
The nvme status will be printed out in case the subcommand itself fails
due to a reason. In case of command which is in the middle of the
subcommand, it will be printed as "<cmd> failed" before status.
This patch has nothing to do with functional change.
Signed-off-by: Minwoo Im <minwoo.im.dev@gmail.com>
Minwoo Im [Wed, 24 Apr 2019 00:48:58 +0000 (01:48 +0100)]
ioctl: Fix wrong return case of get_property
If get_property_helper() succeeds in the first time, and then fails in
the next time, then the ret value will not be updated to an error value.
This patch removes 'ret' variable to make 'err' to return being updated
everytime get_property_helper() invoked.
- ontap_vol is a constant char pointer, set to "/vol/", so 5 bytes
- vol_name's size is ONTAP_LABEL_LEN, which is 260, deducting the
null-byte for termination makes 259 required bytes
- "/" is 1 byte
- ns_name's size is also ONTAP_LABEL_LEN, which is 260, deducting
the null-byte for termination makes 259 required bytes
- the final null-byte: 1
That makes in total 5 + 259 + 1 + 259 + 1 = 525 required bytes
Signed-off-by: Simon Schricker <sschricker@suse.de>
Andy Lutomirski [Mon, 15 Apr 2019 17:48:05 +0000 (10:48 -0700)]
Fix passing CFLAGS on the make command line.
Commit 254bcd6b2343 ("Fix CFLAGS parameter") only fixed the problem
if the variable came from the environment, not if it came from the
command line. Fix it using 'override'. See the GNU Make manual,
section 6.7 ("Overriding variables") for details.
Alexander Larin [Thu, 11 Apr 2019 14:11:50 +0000 (17:11 +0300)]
Use 0x prefix for all hex values of id-ctrl output
Sometimes human-readable id-ctrl output could be confusing, e.g.
$ nvme id-ctrl /dev/nvme0
NVME Identify Controller:
vid : 0x144d
ssvid : 0x144d
sn : S3HDNX0K601842
mn : SAMSUNG MZWLL1T6HEHP-00003
fr : GPNA5B3Q
rab : 8
ieee : 002538
cmic : 0x3
mdts : 5
cntlid : 21
...
Here cntlid value is hexdecimal and equals 33, but nothing shows that.
In the same time some other values have 0x prefix. Let's use the prefix
for all hexdecimal values of the output.
Signed-off-by: Alexander Larin <znahar@yandex-team.ru>
Minwoo Im [Thu, 11 Apr 2019 12:51:19 +0000 (21:51 +0900)]
plugin: Return EINVAL instead of ENOTTY
When a given string for a subcommand is not valid, we can return EINVAL which
means invalid arguments. ENOTTY is used to indicate that an invalid IOCTL
number was specified.
Keith Busch [Tue, 9 Apr 2019 21:32:46 +0000 (15:32 -0600)]
Release for new stable fixes
There's been a few fixes since the last tag that are fairly critical for
some scenarios, so we're tagging a new one already. Since these are all
just fixes and no new features, we'll add an additional minor digit to
the revision.
Signed-off-by: Keith Busch <keith.busch@intel.com>
James Smart [Tue, 9 Apr 2019 20:51:54 +0000 (13:51 -0700)]
nvme-cli: Revert stop-on-failure with connect-all
The patch that added special treatment for EALREADY connect failures
also changed the behavior on what happens if a discovery log contains
an entry that is not connectable by the system or host port. If it
encounters a log entry that can't be connected to, it will not attempt
to connect to any log entries beyond it. This can leave lots of devices
unconnected to.
Revert the stop-on-failure introduced by the previous patch.
Specifically, this failed for me on an FC array that had a discovery log
entry for a port that was not visible via zoning for the initiator
port being used.
Fixes: 1a922e0e121d7 ("connect-all: special treatment to EALREADY afetr write to /dev/nvme-fabrics" Signed-off-by: James Smart <jsmart2021@gmail.com> CC: Eyal Ben David <eyalbe@il.ibm.com> CC: Martin George <Martin.George@netapp.com>
Keith Busch [Mon, 8 Apr 2019 20:51:59 +0000 (14:51 -0600)]
Release version 1.8
There are some important fixes pending a release tag, so now seems as
good as any to tag the release.
Thank you again to everyone who's contribute to this round. Shortlog
below.
Breno Leitao (2):
Fix compilation with GCC-8
Fix CFLAGS parameter
Chaitanya Kulkarni (3):
nvme-cli: fix compilation with uint64_t cast
nvme-cli: minor cleanup for submit_io()
nvme-cli: align all the macros
Dong Ho (11):
wdc: Change device capability checking
wdc: Add additional device for vs-internal-log
wdc: Add device unit info log extraction
wdc: Add get drive status command
wdc: Add clear assert dump status command
wdc: Add drive resize command
wdc: Update device capabilities for clear pcie corr
wdc: Update file parameter checking
wdc: Add command to extract NAND statistics
wdc: Add data area extraction for DUI command
wdc: Additional device capabilities check
James Smart (1):
nvme-cli: fix fc trtype string
Jeffrey Lien (3):
NVMe-CLI WDC Plugin - add support for additional SN840 device ID.
WDC plugin Change vs-internal-log Command to Save Partial E6 Log Data.
WDC Plugins vs-internal-log command unsupported on SN340.
Keith Busch (8):
generate new documentation
Regen docs
Fix print format specifiers
Regen documentation
Add new docs to repository
Generate new documentation
Fix format block size usage
Regen documentation
Kenneth Heitke (4):
Add reporting of Virtual Management support to id-ctrl
Fix possible NULL pointer dereferences
Fix possible memory leak on get-internal-log
Print timestamp as a date and time string
Martin George (2):
nvme-cli: add netapp ontapdevices command
nvme-cli: add netapp ontapdevices man page
Maxim (1):
Adding a helper to format command to enable the user to specify desired block size and have nvme-cli determine the correct LBAF and add format helper to nvme-create-ns command
Minwoo Im (15):
fabrics: Return negative errno when asprintf() fails
fabrics: Return negative errno to check remove_ctrl() is failed
doc: Update nvme-discover by describing options
doc: Update nvme-connect by describing options
doc: Update nvme-connect-all by describing options
doc: Update nvme-disconnect by describing options
doc: Add missing commands to main document entry
nvme: Support raw_binary and json format for show-regs
doc: Update show-regs document with output-format
ioctl: Free memory if get_property for fabrics failed
nvme: Use ARRAY_SIZE() macro in common.h
nvme: Unify min(), max() macro as a common one
nvme: Simplify description for virt-mgmt
nvme: Simplify virt-mgmt options to lowercase
tests: Update print to print() for python3
Roy Shterman (1):
nvme-print: Fix evaluation of ctratt on pretty print
Sagi Grimberg (1):
nvme: print I/O error to stderr
Signed-off-by: Keith Busch <keith.busch@intel.com>