]> www.infradead.org Git - users/sagi/nvme-cli.git/log
users/sagi/nvme-cli.git
15 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>
15 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>
15 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>
16 months agoplugins/wdc: Whitespace changes
Tokunori Ikegami [Sun, 11 Feb 2024 15:01:56 +0000 (00:01 +0900)]
plugins/wdc: Whitespace changes

Delete the loop variable since not changed the value.
Also delete the some variables initial values not necessary.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
16 months agonvme: Delete unused nvme root scanned
Tokunori Ikegami [Fri, 22 Mar 2024 12:52:59 +0000 (21:52 +0900)]
nvme: Delete unused nvme root scanned

The mmap registers has been changed to not use the nvme root.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
16 months agoocp: support OCP 2.5 Set Telemetry Profile feature
Brandon Paupore [Thu, 14 Dec 2023 19:23:03 +0000 (13:23 -0600)]
ocp: support OCP 2.5 Set Telemetry Profile feature

Adds a new OCP plugin function to set the device telemetry profile,
configuring what debug data shall be collected by the device.

Signed-off-by: Brandon Paupore <brandon.paupore@wdc.com>
16 months agonvme: Don't seg fault if given device is not char/block device
Nilay Shroff [Sun, 17 Mar 2024 11:36:22 +0000 (17:06 +0530)]
nvme: Don't seg fault if given device is not char/block device

If the given device name is not char/block device then in
open_dev_direct() set errno to ENODEV and err to -1 before
returning to the dev_fd(). This would then ensure that in
case of error, dev_fd() returns the corerct negative error
code back to its callers. So now the callers of dev_fd()
would handle the error appropriately instead of try
accessing the nvme_dev which would be NULL.

Signed-off-by: Nilay Shroff <nilay@linux.ibm.com>
Signed-off-by: Daniel Wagner <dwagner@suse.de>
16 months agonbft: Include SSNS index in error messages
Tomas Bzatek [Thu, 15 Feb 2024 14:37:51 +0000 (09:37 -0500)]
nbft: Include SSNS index in error messages

In case of complex NBFT tables, multiple messages printed out
start to get confusing. Better to print SSNS indexes for easier
identification in further debugging.

Signed-off-by: Tomas Bzatek <tbzatek@redhat.com>
16 months agonbft: Pause logging for expected connection failures
Tomas Bzatek [Tue, 13 Feb 2024 14:54:15 +0000 (09:54 -0500)]
nbft: Pause logging for expected connection failures

For unavailable SSNSs, pause logging to make connection
attempts truly silent.

Kernel errors are still being logged, e.g.
  nvme nvme8: failed to connect socket: -110

Signed-off-by: Tomas Bzatek <tbzatek@redhat.com>
16 months agonbft: Silence connection failures for unavailable SSNS
Tomas Bzatek [Tue, 13 Feb 2024 14:26:14 +0000 (09:26 -0500)]
nbft: Silence connection failures for unavailable SSNS

In case a SSNS is marked as 'unavailable' by the firmware,
let's give it another try but silence any errors.

Signed-off-by: Tomas Bzatek <tbzatek@redhat.com>
16 months agonbft: Fix 'verbose' argument type
Tomas Bzatek [Thu, 7 Mar 2024 16:03:38 +0000 (17:03 +0100)]
nbft: Fix 'verbose' argument type

nvme-cli logging offers multiple levels now.

Signed-off-by: Tomas Bzatek <tbzatek@redhat.com>
16 months agoplugins/nbft: Implement verbose logging
Tomas Bzatek [Fri, 8 Mar 2024 16:39:45 +0000 (17:39 +0100)]
plugins/nbft: Implement verbose logging

Useful for debugging the libnvme NBFT parser.
Specify '-vv' for debugging messages.

Signed-off-by: Tomas Bzatek <tbzatek@redhat.com>
16 months agoplugins/nbft: Print the new SSNS flags
Tomas Bzatek [Mon, 12 Feb 2024 16:11:17 +0000 (17:11 +0100)]
plugins/nbft: Print the new SSNS flags

New 'unavailable' and 'discovered' flags.
JSON only for the moment.

Signed-off-by: Tomas Bzatek <tbzatek@redhat.com>
16 months agonbft: Fix uninitialized variable
Tomas Bzatek [Tue, 19 Mar 2024 13:31:13 +0000 (14:31 +0100)]
nbft: Fix uninitialized variable

../nbft.c:106:28: warning: variable 'entry' is uninitialized when used here [-Wuninitialized]
  106 |         list_for_each(&nbft_list, entry, node)
      |                                   ^~~~~
../ccan/ccan/list/list.h:524:40: note: expanded from macro 'list_for_each'
  524 |         list_for_each_off(h, i, list_off_var_(i, member))
      |                                               ^
../ccan/ccan/list/list.h:824:21: note: expanded from macro 'list_off_var_'
  824 |         (container_off_var(var, member) +               \
      |                            ^~~
../ccan/ccan/container_of/container_of.h:142:19: note: expanded from macro 'container_off_var'
  142 |         ((const char *)&(var)->member - (const char *)(var))
      |                          ^~~
../ccan/ccan/list/list.h:738:34: note: expanded from macro 'list_for_each_off'
  738 |         list_for_each_off_dir_((h),(i),(off),next)
      |                                         ^~~
../ccan/ccan/list/list.h:693:9: note: expanded from macro 'list_for_each_off_dir_'
  693 |                                    (off));                              \
      |                                     ^~~
../nbft.c:90:31: note: initialize the variable 'entry' to silence this warning
   90 |         struct nbft_file_entry *entry;
      |                                      ^
      |                                       = NULL

Signed-off-by: Tomas Bzatek <tbzatek@redhat.com>
16 months agoplugins/nbft: Fix uninitialized variables
Tomas Bzatek [Tue, 19 Mar 2024 13:29:37 +0000 (14:29 +0100)]
plugins/nbft: Fix uninitialized variables

../plugins/nbft/nbft-plugin.c:328:27: warning: variable 'entry' is uninitialized when used here [-Wuninitialized]
  328 |         list_for_each(nbft_list, entry, node) {
      |                                  ^~~~~
../ccan/ccan/list/list.h:524:40: note: expanded from macro 'list_for_each'
  524 |         list_for_each_off(h, i, list_off_var_(i, member))
      |                                               ^
../ccan/ccan/list/list.h:824:21: note: expanded from macro 'list_off_var_'
  824 |         (container_off_var(var, member) +               \
      |                            ^~~
../ccan/ccan/container_of/container_of.h:142:19: note: expanded from macro 'container_off_var'
  142 |         ((const char *)&(var)->member - (const char *)(var))
      |                          ^~~
../ccan/ccan/list/list.h:738:34: note: expanded from macro 'list_for_each_off'
  738 |         list_for_each_off_dir_((h),(i),(off),next)
      |                                         ^~~
../ccan/ccan/list/list.h:693:9: note: expanded from macro 'list_for_each_off_dir_'
  693 |                                    (off));                              \
      |                                     ^~~
../plugins/nbft/nbft-plugin.c:322:31: note: initialize the variable 'entry' to silence this warning
  322 |         struct nbft_file_entry *entry;
      |                                      ^
      |                                       = NULL

../plugins/nbft/nbft-plugin.c:515:27: warning: variable 'entry' is uninitialized when used here [-Wuninitialized]
  515 |         list_for_each(nbft_list, entry, node) {
      |                                  ^~~~~
../ccan/ccan/list/list.h:524:40: note: expanded from macro 'list_for_each'
  524 |         list_for_each_off(h, i, list_off_var_(i, member))
      |                                               ^
../ccan/ccan/list/list.h:824:21: note: expanded from macro 'list_off_var_'
  824 |         (container_off_var(var, member) +               \
      |                            ^~~
../ccan/ccan/container_of/container_of.h:142:19: note: expanded from macro 'container_off_var'
  142 |         ((const char *)&(var)->member - (const char *)(var))
      |                          ^~~
../ccan/ccan/list/list.h:738:34: note: expanded from macro 'list_for_each_off'
  738 |         list_for_each_off_dir_((h),(i),(off),next)
      |                                         ^~~
../ccan/ccan/list/list.h:693:9: note: expanded from macro 'list_for_each_off_dir_'
  693 |                                    (off));                              \
      |                                     ^~~
../plugins/nbft/nbft-plugin.c:513:31: note: initialize the variable 'entry' to silence this warning
  513 |         struct nbft_file_entry *entry;
      |                                      ^
      |                                       = NULL

Signed-off-by: Tomas Bzatek <tbzatek@redhat.com>
16 months agoplugins/sed: Fix uninitialized variable
Tomas Bzatek [Tue, 19 Mar 2024 13:40:33 +0000 (14:40 +0100)]
plugins/sed: Fix uninitialized variable

../plugins/sed/sedopal_cmd.c: In function ‘sedopal_cmd_discover’:
../plugins/sed/sedopal_cmd.c:506:17: warning: ‘locking_flags’ may be used uninitialized [-Wmaybe-uninitialized]
  506 |                 sedopal_print_locking_features(locking_flags);
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../plugins/sed/sedopal_cmd.c:459:17: note: ‘locking_flags’ was declared here
  459 |         uint8_t locking_flags;
      |                 ^~~~~~~~~~~~~

Signed-off-by: Tomas Bzatek <tbzatek@redhat.com>
16 months agonvme-print-stdout: Fix uninitialized variable
Tomas Bzatek [Tue, 19 Mar 2024 13:28:03 +0000 (14:28 +0100)]
nvme-print-stdout: Fix uninitialized variable

../nvme-print-stdout.c:3796:22: warning: variable 'node' is uninitialized when used here [-Wuninitialized]
 3796 |         list_for_each(list, node, node) {
      |                             ^~~~
../ccan/ccan/list/list.h:524:40: note: expanded from macro 'list_for_each'
  524 |         list_for_each_off(h, i, list_off_var_(i, member))
      |                                               ^
../ccan/ccan/list/list.h:824:21: note: expanded from macro 'list_off_var_'
  824 |         (container_off_var(var, member) +               \
      |                            ^~~
../ccan/ccan/container_of/container_of.h:142:19: note: expanded from macro 'container_off_var'
  142 |         ((const char *)&(var)->member - (const char *)(var))
      |                          ^~~
../ccan/ccan/list/list.h:738:34: note: expanded from macro 'list_for_each_off'
  738 |         list_for_each_off_dir_((h),(i),(off),next)
      |                                         ^~~
../ccan/ccan/list/list.h:693:9: note: expanded from macro 'list_for_each_off_dir_'
  693 |                                    (off));                              \
      |                                     ^~~
../nvme-print-stdout.c:3794:31: note: initialize the variable 'node' to silence this warning
 3794 |         nvme_effects_log_node_t *node;
      |                                      ^
      |                                       = NULL

Signed-off-by: Tomas Bzatek <tbzatek@redhat.com>
16 months agonvme-print-json: Fix uninitialized variable
Tomas Bzatek [Tue, 19 Mar 2024 13:25:17 +0000 (14:25 +0100)]
nvme-print-json: Fix uninitialized variable

../nvme-print-json.c:1340:22: warning: variable 'node' is uninitialized when used here [-Wuninitialized]
 1340 |         list_for_each(list, node, node) {
      |                             ^~~~
../ccan/ccan/list/list.h:524:40: note: expanded from macro 'list_for_each'
  524 |         list_for_each_off(h, i, list_off_var_(i, member))
      |                                               ^
../ccan/ccan/list/list.h:824:21: note: expanded from macro 'list_off_var_'
  824 |         (container_off_var(var, member) +               \
      |                            ^~~
../ccan/ccan/container_of/container_of.h:142:19: note: expanded from macro 'container_off_var'
  142 |         ((const char *)&(var)->member - (const char *)(var))
      |                          ^~~
../ccan/ccan/list/list.h:738:34: note: expanded from macro 'list_for_each_off'
  738 |         list_for_each_off_dir_((h),(i),(off),next)
      |                                         ^~~
../ccan/ccan/list/list.h:693:9: note: expanded from macro 'list_for_each_off_dir_'
  693 |                                    (off));                              \
      |                                     ^~~
../nvme-print-json.c:1338:31: note: initialize the variable 'node' to silence this warning
 1338 |         nvme_effects_log_node_t *node;
      |                                      ^
      |                                       = NULL

Signed-off-by: Tomas Bzatek <tbzatek@redhat.com>
16 months agobuild: Switch default meson buildtype to 'debugoptimized'
Tomas Bzatek [Tue, 19 Mar 2024 14:06:45 +0000 (15:06 +0100)]
build: Switch default meson buildtype to 'debugoptimized'

The meson 'debug' buildtype defaults to '-O0 -g' which misses
some important compiler warnings (as of gcc-13). While there's
no universal solution, the 'debugoptimized' buildtype supplies
'-O2 -g' that appears to be a reasonable compromise for having
important compiler warnings by default.

Either way, the specified warning_level=1 always supplies
'-Wall' that is unfortunately not enough with '-O0'.

Signed-off-by: Tomas Bzatek <tbzatek@redhat.com>
16 months agonvme: do not scan topology when mmaping registers
Daniel Wagner [Tue, 19 Mar 2024 12:45:30 +0000 (13:45 +0100)]
nvme: do not scan topology when mmaping registers

For accessing the registers we don't need to scan the topology. With the
device name we already know where to lookup the resource0 file in sysfs.

We also don't need to do the fallback lookup via the namespaces because
Linux kernel v4.0 has introduced the link in /sys/class/nvme/nvme%d. And
nvme-cli 2.x depends on Linux kernel >= 4.15, so it's safe to drop the
fallback.

This avoids all the topology scanning which is excessive and also might
issue an 'id command' via the nuse sysfs entry. So let's not do it.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
16 months agonvme-print-stdout: Use NVME_BOOT_PARTITION_INFO field definitions
Tokunori Ikegami [Sun, 17 Mar 2024 11:58:01 +0000 (20:58 +0900)]
nvme-print-stdout: 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>
16 months agonvme-print-stdout: Use NVME_GET for MI commands supported and effects CSP
Tokunori Ikegami [Sun, 17 Mar 2024 11:24:36 +0000 (20:24 +0900)]
nvme-print-stdout: Use NVME_GET for MI commands supported and effects CSP

Use it with NVME_MI_CMD_SUPPORTED_EFFECTS register definitions existed.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
16 months agonvme-print-stdout: Use NVME_GET for FID supported and effects FSP
Tokunori Ikegami [Sun, 17 Mar 2024 11:11:12 +0000 (20:11 +0900)]
nvme-print-stdout: Use NVME_GET for FID supported and effects FSP

Use it with NVME_FID_SUPPORTED_EFFECTS register definitions existed.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
16 months agonvme-print-stdout: Use NVME_SET_FEAT_EVENT register definitions
Tokunori Ikegami [Sun, 17 Mar 2024 10:22:30 +0000 (19:22 +0900)]
nvme-print-stdout: Use NVME_SET_FEAT_EVENT register definitions

Change it instead of hardcoded register mask and shift values.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
16 months agonvme-print: Add PEL EHAI port identifier type printf function
Tokunori Ikegami [Fri, 15 Mar 2024 14:55:28 +0000 (23:55 +0900)]
nvme-print: Add PEL EHAI port identifier type printf function

Change to use NVME_PEL_EHAI_PIT definitions.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
16 months agobuild: bump libnvme wrap
Daniel Wagner [Tue, 19 Mar 2024 09:18:18 +0000 (10:18 +0100)]
build: bump libnvme wrap

Include latest libnvme changes.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
16 months agoocp: fix for power-state argument checking
Brandon Paupore [Thu, 14 Dec 2023 20:15:31 +0000 (14:15 -0600)]
ocp: fix for power-state argument checking

Noticed this as part of supporting set-telemetry-profile, it seems that
the power-state option is not being detected properly. With this fix the
function is able to enter set_dssd_power_state when given the option or
its alias.

Signed-off-by: Brandon Paupore <brandon.paupore@wdc.com>
16 months agonvme: do not issue warning when nvme_core module is not loaded
Daniel Wagner [Tue, 19 Mar 2024 08:53:09 +0000 (09:53 +0100)]
nvme: do not issue warning when nvme_core module is not loaded

nvme 1.x did not issue an warning when the nvme_core module was not
loaded. Make 2.x behave in the same way.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
16 months agowdc: Review changes and build fixes
jeff-lien-wdc [Wed, 13 Mar 2024 01:23:09 +0000 (20:23 -0500)]
wdc: Review changes and build fixes

Changes based on review comments.
Fixed build errors building timestamp string.
Fixed lines over the 100 char limit.

Signed-off-by: jeff-lien-wdc <jeff.lien@wdc.com>
16 months agowdc: Fix timestamp displayed by vs-firmware-activate-history command
jeff-lien-wdc [Tue, 5 Mar 2024 21:22:00 +0000 (15:22 -0600)]
wdc:  Fix timestamp displayed by vs-firmware-activate-history command

The actual timestamp value is in bytes 0:5 of the 8 byte field.
The code was using all 8 bytes so a change was made to mask off
the top 2 bytes.  The timestamp calculations were also simplified
to be more maintainable.

Signed-off-by: jeff-lien-wdc <jeff.lien@wdc.com>
16 months agologging: Split to output ioctl latency by log info level
Tokunori Ikegami [Wed, 13 Mar 2024 16:09:40 +0000 (01:09 +0900)]
logging: Split to output ioctl latency by log info level

This is for only output latency but not output other debugging info.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
16 months agonvme-print-stdout: Change hexadecimal value 0x prefix to use %#x
Tokunori Ikegami [Wed, 13 Mar 2024 15:45:20 +0000 (00:45 +0900)]
nvme-print-stdout: Change hexadecimal value 0x prefix to use %#x

Also channge 64bit value to use  %#"PRIx64" instead of 0x%"PRIx64".

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
16 months agonvme-print-stdout: Fix LBA status DSLBA output as hexadecimal
Tokunori Ikegami [Wed, 13 Mar 2024 15:08:32 +0000 (00:08 +0900)]
nvme-print-stdout: Fix LBA status DSLBA output as hexadecimal

The output printed with the 0x prefix but as not hexadecimal.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
16 months agonvme-print-stdout: Split line length exceeded 100 columns
Tokunori Ikegami [Tue, 12 Mar 2024 16:20:30 +0000 (01:20 +0900)]
nvme-print-stdout: Split line length exceeded 100 columns

This resolves checkpatch line length exceeding warning.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
16 months agonvme-print-stdout: Use NVME_PMRMSC register definitions to print
Tokunori Ikegami [Mon, 11 Mar 2024 15:09:50 +0000 (00:09 +0900)]
nvme-print-stdout: Use NVME_PMRMSC register definitions to print

Change it instead of hardcoded register mask and shift values.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
16 months agonvme-print-stdout: Use NVME_PMRSWTP register definitions to print
Tokunori Ikegami [Mon, 11 Mar 2024 14:40:14 +0000 (23:40 +0900)]
nvme-print-stdout: Use NVME_PMRSWTP register definitions to print

Change it instead of hardcoded register mask and shift values.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
16 months agonvme-print-stdout: Use NVME_PMREBS register definitions to print
Tokunori Ikegami [Mon, 11 Mar 2024 14:36:06 +0000 (23:36 +0900)]
nvme-print-stdout: Use NVME_PMREBS register definitions to print

Change it instead of hardcoded register mask and shift values.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
16 months agonvme-print-stdout: Use NVME_PMRSTS register definitions to print
Tokunori Ikegami [Mon, 11 Mar 2024 14:28:57 +0000 (23:28 +0900)]
nvme-print-stdout: Use NVME_PMRSTS register definitions to print

Change it instead of hardcoded register mask and shift values.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
16 months agonvme-print-stdout: Use NVME_PMRCTL_EN register definition to print
Tokunori Ikegami [Mon, 11 Mar 2024 14:15:25 +0000 (23:15 +0900)]
nvme-print-stdout: Use NVME_PMRCTL_EN register definition to print

Change it instead of hardcoded register mask value.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
16 months agonvme-print-stdout: Use NVME_PMRCAP register definition to print
Tokunori Ikegami [Mon, 11 Mar 2024 14:04:11 +0000 (23:04 +0900)]
nvme-print-stdout: Use NVME_PMRCAP register definition to print

Change it instead of hardcoded register mask and shift values.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
16 months agodoc: Fix admin and io passthru cdw parameters description
Tokunori Ikegami [Sun, 10 Mar 2024 11:38:55 +0000 (20:38 +0900)]
doc: Fix admin and io passthru cdw parameters description

Fixes: 2f31c7905558 ("doc: Documentations maintenance changes")
Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>