]> www.infradead.org Git - users/sagi/nvme-cli.git/log
users/sagi/nvme-cli.git
18 months agoplugins/memblaze: Add smart-log-add and latency-feature functions
jinhua.huang [Thu, 12 Oct 2023 08:27:43 +0000 (16:27 +0800)]
plugins/memblaze: Add smart-log-add and latency-feature functions

1. add smart-log-add, latency-feature functions
2. convert code style to align with linux kernel code style
3. using __packed instead of pragma style

Signed-off-by: jinhua.huang <jinhua.huang@memblaze.com>
18 months agoplugins/solidigm: internal-logs Telemetry auto detect last data area.
da Cunha, Leonardo [Wed, 6 Sep 2023 13:45:46 +0000 (06:45 -0700)]
plugins/solidigm: internal-logs Telemetry auto detect last data area.
Faster telemetry retrieval using large buffers.

Signed-off-by: leonardo.da.cunha <leonardo.da.cunha@solidigm.com>
18 months agonvme: Change to use NVME_FLBAS_META_EXT() macro to check flbas value
Tokunori Ikegami [Thu, 12 Oct 2023 13:07:39 +0000 (22:07 +0900)]
nvme: Change to use NVME_FLBAS_META_EXT() macro to check flbas value

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
18 months agonvme-print-json: Add host memory buffer and timestamp features print functions
Tokunori Ikegami [Wed, 11 Oct 2023 16:11:14 +0000 (01:11 +0900)]
nvme-print-json: Add host memory buffer and timestamp features print functions

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
18 months agonvme-print-json: Add feature fields print functions
Tokunori Ikegami [Tue, 10 Oct 2023 16:41:21 +0000 (01:41 +0900)]
nvme-print-json: Add feature fields print functions

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
18 months agonvme-print-json: Add TMPTH feature print function
Tokunori Ikegami [Mon, 9 Oct 2023 15:26:00 +0000 (00:26 +0900)]
nvme-print-json: Add TMPTH feature print function

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
18 months agonvme-print-json: Add show_feature_fields print function
Tokunori Ikegami [Mon, 9 Oct 2023 14:15:47 +0000 (23:15 +0900)]
nvme-print-json: Add show_feature_fields print function

Note: Only partial features are supported yet since still under
      implementing for remaining features.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
18 months agonvme-print-json: Add select_result print function
Tokunori Ikegami [Mon, 9 Oct 2023 12:24:56 +0000 (21:24 +0900)]
nvme-print-json: Add select_result print function

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
18 months agonvme-print-json: Use json_print to print and free object
Tokunori Ikegami [Mon, 9 Oct 2023 05:51:57 +0000 (14:51 +0900)]
nvme-print-json: Use json_print to print and free object

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
18 months agonvme-print-json: Add lba_status print function
Tokunori Ikegami [Mon, 9 Oct 2023 05:30:54 +0000 (14:30 +0900)]
nvme-print-json: Add lba_status print function

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
18 months agonvme-print-json: Combine variable definition and setting value
Tokunori Ikegami [Mon, 9 Oct 2023 04:14:37 +0000 (13:14 +0900)]
nvme-print-json: Combine variable definition and setting value

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
18 months agonvme-print-json: Add id_iocs print function
Tokunori Ikegami [Mon, 9 Oct 2023 01:35:47 +0000 (10:35 +0900)]
nvme-print-json: Add id_iocs print function

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
18 months agonvme-print-stdout: Fix coding style errors
Tokunori Ikegami [Sun, 8 Oct 2023 07:45:52 +0000 (16:45 +0900)]
nvme-print-stdout: Fix coding style errors

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
18 months agonvme-print-json: Add directive print function
Tokunori Ikegami [Sun, 8 Oct 2023 07:44:26 +0000 (16:44 +0900)]
nvme-print-json: Add directive print function

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
18 months agonvme: Fixed segmentation fault when getting host initiated telemetry
da Cunha, Leonardo [Wed, 11 Oct 2023 16:01:44 +0000 (09:01 -0700)]
nvme: Fixed segmentation fault when getting host initiated telemetry

Signed-off-by: leonardo.da.cunha <leonardo.da.cunha@solidigm.com>
18 months agoplugins/wdc: enhanced SN861 device support
Brandon Paupore [Wed, 11 Oct 2023 22:20:28 +0000 (17:20 -0500)]
plugins/wdc: enhanced SN861 device support

This commit enables several commands to work with this device properly
and adds a new plugin command set-latency-monitor-feature.

Reviewed-by: Jeffrey Lien <jeff.lien@wdc.com>
Signed-off-by: Brandon Paupore <brandon.paupore@wdc.com>
18 months agoplugins/wdc: cleanup line lengths
Brandon Paupore [Wed, 11 Oct 2023 22:20:11 +0000 (17:20 -0500)]
plugins/wdc: cleanup line lengths

Signed-off-by: Brandon Paupore <brandon.paupore@wdc.com>
18 months agonvme: do not include meta data for PRACT=1 and MD=8
Daniel Wagner [Wed, 11 Oct 2023 13:04:34 +0000 (15:04 +0200)]
nvme: do not include meta data for PRACT=1 and MD=8

No meta data is transfered for PRACT=1 and MD=8:
   5.2.2.1 Protection Information and Write Commands
   5.2.2.2 Protection Informatio and Read Commands

Signed-off-by: Daniel Wagner <dwagner@suse.de>
18 months agonvme: use block-count arg if provided
Daniel Wagner [Wed, 11 Oct 2023 12:29:52 +0000 (14:29 +0200)]
nvme: use block-count arg if provided

When the user provides the --block-count argument use this value and
don't be clever and try to calculate the value. This is not what
the user asked us to do.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
18 months agobuild: bump libnvme to disable tests option
Steven Seungcheol Lee [Wed, 11 Oct 2023 10:45:03 +0000 (19:45 +0900)]
build: bump libnvme to disable tests option

it occur multiple definition error with static build
project use successful build of subproject revision (no need to build tests)

Signed-off-by: Steven Seungcheol Lee <sc108.lee@samsung.com>
18 months agobuild: Add static build on CI target
Steven Seungcheol Lee [Wed, 11 Oct 2023 10:06:39 +0000 (19:06 +0900)]
build: Add static build on CI target

Update container image as debian:latest(targets run on ubuntu-latest)

Co-authored-by: Daniel Wagner <dwagner@suse.de>
Signed-off-by: Steven Seungcheol Lee <sc108.lee@samsung.com>
18 months agomeson: Add libhugetlbfs option to not included in static
Steven Seungcheol Lee [Wed, 11 Oct 2023 05:52:00 +0000 (14:52 +0900)]
meson: Add libhugetlbfs option to not included in static

libhugetlbfs does not support static library
https://github.com/libhugetlbfs/libhugetlbfs/issues/11

Signed-off-by: Steven Seungcheol Lee <sc108.lee@samsung.com>
18 months agoMakefile: add standalone build
Steven Seungcheol Lee [Fri, 8 Sep 2023 05:10:22 +0000 (14:10 +0900)]
Makefile: add standalone build

To handover build binary for different environment users
Build result checked with ldd below
[root@localhost .build]# ldd nvme
        not a dynamic executable
Do not run libnvme tests(set subproject revision successful build)
Disable keyutils on libnvme(pkgconfig always find shared first when -llib is given)

Signed-off-by: Steven Seungcheol Lee <sc108.lee@samsung.com>
18 months agobuild: upload artifacts only for upstream repo
Daniel Wagner [Wed, 11 Oct 2023 09:56:06 +0000 (11:56 +0200)]
build: upload artifacts only for upstream repo

Only upload any artifacts to linux-nvme organization if it's NOT a fork.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
18 months agonvme-print: Add nvme_zns_start_zone_list() API function
Tokunori Ikegami [Sat, 7 Oct 2023 03:34:52 +0000 (12:34 +0900)]
nvme-print: Add nvme_zns_start_zone_list() API function

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
18 months agonvme-print: Add nvme_zns_finish_zone_list() API function
Tokunori Ikegami [Sat, 7 Oct 2023 03:22:57 +0000 (12:22 +0900)]
nvme-print: Add nvme_zns_finish_zone_list() API function

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
18 months agonvme-print-binary: Set list function to NULL if unimplemented
Tokunori Ikegami [Fri, 29 Sep 2023 15:35:12 +0000 (00:35 +0900)]
nvme-print-binary: Set list function to NULL if unimplemented

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
18 months agonvme-print-json: Change order list functions and set NULL if unimplemented
Tokunori Ikegami [Fri, 29 Sep 2023 12:07:17 +0000 (21:07 +0900)]
nvme-print-json: Change order list functions and set NULL if unimplemented

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
18 months agonvme-print-stdout: Fix to set stdout_list_item print function missed
Tokunori Ikegami [Thu, 28 Sep 2023 14:34:34 +0000 (23:34 +0900)]
nvme-print-stdout: Fix to set stdout_list_item print function missed

Also change order the list functions and set NULL if unused to make sure.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
18 months agoplugins/solidigm: log page name extraction using nvme_log_to_string function
shankara [Wed, 20 Sep 2023 09:36:56 +0000 (02:36 -0700)]
plugins/solidigm: log page name extraction using nvme_log_to_string function

Signed-off-by: shankaralingegowda <shankaralingegowda.singonahalli@solidigmtechnology.com>
18 months agonvme-print: Added missing logpage names in nvme_log_to_string function
shankara [Wed, 20 Sep 2023 08:13:06 +0000 (01:13 -0700)]
nvme-print: Added missing logpage names in nvme_log_to_string function

Signed-off-by: shankaralingegowda <shankaralingegowda.singonahalli@solidigmtechnology.com>
18 months agoudev-rules: rename netapp udev rule
Martin George [Thu, 5 Oct 2023 06:42:46 +0000 (12:12 +0530)]
udev-rules: rename netapp udev rule

Rename 71-nvmf-iopolicy-netapp.rules.in to 71-nvmf-netapp.rules.in
so as to make the name generic, since this not only sets the
iopolicy here but also modifies the ctrl_loss_tmo.

Signed-off-by: Martin George <marting@netapp.com>
18 months agoudev-rules: set ctrl_loss_tmo to -1 for ONTAP NVMe/TCP
Martin George [Tue, 3 Oct 2023 10:35:23 +0000 (16:05 +0530)]
udev-rules: set ctrl_loss_tmo to -1 for ONTAP NVMe/TCP

Setting ctrl_loss_tmo to -1 for ONTAP NVMe/TCP controllers would enable
indefinite reconnect attempts during a path loss and help avoid purging
the path on the host, which otherwise may lead to mounted fs read-only
behavior. So add a rule towards enabling the same.

Signed-off-by: Martin George <marting@netapp.com>
18 months agodoc: Regenerate all docs for v2.6 v2.6
Daniel Wagner [Fri, 29 Sep 2023 06:33:13 +0000 (08:33 +0200)]
doc: Regenerate all docs for v2.6

Signed-off-by: Daniel Wagner <dwagner@suse.de>
18 months agobuild: Update version to v2.6
Daniel Wagner [Fri, 29 Sep 2023 06:33:06 +0000 (08:33 +0200)]
build: Update version to v2.6

Signed-off-by: Daniel Wagner <dwagner@suse.de>
18 months agobuild: bump libnvme wrap to v1.6
Daniel Wagner [Fri, 29 Sep 2023 06:30:37 +0000 (08:30 +0200)]
build: bump libnvme wrap to v1.6

Signed-off-by: Daniel Wagner <dwagner@suse.de>
18 months agonvme: allocate payload buffer in create-ns command
Vikash Kumar [Thu, 28 Sep 2023 14:54:14 +0000 (20:24 +0530)]
nvme: allocate payload buffer in create-ns command

Fixes: 1a8bd305c61d ("nvme: allocate aligned payloads for all nvme commands")
Signed-off-by: Vikash Kumar <vikash.k5@samsung.com>
18 months agonvme-print-stdout: Add CAP.CPS and CAP.NSSS human readable outputs
Tokunori Ikegami [Wed, 27 Sep 2023 16:35:06 +0000 (01:35 +0900)]
nvme-print-stdout: Add CAP.CPS and CAP.NSSS human readable outputs

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
18 months agoREADME: Fix meson build badge
Martin Belanger [Wed, 27 Sep 2023 16:03:28 +0000 (12:03 -0400)]
README: Fix meson build badge

Signed-off-by: Martin Belanger <martin.belanger@dell.com>
18 months agonvme: Add output-format default option instead of argconfig json option
Tokunori Ikegami [Tue, 26 Sep 2023 15:09:35 +0000 (00:09 +0900)]
nvme: Add output-format default option instead of argconfig json option

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
18 months agonvme: fw-download offset only describes FW offset, not file offset
Jeremy Kerr [Sat, 23 Sep 2023 18:06:40 +0000 (11:06 -0700)]
nvme: fw-download offset only describes FW offset, not file offset

In e7ca3bcbdba, we (unintentionally) changed the semantics of the
fw-download's --offset argument to also apply an offset to the source
file.

According to https://github.com/linux-nvme/nvme-cli/issues/2013, the old
behaviour is useful when the source firmware image was provided in
separate chunks.

This change restored to the old hehaviour, where --offset only applies
to the destination firmware buffer on the device. This means that the
start of the source file will end up at the destination offset.

Fixes: https://github.com/linux-nvme/nvme-cli/issues/2013
Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
19 months agounit: add locale number test
Daniel Wagner [Mon, 25 Sep 2023 12:38:11 +0000 (14:38 +0200)]
unit: add locale number test

When the fr_FR.utf-8 locale is available test a string which has an
utf-8 encoded separator for a number.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
19 months agoutil: handle utf-8 thousend separators correctly
Daniel Wagner [Mon, 25 Sep 2023 12:32:23 +0000 (14:32 +0200)]
util: handle utf-8 thousend separators correctly

The separator char can be an utf-8 encoded symbol thus the length
of the string is necessarly one.

The check if we have to issue an separator needs to a fixed modulo of 3
or 4 (without or with l10n enabled) to place the symbol at the right
position in the string.

The copy loop needs to copy the all bytes from the back of the separator
byte sequence to the front, the same order we print the number.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
19 months agonvme: Change to use NVME_ARGS verbose default option from OPT_ARGS
Tokunori Ikegami [Sun, 24 Sep 2023 13:41:50 +0000 (22:41 +0900)]
nvme: Change to use NVME_ARGS verbose default option from OPT_ARGS

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
19 months agofabrics: Fix NVMF_ARGS macro to use parameter n correctly
Tokunori Ikegami [Fri, 22 Sep 2023 10:07:33 +0000 (19:07 +0900)]
fabrics: Fix NVMF_ARGS macro to use parameter n correctly

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
19 months agonvme: Add verbose default option to show command debug output
Tokunori Ikegami [Tue, 16 May 2023 00:10:34 +0000 (09:10 +0900)]
nvme: Add verbose default option to show command debug output

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
19 months agoutil: Fix to set argconfig output format json option correctly
Tokunori Ikegami [Tue, 12 Sep 2023 14:45:18 +0000 (23:45 +0900)]
util: Fix to set argconfig output format json option correctly

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
19 months agoutil: Split argconfig output format json function to set and get
Tokunori Ikegami [Tue, 12 Sep 2023 14:43:33 +0000 (23:43 +0900)]
util: Split argconfig output format json function to set and get

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
19 months agonvme: Spport Phy Rx Eye Opening Measurement Log
Brandon Paupore [Tue, 12 Sep 2023 21:46:09 +0000 (16:46 -0500)]
nvme: Spport Phy Rx Eye Opening Measurement Log

This implements support for TP4119a, adding a new command nvme
phy-rx-eom-log for issuing Get Log Page with the new Log Identifier and
allowing for configuration/validation of the Log Specific Parameters.

Signed-off-by: Brandon Paupore <brandon.paupore@wdc.com>
19 months agonvme: Introduce nvme_realloc function
Brandon Paupore [Fri, 22 Sep 2023 19:55:32 +0000 (14:55 -0500)]
nvme: Introduce nvme_realloc function

This attempts to preserve the functionality of realloc while also
ensuring the final memory is aligned.

Signed-off-by: Brandon Paupore <brandon.paupore@wdc.com>
19 months agonvme: Fix for fdpa reserved field printing
Brandon Paupore [Wed, 20 Sep 2023 15:00:19 +0000 (10:00 -0500)]
nvme: Fix for fdpa reserved field printing

Noticed this when adding similar behavior for phy_rx_eom_log's odp, it
doesn't make much sense to right-shift the byte by 8.

Signed-off-by: Brandon Paupore <brandon.paupore@wdc.com>
19 months agocompletion: add 'version' and 'help' to list
Daniel Wagner [Thu, 21 Sep 2023 09:03:35 +0000 (11:03 +0200)]
completion: add 'version' and 'help' to list

The variable containing the commands is call _cmds and not cmds, thus
the tab completion didn't work for 'version' and 'help'.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
19 months agoudev-rule: apply round-robin iopolicy on i/o subsystems alone
Martin George [Thu, 21 Sep 2023 06:48:26 +0000 (12:18 +0530)]
udev-rule: apply round-robin iopolicy on i/o subsystems alone

The current 71-nvmf-iopolicy-netapp.rules.in sets the round-robin
iopolicy not just on nvme i/o subsystems, but on discovery subsystems
too. Update this rule to have this applied to i/o subsystems alone.

Signed-off-by: Martin George <marting@netapp.com>
Cc: Clayton Skaggs <claytons@netapp.com>
19 months agonvme: Add support for the OAQD ID controller field
Brandon Paupore [Fri, 8 Sep 2023 20:31:18 +0000 (15:31 -0500)]
nvme: Add support for the OAQD ID controller field

Signed-off-by: Brandon Paupore <brandon.paupore@wdc.com>
19 months agobuild: bump libnvme wrap
Daniel Wagner [Thu, 21 Sep 2023 07:49:31 +0000 (09:49 +0200)]
build: bump libnvme wrap

Include the latest OAQD changes.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
19 months agoplugins/solidigm: use static log macro to calc bitmask
Daniel Wagner [Thu, 21 Sep 2023 07:17:12 +0000 (09:17 +0200)]
plugins/solidigm: use static log macro to calc bitmask

The mask is using the log2 function which pulls in the libm. The library
is not always available, e.g when building statically. This makes the
whole build logic way to complex for something like this.

Instead calculating during runtime the bitmask just use the static ilog
macros from ccan.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
19 months agobuild: abort CI builds on first error
Daniel Wagner [Wed, 20 Sep 2023 17:48:44 +0000 (19:48 +0200)]
build: abort CI builds on first error

Do not continue to build and hide any errors.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
19 months agoplugins/ocp: Rename FW activation history command
Arthur Shau [Mon, 5 Jun 2023 04:31:58 +0000 (21:31 -0700)]
plugins/ocp: Rename FW activation history command

Get rid of the "vs-" prefix in the fw-activate-history command to bring
it in line with the other command names

[dwagner: updated tab completion]
Signed-off-by: Daniel Wagner <dwagner@suse.de>
19 months agonvme: auto free nvme_dev resource
Daniel Wagner [Fri, 15 Sep 2023 09:33:48 +0000 (11:33 +0200)]
nvme: auto free nvme_dev resource

Use the cleanup infra structure to free the nvme_dev resource. This
allows us to use return directly and makes the code a bit more readable.

While at it also do the same for trivial filedescriptor cases. The more
complex cases such in submit_io() needs a bit more tinkering to get
right.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
19 months agonvme: allocate aligned payloads for all nvme commands
Daniel Wagner [Thu, 14 Sep 2023 12:33:35 +0000 (14:33 +0200)]
nvme: allocate aligned payloads for all nvme commands

The kernel supports since v5.2 direct mapped DMA buffers to userspace.
Up to this point a bounce buffer was involved. Because the buffers are
now directly accessed by the device, the rules of alignment also apply
for the payloads.

Use the newly introduced nvme_alloc helper to allocate correctly aligned
payloads for all nvme commands.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
19 months agonvme: introduce alloc helper with alignment support
Daniel Wagner [Thu, 14 Sep 2023 08:53:20 +0000 (10:53 +0200)]
nvme: introduce alloc helper with alignment support

The kernel supports since v5.2 direct mapped DMA buffers to userspace.
Up to this point a bounce buffer was involved. Because the buffers are
now directly accessed by the device, the rules of alignment also apply
for the payloads.

Introduce a helper to allocate all correctly buffers aligned.

Furthermore, ensure that the buffer is a multiple of 4k, because there
are devices on the market which will always transfer a multiple of 4k,
even if we ask for less, e.g 512 bytes. This avoid stack smashes.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
19 months agoutil: add cleanup function for generic memory allocations
Daniel Wagner [Thu, 14 Sep 2023 08:51:41 +0000 (10:51 +0200)]
util: add cleanup function for generic memory allocations

Introduce a cleanup helper function to free generic memory allocation
from malloc, calloc, etc.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
19 months agonvme: append huge to nvme_{alloc|free} function
Daniel Wagner [Thu, 14 Sep 2023 08:12:56 +0000 (10:12 +0200)]
nvme: append huge to nvme_{alloc|free} function

These two function are abstracting the libhugebtl API. Let's rename
Rename these functions because we want to introduce a generic alloc
function with alignment support.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
19 months agonvme: fw_download use nvme_alloc only
Daniel Wagner [Thu, 14 Sep 2023 08:01:56 +0000 (10:01 +0200)]
nvme: fw_download use nvme_alloc only

The nvme_alloc has already a built in check which version of the
allocation strategy should be used based on the len argument. There is
no need for fw_download to do this as well.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
19 months agofabrics: Removing duplicate code and moving to libnvme
Martin Belanger [Thu, 14 Sep 2023 15:47:19 +0000 (11:47 -0400)]
fabrics: Removing duplicate code and moving to libnvme

nvme-cli will now use the new libnvme functions nvme_ctrl_find()
and nvme_ctrl_config_match().

Signed-off-by: Martin Belanger <martin.belanger@dell.com>
19 months agobuild: Update libnvme git SHA to pull the right version
Martin Belanger [Thu, 14 Sep 2023 15:49:00 +0000 (11:49 -0400)]
build: Update libnvme git SHA to pull the right version

Signed-off-by: Martin Belanger <martin.belanger@dell.com>
19 months agonvme-print: omit size of protection information
Vincent Fu [Thu, 14 Sep 2023 19:01:17 +0000 (19:01 +0000)]
nvme-print: omit size of protection information

Protection information size is not always 8 bytes. For 16b Guard PI
format, the PI size is 8 bytes but for 32b and 64b Guard PI formats the
PI size is 16 bytes.

See Section 5.2.1 (pp. 76-79) of the NVM Command Set Specification
Revision 1.0c: https://nvmexpress.org/wp-content/uploads/NVM-Express-NVM-Command-Set-Specification-1.0c-2022.10.03-Ratified.pdf

To avoid confusion, omit the PI size.

Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
19 months agotree: Modify label name close_fd to close_dev
Steven Seungcheol Lee [Thu, 14 Sep 2023 05:32:16 +0000 (14:32 +0900)]
tree: Modify label name close_fd to close_dev

Use same label name for same purpose
it was missing modification of 11542bbdb1c1ad7b1f425925ce474c7ce06162d0

Signed-off-by: Steven Seungcheol Lee <sc108.lee@samsung.com>
19 months agofabrics: For TCP/RDMA, compare IP addresses with nvme_ipaddrs_eq()
Martin Belanger [Wed, 2 Aug 2023 13:44:35 +0000 (09:44 -0400)]
fabrics: For TCP/RDMA, compare IP addresses with nvme_ipaddrs_eq()

These are the same changes we've already made to __nvme_lookup_ctrl
in libnvme. IP addresses (especially IPv6) cannot be compared with
a simple strcmp() or strcmpcase().

Also, for consistency with libnvme and improved readability,
replace strcmp0()/strcmpcase0() by streq0()/streqcase0().

Signed-off-by: Martin Belanger <martin.belanger@dell.com>
19 months agofabrics: lookup_discovery_ctrl() must look under host and not root
Martin Belanger [Wed, 2 Aug 2023 13:38:56 +0000 (09:38 -0400)]
fabrics: lookup_discovery_ctrl() must look under host and not root

lookup_discovery_ctrl() was scanning the whole root looking for any
matching discovery controller (DC). Instead, it must look under the
host object. The problem happens when there are more than one Host
NQN used to connect to the same DC. In this case, we will have more
than 1 host object and it is important to search for existing DCs
under the right host object.

Signed-off-by: Martin Belanger <martin.belanger@dell.com>
19 months agonvme: Do not map status to errno codes
Steven Seungcheol Lee [Tue, 5 Sep 2023 02:39:03 +0000 (11:39 +0900)]
nvme: Do not map status to errno codes

this modification orignally applied in below commit
9643090317e8eef5b1f9b2c9abda18e06b3e5902

Signed-off-by: Steven Seungcheol Lee <sc108.lee@samsung.com>
19 months agocompletions: Add bash completion for DSSD Power state feature(FID: C7h)
Arunpandian J [Wed, 23 Aug 2023 08:55:04 +0000 (14:25 +0530)]
completions: Add bash completion for DSSD Power state feature(FID: C7h)

Signed-off-by: Arunpandian J <arun.j@samsung.com>
19 months agoDocumentation: Add document for DSSD Power state feature(FID: C7h)
Arunpandian J [Wed, 23 Aug 2023 08:53:17 +0000 (14:23 +0530)]
Documentation: Add document for DSSD Power state feature(FID: C7h)

Signed-off-by: Arunpandian J <arun.j@samsung.com>
19 months agoplugins/ocp: Add DSSD Power state feature(FID: C7h)
Arunpandian J [Wed, 23 Aug 2023 08:51:54 +0000 (14:21 +0530)]
plugins/ocp: Add DSSD Power state feature(FID: C7h)

Signed-off-by: Arunpandian J <arun.j@samsung.com>
19 months agobuild(deps): bump actions/checkout from 3 to 4
dependabot[bot] [Mon, 4 Sep 2023 18:49:37 +0000 (18:49 +0000)]
build(deps): bump actions/checkout from 3 to 4

Bumps [actions/checkout](https://github.com/actions/checkout) from 3 to 4.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v3...v4)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
19 months agoavoid casting pointer arguments to argconfig functions
Joy Gu [Thu, 24 Aug 2023 20:55:08 +0000 (13:55 -0700)]
avoid casting pointer arguments to argconfig functions

Same issue as 456a24e8daa7e0cccddfef7deaffe7b200358706 ("Don't cast
pointers, cast values."), which was undone in
18de3a6d61a7f090ecea9f6afa52c2d6591d1700 ("Convert to libnvme").

Add some functions to argconfig so that we can directly pass in
__u16/__u32/__u64 arrays without casting to int/long/etc, since an int
isn't always 32 bits, an unsigned long long isn't always 64 bits, etc.

Suggested-by: Randy Jennings <randyj@purestorage.com>
19 months agonvme-print: Add support for EGFEAT, Domain Identifier, TEGCAP and UEGCAP
Tokunori Ikegami [Mon, 21 Aug 2023 15:54:48 +0000 (00:54 +0900)]
nvme-print: Add support for EGFEAT, Domain Identifier, TEGCAP and UEGCAP

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
19 months agonvme-print: Fix endurance_log whitespace changes
Tokunori Ikegami [Mon, 21 Aug 2023 15:52:17 +0000 (00:52 +0900)]
nvme-print: Fix endurance_log whitespace changes

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
19 months agobuild: Bump libnvme wrap
Daniel Wagner [Mon, 4 Sep 2023 16:41:36 +0000 (18:41 +0200)]
build: Bump libnvme wrap

Fetch EGFEAT, Domain Identifier, TEGCAP and UEGCAP changes.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
19 months agonvme: Fix retrieval of telemetry log up to specified data area.
da Cunha, Leonardo [Wed, 16 Aug 2023 15:22:12 +0000 (08:22 -0700)]
nvme: Fix retrieval of telemetry log up to specified data area.

Signed-off-by: leonardo.da.cunha <leonardo.da.cunha@solidigm.com>
19 months agobuild: use latest container instead fixed version master
Daniel Wagner [Thu, 31 Aug 2023 14:26:11 +0000 (16:26 +0200)]
build: use latest container instead fixed version

We control the build containers so there is little risk
that these randomly break. So let's go with the latest
version and avoid updating the build files all the time.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
19 months agobuild: run tests before coverage tool
Daniel Wagner [Thu, 31 Aug 2023 12:15:46 +0000 (14:15 +0200)]
build: run tests before coverage tool

Signed-off-by: Daniel Wagner <dwagner@suse.de>
19 months agobuild: fix generation of coverage report
Daniel Wagner [Thu, 31 Aug 2023 11:59:51 +0000 (13:59 +0200)]
build: fix generation of coverage report

We need to to build the binaries before running the coverage report
tool.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
19 months agobuild: more style fixes for AppImage build
Daniel Wagner [Thu, 31 Aug 2023 11:39:40 +0000 (13:39 +0200)]
build: more style fixes for AppImage build

Signed-off-by: Daniel Wagner <dwagner@suse.de>
19 months agobuild: fix AppImage yaml file
Daniel Wagner [Thu, 31 Aug 2023 11:37:20 +0000 (13:37 +0200)]
build: fix AppImage yaml file

Signed-off-by: Daniel Wagner <dwagner@suse.de>
19 months agobuild: use prebuild containers for builds
Daniel Wagner [Thu, 31 Aug 2023 10:47:22 +0000 (12:47 +0200)]
build: use prebuild containers for builds

The builds keep failing because the install step fails. Use prebuild
containers which contain all the dependencies.

While at it, also add a coverage build.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
19 months agobuild: avoid unused static inline function warning for clang
Daniel Wagner [Thu, 31 Aug 2023 11:07:11 +0000 (13:07 +0200)]
build: avoid unused static inline function warning for clang

clang reports unused static inline fuctions. Just disable this
warning.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
20 months agonvme: Update list secondary command
Daniel Wagner [Sat, 19 Aug 2023 10:50:42 +0000 (12:50 +0200)]
nvme: Update list secondary command

The nsid argument of the  nvme_{mi_admin}_identify_secondary_ctrl_list
command has been removed. Update the call side accordingly.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
20 months agobuild: Bump libnvme wrap
Daniel Wagner [Sat, 19 Aug 2023 10:48:42 +0000 (12:48 +0200)]
build: Bump libnvme wrap

Get the nvme_{mi_admin_}identify_secondary_ctrl_list changes

Signed-off-by: Daniel Wagner <dwagner@suse.de>
20 months agowdc: Add support for SN861 drive
Jeffrey Lien [Thu, 17 Aug 2023 15:57:36 +0000 (10:57 -0500)]
wdc: Add support for SN861 drive

Signed-off-by: Jeffrey Lien <jeff.lien@wdc.com>
20 months agoutil: Set errno to 0 before strtol/stroul call
Daniel Wagner [Fri, 11 Aug 2023 12:24:04 +0000 (14:24 +0200)]
util: Set errno to 0 before strtol/stroul call

In order to be able to distinguish between success/failure case when
calling strtol/stroul we set errno explicitly to 0.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
20 months agonvme: Revert passthru and submit_io to print status to stderr from stdout
Tokunori Ikegami [Sun, 6 Aug 2023 13:57:44 +0000 (22:57 +0900)]
nvme: Revert passthru and submit_io to print status to stderr from stdout

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
20 months agoplugins/zns: Fix offset in report zones
Mateusz Kozlowski [Thu, 3 Aug 2023 08:39:14 +0000 (10:39 +0200)]
plugins/zns: Fix offset in report zones

offset should be a 64b field

Signed-off-by: Mateusz Kozlowski <mateusz.kozlowski@solidigm.com>
20 months agonvme-rpmb: Fix nvme_show_id_ctrl_rpmbs() definition error
Tokunori Ikegami [Wed, 2 Aug 2023 15:21:06 +0000 (00:21 +0900)]
nvme-rpmb: Fix nvme_show_id_ctrl_rpmbs() definition error

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
20 months agofabrics: Use corresponding hostid when hostnqn is generated
Shin'ichiro Kawasaki [Thu, 3 Aug 2023 11:21:39 +0000 (20:21 +0900)]
fabrics: Use corresponding hostid when hostnqn is generated

After the kernel commit ae8bd606e09b ("nvme-fabrics: prevent overriding
of existing host"), kernel ensures hostid and hostnqn maintain 1:1
mapping and "non 1:1 mapping will be rejected". This makes 'nvme
discover' and 'nvme connect' commands fail when they generate hostnqn,
since it does not use corresponding hostid.

To avoid the failures, prepare and use corresponding hostid to the
generated hostnqn, taking the hostid from the hostnqn string. Also add
checks for prepared hostnqn and hostid. If the hostid taken from the
generated hostnqn is different from the hostid from file, print a
warning message. Also, if the prepared hostnqn are inconsistent with the
prepared hostid, print a warning.

Link: https://lore.kernel.org/linux-nvme/l7vk7fnzltpmvkwujsbf2btrzip6wh7ug62iwa3totqcda25l6@siqx7tj6lt3l/
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Signed-off-by: Daniel Wagner <dwagner@suse.de>
20 months agojson: fix seg. fault converting NULL to JSON string
Martin Belanger [Thu, 3 Aug 2023 17:15:28 +0000 (13:15 -0400)]
json: fix seg. fault converting NULL to JSON string

The function json_object_new_string() seg. faults when passed a
NULL pointer. This can happen, for example, when parameters retuned
by a controller (e.g. Firmware, Model Number, Serial Number, etc.)
are undefined and therefore NULL. This will cause the following
command to crash:

nvme list -v -o json

Signed-off-by: Martin Belanger <martin.belanger@dell.com>
21 months agonvme-cli: fix extended metadata size calculation
Keith Busch [Thu, 27 Jul 2023 08:14:37 +0000 (10:14 +0200)]
nvme-cli: fix extended metadata size calculation

With commit 8a2bfa5be4d3 ("nvme: fix block count and data size logic")
we are rounding the request size up. And later we are adding the
extended metadata on top. Thus first figure out if extended metadata is
used and then do the rounding.

Signed-off-by: Keith Busch <kbusch@kernel.org>
[dwagner: added commit message]
Signed-off-by: Daniel Wagner <dwagner@suse.de>
21 months agonvme-print: Show subsystem iopolicy
Daniel Wagner [Wed, 26 Jul 2023 13:54:22 +0000 (15:54 +0200)]
nvme-print: Show subsystem iopolicy

Signed-off-by: Daniel Wagner <dwagner@suse.de>
21 months agonvme-print-stdout: Do not show non reachable ns in namespace topology
Daniel Wagner [Wed, 26 Jul 2023 13:46:55 +0000 (15:46 +0200)]
nvme-print-stdout: Do not show non reachable ns in namespace topology

If the host is connected to the target with two different hostnqn we can
have the situation where a namespace is only reachable via one ctrl and
a second namespace only by a different controller. Thus we should only
show a namespace in the topology if there is a path.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
21 months agonvme-print: Fix show-topolocy for ctrls
Daniel Wagner [Wed, 26 Jul 2023 13:44:34 +0000 (15:44 +0200)]
nvme-print: Fix show-topolocy for ctrls

Depending on the ranking command line argument we are supposed to show the
topology order by namespaces or ctrls.

Fixes: 1d583b7856db ("nvme-print-stdout: Refactor stdout print code to use print_ops")
Signed-off-by: Daniel Wagner <dwagner@suse.de>