Gollu Appalanaidu [Sun, 7 Mar 2021 18:32:35 +0000 (00:02 +0530)]
nvme-print: improve command support and effects log json format
Currently command support and effects log page on json format
printing all the opcodes irrespective of the command supported.
Most part of the log page is "Unkown" opcodes, fixed that. Also
added two json objects "acs" and "iocs" to print them seperately.
Martin George [Wed, 3 Mar 2021 06:19:19 +0000 (11:49 +0530)]
fabrics: ensure zero kato for non-persistent controllers
Add a helper function that sets the default kato value for the
discovery controllers. Along with ensuring a non-zero kato value
(i.e. NVMF_DEF_DISC_TMO) is passed to a persistent discovery
controller, it also ensures a zero kato value is passed to a
non-persistent discovery controller, as mandated by the NVMe spec.
Gollu Appalanaidu [Mon, 1 Mar 2021 18:37:07 +0000 (00:07 +0530)]
nvme-print: fix HMB get feature response in human readable format
For Host Memory Buffer(HMB) fearure as part of get feature Memory
Return(MR) bit is not part of the CQE CDW0 and add endianess conversion
for the get feature HMB attribute data structure.
Gollu Appalanaidu [Sat, 27 Feb 2021 19:40:01 +0000 (01:10 +0530)]
nvme: fix securuty send and receive commands result field
Security Send and Receive commands doesn't fill the CQE CDW0,
remove uncessary passing of result field in both the commands.
The changes are made in RPMB related files since it is dependent
on these commands. RPMB operations only result field as part of
the dataframe and this result is completely different from the
CQE CDW0.
Hannes Reinecke [Thu, 25 Feb 2021 15:53:00 +0000 (16:53 +0100)]
fabrics: correctly handle ctrl_loss_tmo settings for loop
The previous fix had an issue with referrals, as it would take
the default values and apply them to all referral entries.
And if the default entries were for 'loop', the default ctrl_loss_tmo
setting would not be used, but rather '-1'.
So this patch reverts the previous patch and correctly blanks
out the ctrl_loss_tmo setting when constructing the connect string.
Fixes: bdf4f3b ("fabrics: ctrl_loss_tmo setting is invalid for 'loop'") Signed-off-by: Hannes Reinecke <hare@suse.de>
The changes as per the Base NVMe 1.4b and NVMeOF 1.1 specification.
Optional Fabrics Command Support(OFCS) field added at wrong offset
of the structure, and other naming conventions fixed as per the Spec.
Gollu Appalanaidu [Tue, 23 Feb 2021 18:58:45 +0000 (00:28 +0530)]
nvme: add support for lba status log page
This log page is used to provide information about
subsequent actions the host may take to discover which
logical blocks, in namespaces that are attached to
the controller, may no longer be recoverable when read.
For more details see NVM Express 1.4 Spec. Section
5.14.1.14("LBA Status Information (Log Identifier 0Eh)")
Gollu Appalanaidu [Sat, 20 Feb 2021 16:30:09 +0000 (22:00 +0530)]
nvme: add support for endurance group event aggregate log
This log page indicates if an Endurance Group Event has
occurred for a particular Endurance Group, the details of
the particular event are included in the Endurance Group
Information log page for that Group. For details see
NVM Express 1.4 Spec. Section 5.14.1.15 ("Endurance Group
Event Aggregate (Log Identifier 0Fh)")
Hannes Reinecke [Wed, 17 Feb 2021 16:42:43 +0000 (17:42 +0100)]
fabrics: ctrl_loss_tmo setting is invalid for 'loop'
The 'ctrl_loss_tmo' setting is invalid for 'loop' devices, so move
the default to '-1' (for 'unset'), and only set the default timeout
if discovery is not done on a loop device and the user has not
specified another value.
Fixes: 68bc869 ("fabrics: fix passing ctrl_loss_tmo=0 by default") Signed-off-by: Hannes Reinecke <hare@suse.de>
Gollu Appalanaidu [Sun, 7 Feb 2021 11:30:09 +0000 (17:00 +0530)]
nvme: Round of the metadata size to fit into block count
If device formatted with non-zero metadata size and input
metadata size is less than that it can be fit into mentioned
block count from input then round it of to fit into block count.
Minwoo Im [Fri, 22 Jan 2021 15:20:38 +0000 (00:20 +0900)]
nvme-status: return negative status if !errno
'errno' is set to errno value when system calls are returning with an
error (e.g., ioctl). But, If a command fails without any system call,
then it needs to return the raw negative error value.
For example, if we don't provide any options for connect command:
root@vm:~# nvme connect
need a transport (-t) argument
root@vm:~# echo $?
0
Signed-off-by: Minwoo Im <minwoo.im.dev@gmail.com>
Minwoo Im [Thu, 14 Jan 2021 13:52:52 +0000 (22:52 +0900)]
zns: print select_all field for Zone Management Send
If Select All field in CDW13 is set to 1, SLBA(Starting LBA) will be
ignored. This patch added a select all field to print out when
successfully done. More informative success log with this field.
Minwoo Im [Sat, 23 Jan 2021 07:21:46 +0000 (16:21 +0900)]
nvme-topology: fix returning invalid value in scan_subsystems()
Let's say we have multiple three subsystems in the system. If we run
a simple 'nvme list' command, then scan_subsystems() will never set the
'ret' value which is a local variable. This should be initialized to a
initial value to avoid invalid value returning.
This patch fixes returning invalid value from the scan_subsystems() in
case of multi-subsystems found.
Signed-off-by: Minwoo Im <minwoo.im.dev@gmail.com>
Jeff Lien [Tue, 19 Jan 2021 14:31:21 +0000 (08:31 -0600)]
[nvme-cli] WDC plugin fixes for vs-fw-activate-history command
Change to use Power on Hours instead of Timestamp in certain cases
Fix Entry order so entries are displayed oldest to newest
Tomasz Zawadzki [Tue, 14 Jul 2020 08:18:46 +0000 (04:18 -0400)]
skip display of missing controller fields
'Transport' and 'address' fields are determined from sysfs
in legacy_get_pci_bdf(). Meanwhile 'state' field is only set
in scan_ctrl(), rather than legacy_list() path.
This patch fixes display of the fields to be empty.
Then resolves assumption that transport is set,
preventing a segfault.
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Tomasz Zawadzki [Mon, 13 Jul 2020 14:25:17 +0000 (10:25 -0400)]
print topology for NVMe nodes in kernel and path
This patch enables listing kernel devices (under /dev/ or sysfs)
and the ones available under passed path in a single call.
The additional path parameter is optional and first kernel
device topology is checked. After that legacy_list is called
on that and topologies are joint together.
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Tomasz Zawadzki [Mon, 29 Jun 2020 13:04:18 +0000 (09:04 -0400)]
add path to nvme list
In SPDK project (spdk.io) it is possible to represent
devices using CUSE as character devices in "/dev/spdk/" directory.
No sysfs entries are generated for those devices.
nvme-cli default behavior is to scan the sysfs for entries on
newer kernels. Previously legacy_list() was used to determine
the topology, but that worked only on "/dev/" path.
To enable listing SPDK devices following changes were made:
- pass path parameter to list command
- before checking sysfs, check the path using legacy_list()
- expand arguments of scan_subsystems and related functions to accept the path
Example:
nvme list -d /dev/spdk/
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Gollu Appalanaidu [Thu, 14 Jan 2021 17:18:56 +0000 (22:48 +0530)]
nvme: fix get lba status command nsid and data len fields
In get lba status admin command, host shall specify valid and
desired namespace, adding NSID field to receive from user and
also assign data len fields as per the given MNDW value.
Gollu Appalanaidu [Wed, 13 Jan 2021 16:27:13 +0000 (21:57 +0530)]
nvme: add support for predictable latency per NVM set log page
This is to add support for LID = 0x0A, Predictable Latency per
NVM Set, used to determine the current window for the specified
NVM Set when Predictable Latency Mode is enabled and any events
that have occurred for the specified NVM Set. For More details
see NVM Express 1.4 Spec. Section 5.14.1.10 ("Predictable Latency
Per NVM Set (Log Identifier 0Ah)")
Signed-off-by: Gollu Appalanaidu <anaidu.gollu@samsung.com> Co-Authored-By: Karthik Balan <karthik.b82@samsung.com> Reviewed-by: Steven Seungcheol Lee <sc108.lee@samsung.com>
Minwoo Im [Tue, 12 Jan 2021 23:02:55 +0000 (08:02 +0900)]
nvme-print: fix Namespace ID to decimal format
As kernel sysfs shows nsid as a decimal format, nvme-cli should print
Namespace ID as decimal format. Additionally, of course, the following
two commands results should be consistant:
- nvme list
- nvme list --verbose
The following examples is for case of nsid=32.
root@vm:~/work/nvme-cli.git# ./nvme list
Node SN Model Namespace Usage Format FW Rev
---------------- -------------------- ---------------------------------------- --------- -------------------------- ---------------- --------
/dev/nvme0n1 deadbeef QEMU NVMe Ctrl 32 1.05 MB / 1.05 MB 512 B + 0 B 1.0
root@vm:~/work/nvme-cli.git# ./nvme list --verbose NVM Express Subsystems
Device NSID Usage Format Controllers
------------ -------- -------------------------- ---------------- ----------------
nvme0n1 20 1.05 MB / 1.05 MB 512 B + 0 B nvme0
^^^^^^^^
This absolutely should be same with the `nvme list` result as decimal.
This patch fixed list --verbose nsid to decimal format.
Signed-off-by: Minwoo Im <minwoo.im.dev@gmail.com>
Klaus Jensen [Mon, 16 Nov 2020 08:52:19 +0000 (09:52 +0100)]
fix dsm and copy range setup
The argconfig array helpers parse into int and unsigned long long
arrays. In the copy function we are casting an int* to __u16* and we end
up with wrong values. Instead, just use the types in the setup functions
directly and convert the individual values as part of calling the
cpu_to_le* helpers.
While copy is the one that is immediately broken on most systems, do
this for DSM as well since it breaks on systems where int is not 32
bits.
Fixes: 5dc44e6c21a1 ("add support for issuing simple copy commands") Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
Eyal Ben-David [Sun, 29 Nov 2020 10:48:27 +0000 (12:48 +0200)]
verify-no-dep : Fix makefile entry.
"verify-no-dep" makefile rule verifies that the main "nvme" program has no dependency
on code from the plugin modules. It can be used by developers as a regression check
in the development process.
Minwoo Im [Thu, 7 Jan 2021 07:03:13 +0000 (16:03 +0900)]
nvme: refactor S_ISCHR/S_ISBLK with helpers
This patch refactors S_ISCHR/S_ISBLK macros to helper functions for
readability. The global variable nvme_stat does no longer need to be in
subcommand handlers.
Signed-off-by: Minwoo Im <minwoo.im.dev@gmail.com>
Minwoo Im [Thu, 7 Jan 2021 07:28:44 +0000 (16:28 +0900)]
nvme: set block size to blkdev before re-read partition
Before re-reading partition information from a block device, to make
block size of the block device, application should do either:
- Close current file descriptor and re-open it again.
- Request block device to set block size by itself.
Kernel community has discussions about it, and can be found at [1].
The first option might not be good for readability in this program which
is one-shot command-based application. All the subcommands are
constructed "fd open -> issue command -> fd close". I don't want to
break the common style for this requirement.
This patch takes the second one and it just ioctl() to the block device
to update it's block size to a given value.
Gollu Appalanaidu [Mon, 11 Jan 2021 18:38:14 +0000 (00:08 +0530)]
nvme: add support for predictable latency event aggregate log page
This is to add support for LID = 0x0B, Predictable Latency Event
Aggregate Log Page, this is used if a Predictable Latency Event has
occurred for a particular NVM Set. For More details see NVM Express
1.4 Spec. Section 5.14.1.11 ("Predictable Latency Event Aggregate Log
Page (Log Identifier 0Bh)")
Max entries supported by this log page are 2044 which is:
(min xfer size (4096B) - size of num of entries(8B))/entry size (2B)
= 2044 entries
Signed-off-by: Gollu Appalanaidu <anaidu.gollu@samsung.com> Co-Authored-By: Karthik Balan <karthik.b82@samsung.com> Reviewed-by: Steven Seungcheol Lee <sc108.lee@samsung.com>
Keith Busch [Tue, 12 Jan 2021 22:00:43 +0000 (14:00 -0800)]
fix 'list' verbose for controller namespaces
Checking that namespace against the subsystem's namespace list is not
always correct because the namespace may not be multipath capable. For
those namespaces, the kernel doesn't link the namespace to the
subsystem, so it ends up not getting displayed. Print all the
controller's namespaces, as the topology should have filtered ones out
that the controller is not a path to.
Minwoo Im [Tue, 12 Jan 2021 14:37:06 +0000 (23:37 +0900)]
zns: fix showing system error in report_zones
If nvme_zns_report_zones() returns system error(negative) value, it
should not be passed to nvme_show_status() which parses NVMe completion
status code in case of positive value from the ioctl.
Signed-off-by: Minwoo Im <minwoo.im.dev@gmail.com>