Wen Xiong [Wed, 1 Dec 2021 22:25:58 +0000 (17:25 -0500)]
nvme-cli: Decode "Supported Events Bitmap" in PEL header
"Supported Events Bitmap" in PEL header shows what events
are supported in current nvme devices.
Persistent Event Log for device: nvme0n1
Action for Persistent Event Log: 0
..
..
..
Supported Events Bitmap:
Support SMART/Health Log Snapshot Event(0x1)
Support Firmware Commit Event(0x2)
Support Timestamp Change Event(0x3)
Support Power-on or Reset Event(0x4)
Support NVM Subsystem Hardware Error Event(0x5)
Support Change Namespace Event(0x6)
Support Format NVM Start Event(0x7)
Support Format NVM Completion Event(0x8)
Support Sanitize Start Event(0x9)
Support Sanitize Completion Event(0xa)
Support Set Feature Event(0xb)
Support Set Telemetry CRT Event(0xc)
Support Thermal Excursion Event(0xd)
Steven Seungcheol Lee [Fri, 10 Dec 2021 11:39:40 +0000 (20:39 +0900)]
zns: Add printing Zone Capacity Changed from zone reset
if the Variable Zone Capacity bit is set to ‘1’ in the Zone Operation
Characteristics field in the Zoned Namespace Command Set specific
Identify Namespace data structure, then the zone capacity may change
upon successful completion of a Zone Management Send command
specifying the Zone Send Action of Reset Zone
Signed-off-by: Steven Seungcheol Lee <sc108.lee@samsung.com>
Steven Seungcheol Lee [Mon, 22 Nov 2021 10:27:08 +0000 (19:27 +0900)]
Add version check for OpenSSL(1.1.0) required
HMAC_CTX_new(), HMAC_CTX_free() are new in OpenSSL 1.1.0.
nvme.c: In function ‘gen_dhchap_key’:
nvme.c:6792:24: error: implicit declaration of function ‘HMAC_CTX_new’; did you mean ‘HMAC_CTX_init’? [-Werror=implicit-function-declaration]
6792 | HMAC_CTX *hmac_ctx = HMAC_CTX_new();
| ^~~~~~~~~~~~
| HMAC_CTX_init
nvme.c:6792:24: error: initialization of ‘HMAC_CTX *’ {aka ‘struct hmac_ctx_st *’} from ‘int’ makes pointer from integer without a cast [-Werror=int-conversion]
nvme.c:6805:3: error: implicit declaration of function ‘HMAC_CTX_free’; did you mean ‘HMAC_CTX_copy’? [-Werror=implicit-function-declaration]
6805 | HMAC_CTX_free(hmac_ctx);
| ^~~~~~~~~~~~~
| HMAC_CTX_copy
cc1: all warnings being treated as errors
make: *** [Makefile:155: nvme.o] Error 1
Signed-off-by: Steven Seungcheol Lee <sc108.lee@samsung.com>
Steven Seungcheol Lee [Mon, 22 Nov 2021 08:34:58 +0000 (17:34 +0900)]
nvme: fix fatal error for sys/random.h
fatal error: sys/random.h: No such file or directory
sys/random.h supported from glibc version 2.25
so add header file existence check
if there is no sys/random.h, try to read /dev/urandom or /dev/random
Signed-off-by: Steven Seungcheol Lee <sc108.lee@samsung.com>
[dwagner: cache errno value, close will overwrite it] Signed-off-by: Daniel Wagner <dwagner@suse.de>
Steven Seungcheol Lee [Thu, 9 Dec 2021 11:34:24 +0000 (20:34 +0900)]
util/json: fix build error of json_object_add_value_uint64 #1260
util/json used when system does not have json-c library
json_object_add_value_uint handled with unsigned long long (64bits)
That's why json_object_add_value_uint64 is redefined with it
Signed-off-by: Steven Seungcheol Lee <sc108.lee@samsung.com>
Daniel Wagner [Thu, 9 Dec 2021 12:48:30 +0000 (13:48 +0100)]
plugins: Force types for isalnum and isblank
The two users of isalnum and isblank hand in unsigned char and not
int as expected by the API. This triggers thye type checker in the
debug build, e.g.
../subprojects/libnvme/ccan/ccan/build_assert/build_assert.h:38:22: error: size of unnamed array is negative
38 | (sizeof(char [1 - 2*!(cond)]) - 1)
| ^
../ccan/ccan/str/str.h:189:16: note: in expansion of macro ‘BUILD_ASSERT_OR_ZERO’
189 | ((i) + BUILD_ASSERT_OR_ZERO(!__builtin_types_compatible_p(typeof(i), \
| ^~~~~~~~~~~~~~~~~~~~
../ccan/ccan/str/str.h:196:32: note: in expansion of macro ‘str_check_arg_’
196 | #define isalnum(i) str_isalnum(str_check_arg_(i))
| ^~~~~~~~~~~~~~
../plugins/memblaze/memblaze-nvme.c:410:13: note: in expansion of macro ‘isalnum’
410 | if (isalnum(*c) == 0) {
| ^~~~~~~
Brandon Paupore [Thu, 2 Dec 2021 21:40:39 +0000 (15:40 -0600)]
Use unique names for VULs, also return 0 on success
Previously nvme_log_id_to_string returned "WDC Vendor Unique Log ID" if
it was any vendor unique log ID. This causes problems when requesting
JSON output, as only the final vendor unique log ID would be shown.
Instead, append the log id to the string making each unique.
Also, wdc_log_page_directory previously returned whatever the
output_format was. Instead return 0 if the format was valid.
nvme-check-dhchap-key, nvme-gen-dhchap-key the line of === under title
need to be written same length as title
-> fix [asciidoc: FAILED: manpage document title is mandatory]
nvme-connect-all, nvme-connect, nvme-discover new options are added
Signed-off-by: Steven Seungcheol Lee <sc108.lee@samsung.com>
Hannes Reinecke [Tue, 23 Nov 2021 07:19:20 +0000 (08:19 +0100)]
fabrics: do not print 'unrecognized' address family for loop
fabrics implementations like 'loop' do not have a transport address,
and consequently the address family value doesn't make any sense here.
So do not try to translate the address family to a printable string
if the address itself is empty.
Daniel Wagner [Thu, 18 Nov 2021 09:40:59 +0000 (10:40 +0100)]
build: Don't use external script to set version
The meson documentation points out the the version string should be a
fixed string. Our trick with trying to figure out the version is not
working in all cases, e.g. 'meson dist' will create a wrong file name.
The idea is to update the version string when a new development cycle
starts and mark the release with a tag. This is what other projects
do as well. Let's follow their common practice.
Daniel Wagner [Fri, 12 Nov 2021 15:29:20 +0000 (16:29 +0100)]
scripts: Replace gen-hostnqn workaround with 'nvme gen-hostnqn'
The script was introduced to workaround the short commings 'nvme
gen-hostnqn'. In the meantime these have been address. Instead
removing the script completly keep it around for backwards
compatibiliy and just use 'nvme gen-hostnqn'.
Install additional files such as dracut, systemd and udev scipts.
Also add support for building and installing documentation.
Introduce a build option '-Ddocs=[all,man,html]' which builds (if
asciidoctor is availalbe) and installs the docs.
meson doesn't support pre compiled sources updated in the source
tree. This is a design decision. That means the man pages
(Documentation/*.1) and the html pages (Documentation/*.html) can't be
updated so easily as with Makefile.
The workaround provide a shell script which updates the in tree
pre compiled documentation
Hannes Reinecke [Tue, 16 Nov 2021 13:57:05 +0000 (14:57 +0100)]
fabrics: call nvme_ctrl_set_discovery_ctrl()
When creating a discovery connection the user might be using the
unique discovery NQN, so we should be calling nvme_ctrl_set_discovery_ctrl()
to mark the connection as a discovery connection.
Hannes Reinecke [Mon, 15 Nov 2021 11:29:23 +0000 (12:29 +0100)]
nvme: document 'config-file' commandline option
The 'config-file' commandline option is not documented in the
man pages. And we should reference the config file as a 'ghost'
file in the rpm spec to ensure it gets removed together with the
nvme-cli package.
Hannes Reinecke [Wed, 17 Nov 2021 10:00:04 +0000 (11:00 +0100)]
Compability for older json-c releases
commit 0b63a8b7cfb7 ("Check json-c libversion, recover commit d127537")
broke building on older releases when using 'make'.
As the original issue was about json-c not being able to parse full 64
numbers this patch separates out 32 and 64 json objects and adds a warning
if an overflow occurs on older json-c releases.
Daniel Wagner [Tue, 16 Nov 2021 21:25:45 +0000 (22:25 +0100)]
build: Update json-c dependencies
With commit 0b63a8b7cfb7 ("Check json-c libversion, recover commit d127537") with increased the minimum version of json-c. Let's update
the meson wrapper.
While at it also update the min version in meson.build to 0.14.
Jeff Lien [Wed, 29 Sep 2021 14:50:47 +0000 (09:50 -0500)]
ZNS report zones command fix for large number of zones When there are a large number of zones, the buffer required to contain the data becomes extremely large and the linux os is unable to handle that on all systems. This change will break up the transfer of the zone data into smaller chunks - 1024 zone entries at a time and 64k bytes total.
Signed-off-by: Jeff Lien <jeff.lien@wdc.com>
[dwagner: ported from nvme-cli-monolithic] Signed-off-by: Daniel Wagner <wagner@suse.de>
Minwoo Im [Sat, 18 Sep 2021 01:17:15 +0000 (10:17 +0900)]
nvme-print: print generic ns chardev in verbose mode
Generic device (e.g., /dev/ng0n1) is mapped to a block device (e.g.,
/dev/nvme0n1). This chardev can be taken in case that block device is
failed to initialize from the kernel due to some reasons (e.g.,
metadata initialization failed). This generic node information can be
shown in the verbose list mode with HIDDEN block device (nvme0n1 in the
below example).
root@localhost:~# nvme list -v
NVM Express Subsystems
Device Generic NSID Usage Format Controllers
------------ ------------ -------- -------------------------- ---------------- ----------------
nvme0n1 ng0n1 1 0.00 B / 0.00 B 1 B + 0 B nvme0
nvme0n2 ng0n2 2 268.44 MB / 268.44 MB 4 KiB + 0 B nvme0
The nvme0n1 is failed to initialize and it shows 0.00 B size which is
invalid. In this case, we can take /dev/ng0n1 alternatively from the
application through generic I/O path.
Signed-off-by: Minwoo Im <minwoo.im.dev@gmail.com>
[dwagner: - ported from nvme-cli-monolithic
- fixed indention] Signed-off-by: Daniel Wagner <dwagner@suse.de>
add identify endurance group list (cns 0x19) support
Signed-off-by: Gollu Appalanaidu <anaidu.gollu@samsung.com>
[dwagner: ported from monolitic, removed nvme-ioctl.h/nvme.h change,
part of libnvme] Signed-off-by: Daniel Wagner <dwagner@suse.de>
Steven Seungcheol Lee [Mon, 6 Sep 2021 11:01:15 +0000 (20:01 +0900)]
zns: fix(Add missing fields rrl, frl, lbafe)
Based on NVMe-Zoned-Namespace-Command-Set-Specification-1.1a-2021.07.26-Ratified
Signed-off-by: Steven Seungcheol Lee <sc108.lee@samsung.com>
[dwagmer: dropped nvme.h changes, part of libnvme] Signed-off-by: Daniel Wagner <dwagner@suse.de>
Brandon Paupore [Thu, 12 Aug 2021 18:47:51 +0000 (13:47 -0500)]
Enable telemetry data area 4 in base and plugin
Signed-off-by: Brandon Paupore <brandon.paupore@wdc.com>
[dwagner: - ported from monolithic, nvme.h changes,
part of libnvme
- merged in da30c629f0f4 ("Add function to get specific
feature buffer lengths")] Signed-off-by: Daniel Wagner <dwagner@suse.de>
Signed-off-by: Gollu Appalanaidu <anaidu.gollu@samsung.com>
[dwagner: ported from monolithic, droped nvme-ioctl changes,
part of libnvme] Signed-off-by: Daniel Wagner <dwagner@suse.de>