]> www.infradead.org Git - users/sagi/nvme-cli.git/log
users/sagi/nvme-cli.git
2 years agonvme-print-json: Add json output status function
Tokunori Ikegami [Sat, 25 Mar 2023 02:36:10 +0000 (11:36 +0900)]
nvme-print-json: Add json output status function

For the json output add json argconfig option also.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
2 years agoutil: Cleanup argconfig parse function
Tokunori Ikegami [Fri, 24 Mar 2023 17:37:59 +0000 (02:37 +0900)]
util: Cleanup argconfig parse function

1. Split to parse config type function
2. Change if else statement to switch case statement
3. Use calloc instead of malloc
4. Delete unused while 0 statement
5. Add argconfig error common function

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
2 years agonvme: Fix format command function indentation errors
Tokunori Ikegami [Wed, 22 Mar 2023 15:35:00 +0000 (00:35 +0900)]
nvme: Fix format command function indentation errors

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
2 years agoutil: Use argconfig commandline options pointer directly
Tokunori Ikegami [Wed, 22 Mar 2023 15:29:30 +0000 (00:29 +0900)]
util: Use argconfig commandline options pointer directly

Also change print help function options argument as not const variable.
Fix ";;" also incorrectly used to ";".

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
2 years agonvme-print: Fix nvme show status function indentation errors
Tokunori Ikegami [Thu, 23 Mar 2023 16:59:41 +0000 (01:59 +0900)]
nvme-print: Fix nvme show status function indentation errors

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
2 years agonvme: Check fw-commit command support MUD
Tokunori Ikegami [Thu, 23 Mar 2023 11:22:08 +0000 (20:22 +0900)]
nvme: Check fw-commit command support MUD

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
2 years agoprint: print csi and opcode in error log (TP4113)
Minwoo Im [Wed, 8 Mar 2023 23:52:54 +0000 (08:52 +0900)]
print: print csi and opcode in error log (TP4113)

Print newly added fields in the error information log page to show which
command is errored by opcode. This commit is based on TP4113.

Signed-off-by: Minwoo Im <minwoo.im@samsung.com>
2 years agobuild: Bump up libnvme wrap
Minwoo Im [Wed, 22 Mar 2023 21:52:34 +0000 (06:52 +0900)]
build: Bump up libnvme wrap

To fetch newly added the opcode filed in error log in nvme/types.h.

Signed-off-by: Minwoo Im <minwoo.im@samsung.com>
2 years agoplugins/inspur: Cast vendor specific smart log value
Daniel Wagner [Wed, 22 Mar 2023 16:17:42 +0000 (17:17 +0100)]
plugins/inspur: Cast vendor specific smart log value

nvme_get_log_simple expects an 'enum nvme_cmd_get_log_lid' type. Cast
the vendor specific value as clang reports this as warning.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
2 years agonvme: Use correct ABORT type for self abort test
Daniel Wagner [Wed, 22 Mar 2023 16:14:12 +0000 (17:14 +0100)]
nvme: Use correct ABORT type for self abort test

The enum type is not matching, use the correct one.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
2 years agoplugins/solidigm: Do not overwrite previously initialized variable
Daniel Wagner [Wed, 22 Mar 2023 16:06:49 +0000 (17:06 +0100)]
plugins/solidigm: Do not overwrite previously initialized variable

clang reports that .uuidx are initialized twice. Remove the default
initialize value.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
2 years agobuild: Add action build back
Daniel Wagner [Wed, 22 Mar 2023 15:45:08 +0000 (16:45 +0100)]
build: Add action build back

The test target is only the building the minimal dependencies, thus not
the complete code base build. Add the build step back.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
2 years agonvme-print: sanitize supported-log-pages output
Martin George [Wed, 22 Mar 2023 06:36:55 +0000 (12:06 +0530)]
nvme-print: sanitize supported-log-pages output

The current nvme supported-log-pages output is a little cryptic
as seen below:

Support Log Pages Details for nvme1n1:
LID 0x0 (Supported Log Pages), supports 0x3

LID 0x1 (Error Information), supports 0x3
...

So sanitize this output to make it more meaningful with better
formatting. This should apply to the verbose output as well.
With these changes, the sanitized normal output should show up
as follows:

Support Log Pages Details for nvme1n1:
LID 0x0 - Supported Log Pages
LID 0x1 - Error Information
...

And the sanitized verbose output would show up as:

Support Log Pages Details for nvme1n1:
LID 0x0 - Supported Log Pages
  LSUPP is supported
  IOS is supported
LID 0x1 - Error Information
  LSUPP is supported
  IOS is supported
...

Signed-off-by: Martin George <marting@netapp.com>
2 years agonvme: Enforce length to a multiple of 4 in get_log_page
duanhaoqiang [Wed, 15 Mar 2023 10:20:59 +0000 (18:20 +0800)]
nvme: Enforce length to a multiple of 4 in get_log_page

When calculating NUMDL and NUMDU we assume that the controller is only
able to handle dword aligment (see Figure 117: SGL Data Block
descriptor).

Hence we just need to allocate a buffer which is a multiple of 4.

[dwagner: added commit message]
Signed-off-by: Daniel Wagner <dwagner@suse.de>
2 years agonvme: fix block count and data size logic
Martin George [Tue, 21 Mar 2023 08:49:11 +0000 (14:19 +0530)]
nvme: fix block count and data size logic

The required block count and data size is not automatically set
for a namespace device in submit_io(). Also it is the user specified
block count and not the actual required block count that is passed
to the ioctl data structure, often leading to nvme passthrough io
errors. For e.g. an nvme read on a 512b block size namespace device
with data size set to 4K ends up with the below error:

nvme read /dev/nvme0n1 -s 0 -z 4096
NVMe status: Data SGL Length Invalid: The length of a Data SGL is too
short or too long and the controller does not support SGL transfers
longer than the amount of data to be transferred(0x400f)

This read is successful only when the appropriate block count is
passed from the command line:

nvme read /dev/nvme0n1 -s 0 -z 4096 -c 7
read: Success

So fix this by deriving the required block count and data size based
on the logical block size and passing them appropriately to the
respective ioctl data structure. And while we are at it, remove a
couple of superfluous braces in this part of the code.

Signed-off-by: Martin George <marting@netapp.com>
2 years agoutil: Introduce argconfig simple helper to check seen condition
Tokunori Ikegami [Mon, 20 Mar 2023 13:11:22 +0000 (22:11 +0900)]
util: Introduce argconfig simple helper to check seen condition

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
2 years agoplugins/ocp: Add set feature EOL/PLP failure mode no-uuid option
Tokunori Ikegami [Thu, 16 Mar 2023 16:38:07 +0000 (01:38 +0900)]
plugins/ocp: Add set feature EOL/PLP failure mode no-uuid option

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
2 years agoplugins/ocp: Refactor to clear feature identifier C1h and C3h
Tokunori Ikegami [Thu, 16 Mar 2023 16:14:09 +0000 (01:14 +0900)]
plugins/ocp: Refactor to clear feature identifier C1h and C3h

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
2 years agoplugins/ocp: Add support for clear PCIe correctable error counters feature
Tokunori Ikegami [Wed, 15 Mar 2023 17:01:51 +0000 (02:01 +0900)]
plugins/ocp: Add support for clear PCIe correctable error counters feature

Allow argconfig to set NULL default value to check seen flag parameter only.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
2 years agonvme-doc: update man page for supported-log-pages
Martin George [Sat, 11 Mar 2023 05:49:37 +0000 (11:19 +0530)]
nvme-doc: update man page for supported-log-pages

There is no human-readable option implemented for nvme
supported-log-pages. Instead there is only a verbose option.
So update the respective man page to reflect the same.

Signed-off-by: Martin George <marting@netapp.com>
2 years agoplugins/ocp: OCP 2.0 field updates for SMART cloud log
kdedow [Wed, 1 Mar 2023 16:09:52 +0000 (08:09 -0800)]
plugins/ocp: OCP 2.0 field updates for SMART cloud log

- Add power state change field
- Parse full two bytes for point version and minor version fields

2 years agobuild: Print option summary
Martin Belanger [Wed, 15 Mar 2023 19:49:43 +0000 (15:49 -0400)]
build: Print option summary

At the end of the meson setup command, display the options so that
we can quickly determine that we're configured the project properly

Signed-off-by: Martin Belanger <martin.belanger@dell.com>
[dwagner: ported this from libnvme to nvme-cli]
Signed-off-by: Daniel Wagner <dwagner@suse.de>
2 years agonvme: Fix parameter limit range
Steven Seungcheol Lee [Wed, 15 Mar 2023 05:40:30 +0000 (14:40 +0900)]
nvme: Fix parameter limit range

3 Bits - Max value 7
SEL : Bits [10:08] of Get Features Command Dword 10

4 Bits - Max value 15
OWPASS : Bits [07:04] of Sanitize – Command Dword 10

7 Bits - Max value 127
LSP : Bits [14:08] of Get Log Page Command Dword 10
UUID Index : Bits [06:00] of Get Log Page, Get Features, Set Features Command Dword 14

Signed-off-by: Steven Seungcheol Lee <sc108.lee@samsung.com>
2 years agofdp: Fix wrong Reclaim Unit Handle Status size
Steven Seungcheol Lee [Mon, 13 Mar 2023 05:55:04 +0000 (14:55 +0900)]
fdp: Fix wrong Reclaim Unit Handle Status size

size should include reserved, NRUHSD bytes
that exist before Reclaim Unit Handle Status Descriptor List

Signed-off-by: Steven Seungcheol Lee <sc108.lee@samsung.com>
2 years agoplugins/ocp: Add support for EOL/PLP failure mode feature
Tokunori Ikegami [Thu, 9 Mar 2023 17:42:53 +0000 (02:42 +0900)]
plugins/ocp: Add support for EOL/PLP failure mode feature

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
2 years agobuild: Upload all log files on failure
Daniel Wagner [Tue, 14 Mar 2023 13:56:57 +0000 (14:56 +0100)]
build: Upload all log files on failure

Signed-off-by: Daniel Wagner <dwagner@suse.de>
2 years agobuild: Initialize sysconfdir
Daniel Wagner [Tue, 14 Mar 2023 13:11:36 +0000 (14:11 +0100)]
build: Initialize sysconfdir

The default sysconfdir needs to be initialize so that Meson and muon
expand to the same final result using join_paths().

Fixes: 432a49732bf7 ("build: Use prefixdir directly on sysconfdir")
Signed-off-by: Daniel Wagner <dwagner@suse.de>
2 years agonvme-print: Fix printing of u32 values
Caleb Sander [Thu, 9 Mar 2023 16:29:06 +0000 (09:29 -0700)]
nvme-print: Fix printing of u32 values

Fields HMPRE, HMMIN, and NN in the Identify Controller data structure
are 32-bit unsigned values but are being printed as signed integers.
Print them using %u so large values are not displayed as negative ones.
Also make JSON uint objects use uint64 instead of int64 internally
so u32 values are stored accurately.

Signed-off-by: Caleb Sander <csander@purestorage.com>
2 years agonvme: Fix invalid memory access in show_registers
Martin Joerg [Wed, 8 Mar 2023 11:52:29 +0000 (12:52 +0100)]
nvme: Fix invalid memory access in show_registers

In case nvme_get_property fails, nvme_get_properties frees the allocated memory.
The memory should not be accessed and freed again in show_registers.

Signed-off-by: Martin Joerg <martin.joerg@gmail.com>
2 years agoutil: Add argconfig seen flag parameter to check if feature NSID set
Tokunori Ikegami [Wed, 1 Mar 2023 14:51:46 +0000 (23:51 +0900)]
util: Add argconfig seen flag parameter to check if feature NSID set

To set the flag parameter change options arguments as not const variables.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
2 years agonvme-print: fix segfault in supported-log-pages json output
Martin George [Tue, 7 Mar 2023 11:09:54 +0000 (16:39 +0530)]
nvme-print: fix segfault in supported-log-pages json output

nvme supported-log-pages -o json currently segfaults due to the
wrong json object type as shown below:

nvme: json_object.c: json_object_array_add: Assertion `json_object_get_type(jso) == json_type_array' failed.
Aborted (core dumped)

Fix this by passing the appropriate json type.

Signed-off-by: Martin George <marting@netapp.com>
2 years agofabrics: Fix ordering for auto connect services
Daniel Wagner [Tue, 7 Mar 2023 09:24:01 +0000 (10:24 +0100)]
fabrics: Fix ordering for auto connect services

In order to be able to mount file systems via /etc/fstab we have to
make sure that the corresponding auto connect services have been
executed. Because the mounting of the local filesystem happens very
early in the boot we have to carefully sort these service file into the
boot process.

First, we have to disable the DefaultDependency as this will
automatically add dependency on sysinit.target which is too late (after
local mounts). Though without the default dependency we have to provide
a Before and After conditions.

The Before is simple as we have a local-fs-pre target. The After
is a bit tricky as there are no targets available.

Because the whole autoconnect machinery depends on udev events being
delivered we place the service after systemd-udevd has been started.

Link: https://www.freedesktop.org/software/systemd/man/bootup.html
Reported-by: Maurizio Lombardi <mlombard@redhat.com>
Reported-by: Wen Xiong <wenxiong@linux.ibm.com>
Tested-by: Maurizio Lombardi <mlombard@redhat.com>
Tested-by: Wen Xiong <wenxiong@linux.ibm.com>
Signed-off-by: Daniel Wagner <dwagner@suse.de>
2 years agonvme.c: Check Firmware Update Granularity in fwdl
Steven Seungcheol Lee [Fri, 3 Mar 2023 07:44:55 +0000 (16:44 +0900)]
nvme.c: Check Firmware Update Granularity in fwdl

FWUG indicates the granularity and alignment requirement of the
firmware image being updated by the Firmware Image Download command

FWUG is reported in 4 KiB units
0h indicates that no information on granularity is provided
FFh indicates there is no restriction
so when this is 0 value, use 4 KiB split as a default

Do not override when xfer is given by user
-> Support for ignore fwug in (fwug>mdts) case

Reviewed-by: Keith Busch <keith.busch@gmail.com>
Reported-by: Minsik Jeon <hmi.jeon@samsung.com>
Signed-off-by: Steven Seungcheol Lee <sc108.lee@samsung.com>
2 years agolog: high latency timestamp issue
丁剑 [Sun, 19 Feb 2023 07:43:07 +0000 (15:43 +0800)]
log: high latency timestamp issue

1. The old nvme-cli set-feature uses 32bit to represent timestamp, but the spec definition is 48bit.
2. memblaze made a slight correction to allow for overflow.
3. Now this correction is no longer needed.

Signed-off-by: 丁剑 <djukyo@gmail.com>
2 years agonvme: Align get feature data buffer length by page size to allocate
Tokunori Ikegami [Mon, 27 Feb 2023 16:23:01 +0000 (01:23 +0900)]
nvme: Align get feature data buffer length by page size to allocate

Since a memory error caused by some features as data corrupted over length.
Also the issue can be resolved by the change to align the data length.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
2 years agonvme: Continue get feature on invalid NS error to get multiple feature ids
Tokunori Ikegami [Fri, 24 Feb 2023 15:54:24 +0000 (00:54 +0900)]
nvme: Continue get feature on invalid NS error to get multiple feature ids

Some features returned invalid NS if NSID all 0xffffffff default specified.
Also print get feature ID for invalid NS error to get multiple feature ids.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
2 years agoplugins/ocp: SMART cloud log bug fixes.
kdedow [Mon, 27 Feb 2023 20:56:20 +0000 (12:56 -0800)]
plugins/ocp: SMART cloud log bug fixes.

- Fix incorrect SMART cloud log description
- Fix SMART cloud log end-to-end correction offsets

2 years agoMade temperature readouts in line with the SI.
Vishal Pankaj Chandratreya [Tue, 28 Feb 2023 05:10:00 +0000 (10:40 +0530)]
Made temperature readouts in line with the SI.

* The unit name 'kelvin' is written in lowercase, unless it starts a sentence. However, its plural 'kelvins' is more appropriate because of the context.
* Added a space between the number and the unit (e.g. 30 °C or 303 K).
* Wherever '°C' and 'kelvin' appeared in the same context, the latter is replaced with 'K'.

Ref.: *The International System of Units*, 9th edition (2019, updated 2022), Bureau International des Poids et Mesures

2 years agoChanged 'Kelvin' to 'kelvin', as recommended by the BIPM.
Vishal Pankaj Chandratreya [Sun, 26 Feb 2023 12:02:03 +0000 (17:32 +0530)]
Changed 'Kelvin' to 'kelvin', as recommended by the BIPM.

2 years agoplugins/ocp: Fix whitespace and style issues
Dedow, Karl [Thu, 16 Feb 2023 21:07:25 +0000 (13:07 -0800)]
plugins/ocp: Fix whitespace and style issues

As reported by a code linter results in OCP plugin

[dwagner:
 - lot's of manual cleanup
 - fixed non white space changes reported by checktool
 - verified result with 'git diff --word-diff'
]
Signed-off-by: Daniel Wagner <dwagner@suse.de>
2 years agoutil: Revert JSON output to plain numbers
Tokunori Ikegami [Fri, 17 Feb 2023 13:53:26 +0000 (22:53 +0900)]
util: Revert JSON output to plain numbers

Add explicit a localization stringify function for uint128_t types.
Also set serializer to generate a number instead of a string.

Fixes: 2a8bc94 ("nvme-print: Display smart log data units read and written SI value")
Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
[dwagner: introduce an explicit l10 function]
Signed-off-by: Daniel Wagner <dwagner@suse.de>
2 years agonvme: Add rae argument to telemetry-log command
Daniel Wagner [Wed, 15 Feb 2023 16:52:35 +0000 (17:52 +0100)]
nvme: Add rae argument to telemetry-log command

Allow to clear the rae bit for the telemetry-log command.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
2 years agonvme: Refactor get telemetry log page helper
Daniel Wagner [Wed, 15 Feb 2023 15:56:28 +0000 (16:56 +0100)]
nvme: Refactor get telemetry log page helper

Refactor the helper to use explicit code paths instead of conditions to
steer the code flow. This is way simpler to read and the resulting code
size is only growing 88 bytes.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
2 years agonvme: Factor out parse telemetry log da element
Daniel Wagner [Wed, 15 Feb 2023 14:05:00 +0000 (15:05 +0100)]
nvme: Factor out parse telemetry log da element

Make get_telemtetry_log_helper a bit more readable.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
2 years agonvme: Fix type in error message
Daniel Wagner [Wed, 15 Feb 2023 14:02:07 +0000 (15:02 +0100)]
nvme: Fix type in error message

Signed-off-by: Daniel Wagner <dwagner@suse.de>
2 years agobuild: Add muon build target
Daniel Wagner [Fri, 10 Feb 2023 15:09:54 +0000 (16:09 +0100)]
build: Add muon build target

Build nvme-cli using muon.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
2 years agounit: Add test-argconfig-parse
Tokunori Ikegami [Thu, 16 Feb 2023 18:33:29 +0000 (03:33 +0900)]
unit: Add test-argconfig-parse

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
2 years agobuild: Add s390x cross build and enable cross tests
Daniel Wagner [Thu, 16 Feb 2023 16:06:19 +0000 (17:06 +0100)]
build: Add s390x cross build and enable cross tests

Enable s390x cross builds and also run all tests when building cross.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
2 years agobuild: Update CI build targets
Daniel Wagner [Thu, 16 Feb 2023 08:08:23 +0000 (09:08 +0100)]
build: Update CI build targets

Update the CI build targets so we cover a bit more configuration space.

- Build release and debug builds
- Build with clang
- Cleanup the depdency list, e.g. Drop the libdbus dependency
- Do not fail on libnvme warnings, we need to catch them
  in the libnvme project.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
2 years agonvme: Use chunked read in get_log()
Daniel Wagner [Wed, 15 Feb 2023 11:35:10 +0000 (12:35 +0100)]
nvme: Use chunked read in get_log()

Large transfer might not work because we exhaust resource limits, so
chunk the read into 4k (default).

Signed-off-by: Daniel Wagner <dwagner@suse.de>
2 years agonvme: Use fprintf for error message logging in get_log()
Daniel Wagner [Wed, 15 Feb 2023 11:28:01 +0000 (12:28 +0100)]
nvme: Use fprintf for error message logging in get_log()

perror uses the errno variable which is likely set to 0, which leads to
error messages like

  non-zero log-len is required param: Success

Use fprintf and write to stderr the error messages.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
2 years agobuild: Bump libnvme wrap
Daniel Wagner [Thu, 16 Feb 2023 07:38:55 +0000 (08:38 +0100)]
build: Bump libnvme wrap

Fetch the new nvme_mi_admin_get_log_page() function.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
2 years agonvme: fix /dev/spkd/ typo
Stefan Hajnoczi [Wed, 15 Feb 2023 15:46:34 +0000 (10:46 -0500)]
nvme: fix /dev/spkd/ typo

SPDK NVMe character devices are located at /dev/spdk/ according to the
documentation (https://spdk.io/doc/nvme.html#nvme_cuse). Fix the typo.

Fixes: 6c9f792f99aa8782b32635c44e3a573bbb36c830 ("nvme: Print full device path")
Cc: Daniel Wagner <dwagner@suse.de>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2 years agodoc: --storage-tag-check doesn't take any arguments
Daniel Wagner [Fri, 10 Feb 2023 13:12:33 +0000 (14:12 +0100)]
doc: --storage-tag-check doesn't take any arguments

Update the documentation on --storage-tag-check. This command line
option is a boolean flag and doesn't take any arguments.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
2 years agofabrics: Ensure host-traddr/iface consistency for "connect-all"
Martin Belanger [Fri, 10 Feb 2023 16:56:36 +0000 (11:56 -0500)]
fabrics: Ensure host-traddr/iface consistency for "connect-all"

When using "connect-all --device" without specifying the options
--host-traddr and --host-iface, the children connections may not
have the same host-traddr/host-iface as the connection to the
discovery controller (DC).

This is specific to the --device option where one reuses a
persistent connection to a discovery controller to update the
discovery log pages (DLP) and connect to new controllers listed in
the new DLP. If --device is used w/o also specifying --host-traddr
and --host-iface, then the new connections may not use the same
attributes that were used for the DC connection.

This patch checks if --host-traddr and --host-iface have been
provided, and if not, it will use the DC's --host-traddr and
--host-iface for the new connections made as a result of changes
to the DLP.

Signed-off-by: Martin Belanger <martin.belanger@dell.com>
2 years agoMerge pull request #1819 from innogritkenny/master
Daniel Wagner [Wed, 15 Feb 2023 10:21:00 +0000 (11:21 +0100)]
Merge pull request #1819 from innogritkenny/master

plugins/innogrit: modify command opcode for eventlog and cdump

2 years agonvme-print: print the nvme generic name in json output as well
Sagi Grimberg [Wed, 15 Feb 2023 09:00:20 +0000 (11:00 +0200)]
nvme-print: print the nvme generic name in json output as well

For both simple and detailed outputs present the nvme generic
chardev name/path similar to how the ns name/path is presented.

Fixes: f0895ceb145e ("nvme-print: print generic device in list command")
Signed-off-by: Sagi Grimberg <sagi@grimberg.me>
Link: https://lore.kernel.org/r/20230215090020.620994-1-sagi@grimberg.me
[dwagner: added additional "Generic" output to json_details_list in the
          "Namespace" section]
Signed-off-by: Daniel Wagner <dwagner@suse.de>
2 years agoplugins/innogrit: modify command opcode for eventlog and cdump
innogritkenny [Wed, 15 Feb 2023 09:05:59 +0000 (17:05 +0800)]
plugins/innogrit: modify command opcode for eventlog and cdump

2 years agoMerge pull request #1817 from sc108-lee/completion
Daniel Wagner [Wed, 15 Feb 2023 07:40:20 +0000 (08:40 +0100)]
Merge pull request #1817 from sc108-lee/completion

completion: fix typo, add missing args

2 years agocompletion: fix typo, add missing args
Steven Seungcheol Lee [Wed, 15 Feb 2023 04:42:31 +0000 (13:42 +0900)]
completion: fix typo, add missing args

write-zeros -> write-zeroes
--nmic short name is -m
add missing space
add missing args

Reported-by: Youngjin Jung <yj4369.jung@samsung.com>
Signed-off-by: Steven Seungcheol Lee <sc108.lee@samsung.com>
Co-authored-by: Minsik Jeon <hmi.jeon@samsung.com>
2 years agoMerge pull request #1814 from jeffreyalien/latency-log
Daniel Wagner [Tue, 14 Feb 2023 08:55:51 +0000 (09:55 +0100)]
Merge pull request #1814 from jeffreyalien/latency-log

plugins/wdc: Fix data Formatting for Latency Monitor Log Page

2 years agoplugins/wdc: Fix data Formatting for Latency Monitor Log Page
Jeffrey Lien [Fri, 10 Feb 2023 22:14:04 +0000 (16:14 -0600)]
plugins/wdc: Fix data Formatting for Latency Monitor Log Page

Signed-off-by: Jeffrey Lien <jeff.lien@wdc.com>
2 years agoMerge pull request #1800 from igaw/make-json-c-optional
Daniel Wagner [Fri, 10 Feb 2023 15:35:27 +0000 (16:35 +0100)]
Merge pull request #1800 from igaw/make-json-c-optional

Make json-c optional

2 years agonvme: Make json-c optional again
Daniel Wagner [Tue, 7 Feb 2023 08:46:44 +0000 (09:46 +0100)]
nvme: Make json-c optional again

But with the price that functionality is missing.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
2 years agonvme-print: Move JSON printing function into a new file
Daniel Wagner [Wed, 8 Feb 2023 08:03:06 +0000 (09:03 +0100)]
nvme-print: Move JSON printing function into a new file

Let's split the JSON printing part from the console printing code as
the file is getting to big.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
2 years agoplugins/solidigm: Use json_create_object wrapper
Daniel Wagner [Mon, 6 Feb 2023 20:23:04 +0000 (21:23 +0100)]
plugins/solidigm: Use json_create_object wrapper

Use everywhere the json_create_object() wrapper to stay consistent.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
2 years agoplugins/solidigm: Use struct json_object instead of typedef
Daniel Wagner [Mon, 6 Feb 2023 17:35:46 +0000 (18:35 +0100)]
plugins/solidigm: Use struct json_object instead of typedef

It strongly preferred to use explicit types and avoid typedefs.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
2 years agofabrics: No need to sanitize trsvcid and traddr
Daniel Wagner [Wed, 8 Feb 2023 07:49:43 +0000 (08:49 +0100)]
fabrics: No need to sanitize trsvcid and traddr

libnvme does already sanitze these strings, so need to do it again.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
2 years agoMerge pull request #1805 from martin-belanger/fix-doc
Daniel Wagner [Fri, 10 Feb 2023 12:49:50 +0000 (13:49 +0100)]
Merge pull request #1805 from martin-belanger/fix-doc

docs: Fixed typos and add missing option

2 years agoMerge pull request #1809 from igaw/fix-appimage
Daniel Wagner [Fri, 10 Feb 2023 12:40:42 +0000 (13:40 +0100)]
Merge pull request #1809 from igaw/fix-appimage

build: Update library paths for AppImage

2 years agobuild: Update library paths for AppImage
Daniel Wagner [Fri, 10 Feb 2023 10:55:11 +0000 (11:55 +0100)]
build: Update library paths for AppImage

Ubuntu uses a multilib setup hence the libraries are not found
in /lib64.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
2 years agodocs: Fixed typos and missing options
Martin Belanger [Thu, 9 Feb 2023 17:13:43 +0000 (12:13 -0500)]
docs: Fixed typos and missing options

Signed-off-by: Martin Belanger <martin.belanger@dell.com>
2 years agoMerge pull request #1802 from igaw/fix-suffix_binary_parse-regression
Daniel Wagner [Thu, 9 Feb 2023 10:26:27 +0000 (11:26 +0100)]
Merge pull request #1802 from igaw/fix-suffix_binary_parse-regression

util: Numbers without any suffix are also valid

2 years agoutil: Numbers without any suffix are also valid
Daniel Wagner [Thu, 9 Feb 2023 10:04:07 +0000 (11:04 +0100)]
util: Numbers without any suffix are also valid

suffix_binary_parse() is used to parse most of the numeric command
lines. As it turns out the main use case to provide just numbers without
any suffix. Fix the regression recently introduced when we made the
parser also to check two characters suffixes.

Fixes: 1e5abd545622 ("util: Update suffix_binary_parse API")
Reported-by: Steven Seungcheol Lee <sc108.lee@samsung.com>
Signed-off-by: Daniel Wagner <dwagner@suse.de>
2 years agoMerge pull request #1789 from ikegami-t/get-feature-status
Daniel Wagner [Tue, 7 Feb 2023 15:39:34 +0000 (16:39 +0100)]
Merge pull request #1789 from ikegami-t/get-feature-status

nvme: Check invalid field status code value correctly for get feature…

2 years agoMerge pull request #1790 from igaw/reimplement-suffix_si_parse
Daniel Wagner [Tue, 7 Feb 2023 15:37:17 +0000 (16:37 +0100)]
Merge pull request #1790 from igaw/reimplement-suffix_si_parse

util: Reimplement suffix_si_parse

2 years agoutil: Update suffix_binary_parse API
Daniel Wagner [Thu, 2 Feb 2023 14:58:33 +0000 (15:58 +0100)]
util: Update suffix_binary_parse API

Use the same API type for suffix_binary_parse as we have
for suffix_si_parse. While at it also introduce a unit test
for it.

Reviewed-by: Tokunori Ikegami <ikegami.t@gmail.com>
Signed-off-by: Daniel Wagner <dwagner@suse.de>
2 years agoutil: Reimplement suffix_si_parse
Daniel Wagner [Wed, 1 Feb 2023 15:16:00 +0000 (00:16 +0900)]
util: Reimplement suffix_si_parse

suffix_si_parse() has an very awkward interface with using errno and
suffixed as return value. Let's just use the return code as status
value and use an argument for returning the value and avoid setting the
errno.

Furthermoe, this function should not know anything about LBAs, it just
supposed to parse a string with a suffix. In order to support the
previous use case we also return the endprt which allows to implement
the nsze-si parse use case and the caller side (see documentation on
create-ns).

Next problem is that suffix_is_parse uses double for calculation which
tend to get inaccurate, e.g. 6.14T results in 61399999997. Instead let's
do do all in pure integer arithmetic.

Also handle the decimal point according the locale settings.

Reviewed-by: Tokunori Ikegami <ikegami.t@gmail.com>
Signed-off-by: Daniel Wagner <dwagner@suse.de>
2 years agonvme: Filter out status flags for get feature command
Tokunori Ikegami [Wed, 1 Feb 2023 16:57:35 +0000 (01:57 +0900)]
nvme: Filter out status flags for get feature command

Since previously unnecessary DNR, M and CRD status fields were checked.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
2 years agoMerge pull request #1798 from igaw/drop-zlib
Daniel Wagner [Tue, 7 Feb 2023 08:43:56 +0000 (09:43 +0100)]
Merge pull request #1798 from igaw/drop-zlib

util: Add crc32 implementation

2 years agoMerge pull request #1799 from igaw/fix-muon-build
Daniel Wagner [Tue, 7 Feb 2023 08:43:27 +0000 (09:43 +0100)]
Merge pull request #1799 from igaw/fix-muon-build

build: Use prefixdir directly on sysconfdir

2 years agobuild: Use prefixdir directly on sysconfdir
Daniel Wagner [Mon, 6 Feb 2023 13:36:11 +0000 (14:36 +0100)]
build: Use prefixdir directly on sysconfdir

The sysconfdir is an explicit path '/etc' and the muon implementation of
join_paths is dropping the prefixdir, thus we need to string concanate
the syscondfir path instead of using the join_paths function.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
2 years agoutil: Add crc32 implementation
Daniel Wagner [Mon, 6 Feb 2023 10:22:49 +0000 (11:22 +0100)]
util: Add crc32 implementation

a05d4213f0f9 ("Add 'gen-dhchap-key' command") introduced the zlib
dependency in order to use the crc32 function. This simple function
alone is a not worth the additional dependency, so let's ship our own
crc32 function.

The implementation is from teh elfutils project which is licensed under
LGPL 3 or later of GPL 2 or later. For this project we choose the GPL 2
or later license.

Link: https://sourceware.org/git/?p=elfutils.git;a=blob;f=lib/crc32.c;hb=575198c29a427392823cc8f2400579a23d06a875
Signed-off-by: Daniel Wagner <dwagner@suse.de>
2 years agonvme-print: Use attrs_info as key for Zone Attributes Information
sunxing [Sat, 4 Feb 2023 09:00:43 +0000 (17:00 +0800)]
nvme-print: Use attrs_info as key for Zone Attributes Information

The JSON output uses the key 'attrs' for both 'za' and 'zai' members.
Fix this by using 'attrs_info' for the 'zai'.

[dwagner: updated commit messages]
Signed-off-by: Daniel Wagner <dwagner@suse.de>
2 years agobuild: Also trigger Azure Pipeline for PR
Daniel Wagner [Fri, 3 Feb 2023 14:23:48 +0000 (15:23 +0100)]
build: Also trigger Azure Pipeline for PR

Run also the blktests for PRs.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
2 years agoMerge pull request #1795 from igaw/add-blkttests
Daniel Wagner [Fri, 3 Feb 2023 14:14:42 +0000 (15:14 +0100)]
Merge pull request #1795 from igaw/add-blkttests

build: Enable Azure Pipeline again

2 years agobuild: Enable Azure Pipeline again
Daniel Wagner [Fri, 3 Feb 2023 14:02:30 +0000 (15:02 +0100)]
build: Enable Azure Pipeline again

Let's give it another try to use the addition tests. The Azure Pipeline
Agent extension seems to work now.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
2 years agoMerge pull request #1794 from igaw/effects-log
Daniel Wagner [Fri, 3 Feb 2023 10:26:23 +0000 (11:26 +0100)]
Merge pull request #1794 from igaw/effects-log

nvme: Support effects-log for fabrics ctrl

2 years agonvme: Support effects-log for fabrics ctrl
Daniel Wagner [Fri, 3 Feb 2023 10:16:11 +0000 (11:16 +0100)]
nvme: Support effects-log for fabrics ctrl

nvme-cli v1.16 supported effects-log for fabric devices only, nvme-cli
2.x supported only memory based transports (aka PCI). Obviously, we
should support effects-log independent of the transport type.

Do this by first trying to map the PCI registers and read the CAP
property if this fails fall back using the get-properties approach.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
2 years agoplugins/solidigm: Add uuid index resolution
da Cunha, Leonardo [Fri, 20 Jan 2023 01:21:53 +0000 (17:21 -0800)]
plugins/solidigm: Add uuid index resolution

Add automated uuid_index resolution when retrieving latency-tracking
log, garbage collection log, and SMART log.

2 years agoplugins/ocp: Use network byte order for OCP UUID value
da Cunha, Leonardo [Wed, 1 Feb 2023 00:09:51 +0000 (16:09 -0800)]
plugins/ocp: Use network byte order for OCP UUID value

The initialization of the OCP UUID needs to be in network byte order.

2 years agodoc: Regenerate all docs for v2.3 v2.3
Daniel Wagner [Mon, 30 Jan 2023 13:14:36 +0000 (14:14 +0100)]
doc: Regenerate all docs for v2.3

Signed-off-by: Daniel Wagner <dwagner@suse.de>
2 years agobuild: Update version to v2.3
Daniel Wagner [Mon, 30 Jan 2023 13:14:14 +0000 (14:14 +0100)]
build: Update version to v2.3

Signed-off-by: Daniel Wagner <dwagner@suse.de>
2 years agobuild: Bump libnvme.wrap release v1.3
Daniel Wagner [Mon, 30 Jan 2023 13:11:37 +0000 (14:11 +0100)]
build: Bump libnvme.wrap release v1.3

Signed-off-by: Daniel Wagner <dwagner@suse.de>
2 years agoMerge pull request #1782 from ikegami-t/dst
Daniel Wagner [Mon, 30 Jan 2023 12:45:31 +0000 (13:45 +0100)]
Merge pull request #1782 from ikegami-t/dst

Device self-test changes

2 years agonvme: Use abort self-test code definition value instead hard-code value
Tokunori Ikegami [Sat, 28 Jan 2023 02:02:04 +0000 (11:02 +0900)]
nvme: Use abort self-test code definition value instead hard-code value

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
2 years agodoc: Update device-self-test command documentation
Tokunori Ikegami [Fri, 27 Jan 2023 21:20:19 +0000 (06:20 +0900)]
doc: Update device-self-test command documentation

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
2 years agonvme: Move static variable definitions to top of file
Tokunori Ikegami [Fri, 27 Jan 2023 20:58:38 +0000 (05:58 +0900)]
nvme: Move static variable definitions to top of file

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
2 years agonvme: Add device self-test SIGINT signal handling for wait option to abort
Tokunori Ikegami [Fri, 27 Jan 2023 20:56:35 +0000 (05:56 +0900)]
nvme: Add device self-test SIGINT signal handling for wait option to abort

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
2 years agonvme: Ignore device self-test wait option for abort operation
Tokunori Ikegami [Fri, 27 Jan 2023 16:23:09 +0000 (01:23 +0900)]
nvme: Ignore device self-test wait option for abort operation

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>