Daniel Wagner [Wed, 13 Apr 2022 19:31:02 +0000 (21:31 +0200)]
nvme: output also libnvme version
Print the used libnvme version which the nvme-cli fronent is using.
In order to be backward compatible don't expect that the newly
introduce function in libnvme to be 1available.
This is done by providing a weak symbol which is overwritten when
statically build or when libnvme is is used as shared libray the
dlsym() call checks if the function is available.
Daniel Wagner [Tue, 12 Apr 2022 11:52:59 +0000 (13:52 +0200)]
nvme: Add git ref to the binary
In order to be able to figure out which binary is in use (for example
in debugging situation) it's really helpful to have the 'git describe'
ref added to the binary.
$ .build/nvme --version
nvme version 2.0 (git 2.0-2-gcbd3f8d+)
$ .build/nvme wdc --version
nvme wdc version 1.16.4 (git 2.0-2-gcbd3f8d+)
Martin George [Wed, 13 Apr 2022 15:16:35 +0000 (20:46 +0530)]
fabrics: skip connect if the transport types don't match
Discovery log page data may include records belonging to different
transport types. If during a nvme connect-all, a connect is attempted
on a record that doesn't match the transport type passed here, it
would end up in a connect failure for that record. For e.g. one would
see the following error if a connect is attempted on a tcp record,
but the transport type passed here is 'fc' and its associated params:
Martin George [Mon, 11 Apr 2022 04:06:20 +0000 (09:36 +0530)]
fabrics: avoid segfault when nvme discover fails with the -p option
If the initial discovery controller creation fails while passing
the -p option to the nvme discover (or connect-all) command, it
could lead to the below segfault:
nvme discover -t rdma -w 192.168.1.114 -a 192.168.1.113 -p
Failed to write to /dev/nvme-fabrics: Connection reset by peer
Segmentation fault (core dumped)
Avoid this segfault by checking if the controller created in
__create_discover_ctrl() is valid before proceeding.
Martin George [Mon, 11 Apr 2022 12:03:17 +0000 (17:33 +0530)]
fabrics: error message for nvme discover/connect-all with no params
Currently when nvme discover or connect-all is called without
passing any params, it simply blanks out without any meaningful
error. So add an appropriate error message for such scenarios,
similar to what's done in the erstwhile nvme-cli-monolithic branch.
Daniel Wagner [Fri, 8 Apr 2022 13:23:41 +0000 (15:23 +0200)]
fabrics: Refactor argument passing for transport configuration
We passing all the attributes of the transport configuration
individually. Group them together to reduce the number of arguments
one has to pass into the functions.
Daniel Wagner [Fri, 8 Apr 2022 12:08:47 +0000 (14:08 +0200)]
fabrics: Set KATO for discovery controller when connecting
In case we are connecting to the discovered controllers we should also
set the KATO value for persistent discocovery controllers correctly.
Unfortunatly, the compiler seems to get confused by only conditionally
setting tmo and warns about uninitialized variable. Hence we always
store and restore keep_alive_tmo.
Daniel Wagner [Fri, 8 Apr 2022 11:58:01 +0000 (13:58 +0200)]
fabrics: Do no modify default config for discovery controller
When a discovery controller is setup we are currently modifying the
default config. As this configuration might also be used for normal
I/O controllers don't modify it permanently.
Hannes Reinecke [Wed, 6 Apr 2022 13:24:20 +0000 (15:24 +0200)]
nvme: update to nvme_scan_filter_t modifications
The scan filter in libnvme has been updated, so update the code
to make use of it.
Signed-off-by: Hannes Reinecke <hare@suse.de>
[dwagner: list also the paths for non multipath namespaces] Signed-off-by: Daniel Wagner <dwagner@suse.de>
Arthur Shau [Thu, 3 Mar 2022 22:08:15 +0000 (14:08 -0800)]
Add new OCP plugin
New OCP plugin that consolidates some of the functionality from the other vendor plugins. For now, implements getting of C0 and C3 log pages.
Daniel Wagner [Mon, 4 Apr 2022 15:46:11 +0000 (17:46 +0200)]
fabrics: Set default trsvcid ports for TCP and RDMA
libnvme doesn't know at controller creation if the new controller is
going to be discovery controller. But nvme-cli knows it, so just set
defaults on the caller level.
Daniel Wagner [Mon, 4 Apr 2022 10:48:55 +0000 (12:48 +0200)]
fabrics: Do not free static string
38f5a54a7306 ("fabrics: Support connect even when no /etc/nvme/hostnqn
file exists") introduce a regression. arg_parser() might assign a
static string to hostnqn and/or hostid. Can't free this.
Daniel Wagner [Mon, 4 Apr 2022 09:56:15 +0000 (11:56 +0200)]
fabrics: Support connect even when no /etc/nvme/hostnqn file exists
The connect call will fail if there is no /etc/nvme/hostnqn file
available. The 1.x version did have a fallback mechanisme in place
when the config file was missing.
Let's add this feature back by calling nvmf_hostnqn_generate() when
there is no /etc/nvme/hostnqn file.
Jeff Lien [Fri, 25 Mar 2022 15:41:38 +0000 (10:41 -0500)]
plugin: Add new WDC plugin commands for OCP 2.0
Add command to display error recovery (id 0xC1) log page
Add command to display device capabilities (id 0xC4) log page
Add command to display unsupported requirements (id 0xC5) log page
Update WDC plugin version to 1.16.4
Martin Belanger [Fri, 1 Apr 2022 11:16:47 +0000 (07:16 -0400)]
fabrics: Add DIM command
TP8010 defines the DIM command (Discovery Information Management)
as a way to Register-with or Deregister-from a Discovery
Controller. This is used for NVMe-over-Fabrics when connecting to
Central Discovery Controllers (CDC).
Signed-off-by: Martin Belanger <martin.belanger@dell.com>
Daniel Wagner [Thu, 24 Mar 2022 18:27:01 +0000 (19:27 +0100)]
fabrics: Introduce force flag to overwrite persistence logic
The persistence flag will be overwritten by the built in logic. Allow
the user to overwrite this by providing a force command line option.
While at it make the 'discover_from_config_file' path behave as the
'nvmf_discover' path. The idea here is that whenever a matching
persistent discovery controller is present just use this one. Only
create a new discovery controller when none matching found or
we are asked to do so via --force.
Daniel Wagner [Tue, 29 Mar 2022 10:02:43 +0000 (12:02 +0200)]
argconfig: Rename CFG_NONE to CFG_FLAG
CFG_NONE is used to for OPT_FLAG. All other OPT_ macros have the
matching CFG_ enum. Let's rename CFG_NONE to CFG_FLAG to match and
make it consistent.
Daniel Wagner [Mon, 28 Mar 2022 18:24:21 +0000 (20:24 +0200)]
argconfig: Do not use default value loading by getopt_long_only
getopt_long_only() is able to load the default values directly. Though
the type has to be 'int'. If the target type of argument not 'int'
getopt_long_only will overwrite adjacent memory location.
Reduce the complexity by not using this feature.
Instead use the type bool because libnvme uses bool in 'struct
nvme_fabrics_config'.
Hannes Reinecke [Tue, 29 Mar 2022 08:57:04 +0000 (10:57 +0200)]
nvme: use filter for 'list-subsys <devname>'
When a device name is specified for 'nvme list-subsys' we should
be printing out only those parts of the tree which relate to the
specified device name, not the entire tree.