Daniel Wagner [Thu, 26 Jan 2023 13:40:08 +0000 (14:40 +0100)]
fabrics: Fix already connected test
The lookup will also return controllers created from discovery.conf
and config.json. These might not yet connected. When the controller has
a device name we assume that we are connected.
Fixes: 07d6b911e081 ("fabrics: Do not attempt to reconnect to already connected ctrls") Signed-off-by: Daniel Wagner <dwagner@suse.de>
Daniel Wagner [Thu, 26 Jan 2023 13:36:56 +0000 (14:36 +0100)]
fabrics: Fix discovery controller filter function
disc_ctrl_config_match() should also test if the controller is actually
a discovery controller. Because of that ctrl_config_match() can't call
disc_ctrl_config_match() anymore.
Fixes: 07d6b911e081 ("fabrics: Do not attempt to reconnect to already connected ctrls") Signed-off-by: Daniel Wagner <dwagner@suse.de>
Daniel Wagner [Wed, 25 Jan 2023 08:16:53 +0000 (09:16 +0100)]
fabrics: Make PDC behavior configurable
The persistent discovery controller is a behavior change which might
break existing installation. Instead enabling it per default, introduce
a compile time and a global configuration option to define the default
settings.
Daniel Wagner [Mon, 23 Jan 2023 16:01:53 +0000 (17:01 +0100)]
build: The release workflow can't tag
The releaser action is not able to auto tag the tree (permission).
Anyway, we don't want to have a 'tip' or 'latest' tag just because the
build process expects this. So we have to find a different way to have
latest AppImage.
Keith Busch [Tue, 10 Jan 2023 20:43:17 +0000 (12:43 -0800)]
nvme: Add wait for device self test
Add a wait command line option to device-self-test which makes nvme-cli
staying in forground and reports progress. This make it possible to wait
for the end of the test.
Signed-off-by: Keith Busch <kbusch@kernel.org>
[dwagner: make termination condition handling the end of self test] Signed-off-by: Daniel Wagner <dwagner@suse.de>
Daniel Wagner [Fri, 20 Jan 2023 09:39:19 +0000 (10:39 +0100)]
gitignore: Ignore clang build artifacts
When using language server support from clang, the .cache directory is
added. Also for getting lsp working properly the compile_commands.json
file has to present (which is just a link to Meson generared json file).
Daniel Wagner [Thu, 19 Jan 2023 08:21:45 +0000 (09:21 +0100)]
fabrics: Handle DUPRETINFO and EPCSD when doing discovery
The TP8014 adds two new flags for providing information to the host
which discovery controller is returning the same information we already
know or if the discovery controller doesn't support explicit
persistency.
Daniel Wagner [Tue, 17 Jan 2023 08:32:19 +0000 (09:32 +0100)]
fabrics: Prefer unique disc ctrl over well known
Currently, the well known discovery controller is used per default even
though the target might support unique discovery controller as defined
in TP8013.
Change the default behavior to use the unique discovery controller
whenever the target supports it.
Daniel Wagner [Wed, 18 Jan 2023 17:20:09 +0000 (18:20 +0100)]
fabrics: Do not attempt to reconnect to already connected ctrls
Currently, connect-all and connect will blindly try to reconnect to
already connected controllers. Try to lookup the controller in the local
hierarchy. If found just ignore the attempt and fail.
Note, we have to distinguish between normal controllers and discovery
controller when comparing them. The main difference is that we have
ignore the discovery nqn and assume if we find a discovery controller
it's the correct one (persistent). This basically means the well known
discovery nqn matches any found controller.
Daniel Wagner [Wed, 18 Jan 2023 17:16:36 +0000 (18:16 +0100)]
nvme: Ingore LOG_NOTICE level
We don't use the LOG_NOTICE level at all. That means a single '-v' has
no impact. So just ingore it and we get some useful information starting
with LOG_INFO.
Daniel Wagner [Wed, 18 Jan 2023 09:36:45 +0000 (10:36 +0100)]
fabrics: Use endian helper when reading discovery log entries
We should use the correct CPU endian helper when reading the discovery
log. While at it, also sync the JSON output with the console output and
stringify the EFLAGS.
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.
Tokunori Ikegami [Wed, 28 Dec 2022 06:18:25 +0000 (15:18 +0900)]
nvme-print: Display smart log data units read and written SI value
This resolves for the issue #1745. Also change smart log uint128_t values as
group the output with thousands' grouping characters and add test-iunt128-si
unit tests.
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.