]> www.infradead.org Git - users/sagi/nvme-cli.git/log
users/sagi/nvme-cli.git
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>
15 months agonvme: Add support for get-reg and set-reg commands
Tokunori Ikegami [Sun, 10 Mar 2024 02:29:41 +0000 (11:29 +0900)]
nvme: Add support for get-reg and set-reg commands

The get-reg command is to output register(s), it's possible to show
several registers when register name are used as command line option.

The set-reg command is to write nvme register(s). Again, the command is
able to set several registers when the register name are used.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
15 months agonvme-print-json: Add register print functions
Tokunori Ikegami [Sun, 10 Mar 2024 02:20:14 +0000 (11:20 +0900)]
nvme-print-json: Add register print functions

To prepare the state for the get register feature.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
15 months agonvme-print-stdout: Add register print functions
Tokunori Ikegami [Sat, 23 Mar 2024 02:49:55 +0000 (11:49 +0900)]
nvme-print-stdout: Add register print functions

To prepare the state for the get register feature.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
15 months agonvme-print: Add register print functions
Tokunori Ikegami [Sat, 23 Mar 2024 02:25:39 +0000 (11:25 +0900)]
nvme-print: Add register print functions

To prepare the state for the get register feature.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
15 months agonvme: Refactor mmap_registers to add writable parameter
Tokunori Ikegami [Mon, 25 Mar 2024 16:28:25 +0000 (01:28 +0900)]
nvme: Refactor mmap_registers to add writable parameter

To prepare the stage for the set register feature.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
15 months agonvme-print: Change PMRSZU string function as unit string
Tokunori Ikegami [Sat, 23 Mar 2024 02:20:27 +0000 (11:20 +0900)]
nvme-print: Change PMRSZU string function as unit string

To use the function by other registers print functions.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
15 months agonvme-print: Refactor CMBLOC and PMRSTS registers function
Tokunori Ikegami [Sat, 23 Mar 2024 02:18:56 +0000 (11:18 +0900)]
nvme-print: Refactor CMBLOC and PMRSTS registers function

Move the mmio_read up the call chain.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
15 months agologging: fix error handling for ioctl passthru wrappers
Daniel Wagner [Tue, 9 Apr 2024 13:03:43 +0000 (15:03 +0200)]
logging: fix error handling for ioctl passthru wrappers

libnvme fixed the error handling for the passthru commands. Update the
nvme-cli version accordingly.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
15 months agobuild: bump libnvme wrap
Daniel Wagner [Tue, 9 Apr 2024 13:07:12 +0000 (15:07 +0200)]
build: bump libnvme wrap

Include error handling changes for the passthru commands.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
15 months agonbft: Fix scandir() error check
Tomas Bzatek [Tue, 26 Mar 2024 14:40:05 +0000 (15:40 +0100)]
nbft: Fix scandir() error check

read_nbft_files() returns negative errno values in case
of a failure.

Signed-off-by: Tomas Bzatek <tbzatek@redhat.com>
15 months agonbft: Refactor connection attempt out
Tomas Bzatek [Mon, 25 Mar 2024 15:35:31 +0000 (16:35 +0100)]
nbft: Refactor connection attempt out

With planned NBFT discovery work, a common connection
function would be handy. Besides, the DHCP fallback mostly
duplicated the connection code anyway, let's refactor that.

Signed-off-by: Tomas Bzatek <tbzatek@redhat.com>
15 months agonvme-print: Use EOM optional data present macros changed
Tokunori Ikegami [Sun, 24 Mar 2024 13:08:05 +0000 (22:08 +0900)]
nvme-print: Use EOM optional data present macros changed

Also use the EOM optional data present reserved field macro added.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
15 months agonvme-print: Print cntlid number for controller
Nilay Shroff [Fri, 5 Apr 2024 12:10:36 +0000 (17:40 +0530)]
nvme-print: Print cntlid number for controller

Print the controller identifier number (cntlid) for the nvme controller.
The cntlid is printed if nvme list verbose is specified.

Signed-off-by: Nilay Shroff <nilay@linux.ibm.com>
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Link: https://lore.kernel.org/r/20240405121057.297071-1-nilay@linux.ibm.com
Signed-off-by: Daniel Wagner <dwagner@suse.de>
15 months agobuild: bump libnvme wrap
Daniel Wagner [Tue, 9 Apr 2024 10:03:06 +0000 (12:03 +0200)]
build: bump libnvme wrap

Get nvme_ctrl_get_cntlid changes.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
15 months agonvme: check-tls-key fails despite having hostnqn file
Martin George [Sat, 6 Apr 2024 12:47:25 +0000 (18:17 +0530)]
nvme: check-tls-key fails despite having hostnqn file

Nvme check-tls-key requires both hostnqn and subsysnqn to be
specified along with the keydata. Ideally, it should be able to
fetch the hostnqn string from the hostnqn file if no hostnqn
option is passed, irrespective of whether the insert option is
specified or not. Also passing the subsysnqn option is required
not just for identity v1, but for v0 as well, irrespective of
the insert option. Fix accordingly.

Signed-off-by: Martin George <marting@netapp.com>
15 months agonvme: print retained key for gen-tls-key's -i option too
Martin George [Wed, 3 Apr 2024 14:18:47 +0000 (19:48 +0530)]
nvme: print retained key for gen-tls-key's -i option too

Printing the retained or encoded key is useful not only when
generating the tls key but also while inserting it into the
keyring as well.

Signed-off-by: Martin George <marting@netapp.com>
15 months agofabrics : allow host to create duplicate connections to target
Nilay Shroff [Wed, 3 Apr 2024 13:34:16 +0000 (19:04 +0530)]
fabrics : allow host to create duplicate connections to target

Apparently the nvmf connect code doesn't allow creating
duplicate connections from a host to the same target even
though user specifies option "--duplicate-connect" or "-D".
This patch help fix this issue.

Fixes: 07d6b911e081 ("fabrics: Do not attempt to reconnect to already connected ctrls")
Reported-by: Amit Engel <Amit.Engel@Dell.com>
Signed-off-by: Nilay Shroff <nilay@linux.ibm.com>
Link: https://lore.kernel.org/r/20240403133438.161916-1-nilay@linux.ibm.com
Signed-off-by: Daniel Wagner <dwagner@suse.de>
15 months agofabrics: Fix fast_io_fail_tmo option
Israel Rukshin [Tue, 2 Apr 2024 12:18:12 +0000 (12:18 +0000)]
fabrics: Fix fast_io_fail_tmo option

The option was partially removed by a refactoring commit.
Return it back, because it is still supported by the kernel
driver.

Fixes: 18de3a6d61a7 ("Convert to libnvme")
Signed-off-by: Israel Rukshin <israelr@nvidia.com>
Reviewed-by: Max Gurtovoy <mgurtovoy@nvidia.com>
Link: https://lore.kernel.org/r/1712060292-11054-1-git-send-email-israelr@nvidia.com
Signed-off-by: Daniel Wagner <dwagner@suse.de>
15 months agonvme-print-stdout: use admin queue attributes definitions
Tokunori Ikegami [Sun, 31 Mar 2024 10:19:56 +0000 (19:19 +0900)]
nvme-print-stdout: use admin queue attributes definitions

Replace hard coded register shift and mask values instead.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
15 months agonvme-print-stdout: use CSTS definitions
Tokunori Ikegami [Sun, 31 Mar 2024 07:09:04 +0000 (16:09 +0900)]
nvme-print-stdout: use CSTS definitions

Replace hard coded register value, shift and mask values.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
15 months agonvme-print-stdout: use controller configuration definitions
Tokunori Ikegami [Sun, 31 Mar 2024 06:20:26 +0000 (15:20 +0900)]
nvme-print-stdout: use controller configuration definitions

Replace hard corded register value, shift and mask values.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
15 months agonvme-print-stdout: use NVME_MAJOR and NVME_MINOR definitions
Tokunori Ikegami [Sat, 30 Mar 2024 22:42:11 +0000 (07:42 +0900)]
nvme-print-stdout: use NVME_MAJOR and NVME_MINOR definitions

Replace hard coded shift and mask values.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
15 months agonvme-print-stdout: use FDP configuration attributes definitions
Tokunori Ikegami [Sat, 30 Mar 2024 22:21:28 +0000 (07:21 +0900)]
nvme-print-stdout: use FDP configuration attributes definitions

Replace the hard coded shift and mask values in the print function.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
15 months agobuild(deps): bump sand4rt/ftp-deployer from 1.7 to 1.8
dependabot[bot] [Mon, 1 Apr 2024 18:57:38 +0000 (18:57 +0000)]
build(deps): bump sand4rt/ftp-deployer from 1.7 to 1.8

Bumps [sand4rt/ftp-deployer](https://github.com/sand4rt/ftp-deployer) from 1.7 to 1.8.
- [Release notes](https://github.com/sand4rt/ftp-deployer/releases)
- [Commits](https://github.com/sand4rt/ftp-deployer/compare/v1.7...v1.8)

---
updated-dependencies:
- dependency-name: sand4rt/ftp-deployer
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
15 months agonvme: add new function 'tls_key'
Hannes Reinecke [Wed, 28 Feb 2024 09:02:41 +0000 (10:02 +0100)]
nvme: add new function 'tls_key'

Add a new function 'tls_key' to import and export keys from the
keyring.

Signed-off-by: Hannes Reinecke <hare@suse.de>
15 months agobuild: bump libnvme wrap
Hannes Reinecke [Tue, 19 Mar 2024 14:24:29 +0000 (15:24 +0100)]
build: bump libnvme wrap

To include missing symbol nvme_scan_tls_keys.

Signed-off-by: Hannes Reinecke <hare@suse.de>
15 months agonvme: use library functions for importing and exporting TLS keys
Hannes Reinecke [Tue, 27 Feb 2024 08:12:34 +0000 (09:12 +0100)]
nvme: use library functions for importing and exporting TLS keys

As we now have library functions for importing and exporting TLS
keys we should be using them.

Signed-off-by: Hannes Reinecke <hare@suse.de>
16 months agonvme: extend error message for ns scan failures
Daniel Wagner [Wed, 27 Mar 2024 11:37:04 +0000 (12:37 +0100)]
nvme: extend error message for ns scan failures

When the scan operation fails, let's also report the error code in order
to help understand why the operation failed.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
16 months agonvme-print-json: Bugfix status json key of sanitize-log
Minsik Jeon [Thu, 28 Mar 2024 04:50:28 +0000 (13:50 +0900)]
nvme-print-json: Bugfix status json key of sanitize-log

There is a history of combining duplicated json keys before.
Fixes: 1d7c092f9dac ("nvme-print-json: Combine duplicated json key and val string variables")
Fixes: 59a0f125cb08 ("nvme-print-json: Delete static const char string global variables")
But there is a local variable with the same name, so the key and value
are the same.

Reviewed-by: Sangkuk Lee <sangkuk0.lee@samsung.com>
Reported-by: Kiryong Kim <kiryong1.kim@samsung.com>
Signed-off-by: Minsik Jeon <hmi.jeon@samsung.com>
Co-authored-by: Steven Seungcheol Lee <sc108.lee@samsung.com>
16 months agosed: update SED password when initalizing
Greg Joyce [Wed, 27 Mar 2024 17:40:53 +0000 (12:40 -0500)]
sed: update SED password when initalizing

The SED key and kernel keyring were not being updated by the
initialization operation. Add password update after the other
initialization tasks are completed.

Signed-off-by: Greg Joyce <gjoyce@linux.ibm.com>
16 months agoplugins/memblaze: add performance stats
jinhua.huang [Wed, 27 Mar 2024 12:29:59 +0000 (20:29 +0800)]
plugins/memblaze: add performance stats

Add performance stats feature

Signed-off-by: jinhua.huang <jinhua.huang@memblaze.com>
16 months agoplugins/memblaze: fix code mis-type error
jinhua.huang [Wed, 27 Mar 2024 03:06:07 +0000 (11:06 +0800)]
plugins/memblaze: fix code mis-type error

Change "flash_error_media_count" to "inflight_write_io_cmd".

Signed-off-by: jinhua.huang <jinhua.huang@memblaze.com>
16 months agoplugins/memblaze: code refactor on applying __packed on more structs
jinhua.huang [Wed, 27 Mar 2024 02:24:31 +0000 (10:24 +0800)]
plugins/memblaze: code refactor on applying __packed on more structs

applying __packed on more structs

Signed-off-by: jinhua.huang <jinhua.huang@memblaze.com>
16 months agoplugins/memblaze: code refactor on using cleanup_nvme_dev
jinhua.huang [Wed, 27 Mar 2024 02:08:55 +0000 (10:08 +0800)]
plugins/memblaze: code refactor on using cleanup_nvme_dev

using cleanup_nvme_dev to open/close device

Signed-off-by: jinhua.huang <jinhua.huang@memblaze.com>
16 months agonvme: Fix to cleanup free raw_secret memory allocated
Tokunori Ikegami [Mon, 25 Mar 2024 15:55:04 +0000 (00:55 +0900)]
nvme: Fix to cleanup free raw_secret memory allocated

The memory is allocated by the gen-tls-key and check-tls-key commands.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
16 months agoplugins/memblaze: code-format on leading indent and align
jinhua.huang [Mon, 25 Mar 2024 06:37:34 +0000 (14:37 +0800)]
plugins/memblaze: code-format on leading indent and align

1. Set leading indent to tab
2. Set proper alignment as code len limitation

Signed-off-by: jinhua.huang <jinhua.huang@memblaze.com>
16 months agoplugins/wdc: Fix narrow index variable type in for loop to __u32
Tokunori Ikegami [Sun, 11 Feb 2024 15:06:04 +0000 (00:06 +0900)]
plugins/wdc: Fix narrow index variable type in for loop to __u32

Fix the comparison of narrow type with wide type in loop condition.

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