Revanth Rajashekar [Thu, 21 Nov 2019 18:52:05 +0000 (11:52 -0700)]
nvme-cli: Update err value to 0 in get_ns_id func.
Err value should be updated to 0 on success of nvme_get_nsid,
else the File Descriptor is passed on to nvme_status_to_errno
which returns an irrelevant errno.
Keith Busch [Tue, 29 Oct 2019 11:01:57 +0000 (20:01 +0900)]
Unify print routines
Move all the binary/json/normal output handling into a single function
call for each structure that we print. This will reduce the API surface
that we have to maintain.
Keith Busch [Tue, 5 Nov 2019 18:22:53 +0000 (03:22 +0900)]
nvme-cli: Support for hugetlbfs
Some commands require exceptionally large data transfers, and the
kernel driver supports only a limited number of phyiscal segments per
command. To help support this, try to allocate physically contiguous
space via hugetlbfs and fallback to a normal malloc if that fails.
Rather than deal with the nuances of allocating huge pages, use
libhugetlbfs as a dependency.
Revanth Rajashekar [Tue, 29 Oct 2019 00:02:30 +0000 (18:02 -0600)]
nvme-cli: Update PMR Capability and PMR Status
1. Adding Controller Memory Space Supported(CMSS) in PMRCAP
2. Adding Persistent Memory Region Status(CBAI) in PMRSTS
Revanth Rajashekar [Mon, 28 Oct 2019 23:20:29 +0000 (17:20 -0600)]
nvme-cli: Update NVMe Registers
1. Add Controller Memory Buffer Memory Space Control (CMBMSC)
2. Add Controller Memory Buffer Status (CMBSTS)
3. Add Persistent Memory Region Memory Space Control (PMRMSC)
Keith Busch [Thu, 10 Oct 2019 19:35:56 +0000 (04:35 +0900)]
fix namespace checks for legacy list
First ensure the controller we're comparing with has been initialized, and then
compare the correct fields with each other. Previously had been comparing a
model number against the serial.
Ben Reese [Tue, 8 Oct 2019 19:24:34 +0000 (12:24 -0700)]
Intel plugin: Adding fields to id-ctrl VU region
Per https://github.com/linux-nvme/nvme-cli/pull/584/commits/f33510efbf5192116e5757d13a02463d446a1dc5#r332178975 removing pack pragma on vu_id_ctrl_field struct.
Signed-off-by: Ben Reese <5884008+benreese0@users.noreply.github.com>
Sagi Grimberg [Mon, 7 Oct 2019 18:22:21 +0000 (11:22 -0700)]
udev: convert the discovery event handler to the kernel support
The kernel will not send us a specific event for discovery but
rather the AEN result code. So expect NVME_AEN=0x70f002 for
discovery log change events.
Also, we don't get the NVME_CTRL_NAME env var anymore as this is
available from the device $kernel.
Andy Lutomirski [Thu, 3 Oct 2019 18:47:02 +0000 (11:47 -0700)]
Use a systemd app-specific machine ID for hostnqn
If /etc/nvme/hostnqn is not present, the fabric commands will ask
systemd for an app-specific machine ID as a fallback. This should
improve functionality if /etc/nvme/hostnqn is not present and should
allow packagers to avoid creating /etc/nvme/hostnqn.
Heavily based on an earlier patch from Tomasz Torcz.
Signed-off-by: Tomasz Torcz <tomek@pipebreaker.pl> Signed-off-by: Andy Lutomirski <luto@kernel.org>
On error, scandir returns -1 and does not allocate memory
for namelist array. In some places in the code return value
of scandir call is not checked. This causes nvme-cli to
attempt to free() an uninitialized pointer, which subsequently
leads to segmentation fault.
To address this issue, check return value of scandir calls
throughout the code.
Changes determination of Device Self-Test in progress to be based on the
Current Device Self-Test Operation field as opposed to the Current
Device Self-Test Completion field.
Current implementation assumes that the Current Device Self-Test
Completion field will be 100% when no Device Self-Test operation is in
progress. This is an unsafe assumption as the NVMe Specification
explicitly specifies that the Current Device Self-Test Completion field
is invalid when no Device Self-Test operation in progress as indicated
by a value of 0 in the Current Device Self-Test Operation field.
A safe assumption is to use the Current Device Self-Test Operation field
which will be 0 when no Device Self-Test operation is in progress.
Minwoo Im [Tue, 3 Sep 2019 01:25:37 +0000 (10:25 +0900)]
remove LIBUUID things from nvme.h
We have this structure in linux/nvme.h already.
cc -D_GNU_SOURCE -D__CHECK_ENDIAN__ -O2 -g -Wall -Werror -std=gnu99 -I. -DNVME_VERSION='"1.9.22.g6936.dirty"' -Iutil -o nvme-print.o -c nvme-print.c
In file included from nvme.h:35:0,
from nvme-print.h:4,
from nvme-print.c:7:
linux/nvme.h:24:3: error: conflicting types for ‘uuid_t’
} uuid_t;
^~~~~~
In file included from nvme-print.h:4:0,
from nvme-print.c:7:
nvme.h:32:3: note: previous declaration of ‘uuid_t’ was here
} uuid_t;
^~~~~~
Makefile:70: recipe for target 'nvme-print.o' failed
nvme-print.c: In function ‘show_relatives’:
nvme-print.c:3964:3: error: ignoring return value of ‘asprintf’, declared with attribute warn_unused_result [-Werror=unused-result]
asprintf(&path, "/sys/class/nvme/%s", name);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
nvme-print.c:3968:3: error: ignoring return value of ‘asprintf’, declared with attribute warn_unused_result [-Werror=unused-result]
asprintf(&path, "/sys/block/%s/device", name);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Minwoo Im [Sun, 25 Aug 2019 13:28:50 +0000 (22:28 +0900)]
id-ctrl: show Flush command behavior in VWC
Volatile Write Cache(VWC) is now indicating the Flush command behavior
in VWC point-of-view. If 2h, Flush command does not support for the
NSID set to FFFFFFFFh. But in case of 3h, it will support.
Signed-off-by: Minwoo Im <minwoo.im.dev@gmail.com>
Keith Busch [Thu, 29 Aug 2019 19:38:14 +0000 (13:38 -0600)]
nvme-cli: Macro'ify argument defines
Defining arguments by field type is too repetive and creates excessively
long lines. Simplify this with some macros that handle the more tedious
parts.