]> www.infradead.org Git - users/sagi/nvme-cli.git/log
users/sagi/nvme-cli.git
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>
13 months agocompletions: Add timeout option bash completions
Tokunori Ikegami [Sun, 14 Apr 2024 04:19:03 +0000 (13:19 +0900)]
completions: Add timeout option bash completions

Added the option as a nvme default option.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
13 months agocompletions: Add timeout option zsh completions
Tokunori Ikegami [Sat, 13 Apr 2024 17:09:45 +0000 (02:09 +0900)]
completions: Add timeout option zsh completions

Added the option as a nvme default option.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
13 months agocompletions: Add io-mgmt-recv/send commands zsh completions
Tokunori Ikegami [Sat, 13 Apr 2024 17:07:10 +0000 (02:07 +0900)]
completions: Add io-mgmt-recv/send commands zsh completions

Missed to add the commands completions.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
13 months agocompletions: Add /dev/nvme argument missed
Tokunori Ikegami [Sat, 13 Apr 2024 17:02:29 +0000 (02:02 +0900)]
completions: Add /dev/nvme argument missed

The nvme-mi-recv/send and get/set-reg commands missed it.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
13 months agocompletions: Change fw-activate command name to fw-commit
Tokunori Ikegami [Sat, 13 Apr 2024 16:39:26 +0000 (01:39 +0900)]
completions: Change fw-activate command name to fw-commit

The fw-activate command is old version prior to 1.2.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
13 months agocompletions: Fix _nvme indentation errors
Tokunori Ikegami [Wed, 26 Jun 2024 15:31:50 +0000 (00:31 +0900)]
completions: Fix _nvme indentation errors

Fix white spaces indentation to use tabs.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
13 months agocompletions: Fix bash-nvme-completion.sh indentation errors
Tokunori Ikegami [Sat, 13 Apr 2024 16:29:15 +0000 (01:29 +0900)]
completions: Fix bash-nvme-completion.sh indentation errors

Fix white spaces indentation to use tabs.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
13 months agodoc: Add nvme commands timeout option
Tokunori Ikegami [Thu, 11 Apr 2024 16:01:01 +0000 (01:01 +0900)]
doc: Add nvme commands timeout option

The option added as NVME_ARGS default option.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
13 months agonvme: Add support for delete-ns command timeout option
Tokunori Ikegami [Wed, 10 Apr 2024 16:13:14 +0000 (01:13 +0900)]
nvme: Add support for delete-ns command timeout option

Change to pass the timeout value to libnvme API.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
13 months agonvme: Change NVME_DEFAULT_IOCTL_TIMEOUT to use nvme_cfg timeout
Tokunori Ikegami [Wed, 10 Apr 2024 15:17:51 +0000 (00:17 +0900)]
nvme: Change NVME_DEFAULT_IOCTL_TIMEOUT to use nvme_cfg timeout

The timeout variable zero initialized as same with the default definition.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
13 months agonvme: Add nvme_cfg timeout default option
Tokunori Ikegami [Wed, 10 Apr 2024 14:53:05 +0000 (23:53 +0900)]
nvme: Add nvme_cfg timeout default option

Replace the existing timeout options to use this instead.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
13 months agonvme: Add nvme_cfg global variable for NVME_ARGS default options
Tokunori Ikegami [Wed, 26 Jun 2024 15:29:38 +0000 (00:29 +0900)]
nvme: Add nvme_cfg global variable for NVME_ARGS default options

To preapare to add NVME_ARGS default option further.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
13 months agonvme: add helper function to get pif and sts value
Francis Pravin [Wed, 26 Jun 2024 13:37:50 +0000 (19:07 +0530)]
nvme: add helper function to get pif and sts value

Add a helper function to get pif and sts value from elbaf filed.

Signed-off-by: Francis Pravin <francis.p@samsung.com>
13 months agonvme: choose PIF from QPIF if QPIFS supports and PIF is QTYPE
Francis Pravin [Wed, 26 Jun 2024 06:35:39 +0000 (12:05 +0530)]
nvme: choose PIF from QPIF if QPIFS supports and PIF is QTYPE

As per TP4141a:
"If the Qualified Protection Information Format Support(QPIFS) bit is
set to 1 and the Protection Information Format(PIF) field is set to 11b
(i.e., Qualified Type), then the pif is as defined in the Qualified
Protection Information Format (QPIF) field."
So, choose PIF from QPIF if QPIFS supports and PIF is QTYPE.

Signed-off-by: Francis Pravin <francis.p@samsung.com>
Reviewed-by: Steven Seungcheol Lee <sc108.lee@samsung.com>
13 months agonvme: use libnvme's atomic ANA log page fetch
Caleb Sander Mateos [Tue, 30 Apr 2024 22:35:01 +0000 (16:35 -0600)]
nvme: use libnvme's atomic ANA log page fetch

nvme ana-log currently uses libnvme's nvme{,_mi_admin}_get_log_ana()
function to fetch the ANA log page.
As described in the commit adding nvme_get_ana_log_atomic() to libnvme,
this has the potential to overread the ANA log page
and may result in a torn result if the log page changes concurrently.
Use nvme{,_mi_admin}_get_ana_log_atomic() to only fetch up to the end
of the ANA log page and protect against concurrent log page changes.

Signed-off-by: Caleb Sander Mateos <csander@purestorage.com>
13 months agonvme: fix maximum ANA log page length calculation
Caleb Sander Mateos [Mon, 24 Jun 2024 21:31:39 +0000 (15:31 -0600)]
nvme: fix maximum ANA log page length calculation

nvme ana-log only includes space for MNAN namespace IDs
in the allocated ANA log page buffer if bit 6 of ANACAP
in the Identify Controller structure isn't set.

But the specification says:
Bit 6 if set to '1', then the ANAGRPID field in the Identify Namespace
data structure (refer to the NVM Command Set Specification)
does not change while the namespace is attached to any controller

There is no suggestion that NSIDs won't be returned in the ANA log page.

However, we can exclude space for NSIDs from the allocated buffer
if the Get Log Page command is going to be sent with the RGO bit set,
i.e. the --groups argument is passed.

Therefore, use the libnvme helper nvme_get_ana_log_len_from_id_ctrl()
to calculate the maximum ANA log page length.
It ignores ANACAP and takes the RGO setting into account.

Signed-off-by: Caleb Sander Mateos <csander@purestorage.com>
Fixes: bb269bdb5392 ("nvme-cli: add minimal ana-log page support")
13 months agobuild: update libnvme wrap
Caleb Sander Mateos [Tue, 25 Jun 2024 15:03:37 +0000 (09:03 -0600)]
build: update libnvme wrap

Pick up support for nvme_get_ana_log_atomic()
and nvme_get_ana_log_len_from_id_ctrl().

Signed-off-by: Caleb Sander Mateos <csander@purestorage.com>
13 months agonvme-print-json: add missing va_end()
Maurizio Lombardi [Mon, 24 Jun 2024 15:35:56 +0000 (17:35 +0200)]
nvme-print-json: add missing va_end()

Every va_start() should be matched by a corresponding va_end()
to keep the static analyzers happy.

Signed-off-by: Maurizio Lombardi <mlombard@redhat.com>
13 months agofabrics: skip namespace scan for fabric commands
Daniel Wagner [Fri, 7 Jun 2024 12:43:55 +0000 (14:43 +0200)]
fabrics: skip namespace scan for fabric commands

The fabric commands such as connect or disconnect don't need a full
topology scan. The scan is not scalling well on larger setups, thus skip
it.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
13 months agonvme-print: print the new fields added in TP4141a
Francis Pravin [Fri, 21 Jun 2024 07:36:22 +0000 (13:06 +0530)]
nvme-print: print the new fields added in TP4141a

Print the newly added fields in TP4141a. Also, fixed the stcrs
bit mask value.

Signed-off-by: Francis Pravin <francis.p@samsung.com>
Reviewed-by: Steven Seungcheol Lee <sc108.lee@samsung.com>
13 months agoplugins/ocp: underflow + index fixes for telemetry
Brandon Paupore [Tue, 18 Jun 2024 15:33:04 +0000 (10:33 -0500)]
plugins/ocp: underflow + index fixes for telemetry

Printing the GUID was crashing due to the unsigned int never becoming
less than 0, and fixing that triggered a warning about an incorrect max
index when printing Event FIFO data.

Signed-off-by: Brandon Paupore <brandon.paupore@wdc.com>
13 months agobuild(deps): bump dawidd6/action-download-artifact from 5 to 6
dependabot[bot] [Mon, 17 Jun 2024 18:50:39 +0000 (18:50 +0000)]
build(deps): bump dawidd6/action-download-artifact from 5 to 6

Bumps [dawidd6/action-download-artifact](https://github.com/dawidd6/action-download-artifact) from 5 to 6.
- [Release notes](https://github.com/dawidd6/action-download-artifact/releases)
- [Commits](https://github.com/dawidd6/action-download-artifact/compare/v5...v6)

---
updated-dependencies:
- dependency-name: dawidd6/action-download-artifact
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
13 months agoplugins/ocp: Add ocp TCG Configuration Log Page
Vigneshwaran Saravanan [Wed, 5 Jun 2024 06:08:15 +0000 (11:38 +0530)]
plugins/ocp: Add ocp TCG Configuration Log Page

Add TCG Configuration Log Page support to the ocp plugin.

Reviewed-by: Karthik Balan <karthik.b82@samsung.com>
Reviewed-by: Arunpandian J <arun.j@samsung.com>
Signed-off-by: Vigneshwaran Saravanan <s.vignesh@samsungds.net>
[dwagner: - updated commmit message
          - dropped html doc generation]
Signed-off-by: Daniel Wagner <dwagner@suse.de>
13 months agonvme-print-stdout: Add helper function to print PIF in string form
Francis Pravin [Mon, 17 Jun 2024 09:48:52 +0000 (15:18 +0530)]
nvme-print-stdout: Add helper function to print PIF in string form

Use PIF enum and add a helper function to print the Protection
Information Format(PIF) in string form.

Signed-off-by: Francis Pravin <francis.p@samsung.com>
13 months agobuild: update libnvme wrap
Francis Pravin [Mon, 17 Jun 2024 06:40:07 +0000 (12:10 +0530)]
build: update libnvme wrap

Get PIF enum and the new field added in TP4141a.

Signed-off-by: Francis Pravin <francis.p@samsung.com>
13 months agodoc: fix format command info
Hasan Polat [Sat, 8 Jun 2024 03:19:48 +0000 (23:19 -0400)]
doc: fix format command info

Protection Information is not only 8 bytes of the metadata, it can
also be 16 bytes such as in 32b and 64b guard protection formats.

Signed-off-by: Hasan Polat <hasnpol2002@gmail.com>
13 months agonvme: telemetry: report the correct error if the ioctl() fails.
Maurizio Lombardi [Wed, 22 May 2024 13:06:18 +0000 (15:06 +0200)]
nvme: telemetry: report the correct error if the ioctl() fails.

It's wrong to assume that if the ioctl() returns a non-zero number
then the errno variable is set.
The ioctl() might return an NVMe Status error to inform the caller
that the requested log page is not supported, in that case errno is left
untouched.

The original code didn't handle this case and returned "-errno" even when
the latter was zero. The caller interpreted this as a successful operation
and this might lead to improperly dereferencing the log page pointer.

$ nvme telemetry-log /dev/nvme0 --output-file=telemetry_log.bin
ERROR: get_telemetry_log: : write failed with error : Bad address

Fix this bug by returning the NVMe status if errno is zero:

$ nvme telemetry-log /dev/nvme0 --output-file=telemetry_log.bin
NVMe status: Invalid Log Page: The log page indicated is invalid(0x109)
Failed to acquire telemetry log 265!

Signed-off-by: Maurizio Lombardi <mlombard@redhat.com>
13 months agonvme-print: add the cancel opcode to the nvme_cmd_to_string() list
Maurizio Lombardi [Wed, 15 May 2024 10:07:34 +0000 (12:07 +0200)]
nvme-print: add the cancel opcode to the nvme_cmd_to_string() list

Print the correct opcode name instead of "Unknown".

Signed-off-by: Maurizio Lombardi <mlombard@redhat.com>
13 months agobuild: reorder release commits
Daniel Wagner [Fri, 14 Jun 2024 07:17:41 +0000 (09:17 +0200)]
build: reorder release commits

Previously, we updated the docs after the commit so that any version
string in the docs are correct. But there are none, thus we can update
the docs before doing the release. This makes the release look a bit
more natural.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
13 months agodoc: fix ocp format issues
Daniel Wagner [Fri, 14 Jun 2024 08:01:36 +0000 (10:01 +0200)]
doc: fix ocp format issues

asccidoc complains about invalid formatting. Fix this.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
13 months agonbft: Reuse existing discovery controller
Tomas Bzatek [Mon, 20 May 2024 15:43:01 +0000 (17:43 +0200)]
nbft: Reuse existing discovery controller

Attempt to look up and use existing (persistent) discovery
controller.

Signed-off-by: Tomas Bzatek <tbzatek@redhat.com>
13 months agonbft: Skip SSNS records pointing to well-known discovery NQN
Tomas Bzatek [Thu, 25 Apr 2024 13:54:53 +0000 (15:54 +0200)]
nbft: Skip SSNS records pointing to well-known discovery NQN

Depending on a pre-OS implementation, boot attempts pointing
to the well-known discovery NQN may get transformed in
an SSNS record (and marked as 'unavailable') in case
the discovery cannot be performed. Otherwise the NBFT
table should be populated by discovered records instead.

Signed-off-by: Tomas Bzatek <tbzatek@redhat.com>
13 months agonbft: Perform actual discovery
Tomas Bzatek [Wed, 24 Apr 2024 15:52:46 +0000 (17:52 +0200)]
nbft: Perform actual discovery

This adds actual discovery support for Discovery Descriptor records.

SSNS records are connected first. Discovery Descriptor records
are checked for any existing (back-)reference from SSNS records
and are skipped if so. It is assumed in such case that the pre-OS
driver has succeeded in discovery and filled SSNS records
accordingly.

In case no SSNS record references the particular Discovery
record, an actual discovery is performed.

Signed-off-by: Tomas Bzatek <tbzatek@redhat.com>
13 months agoutil/cleanup: Add cleanup for struct nvme_fabrics_uri
Tomas Bzatek [Wed, 24 Apr 2024 15:47:02 +0000 (17:47 +0200)]
util/cleanup: Add cleanup for struct nvme_fabrics_uri

libnvme cleanup definitions are not part of public API.

Signed-off-by: Tomas Bzatek <tbzatek@redhat.com>
13 months agofabrics: Make some symbols public
Tomas Bzatek [Wed, 24 Apr 2024 15:46:19 +0000 (17:46 +0200)]
fabrics: Make some symbols public

Needed for nbft, useful to have public.

Signed-off-by: Tomas Bzatek <tbzatek@redhat.com>
13 months agonvme-print-stdout: fix format index in stdout_nvm_id_ns
Francis Pravin [Thu, 16 May 2024 07:34:37 +0000 (13:04 +0530)]
nvme-print-stdout: fix format index in stdout_nvm_id_ns

Use nvme_id_ns_flbas_to_lbaf_inuse() to get the proper format index
of the namespace.

Signed-off-by: Francis Pravin <francis.p@samsung.com>
13 months agobuild: separate builds of libnvme and nvme-cli
Daniel Wagner [Thu, 13 Jun 2024 12:31:25 +0000 (14:31 +0200)]
build: separate builds of libnvme and nvme-cli

Build and install libnvme separately from libnvme. This should catch any
attempts to include private headers from the library.

Also this is what distro usually do, so we should test this as well.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
13 months agobuild(deps): bump dawidd6/action-download-artifact from 3 to 5
dependabot[bot] [Mon, 10 Jun 2024 18:19:00 +0000 (18:19 +0000)]
build(deps): bump dawidd6/action-download-artifact from 3 to 5

Bumps [dawidd6/action-download-artifact](https://github.com/dawidd6/action-download-artifact) from 3 to 5.
- [Release notes](https://github.com/dawidd6/action-download-artifact/releases)
- [Commits](https://github.com/dawidd6/action-download-artifact/compare/v3...v5)

---
updated-dependencies:
- dependency-name: dawidd6/action-download-artifact
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
13 months agoplugins/solidigm: Added workload-tracker command
Leonardo da Cunha [Tue, 4 Jun 2024 22:50:14 +0000 (15:50 -0700)]
plugins/solidigm: Added workload-tracker command

Added set up and continuous parse and consolidation of workload log.

Signed-off-by: Leonardo da Cunha <leonardo.da.cunha@solidigm.com>
13 months agoplugins/solidigm: Added extra VU fields to id-ctrl
Anant Mashiana [Tue, 28 May 2024 20:42:58 +0000 (13:42 -0700)]
plugins/solidigm: Added extra VU fields to id-ctrl

Added 13 extra VU fields to Solidigm id-ctrl
including a buffer for correct offset

Signed-off-by: Anant Mashiana <anant.mashiana@solidigm.com>
13 months agonvme-print-stdout: print MEM bit of CTRATT field
Francis Pravin [Mon, 3 Jun 2024 10:55:45 +0000 (16:25 +0530)]
nvme-print-stdout: print MEM bit of CTRATT field

Print MDTS and Size Limits Exclude Metadata(MEM) bit of CTRATT field
which added in TP-4099.

Signed-off-by: Francis Pravin <francis.p@samsung.com>
Reviewed-by: Steven Seungcheol Lee <sc108.lee@samsung.com>
Reviewed-by: Minwoo Im <minwoo.im@samsung.com>
13 months agonvme-print-stdout: fix to print the log line by line
Francis Pravin [Tue, 28 May 2024 12:32:14 +0000 (18:02 +0530)]
nvme-print-stdout: fix to print the log line by line

Fix to print the log within one line per each FID & NVMe-MI Command
while printing in human readable form.

Signed-off-by: Francis Pravin <francis.p@samsung.com>
14 months agofabrics: Always pass hostid and hostnqn
Israel Rukshin [Thu, 18 Apr 2024 14:24:36 +0000 (14:24 +0000)]
fabrics: Always pass hostid and hostnqn

After the kernel commit ae8bd606e09b ("nvme-fabrics: prevent overriding
of existing host"), kernel ensures hostid and hostnqn maintain 1:1
mapping. This makes 'nvme discover' and 'nvme connect' commands fail
when providing only hostid or only hostnqn. This issue happens when
the user only enters NQN which doesn't contain UUID, so the generation
of the hostid fails.

There are few more issues that this commit is fixing:
 - When the user provides hostid and NQN, the hostid is overridden
   by generating it from the NQN.
 - hostid is generated from the NQN file instead of the NQN that
   the user enters at the command line.
 - The warning "use generated hostid instead of hostid file" is
   wrong when the user provides hostid via the command line.

The commit fixes those issues by doing the following logic:
 1. If user provided both via command line - pass them as-is
 2. If user doesn't enter them via command line - try to get
    them from files.
 3. If one of them is not provided - generate it from the other.
    Use the new functions nvmf_hostid_generate() when NQN doesn't
    have UUID and use nvmf_hostnqn_generate_from_hostid(hostid) to
    generate hostnqn from hostid.
 4. If user provided none - generate them both. Before this commit,
    nvme cli didn't do it.

Signed-off-by: Israel Rukshin <israelr@nvidia.com>
Reviewed-by: Max Gurtovoy <mgurtovoy@nvidia.com>
Signed-off-by: Daniel Wagner <dwagner@suse.de>
14 months agobuild: bump libnvme wrap
Daniel Wagner [Wed, 22 May 2024 12:50:46 +0000 (14:50 +0200)]
build: bump libnvme wrap

Get nvmf_hostnqn_generate_from_hostid and nvmf_hostid_generate.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
14 months agoplugins/ssstc: Replace __uint16_t with uint16_t
Khem Raj [Tue, 21 May 2024 21:09:32 +0000 (14:09 -0700)]
plugins/ssstc: Replace __uint16_t with uint16_t

uint16_t is ISO defined and comes from stdint.h, makes it
portable across glibc and musl on linux.

Signed-off-by: Khem Raj <raj.khem@gmail.com>
14 months agoplugins/solidigm: Added log pages to vs-internal-logs
Leonardo da Cunha [Wed, 8 May 2024 18:24:44 +0000 (11:24 -0700)]
plugins/solidigm: Added log pages to vs-internal-logs

Added some Identify pages, and some standard log, and some VU logs.
Created abstract data type with common fields for internal logs.
Better string buffer overflow avoidance.

Signed-off-by: Leonardo da Cunha <leonardo.da.cunha@solidigm.com>
14 months agosed: perform a tper revert after lsp revert
Greg Joyce [Mon, 20 May 2024 20:02:17 +0000 (15:02 -0500)]
sed: perform a tper revert after lsp revert

The non-destructive revert was not sufficiently reverting the lsp. A
TPER revert is required or the drive is only partially reverted.

Signed-off-by: Greg Joyce <gjoyce@linux.ibm.com>
14 months agoplugins/nbft: Use default library logging
Tomas Bzatek [Tue, 14 May 2024 15:05:07 +0000 (17:05 +0200)]
plugins/nbft: Use default library logging

Remove the workaround with creating empty root
object and use the new libnvme API instead.

Signed-off-by: Tomas Bzatek <tbzatek@redhat.com>
14 months agodocs: Add missing OCP plugin docs to meson
Arthur Shau [Mon, 13 May 2024 21:01:51 +0000 (14:01 -0700)]
docs: Add missing OCP plugin docs to meson

Multiple commands for OCP plugin have associated doc text files, but
weren't added to the meson.build, causing docs to not be generated.

Signed-off-by: Arthur Shau <arthurshau@meta.com>
14 months agoocp: Switch OCP plugin to use semantic versioning
Arthur Shau [Mon, 13 May 2024 19:38:14 +0000 (12:38 -0700)]
ocp: Switch OCP plugin to use semantic versioning

Chose version 1.0.0 to start at
commit 77f6c8fc3ad8 ("ocp: Update license to GPL-2.0-or-later")

Signed-off-by: Arthur Shau <arthurshau@meta.com>
14 months agonvme: fix fw-commit MUD result message
Francis Pravin [Mon, 13 May 2024 08:56:44 +0000 (14:26 +0530)]
nvme: fix fw-commit MUD result message

As per spec, 0th bit is set when the controller detects an overlapping
firmware/boot partition image update command sequence due to processing
a command from an Admin Submission Queue on a controller and the 1st bit
is set due to processing the command from Management Endpoint. So, fixed
the MUD result message.

Signed-off-by: Francis Pravin <francis.p@samsung.com>
14 months agosed: only re-read partition table after unlock.
Greg Joyce [Fri, 10 May 2024 19:23:11 +0000 (14:23 -0500)]
sed: only re-read partition table after unlock.

The partition table was being re-read after both lock and
unlock operations. The re-read would fail with an error
message after a lock since the partition was no longer readable.

Signed-off-by: Greg Joyce <gjoyce@linux.ibm.com>
14 months agonvme-print-json: Fix LBA status DSLBA output as hexadecimal
Tokunori Ikegami [Mon, 29 Apr 2024 15:36:13 +0000 (00:36 +0900)]
nvme-print-json: Fix LBA status DSLBA output as hexadecimal

The output printed with the 0x prefix but as not hexadecimal.
Same change for nvme-print-stdout below.
7b4b50ff ("nvme-print-stdout: Fix LBA status DSLBA output as hexadecimal")

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
14 months agonvme-print-json: Use NVME_PMRxxx register definitions to print
Tokunori Ikegami [Mon, 29 Apr 2024 14:22:16 +0000 (23:22 +0900)]
nvme-print-json: Use NVME_PMRxxx register definitions to print

Change them instead of hardcoded register mask and shift values.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
14 months agonvme-print-stdout: Fix PMRWBM register name
Tokunori Ikegami [Mon, 29 Apr 2024 14:08:45 +0000 (23:08 +0900)]
nvme-print-stdout: Fix PMRWBM register name

Incorrectly defined as PMRWMB.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
14 months agonvme-print-json: Fix channel configuration descriptors pointer
Tokunori Ikegami [Mon, 29 Apr 2024 13:15:40 +0000 (22:15 +0900)]
nvme-print-json: Fix channel configuration descriptors pointer

Set the address after NVM set EGSETS - 1 identifier parameter.
Same change for nvme-print-stdout 10d24132
("nvme-print-stdout: Fix channel configuration descriptors pointer").

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
14 months agonvme-print-json: Fix linux kernel check patch errors
Tokunori Ikegami [Mon, 29 Apr 2024 12:58:38 +0000 (21:58 +0900)]
nvme-print-json: Fix linux kernel check patch errors

Note: The long line string and strncpy() warnings are not fixed.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
14 months agobuild: Update meson commands in Makefile
Martin Belanger [Fri, 10 May 2024 13:43:38 +0000 (09:43 -0400)]
build: Update meson commands in Makefile

Invoking meson by itself w/o "setup" is considered deprecated.
Updated Makefile to use "meson setup". Also replaced "ninja"
commands by the corresponding "meson compile" command.

Signed-off-by: Martin Belanger <martin.belanger@dell.com>
14 months agonvme-print: Added "Command and Feature Lockdown" string to LID 0x14
Leonardo da Cunha [Fri, 3 May 2024 15:28:22 +0000 (08:28 -0700)]
nvme-print: Added "Command and Feature Lockdown" string to LID 0x14

NVMe Spec 2.0 added LID 0x14.

Signed-off-by: Leonardo da Cunha <leonardo.da.cunha@solidigm.com>
14 months agoplugins/innogrit: `u_char` -> `unsigned char`
Sam James [Sat, 4 May 2024 08:15:03 +0000 (09:15 +0100)]
plugins/innogrit: `u_char` -> `unsigned char`

`u_char` is not a standard name for `unsigned char` and may not work;
some implementations may provide it for convenience.

Signed-off-by: Sam James <sam@gentoo.org>
14 months agonvme: Use C99 types for uint32_t
Sam James [Sat, 4 May 2024 08:13:06 +0000 (09:13 +0100)]
nvme: Use C99 types for uint32_t

<stdint.h> provides `uint32_t`, while `u_int_32` is an unofficial/internal
typedef that glibc happens to provide. This fixes the build on musl.

Bug: https://bugs.gentoo.org/931194
Signed-off-by: Sam James <sam@gentoo.org>
14 months agonvme-print-stdout: print frl1/2/3 values for zns id-ns
lebao [Fri, 26 Apr 2024 08:13:16 +0000 (16:13 +0800)]
nvme-print-stdout: print frl1/2/3 values for zns id-ns

The zns id-ns outputs always the frl value instead the matching
frl1/2/3.

Signed-off-by: lebao <sharpllr@163.com>
14 months agosolidigm: Eliminate <linux/limits.h>
Warner Losh [Sat, 4 May 2024 03:32:07 +0000 (21:32 -0600)]
solidigm: Eliminate <linux/limits.h>

ARG_MAX is defined in <limits.h>, per POSIX, but it's defined to be a
variable in glibc. Instead, get rid of it entirely by using asprintf to
construct the commands. This prevents us from trying a partially
constructed command that might do something unintentional. For
solidigm-market-log.c, there's no constants needed from
<linux/limits.h>. With this we can delete it both places.

Signed-off-by: Warner Losh <imp@bsdimp.com>
14 months agonvme: remove double free in persistent-event-log
Francis Pravin [Fri, 10 May 2024 09:46:36 +0000 (15:16 +0530)]
nvme: remove double free in persistent-event-log

The pevent_collected structure uses the buffer address which is allocated
using nvme_alloc_huge(). So, pevent_collected and mh.p has same address.
Hence, remove _cleanup_free_ from pevent_collected to prevent double free.

Signed-off-by: Francis Pravin <francis.p@samsung.com>
Signed-off-by: Sathyavathi M <sathya.m@samsung.com>
14 months agoocp: Add Get DSSD Power State Feature (FID: C7h)
Arthur Shau [Thu, 9 May 2024 18:41:16 +0000 (11:41 -0700)]
ocp: Add Get DSSD Power State Feature (FID: C7h)

Implements the Get DSSD Power State Feature (FID C7h). Also added an
optional flag that you can pass to the plugin command to print out
all three values at once.

Signed-off-by: Arthur Shau <arthurshau@meta.com>
14 months agonvme: initialize default library logging
Daniel Wagner [Wed, 27 Mar 2024 15:59:32 +0000 (16:59 +0100)]
nvme: initialize default library logging

The library will only print errors unless we initialize default logging.
By doing so, all nvme commands are enabled to also print debug
information.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
14 months agonvme: use cleanup helper for nvme_root_t objects
Daniel Wagner [Wed, 27 Mar 2024 16:08:10 +0000 (17:08 +0100)]
nvme: use cleanup helper for nvme_root_t objects

Use a cleanup helper for the nvme_root_t objects which simplifies the
error paths and ensures we are always removing all the allocated
resources.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
14 months agobuild: bump libnvme wrap
Daniel Wagner [Fri, 10 May 2024 07:16:18 +0000 (09:16 +0200)]
build: bump libnvme wrap

Import nvme_init_default_logging.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
14 months agodoc: add nvme connet ctrl-loss-tmo description
Tokunori Ikegami [Sun, 5 May 2024 12:22:36 +0000 (21:22 +0900)]
doc: add nvme connet ctrl-loss-tmo description

Describe the kernel retry a connection behavior.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
14 months agoplugins/solidigm: Automatic enabling Data Area 4 when retrieving Telemetry.
Leonardo da Cunha [Mon, 29 Apr 2024 22:00:35 +0000 (15:00 -0700)]
plugins/solidigm: Automatic enabling Data Area 4 when retrieving Telemetry.

vs-internal-log, stopped extracting Host Initiated Telemetry previous
snapshot, simplified the type name of Telemetry snapshots to CIT and HIT,
removed command options for setting namespace, and file prefix, and added
command option to set output folder.

Signed-off-by: Leonardo da Cunha <leonardo.da.cunha@solidigm.com>
14 months agodoc: Regenerate all docs for v2.9.1
Daniel Wagner [Fri, 3 May 2024 14:03:42 +0000 (16:03 +0200)]
doc: Regenerate all docs for v2.9.1

Signed-off-by: Daniel Wagner <dwagner@suse.de>
14 months agobuild: Update version to v2.9.1
Daniel Wagner [Fri, 3 May 2024 14:03:15 +0000 (16:03 +0200)]
build: Update version to v2.9.1

Signed-off-by: Daniel Wagner <dwagner@suse.de>
14 months agoplugins/spdk: drop the plugin
Daniel Wagner [Fri, 3 May 2024 13:50:53 +0000 (15:50 +0200)]
plugins/spdk: drop the plugin

The plugin depends on the private header of libvnme and breaks the build
if the library is not a builtin dependency.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
14 months agodoc: Regenerate all docs for v2.9
Daniel Wagner [Fri, 3 May 2024 12:48:00 +0000 (14:48 +0200)]
doc: Regenerate all docs for v2.9

Signed-off-by: Daniel Wagner <dwagner@suse.de>
14 months agobuild: Update version to v2.9
Daniel Wagner [Fri, 3 May 2024 12:47:33 +0000 (14:47 +0200)]
build: Update version to v2.9

Signed-off-by: Daniel Wagner <dwagner@suse.de>
14 months agonvme-print: expand the maximum field length to prevent misalignment
Sebastian Brzezinka [Fri, 8 Dec 2023 14:29:20 +0000 (15:29 +0100)]
nvme-print: expand the maximum field length to prevent misalignment

Fields like Generic and Device are longer for SPDK-controlled
devices, which causes misalignment.

Signed-off-by: Sebastian Brzezinka <sebastian.brzezinka@intel.com>
Signed-off-by: Daniel Wagner <dwagner@suse.de>