]> www.infradead.org Git - users/sagi/nvme-cli.git/log
users/sagi/nvme-cli.git
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>
16 months agodoc: Add get-feature cdw11 and set-feature cdw12 parameters
Tokunori Ikegami [Sun, 10 Mar 2024 10:33:03 +0000 (19:33 +0900)]
doc: Add get-feature cdw11 and set-feature cdw12 parameters

Those implemented but missed to described by the documentations.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
16 months agomicron-nvme: Unuse stat() to check if strMainDirName exists
Tokunori Ikegami [Sun, 10 Mar 2024 09:12:17 +0000 (18:12 +0900)]
micron-nvme: Unuse stat() to check if strMainDirName exists

It is checked by mkdir errno EEXIST instead.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
16 months agodoc: Fix get-property and set-property offset and value descriptions
Tokunori Ikegami [Sun, 10 Mar 2024 03:27:28 +0000 (12:27 +0900)]
doc: Fix get-property and set-property offset and value descriptions

Those parameters need the <offset> and <val> parameters values.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
16 months agodoc: Fix documentation file mode 100755 to 100644
Tokunori Ikegami [Sat, 17 Feb 2024 18:31:14 +0000 (03:31 +0900)]
doc: Fix documentation file mode 100755 to 100644

Only the get-property and set-property commands fixed errors.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
16 months agonvme-print-stdout: Fix channel configuration descriptors pointer
Tokunori Ikegami [Sun, 10 Mar 2024 04:44:45 +0000 (13:44 +0900)]
nvme-print-stdout: Fix channel configuration descriptors pointer

Set the address after NVM set EGSETS - 1 identifier parameter.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
16 months agonvme-print-stdout: Check sscanf return value
Tokunori Ikegami [Sun, 10 Mar 2024 04:53:49 +0000 (13:53 +0900)]
nvme-print-stdout: Check sscanf return value

To fix linux kernel check patch error.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
16 months agonvme-print-stdout: Fix linux kernel check patch errors
Tokunori Ikegami [Sat, 17 Feb 2024 04:35:49 +0000 (13:35 +0900)]
nvme-print-stdout: 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>
16 months agonvme: Delete unusual fallthrough for cases have no body
Tokunori Ikegami [Mon, 5 Feb 2024 13:05:37 +0000 (22:05 +0900)]
nvme: Delete unusual fallthrough for cases have no body

All the cases listed adjacently and use only for cases have any body.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
16 months agonvme: Delete duplicated semicolon
Tokunori Ikegami [Mon, 22 Jan 2024 16:53:13 +0000 (01:53 +0900)]
nvme: Delete duplicated semicolon

Fix for the checkpatch.pl error.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
16 months agonvme-print, common: Fix for whitespace change
Tokunori Ikegami [Sun, 10 Mar 2024 05:06:09 +0000 (14:06 +0900)]
nvme-print, common: Fix for whitespace change

Fix to change space characters for indentation to tab characters.
Delete a space between cast parentheses and variable.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
16 months agologging: output ioctl debugging info
Daniel Wagner [Wed, 6 Mar 2024 08:54:39 +0000 (09:54 +0100)]
logging: output ioctl debugging info

Instead pushing insane logging infra code into the library, let's keep
this stuff in the frontend. This is done by providing our own version
of the low level ioctl function as the library is exposing this as weak
symbol. This allows us to print the passthru structures and also the
timing information.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
16 months agonvme: track verbose level
Daniel Wagner [Wed, 6 Mar 2024 08:36:23 +0000 (09:36 +0100)]
nvme: track verbose level

The command line option parser is able to count how many times 'verbose'
is provided by the user. This increases the verbosity level. Use this
for mapping it to the correct log_level.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
16 months agologging: track log level globally
Daniel Wagner [Wed, 6 Mar 2024 08:15:13 +0000 (09:15 +0100)]
logging: track log level globally

Preparation patch to enable verbose/debug logging in parts where we
don't have the nvme_root_t object introduce a global logging level
variable.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
16 months agologging: move logging code to a new file
Daniel Wagner [Tue, 5 Mar 2024 16:44:02 +0000 (17:44 +0100)]
logging: move logging code to a new file

In preparation to extend the logging use case move the existing code to
a new location.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
16 months agonvme: update include for libnvme
Daniel Wagner [Tue, 5 Mar 2024 16:37:04 +0000 (17:37 +0100)]
nvme: update include for libnvme

This header file is not a local header file, it's the main header from
libnvme. Thus use the correct include statement.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
16 months agonvme: remove unused declaration
Daniel Wagner [Tue, 5 Mar 2024 16:11:17 +0000 (17:11 +0100)]
nvme: remove unused declaration

There is no user for current_index, thus remove it

Signed-off-by: Daniel Wagner <dwagner@suse.de>
16 months agobuild: bump libnvme wrap
Daniel Wagner [Wed, 6 Mar 2024 09:57:27 +0000 (10:57 +0100)]
build: bump libnvme wrap

Fetch the new low level passthru functions.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
16 months agonvme-netapp: add nspath tlv handling
Martin George [Tue, 5 Mar 2024 12:39:57 +0000 (18:09 +0530)]
nvme-netapp: add nspath tlv handling

Add nspath tlv handling logic to the NetApp plugin.

Signed-off-by: Martin George <marting@netapp.com>
16 months agorpm: Add missing rule and service files
Minsik Jeon [Tue, 5 Mar 2024 10:25:31 +0000 (19:25 +0900)]
rpm: Add missing rule and service files

Rule and service were added previously.
But rule and service files were not added the spec file.
So add missing rule and service files.

make rpm result:
Installed (but unpackaged) file(s) found:
/usr/local/lib/systemd/system/nvmf-connect-nbft.service
/usr/local/lib/udev/rules.d/65-persistent-net-nbft.rules

Signed-off-by: Minsik Jeon <hmi.jeon@samsung.com>
Co-authored-by: Ra See <tkwpvk789@gmail.com>
16 months agonvme-print-json, nvme-print-stdout: Use CHAR_BIT definition
Tokunori Ikegami [Mon, 4 Mar 2024 15:06:50 +0000 (00:06 +0900)]
nvme-print-json, nvme-print-stdout: Use CHAR_BIT definition

Instead of the hardcoded value use the macro definition.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
16 months agonvme-print-stdout: Delete duplicated if condition checking line
Tokunori Ikegami [Mon, 4 Mar 2024 15:01:28 +0000 (00:01 +0900)]
nvme-print-stdout: Delete duplicated if condition checking line

nvme_pel_event_to_string() checked twice in stdout_add_bitmap().

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
16 months agoocp: Fix timestamp displayed by fw-activate-history command
jeff-lien-wdc [Mon, 4 Mar 2024 20:31:26 +0000 (14:31 -0600)]
ocp: Fix timestamp displayed by fw-activate-history command

The current code is displaying all 8 bytes of the timestamp
field for the timestamp.  The timestamp value is only in
the first 6 bytes. The 7th byte contains the origin and
synch fields and the 8th byte is reserved.

Signed-off-by: jeff-lien-wdc <jeff.lien@wdc.com>
16 months agowdc: Add support for the get-drive-status command to SN861
jeff-lien-wdc [Fri, 1 Mar 2024 22:01:40 +0000 (16:01 -0600)]
wdc: Add support for the get-drive-status command to SN861

This change will use UUID lists to access the WD C2 log
page and retrieve the correct info needed to display the
drive status.

Signed-off-by: jeff-lien-wdc <jeff.lien@wdc.com>
16 months agonvme-print: Fix nvme_host_metadata_type_to_string() indentation errors
Tokunori Ikegami [Mon, 26 Feb 2024 15:57:18 +0000 (00:57 +0900)]
nvme-print: Fix nvme_host_metadata_type_to_string() indentation errors

Change white space indentations to use tab spaces.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
16 months agonvme-print: Add PEL RCI port identifier type printf function
Tokunori Ikegami [Mon, 26 Feb 2024 15:52:02 +0000 (00:52 +0900)]
nvme-print: Add PEL RCI port identifier type printf function

Change to use NVME_PEL_RCI_RCPIT definitions.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
16 months agonvme-print-stdout: Use persistent event log RCI definitions
Tokunori Ikegami [Sun, 25 Feb 2024 15:28:31 +0000 (00:28 +0900)]
nvme-print-stdout: Use persistent event log RCI definitions

Change the hardcoded the register bit shift to use the definitions.

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

Include PEL changes.

Signed-off-by: Daniel Wagner <dwagner@suse.de>