Tokunori Ikegami [Fri, 24 Mar 2023 17:37:59 +0000 (02:37 +0900)]
util: Cleanup argconfig parse function
1. Split to parse config type function
2. Change if else statement to switch case statement
3. Use calloc instead of malloc
4. Delete unused while 0 statement
5. Add argconfig error common function
Martin George [Wed, 22 Mar 2023 06:36:55 +0000 (12:06 +0530)]
nvme-print: sanitize supported-log-pages output
The current nvme supported-log-pages output is a little cryptic
as seen below:
Support Log Pages Details for nvme1n1:
LID 0x0 (Supported Log Pages), supports 0x3
LID 0x1 (Error Information), supports 0x3
...
So sanitize this output to make it more meaningful with better
formatting. This should apply to the verbose output as well.
With these changes, the sanitized normal output should show up
as follows:
Support Log Pages Details for nvme1n1:
LID 0x0 - Supported Log Pages
LID 0x1 - Error Information
...
And the sanitized verbose output would show up as:
Support Log Pages Details for nvme1n1:
LID 0x0 - Supported Log Pages
LSUPP is supported
IOS is supported
LID 0x1 - Error Information
LSUPP is supported
IOS is supported
...
Martin George [Tue, 21 Mar 2023 08:49:11 +0000 (14:19 +0530)]
nvme: fix block count and data size logic
The required block count and data size is not automatically set
for a namespace device in submit_io(). Also it is the user specified
block count and not the actual required block count that is passed
to the ioctl data structure, often leading to nvme passthrough io
errors. For e.g. an nvme read on a 512b block size namespace device
with data size set to 4K ends up with the below error:
nvme read /dev/nvme0n1 -s 0 -z 4096
NVMe status: Data SGL Length Invalid: The length of a Data SGL is too
short or too long and the controller does not support SGL transfers
longer than the amount of data to be transferred(0x400f)
This read is successful only when the appropriate block count is
passed from the command line:
So fix this by deriving the required block count and data size based
on the logical block size and passing them appropriately to the
respective ioctl data structure. And while we are at it, remove a
couple of superfluous braces in this part of the code.
Martin George [Sat, 11 Mar 2023 05:49:37 +0000 (11:19 +0530)]
nvme-doc: update man page for supported-log-pages
There is no human-readable option implemented for nvme
supported-log-pages. Instead there is only a verbose option.
So update the respective man page to reflect the same.
Martin Belanger [Wed, 15 Mar 2023 19:49:43 +0000 (15:49 -0400)]
build: Print option summary
At the end of the meson setup command, display the options so that
we can quickly determine that we're configured the project properly
Signed-off-by: Martin Belanger <martin.belanger@dell.com>
[dwagner: ported this from libnvme to nvme-cli] Signed-off-by: Daniel Wagner <dwagner@suse.de>
Steven Seungcheol Lee [Wed, 15 Mar 2023 05:40:30 +0000 (14:40 +0900)]
nvme: Fix parameter limit range
3 Bits - Max value 7
SEL : Bits [10:08] of Get Features Command Dword 10
4 Bits - Max value 15
OWPASS : Bits [07:04] of Sanitize – Command Dword 10
7 Bits - Max value 127
LSP : Bits [14:08] of Get Log Page Command Dword 10
UUID Index : Bits [06:00] of Get Log Page, Get Features, Set Features Command Dword 14
Signed-off-by: Steven Seungcheol Lee <sc108.lee@samsung.com>
Caleb Sander [Thu, 9 Mar 2023 16:29:06 +0000 (09:29 -0700)]
nvme-print: Fix printing of u32 values
Fields HMPRE, HMMIN, and NN in the Identify Controller data structure
are 32-bit unsigned values but are being printed as signed integers.
Print them using %u so large values are not displayed as negative ones.
Also make JSON uint objects use uint64 instead of int64 internally
so u32 values are stored accurately.
Daniel Wagner [Tue, 7 Mar 2023 09:24:01 +0000 (10:24 +0100)]
fabrics: Fix ordering for auto connect services
In order to be able to mount file systems via /etc/fstab we have to
make sure that the corresponding auto connect services have been
executed. Because the mounting of the local filesystem happens very
early in the boot we have to carefully sort these service file into the
boot process.
First, we have to disable the DefaultDependency as this will
automatically add dependency on sysinit.target which is too late (after
local mounts). Though without the default dependency we have to provide
a Before and After conditions.
The Before is simple as we have a local-fs-pre target. The After
is a bit tricky as there are no targets available.
Because the whole autoconnect machinery depends on udev events being
delivered we place the service after systemd-udevd has been started.
Steven Seungcheol Lee [Fri, 3 Mar 2023 07:44:55 +0000 (16:44 +0900)]
nvme.c: Check Firmware Update Granularity in fwdl
FWUG indicates the granularity and alignment requirement of the
firmware image being updated by the Firmware Image Download command
FWUG is reported in 4 KiB units
0h indicates that no information on granularity is provided
FFh indicates there is no restriction
so when this is 0 value, use 4 KiB split as a default
Do not override when xfer is given by user
-> Support for ignore fwug in (fwug>mdts) case
Reviewed-by: Keith Busch <keith.busch@gmail.com> Reported-by: Minsik Jeon <hmi.jeon@samsung.com> Signed-off-by: Steven Seungcheol Lee <sc108.lee@samsung.com>
丁剑 [Sun, 19 Feb 2023 07:43:07 +0000 (15:43 +0800)]
log: high latency timestamp issue
1. The old nvme-cli set-feature uses 32bit to represent timestamp, but the spec definition is 48bit.
2. memblaze made a slight correction to allow for overflow.
3. Now this correction is no longer needed.
Tokunori Ikegami [Fri, 24 Feb 2023 15:54:24 +0000 (00:54 +0900)]
nvme: Continue get feature on invalid NS error to get multiple feature ids
Some features returned invalid NS if NSID all 0xffffffff default specified.
Also print get feature ID for invalid NS error to get multiple feature ids.
* The unit name 'kelvin' is written in lowercase, unless it starts a sentence. However, its plural 'kelvins' is more appropriate because of the context.
* Added a space between the number and the unit (e.g. 30 °C or 303 K).
* Wherever '°C' and 'kelvin' appeared in the same context, the latter is replaced with 'K'.
Ref.: *The International System of Units*, 9th edition (2019, updated 2022), Bureau International des Poids et Mesures
Dedow, Karl [Thu, 16 Feb 2023 21:07:25 +0000 (13:07 -0800)]
plugins/ocp: Fix whitespace and style issues
As reported by a code linter results in OCP plugin
[dwagner:
- lot's of manual cleanup
- fixed non white space changes reported by checktool
- verified result with 'git diff --word-diff'
] Signed-off-by: Daniel Wagner <dwagner@suse.de>
Tokunori Ikegami [Fri, 17 Feb 2023 13:53:26 +0000 (22:53 +0900)]
util: Revert JSON output to plain numbers
Add explicit a localization stringify function for uint128_t types.
Also set serializer to generate a number instead of a string.
Fixes: 2a8bc94 ("nvme-print: Display smart log data units read and written SI value") Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
[dwagner: introduce an explicit l10 function] Signed-off-by: Daniel Wagner <dwagner@suse.de>
Daniel Wagner [Wed, 15 Feb 2023 15:56:28 +0000 (16:56 +0100)]
nvme: Refactor get telemetry log page helper
Refactor the helper to use explicit code paths instead of conditions to
steer the code flow. This is way simpler to read and the resulting code
size is only growing 88 bytes.
Daniel Wagner [Thu, 16 Feb 2023 08:08:23 +0000 (09:08 +0100)]
build: Update CI build targets
Update the CI build targets so we cover a bit more configuration space.
- Build release and debug builds
- Build with clang
- Cleanup the depdency list, e.g. Drop the libdbus dependency
- Do not fail on libnvme warnings, we need to catch them
in the libnvme project.
Stefan Hajnoczi [Wed, 15 Feb 2023 15:46:34 +0000 (10:46 -0500)]
nvme: fix /dev/spkd/ typo
SPDK NVMe character devices are located at /dev/spdk/ according to the
documentation (https://spdk.io/doc/nvme.html#nvme_cuse). Fix the typo.
Fixes: 6c9f792f99aa8782b32635c44e3a573bbb36c830 ("nvme: Print full device path") Cc: Daniel Wagner <dwagner@suse.de> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Martin Belanger [Fri, 10 Feb 2023 16:56:36 +0000 (11:56 -0500)]
fabrics: Ensure host-traddr/iface consistency for "connect-all"
When using "connect-all --device" without specifying the options
--host-traddr and --host-iface, the children connections may not
have the same host-traddr/host-iface as the connection to the
discovery controller (DC).
This is specific to the --device option where one reuses a
persistent connection to a discovery controller to update the
discovery log pages (DLP) and connect to new controllers listed in
the new DLP. If --device is used w/o also specifying --host-traddr
and --host-iface, then the new connections may not use the same
attributes that were used for the DC connection.
This patch checks if --host-traddr and --host-iface have been
provided, and if not, it will use the DC's --host-traddr and
--host-iface for the new connections made as a result of changes
to the DLP.
Signed-off-by: Martin Belanger <martin.belanger@dell.com>
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.