]> www.infradead.org Git - users/sagi/nvme-cli.git/log
users/sagi/nvme-cli.git
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>
4 years agoprint topology for NVMe nodes in kernel and path
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>
4 years agoreport scandir errors in legacy_list
Tomasz Zawadzki [Mon, 13 Jul 2020 13:04:19 +0000 (09:04 -0400)]
report scandir errors in legacy_list

Until recently the path to check was hardcoded
to "/dev/". This made it unlikely for scandir()
to ever report errors.

Now that legacy_list accepts different paths,
proper errors should be reported up the stack.

Especially since "No NVMe devices" is not an error,
since both (legacy & sysfs) paths allow for empty
topology.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
4 years agoadd path to nvme list
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>
4 years agonvme: fix get lba status command nsid and data len fields
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.

Signed-off-by: Gollu Appalanaidu <anaidu.gollu@samsung.com>
4 years agonvme: add support for predictable latency per NVM set log page
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>
4 years agonvme-print: fix Namespace ID to decimal format
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

Subsystem        Subsystem-NQN                                                                                    Controllers
---------------- ------------------------------------------------------------------------------------------------ ----------------
nvme-subsys0     nqn.2019-08.org.qemu:deadbeef                                                                    nvme0

NVM Express Controllers

Device   SN                   MN                                       FR       TxPort Address        Subsystem    Namespaces
-------- -------------------- ---------------------------------------- -------- ------ -------------- ------------ ----------------
nvme0    deadbeef             QEMU NVMe Ctrl                           1.0      pcie   0000:01:00.0   nvme-subsys0 nvme0n1
NVM Express Namespaces

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>
4 years agofix dsm and copy range setup
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>
4 years agoverify-no-dep : Fix makefile entry.
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.

4 years agoMerge branch 'hanumanthuh-master'
Keith Busch [Tue, 12 Jan 2021 22:22:20 +0000 (14:22 -0800)]
Merge branch 'hanumanthuh-master'

4 years agoMerge branch 'master' of https://github.com/hanumanthuh/nvme-cli into hanumanthuh...
Keith Busch [Tue, 12 Jan 2021 22:22:09 +0000 (14:22 -0800)]
Merge branch 'master' of https://github.com/hanumanthuh/nvme-cli into hanumanthuh-master

4 years agonvme: refactor S_ISCHR/S_ISBLK with helpers
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>
4 years agonvme: set block size to blkdev before re-read partition
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.

[1] https://lore.kernel.org/linux-nvme/20210105150214.GA16251@lst.de/T/#u

Signed-off-by: Minwoo Im <minwoo.im.dev@gmail.com>
4 years agonvme: add support for predictable latency event aggregate log page
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>
4 years agofix 'list' verbose for controller namespaces
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.

Signed-off-by: Keith Busch <kbusch@kernel.org>
4 years agozns: fix showing system error in report_zones
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>
4 years agoFix build failure from incorrect indenting
Jeff Lien [Fri, 8 Jan 2021 15:32:27 +0000 (09:32 -0600)]
Fix build failure from incorrect indenting

4 years ago[NVME-CLI] WDC Plugin Fixes for SN-730
Jeff Lien [Fri, 8 Jan 2021 14:41:00 +0000 (08:41 -0600)]
[NVME-CLI] WDC Plugin Fixes for SN-730
  vs-nand-stats not printing json format
  vs-nand-stats not printing raw format for several fields
  vs-temperature-stats not printing json format
  vs-drive-info not printing json format

4 years agonvme: add support for persistent event log page
Gollu Appalanaidu [Mon, 11 Jan 2021 08:17:45 +0000 (13:47 +0530)]
nvme: add support for persistent event log page

This is to add support for LID = 0x0D, Persistent Event log page,
this log page contains information about significant events not
specific to a particular command. The information in this log page
shall be retained across power cycles and resets. For More details
see NVM Express 1.4 Spec. Section 5.14.1.13 Persistent Event Log
(Log Identifier 0Dh)

Change nvme get log to read the whole log page interms of 4096 bytes.
Adding LSP argument in nvme get log fuction and change this across
the nvme get log function wherever has been used with NVME_NO_LOG_LSP.

This Adds support for the persistent event types:
01h SMART / Health Log Snapshot
02h Firmware Commit
03h Timestamp Change
04h Power-on or Reset
05h NVM Subsystem Hardware Error
06h Change Namespace
07h Format NVM Start
08h Format NVM Completion
09h Sanitize Start
0Ah Sanitize Completion
0Dh Thermal Excursion

Signed-off-by: Gollu Appalanaidu <anaidu.gollu@samsung.com>
Co-Authored-By: Karthik Balan <karthik.b82@samsung.com>
Co-Authored-By: Steven Seungcheol Lee <sc108.lee@samsung.com>
4 years agoMicron plugin changes - version 1.0.4
Hanumanthu H [Mon, 21 Dec 2020 13:14:45 +0000 (18:44 +0530)]
Micron plugin changes - version 1.0.4

4 years agoMicron plugin changes - extended smart health info and others
Hanumanthu H [Mon, 21 Dec 2020 11:53:03 +0000 (17:23 +0530)]
Micron plugin changes - extended smart health info and others

4 years agosync with latest repo
Hanumanthu H [Mon, 21 Dec 2020 10:52:56 +0000 (16:22 +0530)]
sync with latest repo

4 years ago[nvme cli] Add Customer Serial Num to vs-drive-info command
Jeff Lien [Fri, 4 Dec 2020 20:16:23 +0000 (14:16 -0600)]
[nvme cli] Add Customer Serial Num to vs-drive-info command

4 years ago[nvme cli] Fix drive capabilities to meet OCP Spec
Jeff Lien [Thu, 3 Dec 2020 19:30:12 +0000 (13:30 -0600)]
[nvme cli] Fix drive capabilities to meet OCP Spec

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 agofix null string compiler warning
Keith Busch [Mon, 7 Dec 2020 15:13:18 +0000 (07:13 -0800)]
fix null string compiler warning

Signed-off-by: Keith Busch <kbusch@kernel.org>
4 years agoFix copyright typo
Hanumanthu H [Wed, 5 Aug 2020 06:46:37 +0000 (12:16 +0530)]
Fix copyright typo

4 years agoAdd support for Replay Protection Memory Block (RPMB) commands
Hanumanthu H [Tue, 4 Aug 2020 10:30:39 +0000 (16:00 +0530)]
Add support for Replay Protection Memory Block (RPMB) commands

4 years ago[nvme cli] Add WDC plugin command vs-pcie-stats
Jeff Lien [Tue, 10 Nov 2020 15:01:50 +0000 (09:01 -0600)]
[nvme cli] Add WDC plugin command vs-pcie-stats
[nvme cli] Fix vs-smart-add-log min/max user data erase counts

4 years agoAdd missing sub-command links from main man page
Minwoo Im [Tue, 1 Dec 2020 14:36:22 +0000 (23:36 +0900)]
Add missing sub-command links from main man page

This patch adds missing subcommands to the main man page.

Issue: https://github.com/linux-nvme/nvme-cli/issues/793
Signed-off-by: Minwoo Im <minwoo.im.dev@gmail.com>
4 years ago[nvme-cli] WDC plugin add support for cloud-SSD-plugin-version
Jeff Lien [Thu, 12 Nov 2020 16:39:52 +0000 (10:39 -0600)]
[nvme-cli] WDC plugin add support for cloud-SSD-plugin-version

4 years agoMerge branch 'ErwanAliasr1-evelu-feature'
Keith Busch [Tue, 17 Nov 2020 21:45:38 +0000 (13:45 -0800)]
Merge branch 'ErwanAliasr1-evelu-feature'

4 years agonvme-print: Adding enum nvme_feat
Erwan Velu [Thu, 29 Oct 2020 17:59:48 +0000 (18:59 +0100)]
nvme-print: Adding enum nvme_feat

This patch switch the feature_id into an named enum called nvme_feat.

Having named enum ease the implementation as Werror=switch compile flag will detect forgotten case statements.

A build failure looks like :
nvme-print.c:4525:2: error: enumeration value ‘NVME_FEAT_RRL’ not handled in switch [-Werror=switch]

This patch adds the NVME_FEAT_SANITIZE & NVME_FEAT_RRL inside nvme_feature_show_fields().

A NVME_FEAT_NONE=0 value is added to give a neutral/default value when needed.

Signed-off-by: Erwan Velu <e.velu@criteo.com>
4 years agonvme.spec.in: using specific directory for nvme command on %post
Steven Seungcheol Lee [Wed, 28 Oct 2020 08:20:00 +0000 (17:20 +0900)]
nvme.spec.in: using specific directory for nvme command on %post

${_sbindir} could be placed in out of default bin directories
so just 'nvme gen-hostnqn' would not work with 'nvme command not found'

Signed-off-by: Steven Seungcheol Lee <sc108.lee@samsung.com>
4 years agoUpdate nvme.c
duanhaoqiang [Wed, 4 Nov 2020 01:50:52 +0000 (09:50 +0800)]
Update nvme.c

return error when fw-download firmware size is 0

4 years agoprovide value bounds check on numerical lists
Keith Busch [Fri, 30 Oct 2020 21:28:16 +0000 (14:28 -0700)]
provide value bounds check on numerical lists

Check if the user provided a value exceeding the 32 bits they're
going to be used with rather than silently truncate the value.

Link: https://github.com/linux-nvme/nvme-cli/issues/828
Signed-off-by: Keith Busch <kbusch@kernel.org>
4 years agonvme-print: Show more async event config fields
Jonathan Teh [Wed, 28 Oct 2020 13:31:05 +0000 (13:31 +0000)]
nvme-print: Show more async event config fields

Also fix the ANA log name.

4 years ago[nvme-cli] WDC Plugin fix to Fix clear-fw-activate-history command for SN640 Drives
Jeff Lien [Tue, 27 Oct 2020 21:35:30 +0000 (16:35 -0500)]
[nvme-cli] WDC Plugin fix to Fix clear-fw-activate-history command for SN640 Drives