]> www.infradead.org Git - users/sagi/nvme-cli.git/log
users/sagi/nvme-cli.git
13 months agobuild: update libnvme wrap
Francis Pravin [Mon, 17 Jun 2024 06:40:07 +0000 (12:10 +0530)]
build: update libnvme wrap

Get PIF enum and the new field added in TP4141a.

Signed-off-by: Francis Pravin <francis.p@samsung.com>
13 months agodoc: fix format command info
Hasan Polat [Sat, 8 Jun 2024 03:19:48 +0000 (23:19 -0400)]
doc: fix format command info

Protection Information is not only 8 bytes of the metadata, it can
also be 16 bytes such as in 32b and 64b guard protection formats.

Signed-off-by: Hasan Polat <hasnpol2002@gmail.com>
13 months agonvme: telemetry: report the correct error if the ioctl() fails.
Maurizio Lombardi [Wed, 22 May 2024 13:06:18 +0000 (15:06 +0200)]
nvme: telemetry: report the correct error if the ioctl() fails.

It's wrong to assume that if the ioctl() returns a non-zero number
then the errno variable is set.
The ioctl() might return an NVMe Status error to inform the caller
that the requested log page is not supported, in that case errno is left
untouched.

The original code didn't handle this case and returned "-errno" even when
the latter was zero. The caller interpreted this as a successful operation
and this might lead to improperly dereferencing the log page pointer.

$ nvme telemetry-log /dev/nvme0 --output-file=telemetry_log.bin
ERROR: get_telemetry_log: : write failed with error : Bad address

Fix this bug by returning the NVMe status if errno is zero:

$ nvme telemetry-log /dev/nvme0 --output-file=telemetry_log.bin
NVMe status: Invalid Log Page: The log page indicated is invalid(0x109)
Failed to acquire telemetry log 265!

Signed-off-by: Maurizio Lombardi <mlombard@redhat.com>
13 months agonvme-print: add the cancel opcode to the nvme_cmd_to_string() list
Maurizio Lombardi [Wed, 15 May 2024 10:07:34 +0000 (12:07 +0200)]
nvme-print: add the cancel opcode to the nvme_cmd_to_string() list

Print the correct opcode name instead of "Unknown".

Signed-off-by: Maurizio Lombardi <mlombard@redhat.com>
13 months agobuild: reorder release commits
Daniel Wagner [Fri, 14 Jun 2024 07:17:41 +0000 (09:17 +0200)]
build: reorder release commits

Previously, we updated the docs after the commit so that any version
string in the docs are correct. But there are none, thus we can update
the docs before doing the release. This makes the release look a bit
more natural.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
13 months agodoc: fix ocp format issues
Daniel Wagner [Fri, 14 Jun 2024 08:01:36 +0000 (10:01 +0200)]
doc: fix ocp format issues

asccidoc complains about invalid formatting. Fix this.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
13 months agonbft: Reuse existing discovery controller
Tomas Bzatek [Mon, 20 May 2024 15:43:01 +0000 (17:43 +0200)]
nbft: Reuse existing discovery controller

Attempt to look up and use existing (persistent) discovery
controller.

Signed-off-by: Tomas Bzatek <tbzatek@redhat.com>
13 months agonbft: Skip SSNS records pointing to well-known discovery NQN
Tomas Bzatek [Thu, 25 Apr 2024 13:54:53 +0000 (15:54 +0200)]
nbft: Skip SSNS records pointing to well-known discovery NQN

Depending on a pre-OS implementation, boot attempts pointing
to the well-known discovery NQN may get transformed in
an SSNS record (and marked as 'unavailable') in case
the discovery cannot be performed. Otherwise the NBFT
table should be populated by discovered records instead.

Signed-off-by: Tomas Bzatek <tbzatek@redhat.com>
13 months agonbft: Perform actual discovery
Tomas Bzatek [Wed, 24 Apr 2024 15:52:46 +0000 (17:52 +0200)]
nbft: Perform actual discovery

This adds actual discovery support for Discovery Descriptor records.

SSNS records are connected first. Discovery Descriptor records
are checked for any existing (back-)reference from SSNS records
and are skipped if so. It is assumed in such case that the pre-OS
driver has succeeded in discovery and filled SSNS records
accordingly.

In case no SSNS record references the particular Discovery
record, an actual discovery is performed.

Signed-off-by: Tomas Bzatek <tbzatek@redhat.com>
13 months agoutil/cleanup: Add cleanup for struct nvme_fabrics_uri
Tomas Bzatek [Wed, 24 Apr 2024 15:47:02 +0000 (17:47 +0200)]
util/cleanup: Add cleanup for struct nvme_fabrics_uri

libnvme cleanup definitions are not part of public API.

Signed-off-by: Tomas Bzatek <tbzatek@redhat.com>
13 months agofabrics: Make some symbols public
Tomas Bzatek [Wed, 24 Apr 2024 15:46:19 +0000 (17:46 +0200)]
fabrics: Make some symbols public

Needed for nbft, useful to have public.

Signed-off-by: Tomas Bzatek <tbzatek@redhat.com>
13 months agonvme-print-stdout: fix format index in stdout_nvm_id_ns
Francis Pravin [Thu, 16 May 2024 07:34:37 +0000 (13:04 +0530)]
nvme-print-stdout: fix format index in stdout_nvm_id_ns

Use nvme_id_ns_flbas_to_lbaf_inuse() to get the proper format index
of the namespace.

Signed-off-by: Francis Pravin <francis.p@samsung.com>
13 months agobuild: separate builds of libnvme and nvme-cli
Daniel Wagner [Thu, 13 Jun 2024 12:31:25 +0000 (14:31 +0200)]
build: separate builds of libnvme and nvme-cli

Build and install libnvme separately from libnvme. This should catch any
attempts to include private headers from the library.

Also this is what distro usually do, so we should test this as well.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
13 months agobuild(deps): bump dawidd6/action-download-artifact from 3 to 5
dependabot[bot] [Mon, 10 Jun 2024 18:19:00 +0000 (18:19 +0000)]
build(deps): bump dawidd6/action-download-artifact from 3 to 5

Bumps [dawidd6/action-download-artifact](https://github.com/dawidd6/action-download-artifact) from 3 to 5.
- [Release notes](https://github.com/dawidd6/action-download-artifact/releases)
- [Commits](https://github.com/dawidd6/action-download-artifact/compare/v3...v5)

---
updated-dependencies:
- dependency-name: dawidd6/action-download-artifact
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
13 months agoplugins/solidigm: Added workload-tracker command
Leonardo da Cunha [Tue, 4 Jun 2024 22:50:14 +0000 (15:50 -0700)]
plugins/solidigm: Added workload-tracker command

Added set up and continuous parse and consolidation of workload log.

Signed-off-by: Leonardo da Cunha <leonardo.da.cunha@solidigm.com>
13 months agoplugins/solidigm: Added extra VU fields to id-ctrl
Anant Mashiana [Tue, 28 May 2024 20:42:58 +0000 (13:42 -0700)]
plugins/solidigm: Added extra VU fields to id-ctrl

Added 13 extra VU fields to Solidigm id-ctrl
including a buffer for correct offset

Signed-off-by: Anant Mashiana <anant.mashiana@solidigm.com>
13 months agonvme-print-stdout: print MEM bit of CTRATT field
Francis Pravin [Mon, 3 Jun 2024 10:55:45 +0000 (16:25 +0530)]
nvme-print-stdout: print MEM bit of CTRATT field

Print MDTS and Size Limits Exclude Metadata(MEM) bit of CTRATT field
which added in TP-4099.

Signed-off-by: Francis Pravin <francis.p@samsung.com>
Reviewed-by: Steven Seungcheol Lee <sc108.lee@samsung.com>
Reviewed-by: Minwoo Im <minwoo.im@samsung.com>
13 months agonvme-print-stdout: fix to print the log line by line
Francis Pravin [Tue, 28 May 2024 12:32:14 +0000 (18:02 +0530)]
nvme-print-stdout: fix to print the log line by line

Fix to print the log within one line per each FID & NVMe-MI Command
while printing in human readable form.

Signed-off-by: Francis Pravin <francis.p@samsung.com>
14 months agofabrics: Always pass hostid and hostnqn
Israel Rukshin [Thu, 18 Apr 2024 14:24:36 +0000 (14:24 +0000)]
fabrics: Always pass hostid and hostnqn

After the kernel commit ae8bd606e09b ("nvme-fabrics: prevent overriding
of existing host"), kernel ensures hostid and hostnqn maintain 1:1
mapping. This makes 'nvme discover' and 'nvme connect' commands fail
when providing only hostid or only hostnqn. This issue happens when
the user only enters NQN which doesn't contain UUID, so the generation
of the hostid fails.

There are few more issues that this commit is fixing:
 - When the user provides hostid and NQN, the hostid is overridden
   by generating it from the NQN.
 - hostid is generated from the NQN file instead of the NQN that
   the user enters at the command line.
 - The warning "use generated hostid instead of hostid file" is
   wrong when the user provides hostid via the command line.

The commit fixes those issues by doing the following logic:
 1. If user provided both via command line - pass them as-is
 2. If user doesn't enter them via command line - try to get
    them from files.
 3. If one of them is not provided - generate it from the other.
    Use the new functions nvmf_hostid_generate() when NQN doesn't
    have UUID and use nvmf_hostnqn_generate_from_hostid(hostid) to
    generate hostnqn from hostid.
 4. If user provided none - generate them both. Before this commit,
    nvme cli didn't do it.

Signed-off-by: Israel Rukshin <israelr@nvidia.com>
Reviewed-by: Max Gurtovoy <mgurtovoy@nvidia.com>
Signed-off-by: Daniel Wagner <dwagner@suse.de>
14 months agobuild: bump libnvme wrap
Daniel Wagner [Wed, 22 May 2024 12:50:46 +0000 (14:50 +0200)]
build: bump libnvme wrap

Get nvmf_hostnqn_generate_from_hostid and nvmf_hostid_generate.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
14 months agoplugins/ssstc: Replace __uint16_t with uint16_t
Khem Raj [Tue, 21 May 2024 21:09:32 +0000 (14:09 -0700)]
plugins/ssstc: Replace __uint16_t with uint16_t

uint16_t is ISO defined and comes from stdint.h, makes it
portable across glibc and musl on linux.

Signed-off-by: Khem Raj <raj.khem@gmail.com>
14 months agoplugins/solidigm: Added log pages to vs-internal-logs
Leonardo da Cunha [Wed, 8 May 2024 18:24:44 +0000 (11:24 -0700)]
plugins/solidigm: Added log pages to vs-internal-logs

Added some Identify pages, and some standard log, and some VU logs.
Created abstract data type with common fields for internal logs.
Better string buffer overflow avoidance.

Signed-off-by: Leonardo da Cunha <leonardo.da.cunha@solidigm.com>
14 months agosed: perform a tper revert after lsp revert
Greg Joyce [Mon, 20 May 2024 20:02:17 +0000 (15:02 -0500)]
sed: perform a tper revert after lsp revert

The non-destructive revert was not sufficiently reverting the lsp. A
TPER revert is required or the drive is only partially reverted.

Signed-off-by: Greg Joyce <gjoyce@linux.ibm.com>
14 months agoplugins/nbft: Use default library logging
Tomas Bzatek [Tue, 14 May 2024 15:05:07 +0000 (17:05 +0200)]
plugins/nbft: Use default library logging

Remove the workaround with creating empty root
object and use the new libnvme API instead.

Signed-off-by: Tomas Bzatek <tbzatek@redhat.com>
14 months agodocs: Add missing OCP plugin docs to meson
Arthur Shau [Mon, 13 May 2024 21:01:51 +0000 (14:01 -0700)]
docs: Add missing OCP plugin docs to meson

Multiple commands for OCP plugin have associated doc text files, but
weren't added to the meson.build, causing docs to not be generated.

Signed-off-by: Arthur Shau <arthurshau@meta.com>
14 months agoocp: Switch OCP plugin to use semantic versioning
Arthur Shau [Mon, 13 May 2024 19:38:14 +0000 (12:38 -0700)]
ocp: Switch OCP plugin to use semantic versioning

Chose version 1.0.0 to start at
commit 77f6c8fc3ad8 ("ocp: Update license to GPL-2.0-or-later")

Signed-off-by: Arthur Shau <arthurshau@meta.com>
14 months agonvme: fix fw-commit MUD result message
Francis Pravin [Mon, 13 May 2024 08:56:44 +0000 (14:26 +0530)]
nvme: fix fw-commit MUD result message

As per spec, 0th bit is set when the controller detects an overlapping
firmware/boot partition image update command sequence due to processing
a command from an Admin Submission Queue on a controller and the 1st bit
is set due to processing the command from Management Endpoint. So, fixed
the MUD result message.

Signed-off-by: Francis Pravin <francis.p@samsung.com>
14 months agosed: only re-read partition table after unlock.
Greg Joyce [Fri, 10 May 2024 19:23:11 +0000 (14:23 -0500)]
sed: only re-read partition table after unlock.

The partition table was being re-read after both lock and
unlock operations. The re-read would fail with an error
message after a lock since the partition was no longer readable.

Signed-off-by: Greg Joyce <gjoyce@linux.ibm.com>
14 months agonvme-print-json: Fix LBA status DSLBA output as hexadecimal
Tokunori Ikegami [Mon, 29 Apr 2024 15:36:13 +0000 (00:36 +0900)]
nvme-print-json: Fix LBA status DSLBA output as hexadecimal

The output printed with the 0x prefix but as not hexadecimal.
Same change for nvme-print-stdout below.
7b4b50ff ("nvme-print-stdout: Fix LBA status DSLBA output as hexadecimal")

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
14 months agonvme-print-json: Use NVME_PMRxxx register definitions to print
Tokunori Ikegami [Mon, 29 Apr 2024 14:22:16 +0000 (23:22 +0900)]
nvme-print-json: Use NVME_PMRxxx register definitions to print

Change them instead of hardcoded register mask and shift values.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
14 months agonvme-print-stdout: Fix PMRWBM register name
Tokunori Ikegami [Mon, 29 Apr 2024 14:08:45 +0000 (23:08 +0900)]
nvme-print-stdout: Fix PMRWBM register name

Incorrectly defined as PMRWMB.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
14 months agonvme-print-json: Fix channel configuration descriptors pointer
Tokunori Ikegami [Mon, 29 Apr 2024 13:15:40 +0000 (22:15 +0900)]
nvme-print-json: Fix channel configuration descriptors pointer

Set the address after NVM set EGSETS - 1 identifier parameter.
Same change for nvme-print-stdout 10d24132
("nvme-print-stdout: Fix channel configuration descriptors pointer").

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
14 months agonvme-print-json: Fix linux kernel check patch errors
Tokunori Ikegami [Mon, 29 Apr 2024 12:58:38 +0000 (21:58 +0900)]
nvme-print-json: Fix linux kernel check patch errors

Note: The long line string and strncpy() warnings are not fixed.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
14 months agobuild: Update meson commands in Makefile
Martin Belanger [Fri, 10 May 2024 13:43:38 +0000 (09:43 -0400)]
build: Update meson commands in Makefile

Invoking meson by itself w/o "setup" is considered deprecated.
Updated Makefile to use "meson setup". Also replaced "ninja"
commands by the corresponding "meson compile" command.

Signed-off-by: Martin Belanger <martin.belanger@dell.com>
14 months agonvme-print: Added "Command and Feature Lockdown" string to LID 0x14
Leonardo da Cunha [Fri, 3 May 2024 15:28:22 +0000 (08:28 -0700)]
nvme-print: Added "Command and Feature Lockdown" string to LID 0x14

NVMe Spec 2.0 added LID 0x14.

Signed-off-by: Leonardo da Cunha <leonardo.da.cunha@solidigm.com>
14 months agoplugins/innogrit: `u_char` -> `unsigned char`
Sam James [Sat, 4 May 2024 08:15:03 +0000 (09:15 +0100)]
plugins/innogrit: `u_char` -> `unsigned char`

`u_char` is not a standard name for `unsigned char` and may not work;
some implementations may provide it for convenience.

Signed-off-by: Sam James <sam@gentoo.org>
14 months agonvme: Use C99 types for uint32_t
Sam James [Sat, 4 May 2024 08:13:06 +0000 (09:13 +0100)]
nvme: Use C99 types for uint32_t

<stdint.h> provides `uint32_t`, while `u_int_32` is an unofficial/internal
typedef that glibc happens to provide. This fixes the build on musl.

Bug: https://bugs.gentoo.org/931194
Signed-off-by: Sam James <sam@gentoo.org>
14 months agonvme-print-stdout: print frl1/2/3 values for zns id-ns
lebao [Fri, 26 Apr 2024 08:13:16 +0000 (16:13 +0800)]
nvme-print-stdout: print frl1/2/3 values for zns id-ns

The zns id-ns outputs always the frl value instead the matching
frl1/2/3.

Signed-off-by: lebao <sharpllr@163.com>
14 months agosolidigm: Eliminate <linux/limits.h>
Warner Losh [Sat, 4 May 2024 03:32:07 +0000 (21:32 -0600)]
solidigm: Eliminate <linux/limits.h>

ARG_MAX is defined in <limits.h>, per POSIX, but it's defined to be a
variable in glibc. Instead, get rid of it entirely by using asprintf to
construct the commands. This prevents us from trying a partially
constructed command that might do something unintentional. For
solidigm-market-log.c, there's no constants needed from
<linux/limits.h>. With this we can delete it both places.

Signed-off-by: Warner Losh <imp@bsdimp.com>
14 months agonvme: remove double free in persistent-event-log
Francis Pravin [Fri, 10 May 2024 09:46:36 +0000 (15:16 +0530)]
nvme: remove double free in persistent-event-log

The pevent_collected structure uses the buffer address which is allocated
using nvme_alloc_huge(). So, pevent_collected and mh.p has same address.
Hence, remove _cleanup_free_ from pevent_collected to prevent double free.

Signed-off-by: Francis Pravin <francis.p@samsung.com>
Signed-off-by: Sathyavathi M <sathya.m@samsung.com>
14 months agoocp: Add Get DSSD Power State Feature (FID: C7h)
Arthur Shau [Thu, 9 May 2024 18:41:16 +0000 (11:41 -0700)]
ocp: Add Get DSSD Power State Feature (FID: C7h)

Implements the Get DSSD Power State Feature (FID C7h). Also added an
optional flag that you can pass to the plugin command to print out
all three values at once.

Signed-off-by: Arthur Shau <arthurshau@meta.com>
14 months agonvme: initialize default library logging
Daniel Wagner [Wed, 27 Mar 2024 15:59:32 +0000 (16:59 +0100)]
nvme: initialize default library logging

The library will only print errors unless we initialize default logging.
By doing so, all nvme commands are enabled to also print debug
information.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
14 months agonvme: use cleanup helper for nvme_root_t objects
Daniel Wagner [Wed, 27 Mar 2024 16:08:10 +0000 (17:08 +0100)]
nvme: use cleanup helper for nvme_root_t objects

Use a cleanup helper for the nvme_root_t objects which simplifies the
error paths and ensures we are always removing all the allocated
resources.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
14 months agobuild: bump libnvme wrap
Daniel Wagner [Fri, 10 May 2024 07:16:18 +0000 (09:16 +0200)]
build: bump libnvme wrap

Import nvme_init_default_logging.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
14 months agodoc: add nvme connet ctrl-loss-tmo description
Tokunori Ikegami [Sun, 5 May 2024 12:22:36 +0000 (21:22 +0900)]
doc: add nvme connet ctrl-loss-tmo description

Describe the kernel retry a connection behavior.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
14 months agoplugins/solidigm: Automatic enabling Data Area 4 when retrieving Telemetry.
Leonardo da Cunha [Mon, 29 Apr 2024 22:00:35 +0000 (15:00 -0700)]
plugins/solidigm: Automatic enabling Data Area 4 when retrieving Telemetry.

vs-internal-log, stopped extracting Host Initiated Telemetry previous
snapshot, simplified the type name of Telemetry snapshots to CIT and HIT,
removed command options for setting namespace, and file prefix, and added
command option to set output folder.

Signed-off-by: Leonardo da Cunha <leonardo.da.cunha@solidigm.com>
14 months agodoc: Regenerate all docs for v2.9.1
Daniel Wagner [Fri, 3 May 2024 14:03:42 +0000 (16:03 +0200)]
doc: Regenerate all docs for v2.9.1

Signed-off-by: Daniel Wagner <dwagner@suse.de>
14 months agobuild: Update version to v2.9.1
Daniel Wagner [Fri, 3 May 2024 14:03:15 +0000 (16:03 +0200)]
build: Update version to v2.9.1

Signed-off-by: Daniel Wagner <dwagner@suse.de>
14 months agoplugins/spdk: drop the plugin
Daniel Wagner [Fri, 3 May 2024 13:50:53 +0000 (15:50 +0200)]
plugins/spdk: drop the plugin

The plugin depends on the private header of libvnme and breaks the build
if the library is not a builtin dependency.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
14 months agodoc: Regenerate all docs for v2.9
Daniel Wagner [Fri, 3 May 2024 12:48:00 +0000 (14:48 +0200)]
doc: Regenerate all docs for v2.9

Signed-off-by: Daniel Wagner <dwagner@suse.de>
14 months agobuild: Update version to v2.9
Daniel Wagner [Fri, 3 May 2024 12:47:33 +0000 (14:47 +0200)]
build: Update version to v2.9

Signed-off-by: Daniel Wagner <dwagner@suse.de>
14 months agonvme-print: expand the maximum field length to prevent misalignment
Sebastian Brzezinka [Fri, 8 Dec 2023 14:29:20 +0000 (15:29 +0100)]
nvme-print: expand the maximum field length to prevent misalignment

Fields like Generic and Device are longer for SPDK-controlled
devices, which causes misalignment.

Signed-off-by: Sebastian Brzezinka <sebastian.brzezinka@intel.com>
Signed-off-by: Daniel Wagner <dwagner@suse.de>
14 months agoplugins/spdk: plugin to list SPDK subsystems
Sebastian Brzezinka [Mon, 12 Sep 2022 13:02:53 +0000 (15:02 +0200)]
plugins/spdk: plugin to list SPDK subsystems

Since `nvme-cli` start using `sysfs` to gather information about
subsystems, SPDK devices that are represented using CUSE can
no longer be listed.

Support for the JSON format is disabled cause `nvme_ctrl_get_state` use
sysfs to get value, causing segmentation fault when it's missing.
It could be solved by providing an empty string instead of a NULL pointer.

This patch adds SPDK devices to the nvme_root topology tree,

     $ nvme spdk list-subsys

Signed-off-by: Sebastian Brzezinka <sebastian.brzezinka@intel.com>
Signed-off-by: Daniel Wagner <dwagner@suse.de>
14 months agonvme-print: check if controller belong to SPDK
Sebastian Brzezinka [Fri, 26 May 2023 09:23:37 +0000 (11:23 +0200)]
nvme-print: check if controller belong to SPDK

Check if controller belongs to SPDK cuse devices and compare paths
to make it possible to distinguish SPDK devices and not rely on
order and existence of a file.

Signed-off-by: Sebastian Brzezinka <sebastian.brzezinka@intel.com>
Signed-off-by: Daniel Wagner <dwagner@suse.de>
14 months agoplugins/spdk: plugin to list SPDK controllers
Tomasz Zawadzki [Wed, 23 Mar 2022 12:41:40 +0000 (13:41 +0100)]
plugins/spdk: plugin to list SPDK controllers

Since libnvme and nvme-cli(2.0) are continuing as separate projects,
and libnvme use sysfs exclusively to gather information about NVMe
devices, legacy paths that allow specifying a custom directory ('-d`)
is no longer available.

SPDK, as a userspace driver, does not create a sysfs entry but makes it
possible to expose such devices via NVMe-cuse and since it behaves as
character device, most commands should be intact, except
listing devices and subsystems.

This patch adds SPDK devices to the nvme_root topology tree, which
allows for keeping functionality where both SPDK and kernel devices
are printed.

    $ nvme spdk list

Signed-off-by: Sebastian Brzezinka <sebastian.brzezinka@intel.com>
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Signed-off-by: Daniel Wagner <dwagner@suse.de>
14 months agonvme-print-stdout: fix ASQB, ACQB and BMBBA prints
Tokunori Ikegami [Wed, 1 May 2024 10:58:43 +0000 (19:58 +0900)]
nvme-print-stdout: fix ASQB, ACQB and BMBBA prints

The fields needed be output only as the 52 most significant bits.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
14 months agobuild: bump libnvme wrap
Daniel Wagner [Fri, 3 May 2024 12:13:18 +0000 (14:13 +0200)]
build: bump libnvme wrap

Update to v1.9 release.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
14 months agonvmf-autoconnect: fix string encoding
Daniel Wagner [Thu, 2 May 2024 09:00:07 +0000 (11:00 +0200)]
nvmf-autoconnect: fix string encoding

systemd reports that the arguments are not correctly encoded. Replace
the = char with \x3 encoding.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
14 months agonvme: identify primary ctrl do not accept nsid
Daniel Wagner [Thu, 28 Mar 2024 16:11:18 +0000 (17:11 +0100)]
nvme: identify primary ctrl do not accept nsid

The identify primary ctrl command do not accept the namespace argument.
Thus remove it.

While at it, also update identify secondary ctrl function to use same
argument name.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
14 months agonvme-wrap: remove unused nvme_cli_get_log_ana_groups()
Caleb Sander Mateos [Wed, 1 May 2024 17:52:27 +0000 (11:52 -0600)]
nvme-wrap: remove unused nvme_cli_get_log_ana_groups()

nvme_cli_get_log_ana_groups() is not called anywhere.
In preparation for a libnvme change that changes the signature
of nvme_get_log_ana_groups(), just remove the function.

Signed-off-by: Caleb Sander Mateos <csander@purestorage.com>
14 months agonvme-print-json: use admin queue attributes definitions
Tokunori Ikegami [Wed, 1 May 2024 16:37:55 +0000 (01:37 +0900)]
nvme-print-json: use admin queue attributes definitions

Replace hard coded register shift and mask values instead.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
14 months agonvme-print-json: use CSTS definitions
Tokunori Ikegami [Wed, 1 May 2024 16:33:53 +0000 (01:33 +0900)]
nvme-print-json: use CSTS definitions

Replace hard coded register value, shift and mask values.
Also add CSTS.ST output.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
14 months agonvme-print-stdout: use POWER_OF_TWO macro
Tokunori Ikegami [Wed, 1 May 2024 16:28:19 +0000 (01:28 +0900)]
nvme-print-stdout: use POWER_OF_TWO macro

Already used for json print.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
14 months agonvme-print-json: use controller configuration definitions
Tokunori Ikegami [Wed, 1 May 2024 16:23:27 +0000 (01:23 +0900)]
nvme-print-json: use controller configuration definitions

Replace hard corded register value, shift and mask values.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
14 months agonvme-print-json, nvme-print-stdout: add tertiary version number
Tokunori Ikegami [Wed, 1 May 2024 15:44:45 +0000 (00:44 +0900)]
nvme-print-json, nvme-print-stdout: add tertiary version number

Supported from version 1.2.1.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
14 months agonvme-print-json: use NVME_MAJOR and NVME_MINOR definitions
Tokunori Ikegami [Wed, 1 May 2024 16:11:08 +0000 (01:11 +0900)]
nvme-print-json: use NVME_MAJOR and NVME_MINOR definitions

Replace hard coded shift and mask values.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
14 months agonvme-print-json: use NVME_BOOT_PARTITION_INFO field definitions
Tokunori Ikegami [Wed, 1 May 2024 16:09:43 +0000 (01:09 +0900)]
nvme-print-json: use NVME_BOOT_PARTITION_INFO field definitions

Change it instead of hardcoded field mask and shift values.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
14 months agonvme-print-json: add support telemetry log create event in PEL
Tokunori Ikegami [Tue, 30 Apr 2024 15:31:54 +0000 (00:31 +0900)]
nvme-print-json: add support telemetry log create event in PEL

Already supported but only for stdout print.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
14 months agonvme-print-json: add support set feature event in PEL
Tokunori Ikegami [Tue, 30 Apr 2024 15:29:10 +0000 (00:29 +0900)]
nvme-print-json: add support set feature event in PEL

Already supported but only for stdout print.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
14 months agonvme-print-json: add obj_d() function
Tokunori Ikegami [Tue, 30 Apr 2024 15:26:08 +0000 (00:26 +0900)]
nvme-print-json: add obj_d() function

Also change json_d() to use the function.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
14 months agonvme-print-json: add obj_add_uint_0nx() function
Tokunori Ikegami [Tue, 30 Apr 2024 15:39:17 +0000 (00:39 +0900)]
nvme-print-json: add obj_add_uint_0nx() function

Supports field width to add "0x" prepended and zero padded hexadecimal.
obj_add_uint_02x() also changed to use the function as field width 2.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
14 months agomeson.build: Fix spelling of sed-opal.h filename
Warner Losh [Mon, 29 Apr 2024 17:58:15 +0000 (11:58 -0600)]
meson.build: Fix spelling of sed-opal.h filename

Add missing 'l' in sed-opal.h in description in meson.build.

Signed-off-by: Warner Losh <imp@bsdimp.com>
14 months agosed_opal: Only build when we really have sed_opal headers
Warner Losh [Mon, 29 Apr 2024 17:43:53 +0000 (11:43 -0600)]
sed_opal: Only build when we really have sed_opal headers

There's already code to not build the sed opal plugin when the necessary
headers aren't present. However, it doesn't work, since HAVE_SED_OPAL is
always defined to be either 0 or 1, so the meson has() return true, even
when the value is 0, causing the sed-opal plugin to build, even when the
header files it needs are missing.

Signed-off-by: Warner Losh <imp@bsdimp.com>
14 months agonvme: fix error path if write() fails in get_telemetry_log()
Maurizio Lombardi [Mon, 22 Apr 2024 09:47:33 +0000 (11:47 +0200)]
nvme: fix error path if write() fails in get_telemetry_log()

Print an error message and return the error code to the caller.

Signed-off-by: Maurizio Lombardi <mlombard@redhat.com>
14 months agoplugins/solidigm: Additional LID for temperature statistics.
Leonardo da Cunha [Thu, 18 Apr 2024 20:33:01 +0000 (13:33 -0700)]
plugins/solidigm: Additional LID for temperature statistics.

Temperature statistics log moved to different LID on some products.

Signed-off-by: Leonardo da Cunha <leonardo.da.cunha@solidigm.com>
14 months agoplugins/solidigm: Improved Solidigm UUID index detection.
Leonardo da Cunha [Wed, 17 Apr 2024 20:57:05 +0000 (13:57 -0700)]
plugins/solidigm: Improved Solidigm UUID index detection.

Code clean-up on solidigm log-page-directory.
UUID function calls following POSIX style.

Signed-off-by: Leonardo da Cunha <leonardo.da.cunha@solidigm.com>
14 months agonvme-print-stdout: Add CSTS.ST register stdout print
Tokunori Ikegami [Sun, 21 Apr 2024 07:43:17 +0000 (16:43 +0900)]
nvme-print-stdout: Add CSTS.ST register stdout print

Added by NVMe revision 2.0 multiple controller shutdown enhancement.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
14 months agonvme-print-stdout: Use NVME_CMIC definitions
Tokunori Ikegami [Wed, 17 Apr 2024 15:52:30 +0000 (00:52 +0900)]
nvme-print-stdout: Use NVME_CMIC definitions

Use libnvme definitions to print CMIC data.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
15 months agonvme-print: Use NVME_UNIT definitions
Tokunori Ikegami [Mon, 15 Apr 2024 14:31:24 +0000 (23:31 +0900)]
nvme-print: Use NVME_UNIT definitions

Use libnvme register definitions instead.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
15 months agonvme-print-stdout: Use NVME_CMBMSC/STS/EBS/SWTP definitions
Tokunori Ikegami [Mon, 15 Apr 2024 14:29:58 +0000 (23:29 +0900)]
nvme-print-stdout: Use NVME_CMBMSC/STS/EBS/SWTP definitions

Use libnvme register definitions instead.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
15 months agobuild: bump libnvme wrap
Tokunori Ikegami [Tue, 16 Apr 2024 15:03:55 +0000 (00:03 +0900)]
build: bump libnvme wrap

Include libnvme CMBSWTP property definitions changes.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
15 months agoplugins/ssstc: add a new plugin for SSSTC driver
kobyou [Wed, 24 Apr 2024 03:30:00 +0000 (11:30 +0800)]
plugins/ssstc: add a new plugin for SSSTC driver

Signed-off-by: kobyou <kobyou@126.com>
15 months agonvmf-connect: systemd hardening effort
Daniel Wagner [Tue, 4 Apr 2023 12:06:03 +0000 (14:06 +0200)]
nvmf-connect: systemd hardening effort

Apply the recommended hardening settings as recommended by openSUSE
and Fedor project. A few of the hardening option have to turned of
because nvme-cli needs write access to sysfs and /dev/nvme devices.

Links: https://en.opensuse.org/openSUSE:Security_Features#Systemd_hardening_effort
Links: https://fedoraproject.org/wiki/Changes/SystemdSecurityHardening
Signed-off-by: Daniel Wagner <dwagner@suse.de>
15 months agoplugins/ocp: Adjusted variable type size carrying UUID index to 8 bit.
Leonardo da Cunha [Fri, 19 Apr 2024 22:32:18 +0000 (15:32 -0700)]
plugins/ocp: Adjusted variable type size carrying UUID index to 8 bit.

Changed uuidx type to __u8 in the related function calls,
because that's the type that will feed struct nvme_get_log_args.

Signed-off-by: Leonardo da Cunha <leonardo.da.cunha@solidigm.com>
15 months agonvme: fix security buffer allocation size
Wilfred Mallawa [Sun, 21 Apr 2024 23:39:56 +0000 (09:39 +1000)]
nvme: fix security buffer allocation size

Signed-off-by: Wilfred Mallawa <wilfred.mallawa@wdc.com>
15 months agonvme: Change fw-download xfer initialization to set 0
Tokunori Ikegami [Sun, 21 Apr 2024 15:55:32 +0000 (00:55 +0900)]
nvme: Change fw-download xfer initialization to set 0

Since by the default the FWUG value not checked.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
15 months agonvme: Add fw-download warning message for FWUG alignment error
Tokunori Ikegami [Sun, 21 Apr 2024 15:33:23 +0000 (00:33 +0900)]
nvme: Add fw-download warning message for FWUG alignment error

Check the firmware file size if not aligned with FWUG value.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
15 months agoplugins/ocp: Split ocp_get_uuid_index() into find and get functions.
Leonardo da Cunha [Thu, 18 Apr 2024 23:50:30 +0000 (16:50 -0700)]
plugins/ocp: Split ocp_get_uuid_index() into find and get functions.

Enable reuse of OCP UUID discovery logic from other plugins.
Enable single call to nvme_identify_uuid() when dealing with multiple UUIDs

Signed-off-by: Leonardo da Cunha <leonardo.da.cunha@solidigm.com>
15 months agoRevert "build(deps): bump AppImageCrafters/build-appimage from 1.3 to 2"
Daniel Wagner [Wed, 17 Apr 2024 09:17:38 +0000 (11:17 +0200)]
Revert "build(deps): bump AppImageCrafters/build-appimage from 1.3 to 2"

This reverts commit 158eb8d82c497c104cf9c2d4665983084cc8ae0e.

This breaks the build with

'appimagecrafters/appimage-builder:0.8.2' should be either '[path]/Dockerfile' or 'docker://image[:tag]'.

v2 was released a couple of years ago, so I don't expect this gets fixed
at all. Instead go back to last good version.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
15 months agonvme: fix mem leak in multiple key related functions
Martin George [Tue, 16 Apr 2024 07:38:11 +0000 (13:08 +0530)]
nvme: fix mem leak in multiple key related functions

Valgrind revealed mem leaks in multiple key related functions
including gen_tls_key() and check_tls_key() during insert, and
gen_dhchap_key(). This was traced to the respective cfg pointer
not getting freed after fetching the hostnqn string from the
hostnqn file. Fix the same.

Signed-off-by: Martin George <marting@netapp.com>
15 months agofabrics: fix mem leak in nvmf_check_hostid_and_hostnqn()
Martin George [Mon, 15 Apr 2024 07:14:32 +0000 (12:44 +0530)]
fabrics: fix mem leak in nvmf_check_hostid_and_hostnqn()

Valgrind revealed a mem leak in nvmf_check_hostid_and_hostnqn()
during nvme discover & connect. Leak traced to both hostid
pointers not getting freed for cases where the hostid value
matches the strings from both these respective hostid pointers.
Fix the same.

Signed-off-by: Martin George <marting@netapp.com>
15 months agobuild(deps): bump AppImageCrafters/build-appimage from 1.3 to 2
dependabot[bot] [Mon, 15 Apr 2024 18:11:49 +0000 (18:11 +0000)]
build(deps): bump AppImageCrafters/build-appimage from 1.3 to 2

Bumps [AppImageCrafters/build-appimage](https://github.com/appimagecrafters/build-appimage) from 1.3 to 2.
- [Release notes](https://github.com/appimagecrafters/build-appimage/releases)
- [Commits](https://github.com/appimagecrafters/build-appimage/compare/v1.3...v2)

---
updated-dependencies:
- dependency-name: AppImageCrafters/build-appimage
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
15 months agonvme-print-stdout: Use NVME_BPRSEL definitions
Tokunori Ikegami [Sun, 14 Apr 2024 07:59:52 +0000 (16:59 +0900)]
nvme-print-stdout: Use NVME_BPRSEL definitions

Use libnvme register definitions instead.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
15 months agonvme-print-stdout: Use NVME_BPINFO definitions
Tokunori Ikegami [Sun, 14 Apr 2024 07:31:11 +0000 (16:31 +0900)]
nvme-print-stdout: Use NVME_BPINFO definitions

Use libnvme register definitions instead.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
15 months agonvme-print-stdout: Use NVME_CMBSZ definitions
Tokunori Ikegami [Sun, 14 Apr 2024 07:27:21 +0000 (16:27 +0900)]
nvme-print-stdout: Use NVME_CMBSZ definitions

Use libnvme register definitions instead.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
15 months agonvme-print-stdout: Use NVME_CMBLOC definitions
Tokunori Ikegami [Sun, 14 Apr 2024 07:17:36 +0000 (16:17 +0900)]
nvme-print-stdout: Use NVME_CMBLOC definitions

Use libnvme register definitions instead.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
15 months agoRevert "logging: fix error handling for ioctl passthru wrappers"
Daniel Wagner [Fri, 12 Apr 2024 10:05:00 +0000 (12:05 +0200)]
Revert "logging: fix error handling for ioctl passthru wrappers"

This reverts commit a2b1aecb9075c7a8f9bad627fc45171bb533c8bd.

The result field is undefined for many commands and thus can have random
values. Thus we can't blindly evaluate these for all commands.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
15 months agofabrics: align identify command payload
Daniel Wagner [Wed, 10 Apr 2024 08:58:13 +0000 (10:58 +0200)]
fabrics: align identify command payload

The payload should be properly aligned.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
15 months agoocp: Unify line start spacing as tabs
Brandon Paupore [Tue, 26 Mar 2024 15:27:07 +0000 (10:27 -0500)]
ocp: Unify line start spacing as tabs

Most of the ocp-nvme.c file already uses tabs in this way, but some
functions are using spaces instead. Unify this to follow the checkpatch
preference for code indents using tabs where possible.

Signed-off-by: Brandon Paupore <brandon.paupore@wdc.com>
15 months agoocp: support OCP DSSD Async Event Config feature
Brandon Paupore [Fri, 15 Mar 2024 21:36:47 +0000 (16:36 -0500)]
ocp: support OCP DSSD Async Event Config feature

Adds two new OCP plugin functions for getting and setting this feature,
based on the 2.5 OCP spec.

Signed-off-by: Brandon Paupore <brandon.paupore@wdc.com>