]> www.infradead.org Git - users/sagi/nvme-cli.git/log
users/sagi/nvme-cli.git
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>
12 months agoutil: reduce complexity of argconfig_parse_val()
Caleb Sander Mateos [Tue, 16 Jul 2024 16:53:59 +0000 (10:53 -0600)]
util: reduce complexity of argconfig_parse_val()

Assuming constant-length value strings, argconfig_parse_val()'s runtime
is currently quadratic in the number of option values.
For each option value, it computes a minimum prefix length
that distinguishes that option from all others.
It then checks whether the input matches up to that prefix length.

Instead, compare the input directly against each option value.
If exactly one matches, select that option value.
Otherwise, fallback on the default value parser.

Signed-off-by: Caleb Sander Mateos <csander@purestorage.com>
12 months agoutil: reduce arguments passed to argconfig_parse_type()
Caleb Sander Mateos [Tue, 16 Jul 2024 16:35:07 +0000 (10:35 -0600)]
util: reduce arguments passed to argconfig_parse_type()

Arguments option and index are only used to get the name of the option.
This can be obtained from s->option instead.

Signed-off-by: Caleb Sander Mateos <csander@purestorage.com>
12 months agoutil: remove empty default case in argconfig functions
Caleb Sander Mateos [Tue, 16 Jul 2024 16:21:04 +0000 (10:21 -0600)]
util: remove empty default case in argconfig functions

Both argconfig_parse_type() and argconfig_set_opt_val()
switch on the argument value type and have an empty default case.
This is unnecessary and masks errors from unhandled enum values.
So drop the default cases.

Signed-off-by: Caleb Sander Mateos <csander@purestorage.com>
12 months agoutil: remove unnecessary parentheses in argconfig_parse_type()
Caleb Sander Mateos [Tue, 16 Jul 2024 16:17:46 +0000 (10:17 -0600)]
util: remove unnecessary parentheses in argconfig_parse_type()

Match the style in argconfig_set_opt_val().

Signed-off-by: Caleb Sander Mateos <csander@purestorage.com>
12 months agoutil: remove redundant cast in argconfig_parse_type()
Caleb Sander Mateos [Tue, 16 Jul 2024 16:13:01 +0000 (10:13 -0600)]
util: remove redundant cast in argconfig_parse_type()

s->default_value is already a void *,
so there is no need to cast it to a char * and back.

Signed-off-by: Caleb Sander Mateos <csander@purestorage.com>
12 months agoutil: inline argconfig_parse_byte()
Caleb Sander Mateos [Tue, 16 Jul 2024 16:10:48 +0000 (10:10 -0600)]
util: inline argconfig_parse_byte()

argconfig_parse_byte() is only used in argconfig_parse_type().
For consistency with the other cases, inline it into the function.

Signed-off-by: Caleb Sander Mateos <csander@purestorage.com>
12 months agoutil: remove redundant NULL check in argconfig_print_help()
Caleb Sander Mateos [Tue, 16 Jul 2024 16:05:41 +0000 (10:05 -0600)]
util: remove redundant NULL check in argconfig_print_help()

s has been checked to be non-NULL earlier,
so there is no need to check it in the loop.

Signed-off-by: Caleb Sander Mateos <csander@purestorage.com>
12 months agoutil: use cleanup to avoid goto in argconfig_parse()
Caleb Sander Mateos [Tue, 16 Jul 2024 15:57:38 +0000 (09:57 -0600)]
util: use cleanup to avoid goto in argconfig_parse()

Use _cleanup_free_ in place of explicit calls to free()
in argconfig_parse(). This simplifies the code
and allows using an early return in place of a goto.

Signed-off-by: Caleb Sander Mateos <csander@purestorage.com>
12 months agoutil: make argconfig_set_opt_val() a void function
Caleb Sander Mateos [Tue, 16 Jul 2024 15:49:46 +0000 (09:49 -0600)]
util: make argconfig_set_opt_val() a void function

argconfig_set_opt_val() always returns 0,
so there is no need for its return value.
Return 0 in the one caller, argconfig_set_opt_val(), instead.

Signed-off-by: Caleb Sander Mateos <csander@purestorage.com>
12 months agoutil: remove argconfig_parse_val() declaration
Caleb Sander Mateos [Tue, 16 Jul 2024 15:42:36 +0000 (09:42 -0600)]
util: remove argconfig_parse_val() declaration

argconfig_parse_val() is defined before it is used,
so there is no need to pre-declare it.

Signed-off-by: Caleb Sander Mateos <csander@purestorage.com>
12 months agoutil: remove argconfig CFG_SIZE type
Caleb Sander Mateos [Tue, 16 Jul 2024 18:42:44 +0000 (12:42 -0600)]
util: remove argconfig CFG_SIZE type

CFG_SIZE is unused and not handled by argconfig_set_opt_val().

Signed-off-by: Caleb Sander Mateos <csander@purestorage.com>
12 months agotest: add test cases for argconfig comma-separated array parsing
Caleb Sander Mateos [Tue, 16 Jul 2024 22:46:04 +0000 (16:46 -0600)]
test: add test cases for argconfig comma-separated array parsing

There are no unit tests currently covering
argconfig's comma-separated integer array parsing.
Add test cases to test-argconfig-parse.c
that use argconfig_parse_comma_sep_array_u32(),
verifying its functionality and edge cases.

Signed-off-by: Caleb Sander Mateos <csander@purestorage.com>
12 months agotest: add test cases for argconfig option values
Caleb Sander Mateos [Tue, 16 Jul 2024 18:38:11 +0000 (12:38 -0600)]
test: add test cases for argconfig option values

test-argconfig-parse.c tests argconfig option parsing,
but is missing test cases for options with opt_val lists.

Add test cases to verify this functionality and its edge cases.

Signed-off-by: Caleb Sander Mateos <csander@purestorage.com>
12 months agowdc: Update and refactor the C0h log page parsing
jeff-lien-wdc [Mon, 8 Jan 2024 15:38:55 +0000 (09:38 -0600)]
wdc: Update and refactor the C0h log page parsing

Add OCP 2.5 fields
Create common functions to get and parse the
different variations of the C0 log page.

Signed-off-by: jeff-lien-wdc <jeff.lien@wdc.com>
12 months agobuild(deps): bump mosteo-actions/docker-run from 1 to 2
dependabot[bot] [Mon, 15 Jul 2024 18:23:37 +0000 (18:23 +0000)]
build(deps): bump mosteo-actions/docker-run from 1 to 2

Bumps [mosteo-actions/docker-run](https://github.com/mosteo-actions/docker-run) from 1 to 2.
- [Release notes](https://github.com/mosteo-actions/docker-run/releases)
- [Commits](https://github.com/mosteo-actions/docker-run/compare/v1...v2)

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

Signed-off-by: dependabot[bot] <support@github.com>
12 months agobuild: use official download action
Daniel Wagner [Fri, 12 Jul 2024 18:38:38 +0000 (20:38 +0200)]
build: use official download action

There is no point in using 3rd party actions for downloading the
artifacts. Let's use the official one.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
12 months agobuild: fetch complete git history
Daniel Wagner [Fri, 12 Jul 2024 12:51:14 +0000 (14:51 +0200)]
build: fetch complete git history

In order to build a image with which contains the correct git version
SHA we need to fetch the complete git tree. Otherwise 'git describe'
fails and we use the project version string as fallback.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
12 months agobuild: show git version used during configuration
Daniel Wagner [Fri, 12 Jul 2024 12:18:12 +0000 (14:18 +0200)]
build: show git version used during configuration

Show which git version is used when configuration phase.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
12 months agobuild: add static build target
Daniel Wagner [Fri, 12 Jul 2024 11:52:54 +0000 (13:52 +0200)]
build: add static build target

Add a static build target.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
12 months agoccan: Add freed pointer checking to delete strset member
Tokunori Ikegami [Fri, 23 Feb 2024 12:07:48 +0000 (21:07 +0900)]
ccan: Add freed pointer checking to delete strset member

Add to set freed entry pointer to NULL then check it if NULL.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
12 months agofabrics: connect all hosts in config.json
Daniel Wagner [Tue, 9 Jul 2024 09:02:48 +0000 (11:02 +0200)]
fabrics: connect all hosts in config.json

Iterate over all hosts defined in the config.json configuration file,
instead just the default controller.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
12 months agofabrics: refactore discover from json config
Daniel Wagner [Fri, 5 Jul 2024 12:35:30 +0000 (14:35 +0200)]
fabrics: refactore discover from json config

Move the connect logic out of the subsystem, ctrl loop. Too much
indention.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
12 months agofabrics: first read config before topology scanning
Daniel Wagner [Thu, 11 Jul 2024 08:49:23 +0000 (10:49 +0200)]
fabrics: first read config before topology scanning

The topology scanning will create nodes in the internal libnvme tree. As
we rely on the order of the nodes in the tree, we need to read the
config before we scan. This makes sure the first node is the one we have
defined in the config.json. This is important because the first node
provides default hosnqn configuration in absents of /etc/nvme/hostnqn.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
12 months agofabrics: use helper to lookup default hostnqn/hostid
Daniel Wagner [Wed, 3 Jul 2024 08:22:18 +0000 (10:22 +0200)]
fabrics: use helper to lookup default hostnqn/hostid

libnvme provides a handy new helper to lookup the hostnqn and hostid.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
12 months agofabrics: extend already connected message
Daniel Wagner [Thu, 11 Jul 2024 11:40:42 +0000 (13:40 +0200)]
fabrics: extend already connected message

The 'already connected' message only contains the traddr as info. Add
the missing information so that it's possible to figure out what
combination is already in use.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
12 months agofabrics: use cleanup helper to free nvme root object
Daniel Wagner [Wed, 3 Jul 2024 09:42:42 +0000 (11:42 +0200)]
fabrics: use cleanup helper to free nvme root object

Simplify the error handling path by using the cleanup helpers.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
12 months agobuild: bump libnvme wrap
Daniel Wagner [Fri, 12 Jul 2024 08:20:25 +0000 (10:20 +0200)]
build: bump libnvme wrap

Fetch hostnqn changes.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
12 months agonvme: check MD size with PI size when PRACT set to 1
Francis Pravin [Fri, 12 Jul 2024 06:18:51 +0000 (11:48 +0530)]
nvme: check MD size with PI size when PRACT set to 1

As per NVM Command Set Specification, Rev 1.0d, Sec-5.2.2 PRACT Bit:
"If PRACT bit is set to 1 and Metadata size equals to the Protection
Information size, the protection information is stripped or inserted
by the controller."
Currently NVMe supports 8 and 16 byte size of Protection Information.
So, use pi_size instead of 8 byte.

Signed-off-by: Francis Pravin <francis.p@samsung.com>
Reviewed-by: Steven Seungcheol Lee <sc108.lee@samsung.com>
12 months agonvme-print: add new field added in TP4090
Nitin Sao [Wed, 26 Jun 2024 03:17:42 +0000 (08:47 +0530)]
nvme-print: add new field added in TP4090

As per TP4090, a new field support is added as NPDGL (Namespace
Preferred Deallocate Granularity Large) and so the bit-field of
NSFEAT, OPTPERF get extended by 1 bit.

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 agobuild: bump libnvme wrap
Nitin Sao [Wed, 26 Jun 2024 03:17:42 +0000 (08:47 +0530)]
build: bump libnvme wrap

Fetch npdgl field from nvme_nvm_id_ns

Signed-off-by: Nitin Sao <nitin.sao@samsung.com>
12 months agonvme-print-binary: add effects-log command output missed
Tokunori Ikegami [Tue, 9 Jul 2024 15:55:49 +0000 (00:55 +0900)]
nvme-print-binary: add effects-log command output missed

The csi data added before effects log page output.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
12 months agobuild: add documentation CI build
Daniel Wagner [Wed, 10 Jul 2024 06:58:16 +0000 (08:58 +0200)]
build: add documentation CI build

Build the documentation in the CI build to catch formatting issues in
the submissions.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
12 months agocompletions: add ocp get-error-injection command
Tokunori Ikegami [Sun, 7 Jul 2024 07:52:44 +0000 (16:52 +0900)]
completions: add ocp get-error-injection command

The set-error-injection command will be added separately.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
12 months agodoc: add ocp get-error-injection command
Tokunori Ikegami [Sun, 7 Jul 2024 07:36:07 +0000 (16:36 +0900)]
doc: add ocp get-error-injection command

The set-error-injection command will be added separately.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
12 months agoocp: add get-error-injection command
Tokunori Ikegami [Sun, 7 Jul 2024 06:08:20 +0000 (15:08 +0900)]
ocp: add get-error-injection command

The set-error-injection command will be added separately.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
12 months agoocp: fix eol-plp-failure-mode command sel option value
Tokunori Ikegami [Sun, 7 Jul 2024 09:11:05 +0000 (18:11 +0900)]
ocp: fix eol-plp-failure-mode command sel option value

Since the select value 8 as changed not supported by the command.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
12 months agodoc: fix ocp eol-plp-failure-mode select short option
Tokunori Ikegami [Sun, 7 Jul 2024 08:20:55 +0000 (17:20 +0900)]
doc: fix ocp eol-plp-failure-mode select short option

Fix -s to -S since the -s is used for the save short option.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
12 months agoocp: set UUID index for eol-plp-failure-mode command to get
Tokunori Ikegami [Sun, 7 Jul 2024 06:28:54 +0000 (15:28 +0900)]
ocp: set UUID index for eol-plp-failure-mode command to get

The value required from OCP version 2.0 for get feature command also.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
12 months agonvme: fix verbose logging
Martin George [Mon, 8 Jul 2024 16:03:58 +0000 (21:33 +0530)]
nvme: fix verbose logging

The -v verbose option for certain nvme commands like id-ctrl,
id-ns, smart-log, sanitize-log, etc. is practically a no-op since
it only prints latency info in addition to the regular output.
But at the same time, these commands already implement a -H human
readable option which prints additional useful info. So fix the
-v option to make it synonymous with the -H option here. And while
we are at it, move the latency info from current INFO level (i.e.
-v logging) to DEBUG level (i.e. -vv logging) since it is better
suited there.

Signed-off-by: Martin George <marting@netapp.com>
12 months agodoc: fix micron ocp telemetry log parse title
Daniel Wagner [Tue, 9 Jul 2024 15:38:41 +0000 (17:38 +0200)]
doc: fix micron ocp telemetry log parse title

The title needs a man page section info.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
12 months agonvme-rpmb: send RPMB_REQ_READ_RESULT for authentication key programming
Tokunori Ikegami [Fri, 28 Jun 2024 11:57:40 +0000 (20:57 +0900)]
nvme-rpmb: send RPMB_REQ_READ_RESULT for authentication key programming

This follows the NVMe revision 2.0a authentication key data flow.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
12 months agoplugins/micron: Add support for OCP telemetry log parsing
Chaithanya shoba [Fri, 24 May 2024 07:26:08 +0000 (12:56 +0530)]
plugins/micron: Add support for OCP telemetry log parsing

Datacenter NVMe SSD Specification v2.5r9, section 4.9.

Signed-off-by: Chaithanya Shoba <ashoba@micron.com>
12 months agoocp: Update Plugin Version
jeff-lien-wdc [Fri, 5 Jul 2024 14:35:08 +0000 (09:35 -0500)]
ocp: Update Plugin Version

Update ocp plugin version to 2.9.0

Signed-off-by: jeff-lien-wdc <jeff.lien@wdc.com>
12 months agonvme: fix lbaf inuse to use 6:5 bits
Steven Seungcheol Lee [Mon, 8 Jul 2024 06:55:54 +0000 (15:55 +0900)]
nvme: fix lbaf inuse to use 6:5 bits

Signed-off-by: Steven Seungcheol Lee <sc108.lee@samsung.com>
12 months agoocp: use NVME_ARGS macro definition by eol-plp-failure-mode command
Tokunori Ikegami [Sun, 7 Jul 2024 13:55:14 +0000 (22:55 +0900)]
ocp: use NVME_ARGS macro definition by eol-plp-failure-mode command

The verbose, output-format and timeout options enabled by the macro.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
12 months agonvme: extern NVME_ARGS macro definition
Tokunori Ikegami [Sun, 7 Jul 2024 13:52:41 +0000 (22:52 +0900)]
nvme: extern NVME_ARGS macro definition

To use the macro by the plugins/ocp commands etc.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
12 months agonvme: use _cleanup_free_ type buffer for get-feature command
Tokunori Ikegami [Sat, 6 Jul 2024 11:35:25 +0000 (20:35 +0900)]
nvme: use _cleanup_free_ type buffer for get-feature command

Reduce the buffer free calls.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
12 months agoplugins/ocp: Update telemetry string log page (C9h)
Vigneshwaran Saravanan/Vigneshwaran Saravanan [Thu, 4 Jul 2024 08:36:02 +0000 (14:06 +0530)]
plugins/ocp: Update telemetry string log page (C9h)

Take care the below failures for "telemetry-string-log".

Resolved the json printing issue.

Changed the Statistic Identifier, Event String, Vendor Unique, ASCII
table offset and size calculation.

Reviewed-by: Karthik Balan <karthik.b82@samsung.com>
Reviewed-by: Arunpandian J <arun.j@samsung.com>
Reviewed-by: Jayakanthan Rajendran <jaya.ganthan@samsung.com>
Signed-off-by: Vigneshwaran Saravanan <s.vignesh@samsung.com>
12 months agonvme-print-json: add get-feature command fahrenheit temperature output
Tokunori Ikegami [Sun, 30 Jun 2024 06:56:27 +0000 (15:56 +0900)]
nvme-print-json: add get-feature command fahrenheit temperature output

Add temperature threshold and host controlled thermal management outputs.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
12 months agonvme: add get-feature and id-ctrl commands fahrenheit outputs
Tokunori Ikegami [Fri, 5 Jul 2024 16:01:15 +0000 (01:01 +0900)]
nvme: add get-feature and id-ctrl commands fahrenheit outputs

Show temperatures in degrees fahrenheit by the option.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
12 months agonvme: delete smart-log command fahrenheit option
Tokunori Ikegami [Fri, 5 Jul 2024 15:52:48 +0000 (00:52 +0900)]
nvme: delete smart-log command fahrenheit option

Used locale for the fahrenheit temperature instead.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
12 months agonvme-print: check locale to use temperatures in degrees fahrenheit
Tokunori Ikegami [Thu, 4 Jul 2024 16:55:45 +0000 (01:55 +0900)]
nvme-print: check locale to use temperatures in degrees fahrenheit

Delete the fahrenheit option separately.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
12 months agocompletion: add support for tls-key
Daniel Wagner [Thu, 4 Jul 2024 17:17:46 +0000 (19:17 +0200)]
completion: add support for tls-key

The tls-key command is missing support for the zsh and bash completion.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
12 months agodoc: add tls-key --revoke documentation
Daniel Wagner [Mon, 1 Jul 2024 09:24:12 +0000 (11:24 +0200)]
doc: add tls-key --revoke documentation

Add the --revoke option to the tls-key documentation.

While at it, add examples how to use it.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
12 months agodoc: fix tls-key --keyfile shorthand
Daniel Wagner [Thu, 4 Jul 2024 17:20:27 +0000 (19:20 +0200)]
doc: fix tls-key --keyfile shorthand

The shorthand for --keyfile is -f and not -k.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
12 months agobuild: sort documentation files entries
Daniel Wagner [Mon, 1 Jul 2024 12:38:27 +0000 (14:38 +0200)]
build: sort documentation files entries

Sort the file names alphabetically.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
12 months agonvme: add support to revoke TLS key
Daniel Wagner [Mon, 1 Jul 2024 09:13:11 +0000 (11:13 +0200)]
nvme: add support to revoke TLS key

Add support to nvme-cli to revoke TLS keys from a keyring.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
12 months agonvme: return error code/message for TLS commands
Daniel Wagner [Tue, 9 Jul 2024 09:19:06 +0000 (11:19 +0200)]
nvme: return error code/message for TLS commands

Propagate error codes for TLS commands. Also print an error message when
scanning TLS keys.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
12 months agonvme: factor out import key function
Daniel Wagner [Fri, 28 Jun 2024 18:12:55 +0000 (20:12 +0200)]
nvme: factor out import key function

Split the command line option handling code from the operation.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
12 months agonvme: use cleanup helper to close file descriptor
Daniel Wagner [Thu, 4 Jul 2024 16:43:54 +0000 (18:43 +0200)]
nvme: use cleanup helper to close file descriptor

io_mgmt_send uses a file descriptor. Let's use the cleanup helper to
close it.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
12 months agonvme-rpmb: use cleanup helper for STREAM objects
Daniel Wagner [Thu, 4 Jul 2024 16:42:46 +0000 (18:42 +0200)]
nvme-rpmb: use cleanup helper for STREAM objects

write_file uses a STREAM. Let's use the cleanup helper to close it.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
12 months agofabrics: use cleanup helper for STREAM objects
Daniel Wagner [Thu, 4 Jul 2024 16:41:35 +0000 (18:41 +0200)]
fabrics: use cleanup helper for STREAM objects

discover_from_conf_file uses a STREAM. Let's use the cleanup helper to
close it.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
12 months agonvme: use cleanup helper for STREAM objects
Daniel Wagner [Thu, 4 Jul 2024 16:38:56 +0000 (18:38 +0200)]
nvme: use cleanup helper for STREAM objects

The tls_key function is using a STREAM object and closes it when leaving
the context. Update it to use the helper.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
12 months agonvme: strip newline when parsing TLS key files
Daniel Wagner [Mon, 1 Jul 2024 12:46:04 +0000 (14:46 +0200)]
nvme: strip newline when parsing TLS key files

When exporting a TLS keys from the kernel keyring a line might have a
newline. Strip the newline away as the nvme_import_tls_key is not
expecting it and thus fails to load an exported keyfile.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
12 months agonvme: use stdout for exporting TLS keys
Daniel Wagner [Mon, 1 Jul 2024 09:41:11 +0000 (11:41 +0200)]
nvme: use stdout for exporting TLS keys

The export command should use stdout as default output as documentation
claims. Furthermore, it should open the keyfile to write in write mode.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
12 months agobuild: bump libnvme wrap
Daniel Wagner [Thu, 4 Jul 2024 17:28:07 +0000 (19:28 +0200)]
build: bump libnvme wrap

Fetch nvme_revoke_tls_key.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
12 months agonvme: change _cleanup_file_ to _cleanup_fd_
Tokunori Ikegami [Thu, 4 Jul 2024 15:59:56 +0000 (00:59 +0900)]
nvme: change _cleanup_file_ to _cleanup_fd_

Add _cleanup_file_ to clean up file stream instead.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
12 months agocommon.h: Avoid using unsupported load/store instructions in arm64 VMs
Oliver Upton [Thu, 4 Jul 2024 09:09:40 +0000 (09:09 +0000)]
common.h: Avoid using unsupported load/store instructions in arm64 VMs

Using nvme show-regs within a VM on arm64 can sometimes lead to VM
termination.

To answer why this happens: one of the deficiencies of the Arm
architecture is that there exists a range of load/store instructions
that have insufficient decode information for traps taken to the
hypervisor. KVM, for example, may raise an external abort or outright
terminate the VM depending on the configuration.

This is a known problem on the kernel side, and is fixed by using
assembly MMIO accessors w/ 'safe' load/store instructions. So do
exactly that, providing arm64-specific accessors and falling back to
plain old volatile pointer accesses for other architectures.

Reported-by: William Butler <wab@google.com>
Signed-off-by: Oliver Upton <oliver.upton@linux.dev>
12 months agoocp: OCP 2.5 Telemetry DA 1 and 2 Parsing Updates
jeff-lien-wdc [Wed, 10 Apr 2024 17:51:46 +0000 (12:51 -0500)]
ocp: OCP 2.5 Telemetry DA 1 and 2 Parsing Updates

This commit will provide the first phase of changes
needed for parsing of OCP 2.5 Telemetry Data Areas
1 and 2.  It will decode the prefined classes,
statistics, and events.

Signed-off-by: jeff-lien-wdc <jeff.lien@wdc.com>
12 months agonvme-print-stdout: refactor subsys config
Daniel Wagner [Tue, 2 Jul 2024 12:21:51 +0000 (14:21 +0200)]
nvme-print-stdout: refactor subsys config

DRY the subsys config output. Refactor into a helper.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
12 months agowdc: Fix compiler warning.
jeff-lien-wdc [Tue, 2 Jul 2024 14:45:23 +0000 (09:45 -0500)]
wdc: Fix compiler warning.

Make the file_path array size big enough to contain the
full directory and file name.

Signed-off-by: jeff-lien-wdc <jeff.lien@wdc.com>
12 months agonvme: add flags type nvme_print_flags_t
Tokunori Ikegami [Mon, 1 Jul 2024 16:06:31 +0000 (01:06 +0900)]
nvme: add flags type nvme_print_flags_t

Change the flags type to the type from enum nvme_print_flags.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
12 months agonvme-print: Use 'unsigned int' instead of 'unsigned'
Tokunori Ikegami [Sat, 29 Jun 2024 07:41:56 +0000 (16:41 +0900)]
nvme-print: Use 'unsigned int' instead of 'unsigned'

Fix for the checkpatch review error below.
  Error: WARNING: Prefer 'unsigned int' to bare use of 'unsigned'

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
12 months agonvme: update parse_args() return value handling
Martin George [Sun, 30 Jun 2024 07:39:07 +0000 (13:09 +0530)]
nvme: update parse_args() return value handling

Treat non-zero return values from parse_args() as errors, and not
just negative return values. Also makes this consistent with other
functions in nvme.c where parse_args() is invoked.

Signed-off-by: Martin George <marting@netapp.com>
13 months agonvme-print: Fix nvme_show_smart_log indentation error
Tokunori Ikegami [Fri, 28 Jun 2024 15:39:31 +0000 (00:39 +0900)]
nvme-print: Fix nvme_show_smart_log indentation error

Follow the linux kernel coding style indentation.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
13 months agonvme-print-stdout: Fix stdout_smart_log indentation error
Tokunori Ikegami [Fri, 28 Jun 2024 15:35:26 +0000 (00:35 +0900)]
nvme-print-stdout: Fix stdout_smart_log indentation error

Follow the linux kernel coding style indentation.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
13 months agonvme-print-binary: Fix binary_smart_log indentation error
Tokunori Ikegami [Fri, 28 Jun 2024 15:33:28 +0000 (00:33 +0900)]
nvme-print-binary: Fix binary_smart_log indentation error

Follow the linux kernel coding style indentation.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
13 months agocompletions: add smart-log command fahrenheit option
Tokunori Ikegami [Fri, 28 Jun 2024 09:11:11 +0000 (18:11 +0900)]
completions: add smart-log command fahrenheit option

Added the verbose option missed also.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
13 months agodoc: Add smart-log command fahrenheit option
Tokunori Ikegami [Fri, 28 Jun 2024 08:58:08 +0000 (17:58 +0900)]
doc: Add smart-log command fahrenheit option

Show temperatures in degrees fahrenheit by the option.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
13 months agonvme: Add smart-log command fahrenheit option
Tokunori Ikegami [Fri, 28 Jun 2024 15:39:03 +0000 (00:39 +0900)]
nvme: Add smart-log command fahrenheit option

Show temperatures in degrees fahrenheit by the option.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
13 months agonvme-print: add PEL vendor specific and TCG defined events strings
Tokunori Ikegami [Fri, 28 Jun 2024 08:31:52 +0000 (17:31 +0900)]
nvme-print: add PEL vendor specific and TCG defined events strings

Added the PEL event types definitions in libnvme.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
13 months agobuild: bump libnvme wrap
Tokunori Ikegami [Fri, 28 Jun 2024 08:31:32 +0000 (17:31 +0900)]
build: bump libnvme wrap

Include libnvme nvme_persistent_event_types definition changes.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
13 months agonvme-print: Print PEL reserved event string
Tokunori Ikegami [Fri, 28 Jun 2024 01:12:54 +0000 (10:12 +0900)]
nvme-print: Print PEL reserved event string

Previously PEL reserved event output as NULL string.
This resolves to print as reserved event with the event type value.

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