]> www.infradead.org Git - users/sagi/nvme-cli.git/log
users/sagi/nvme-cli.git
10 months agoocp: fix to set log data pointer allocated
Tokunori Ikegami [Wed, 18 Sep 2024 14:36:08 +0000 (23:36 +0900)]
ocp: fix to set log data pointer allocated

Previously the NULL pointer is set incorrectly.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
10 months agonvme: use NVME_CHECK() to check get features select field value
Tokunori Ikegami [Sun, 15 Sep 2024 01:45:24 +0000 (10:45 +0900)]
nvme: use NVME_CHECK() to check get features select field value

Use the macro instead of comparing the long filed value definition.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
10 months agobuild: bump libnvme wrap
Tokunori Ikegami [Mon, 16 Sep 2024 12:10:29 +0000 (21:10 +0900)]
build: bump libnvme wrap

Include libnvme NVME_CHECK() definition addition.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
10 months agoocp: split ocp-hwcomp log
Tokunori Ikegami [Mon, 16 Sep 2024 11:59:30 +0000 (20:59 +0900)]
ocp: split ocp-hwcomp log

This is to reduce the ocp-nvme.c code size.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
10 months agocompletions: add ocp hardware-component-log command
Tokunori Ikegami [Sat, 7 Sep 2024 11:22:50 +0000 (20:22 +0900)]
completions: add ocp hardware-component-log command

The command lists component descriptions.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
10 months agodoc: add ocp hardware-component-log command
Tokunori Ikegami [Sat, 7 Sep 2024 08:00:35 +0000 (17:00 +0900)]
doc: add ocp hardware-component-log command

The command lists component descriptions.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
10 months agoocp: add hwcomp log json output
Tokunori Ikegami [Sun, 1 Sep 2024 08:29:03 +0000 (17:29 +0900)]
ocp: add hwcomp log json output

Add struct hwcomp_desc_entry and fix id option value type error.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
10 months agoocp: add hwcomp log command list option
Tokunori Ikegami [Sat, 31 Aug 2024 10:49:59 +0000 (19:49 +0900)]
ocp: add hwcomp log command list option

This is to list component descriptions.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
10 months agoocp: add hwcomp log command comp-id option
Tokunori Ikegami [Sat, 31 Aug 2024 07:46:37 +0000 (16:46 +0900)]
ocp: add hwcomp log command comp-id option

This is to filter the component descriptions.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
10 months agoocp: add hwcomp dummy definition
Tokunori Ikegami [Sat, 31 Aug 2024 06:50:52 +0000 (15:50 +0900)]
ocp: add hwcomp dummy definition

This is for a debugging.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
10 months agoocp: add support for hwcomp log page
Tokunori Ikegami [Mon, 16 Sep 2024 11:57:18 +0000 (20:57 +0900)]
ocp: add support for hwcomp log page

Note: Still json output not supported.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
10 months agonvme: use NVME_CTRL_FNA definitions
Tokunori Ikegami [Mon, 16 Sep 2024 06:11:51 +0000 (15:11 +0900)]
nvme: use NVME_CTRL_FNA definitions

Replace the hardcoded values.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
10 months agonetapp-smdevices: print single device output too
Martin George [Fri, 13 Sep 2024 17:14:18 +0000 (22:44 +0530)]
netapp-smdevices: print single device output too

In addition to printing info of all smdevices on the host, provide
an option to print the output of the specified device alone.

Signed-off-by: Martin George <marting@netapp.com>
Tested-by: Clayton Skaggs <claytons@netapp.com>
10 months agonetapp-smdevices: segregate print routines
Martin George [Fri, 13 Sep 2024 16:06:37 +0000 (21:36 +0530)]
netapp-smdevices: segregate print routines

Segregate printing the respective normal/column and json outputs
into separate routines for better readability.

Signed-off-by: Martin George <marting@netapp.com>
Tested-by: Clayton Skaggs <claytons@netapp.com>
10 months agoAdd Support for new SN655 PCI Device ID
jeff-lien-wdc [Thu, 12 Sep 2024 20:15:19 +0000 (15:15 -0500)]
Add Support for new SN655 PCI Device ID

Support was added for an additional PCI Device ID (0x2723)
for SN655 drives.

Signed-off-by: jeff-lien-wdc <jeff.lien@wdc.com>
10 months agonvme-print-json: extern json object add functions
Tokunori Ikegami [Mon, 9 Sep 2024 16:08:25 +0000 (01:08 +0900)]
nvme-print-json: extern json object add functions

Some additinal functions introduced and fix obj_add_uint_0nx error.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
10 months agoocp: add SMART / health information extended log page version 4
Tokunori Ikegami [Tue, 3 Sep 2024 14:46:01 +0000 (23:46 +0900)]
ocp: add SMART / health information extended log page version 4

Add NVMe command set errata version and lowest permitted firmware revision.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
10 months agoocp: add error recovery log page version 3
Tokunori Ikegami [Tue, 3 Sep 2024 17:55:17 +0000 (02:55 +0900)]
ocp: add error recovery log page version 3

Add panic count and previous panic IDs.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
10 months agoocp: add get-enable-ieee1667-silo command
Tokunori Ikegami [Sun, 8 Sep 2024 10:00:52 +0000 (19:00 +0900)]
ocp: add get-enable-ieee1667-silo command

The commands returns set of enable IEEE1667 silo.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
10 months agofabrics: fix incorrect access filename check
Martin George [Wed, 28 Aug 2024 08:33:55 +0000 (14:03 +0530)]
fabrics: fix incorrect access filename check

Config JSON file handling is currently broken due to an incorrect
access filename check. Fix it.

Signed-off-by: Martin George <marting@netapp.com>
10 months agonvme: use NVME_GET_FEATURES_SEL_SUPPORTED definition
Tokunori Ikegami [Sun, 8 Sep 2024 10:05:56 +0000 (19:05 +0900)]
nvme: use NVME_GET_FEATURES_SEL_SUPPORTED definition

This is to delete the hardcoded values.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
10 months agonvme-print-json: use _cleanup_free_
Tokunori Ikegami [Sat, 7 Sep 2024 13:25:59 +0000 (22:25 +0900)]
nvme-print-json: use _cleanup_free_

This is to delete the free function call.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
10 months agoplugins/solidigm: fix use after free.
Maurizio Lombardi [Mon, 2 Sep 2024 15:43:03 +0000 (17:43 +0200)]
plugins/solidigm: fix use after free.

the "output" file descriptor is automatically closed when the function
returns; therefore we shouldn't explicitly call close() against it.

Signed-off-by: Maurizio Lombardi <mlombard@redhat.com>
10 months agoocp: fix ocp-nvme.c coding style errors
Tokunori Ikegami [Sun, 1 Sep 2024 14:16:13 +0000 (23:16 +0900)]
ocp: fix ocp-nvme.c coding style errors

Only fixed some errors found by the file changes.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
10 months agoocp: Change C9 function names to use c9 instead
Tokunori Ikegami [Sun, 1 Sep 2024 14:12:18 +0000 (23:12 +0900)]
ocp: Change C9 function names to use c9 instead

This is to unify c9 and C9 function names.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
10 months agoocp: fix to return c9 log page data error to open file
Tokunori Ikegami [Sun, 1 Sep 2024 14:02:58 +0000 (23:02 +0900)]
ocp: fix to return c9 log page data error to open file

Use _cleanup_fd_ function so delete close() call and goto statement.
Also fix some minor coding style errors around the code.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
10 months agoocp: fix to set return value to get c9 log page data
Tokunori Ikegami [Sun, 1 Sep 2024 13:50:43 +0000 (22:50 +0900)]
ocp: fix to set return value to get c9 log page data

The value not set but checked the ret variable after the call.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
10 months agonvme: update nvme_insert_tls_key_versioned() return handling
Martin George [Sun, 1 Sep 2024 11:51:47 +0000 (17:21 +0530)]
nvme: update nvme_insert_tls_key_versioned() return handling

Treat nvme_insert_tls_key_versioned() return value of zero as
errors too.

Signed-off-by: Martin George <marting@netapp.com>
10 months agonvme-print-stdout: add print_array function
Tokunori Ikegami [Sat, 31 Aug 2024 05:54:16 +0000 (14:54 +0900)]
nvme-print-stdout: add print_array function

To reduce the repeated print code for arrays.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
10 months agologging: add print_info function
Tokunori Ikegami [Sat, 31 Aug 2024 06:24:30 +0000 (15:24 +0900)]
logging: add print_info function

This is for debugging print.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
10 months agoutil: extern uint128_t_to_double() function
Tokunori Ikegami [Fri, 30 Aug 2024 18:49:45 +0000 (03:49 +0900)]
util: extern uint128_t_to_double() function

Use the function to calculate with the uint128_t value.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
10 months agonvme-print: sanitize error-log output
Martin George [Thu, 29 Aug 2024 06:01:13 +0000 (11:31 +0530)]
nvme-print: sanitize error-log output

Minor textual and formatting changes to the error-log output.

Signed-off-by: Martin George <marting@netapp.com>
10 months agoplugins/solidigm : Fixing vs-internal-log to generate identify per allocated namespace.
Haro Panosyan [Wed, 21 Aug 2024 23:38:03 +0000 (16:38 -0700)]
plugins/solidigm : Fixing vs-internal-log to generate identify per allocated namespace.

CNS 11h is for namespace data structures for allocated namespaces.
Earlier code was using attached namespaces. This fix is to generate
identify data structures per allocated namespace.

Signed-off-by: Haro Panosyan <haro.panosyan@solidigm.com>
11 months agonvme-print: added new fields for nvm_id_ns
Ankit Soni [Fri, 23 Aug 2024 10:43:46 +0000 (16:13 +0530)]
nvme-print: added new fields for nvm_id_ns

Added new fields from I/O Command Set Specific Identify Namespace
Data Structure CNS5 as per NVM Command Set Specification(Rev 1.1).

Signed-off-by: Ankit Soni <soni.ankit@samsung.com>
Reviewed-by: Steven Seungcheol Lee <sc108.lee@samsung.com>
11 months agobuild: update libnvme wrap
Ankit Soni [Fri, 23 Aug 2024 10:36:33 +0000 (16:06 +0530)]
build: update libnvme wrap

5585f06 - types: added new fields in nvme_nvme_id_ns

Signed-off-by: Ankit Soni <soni.ankit@samsung.com>
11 months agoplugins/fdp: bugfix error check to validate output format
Minsik Jeon [Wed, 21 Aug 2024 10:22:01 +0000 (19:22 +0900)]
plugins/fdp: bugfix error check to validate output format

The return value of validate_output_format functions is whether the
functions fails. So I fix to check the err variable.

Signed-off-by: Minsik Jeon <hmi.jeon@samsung.com>
11 months agoplugins/wdc: fix json output for vs-nand-stats
Carl Moran [Fri, 16 Aug 2024 00:49:46 +0000 (17:49 -0700)]
plugins/wdc: fix json output for vs-nand-stats

Running nvme wdc vs-nand-stats will change the values of the user data fields
depending on output format used. In regular stdout, the ordering is TLC min,
TLC Max, SLC Min, SLC Max. However in json, the values get reassigned, what
was SLC Min in stdout will become TLC >

Regular format (TLC Min, TLC Max, SLC Min, SLC Max)
[root@ /tmp/]# nvme wdc vs-nand-stats /dev/nvme0n1 | grep User\ Data
User Data Erase Counts - TLC Min 169
User Data Erase Counts - TLC Max 310
User Data Erase Counts - SLC Min 10719
User Data Erase Counts - SLC Max 11676

Json format (SLC Min, SLC Max, TLC Min, TLC Max)
[root@ /tmp/]# nvme wdc vs-nand-stats /dev/nvme0n1 -o json | grep User\ Data
"User Data Erase Counts - SLC Min" : 169,
"User Data Erase Counts - SLC Max" : 310,
"User Data Erase Counts - TLC Min" : 10719,
"User Data Erase Counts - TLC Max" : 11676,

The difference can be traced to how the array subscripts are being
used in the two output formats

stdout : https://t.ly/sRIDz

tlc_min == 0
tlc_max == 1
slc_min == 2
slc_max == 3

json : https://t.ly/pmU-m
slc_min = 0
slc_max = 1
tlc_min = 2
tlc_max = 3

With the patch, we rename the fields to be the same for both stdout & json.
Output comparison below

Regular format (TLC Min, TLC Max, SLC Min, SLC Max)
[root@ /tmp/]# ./nvme wdc vs-nand-stats /dev/nvme0n1 | grep User\ Data
User Data Erase Counts - TLC Min 169
User Data Erase Counts - TLC Max 310
User Data Erase Counts - SLC Min 10719
User Data Erase Counts - SLC Max 11676

Json format (TLC Min, TLC Max, SLC Min, SLC Max)
[root@ /tmp/]# ./nvme wdc vs-nand-stats /dev/nvme0n1 -o json | grep User\ Data
"User Data Erase Counts - TLC Min":169,
"User Data Erase Counts - TLC Max":310,
"User Data Erase Counts - SLC Min":10719,
"User Data Erase Counts - SLC Max":11676,

Signed-off-by: Carl Moran<carl.moran1@meta.com>
11 months agonvme-print-stdout: use NVME_FEAT util definitions
Tokunori Ikegami [Mon, 19 Aug 2024 12:13:49 +0000 (21:13 +0900)]
nvme-print-stdout: use NVME_FEAT util definitions

Some NVME_FEAT definitions needed to add for FDP, etc.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
11 months agonvme-print: update subsys verbose outputs
Martin George [Sun, 18 Aug 2024 16:54:18 +0000 (22:24 +0530)]
nvme-print: update subsys verbose outputs

The current list-subsys & show-topology simple outputs are a
little crowded. Also the respective verbose options to both
these commands are a no-op at the moment. So move the iopolicy
and subsystype details to the respective verbose outputs instead
so that the simple outputs are restricted to displaying key subsys
details like subsys name & NQN alone.

Signed-off-by: Martin George <marting@netapp.com>
11 months agonvme-print: add subsystype to the list-subsys output
Martin George [Sun, 18 Aug 2024 16:42:58 +0000 (22:12 +0530)]
nvme-print: add subsystype to the list-subsys output

The nvme list-subsys and show-topology outputs misses out on the
subsystype details. Add the same.

Signed-off-by: Martin George <marting@netapp.com>
11 months agonetapp: print output for single device too
Martin George [Fri, 16 Aug 2024 13:35:13 +0000 (19:05 +0530)]
netapp: print output for single device too

In addition to printing info of all ontap devices on the host,
provide an option to print the output for the specified
device alone.

Signed-off-by: Martin George <marting@netapp.com>
11 months agonetapp: segregate the print routines
Martin George [Fri, 16 Aug 2024 12:42:04 +0000 (18:12 +0530)]
netapp: segregate the print routines

Segregate printing the respective regular/normal and json outputs
into separate routines for better readability.

Signed-off-by: Martin George <marting@netapp.com>
11 months agonetapp: fix uninitialized value from heap error
Martin George [Fri, 16 Aug 2024 11:42:44 +0000 (17:12 +0530)]
netapp: fix uninitialized value from heap error

Valgrind complained about an "uninitialized value created by a
heap allocation" error. Fix the same.

Signed-off-by: Martin George <marting@netapp.com>
11 months agonvme-print: print the new fields added in TP4142
Francis Pravin [Fri, 16 Aug 2024 06:42:36 +0000 (12:12 +0530)]
nvme-print: print the new fields added in TP4142

Print the new fields added in Identify Controller Data Structure.
Also, print the field added in Temperature Threshold feature.

Signed-off-by: Francis Pravin <francis.p@samsung.com>
Reviewed-by: Steven Seungcheol Lee <sc108.lee@samsung.com>
11 months agoplugins/innogrit: modify for project tacoma
innogritkenny [Wed, 14 Aug 2024 04:50:28 +0000 (12:50 +0800)]
plugins/innogrit: modify for project tacoma

modify get-eventlog and remove smart-log-add function

Signed-off-by: innogritkenny <kenny.chu@innogrit.com>
11 months agowdc: Add Support for new SN-861 PCI device id
jeff-lien-wdc [Thu, 8 Aug 2024 19:59:50 +0000 (14:59 -0500)]
wdc: Add Support for new SN-861 PCI device id

A new form factor (EDSFF E3.S) of the SN-861
drive was added to the wdc plugin code.

Signed-off-by: jeff-lien-wdc <jeff.lien@wdc.com>
11 months agonvme-print: use LC_MEASUREMENT to check fahrenheit temperature
Tokunori Ikegami [Sun, 11 Aug 2024 04:29:17 +0000 (13:29 +0900)]
nvme-print: use LC_MEASUREMENT to check fahrenheit temperature

Previously used LC_ALL so not checked correctly if LC_MEASUREMENT set.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
11 months agonvme-print: use Completion Condition enum
Francis Pravin [Fri, 9 Aug 2024 11:42:03 +0000 (17:12 +0530)]
nvme-print: use Completion Condition enum

Use the Completion Condition enum for LBA Status Descriptor.
Also, modified the print statement of Completion Condition.

Signed-off-by: Francis Pravin <francis.p@samsung.com>
11 months agobuild: update libnvme wrap
Francis Pravin [Fri, 9 Aug 2024 10:43:43 +0000 (16:13 +0530)]
build: update libnvme wrap

9bee8e1 - types: add new fields added in TP4142
df12de6 - types: Add enum for Completion Condition of
Get LBA status command

Signed-off-by: Francis Pravin <francis.p@samsung.com>
11 months agocompletions: add the zsh completion of the dapustor plugin
Xiaoyuan Zhang [Thu, 8 Aug 2024 11:31:06 +0000 (19:31 +0800)]
completions: add the zsh completion of the dapustor plugin

add the zsh completion of the dapustor plugin

Signed-off-by: Xiaoyuan Zhang <zhxiaoy2024@gmail.com>
11 months agonvme-print: print the new fields added in TP4165
Francis Pravin [Wed, 7 Aug 2024 12:38:05 +0000 (18:08 +0530)]
nvme-print: print the new fields added in TP4165

Print the new fields added in TP4165.

Signed-off-by: Francis Pravin <francis.p@samsung.com>
Reviewed-by: Steven Seungcheol Lee <sc108.lee@samsung.com>
11 months agoplugins/dapustor: dapustor smart-log-add update
Xiaoyuan Zhang [Wed, 7 Aug 2024 10:24:58 +0000 (18:24 +0800)]
plugins/dapustor: dapustor smart-log-add update

Extended Additional SMART log is optional.
If the collection fails, the command dose not stop.

Add the manual of dapustor plugin.
Update tab completion.

Signed-off-by: Xiaoyuan Zhang <zhxiaoy2024@gmail.com>
11 months agonvme-print-stdout: Added print for new field CSER (TP4167)
Nitin Sao [Tue, 6 Aug 2024 05:45:11 +0000 (11:15 +0530)]
nvme-print-stdout: Added print for new field CSER (TP4167)

As per TP4167, added print for a new field CSER (Command Submission
and Execution Relaxations) [15:14] added in Commands Supported and
Effects Data Structure.

Signed-off-by: Nitin Sao <nitin.sao@samsung.com>
Reviewed-by: Mohit Kapoor <mohit.kap@samsung.com>
11 months agobuild: bump libnvme wrap
Nitin Sao [Tue, 6 Aug 2024 05:40:13 +0000 (11:10 +0530)]
build: bump libnvme wrap

fetch NVME_CMD_EFFECTS_CSER_MASK from enum nvme_cmd_effects

Signed-off-by: Nitin Sao <nitin.sao@samsung.com>
11 months agoplugins: Add a new DapuStor plugin and the smart-log-add command
Xiaoyuan Zhang [Tue, 6 Aug 2024 07:37:09 +0000 (15:37 +0800)]
plugins: Add a new DapuStor plugin and the smart-log-add command

Add the DapuStor plugin to support the retrieval and
display of the Vendor Specific SMART logs:
Additional SMART log page (0xCA)
Extended Additional SMART log page (0xCB)

Signed-off-by: Xiaoyuan Zhang <zhxiaoy2024@gmail.com>
11 months agoRelease v2.10.2
Daniel Wagner [Mon, 5 Aug 2024 13:42:49 +0000 (15:42 +0200)]
Release v2.10.2

Signed-off-by: Daniel Wagner <dwagner@suse.de>
11 months agodoc: Regenerate all docs for v2.10.2
Daniel Wagner [Mon, 5 Aug 2024 13:42:49 +0000 (15:42 +0200)]
doc: Regenerate all docs for v2.10.2

Signed-off-by: Daniel Wagner <dwagner@suse.de>
11 months agobuild: fix libnvme dependency
Daniel Wagner [Mon, 5 Aug 2024 13:41:52 +0000 (15:41 +0200)]
build: fix libnvme dependency

Undo last libnvme dependency update which was done automatically
done by the release script.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
11 months agoRelease v2.10.1
Daniel Wagner [Mon, 5 Aug 2024 13:33:31 +0000 (15:33 +0200)]
Release v2.10.1

Signed-off-by: Daniel Wagner <dwagner@suse.de>
11 months agodoc: Regenerate all docs for v2.10.1
Daniel Wagner [Mon, 5 Aug 2024 13:33:31 +0000 (15:33 +0200)]
doc: Regenerate all docs for v2.10.1

Signed-off-by: Daniel Wagner <dwagner@suse.de>
11 months agobuild: add install step to doc CI build
Daniel Wagner [Fri, 2 Aug 2024 11:08:13 +0000 (13:08 +0200)]
build: add install step to doc CI build

We had some fallouts which were happened at the install step when the
documentation was build. Let's add this step, so we catch those errors
in future.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
11 months agodocs: rename ocp-unsupported-req-log file
Daniel Wagner [Fri, 2 Aug 2024 09:46:49 +0000 (11:46 +0200)]
docs: rename ocp-unsupported-req-log file

The filename has to match the command name, thus rename the filename.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
11 months agoRelease v2.10
Daniel Wagner [Fri, 2 Aug 2024 07:58:11 +0000 (09:58 +0200)]
Release v2.10

Signed-off-by: Daniel Wagner <dwagner@suse.de>
11 months agodoc: Regenerate all docs for v2.10
Daniel Wagner [Fri, 2 Aug 2024 07:58:11 +0000 (09:58 +0200)]
doc: Regenerate all docs for v2.10

Signed-off-by: Daniel Wagner <dwagner@suse.de>
11 months agobuild: bump libnvme wrap
Daniel Wagner [Fri, 2 Aug 2024 07:54:53 +0000 (09:54 +0200)]
build: bump libnvme wrap

Update to libnvme v1.10 release.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
11 months agosed: Fix parsing of Discovery0 features
Milan Broz [Thu, 1 Aug 2024 08:41:50 +0000 (10:41 +0200)]
sed: Fix parsing of Discovery0 features

TCG SED features have variable sizes, so the code needs to use
stored length to move the offset for the next feature.
Otherwise, it checks the code at the wrong offset.

Signed-off-by: Milan Broz <gmazyland@gmail.com>
11 months agofabrics: avoid potential segfault in nvmf_dim()
Martin George [Thu, 1 Aug 2024 19:07:12 +0000 (00:37 +0530)]
fabrics: avoid potential segfault in nvmf_dim()

Eliminate the call to nvme_free_tree() in nvmf_dim() since the
cleanup helper is already available here.

Signed-off-by: Martin George <marting@netapp.com>
11 months agonvme: avoid segfault in show-topology
Martin George [Thu, 1 Aug 2024 19:02:27 +0000 (00:32 +0530)]
nvme: avoid segfault in show-topology

The show-topology command currently ends in a segfault for
ENOENT scenarios:

nvme show-topology
Failed to scan topology: No such file or directory
Segmentation fault (core dumped)

Fix this by eliminating the call to nvme_free_tree() since the
cleanup helper is already available here.

Signed-off-by: Martin George <marting@netapp.com>
11 months agofabrics: do not leak nvme_ctrl_t object on connect
Daniel Wagner [Thu, 1 Aug 2024 13:08:06 +0000 (15:08 +0200)]
fabrics: do not leak nvme_ctrl_t object on connect

valgrinds reports that the nvme_ctrl_t is leaked in the connect command.
Let's introduced a new cleanup helper for this.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
11 months agonvme: extend help message when mmap regs fails
Daniel Wagner [Thu, 1 Aug 2024 11:23:28 +0000 (13:23 +0200)]
nvme: extend help message when mmap regs fails

Newer kernels enable the lockdown feature when secure boot is enabled.
This feature also prevents the register mapping into userspace. Thus it
is not enough to have CONFIG_IO_STRICT_DEVMEM disabled. Extend the
message with the hint also to disable secure boot.

While at it, also lower the reporting level to INFO, so that one single
'-v' is enough to get this information.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
11 months agonvme: return -ENXIO value to open device if errno not set
Tokunori Ikegami [Thu, 18 Jul 2024 15:11:10 +0000 (00:11 +0900)]
nvme: return -ENXIO value to open device if errno not set

The APIs may not set errno so set errno to ENXIO before the device open.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
11 months agowdc: OCP 2.5 Log Page Updates
jeff-lien-wdc [Tue, 16 Jul 2024 20:26:49 +0000 (15:26 -0500)]
wdc: OCP 2.5 Log Page Updates

Add panic count and prev panic id to Error Recovery log page (0xC1)

Add debug telemetry log size to Latency Monitor log page (0xc3)

Signed-off-by: jeff-lien-wdc <jeff.lien@wdc.com>
11 months agofabrics: drop --quiet alias -S
Daniel Wagner [Thu, 11 Jul 2024 17:06:29 +0000 (19:06 +0200)]
fabrics: drop --quiet alias -S

-S has been allocated for the global dhchap secret option. It's likely
that the --quiet option is less used, thus drop the -S alias for it.

Fixes: 0571307d3af0 ("nvme-connect: Add 'dhchap-secret' and 'dhchap-ctrl-secret' arguments")
Signed-off-by: Daniel Wagner <dwagner@suse.de>
11 months agofabrics: drop --disable-sqflow alias -d
Daniel Wagner [Thu, 11 Jul 2024 16:53:36 +0000 (18:53 +0200)]
fabrics: drop --disable-sqflow alias -d

The alias for --disable-sqflow -d clashes with --device for the
discover command. Since the --disable-sqflow is not so commonly used,
let's free -d for other uses.

Fixes: 18de3a6d61a7 ("Convert to libnvme")
Signed-off-by: Daniel Wagner <dwagner@suse.de>
11 months agofabrics: check if json config is existing
Daniel Wagner [Thu, 11 Jul 2024 16:42:23 +0000 (18:42 +0200)]
fabrics: check if json config is existing

nvme_read_config will return success even if the file doesn't exist.
This leads to the situation that we always execute
discover_from_json_config_file even though there is no json config
file.

One side effect of this is that when executing 'nvme discover -d
/dev/nvmeXXX' we will always do a discover for the first controller we
find.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
11 months agoplugins/ocp: fix UAF when printing telemetry log
Vigneshwaran Saravanan/Vigneshwaran Saravanan [Tue, 30 Jul 2024 13:45:52 +0000 (19:15 +0530)]
plugins/ocp: fix UAF when printing telemetry log

Take care the below failures for "telemetry-string-log". Resolved the
Segmentation Fault issue while printing.

Signed-off-by: Vigneshwaran Saravanan/Vigneshwaran Saravanan <s.vignesh@samsung.com>
Reviewed-by: Karthik Balan <karthik.b82@samsung.com>
Reviewed-by: Arunpandian J <arun.j@samsung.com>
11 months agonvme-print-stdout: fix persistent-event-log set feature event output
Xiaoyuan Zhang [Sat, 27 Jul 2024 07:46:30 +0000 (15:46 +0800)]
nvme-print-stdout: fix persistent-event-log set feature event output

Refer to FDP Events Set Feature Data Structure:
the number of FDP Event Types is only Dword11 bits [23:16].
the buffer only contains FDP Event Type.

The value of mem_buf is incorrect:
the pointer 'set_feat_event' should be converted to 'unsigned char *' first

Signed-off-by: Xiaoyuan Zhang <zhxiaoy2024@gmail.com>
11 months agofabrics: do not report error when no modules are loaded when disconnecting
Daniel Wagner [Fri, 26 Jul 2024 12:20:09 +0000 (14:20 +0200)]
fabrics: do not report error when no modules are loaded when disconnecting

Do not report an error when the libnvme reports that the subsystem is
not available when the user tries to disconnect. This allows the user to
call disconnect without filtering this special case. The result is the
same, after this call the host is not connected anymore.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
11 months agofabrics: use cleanup helper where possible
Daniel Wagner [Fri, 26 Jul 2024 12:14:16 +0000 (14:14 +0200)]
fabrics: use cleanup helper where possible

Let's make the error path shorter and simpler by using the cleanup
helpers.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
11 months agofabrics: print an error for ENOENT too
Martin George [Wed, 17 Jul 2024 08:17:51 +0000 (13:47 +0530)]
fabrics: print an error for ENOENT too

Many nvme commands such as discover, connect, connect-all, etc.
simply return to the prompt without printing any useful error
message when the respective nvme driver modules are not loaded in
the kernel. This is because nothing gets printed when
nvme_scan_topology() returns an ENOENT due to missing nvme system
files stemming from not loading the appropriate nvme modules.
Fix the same.

Signed-off-by: Martin George <marting@netapp.com>
12 months agoplugins/virtium: use time_t for time_stamp values
Heitor Alves de Siqueira [Wed, 24 Jul 2024 16:15:35 +0000 (13:15 -0300)]
plugins/virtium: use time_t for time_stamp values

In the vtview_log structs, time_t should be used for any time_stamp
values instead of long. This ensures correct builds on 32-bit
architectures even with 64-bit time_t (e.g. armhf on Ubuntu).

Signed-off-by: Heitor Alves de Siqueira <halves@canonical.com>
12 months agocompletions: add ocp set-error-injection command
Tokunori Ikegami [Sun, 21 Jul 2024 01:16:28 +0000 (10:16 +0900)]
completions: add ocp set-error-injection command

The command injects error conditions.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
12 months agodoc: add ocp set-error-injection command
Tokunori Ikegami [Sun, 21 Jul 2024 00:53:11 +0000 (09:53 +0900)]
doc: add ocp set-error-injection command

The command injects error conditions.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
12 months agoocp: add set-error-injection command
Tokunori Ikegami [Sun, 7 Jul 2024 14:37:43 +0000 (23:37 +0900)]
ocp: add set-error-injection command

The command injects error conditions.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
12 months agonvme: use argconfig_parse_seen to check conditions
zhangxiaoyuan [Fri, 19 Jul 2024 10:23:44 +0000 (18:23 +0800)]
nvme: use argconfig_parse_seen to check conditions

The value of NVME_FEAT_FID_TIMESTAMP cannot be set
to 0 through 'set-feature /dev/nvmeX -f 0xe -v 0'.
using argconfig_parse_seen() can fix this issue.

Signed-off-by: Xiaoyuan Zhang <zhxiaoy@outlook.com>
12 months agonvme: use proper mask to get correct lbafu value
Francis Pravin [Thu, 18 Jul 2024 10:05:44 +0000 (15:35 +0530)]
nvme: use proper mask to get correct lbafu value

The NVME_NS_FLBAS_HIGHER/LOWER_MASK is used to get the format index
value from Formatted LBA Size (FLBAS) field of Identify Namespace
Data Structure. But, We are not getting the proper lbafu value while
using the same macro on user passed format index value.
So, use the proper mask to get the correct lbafu value.

Signed-off-by: Francis Pravin <francis.p@samsung.com>
Reviewed-by: Steven Seungcheol Lee <sc108.lee@samsung.com>
12 months agoutils: fix print formatting option
Daniel Wagner [Wed, 17 Jul 2024 15:39:23 +0000 (17:39 +0200)]
utils: fix print formatting option

A 64bit value to print needs to use the PRIx macros to work on 32bit and
64bit platforms.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
12 months agoutils: cleanup includes in utils.h
Daniel Wagner [Wed, 17 Jul 2024 15:25:18 +0000 (17:25 +0200)]
utils: cleanup includes in utils.h

There a plenty of includes which are not necessary. Remove them.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
12 months agoutils: add missing header
Daniel Wagner [Wed, 17 Jul 2024 15:24:32 +0000 (17:24 +0200)]
utils: add missing header

The build breaks because convert_ts is missing.

Also utils.c depends on json_object_add_value_string, thus define one
when we don't use json-c.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
12 months agonvme-print: Added print for two new fields for HMB feature
Nitin Sao [Tue, 16 Jul 2024 06:28:18 +0000 (11:58 +0530)]
nvme-print: Added print for two new fields for HMB feature

As per TP4104, added print for two new fields for HMB feature
HMNARE (Host Memory Non-operational Access Restriction Enable) and
HMNAR (Host Memory Non-operational Access Restricted) with 1 bit
each. Bit 1 is not used for Get Feature command and will be 0.
And added print for HMBR field in stdout_id_ctrl_ctratt.

Signed-off-by: Nitin Sao <nitin.sao@samsung.com>
Reviewed-by: Steven Seungcheol Lee <sc108.lee@samsung.com>
Reviewed-by: Mohit Kapoor <mohit.kap@samsung.com>
12 months agoplugins/micron: Move OCP internal log parsing from Micron to OCP Plugin.
Chaithanya shoba [Sun, 14 Jul 2024 17:29:11 +0000 (22:59 +0530)]
plugins/micron: Move OCP internal log parsing from Micron to OCP Plugin.

Move OCP internal log parsing from Micron to OCP Plugin. Previous
PR https://github.com/linux-nvme/nvme-cli/pull/2354. Datacenter
NVMe SSD Specification v2.5r9, section 4.9.

Signed-off-by: Chaithanya shoba <ashoba@micron.com>
12 months agofabrics: remove unused _discover_from_json_config_file() argument
Caleb Sander Mateos [Wed, 17 Jul 2024 02:26:05 +0000 (20:26 -0600)]
fabrics: remove unused _discover_from_json_config_file() argument

_discover_from_json_config_file() takes a nvme_subsystem_t argument
but doesn't use it.
Drop the unnecessary argument.

Signed-off-by: Caleb Sander Mateos <csander@purestorage.com>
Fixes: b3b9963396c5 ("fabrics: refactore discover from json config")
12 months agonvme: avoid unnecessary dup() + close() in io_mgmt_send()
Caleb Sander Mateos [Wed, 17 Jul 2024 02:04:04 +0000 (20:04 -0600)]
nvme: avoid unnecessary dup() + close() in io_mgmt_send()

_cleanup_fd_ doesn't close STD{IN,OUT,ERR}_FILENO,
so don't bother creating a duplicate fd.

Signed-off-by: Caleb Sander Mateos <csander@purestorage.com>
Fixes: 7e1f6799f8cd ("nvme: use cleanup helper to close file descriptor")
12 months agoutil: remove unnecessary NULL check in cleanup_nvme_root()
Caleb Sander Mateos [Tue, 16 Jul 2024 15:59:29 +0000 (09:59 -0600)]
util: remove unnecessary NULL check in cleanup_nvme_root()

cleanup_nvme_root() is checking whether the passed pointer is non-NULL,
but since the pointer is to a local variable, this will always be true.
Therefore, remove the check and always call nvme_free_tree().

Signed-off-by: Caleb Sander Mateos <csander@purestorage.com>
12 months agonvme: use argconfig_parse_comma_sep_array_u16() in attach-ns
Caleb Sander Mateos [Tue, 16 Jul 2024 21:34:57 +0000 (15:34 -0600)]
nvme: use argconfig_parse_comma_sep_array_u16() in attach-ns

nvme_attach_ns() is using argconfig_parse_comma_sep_array()
to parse a list of ints and then copying them into a list of u16s.

Use argconfig_parse_comma_sep_array_u16() instead to save on memory
and avoid needing to copy the values to another list.
This also checks that the values fit in u16.

Also use NVME_ID_CTRL_LIST_MAX instead of hard-coding the max list size.

Signed-off-by: Caleb Sander Mateos <csander@purestorage.com>
12 months agoutil: avoid duplication in argconfig_parse_comma_sep_array*()
Caleb Sander Mateos [Tue, 16 Jul 2024 21:28:53 +0000 (15:28 -0600)]
util: avoid duplication in argconfig_parse_comma_sep_array*()

Use the loop body to convert the first token to an int.

Extend the existing macro so it can be used to define all the functions.

Signed-off-by: Caleb Sander Mateos <csander@purestorage.com>
12 months agoutil: remove redundant loop condition in argconfig_parse()
Caleb Sander Mateos [Tue, 16 Jul 2024 19:11:34 +0000 (13:11 -0600)]
util: remove redundant loop condition in argconfig_parse()

Since options_count is computed as the number of options
until the first one with a NULL option field,
s->option and option_index < options_count are equivalent.

Signed-off-by: Caleb Sander Mateos <csander@purestorage.com>
12 months agoutil: introduce is_null_or_empty() to avoid strlen()
Caleb Sander Mateos [Tue, 16 Jul 2024 21:43:18 +0000 (15:43 -0600)]
util: introduce is_null_or_empty() to avoid strlen()

argconfig uses strlen() in several places to check for empty strings.
strlen() traverses the entire string though only the first char matters.

Add a helper function is_null_or_empty() that only checks the first char
for NUL. It also encapsulates the NULL check performed by each caller.

Signed-off-by: Caleb Sander Mateos <csander@purestorage.com>
12 months agoutil: reduce allocation sizes in argconfig_parse()
Caleb Sander Mateos [Tue, 16 Jul 2024 19:07:23 +0000 (13:07 -0600)]
util: reduce allocation sizes in argconfig_parse()

long_opts stores up to 1 element per option, plus a help element,
and a zerored final element. So it can be allocated with length
options_count + 2 instead of options_count + 3.
short_opts stores up to 3 characters per option, plus 2 help characters,
and a NUL terminator. So it can be allocated with length
options_count * 3 + 3 instead of options_count * 3 + 5.

Also use the two arguments to calloc() instead of multiplying the sizes.

Signed-off-by: Caleb Sander Mateos <csander@purestorage.com>
12 months agoutil: consolidate call paths to argconfig_parse_type()
Caleb Sander Mateos [Tue, 16 Jul 2024 19:01:36 +0000 (13:01 -0600)]
util: consolidate call paths to argconfig_parse_type()

argconfig_parse_val() already falls back on argconfig_parse_type()
if no option values match.
So always call argconfig_parse_val() from argconfig_parse()
instead of checking whether any option values are defined.

Signed-off-by: Caleb Sander Mateos <csander@purestorage.com>