]> www.infradead.org Git - users/hch/nvme-cli.git/log
users/hch/nvme-cli.git
8 years ago<linux/nvme.h>: Correct NVMF enum values to match NVMe-oF rev 1.0
Roland Dreier [Thu, 2 Mar 2017 03:35:39 +0000 (19:35 -0800)]
<linux/nvme.h>: Correct NVMF enum values to match NVMe-oF rev 1.0

The enum values for QPTYPE, PRTYPE and CMS are off by 1 from the
values defined in figure 42 of the NVM Express over Fabrics 1.0:

    http://www.nvmexpress.org/wp-content/uploads/NVMe_over_Fabrics_1_0_Gold_20160605-1.pdf

Fix our enums to match the final spec.

The matching fix to the kernel include has been submitted as well:

    http://lists.infradead.org/pipermail/linux-nvme/2017-March/008612.html

Signed-off-by: Roland Dreier <roland@purestorage.com>
8 years agonvme-cli: Western Digital/HGST plug-in documentation.
Chaitanya Kulkarni [Wed, 1 Mar 2017 02:14:10 +0000 (18:14 -0800)]
nvme-cli: Western Digital/HGST plug-in documentation.

This patch adds documentation for the commands present in
Western Digital/HGST plug-in.

Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@hgst.com>
8 years agonvme-cli: Western Digital/HGST plug-in.
Chaitanya Kulkarni [Wed, 1 Mar 2017 02:14:09 +0000 (18:14 -0800)]
nvme-cli: Western Digital/HGST plug-in.

This patch adds support for Vendor unique commands for
Western Digital/HGST devices. Following commands are
supported in current version of this extension:-

1.cap-diag        WDC Capture-Diagnostics
2.drive-log       WDC Drive Log
3.get-crash-dump  WDC Crash Dump
4.id-ctrl         WDC identify controller
5.purge           WDC Purge
6.purge-monitor   WDC Purge Monitor
7.smart-log-add   WDC Additional Smart Log

Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@hgst.com>
8 years agonvme-cli: nvme.c: Allow plug-ins to access to output formats and helper.
Chaitanya Kulkarni [Wed, 1 Mar 2017 02:14:08 +0000 (18:14 -0800)]
nvme-cli: nvme.c: Allow plug-ins to access to output formats and helper.

This patch allows plug-ins to access output format enums and
its helper by moving the enum definition and helper declaration
to the header file.

Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@hgst.com>
8 years agonvme-cli: id-ctrl: Add vendor fields in JSON id-ctrl.
Chaitanya Kulkarni [Wed, 1 Mar 2017 02:14:07 +0000 (18:14 -0800)]
nvme-cli: id-ctrl: Add vendor fields in JSON id-ctrl.

As a part of the id-ctrl command vendor specific callback is issued.
This patch allows the vendor-specific callback to print the extended
vendor unique (ctrl->vs) information from identify controller
data structure in the JSON format. It also enables id-ctrl command
to print vendor specific fields along with generic id-ctrl fields
in one JSON object. This modifies Intel plug-in which is the only
one uses extended id-ctrl (cs->vs) information in current
implementation.

Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@hgst.com>
8 years agoget-ns-id: Exit when no device provided.
Keith Busch [Mon, 27 Feb 2017 15:31:38 +0000 (10:31 -0500)]
get-ns-id: Exit when no device provided.

https://github.com/linux-nvme/nvme-cli/issues/159

Signed-off-by: Keith Busch <keith.busch@intel.com>
8 years agoBuild without uuid
Keith Busch [Mon, 27 Feb 2017 15:25:53 +0000 (10:25 -0500)]
Build without uuid

By popular demand, this introduces a compile time check for uuid and
callbacks accordingly.

https://github.com/linux-nvme/nvme-cli/issues/160

Signed-off-by: Keith Busch <keith.busch@intel.com>
8 years agoDon't print unimplemented sensor
Keith Busch [Mon, 27 Feb 2017 15:06:43 +0000 (10:06 -0500)]
Don't print unimplemented sensor

This is an optional feature, no need to display it if not implemented. A
value of 0 indicates it's not used.

Signed-off-by: Keith Busch <keith.busch@intel.com>
8 years agonvme-cli: smart-log: Allow negative values for temp sensors.
Chaitanya Kulkarni [Sun, 26 Feb 2017 07:34:42 +0000 (23:34 -0800)]
nvme-cli: smart-log: Allow negative values for temp sensors.

HGST devices allowed to produce valid negative values for
"Temperature Sensor 1" of the smart-log command. Change the
temperature sensor value from unsigned to signed so that
negative values will be printed correctly.

Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@hgst.com>
Reviewed-by: Sagi Grimberg <sagi@grimbeg.me>
Signed-off-by: Keith Busch <keith.busch@intel.com>
8 years agonvme-cli: json_add_smart_log(): Fix memory leak for JSON.
Chaitanya Kulkarni [Fri, 24 Feb 2017 02:39:37 +0000 (18:39 -0800)]
nvme-cli: json_add_smart_log(): Fix memory leak for JSON.

This patch fixes the following memory leak for json_add_smart_log()
when used by the external function:-
==8637== HEAP SUMMARY:
==8637==     in use at exit: 1,807 bytes in 56 blocks
==8637==   total heap usage: 101 allocs, 45 frees, 6,577 bytes allocated
==8637==
==8637== LEAK SUMMARY:
==8637==    definitely lost: 24 bytes in 1 blocks
==8637==    indirectly lost: 1,783 bytes in 55 blocks
==8637==      possibly lost: 0 bytes in 0 blocks
==8637==    still reachable: 0 bytes in 0 blocks
==8637==         suppressed: 0 bytes in 0 blocks

Fix:-
==8667== HEAP SUMMARY:
==8667==     in use at exit: 0 bytes in 0 blocks
==8667==   total heap usage: 101 allocs, 152 frees, 6,577 bytes allocated
==8667==

Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@hgst.com>
8 years agonvme-cli: fw-log: Fix memory leak for JSON.
Chaitanya Kulkarni [Fri, 24 Feb 2017 02:39:36 +0000 (18:39 -0800)]
nvme-cli: fw-log: Fix memory leak for JSON.

This patch fixes the following memory leak when fw-log command
executed with JSON option:-
==7822==
==7822== HEAP SUMMARY:
==7822==     in use at exit: 1,104 bytes in 38 blocks
==7822==   total heap usage: 75 allocs, 37 frees, 5,103 bytes allocated
==7822==
==7822== LEAK SUMMARY:
==7822==    definitely lost: 24 bytes in 1 blocks
==7822==    indirectly lost: 1,080 bytes in 37 blocks
==7822==      possibly lost: 0 bytes in 0 blocks
==7822==    still reachable: 0 bytes in 0 blocks
==7822==         suppressed: 0 bytes in 0 blocks

Fix:-
==8436==
==8436== HEAP SUMMARY:
==8436==     in use at exit: 0 bytes in 0 blocks
==8436==   total heap usage: 75 allocs, 75 frees, 5,103 bytes allocated
==8436==

Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@hgst.com>
8 years agonvme-cli: smart-log: Fix memory leak for JSON.
Chaitanya Kulkarni [Fri, 24 Feb 2017 02:39:35 +0000 (18:39 -0800)]
nvme-cli: smart-log: Fix memory leak for JSON.

This patch fixes the following memory leak when smart-log command
executed with JSON option:-
==7725== HEAP SUMMARY:
==7725==     in use at exit: 1,661 bytes in 53 blocks
==7725==   total heap usage: 99 allocs, 46 frees, 6,559 bytes allocated
==7725==
==7725== LEAK SUMMARY:
==7725==    definitely lost: 24 bytes in 1 blocks
==7725==    indirectly lost: 1,637 bytes in 52 blocks
==7725==      possibly lost: 0 bytes in 0 blocks
==7725==    still reachable: 0 bytes in 0 blocks
==7725==         suppressed: 0 bytes in 0 blocks

Fix:-
==8322==
==8322== HEAP SUMMARY:
==8322==     in use at exit: 0 bytes in 0 blocks
==8322==   total heap usage: 99 allocs, 99 frees, 6,559 bytes allocated
==8322==

Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@hgst.com>
8 years agonvme-cli: resv-report: Fix memory leak.
Chaitanya Kulkarni [Fri, 24 Feb 2017 02:39:34 +0000 (18:39 -0800)]
nvme-cli: resv-report: Fix memory leak.

 This patch fixes the following memory leak for resv-report command:-
 ==7705==
 ==7705== HEAP SUMMARY:
 ==7705==     in use at exit: 4,096 bytes in 1 blocks
 ==7705==   total heap usage: 31 allocs, 30 frees, 7,941 bytes allocated
 ==7705==
 ==7705== LEAK SUMMARY:
 ==7705==    definitely lost: 4,096 bytes in 1 blocks
 ==7705==    indirectly lost: 0 bytes in 0 blocks
 ==7705==      possibly lost: 0 bytes in 0 blocks
 ==7705==    still reachable: 0 bytes in 0 blocks
 ==7705==         suppressed: 0 bytes in 0 blocks

 Fix:-
 ==8253==
 ==8253== HEAP SUMMARY:
 ==8253==     in use at exit: 0 bytes in 0 blocks
 ==8253==   total heap usage: 31 allocs, 31 frees, 7,941 bytes allocated
 ==8253==

Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@hgst.com>
8 years agonvme-cli: error-log: Fix memory leak for JSON.
Chaitanya Kulkarni [Fri, 24 Feb 2017 02:39:33 +0000 (18:39 -0800)]
nvme-cli: error-log: Fix memory leak for JSON.

This patch fixes the following memory leak when error-log command
executed with JSON option:-
==7690==
==7690== HEAP SUMMARY:
==7690==     in use at exit: 49,779 bytes in 1,708 blocks
==7690==   total heap usage: 2,242 allocs, 534 frees, 87,392 bytes allocated
==7690==
==7690== LEAK SUMMARY:
==7690==    definitely lost: 24 bytes in 1 blocks
==7690==    indirectly lost: 49,755 bytes in 1,707 blocks
==7690==      possibly lost: 0 bytes in 0 blocks
==7690==    still reachable: 0 bytes in 0 blocks
==7690==         suppressed: 0 bytes in 0 blocks

Fix:-
==8015==
==8015== HEAP SUMMARY:
==8015==     in use at exit: 0 bytes in 0 blocks
==8015==   total heap usage: 2,242 allocs, 2,242 frees, 87,392 bytes allocated
==8015==

Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@hgst.com>
8 years agonvme-cli: id-ns: Fix memory leak for JSON.
Chaitanya Kulkarni [Fri, 24 Feb 2017 02:39:32 +0000 (18:39 -0800)]
nvme-cli: id-ns: Fix memory leak for JSON.

This patch fixes the following memory leak when id-ns command
executed with JSON option:-
==7642==
==7642== HEAP SUMMARY:
==7642==     in use at exit: 3,297 bytes in 120 blocks
==7642==   total heap usage: 182 allocs, 62 frees, 9,204 bytes allocated
==7642==
==7642== LEAK SUMMARY:
==7642==    definitely lost: 24 bytes in 1 blocks
==7642==    indirectly lost: 3,273 bytes in 119 blocks
==7642==      possibly lost: 0 bytes in 0 blocks
==7642==    still reachable: 0 bytes in 0 blocks
==7642==         suppressed: 0 bytes in 0 blocks
==7642== Rerun with --leak-check=full to see details of leaked memory
==7642==

Fix:-
==7949==
==7949== HEAP SUMMARY:
==7949==     in use at exit: 0 bytes in 0 blocks
==7949==   total heap usage: 182 allocs, 182 frees, 9,204 bytes allocated
==7949==

Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@hgst.com>
8 years agonvme-cli: id-ctrl: Fix memory leak for JSON.
Chaitanya Kulkarni [Fri, 24 Feb 2017 02:39:31 +0000 (18:39 -0800)]
nvme-cli: id-ctrl: Fix memory leak for JSON.

This patch fixes the following memory leak when id-ctrl command
executed with JSON option:-
==7680==
==7680== HEAP SUMMARY:
==7680==     in use at exit: 9,796 bytes in 338 blocks
==7680==   total heap usage: 474 allocs, 136 frees, 24,729 bytes allocated
==7680==
==7680== LEAK SUMMARY:
==7680==    definitely lost: 24 bytes in 1 blocks
==7680==    indirectly lost: 9,772 bytes in 337 blocks
==7680==      possibly lost: 0 bytes in 0 blocks
==7680==    still reachable: 0 bytes in 0 blocks
==7680==         suppressed: 0 bytes in 0 blocks

Fix:-
==7971==
==7971== HEAP SUMMARY:
==7971==     in use at exit: 0 bytes in 0 blocks
==7971==   total heap usage: 474 allocs, 474 frees, 24,729 bytes allocated
==7971==

Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@hgst.com>
8 years agonvme-cli: fabrics: Fix to pass "host_traddr" to the kernel driver.
Duane Grigsby [Wed, 8 Feb 2017 18:46:24 +0000 (10:46 -0800)]
nvme-cli: fabrics: Fix to pass "host_traddr" to the kernel driver.

This fix adds the  "host_traddr" to the contructed string that is
passed to the kernel.

Signed-off-by: Darren Trapp <darren.trapp@cavium.com>
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
8 years agoMerge pull request #158 from MatiasBjorling/lightnvm_default_target_parameters
Keith Busch [Wed, 15 Feb 2017 15:45:56 +0000 (08:45 -0700)]
Merge pull request #158 from MatiasBjorling/lightnvm_default_target_parameters

lightnvm: default to -1 on lun begin and end

8 years agolightnvm: default to -1 on lun begin and end
Matias Bjørling [Wed, 15 Feb 2017 14:57:32 +0000 (15:57 +0100)]
lightnvm: default to -1 on lun begin and end

The default behavior when initializing a target without lun end and
begin is to use only the first lun of the OCSSD. Going forward, the
user shall either explicit specific the begin and end, or if not defined
for kernel 4.11 and newer, the full SSD is initialized.

Signed-off-by: Matias Bjørling <matias@cnexlabs.com>
8 years agoMerge pull request #157 from leitao/pr
Keith Busch [Mon, 6 Feb 2017 16:42:45 +0000 (09:42 -0700)]
Merge pull request #157 from leitao/pr

Moving the bash completion files to the standard

8 years agoMoving the bash completion files to the standard
Breno Leitao [Mon, 6 Feb 2017 16:03:14 +0000 (11:03 -0500)]
Moving the bash completion files to the standard

Currently it is not recommend to put the bash completion files inside
/etc, but on the new /usr/share/completion, as stated in :

https://lintian.debian.org/tags/package-installs-into-obsolete-dir.html
https://bugs.debian.org/776954

Signed-off-by: Breno Leitao <breno.leitao@gmail.com>
8 years agoMerge pull request #156 from leitao/master
Keith Busch [Mon, 6 Feb 2017 15:34:35 +0000 (08:34 -0700)]
Merge pull request #156 from leitao/master

Small changes detected during packaging version 1.1

8 years agoRemove pyc files generated by 'make test'
Breno Leitao [Mon, 6 Feb 2017 13:10:57 +0000 (08:10 -0500)]
Remove pyc files generated by 'make test'

When target 'test' is called, it generate some pyc files, that is not
removed by the target 'clean'.

This cause problem with the deb package, since the 'clean' target make
the source files equal to the original one.

Signed-off-by: Breno Leitao <breno.leitao@gmail.com>
8 years agoRemove debian/ directory
Breno Leitao [Mon, 6 Feb 2017 13:04:35 +0000 (08:04 -0500)]
Remove debian/ directory

Current debian/ directory is not used anymore. All the debian control
files are kept in the packages at Debian/Ubuntu/etc

This directory is, in fact, causing trouble when upgrading nvme-cli in
Debian.

Signed-off-by: Breno Leitao <breno.leitao@gmail.com>
8 years agoRegen documentation
Keith Busch [Thu, 2 Feb 2017 16:54:17 +0000 (11:54 -0500)]
Regen documentation

Signed-off-by: Keith Busch <keith.busch@intel.com>
8 years agoDocumentation: fix location of device reset
Johannes Thumshirn [Thu, 2 Feb 2017 15:38:05 +0000 (16:38 +0100)]
Documentation: fix location of device reset

Fix the location of the device reset sysfs path.

Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
8 years agoMerge pull request #155 from amluto/sel3
Keith Busch [Wed, 1 Feb 2017 18:20:17 +0000 (11:20 -0700)]
Merge pull request #155 from amluto/sel3

get-features: Don't try to read the data buffer for sel == 3

8 years agoget-features: Don't try to read the data buffer for sel == 3
Andy Lutomirski [Thu, 1 Sep 2016 15:27:48 +0000 (08:27 -0700)]
get-features: Don't try to read the data buffer for sel == 3

When sel == 3, the controller returns capabilities in the completion
entry and does not produce a feature value blob.  Stop allocating
space for the blob and displaying it -- the result is garbage.

Signed-off-by: Andy Lutomirski <luto@kernel.org>
8 years agoFix read/write man pages
Keith Busch [Wed, 18 Jan 2017 20:15:02 +0000 (15:15 -0500)]
Fix read/write man pages

Removing the second "block-count" parameter.

Signed-off-by: Keith Busch <keith.busch@intel.com>
8 years agoRegenerate Documentation
Keith Busch [Wed, 18 Jan 2017 17:10:54 +0000 (12:10 -0500)]
Regenerate Documentation

New man page added for gen-hostnqn.

Signed-off-by: Keith Busch <keith.busch@intel.com>
8 years agoDocumentation: Add entry for gen-hostnqn
Sagi Grimberg [Thu, 12 Jan 2017 11:13:30 +0000 (13:13 +0200)]
Documentation: Add entry for gen-hostnqn

Signed-off-by: Sagi Grimberg <sagi@grimberg.me>
8 years agonvme.spec/debian: Auto generate host nqn as part of install
Sagi Grimberg [Thu, 12 Jan 2017 11:13:29 +0000 (13:13 +0200)]
nvme.spec/debian: Auto generate host nqn as part of install

The installation will generate a hostnqn and store it in
/etc/nvme/hostnqn file (in case it doesn't exist).
This file will be removed upon uninstallation (purge on for debian).

Signed-off-by: Sagi Grimberg <sagi@grimberg.me>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Jay Freyensee <james_p_freyensee@linux.intel.com>
8 years agonvme-cli: Add nvme hostnqn generation option
Sagi Grimberg [Thu, 12 Jan 2017 11:13:28 +0000 (13:13 +0200)]
nvme-cli: Add nvme hostnqn generation option

Add option to generate a NVMe qualified name of a given host
(in the form of: nqn.2014-08.org.nvmexpress:NVMf:uuid:<some_uuid>).
This hostnqn will be used for fabrics discovery and connect functions.

Signed-off-by: Sagi Grimberg <sagi@grimberg.me>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Jay Freyensee <james_p_freyensee@linux.intel.com>
8 years agoMerge pull request #153 from ncopa/fix-build-with-musl
Keith Busch [Tue, 27 Dec 2016 14:36:40 +0000 (07:36 -0700)]
Merge pull request #153 from ncopa/fix-build-with-musl

Include endian.h for byte/host order functions

8 years agoInclude endian.h for byte/host order functions
Natanael Copa [Mon, 26 Dec 2016 22:12:58 +0000 (23:12 +0100)]
Include endian.h for byte/host order functions

Fix the following error when building with musl libc:

nvme.h:136:2: error: implicit declaration of function 'le16toh'
[-Werror=implicit-function-declaration]
  le16toh((__force __u16)(x))
  ^

Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
8 years agoRelease v1.1 v1.1
Keith Busch [Wed, 21 Dec 2016 22:24:31 +0000 (17:24 -0500)]
Release v1.1

This fixes multiple compiler warnings for 32-bit and other environments
from v1.0, adds more documentation to fabrics, removes the libudev
dependency entirely from this project, adds a framework for unit testing
devices, and fixes usage for user defined install paths.

Signed-off-by: Keith Busch <keith.busch@intel.com>
8 years agoMerge pull request #149 from lsgunth/master
Keith Busch [Mon, 19 Dec 2016 15:42:00 +0000 (08:42 -0700)]
Merge pull request #149 from lsgunth/master

Fix bash completion script

8 years agoFix compiler warning, asprintf usage
Keith Busch [Mon, 19 Dec 2016 15:21:56 +0000 (10:21 -0500)]
Fix compiler warning, asprintf usage

Reported-by: Yachun Liu <D201577676@hust.edu.cn>
Signed-off-by: Keith Busch <keith.busch@intel.com>
8 years agoFix bash completion script
Logan Gunthorpe [Mon, 19 Dec 2016 05:14:13 +0000 (22:14 -0700)]
Fix bash completion script

The bash completion script has never worked correctly for me.
After reviewing the code, it didn't seem to make too much sense to me
either. Thus, I've rewrote parts of it so that it works. I've also done
a _quick_ audit of all the main commands to make sure they
have the correct arguments available.

8 years agofabrics: show number of controllers disconnected
Keith Busch [Fri, 16 Dec 2016 23:35:15 +0000 (18:35 -0500)]
fabrics: show number of controllers disconnected

Multiple controllers may have the same nqn, so we iterate multiple
times and don't want to return the status of just the last one to try to
disconnect. This patch has the status show the number of controllers that
were disconnected based on that nqn as that should be more informative.

Signed-off-by: Keith Busch <keith.busch@intel.com>
8 years agonvme-cli: fabrics: remove libudev dependency
Keith Busch [Thu, 15 Dec 2016 23:46:05 +0000 (18:46 -0500)]
nvme-cli: fabrics: remove libudev dependency

I get a lot of complaints about portability of the nvme-cli regarding the
libudev dependency. This patch removes the dependency from the fabrics
disconnect command when using the target nqn method. Tested on nvme
loop target.

Signed-off-by: Keith Busch <keith.busch@intel.com>
8 years agoMerge pull request #148 from vapier/master
Keith Busch [Fri, 16 Dec 2016 17:11:24 +0000 (10:11 -0700)]
Merge pull request #148 from vapier/master

Documentation: allow parent PREFIX to override

8 years agoDocumentation: allow parent PREFIX to override
Mike Frysinger [Fri, 16 Dec 2016 17:08:02 +0000 (12:08 -0500)]
Documentation: allow parent PREFIX to override

The current Documentation/Makefile always sets PREFIX to /usr/local.
If the parent Makefile sets it to something else, then it still gets
clobbered.  Change the Makefile to look like the parent and allow the
cascading logic to work.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
8 years agoMerge pull request #147 from vapier/master
Keith Busch [Fri, 16 Dec 2016 15:32:33 +0000 (08:32 -0700)]
Merge pull request #147 from vapier/master

change default CFLAGS settings into the default

8 years agochange default CFLAGS settings into the default
Mike Frysinger [Fri, 16 Dec 2016 00:10:28 +0000 (19:10 -0500)]
change default CFLAGS settings into the default

The way compiler settings are appended to CFLAGS breaks custom flags
that people are using to build.  So if someone does:
$ export CFLAGS='-O0 -ggdb'
$ make
The build will force -O2 instead.

Shift these defaults into a default setting rather than always appending.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
8 years agoAdd error checking on all file opens
Keith Busch [Fri, 16 Dec 2016 00:06:36 +0000 (19:06 -0500)]
Add error checking on all file opens

I'm missing a few of these, which is causing erroneous errors to be
printed when requesting help, or providing a bad file handle.

Signed-off-by: Keith Busch <keith.busch@intel.com>
8 years agoDecode an reservation errors code to strings
Yongseok Oh [Wed, 14 Dec 2016 03:05:55 +0000 (12:05 +0900)]
Decode an reservation errors code to strings

If reservation conflict happens with reservation related commands (e.g.,
resv_register, resv_acquire, and resv_release), show the error as a string.

[fixed compile error; reword commit message]
Signed-off-by: Keith Busch <keith.busch@intel.com>
8 years agoMerge branch 'apage43-jsonfixes'
Keith Busch [Mon, 12 Dec 2016 16:26:19 +0000 (11:26 -0500)]
Merge branch 'apage43-jsonfixes'

Signed-off-by: Keith Busch <keith.busch@intel.com>
8 years agoFix right trim() in JSON output
Aaron Miller [Fri, 9 Dec 2016 23:38:35 +0000 (15:38 -0800)]
Fix right trim() in JSON output

Was always trimming from the end of the format buffer, not the end of
the snprintf output. Also need to remove the initial decrement as
snprintf will leave fmt_sz pointing at the terminating NUL.

8 years agoOutput JSON device list in an array
Aaron Miller [Tue, 6 Dec 2016 21:50:21 +0000 (13:50 -0800)]
Output JSON device list in an array

When printing as an object with product name as key, multiple cards with
the same product name can be present as the same key, and most JSON
parsers will only see one.

8 years agoFix handling of Firmware field in JSON output
Aaron Miller [Fri, 9 Dec 2016 23:11:28 +0000 (15:11 -0800)]
Fix handling of Firmware field in JSON output

This was not checking the sizeof() of the .fr field and could read past
the end of it.

8 years agoAllow bi-directional commands
Keith Busch [Tue, 6 Dec 2016 23:03:25 +0000 (18:03 -0500)]
Allow bi-directional commands

The spec allows bi-directional commands so let's let a user submit
one. The kernel does not support this at the moment, but maybe it will
someday.

Signed-off-by: Keith Busch <keith.busch@intel.com>
8 years agoFix segfault listing models
Keith Busch [Tue, 6 Dec 2016 22:36:32 +0000 (15:36 -0700)]
Fix segfault listing models

The models strings may not exist in the place this program thinks it
does. Check if the file is valid before reading from it, and return an
apporpriate string accordingly.

https://github.com/linux-nvme/nvme-cli/issues/140

Signed-off-by: Keith Busch <keith.busch@intel.com>
8 years agoRemove intel specific log from top-level commands
Keith Busch [Tue, 29 Nov 2016 22:42:40 +0000 (15:42 -0700)]
Remove intel specific log from top-level commands

Vendor specific plugins should be used for vendor specific logs, and
Intel already provides one.

Signed-off-by: Keith Busch <keith.busch@intel.com>
8 years agoMake code alignment great again
Keith Busch [Tue, 29 Nov 2016 22:37:56 +0000 (15:37 -0700)]
Make code alignment great again

Some of these config options got mis-aligned somewhere along the way.

Signed-off-by: Keith Busch <keith.busch@intel.com>
8 years agoMake program have single exit location
Keith Busch [Mon, 10 Oct 2016 23:11:19 +0000 (17:11 -0600)]
Make program have single exit location

All errors are returned rather than exiting the program. This requires
more return code error checking, but it makes it predictable where the
program may end and required if we ever implement an interactive mode.

Signed-off-by: Keith Busch <keith.busch@intel.com>
8 years agoFix suffix shift overflow
Karsten Weiss [Tue, 6 Dec 2016 17:40:28 +0000 (12:40 -0500)]
Fix suffix shift overflow

From: Karsten Weiss <k.weiss@science-computing.de>
Signed-off-by: Keith Busch <keith.busch@intel.com>
8 years agoFix intel read stats log page
Keith Busch [Tue, 6 Dec 2016 16:34:15 +0000 (11:34 -0500)]
Fix intel read stats log page

Need to use the parameter. Was mistakenly using the defined string,
which makes no sense.

Reported-by: Karsten Weiss <k.weiss@science-computing.de>
Signed-off-by: Keith Busch <keith.busch@intel.com>
8 years agoFix 48-bit conversion for 32-bit arch
Keith Busch [Tue, 6 Dec 2016 15:37:52 +0000 (10:37 -0500)]
Fix 48-bit conversion for 32-bit arch

The cast to 'long' was the wrong type for 32-bit.

Signed-off-by: Keith Busch <keith.busch@intel.com>
8 years agoFix 32-bit warning on print
Keith Busch [Tue, 6 Dec 2016 15:28:15 +0000 (10:28 -0500)]
Fix 32-bit warning on print

Use the arch specific print format macros.

https://github.com/linux-nvme/nvme-cli/issues/143

Signed-off-by: Keith Busch <keith.busch@intel.com>
8 years agoShow negative temperatures in smart log.
Keith Busch [Tue, 29 Nov 2016 15:25:27 +0000 (10:25 -0500)]
Show negative temperatures in smart log.

Issue: https://github.com/linux-nvme/nvme-cli/issues/141
Signed-off-by: Keith Busch <keith.busch@intel.com>
8 years agoUpdate man pages
Keith Busch [Thu, 17 Nov 2016 16:45:01 +0000 (11:45 -0500)]
Update man pages

Signed-off-by: Keith Busch <keith.busch@intel.com>
8 years agoadd a disconnect man page
Christoph Hellwig [Thu, 17 Nov 2016 16:26:27 +0000 (17:26 +0100)]
add a disconnect man page

Signed-off-by: Christoph Hellwig <hch@lst.de>
8 years agoadd a full blown connect man page
Christoph Hellwig [Thu, 17 Nov 2016 16:26:26 +0000 (17:26 +0100)]
add a full blown connect man page

Mostly based on the wording in connect-all.

Signed-off-by: Christoph Hellwig <hch@lst.de>
[Removed older/duplicate option]
Signed-off-by: Keith Busch <keith.busch@intel.com>
8 years agoupdate discover and connect-all man pages
Christoph Hellwig [Thu, 17 Nov 2016 16:26:25 +0000 (17:26 +0100)]
update discover and connect-all man pages

Document the --host-traddr option, and add the missing description of
the --raw command to the connect-all man page.

Signed-off-by: Christoph Hellwig <hch@lst.de>
[Removed old/duplicate option entry]
Signed-off-by: Keith Busch <keith.busch@intel.com>
Conflicts:
Documentation/nvme-connect-all.txt
Documentation/nvme-discover.txt

8 years agonvmecli-tests : update the list of dependencies
chaitany kulkarni [Thu, 17 Nov 2016 08:48:17 +0000 (00:48 -0800)]
nvmecli-tests : update the list of dependencies

README file is updated with complete list of dependencies
required to setup the environment for unitttests.

Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@hgst.com>
8 years agoFix Debian rules
Sagi Grimberg [Thu, 17 Nov 2016 15:35:13 +0000 (10:35 -0500)]
Fix Debian rules

Usually when building a package we don't want to run tests
that require nvme devices. So until we can classify to tests
that have requirements to not run unless some env variables
are set we need this rule.

Reviewed-by: Christoph Hellwig <hch@lst.de>
8 years agoUnittest framework based on nvme-cli.
Chaitanya Kulkarni [Thu, 27 Oct 2016 06:48:37 +0000 (23:48 -0700)]
Unittest framework based on nvme-cli.

Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@hgst.com>
8 years agoRelease version 1.0 v1.0
Keith Busch [Tue, 15 Nov 2016 23:15:25 +0000 (18:15 -0500)]
Release version 1.0

Been long enough, and lots of updates accumlated. Thank you to everyone
who contributed this round!

Just some highlights in this release:

 * Bug fixes on some of the lesser used parameters and commands
 * Support for fabrics discover and connect to targets
 * More 3rd party extensions have been added
 * New JSON output formats on some of the show routines
 * Documenation updates and fixes
 * Compiler warnings for some configurations

Signed-off-by: Keith Busch <keith.busch@intel.com>
8 years agoUpdate documentation
Keith Busch [Tue, 15 Nov 2016 23:11:06 +0000 (18:11 -0500)]
Update documentation

Fill in missing options in the IO commands.

Signed-off-by: Keith Busch <keith.busch@intel.com>
8 years agoRemove accidental print
Keith Busch [Tue, 15 Nov 2016 17:24:54 +0000 (12:24 -0500)]
Remove accidental print

Signed-off-by: Keith Busch <keith.busch@intel.com>
8 years agoUpdate nvme-write-uncor documentation.
Keith Busch [Fri, 11 Nov 2016 15:26:33 +0000 (10:26 -0500)]
Update nvme-write-uncor documentation.

Eluded to the write-zeroes by mistake.

Signed-off-by: Keith Busch <keith.busch@intel.com>
8 years agoget-feature updates
Keith Busch [Fri, 11 Nov 2016 15:24:23 +0000 (10:24 -0500)]
get-feature updates

This fixes some of the printing options. We don't want to print text if
the request is to display the buffer in raw binary, and we don't want
to do a binary output if there is no buffer to write.

Signed-off-by: Keith Busch <keith.busch@intel.com>
8 years agoRe-add host-traddr option to connect-all manpage
Keith Busch [Thu, 27 Oct 2016 16:31:28 +0000 (12:31 -0400)]
Re-add host-traddr option to connect-all manpage

Signed-off-by: Keith Busch <keith.busch@intel.com>
8 years agoUpdate documentation for discover
Keith Busch [Thu, 27 Oct 2016 16:19:30 +0000 (12:19 -0400)]
Update documentation for discover

Previous commit mistakenly added the host-traddr option to
connect-all. This is for discover.

Signed-off-by: Keith Busch <keith.busch@intel.com>
8 years agoFix coding alignment
Keith Busch [Thu, 27 Oct 2016 16:18:05 +0000 (12:18 -0400)]
Fix coding alignment

Line wrapping argconfig options makes it harder to read.

Signed-off-by: Keith Busch <keith.busch@intel.com>
8 years agoHost-traddr documentation updates
Keith Busch [Thu, 27 Oct 2016 16:00:00 +0000 (12:00 -0400)]
Host-traddr documentation updates

Changed the parameter to use '-' instead of '_' to match consistency of
other options.

Added the option to the connect and connect all manpages.

Replaced the 's' option to 'w' (wwn) as 's' was already in use.

Signed-off-by: Keith Busch <keith.busch@intel.com>
8 years agoDocument timeout value usage
Keith Busch [Wed, 26 Oct 2016 19:41:29 +0000 (15:41 -0400)]
Document timeout value usage

Add to man page and clarify value is in milliseconds.

Signed-off-by: Keith Busch <keith.busch@intel.com>
8 years agonvme-cli: endian swap mmio access
Christoph Hellwig [Wed, 26 Oct 2016 15:01:16 +0000 (17:01 +0200)]
nvme-cli: endian swap mmio access

PCIe is always defined as little endian, so swap the data read from the
register to native endian.

Use the opportunity to also apply the no 64-bit access workaround to
all of the register accesses and not just some and dump struct nvme_reg.

Signed-off-by: Christoph Hellwig <hch@lst.de>
8 years agonvme-cli: Add support for Fibre-channel host address
Duane Grigsby [Mon, 24 Oct 2016 15:30:32 +0000 (08:30 -0700)]
nvme-cli: Add support for Fibre-channel host address

   Example:
nvme connect-all --transport=fc --traddr=pn-0x200100110d9f4100:nn-0x200100110d9f4100 \
--host_traddr=nn-0x20000024ff5ba062:pn-0x21000024ff5ba062

nvme connect --transport=fc --nqn=nqn.2014-08.org.nvmexpress:nvm-subsystem \
--traddr=pn-0x200100110d9f4100:nn-0x200100110d9f4100 --host_traddr=nn-0x20000024ff5ba062:pn-0x21000024ff5ba062

Signed-off-by: Darren Trapp <darren.trapp@cavium.com>
8 years agoregenerate man pages
Keith Busch [Fri, 21 Oct 2016 16:03:57 +0000 (12:03 -0400)]
regenerate man pages

Signed-off-by: Keith Busch <keith.busch@intel.com>
8 years agonvme-cli: fix nvme-connect-all using hostnqn
Jay Freyensee [Fri, 21 Oct 2016 15:50:05 +0000 (08:50 -0700)]
nvme-cli: fix nvme-connect-all using hostnqn

The example in the man pages:

nvme connect-all --transport=rdma --traddr=192.168.1.3 \
--hostnqn=host1-rogue-nqn

fails because nvme-cli fails to actually use hostnqn upon
connect.  This patch fixes that.

Signed-off-by: Jay Freyensee <james_p_freyensee@linux.intel.com>
8 years agonvme-cli: follow-on doc tweaks to nvme-connect-all
Jay Freyensee [Fri, 21 Oct 2016 15:50:04 +0000 (08:50 -0700)]
nvme-cli: follow-on doc tweaks to nvme-connect-all

Minor massaging and typo fixes.

Signed-off-by: Jay Freyensee <james_p_freyensee@linux.intel.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
8 years agonvme-cli: follow-on discovery tweaks from thread
Jay Freyensee [Fri, 21 Oct 2016 15:50:03 +0000 (08:50 -0700)]
nvme-cli: follow-on discovery tweaks from thread

Follow-on doc patch tweaks from discovery documentation discussion.

Signed-off-by: Jay Freyensee <james_p_freyensee@linux.intel.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
8 years agoMerge pull request #133 from weber-wenbo-wang/master
Keith Busch [Tue, 18 Oct 2016 14:49:08 +0000 (08:49 -0600)]
Merge pull request #133 from weber-wenbo-wang/master

Add more memblaze specific smart info for FW 500

8 years agoAdd more memblaze specific smart info for FW 500
Wenbo Wang [Tue, 18 Oct 2016 07:09:28 +0000 (15:09 +0800)]
Add more memblaze specific smart info for FW 500

8 years agoMerge pull request #131 from gwendalcr/fix_compil
Keith Busch [Fri, 14 Oct 2016 14:33:08 +0000 (08:33 -0600)]
Merge pull request #131 from gwendalcr/fix_compil

Fix compilation errors

8 years agoFix compilation errors:
Gwendal Grignou [Thu, 13 Oct 2016 21:25:33 +0000 (14:25 -0700)]
Fix compilation errors:

While compiling nvme-cli for ChromeOS, the compiler founds minor issues
in the code:
- unsigned and sizet_t can never be negative.
- use fabs instead of llabs when argument is a double.

Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
8 years agoMan page updates
Keith Busch [Wed, 12 Oct 2016 19:17:14 +0000 (15:17 -0400)]
Man page updates

Fix the connect-all manpage header section and regenerate all the
manpages.

Signed-off-by: Keith Busch <keith.busch@intel.com>
8 years agoadd documentation for the connect-all command
Christoph Hellwig [Wed, 12 Oct 2016 08:45:51 +0000 (10:45 +0200)]
add documentation for the connect-all command

Signed-off-by: Christoph Hellwig <hch@lst.de>
8 years agofine tune the nvme-discover manpage
Christoph Hellwig [Wed, 12 Oct 2016 08:45:51 +0000 (10:45 +0200)]
fine tune the nvme-discover manpage

 - remove the device argument, which as far as I can tell does not
   exist.
 - mention the /etc/nvme/hostnqn file, the default host nqn and explain
   host nqns a bit more
 - mention the loopback transport
 - be a bit more specific about IP addressing as a concept separate from
   the RDMA transport
 - improve the introduction a bit.

Signed-off-by: Christoph Hellwig <hch@lst.de>
8 years agoconsolidate reporting bugs information
Christoph Hellwig [Wed, 12 Oct 2016 08:45:51 +0000 (10:45 +0200)]
consolidate reporting bugs information

Add the Linux-nvme list to the main reporting bugs section and remove
the separate ones in the connect and discovery pages.

Signed-off-by: Christoph Hellwig <hch@lst.de>
8 years agoAdd json format to list command
Keith Busch [Mon, 10 Oct 2016 20:29:07 +0000 (14:29 -0600)]
Add json format to list command

Updating man page with new options.

Signed-off-by: Keith Busch <keith.busch@intel.com>
8 years agoargconfig: use strtoul for unsigned types
Keith Busch [Mon, 10 Oct 2016 19:50:27 +0000 (13:50 -0600)]
argconfig: use strtoul for unsigned types

Signed-off-by: Keith Busch <keith.busch@intel.com>
8 years agoReturn all errors on list command
Keith Busch [Mon, 10 Oct 2016 18:06:38 +0000 (12:06 -0600)]
Return all errors on list command

Negative errors mean the command failed and we shouldn't try displaying
information if getting it wasn't succcessful.

Signed-off-by: Keith Busch <keith.busch@intel.com>
8 years agoMerge pull request #130 from jpfreyen/master
Keith Busch [Fri, 7 Oct 2016 19:33:39 +0000 (13:33 -0600)]
Merge pull request #130 from jpfreyen/master

fix to argconfig.c for nvme-discover

8 years agonvme-cli: tweak discover man pages w/argconfig fix
Jay Freyensee [Fri, 7 Oct 2016 19:09:20 +0000 (12:09 -0700)]
nvme-cli: tweak discover man pages w/argconfig fix

With Sagi's fix to argconfig.c, the nvme-discover man
pages need to be tweaked to show the true intent of
using discovery.conf, a default with multiple discover
command-lines.

Signed-off-by: Jay Freyensee <james_p_freyensee@linux.intel.com>
8 years agonvme-cli: have cfg var get set more than 1 execution
Jay Freyensee [Fri, 7 Oct 2016 18:46:16 +0000 (11:46 -0700)]
nvme-cli: have cfg var get set more than 1 execution

Without this fix, the struct config cfg variable only
gets set one time when argconfig_parse() is called. Any other
time it is attempted to be set, it acts as a read-only value
and continues to use the initial value it was set with.

This poses a problem for the discovery feature, discovery.conf file
as it is desired to make the file multiple line instead of a single
line, such as:

-t rdma -a 192.168.69.33 -s 4420 -q host2-proper-nqn
-t rdma -a 192.168.1.4   -s 4420 -q host2-proper-nqn
-t rdma -a 192.168.69.33 -s 99 -q host2-proper-nqn

I've tried the fix with a few existing commands and nothing
appears to be broken, but I haven't done an exhaustive test.

Reported-by: Jay Freyensee <james_p_freyensee@linux.intel.com>
Originally-by: Sagi Grimberg <sagi@lightbits.io>
Tested-by: Jay Freyensee <james_p_freyensee@linux.intel.com>
8 years agoFix nvme-models in makefile
Keith Busch [Wed, 5 Oct 2016 23:23:28 +0000 (19:23 -0400)]
Fix nvme-models in makefile

From: Scott Bauer <scott.bauer@intel.com>

We're not sure why our system tested ok without this...

Signed-off-by: Keith Busch <keith.busch@intel.com>
8 years agoMerge branch 'isdct-nvme-log' of https://github.com/ScottyBauer/nvme-cli
Keith Busch [Wed, 5 Oct 2016 23:07:13 +0000 (19:07 -0400)]
Merge branch 'isdct-nvme-log' of https://github.com/ScottyBauer/nvme-cli