Sagi Grimberg [Wed, 15 Feb 2023 09:00:20 +0000 (11:00 +0200)]
nvme-print: print the nvme generic name in json output as well
For both simple and detailed outputs present the nvme generic
chardev name/path similar to how the ns name/path is presented.
Fixes: f0895ceb145e ("nvme-print: print generic device in list command") Signed-off-by: Sagi Grimberg <sagi@grimberg.me> Link: https://lore.kernel.org/r/20230215090020.620994-1-sagi@grimberg.me
[dwagner: added additional "Generic" output to json_details_list in the
"Namespace" section] Signed-off-by: Daniel Wagner <dwagner@suse.de>
Daniel Wagner [Thu, 9 Feb 2023 10:04:07 +0000 (11:04 +0100)]
util: Numbers without any suffix are also valid
suffix_binary_parse() is used to parse most of the numeric command
lines. As it turns out the main use case to provide just numbers without
any suffix. Fix the regression recently introduced when we made the
parser also to check two characters suffixes.
Fixes: 1e5abd545622 ("util: Update suffix_binary_parse API") Reported-by: Steven Seungcheol Lee <sc108.lee@samsung.com> Signed-off-by: Daniel Wagner <dwagner@suse.de>
Daniel Wagner [Wed, 1 Feb 2023 15:16:00 +0000 (00:16 +0900)]
util: Reimplement suffix_si_parse
suffix_si_parse() has an very awkward interface with using errno and
suffixed as return value. Let's just use the return code as status
value and use an argument for returning the value and avoid setting the
errno.
Furthermoe, this function should not know anything about LBAs, it just
supposed to parse a string with a suffix. In order to support the
previous use case we also return the endprt which allows to implement
the nsze-si parse use case and the caller side (see documentation on
create-ns).
Next problem is that suffix_is_parse uses double for calculation which
tend to get inaccurate, e.g. 6.14T results in 61399999997. Instead let's
do do all in pure integer arithmetic.
Also handle the decimal point according the locale settings.
Reviewed-by: Tokunori Ikegami <ikegami.t@gmail.com> Signed-off-by: Daniel Wagner <dwagner@suse.de>
Daniel Wagner [Mon, 6 Feb 2023 13:36:11 +0000 (14:36 +0100)]
build: Use prefixdir directly on sysconfdir
The sysconfdir is an explicit path '/etc' and the muon implementation of
join_paths is dropping the prefixdir, thus we need to string concanate
the syscondfir path instead of using the join_paths function.
Daniel Wagner [Mon, 6 Feb 2023 10:22:49 +0000 (11:22 +0100)]
util: Add crc32 implementation
a05d4213f0f9 ("Add 'gen-dhchap-key' command") introduced the zlib
dependency in order to use the crc32 function. This simple function
alone is a not worth the additional dependency, so let's ship our own
crc32 function.
The implementation is from teh elfutils project which is licensed under
LGPL 3 or later of GPL 2 or later. For this project we choose the GPL 2
or later license.
Daniel Wagner [Fri, 3 Feb 2023 10:16:11 +0000 (11:16 +0100)]
nvme: Support effects-log for fabrics ctrl
nvme-cli v1.16 supported effects-log for fabric devices only, nvme-cli
2.x supported only memory based transports (aka PCI). Obviously, we
should support effects-log independent of the transport type.
Do this by first trying to map the PCI registers and read the CAP
property if this fails fall back using the get-properties approach.
Caleb Sander [Thu, 26 Jan 2023 17:53:07 +0000 (10:53 -0700)]
json_discovery_log: avoid buffer overrun
nvme_strip_spaces() has an off-by-one error and starts stripping spaces
at the byte AFTER the end of the buffer. Use space_strip_len() instead,
which doesn't have this bug and is already used in print_discovery_log().
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>
Klaus Jensen [Thu, 26 Jan 2023 08:38:40 +0000 (09:38 +0100)]
nvme-print: prettify the fdp event printing
The default human readable printing of FDP events does not have to print
the event flags since they are only used to indicate the validity of
some of the fields.
Remove the flags from printing and use it to conditionally print valid
fields.
Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
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.