Haro Panosyan [Wed, 21 Aug 2024 23:38:03 +0000 (16:38 -0700)]
plugins/solidigm : Fixing vs-internal-log to generate identify per allocated namespace.
CNS 11h is for namespace data structures for allocated namespaces.
Earlier code was using attached namespaces. This fix is to generate
identify data structures per allocated namespace.
Carl Moran [Fri, 16 Aug 2024 00:49:46 +0000 (17:49 -0700)]
plugins/wdc: fix json output for vs-nand-stats
Running nvme wdc vs-nand-stats will change the values of the user data fields
depending on output format used. In regular stdout, the ordering is TLC min,
TLC Max, SLC Min, SLC Max. However in json, the values get reassigned, what
was SLC Min in stdout will become TLC >
Regular format (TLC Min, TLC Max, SLC Min, SLC Max)
[root@ /tmp/]# nvme wdc vs-nand-stats /dev/nvme0n1 | grep User\ Data
User Data Erase Counts - TLC Min 169
User Data Erase Counts - TLC Max 310
User Data Erase Counts - SLC Min 10719
User Data Erase Counts - SLC Max 11676
Json format (SLC Min, SLC Max, TLC Min, TLC Max)
[root@ /tmp/]# nvme wdc vs-nand-stats /dev/nvme0n1 -o json | grep User\ Data
"User Data Erase Counts - SLC Min" : 169,
"User Data Erase Counts - SLC Max" : 310,
"User Data Erase Counts - TLC Min" : 10719,
"User Data Erase Counts - TLC Max" : 11676,
The difference can be traced to how the array subscripts are being
used in the two output formats
With the patch, we rename the fields to be the same for both stdout & json.
Output comparison below
Regular format (TLC Min, TLC Max, SLC Min, SLC Max)
[root@ /tmp/]# ./nvme wdc vs-nand-stats /dev/nvme0n1 | grep User\ Data
User Data Erase Counts - TLC Min 169
User Data Erase Counts - TLC Max 310
User Data Erase Counts - SLC Min 10719
User Data Erase Counts - SLC Max 11676
Json format (TLC Min, TLC Max, SLC Min, SLC Max)
[root@ /tmp/]# ./nvme wdc vs-nand-stats /dev/nvme0n1 -o json | grep User\ Data
"User Data Erase Counts - TLC Min":169,
"User Data Erase Counts - TLC Max":310,
"User Data Erase Counts - SLC Min":10719,
"User Data Erase Counts - SLC Max":11676,
Martin George [Sun, 18 Aug 2024 16:54:18 +0000 (22:24 +0530)]
nvme-print: update subsys verbose outputs
The current list-subsys & show-topology simple outputs are a
little crowded. Also the respective verbose options to both
these commands are a no-op at the moment. So move the iopolicy
and subsystype details to the respective verbose outputs instead
so that the simple outputs are restricted to displaying key subsys
details like subsys name & NQN alone.
Nitin Sao [Tue, 6 Aug 2024 05:45:11 +0000 (11:15 +0530)]
nvme-print-stdout: Added print for new field CSER (TP4167)
As per TP4167, added print for a new field CSER (Command Submission
and Execution Relaxations) [15:14] added in Commands Supported and
Effects Data Structure.
Xiaoyuan Zhang [Tue, 6 Aug 2024 07:37:09 +0000 (15:37 +0800)]
plugins: Add a new DapuStor plugin and the smart-log-add command
Add the DapuStor plugin to support the retrieval and
display of the Vendor Specific SMART logs:
Additional SMART log page (0xCA)
Extended Additional SMART log page (0xCB)
Daniel Wagner [Fri, 2 Aug 2024 11:08:13 +0000 (13:08 +0200)]
build: add install step to doc CI build
We had some fallouts which were happened at the install step when the
documentation was build. Let's add this step, so we catch those errors
in future.
Milan Broz [Thu, 1 Aug 2024 08:41:50 +0000 (10:41 +0200)]
sed: Fix parsing of Discovery0 features
TCG SED features have variable sizes, so the code needs to use
stored length to move the offset for the next feature.
Otherwise, it checks the code at the wrong offset.
Daniel Wagner [Thu, 1 Aug 2024 11:23:28 +0000 (13:23 +0200)]
nvme: extend help message when mmap regs fails
Newer kernels enable the lockdown feature when secure boot is enabled.
This feature also prevents the register mapping into userspace. Thus it
is not enough to have CONFIG_IO_STRICT_DEVMEM disabled. Extend the
message with the hint also to disable secure boot.
While at it, also lower the reporting level to INFO, so that one single
'-v' is enough to get this information.
Daniel Wagner [Thu, 11 Jul 2024 16:53:36 +0000 (18:53 +0200)]
fabrics: drop --disable-sqflow alias -d
The alias for --disable-sqflow -d clashes with --device for the
discover command. Since the --disable-sqflow is not so commonly used,
let's free -d for other uses.
Fixes: 18de3a6d61a7 ("Convert to libnvme") Signed-off-by: Daniel Wagner <dwagner@suse.de>
Daniel Wagner [Thu, 11 Jul 2024 16:42:23 +0000 (18:42 +0200)]
fabrics: check if json config is existing
nvme_read_config will return success even if the file doesn't exist.
This leads to the situation that we always execute
discover_from_json_config_file even though there is no json config
file.
One side effect of this is that when executing 'nvme discover -d
/dev/nvmeXXX' we will always do a discover for the first controller we
find.
Daniel Wagner [Fri, 26 Jul 2024 12:20:09 +0000 (14:20 +0200)]
fabrics: do not report error when no modules are loaded when disconnecting
Do not report an error when the libnvme reports that the subsystem is
not available when the user tries to disconnect. This allows the user to
call disconnect without filtering this special case. The result is the
same, after this call the host is not connected anymore.
Martin George [Wed, 17 Jul 2024 08:17:51 +0000 (13:47 +0530)]
fabrics: print an error for ENOENT too
Many nvme commands such as discover, connect, connect-all, etc.
simply return to the prompt without printing any useful error
message when the respective nvme driver modules are not loaded in
the kernel. This is because nothing gets printed when
nvme_scan_topology() returns an ENOENT due to missing nvme system
files stemming from not loading the appropriate nvme modules.
Fix the same.
In the vtview_log structs, time_t should be used for any time_stamp
values instead of long. This ensures correct builds on 32-bit
architectures even with 64-bit time_t (e.g. armhf on Ubuntu).
Signed-off-by: Heitor Alves de Siqueira <halves@canonical.com>
Francis Pravin [Thu, 18 Jul 2024 10:05:44 +0000 (15:35 +0530)]
nvme: use proper mask to get correct lbafu value
The NVME_NS_FLBAS_HIGHER/LOWER_MASK is used to get the format index
value from Formatted LBA Size (FLBAS) field of Identify Namespace
Data Structure. But, We are not getting the proper lbafu value while
using the same macro on user passed format index value.
So, use the proper mask to get the correct lbafu value.
Signed-off-by: Francis Pravin <francis.p@samsung.com> Reviewed-by: Steven Seungcheol Lee <sc108.lee@samsung.com>
nvme-print: Added print for two new fields for HMB feature
As per TP4104, added print for two new fields for HMB feature
HMNARE (Host Memory Non-operational Access Restriction Enable) and
HMNAR (Host Memory Non-operational Access Restricted) with 1 bit
each. Bit 1 is not used for Get Feature command and will be 0.
And added print for HMBR field in stdout_id_ctrl_ctratt.
Signed-off-by: Nitin Sao <nitin.sao@samsung.com> Reviewed-by: Steven Seungcheol Lee <sc108.lee@samsung.com> Reviewed-by: Mohit Kapoor <mohit.kap@samsung.com>
util: remove unnecessary NULL check in cleanup_nvme_root()
cleanup_nvme_root() is checking whether the passed pointer is non-NULL,
but since the pointer is to a local variable, this will always be true.
Therefore, remove the check and always call nvme_free_tree().
nvme: use argconfig_parse_comma_sep_array_u16() in attach-ns
nvme_attach_ns() is using argconfig_parse_comma_sep_array()
to parse a list of ints and then copying them into a list of u16s.
Use argconfig_parse_comma_sep_array_u16() instead to save on memory
and avoid needing to copy the values to another list.
This also checks that the values fit in u16.
Also use NVME_ID_CTRL_LIST_MAX instead of hard-coding the max list size.
util: remove redundant loop condition in argconfig_parse()
Since options_count is computed as the number of options
until the first one with a NULL option field,
s->option and option_index < options_count are equivalent.
util: reduce allocation sizes in argconfig_parse()
long_opts stores up to 1 element per option, plus a help element,
and a zerored final element. So it can be allocated with length
options_count + 2 instead of options_count + 3.
short_opts stores up to 3 characters per option, plus 2 help characters,
and a NUL terminator. So it can be allocated with length
options_count * 3 + 3 instead of options_count * 3 + 5.
Also use the two arguments to calloc() instead of multiplying the sizes.
util: consolidate call paths to argconfig_parse_type()
argconfig_parse_val() already falls back on argconfig_parse_type()
if no option values match.
So always call argconfig_parse_val() from argconfig_parse()
instead of checking whether any option values are defined.
Assuming constant-length value strings, argconfig_parse_val()'s runtime
is currently quadratic in the number of option values.
For each option value, it computes a minimum prefix length
that distinguishes that option from all others.
It then checks whether the input matches up to that prefix length.
Instead, compare the input directly against each option value.
If exactly one matches, select that option value.
Otherwise, fallback on the default value parser.
util: remove empty default case in argconfig functions
Both argconfig_parse_type() and argconfig_set_opt_val()
switch on the argument value type and have an empty default case.
This is unnecessary and masks errors from unhandled enum values.
So drop the default cases.
util: use cleanup to avoid goto in argconfig_parse()
Use _cleanup_free_ in place of explicit calls to free()
in argconfig_parse(). This simplifies the code
and allows using an early return in place of a goto.
test: add test cases for argconfig comma-separated array parsing
There are no unit tests currently covering
argconfig's comma-separated integer array parsing.
Add test cases to test-argconfig-parse.c
that use argconfig_parse_comma_sep_array_u32(),
verifying its functionality and edge cases.
Daniel Wagner [Fri, 12 Jul 2024 12:51:14 +0000 (14:51 +0200)]
build: fetch complete git history
In order to build a image with which contains the correct git version
SHA we need to fetch the complete git tree. Otherwise 'git describe'
fails and we use the project version string as fallback.
Daniel Wagner [Thu, 11 Jul 2024 08:49:23 +0000 (10:49 +0200)]
fabrics: first read config before topology scanning
The topology scanning will create nodes in the internal libnvme tree. As
we rely on the order of the nodes in the tree, we need to read the
config before we scan. This makes sure the first node is the one we have
defined in the config.json. This is important because the first node
provides default hosnqn configuration in absents of /etc/nvme/hostnqn.
Daniel Wagner [Thu, 11 Jul 2024 11:40:42 +0000 (13:40 +0200)]
fabrics: extend already connected message
The 'already connected' message only contains the traddr as info. Add
the missing information so that it's possible to figure out what
combination is already in use.