]> www.infradead.org Git - users/sagi/nvme-cli.git/log
users/sagi/nvme-cli.git
4 years agonvme: make else if and else statements uniform
Gollu Appalanaidu [Thu, 25 Mar 2021 18:53:38 +0000 (00:23 +0530)]
nvme: make else if and else statements uniform

Signed-off-by: Gollu Appalanaidu <anaidu.gollu@samsung.com>
4 years agonvme: fix timestamp feature in set feature
Gollu Appalanaidu [Thu, 25 Mar 2021 19:41:35 +0000 (01:11 +0530)]
nvme: fix timestamp feature in set feature

In Timestamp feature structure size is 8 bytes, since the 6th
and 7th bytes are reserved no need to change the data len
parameter to 6 bytes.

Signed-off-by: Gollu Appalanaidu <anaidu.gollu@samsung.com>
4 years agoRead system UUID from DMI and merge hostnqn generation functions
Hannes Reinecke [Wed, 24 Mar 2021 07:22:28 +0000 (08:22 +0100)]
Read system UUID from DMI and merge hostnqn generation functions

Both fabrics.c and the 'gen-hostnqn' command contain functions
to generate a default host NQN. Needless to say, both are different.
_And_ we have the script 'nvme-gen-hostnqn' to read the host nqn
from the system UUID, implement yet another way.

This patch merges all of these functions, and implements a hierarchy
in generating host NQNs:
- Try reading system UUID from /sys/firmware/dmi/entries
- Try reading systemd-generated UUID
- Generate a random UUID

Signed-off-by: Hannes Reinecke <hare@suse.de>
4 years agonvme: build against json-c library
Hannes Reinecke [Sat, 20 Mar 2021 08:21:25 +0000 (09:21 +0100)]
nvme: build against json-c library

Allow to use the json-c library instead of our own hand-crafted
json routines. This allows us to add more functionality like
parsing json files in the future.

Signed-off-by: Hannes Reinecke <hare@suse.de>
4 years agoutil/json: unify struct json_object and struct json_array
Hannes Reinecke [Sat, 20 Mar 2021 08:19:04 +0000 (09:19 +0100)]
util/json: unify struct json_object and struct json_array

Merge both structure to have just a single json_object structure.

Signed-off-by: Hannes Reinecke <hare@suse.de>
4 years agofabrics: fix infinite loop on invalid parameters
Hannes Reinecke [Wed, 24 Mar 2021 06:39:31 +0000 (07:39 +0100)]
fabrics: fix infinite loop on invalid parameters

When parsing the discovery entries results in invalid parameters
for a given connection we'll enter an infinite loop as the -EINVAL
error code is always assumed to indicate a wrong 'disable_sqflow'
setting.

Signed-off-by: Hannes Reinecke <hare@suse.de>
4 years agomicron plugin version 1.0.5 - 51C2, 51C3 support
Hanumanthu H [Thu, 18 Mar 2021 17:56:37 +0000 (23:26 +0530)]
micron plugin version 1.0.5 - 51C2, 51C3 support

4 years agomicron plugin version 1.0.5
Hanumanthu H [Thu, 18 Mar 2021 16:45:50 +0000 (22:15 +0530)]
micron plugin version 1.0.5

4 years agonvme: fix commenting style
Gollu Appalanaidu [Wed, 17 Mar 2021 11:50:06 +0000 (17:20 +0530)]
nvme: fix commenting style

Signed-off-by: Gollu Appalanaidu <anaidu.gollu@samsung.com>
4 years ago[NVMe-CLI] SN730 Updates for FW Maintenance Release
Jeff Lien [Wed, 17 Mar 2021 13:54:19 +0000 (08:54 -0500)]
[NVMe-CLI] SN730 Updates for FW Maintenance Release

4 years ago[NVMe-CLI] Add support for new customer ids to WDC plugin commmands
Jeff Lien [Wed, 17 Mar 2021 14:36:40 +0000 (09:36 -0500)]
[NVMe-CLI] Add support for new customer ids to WDC plugin commmands

4 years agonvme: add lba status information attributes feature support
Gollu Appalanaidu [Tue, 16 Mar 2021 13:06:50 +0000 (18:36 +0530)]
nvme: add lba status information attributes feature support

Adding LBA Status Information Attributes Feature with FID = 0x15.

Signed-off-by: Gollu Appalanaidu <anaidu.gollu@samsung.com>
4 years agonvme: remove trailing space
Gollu Appalanaidu [Tue, 16 Mar 2021 07:30:53 +0000 (13:00 +0530)]
nvme: remove trailing space

Signed-off-by: Gollu Appalanaidu <anaidu.gollu@samsung.com>
4 years agonvme-topology: have list-subsys print only controllers with attached namespace
Sagi Grimberg [Mon, 15 Mar 2021 20:52:09 +0000 (13:52 -0700)]
nvme-topology: have list-subsys print only controllers with attached namespace

When running list-subsys on a specific namespace, we output all the
controllers that belong to the subsystem regardless if the requested
namespace is actually attached to them.

Example:
$ nvme list-subsys /dev/nvme0n1
nvme-subsys0 - NQN=nqn.2016-01.com.lightbitslabs:uuid:07cfffe6-5a4f-4151-b663-e13cf835609b
\
 +- nvme0 tcp traddr=10.113.5.1 trsvcid=4420 live optimized
 +- nvme1 tcp traddr=10.133.3.1 trsvcid=4420 live
 +- nvme2 tcp traddr=10.133.1.1 trsvcid=4420 live
 +- nvme3 tcp traddr=10.113.1.1 trsvcid=4420 live inaccessible
 +- nvme4 tcp traddr=10.133.5.1 trsvcid=4420 live
 +- nvme5 tcp traddr=10.113.4.1 trsvcid=4420 live
 +- nvme6 tcp traddr=10.133.4.1 trsvcid=4420 live
 +- nvme7 tcp traddr=10.113.2.1 trsvcid=4420 live
 +- nvme8 tcp traddr=10.133.2.1 trsvcid=4420 live
 +- nvme9 tcp traddr=10.113.3.1 trsvcid=4420 live

This output is somewhat confusing and makes the user think the namespace
is actually attached to all of these controllers, instead we want the
output which provided by the change introduced here:

$ nvme list-subsys /dev/nvme0n1
nvme-subsys0 - NQN=nqn.2016-01.com.lightbitslabs:uuid:07cfffe6-5a4f-4151-b663-e13cf835609b
\
 +- nvme0 tcp traddr=10.113.5.1 trsvcid=4420 live optimized
 +- nvme3 tcp traddr=10.113.1.1 trsvcid=4420 live inaccessible

Do the same trick as we do in scan_subsystems, we add the ctrl to the
topology if either ns_instance wasn't passed (see all controllers) or
it was pased _and_ the controller has this namespace is attached to
the controller (to do that we add nsid down the call chain for that).

Reviewed-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
Signed-off-by: Sagi Grimberg <sagi@grimberg.me>
Signed-off-by: Keith Busch <kbusch@kernel.org>
4 years agonvme: address 1.4 to 1.4b changes for Change NS event type
Gollu Appalanaidu [Sun, 14 Mar 2021 17:57:47 +0000 (23:27 +0530)]
nvme: address 1.4 to 1.4b changes for Change NS event type

In NVMe 1.4 spec. Change Namespace Event Type (06h) of persistent
event log Data Format - NCAP field was assigned with 16 bytes. Now
in 1.4b spec. its modified to 8 bytes.

Signed-off-by: Gollu Appalanaidu <anaidu.gollu@samsung.com>
4 years agonvme: fix dsm and copy commands free up buffers
Gollu Appalanaidu [Thu, 11 Mar 2021 18:45:05 +0000 (00:15 +0530)]
nvme: fix dsm and copy commands free up buffers

In DSM and Copy Commands buffers which dyamically allocated
not freed, fixing that.

Signed-off-by: Gollu Appalanaidu <anaidu.gollu@samsung.com>
4 years agonvme: add namespace id config field for copy command
Gollu Appalanaidu [Thu, 11 Mar 2021 19:19:52 +0000 (00:49 +0530)]
nvme: add namespace id config field for copy command

For Copy command add namespace id as a user config field

Signed-off-by: Gollu Appalanaidu <anaidu.gollu@samsung.com>
4 years agonvme: refactor and improve the passthru function
Gollu Appalanaidu [Wed, 10 Mar 2021 14:33:18 +0000 (20:03 +0530)]
nvme: refactor and improve the passthru function

Refactor and improve the passthru, io-passthru and admin-passthru
result printing based on the command opcode and type by using the
cmd_to_string.

Signed-off-by: Gollu Appalanaidu <anaidu.gollu@samsung.com>
4 years agonvme: add reservation notifacation log page
Gollu Appalanaidu [Fri, 5 Mar 2021 20:20:57 +0000 (01:50 +0530)]
nvme: add reservation notifacation log page

This is to add the support for the reservation notification
log page with LID = 0x80.

Signed-off-by: Gollu Appalanaidu <anaidu.gollu@samsung.com>
Co-Authored-By: Karthik Balan <karthik.b82@samsung.com>
4 years agonvme-print: improve command support and effects log json format
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.

Signed-off-by: Gollu Appalanaidu <anaidu.gollu@samsung.com>
4 years agonvme: fix DPS description and improve the other fields descriptions
Gollu Appalanaidu [Sat, 6 Mar 2021 19:10:25 +0000 (00:40 +0530)]
nvme: fix DPS description and improve the other fields descriptions

Fix DSP description, which is Data Protections Settings and other fields
description improved especially 'flbas' and 'block-size' relationship.

Signed-off-by: Gollu Appalanaidu <anaidu.gollu@samsung.com>
4 years agonvme: use nvme_show_status when command status code is non-zero
Gollu Appalanaidu [Fri, 5 Mar 2021 17:12:20 +0000 (22:42 +0530)]
nvme: use nvme_show_status when command status code is non-zero

Show the command return status code along with details with the
help of nvme_show_status instead of printing the err.

Signed-off-by: Gollu Appalanaidu <anaidu.gollu@samsung.com>
4 years agozns: support piremap flag for zone append
Klaus Jensen [Tue, 9 Mar 2021 13:22:50 +0000 (14:22 +0100)]
zns: support piremap flag for zone append

Add the '--piremap' / '-P' flag for zone-append.

Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
4 years agozns: do not check metadata when pract is set
Klaus Jensen [Tue, 9 Mar 2021 13:20:51 +0000 (14:20 +0100)]
zns: do not check metadata when pract is set

Do not check the alignment of metadata if the namespace is formatted
with 8 bytes of metadata and PRACT is set.

Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
4 years ago[nvme-cli] Fix Max/Min User data erase counts displayed in 0xC2 Log Page
Jeff Lien [Tue, 2 Mar 2021 22:32:38 +0000 (16:32 -0600)]
[nvme-cli] Fix Max/Min User data erase counts displayed in 0xC2 Log Page

4 years agofabrics: ensure zero kato for non-persistent controllers
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.

Signed-off-by: Martin George <marting@netapp.com>
4 years agonvme-print: fix register size for raw format print
Gollu Appalanaidu [Fri, 26 Feb 2021 20:49:12 +0000 (02:19 +0530)]
nvme-print: fix register size for raw format print

Signed-off-by: Gollu Appalanaidu <anaidu.gollu@samsung.com>
4 years agonvme-print: fix HMB get feature response in human readable format
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.

Signed-off-by: Gollu Appalanaidu <anaidu.gollu@samsung.com>
4 years agonvme-print: add NSSC field in directive receive show fields
Gollu Appalanaidu [Sun, 28 Feb 2021 16:59:44 +0000 (22:29 +0530)]
nvme-print: add NSSC field in directive receive show fields

Signed-off-by: Gollu Appalanaidu <anaidu.gollu@samsung.com>
4 years agonvme: fix securuty send and receive commands result field
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.

Signed-off-by: Gollu Appalanaidu <anaidu.gollu@samsung.com>
4 years agonvme: fix security send & receive commands show status code
Gollu Appalanaidu [Sat, 27 Feb 2021 19:02:43 +0000 (00:32 +0530)]
nvme: fix security send & receive commands show status code

Signed-off-by: Gollu Appalanaidu <anaidu.gollu@samsung.com>
4 years agonvme-print: split pmrmsc into pmrmscl and pmrmscu
Gollu Appalanaidu [Fri, 26 Feb 2021 19:53:44 +0000 (01:23 +0530)]
nvme-print: split pmrmsc into pmrmscl and pmrmscu

Split the PMR Memory Space Control register 64 bits into
PMR Memory Space Control Lower and Upper 32 bits each as
per NVM Express Spec. 1.4b changes.

Signed-off-by: Gollu Appalanaidu <anaidu.gollu@samsung.com>
4 years agonvme: change system error notification from fprintf to perror
Gollu Appalanaidu [Thu, 25 Feb 2021 18:51:21 +0000 (00:21 +0530)]
nvme: change system error notification from fprintf to perror

As per the latest comment on PR #933, changing all the memory
failure errors notify using "perror" instead of "fprintf"

Signed-off-by: Gollu Appalanaidu <anaidu.gollu@samsung.com>
4 years agofabrics: correctly handle ctrl_loss_tmo settings for loop
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>
4 years ago[nvme-cli] Add support for WDC Plugin cloud-SSD-plugin-version to SN355
Jeff Lien [Mon, 1 Mar 2021 21:49:41 +0000 (15:49 -0600)]
[nvme-cli] Add support for WDC Plugin cloud-SSD-plugin-version to SN355

4 years agonvme: fix identify controller structure fabrics identify fields
Gollu Appalanaidu [Tue, 2 Mar 2021 19:06:17 +0000 (00:36 +0530)]
nvme: fix identify controller structure fabrics identify fields

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.

Signed-off-by: Gollu Appalanaidu <anaidu.gollu@samsung.com>
4 years agofabrics: update discovery.conf error message
Martin George [Tue, 2 Mar 2021 09:55:22 +0000 (15:25 +0530)]
fabrics: update discovery.conf error message

Remove the extra "conf" in the error message when the open on
/etc/nvme/discovery.conf fails.

Signed-off-by: Martin George <marting@netapp.com>
4 years agonvme: Make gen-hostnqn use partition UUID on IBM POWER systems
Brian King [Fri, 26 Feb 2021 20:24:07 +0000 (14:24 -0600)]
nvme: Make gen-hostnqn use partition UUID on IBM POWER systems

IBM POWER systems expose a platform created UUID in the device
tree. Use that as the UUID in the host NQN.

Signed-off-by: Brian King <brking@linux.vnet.ibm.com>
4 years agonvme-cli: misc. fixes for memory allocation failure case
Gollu Appalanaidu [Thu, 25 Feb 2021 19:08:34 +0000 (00:38 +0530)]
nvme-cli: misc. fixes for memory allocation failure case

Signed-off-by: Gollu Appalanaidu <anaidu.gollu@samsung.com>
4 years agonvme-discover: add json output
Hannes Reinecke [Tue, 16 Feb 2021 15:12:42 +0000 (16:12 +0100)]
nvme-discover: add json output

Add the '-o'/'--output-format' option to generate JSON output
for nvme discovery.

Signed-off-by: Hannes Reinecke <hare@suse.de>
4 years agonvme: add support for lba status log page
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)")

Signed-off-by: Gollu Appalanaidu <anaidu.gollu@samsung.com>
Co-Authored-By: Karthik Balan <karthik.b82@samsung.com>
4 years agonvme: add support for endurance group event aggregate log
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)")

Signed-off-by: Gollu Appalanaidu <anaidu.gollu@samsung.com>
Co-Authored-By: Karthik Balan <karthik.b82@samsung.com>
4 years agoprint device name when creating a persistent device
Martin Belanger [Mon, 22 Feb 2021 20:28:33 +0000 (15:28 -0500)]
print device name when creating a persistent device

4 years agonvme: fix status field masking and data type
Gollu Appalanaidu [Mon, 22 Feb 2021 19:09:18 +0000 (00:39 +0530)]
nvme: fix status field masking and data type

Signed-off-by: Gollu Appalanaidu <anaidu.gollu@samsung.com>
4 years agonvme: fix printing set-feature FID and print cdw12, save fields
Gollu Appalanaidu [Sun, 21 Feb 2021 14:12:47 +0000 (19:42 +0530)]
nvme: fix printing set-feature FID and print cdw12, save fields

Signed-off-by: Gollu Appalanaidu <anaidu.gollu@samsung.com>
4 years agonvme-print: show feat fields for FID = {0x17,0x12} and refactoring
Gollu Appalanaidu [Sun, 21 Feb 2021 12:04:16 +0000 (17:34 +0530)]
nvme-print: show feat fields for FID = {0x17,0x12} and refactoring

Showing Sanitize Config (FID = 0x17) and Read Recovery Level
Config (RRL) (FID = 0x12) feature fields. Refactor the FID = 0x0
and non-defined/reserved FIDs response.

Signed-off-by: Gollu Appalanaidu <anaidu.gollu@samsung.com>
4 years agonvme: add endurance group event configuration feature
Gollu Appalanaidu [Sun, 21 Feb 2021 11:12:28 +0000 (16:42 +0530)]
nvme: add endurance group event configuration feature

Signed-off-by: Gollu Appalanaidu <anaidu.gollu@samsung.com>
4 years agonvme-print: add status_to_string for IO command specific status codes
Gollu Appalanaidu [Fri, 19 Feb 2021 19:35:58 +0000 (01:05 +0530)]
nvme-print: add status_to_string for IO command specific status codes

Signed-off-by: Gollu Appalanaidu <anaidu.gollu@samsung.com>
4 years agonvme: add path related error status codes
Gollu Appalanaidu [Fri, 19 Feb 2021 19:14:49 +0000 (00:44 +0530)]
nvme: add path related error status codes

Signed-off-by: Gollu Appalanaidu <anaidu.gollu@samsung.com>
4 years agonvme-print: remove unused argument passing to json output format print
Gollu Appalanaidu [Tue, 16 Feb 2021 17:47:31 +0000 (23:17 +0530)]
nvme-print: remove unused argument passing to json output format print

Signed-off-by: Gollu Appalanaidu <anaidu.gollu@samsung.com>
4 years agoMerge branch 'cgdeveloper1-HMT'
Keith Busch [Thu, 18 Feb 2021 21:05:34 +0000 (13:05 -0800)]
Merge branch 'cgdeveloper1-HMT'

4 years agoMerge branch 'HMT' of https://github.com/cgdeveloper1/nvme-cli into cgdeveloper1-HMT
Keith Busch [Thu, 18 Feb 2021 21:04:04 +0000 (13:04 -0800)]
Merge branch 'HMT' of https://github.com/cgdeveloper1/nvme-cli into cgdeveloper1-HMT

4 years agofabrics: permit kato int argument for discovery controllers
Martin George [Thu, 18 Feb 2021 09:46:42 +0000 (15:16 +0530)]
fabrics: permit kato int argument for discovery controllers

Given discovery controllers can now accept integer arguments
for kato, permit the same in build_options().

Signed-off-by: Martin George <marting@netapp.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Keith Busch <kbusch@kernel.org>
4 years agonvme: add man page and completions of nvm command set id controller
Gollu Appalanaidu [Thu, 18 Feb 2021 10:27:17 +0000 (15:57 +0530)]
nvme: add man page and completions of nvm command set id controller

This is to add the man page for the NVM comand set Identify Controller
struture and zsh, bash completions.

Signed-off-by: Gollu Appalanaidu <anaidu.gollu@samsung.com>
Co-Authored-By: Karthik Balan <karthik.b82@samsung.com>
4 years agoRebased and removed empty printouts for reserved locations.
Affe [Thu, 18 Feb 2021 10:00:29 +0000 (12:00 +0200)]
Rebased and removed empty printouts for reserved locations.

4 years agonvme: remove unassigned variable "lbads" from format function
Gollu Appalanaidu [Thu, 4 Feb 2021 12:32:23 +0000 (18:02 +0530)]
nvme: remove unassigned variable "lbads" from format function

Signed-off-by: Gollu Appalanaidu <anaidu.gollu@samsung.com>
4 years agonvme: remove spurious command show 'rsvd'
Minwoo Im [Wed, 10 Feb 2021 12:27:01 +0000 (21:27 +0900)]
nvme: remove spurious command show 'rsvd'

Remove spurious showing attribute 'rsvd'.  This even is not from the
user input.

Signed-off-by: Minwoo Im <minwoo.im.dev@gmail.com>
4 years agozns: fix zone management receive command zra and zrasf data types
Gollu Appalanaidu [Sat, 6 Feb 2021 11:03:48 +0000 (16:33 +0530)]
zns: fix zone management receive command zra and zrasf data types

Signed-off-by: Gollu Appalanaidu <anaidu.gollu@samsung.com>
4 years agonvme: add identify controller nvm command set support
Gollu Appalanaidu [Tue, 16 Feb 2021 17:28:32 +0000 (22:58 +0530)]
nvme: add identify controller nvm command set support

This will add the support for the identify controller nvm
command set. This is to impose size limit on non-mdts IO
commands as per TP 4040.

Signed-off-by: Gollu Appalanaidu <anaidu.gollu@samsung.com>
Co-Authored-By: Karthik Balan <karthik.b82@samsung.com>
4 years agofabrics: ctrl_loss_tmo setting is invalid for 'loop'
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>
4 years agoMan page update nvme discover
Eric Curtin [Wed, 10 Feb 2021 19:44:50 +0000 (19:44 +0000)]
Man page update nvme discover

Document --device option so people know just to use the device name,
rather than device name with /dev prepended.

4 years agoRebase and merge into HMT
Affe [Tue, 16 Feb 2021 09:58:57 +0000 (11:58 +0200)]
Rebase and merge into HMT

4 years agoAdding and updating some ns-id paramters to be inline with NVMe spec. rev. 1.4b
Affe [Wed, 9 Dec 2020 12:44:30 +0000 (14:44 +0200)]
Adding and updating some ns-id paramters to be inline with NVMe spec. rev. 1.4b

4 years agonvme-print: fix fetching status code type and status data type
Gollu Appalanaidu [Sun, 14 Feb 2021 05:04:22 +0000 (10:34 +0530)]
nvme-print: fix fetching status code type and status data type

Signed-off-by: Gollu Appalanaidu <anaidu.gollu@samsung.com>
4 years agonvme-print: add one space around the operators
Gollu Appalanaidu [Sun, 14 Feb 2021 05:19:45 +0000 (10:49 +0530)]
nvme-print: add one space around the operators

Signed-off-by: Gollu Appalanaidu <anaidu.gollu@samsung.com>
4 years agozns: fix namespace-id data type in multiple places
Gollu Appalanaidu [Sat, 6 Feb 2021 10:52:24 +0000 (16:22 +0530)]
zns: fix namespace-id data type in multiple places

Signed-off-by: Gollu Appalanaidu <anaidu.gollu@samsung.com>
4 years agonvme-status: add status to error no support for path related errors
Gollu Appalanaidu [Sun, 14 Feb 2021 16:33:33 +0000 (22:03 +0530)]
nvme-status: add status to error no support for path related errors

Signed-off-by: Gollu Appalanaidu <anaidu.gollu@samsung.com>
4 years agonvme-print: align switch-case with existing style
Gollu Appalanaidu [Fri, 12 Feb 2021 16:55:23 +0000 (22:25 +0530)]
nvme-print: align switch-case with existing style

Signed-off-by: Gollu Appalanaidu <anaidu.gollu@samsung.com>
4 years agonvme-print: refactor sanitize log status string
Gollu Appalanaidu [Fri, 12 Feb 2021 16:46:47 +0000 (22:16 +0530)]
nvme-print: refactor sanitize log status string

Signed-off-by: Gollu Appalanaidu <anaidu.gollu@samsung.com>
4 years agofix 32-bit compile
Keith Busch [Thu, 11 Feb 2021 18:48:05 +0000 (10:48 -0800)]
fix 32-bit compile

Signed-off-by: Keith Busch <kbusch@kernel.org>
4 years agofeat: add timstamp support(Optional)
dingjian [Thu, 27 Aug 2020 23:44:55 +0000 (07:44 +0800)]
feat: add timstamp support(Optional)

1. Follow NVMe spec 1.4;
2. Change the code about feature id 0x0E;
3. Examples of commands using the -d option:
   3.1. date +"%s%3N" > timestamp.log
   3.2. sudo ./nvme set-feature /dev/nvme0 -f 0x0E -d timestamp.log
4. Examples of commands using the -v option:
   4.1. sudo ./nvme set-feature /dev/nvme0 -f 0x0E -v $[`date +"%s%3N"`]

Signed-off-by: dingjian <jian.ding@memblaze.com>
4 years agofeat: clear-error-log support
Zhangyi Huo [Wed, 20 Jan 2021 03:41:27 +0000 (11:41 +0800)]
feat: clear-error-log support

1. Add the feature of clear-error-log for Memblaze
2. Command example:
   sudo ./nvme memblaze clear-error-log /dev/nvme0n1

Signed-off-by: Zhangyi Huo <zhangyi.huo@memblaze.com>
4 years agofeat: support high latency log
dingjian [Mon, 2 Nov 2020 12:41:19 +0000 (20:41 +0800)]
feat: support high latency log

1. used set feature, id is 0xE1
2. command example:
2.1. set disable:
sudo ./nvme memblaze lat-log /dev/nvme0 -p 0,0
set-feature:0xE1 (Memblaze high latency log), value:00000000
2.2. set enable:
sudo ./nvme memblaze lat-log /dev/nvme0 -p 1,5
set-feature:0xE1 (Memblaze high latency log), value:0x008005
2.3. get high latency log:
sudo ./nvme memblaze lat-log-print /dev/nvme0
Memblaze High Latency Log
---------------------------------------------------------------------------------------------
Timestamp                        Type    QID    CID    NSID     StartLBA      NumLBA   Latency
---------------------------------------------------------------------------------------------
20201023--15:51:40.280 UTC       1       6      14f    0           000000b80  1f       5015
20201023--15:51:40.280 UTC       1       6      151    0           000000bc0  1f       5066
20201023--15:51:40.280 UTC       1       6      15c    0           000000d20  1f       5046
20201023--15:51:40.280 UTC       1       6      156    0           000000c60  1f       5491

Signed-off-by: dingjian <jian.ding@memblaze.com>
4 years agostyle: rename function
dingjian [Mon, 2 Nov 2020 12:33:27 +0000 (20:33 +0800)]
style: rename function

1. add mb_ prefix for memblaze function
2. fix power manager feature id is 0x02
3. simplify these functions
4. rename function

Signed-off-by: dingjian <jian.ding@memblaze.com>
4 years agofeat: support io latency histogram
dingjian [Wed, 2 Sep 2020 07:05:11 +0000 (15:05 +0800)]
feat: support io latency histogram

1. set io latency histogram command:
sudo ./nvme memblaze lat-stats /dev/nvme0 -d
Successfully set enable bit for FID (0xE2) to 0.
sudo ./nvme memblaze lat-stats /dev/nvme0 -e
Successfully set enable bit for FID (0xE2) to 1.
2. print io latency read/write histogram command:
sudo ./nvme memblaze lat-stats-print /dev/nvme0
Memblaze IO Read Command Latency Histogram
Major Revision : 1
Minor Revision : 0
--------------------------------------------------
Bucket      Start       End         Value
--------------------------------------------------
0           0us         32us        1176
1           32us        64us        80869
2           64us        96us        86951
3           96us        128us       93147
sudo ./nvme memblaze lat-stats-print /dev/nvme0 -w
Memblaze IO write Command Latency Histogram
Major Revision : 1
Minor Revision : 0
--------------------------------------------------
Bucket      Start       End         Value
--------------------------------------------------
0           0us         32us        0
1           32us        64us        0
2           64us        96us        5
3           96us        128us       20
4           128us       160us       21
3. Complete test script

sudo ./nvme memblaze lat-stats /dev/nvme0n1 -d  # disable io latency tracking
sudo ./nvme memblaze lat-stats /dev/nvme0n1 -e  # enable io latency tracking
sudo fio -rw=randread -filename=/dev/nvme0n1 -size=1G -name="dingjian"  # read io
sudo fio -rw=randwrite -filename=/dev/nvme0n1 -size=1G -name="dingjian"  # write io
sudo ./nvme memblaze lat-stats-print /dev/nvme0n1  # get read io latency histogram
sudo ./nvme memblaze lat-stats-print /dev/nvme0n1 -w  # get write io latency histogram

Signed-off-by: dingjian <jian.ding@memblaze.com>
4 years agochore: smart-log-add add more project support
dingjian [Mon, 24 Aug 2020 02:49:09 +0000 (10:49 +0800)]
chore: smart-log-add add more project support

Signed-off-by: dingjian <jian.ding@memblaze.com>
4 years agostyle: modify a prompt word
dingjian [Mon, 24 Aug 2020 08:37:13 +0000 (16:37 +0800)]
style: modify a prompt word

Signed-off-by: dingjian <jian.ding@memblaze.com>
4 years agoDon't print error on failed to open in nvme-topology.c
Eric Curtin [Wed, 10 Feb 2021 18:32:01 +0000 (18:32 +0000)]
Don't print error on failed to open in nvme-topology.c

Sometimes opens are intentionally attempted and allowed fail, such as
the "nvme list" command.

4 years agoInput expects device name without /dev
Eric Curtin [Wed, 10 Feb 2021 00:01:59 +0000 (00:01 +0000)]
Input expects device name without /dev

But don't segfault if user gets this incorrect, instead provide helpful
info.

4 years ago[nvme-cli] Change to set default DA for SN730
Jeff Lien [Fri, 5 Feb 2021 19:59:09 +0000 (13:59 -0600)]
[nvme-cli] Change to set default DA for SN730

4 years agoTrying to get a ppc64le build going
Eric Curtin [Wed, 3 Feb 2021 21:09:54 +0000 (21:09 +0000)]
Trying to get a ppc64le build going

Fix warnings along with that

4 years agonvme: remove unused functions nvme_{read, write, compare}
Gollu Appalanaidu [Sun, 7 Feb 2021 15:09:03 +0000 (20:39 +0530)]
nvme: remove unused functions nvme_{read, write, compare}

Functions nvme_write, nvme_read, nvme_compare are
not being called in place. Removing these unused
functions.

Signed-off-by: Gollu Appalanaidu <anaidu.gollu@samsung.com>
4 years agonvme: Round of the metadata size to fit into block count
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.

Signed-off-by: Gollu Appalanaidu <anaidu.gollu@samsung.com>
4 years ago[nvme-cli] Add support for 0x2720 PCI Device ID
Jeff Lien [Tue, 26 Jan 2021 16:25:37 +0000 (10:25 -0600)]
[nvme-cli] Add support for 0x2720 PCI Device ID

4 years agonvme: print NSFEAT UIDREUSE bit in human readable format
Gollu Appalanaidu [Thu, 4 Feb 2021 13:27:12 +0000 (18:57 +0530)]
nvme: print NSFEAT UIDREUSE bit in human readable format

Signed-off-by: Gollu Appalanaidu <anaidu.gollu@samsung.com>
4 years agonvme: remove zns command set opcodes from the effects log
Gollu Appalanaidu [Thu, 4 Feb 2021 02:25:51 +0000 (07:55 +0530)]
nvme: remove zns command set opcodes from the effects log

Signed-off-by: Gollu Appalanaidu <anaidu.gollu@samsung.com>
4 years agonvme: add latest opcodes for command supported and effects log
Gollu Appalanaidu [Wed, 3 Feb 2021 17:05:27 +0000 (22:35 +0530)]
nvme: add latest opcodes for command supported and effects log

Signed-off-by: Gollu Appalanaidu <anaidu.gollu@samsung.com>
4 years agonvme: fix get and set features feature-id data type
Gollu Appalanaidu [Wed, 3 Feb 2021 16:27:28 +0000 (21:57 +0530)]
nvme: fix get and set features feature-id data type

Signed-off-by: Gollu Appalanaidu <anaidu.gollu@samsung.com>
4 years agonvme: fix log-id data type and remove unnecessary log-id validtion
Gollu Appalanaidu [Tue, 2 Feb 2021 17:06:25 +0000 (22:36 +0530)]
nvme: fix log-id data type and remove unnecessary log-id validtion

Signed-off-by: Gollu Appalanaidu <anaidu.gollu@samsung.com>
4 years agoTypo s/rtyep/rtype/g
Eric Curtin [Tue, 2 Feb 2021 01:13:06 +0000 (01:13 +0000)]
Typo s/rtyep/rtype/g

rtyep should read rtype

4 years agonvme: add fix for sanitize OWPASS value and log page structure
Gollu Appalanaidu [Sat, 23 Jan 2021 09:01:35 +0000 (14:31 +0530)]
nvme: add fix for sanitize OWPASS value and log page structure

OWPASS value will be from 0 to 15.

Added the complete log data structure memebers, currently reseved
fields are ignored currently.

Signed-off-by: Gollu Appalanaidu <anaidu.gollu@samsung.com>
4 years agonvme-status: return negative status if !errno
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>
4 years agozns: print select_all field for Zone Management Send
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.

Example:
  # nvme zns reset-zone /dev/nvme0n1 -s 0 -a
  zns-reset-zone: Success, action:4 zone:0 all:1 nsid:1

Signed-off-by: Minwoo Im <minwoo.im.dev@gmail.com>
4 years agoMerge branch 'ganaidu707-dst/fix'
Keith Busch [Tue, 26 Jan 2021 21:16:50 +0000 (13:16 -0800)]
Merge branch 'ganaidu707-dst/fix'

4 years agoMerge branch 'master' into dst/fix
Keith Busch [Tue, 26 Jan 2021 21:15:00 +0000 (14:15 -0700)]
Merge branch 'master' into dst/fix

4 years agonvme: device self test cdw10 specific fields
Gollu Appalanaidu [Sat, 23 Jan 2021 18:18:44 +0000 (23:48 +0530)]
nvme: device self test cdw10 specific fields

Signed-off-by: Gollu Appalanaidu <anaidu.gollu@samsung.com>
4 years agonvme-topology: fix returning invalid value in scan_subsystems()
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>
4 years agonvme: fix device self test log
Gollu Appalanaidu [Sat, 23 Jan 2021 10:23:47 +0000 (15:53 +0530)]
nvme: fix device self test log

Namespace ID no need to mention for the device self test log,
removing nsid and adding DST log entries field

Signed-off-by: Gollu Appalanaidu <anaidu.gollu@samsung.com>
4 years ago[nvme-cli] WDC plugin fixes for vs-fw-activate-history command
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

4 years agoskip display of missing controller fields
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>