Daniel Wagner [Mon, 16 Jan 2023 13:44:40 +0000 (14:44 +0100)]
fabrics: Do not overwrite errno with return code
__create_discover_ctrl() is calling nvmf_add_ctrl() which sets errno
when something doesn't work. Hence we should not overwrite the errno
with the return code in __ctrl_discover_ctrl().
This prevents to propagate the errno code to the callside and the
nvme_strerror(errno) call is just return 'unknown error -1'.
Daniel Wagner [Mon, 16 Jan 2023 13:51:07 +0000 (14:51 +0100)]
build: Set projects default to debug and prefix /usr/local
Do not install to /usr per default and accidently overwrite the
distributions version of the package. And also debugging symbols per
default to make development setup as we don't install it anyway to /usr
anyway.
Daniel Wagner [Tue, 3 Jan 2023 17:46:57 +0000 (18:46 +0100)]
unit: Move unit tests to a new directory
The tests directory contains a test framework for testing
real hardware and are thus no real unit tests. As these
tests are reading and writing data to /dev/nvme0 we should
disable them per default.
To distinguish between the real unit tests and the nvme test
framework move all unit test to a new directory.
Tokunori Ikegami [Wed, 28 Dec 2022 10:18:30 +0000 (19:18 +0900)]
nvme: create-ns: Add nsze-si and ncap-si arguments to set in standard SI units
This is proposed by the issue #1747. The value suffixed SI is divided by the
namespace LBA size to set as NSZE and NCAP. If the value not suffixed it is set
as same with the nsze and ncap options.
Note: The existing nsze/ncap arguments follow the specification defined units.
Qiang Wei [Fri, 30 Dec 2022 14:52:38 +0000 (22:52 +0800)]
Bash completion: move global declare into function
* To fix completion issue by moving global vairables into
function _nvme_subcmds. It is not only suite for bash
completion system but also support manually source bash script.
* Fix pluginx_sfx_opts spell error to plugin_sfx_opts.
* Correct variable NO_OPTS used in bash assginment.
Tokunori Ikegami [Fri, 16 Dec 2022 17:34:15 +0000 (02:34 +0900)]
nvme-print: Serialize uint32_t types correctly
le32_to_cpu returns an unsigned type which gets extended to a signed
type when using %d format specifier or json_object_add_value_int. Use
%u in this case or json_object_add_value_uint accordingly.
Jeremy Kerr [Mon, 14 Nov 2022 06:04:19 +0000 (14:04 +0800)]
nvme: fw-download: handle overlapping range errors
Some NVMe implementations may return an Overlapping Range error if we
attempt to re-send a image range that has already been sent to a device.
We may hit this in a couple scenarios:
- a prior Firmware Image Download command succeeded, but the success
response was lost due to unrelated transport issues
- a download has been cancelled, and is now being re-attempted
In order to handle this, this change adds a --ignore-ovr option to the
fw-download subcommand, which treats the Overlapping Range errors as
non-fatal, allowing the firmware download to proceed with the
non-overlapping portions.
We don't make this the default behaviour, because we cannot guarantee
that the currently-upoloaded portion is what has already been sent to
the device (and the user actually wants to overwrite with new image
data). In those cases, a firmware commit or device reset is required
instead.
Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
Jeremy Kerr [Tue, 8 Nov 2022 07:13:32 +0000 (15:13 +0800)]
nvme: fw-download: Add retry mechanism
Since we're potentially sending a lot of (chunked) data in the
fw-download process, add a facility for a single chunk failure to be
retried, if the error status does not indicate the Do Not Resend status
flag.
The retry count is reset once a chunk is sucessfully transferred, up to
a maximum of three retries.
This allows for occasional transport errors to not abort the whole
transfer.
Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
Jeremy Kerr [Mon, 14 Nov 2022 06:12:55 +0000 (14:12 +0800)]
nvme: fw-download: move individual transfers to a separate function
The next few changes will add progress reporting and more comprehensive
error reporting to the fw-download process, which will be more readable
as a single function.
Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
nick black [Sun, 13 Nov 2022 22:34:34 +0000 (17:34 -0500)]
nvme: call nvme_get_smart_log() with false
Changing this to true resulted in my Western Digital 970 EVO Pro NVMe
SSDs returning all zeros for smartlog information. Reverts change made
in cc73f65fc016 ("nvme: Add wrappers for Get Log page helpers")
Resolves #1729.
Signed-off-by: nick black <dankamongmen@gmail.com>
nick black [Sun, 13 Nov 2022 21:14:44 +0000 (16:14 -0500)]
build: require meson 0.50.0+
The Meson buildspec uses features introduced ('plain strings for
include_directories') in Meson 0.50.0, but only specifies
0.48.0. Eliminates a Meson warning.
Signed-off-by: nick black <dankamongmen@gmail.com>
Daniel Wagner [Fri, 11 Nov 2022 14:12:33 +0000 (15:12 +0100)]
build: Disable Azure Pipeline
Unfortunatly, currently the build agent setup is not working
correctly. The issue is that when the build VM is spawned and the
agent is installed via the Extension API it will not show up as build
agent (though as deploy agent).
Daniel Wagner [Thu, 10 Nov 2022 14:16:24 +0000 (15:16 +0100)]
build: Add Azure Pipeline configuration
Verify if the change for nvme-cli is breaking blktests. We can't run
the blktests inside the containers because blktests wants write access
to sysfs and configfs which is forbidden in the provided github
containers. Thus we have to run our own fullfledge VM.
The instruction how to setup the build infrastructure is coming soon.
Jinliang Wang [Wed, 9 Nov 2022 01:22:34 +0000 (17:22 -0800)]
nvme: Support telemetry-log over nvme-mi
Copy and re-write the nvme_get_telemetry_log() function, so that we
can use the existing wrappers below to get telemetry log both in-band
and over nvme-mi:
Ronan Pigott [Sun, 6 Nov 2022 21:26:15 +0000 (14:26 -0700)]
zsh: move SPDX identifier
The zsh completion system requires compdef to be set in the first line
of the completion definition. The SPDX identifier introduced breaks this
requirement, so let's just move it a line down.
Martin George [Fri, 28 Oct 2022 16:19:29 +0000 (21:49 +0530)]
solidgm: fix initialization warning
Seeing the below warning while compiling nvme-cli:
ninja: Entering directory `.build'
[27/51] Compiling C object nvme.p/plugins_solidigm_solidigm-telemetry.c.o
../plugins/solidigm/solidigm-telemetry.c: In function ‘solidigm_get_telemetry_log’:
../plugins/solidigm/solidigm-telemetry.c:126:22: warning: ‘length’ may be used uninitialized in this function [-Wmaybe-uninitialized]
tl.configuration = json_tokener_parse_ex(jstok, conf_str, length);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[51/51] Linking target nvme
Fix this by initializing the 'length' variable to zero.
Daniel Wagner [Fri, 28 Oct 2022 09:32:30 +0000 (11:32 +0200)]
build: Fix endian check for cross build
The endian check is supposed to figure it the ordering on the machine
which the binary will run on. Hence we need to check the host not the
build machine.
leonardo.da.cunha [Thu, 27 Oct 2022 22:46:22 +0000 (15:46 -0700)]
utils/json: Add json_object_new_uint64 for json-c < 0.14
json-c 0.14 added json_object_new_uint64 but older version are missing
this function. Instead defining two different json_object_object_add
version we can just define the fallback function first.
[dwagner: rewrote the commit message] Signed-off-by: Daniel Wagner <dwagner@suse.de>
Jeremy Kerr [Sun, 23 Oct 2022 03:13:00 +0000 (11:13 +0800)]
nvme-print: decode status types
With the new nvme_status_get_type/nvme_status_get_value() accessors in
libnvme, restructure nvme_show_status to allow type-specific deciding in
future.
Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>