Daniel Wagner [Tue, 21 Dec 2021 14:56:14 +0000 (15:56 +0100)]
fabrics: Declare loop index at the beginning of the block
The gcc in Centos 6.10 complains with
nvme/fabrics.c:909: error: ‘for’ loop initial declarations are only allowed in C99 mode
nvme/fabrics.c:909: note: use option -std=c99 or -std=gnu99 to compileyour code
Let's declare the index at the beginning of the basic block.
Daniel Wagner [Mon, 13 Dec 2021 17:37:21 +0000 (02:37 +0900)]
types: Add Controller Metadata and Namespace Metadata
Port and extent the libnvme part from the commit "Add NVMe MI
Features: Controller Metadata (0x7E) and Namespace Metadata (0x7F)."
from the nvme-cli monolithic branch.
While at it add the missing definitions and add some documentation.
This is based on Tokunori Ikegami first port attempt.
Tomas Bzatek [Wed, 1 Dec 2021 15:41:53 +0000 (16:41 +0100)]
types: Fabrics doc strings updates
Includes a typo correction, prefix changes, transition away from anonymous
enums and added some more enum members according to the standard.
All subtle API breaks.
Martin Belanger [Tue, 30 Nov 2021 19:50:29 +0000 (14:50 -0500)]
Fix memory leak.
The API PyDict_SetItemString() does not steal references
when adding objects to a dictionary. Therefore, the caller
must decrement the reference count after adding objects to
the dictionary if those objects are no longer needed.
Signed-off-by: Martin Belanger <martin.belanger@dell.com>
Sagi Grimberg [Sun, 28 Nov 2021 13:03:03 +0000 (15:03 +0200)]
fabrics: fix endless loop in connect-all for NVME_NQN_CURR
For a discovery log page entry that indicates the discovery controller
that returned it (i.e. itself), we need to set the controller as
discovered (because we got the discovery log page by connecting to it).
Without this connect-all goes in an endless loop keep connecting and
retrieving the log page from the same discovery subsystem port.
Daniel Wagner [Fri, 19 Nov 2021 10:25:37 +0000 (11:25 +0100)]
build: Do not use the configurator for meson
meson does the feature detection itself and we don't have to rely on
the configurator. So don't use it.
To avoid touching the ccan files, we have to rethink our config.h to
libnvme-config.h rename change. Since the ccan files include
'config.h' we have to use the second option to avoid including it into
external include paths. This is moving the config.h file into a
private folder and drop the include path '.'.
Hannes Reinecke [Thu, 18 Nov 2021 16:35:53 +0000 (17:35 +0100)]
Sanitize zns command arguments
With the recent up the calling convention has been sanitzed to always
have the 'timeout' argument as second-to-last, and the 'result' as the
laster argument.
Modify the zns commands accordingly.
Hannes Reinecke [Wed, 11 Aug 2021 06:04:38 +0000 (08:04 +0200)]
Implement 'dhchap_key' host and controller attributes
Implement a 'dhchap_key' attribute for the nvme_host structure to
support the 'dhchap_secret' connection argument, and a
'dhchap_key' attribute for the nvme_controller structure to support
the 'dhchap_ctrl_secret' connection argument.
Hannes Reinecke [Thu, 18 Nov 2021 09:29:10 +0000 (10:29 +0100)]
Add 'result' argument to ioctl wrapper functions
The ioctl wrapper function are pretty inconsistent as to whether
the NVME cqe result is returned or not.
We'd better add it to every function to have a consistent interface.
Daniel Wagner [Thu, 18 Nov 2021 09:04:13 +0000 (10:04 +0100)]
build: Rename config.h to libnvme-config.h
The meson documentation recommends not to put a config.h file in the
external search path. This will clash with any project consuming this
library. There are two ways to workaround, either renaming the config
header file or put it under a different path which isn't added into
the default include path.
Minwoo Im [Mon, 15 Nov 2021 14:46:00 +0000 (23:46 +0900)]
tree: add namespace chrdev name to nvme_ns
Namespace device node is initialized into two different nodes: block
device and character device which is a generic device used when block
device is not available due to initialization failure in the kernel.
This can be directly retrieved from the `struct nvme_ns` to print out
the generic node in somewhere like `nvme list` command in nvme-cli.
Signed-off-by: Minwoo Im <minwoo.im.dev@gmail.com>
Hannes Reinecke [Wed, 17 Nov 2021 13:01:02 +0000 (14:01 +0100)]
fabrics: add nvmf_default_config()
'struct nvme_fabrics_config' has some default values, and the output
functions key off these values to filter the values being printed.
So to avoid applications having to know these default values this
patch introduces a function nvmf_default_config() to ensure that
every application is using the same defaults.
Daniel Wagner [Wed, 17 Nov 2021 12:38:30 +0000 (13:38 +0100)]
build: Lower json-c dependencies
libnvme has no hard requirement on json-c 0.14. It was updated to
match to min version for nvme-cli. But nvme-cli has added a
workaround, to avoid requiring a newer version of json-c. Let's drop
the requirement here too.
Hannes Reinecke [Tue, 16 Nov 2021 08:59:42 +0000 (09:59 +0100)]
fabrics: set 'discovery' argument for unique discovery controllers
Discovery controllers providing a unique NQN cannot be distinguished
by the NQN from 'normal' I/O controllers, so we need to add the keyword
'discovery' when creating the connection to indicate that this is a
disocvery connection.
Hannes Reinecke [Mon, 15 Nov 2021 14:27:27 +0000 (15:27 +0100)]
Distinguish between 'nvm' and 'discovery' subsystems
Add a 'subsystype' value to the subsystem to determine if a given
subsystem is a 'discovery' or a 'nvm' subsystem.
And also add a flags 'discovery_ctrl' to specify if a given controller
is a discovery controller; this allows connection to discovery controllers
with unique subsystem NQNs, as these cannot distinguished by the NQN
anymore.
Daniel Wagner [Thu, 11 Nov 2021 10:57:16 +0000 (11:57 +0100)]
build: Adopt libsystemd versioning scheme
systemd increases the micro version for every release which is
compatible to what libtool expects. This means we just have to add the
patch level to the version string which happens to be always 0.
Steven Seungcheol Lee [Thu, 4 Nov 2021 14:19:38 +0000 (15:19 +0100)]
types: Add Identify for CNS 08h NVMe spec 2.0a based
I/O Command Set Independent Identify Namespace data structure (CNS
08h) Most of data comes from existing data of id-ns which is common
from All I/O command set
Signed-off-by: Steven Seungcheol Lee <sc108.lee@samsung.com>
[dwagner: ported from nvme-cli-monolithic] Signed-off-by: Daniel Wagner <dwagner@suse.de>