]> www.infradead.org Git - users/hch/nvme-cli.git/log
users/hch/nvme-cli.git
7 years agonvme-cli: Add parsing support for noiob
Scott Bauer [Mon, 15 May 2017 16:40:47 +0000 (10:40 -0600)]
nvme-cli: Add parsing support for noiob

Signed-off-by: Scott Bauer <scott.bauer@intel.com>
7 years agoMerge pull request #178 from ScottyBauer/jsonify-nvme-intel
Keith Busch [Fri, 12 May 2017 22:15:24 +0000 (16:15 -0600)]
Merge pull request #178 from ScottyBauer/jsonify-nvme-intel

nvme-cli: nvme-intel implement json output for smart-log

7 years agonvme-cli: nvme-intel implement json output for smart-log
Scott Bauer [Fri, 12 May 2017 21:54:24 +0000 (15:54 -0600)]
nvme-cli: nvme-intel implement json output for smart-log

./nvme intel smart-log-add --json /dev/nvme0n1

Signed-off-by: Scott Bauer <scott.bauer@intel.com>
7 years agofabrics: add option to override drivers queue depth
Johannes Thumshirn [Wed, 10 May 2017 09:04:12 +0000 (11:04 +0200)]
fabrics: add option to override drivers queue depth

Currently it is not possible to override the fabrics drivers default queue
depth with the nvme userspace utility, but only when manually writing the
parameters to the /dev/nvme-fabrics character device.

Add an option to override the drivers default queue depth for NVMe over
fabrics.

Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Keith Busch <keith.busch@intel.com>
7 years agonvme-list: print empty lists when no devices are present
Keith Busch [Mon, 8 May 2017 20:48:12 +0000 (16:48 -0400)]
nvme-list: print empty lists when no devices are present

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

Signed-off-by: Keith Busch <keith.busch@intel.com>
7 years agoid-ctrl: remove new lines from json output
Keith Busch [Fri, 5 May 2017 20:07:16 +0000 (14:07 -0600)]
id-ctrl: remove new lines from json output

This patch removes the ending newlines from json strings, and skips
printing the optional subsysnqn if the controller does not implement it.

Reported-by: Krishna Dhulipala <krishnad@fb.com>
Signed-off-by: Keith Busch <keith.busch@intel.com>
8 years agonvme-print: Fix line spacing on -H option
Stephen Bates [Mon, 1 May 2017 21:22:45 +0000 (15:22 -0600)]
nvme-print: Fix line spacing on -H option

Add newlines to make the ASQ and ACQ human readable output consistent
with other fields.

Signed-off-by: Stephen Bates <sbates@raithlin.com>
Signed-off-by: Keith Busch <keith.busch@intel.com>
8 years agonvme-cli: Huawei plug-in.
Zou Ming [Thu, 27 Apr 2017 08:05:01 +0000 (08:05 +0000)]
nvme-cli: Huawei plug-in.

This patch adds support for Vendor unique commands for Huawei devices.
Following commands are supported in current version of this extension:

1.list  List addition info (such as namespace name and array name) for Huawei devices

8 years agonvme-cli: Fix build on aarch64-linux-android-4.9
Rakesh Pandit [Mon, 24 Apr 2017 07:44:17 +0000 (10:44 +0300)]
nvme-cli: Fix build on aarch64-linux-android-4.9

Need to include sys/stat.h to fix:
fabrics.c:414:45: error: 'S_IRUSR' undeclared (first use in this function)
fabrics.c:414:53: error: 'S_IWUSR' undeclared (first use in this function)

Also fix warning:
common.h:4:0:
warning: "offsetof" redefined #define offsetof(x, y)
__builtin_offsetof(x, y) ^

Fix this trivial warning by including stddef.h and removing this
definition.

Signed-off-by: Rakesh Pandit <rakesh@tuxera.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Keith Busch <keith.busch@intel.com>
8 years agoFix compile for 32-bit
Keith Busch [Fri, 21 Apr 2017 15:27:10 +0000 (11:27 -0400)]
Fix compile for 32-bit

Incomplete pointer cast to 64-bit failed to compile. Fixing.

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

Signed-off-by: Keith Busch <keith.busch@intel.com>
8 years agonvme-cli: return 0 if disconnect operation with cfg.nqn successfully
Yi Zhang [Tue, 18 Apr 2017 09:20:24 +0000 (17:20 +0800)]
nvme-cli: return 0 if disconnect operation with cfg.nqn successfully

disconnect_by_nqn function will return the number of controllers
successfully disconnected, so change ret = 0 if disconnect operation
with nqn successfully.

$ ./nvme disconnect -n testnqn
NQN:testnqn disconnected 1 controller(s)
$ echo $?
1

Signed-off-by: Yi Zhang <yizhan@redhat.com>
Signed-off-by: Keith Busch <keith.busch@intel.com>
8 years agoMerge pull request #170 from javigon/master
Keith Busch [Tue, 11 Apr 2017 14:14:45 +0000 (08:14 -0600)]
Merge pull request #170 from javigon/master

lightnvm: allow to init target on factory mode

8 years agoMerge pull request #169 from ScottyBauer/fixup-secsend2
Keith Busch [Thu, 6 Apr 2017 16:25:57 +0000 (10:25 -0600)]
Merge pull request #169 from ScottyBauer/fixup-secsend2

Fixed problem with security-recv binary output not working correctly

8 years agoFixed problem with security-recv binary output not working correctly
Thomas Bowen [Tue, 14 Mar 2017 19:58:14 +0000 (12:58 -0700)]
Fixed problem with security-recv binary output not working correctly

Security Receive sent the wrong pointer, specifically a pointer to a
stack location. When using the Dump raw command we would dump stack
contents, not the buffer received from the controller.

Signed-off-by: Thomas Bowen <thomas.r.bowen@intel.com>
Signed-off-by: Scott Bauer <Scott.Bauer@intel.com>
8 years agolightnvm: allow to init target on factory mode
Javier González [Wed, 5 Apr 2017 10:10:27 +0000 (12:10 +0200)]
lightnvm: allow to init target on factory mode

Allow to drop the target recovery mechanism when creating a target in
order to start in factory mode. This facilitates development and makes
it possible to evaluate an OCSSD in different states.

Signed-off-by: Javier González <javier@cnexlabs.com>
8 years agoMerge pull request #167 from lsgunth/master
Keith Busch [Tue, 28 Mar 2017 20:00:51 +0000 (14:00 -0600)]
Merge pull request #167 from lsgunth/master

fabrics: Fix disconnect_by_device from disconnecting instance 0 on error

8 years agofabrics: Fix disconnect_by_device from disconnecting instance 0 on error
Logan Gunthorpe [Tue, 28 Mar 2017 19:26:41 +0000 (13:26 -0600)]
fabrics: Fix disconnect_by_device from disconnecting instance 0 on error

I was a bit surprised that running:

nvme disconnect -d /dev/nvme1

actually disconnected nvme0 and I could never disconnect nvme1. Turns
out the code was not expecting a full path and silently used instance
zero if it failed to parse any arguments.

This patch fixes it so that it ignores any path component and fails if
sscanf doesn't match any items.

8 years agoMerge pull request #166 from jasperla/rpm
Keith Busch [Fri, 17 Mar 2017 14:16:03 +0000 (08:16 -0600)]
Merge pull request #166 from jasperla/rpm

Unbreak RPM build after bash completion files were moved in 7e4c7596

8 years agoUnbreak RPM build after bash completion files were moved in 7e4c7596
Jasper Lievisse Adriaanse [Fri, 17 Mar 2017 09:25:48 +0000 (10:25 +0100)]
Unbreak RPM build after bash completion files were moved in 7e4c7596

8 years agoMerge pull request #165 from ScottyBauer/fixup-secsend
Keith Busch [Thu, 16 Mar 2017 23:33:18 +0000 (17:33 -0600)]
Merge pull request #165 from ScottyBauer/fixup-secsend

Fixup Security send/recv to read data from disk

8 years agoFixup Security send/recv to read data from disk
Scott Bauer [Thu, 16 Mar 2017 23:16:29 +0000 (17:16 -0600)]
Fixup Security send/recv to read data from disk

We forgot to actually read the data from the disk into the buffer.

Signed-off-by: Scott Bauer <scott.bauer@intel.com>
8 years agonvme-cli: Release v1.2 v1.2
Keith Busch [Wed, 15 Mar 2017 15:33:35 +0000 (11:33 -0400)]
nvme-cli: Release v1.2

Changes in this release:

  New vendor pluging from Western Digital.

  Better memory usage on program tear down. Will be more important if
  we have an interactive mode in the future.

  Minor code reorganization to keep vendor uniqueness out of common code.

  Conditionally compile without uuid support if library is not
  installed. This is mainly to silence the complaints, as having libuuid
  is very useful for fabrics.

  Documentation updates and fixes.

Signed-off-by: Keith Busch <keith.busch@intel.com>
8 years agonvme-cli/format: use existing LBAF if none requested
Keith Busch [Tue, 14 Mar 2017 15:49:42 +0000 (11:49 -0400)]
nvme-cli/format: use existing LBAF if none requested

We previously default to LBAF 0 if the user didn't specify one. If a
specific LBAF is not explicitly requested, most people expect format
to not change their currently in use LBAF.  This patch uses the current
format if we have a namespace to query.

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

Signed-off-by: Keith Busch <keith.busch@intel.com>
8 years agomove struct nvme_additional_smart_log to intel-nvme.c
Christoph Hellwig [Mon, 13 Mar 2017 23:10:54 +0000 (17:10 -0600)]
move struct nvme_additional_smart_log to intel-nvme.c

It's a vendor-specific structure only used by the intel plugin, so
move it there.

Signed-off-by: Christoph Hellwig <hch@lst.de>
8 years agoremove nvme_intel_smart_log
Christoph Hellwig [Mon, 13 Mar 2017 23:10:53 +0000 (17:10 -0600)]
remove nvme_intel_smart_log

and just inline it into the only caller.

Signed-off-by: Christoph Hellwig <hch@lst.de>
8 years agoremove json_add_smart_log
Christoph Hellwig [Mon, 13 Mar 2017 23:10:52 +0000 (17:10 -0600)]
remove json_add_smart_log

This is the json variant of the Intel additional smart log, but it
appears to be entirely unused.  If we want to bring it back it should
be moved to intel-nvme.c, though.

Signed-off-by: Christoph Hellwig <hch@lst.de>
8 years agomove show_intel_smart_log to intel-nvme.c
Christoph Hellwig [Mon, 13 Mar 2017 23:10:51 +0000 (17:10 -0600)]
move show_intel_smart_log to intel-nvme.c

To fit in with the rest of the plugin infrastructure.

Signed-off-by: Christoph Hellwig <hch@lst.de>
8 years agonvme-cli: bug-fix: use right file name for perror.
Chaitanya Kulkarni [Sun, 12 Mar 2017 23:13:24 +0000 (16:13 -0700)]
nvme-cli: bug-fix: use right file name for perror.

Use right file descriptor while printing an error, when
--metadata option is used for read/write commands.

Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@hgst.com>
8 years agoMerge pull request #162 from rolandd/master
Keith Busch [Mon, 6 Mar 2017 19:44:55 +0000 (12:44 -0700)]
Merge pull request #162 from rolandd/master

fabrics: Handle space-padded TRSVCID and TRADDR fields

8 years agofabrics: Handle space-padded TRSVCID and TRADDR fields
Roland Dreier [Thu, 2 Mar 2017 18:06:21 +0000 (10:06 -0800)]
fabrics: Handle space-padded TRSVCID and TRADDR fields

The TRSVCID and TRADDR fields in the discovery log page are defined
as ASCII strings, which according to the NVMe standard means they
should be space-padded rather than NUL-terminated.

The current nvme-cli code will print all the spaces and possibly some
garbage from the next field.  For example this causes "connect-all"
to write strings that get rejected with "malformed IP address passed."

Fix this by only writing the contents of these fields until the last
non-space character, and limiting the length to the size of the field.

Signed-off-by: Roland Dreier <roland@purestorage.com>
8 years agoMerge pull request #161 from rolandd/master
Keith Busch [Thu, 2 Mar 2017 15:53:42 +0000 (08:53 -0700)]
Merge pull request #161 from rolandd/master

<linux/nvme.h>: Correct NVMF enum values to match NVMe-oF rev 1.0

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>