]> www.infradead.org Git - users/sagi/libnvme.git/log
users/sagi/libnvme.git
3 years agoMerge pull request #136 from martin-belanger/memleak-swig-module
Hannes Reinecke [Wed, 1 Dec 2021 07:01:46 +0000 (08:01 +0100)]
Merge pull request #136 from martin-belanger/memleak-swig-module

Fix memory leak in SWIG module

3 years agoFix memory leak.
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>
3 years agoMerge pull request #133 from sc108-lee/update-id-ctrl
Hannes Reinecke [Mon, 29 Nov 2021 07:25:47 +0000 (08:25 +0100)]
Merge pull request #133 from sc108-lee/update-id-ctrl

recover monolithic commit 782086cc4fd590f1df171c927ebf9a2debc0a052

3 years agoMerge pull request #134 from hreinecke/discovery-fix
Hannes Reinecke [Mon, 29 Nov 2021 06:47:40 +0000 (07:47 +0100)]
Merge pull request #134 from hreinecke/discovery-fix

fabrics: fix endless loop in connect-all for NVME_NQN_CURR

3 years agofabrics: fix endless loop in connect-all for NVME_NQN_CURR
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.

Fixes: 06a8f001d314 ("tree,fabrics: detect discovery loops")
Signed-off-by: Sagi Grimberg <sagi@grimberg.me>
3 years agodoc: Add ocfs explaination
Steven Seungcheol Lee [Wed, 24 Nov 2021 09:51:16 +0000 (18:51 +0900)]
doc: Add ocfs explaination

Signed-off-by: Steven Seungcheol Lee <sc108.lee@samsung.com>
3 years agonvme: add optional copy format support id ctrl field
Gollu Appalanaidu [Fri, 28 May 2021 05:10:40 +0000 (10:40 +0530)]
nvme: add optional copy format support id ctrl field

Add the OCFS field in Identify Controller Structure, as per the
Ratified TP 4065b (Simple Copy Command).

Signed-off-by: Gollu Appalanaidu <anaidu.gollu@samsung.com>
3 years agoMerge pull request #132 from hreinecke/loop-fix
Hannes Reinecke [Mon, 22 Nov 2021 16:42:30 +0000 (17:42 +0100)]
Merge pull request #132 from hreinecke/loop-fix

tree: fixup loop address handling

3 years agotree: fixup loop address handling
Hannes Reinecke [Mon, 22 Nov 2021 16:35:36 +0000 (17:35 +0100)]
tree: fixup loop address handling

'loop' controllers have an empty 'address' sysfs attribute, so we
need to check for loop to avoid failures due to an invalid controller
address.

Signed-off-by: Hannes Reinecke <hare@suse.de>
3 years agoMerge pull request #126 from igaw/drop-configurator
Daniel Wagner [Fri, 19 Nov 2021 11:19:28 +0000 (12:19 +0100)]
Merge pull request #126 from igaw/drop-configurator

build: Do not use the configurator for meson

3 years agobuild: Do not use the configurator for meson
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 '.'.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
3 years agoMerge pull request #122 from hreinecke/zns-args
Hannes Reinecke [Thu, 18 Nov 2021 16:51:43 +0000 (17:51 +0100)]
Merge pull request #122 from hreinecke/zns-args

Sanitize zns command arguments

3 years agoMerge pull request #121 from hreinecke/json-fix
Hannes Reinecke [Thu, 18 Nov 2021 16:51:24 +0000 (17:51 +0100)]
Merge pull request #121 from hreinecke/json-fix

Add authentication keys to JSON schema

3 years agoSanitize zns command arguments
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.

Signed-off-by: Hannes Reinecke <hare@suse.de>
3 years agoAdd authentication keys to JSON schema
Hannes Reinecke [Thu, 18 Nov 2021 16:01:20 +0000 (17:01 +0100)]
Add authentication keys to JSON schema

Add the authentication key definitions to the JSON schema.

Signed-off-by: Hannes Reinecke <hare@suse.de>
3 years agoMerge pull request #100 from hreinecke/auth.v5
Hannes Reinecke [Thu, 18 Nov 2021 13:32:12 +0000 (14:32 +0100)]
Merge pull request #100 from hreinecke/auth.v5

Implement 'dhchap_key' host and controller attributes

3 years agoImplement 'dhchap_key' host and controller attributes
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.

Signed-off-by: Hannes Reinecke <hare@suse.de>
3 years agoMerge pull request #120 from hreinecke/spdx
Hannes Reinecke [Thu, 18 Nov 2021 13:23:45 +0000 (14:23 +0100)]
Merge pull request #120 from hreinecke/spdx

log: fixup SPDX license

3 years agolog: fixup SPDX license
Hannes Reinecke [Thu, 18 Nov 2021 13:22:04 +0000 (14:22 +0100)]
log: fixup SPDX license

3 years agoMerge pull request #119 from minwooim/for-fix-chrdev-to-generic
Daniel Wagner [Thu, 18 Nov 2021 13:13:03 +0000 (14:13 +0100)]
Merge pull request #119 from minwooim/for-fix-chrdev-to-generic

tree: rename namespace function name chrdev to generic

3 years agotree: rename namespace function name chrdev to generic
Minwoo Im [Thu, 18 Nov 2021 13:09:05 +0000 (22:09 +0900)]
tree: rename namespace function name chrdev to generic

The attribute in `struct nvme_ns` is `generic_name`, not chrdev.  So
rename the function name of this attribute.

Signed-off-by: Minwoo Im <minwoo.im.dev@gmail.com>
3 years agoMerge pull request #118 from hreinecke/timeout
Hannes Reinecke [Thu, 18 Nov 2021 10:59:42 +0000 (11:59 +0100)]
Merge pull request #118 from hreinecke/timeout

RFC: Sanitize ioctl command wrappers

3 years agoMerge pull request #99 from wxiong38/pel_coredump
Hannes Reinecke [Thu, 18 Nov 2021 09:52:51 +0000 (10:52 +0100)]
Merge pull request #99 from wxiong38/pel_coredump

libnvme: core dump when running nvme persistent-event-log

3 years agoMerge pull request #117 from igaw/update-json-c-wrap
Daniel Wagner [Thu, 18 Nov 2021 09:29:44 +0000 (10:29 +0100)]
Merge pull request #117 from igaw/update-json-c-wrap

build: Set include dirs when buidling configurator

3 years agoAdd 'result' argument to ioctl wrapper functions
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.

Signed-off-by: Hannes Reinecke <hare@suse.de>
3 years agobuild: Set include dirs when buidling configurator
Daniel Wagner [Thu, 18 Nov 2021 09:23:04 +0000 (10:23 +0100)]
build: Set include dirs when buidling configurator

The default include paths are not set when building the configurator,
hence the build fails when libnvme is consumed by an project as wrap.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
3 years agoMerge pull request #116 from igaw/update-json-c-wrap
Daniel Wagner [Thu, 18 Nov 2021 09:12:26 +0000 (10:12 +0100)]
Merge pull request #116 from igaw/update-json-c-wrap

Update json c wrap

3 years agobuild: Rename config.h to libnvme-config.h
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.

Renaming is way simpler, let's do this.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
3 years agobuild: Update json-c.wrap
Daniel Wagner [Thu, 18 Nov 2021 08:53:54 +0000 (09:53 +0100)]
build: Update json-c.wrap

The json-c wrap was updated to fix a deprecation warnings issued by
meson.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
3 years agoMerge pull request #103 from minwooim/for-chrdev-name
Daniel Wagner [Thu, 18 Nov 2021 08:34:27 +0000 (09:34 +0100)]
Merge pull request #103 from minwooim/for-chrdev-name

tree: add namespace chrdev name to nvme_ns

3 years agoAdd 'timeout' parameter to ioctl function
Hannes Reinecke [Thu, 18 Nov 2021 08:30:57 +0000 (09:30 +0100)]
Add 'timeout' parameter to ioctl function

Lift the 'timeout' parameter from the basic ioctl to the various
ioctl command abstractions to get a better flexibility when using
these commands.

Signed-off-by: Hannes Reinecke <hare@suse.de>
3 years agotree: add namespace chrdev name to nvme_ns
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>
3 years agoMerge pull request #115 from hreinecke/doc-update
Hannes Reinecke [Wed, 17 Nov 2021 17:28:29 +0000 (18:28 +0100)]
Merge pull request #115 from hreinecke/doc-update

fabrics: add missing function documentation and mapfile update

3 years agofabrics: add missing function documentation and mapfile update
Hannes Reinecke [Wed, 17 Nov 2021 17:23:51 +0000 (18:23 +0100)]
fabrics: add missing function documentation and mapfile update

Add some function documentation and the missing symbol nvmf_eflags_str
to the mapfile.

Signed-off-by: Hannes Reinecke <hare@suse.de>
3 years agoMerge pull request #114 from martin-belanger/add-tp8013-to-python
Hannes Reinecke [Wed, 17 Nov 2021 17:07:51 +0000 (18:07 +0100)]
Merge pull request #114 from martin-belanger/add-tp8013-to-python

Add discovery_ctrl_set() to Python bindings

3 years agoAdd discovery_ctrl_set() to Python bindings.
Martin Belanger [Wed, 17 Nov 2021 15:20:28 +0000 (10:20 -0500)]
Add discovery_ctrl_set() to Python bindings.

Following Hannes' recent TP8013 changes, we need
to add this method to the Python bindings.

Signed-off-by: Martin Belanger <martin.belanger@dell.com>
3 years agoMerge pull request #112 from hreinecke/map-update
Hannes Reinecke [Wed, 17 Nov 2021 15:01:15 +0000 (16:01 +0100)]
Merge pull request #112 from hreinecke/map-update

Add missing symbols for discovery to map file

3 years agoAdd missing symbols for discovery to map file
Hannes Reinecke [Wed, 17 Nov 2021 14:58:03 +0000 (15:58 +0100)]
Add missing symbols for discovery to map file

Adding support for discovery controller discovery did not add
the new symbols to the map file.

3 years agoMerge pull request #110 from hreinecke/default-config
Hannes Reinecke [Wed, 17 Nov 2021 13:52:22 +0000 (14:52 +0100)]
Merge pull request #110 from hreinecke/default-config

fabrics: add nvmf_default_config()

3 years agofabrics: add nvmf_default_config()
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.

Signed-off-by: Hannes Reinecke <hare@suse.de>
3 years agoMerge pull request #109 from igaw/json-c-dep
Hannes Reinecke [Wed, 17 Nov 2021 13:08:58 +0000 (14:08 +0100)]
Merge pull request #109 from igaw/json-c-dep

lower json-c depependecy for meson build

3 years agoworkflows: Install libjson-c-dev
Daniel Wagner [Wed, 17 Nov 2021 12:40:20 +0000 (13:40 +0100)]
workflows: Install libjson-c-dev

Since libnvme is able to use the 0.13 version provided by gitlabs CI,
let's use it.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
3 years agobuild: Lower json-c dependencies
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.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
3 years agoMerge pull request #105 from hreinecke/discovery
Hannes Reinecke [Wed, 17 Nov 2021 09:34:50 +0000 (10:34 +0100)]
Merge pull request #105 from hreinecke/discovery

TP8013 & 8014 support

3 years agofabrics: set 'discovery' argument for unique discovery controllers
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.

Signed-off-by: Hannes Reinecke <hare@suse.de>
3 years agoDistinguish between 'nvm' and 'discovery' subsystems
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.

Signed-off-by: Hannes Reinecke <hare@suse.de>
3 years agofabrics: decode discover log page flags
Hannes Reinecke [Mon, 15 Nov 2021 14:27:27 +0000 (15:27 +0100)]
fabrics: decode discover log page flags

TP8014 defines a new discovery log page entry field 'eflags', which
carries information about the returned entries.
This patch decodes the new field.

Signed-off-by: Hannes Reinecke <hare@suse.de>
3 years agofabrics: decode new discovery log entry type '3'
Hannes Reinecke [Thu, 12 Aug 2021 11:23:13 +0000 (13:23 +0200)]
fabrics: decode new discovery log entry type '3'

TP8014 adds a new discovery log entry type '3' to describe the
current discovery controller.

Signed-off-by: Hannes Reinecke <hare@suse.de>
3 years agoMerge pull request #107 from igaw/update-json-c-dep
Daniel Wagner [Tue, 16 Nov 2021 22:02:09 +0000 (23:02 +0100)]
Merge pull request #107 from igaw/update-json-c-dep

Update json-c dependency

3 years agoworkflows: Don't install libjson-c-dev
Daniel Wagner [Tue, 16 Nov 2021 21:48:41 +0000 (22:48 +0100)]
workflows: Don't install libjson-c-dev

ubuntu-latest ships an old version of json-c (0.13). Let's use the
version from meson's wrapdb which is bit newer (0.15).

Signed-off-by: Daniel Wagner <dwagner@suse.de>
3 years agobuild: Update json-c dependencies
Daniel Wagner [Tue, 16 Nov 2021 21:47:18 +0000 (22:47 +0100)]
build: Update json-c dependencies

nvme-cli has a minimum dependency to json-c 0.14. Let's update libnvme
accordingly to avoid any confusions.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
3 years agoMerge pull request #94 from igaw/merge-nvme-cli-monolithic
Daniel Wagner [Tue, 16 Nov 2021 15:31:42 +0000 (16:31 +0100)]
Merge pull request #94 from igaw/merge-nvme-cli-monolithic

Merge nvme cli monolithic

3 years agobuild: Adopt libsystemd versioning scheme
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.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
3 years agobuild: Remove meson help text from meson.build
Daniel Wagner [Wed, 10 Nov 2021 17:22:21 +0000 (18:22 +0100)]
build: Remove meson help text from meson.build

The generic meson documentation is cluttering the meson.build
file. This is already in README.md file, so let's just remove it
completely.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
3 years agotypes: Add missing Zone Attributes Information on zone descriptor
Steven Seungcheol Lee [Fri, 5 Nov 2021 17:42:56 +0000 (18:42 +0100)]
types: Add missing Zone Attributes Information on zone descriptor

NVMe-Zoned-Namespace-Command-Set-Specification-1.1a-2021.07.26-Ratified
Figure 37: Zone Descriptor Data Structure - Zone Attributes Information

Signed-off-by: Steven Seungcheol Lee <sc108.lee@samsung.com>
[dwagner: ported from nvme-cli-monolithic]
Signed-off-by: Daniel Wagner <dwagner@suse.de>
3 years agotypes: nvme_id_ns rsvd area modified as lbaf fields
Daniel Wagner [Fri, 5 Nov 2021 17:36:38 +0000 (18:36 +0100)]
types: nvme_id_ns rsvd area modified as lbaf fields

Based spec : NVMe-NVM-Command-Set-Specification-1.0a-2021.07.26-Ratified

[dwagner: ported from nvme-cli-monolithic]
Signed-off-by: Daniel Wagner <dwagner@suse.de>
3 years agotypes: add identify endurance group list (cns 0x19) support
Gollu Appalanaidu [Fri, 5 Nov 2021 16:35:24 +0000 (17:35 +0100)]
types: add identify endurance group list (cns 0x19) support

Signed-off-by: Gollu Appalanaidu <anaidu.gollu@samsung.com>
[dwagner: ported from nvme-cli-monolithic]
Signed-off-by: Daniel Wagner <dwagner@suse.de>
3 years agotypes: fix(Add missing fields rrl, frl, lbafe)
Steven Seungcheol Lee [Fri, 5 Nov 2021 16:24:18 +0000 (17:24 +0100)]
types: fix(Add missing fields rrl, frl, lbafe)

Based on NVMe-Zoned-Namespace-Command-Set-Specification-1.1a-2021.07.26-Ratified

Signed-off-by: Steven Seungcheol Lee <sc108.lee@samsung.com>
[dwagner: ported from nvme-cli-monolithic]
Signed-off-by: Daniel Wagner <dwagner@suse.de>
3 years agoioctl: add lockdown command support
Gollu Appalanaidu [Fri, 5 Nov 2021 16:16:59 +0000 (17:16 +0100)]
ioctl: add lockdown command support

Signed-off-by: Karthik Balan karthik.b82@samsung.com
Signed-off-by: Gollu Appalanaidu <anaidu.gollu@samsung.com>
[dwagner: ported from nvme-cli-monolithic]
Signed-off-by: Daniel Wagner <dwagner@suse.de>
3 years agotypes: Enable telemetry data area 4 in base
Brandon Paupore [Fri, 5 Nov 2021 13:22:16 +0000 (14:22 +0100)]
types: Enable telemetry data area 4 in base

Signed-off-by: Brandon Paupore <brandon.paupore@wdc.com>
[dwagner: ported from nvme-cli-monolithic]
Signed-off-by: Daniel Wagner <dwagner@suse.de>
3 years agotypes: add supported log pages log page (lid = 0x00)
Gollu Appalanaidu [Fri, 5 Nov 2021 13:05:37 +0000 (14:05 +0100)]
types: add supported log pages log page (lid = 0x00)

Signed-off-by: Gollu Appalanaidu <anaidu.gollu@samsung.com>
[dwagner: - ported from nvme-cli-monolithic
          - changed naming scheme to nvme_get_log_supported_log_pages]
Signed-off-by: Daniel Wagner <dwagner@suse.de>
3 years agoioctl: Add Timeout Parameter for Zone Management Commands
Brandon Paupore [Fri, 5 Nov 2021 09:24:13 +0000 (10:24 +0100)]
ioctl: Add Timeout Parameter for Zone Management Commands

Signed-off-by: Brandon Paupore <brandon.paupore@wdc.com>
[dwagner: ported from nvme-cli-monolithic]
Signed-off-by: Daniel Wagner <dwagner@suse.de>
3 years agotypes: add support for fid supported and effects log(lid = 0x12)
Gollu Appalanaidu [Fri, 5 Nov 2021 08:47:11 +0000 (09:47 +0100)]
types: add support for fid supported and effects log(lid = 0x12)

Signed-off-by: Gollu Appalanaidu <anaidu.gollu@samsung.com>
[dwagner: - ported from nvme-cli-monolithic
          - changed naming scheme to nvme_get_log_fid_supported_effects]
Signed-off-by: Daniel Wagner <dwagner@suse.de>
3 years agoioctl: Fix rae parameter order in __nvme_get_log
Daniel Wagner [Thu, 4 Nov 2021 17:36:32 +0000 (18:36 +0100)]
ioctl: Fix rae parameter order in __nvme_get_log

__nvme_get_log() is a wrapper for nvme_get_log(). Though it got the
position for the rae arguemtn wrong.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
3 years agotypes: add boot partition log support
Gollu Appalanaidu [Thu, 4 Nov 2021 17:35:48 +0000 (18:35 +0100)]
types: add boot partition log support

Signed-off-by: Gollu Appalanaidu <anaidu.gollu@samsung.com>
[dwagner: ported from nvme-cli-monolithic]
Signed-off-by: Daniel Wagner <dwagner@suse.de>
3 years agotypes: Add Identify for CNS 08h NVMe spec 2.0a based
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>
3 years agotypes: add spinup control feature (fid=0x1A)
Gollu Appalanaidu [Thu, 4 Nov 2021 13:26:45 +0000 (14:26 +0100)]
types: add spinup control feature (fid=0x1A)

Signed-off-by: Gollu Appalanaidu <anaidu.gollu@samsung.com>
[dwagner: ported from nvme-cli-monolithic]
Signed-off-by: Daniel Wagner <dwagner@suse.de>
3 years agotypes: Add New fields on PEL based on NVMe 2.0a
Steven Seungcheol Lee [Thu, 4 Nov 2021 10:16:03 +0000 (11:16 +0100)]
types: Add New fields on PEL based on NVMe 2.0a

Persistent Event Log header got new fields below
[373:372] Generation Number
[377:374] Reporting Context Information (RCI)

Signed-off-by: Steven Seungcheol Lee <sc108.lee@samsung.com>
[dwagner: ported from nvme-cli-monolithic]
Signed-off-by: Daniel Wagner <dwagner@suse.de>
3 years agotypes: Add Identify CNS 0x18 Domain List Support
Daniel Wagner [Thu, 4 Nov 2021 09:32:46 +0000 (10:32 +0100)]
types: Add Identify CNS 0x18 Domain List Support

Signed-off-by: Daniel Wagner <dwagner@suse.de>
3 years agotypes: add capacity management command support
Gollu Appalanaidu [Wed, 3 Nov 2021 16:32:37 +0000 (17:32 +0100)]
types: add capacity management command support

Host software issues this Capacity Management command to
configure/Create/Delete Endurance Groups and NVM Sets in an
NVM subsystem.

Signed-off-by: Gollu Appalanaidu <anaidu.gollu@samsung.com>
Signed-off-by: Karthik Balan <karthik.b82@samsung.com>
[dwagner: - ported from nvme-cli-monolithic
          - renamed nvme_cap_mgmt to nmve_capacity_mgmt]
Signed-off-by: Daniel Wagner <dwagner@suse.de>
3 years agoioctl: add multiple update detected result value in fw commit
Gollu Appalanaidu [Wed, 3 Nov 2021 16:05:19 +0000 (17:05 +0100)]
ioctl: add multiple update detected result value in fw commit

Add Multiple Update Detected (MUD) field in FW Commit command
CQE CDW0 as per NVMe 2.0 Spec.

Signed-off-by: Gollu Appalanaidu <anaidu.gollu@samsung.com>
[dwagner: ported from nvme-cli-monolithic]
Signed-off-by: Daniel Wagner <dwagner@suse.de>
3 years agoioctl: Change IOCTL for read, write and compare commands
Gollu Appalanaidu [Wed, 3 Nov 2021 14:31:45 +0000 (15:31 +0100)]
ioctl: Change IOCTL for read, write and compare commands

Change the IOCTL and depricate SQE structure for NVM commands
Read, Write and Compare Commands to add support for the Storage
Tag field (CDW2 and CDW3).

Signed-off-by: Gollu Appalanaidu <anaidu.gollu@samsung.com>
[dwagner: ported from nvme-cli-monolithic]
Signed-off-by: Daniel Wagner <dwagner@suse.de>
3 years agoioctl: add CDW2 and CDW3 support for Write Zeroes and Verify Command
Gollu Appalanaidu [Wed, 3 Nov 2021 13:13:46 +0000 (14:13 +0100)]
ioctl: add CDW2 and CDW3 support for Write Zeroes and Verify Command

Added support for the Variable Sized Expected Logical Block Storage Tag(ELBST)
and Expected Logical Block Reference Tag (ELBRT), CDW2 and CDW3 (00:47) bits
for NVM commands Write Zeroes and Verify commands.

Signed-off-by: Gollu Appalanaidu <anaidu.gollu@samsung.com>
[dwagner: ported from nvme-cli-monolithic]
Signed-off-by: Daniel Wagner <dwagner@suse.de>
3 years agonvme: add identify controller structure 2.0 spec. fields
Gollu Appalanaidu [Fri, 11 Jun 2021 21:24:56 +0000 (02:54 +0530)]
nvme: add identify controller structure 2.0 spec. fields

Signed-off-by: Gollu Appalanaidu <anaidu.gollu@samsung.com>
[dwagner: ported from nvme-cli-monolithic]
Signed-off-by: Daniel Wagner <dwagner@suse.de>
3 years agotree: fix memory leak in nvme_ctrl_lookup_subsystem_name
Jonathan Teh [Mon, 15 Nov 2021 18:02:00 +0000 (18:02 +0000)]
tree: fix memory leak in nvme_ctrl_lookup_subsystem_name

Ensure all dirents are freed when a successful stat(2) causes an early
break out of the loop.

Reproduced with valgrind running "nvme discover" against an NVMe-oF
target:

==34612== 32 bytes in 1 blocks are definitely lost in loss record 2 of 2
==34612==    at 0x483B7F3: malloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==34612==    by 0x4963A4C: __scandir64_tail (scandir-tail-common.c:69)
==34612==    by 0x16E77D: nvme_ctrl_lookup_subsystem_name.isra.0 (tree.c:1024)
==34612==    by 0x170081: nvme_init_ctrl (tree.c:1100)
==34612==    by 0x16DA1F: nvmf_add_ctrl (fabrics.c:558)
==34612==    by 0x136B03: nvmf_discover (fabrics.c:516)
==34612==    by 0x139999: handle_plugin (plugin.c:155)
==34612==    by 0x1131E9: main (nvme.c:5967)

Signed-off-by: Jonathan Teh <jonathan.teh@mayadata.io>
Reviewed-by: Keith Busch <kbusch@kernel.org>
Signed-off-by: Daniel Wagner <dwagner@suse.de>
3 years agoMerge pull request #106 from hreinecke/fixes
Daniel Wagner [Tue, 16 Nov 2021 12:52:59 +0000 (13:52 +0100)]
Merge pull request #106 from hreinecke/fixes

Remove references to nvme_ctrl_get_nqn()

3 years agoMerge pull request #101 from sc108-lee/fix/id_psd
Daniel Wagner [Tue, 16 Nov 2021 12:36:19 +0000 (13:36 +0100)]
Merge pull request #101 from sc108-lee/fix/id_psd

types: fix wrong bits nvme_id_psd apw[178:176], aps[183:182]

3 years agofabrics: use nvme_msg() instead of fprintf()
Hannes Reinecke [Tue, 16 Nov 2021 09:25:49 +0000 (10:25 +0100)]
fabrics: use nvme_msg() instead of fprintf()

Commit d569afca ("fabrics: restore hostname traddr support")
used fprintf() instead of nvme_msg(). Fix it up.

Signed-off-by: Hannes Reinecke <hare@suse.de>
3 years agoRemove references to nvme_ctrl_get_nqn()
Hannes Reinecke [Tue, 16 Nov 2021 09:21:18 +0000 (10:21 +0100)]
Remove references to nvme_ctrl_get_nqn()

Stale reference, function is not implemented.

Signed-off-by: Hannes Reinecke <hare@suse.de>
3 years agoMerge pull request #102 from hreinecke/config
Hannes Reinecke [Tue, 16 Nov 2021 08:22:43 +0000 (09:22 +0100)]
Merge pull request #102 from hreinecke/config

Add json config schema

3 years agoAdd json config schema
Hannes Reinecke [Mon, 15 Nov 2021 14:29:46 +0000 (15:29 +0100)]
Add json config schema

Add a schema file to describe the JSON configuration file format.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Keith Busch <kbusch@kernel.org>
3 years agotypes: fix wrong bits nvme_id_psd apw[178:176], aps[183:182]
Steven Seungcheol Lee [Thu, 28 Oct 2021 03:39:30 +0000 (12:39 +0900)]
types: fix wrong bits nvme_id_psd apw[178:176], aps[183:182]

Signed-off-by: Steven Seungcheol Lee <sc108.lee@samsung.com>
3 years agolibnvme: core dump when running nvme persistent-event-log
root [Thu, 11 Nov 2021 21:09:41 +0000 (16:09 -0500)]
libnvme: core dump when running nvme persistent-event-log

[root@ltczz405-lp2 nvme-cli]# ./nvme persistent-event-log -a 0 /dev/nvme0>out
[20748.494262] nvme[9059]: segfault (11) at 7fff8cf20007 nip 10024828 lr 10024824 code 2 in nvme[10000000+c0000]
[20748.494288] nvme[9059]: code: 3b9c0024 3b7b0001 4bfddb41 e8410018 889cffe6 7e439378 4bfddb31 e8410018
[20748.494295] nvme[9059]: code: 889cffe7 e8610068 4bfddb21 e8410018 <809cfff4e8610070 4bfddb11 e8410018
Segmentation fault (core dumped)

Saw the segmentation fault. Also looks only the first event is good. Other events are like random stuff.

Persistent Event Log for device: nvme0
Action for Persistent Event Log: 0
Log Identifier: 13
Total Number of Events: 6963
Total Log Length : 674496
Log Revision: 1
Log Header Length: 492
Timestamp: 564586531692487
Power On Hours (POH): 5,576
Power Cycle Count: 92
PCI Vendor ID (VID): 5197
PCI Subsystem Vendor ID (SSVID): 4116
Serial Number (SN): S4WANE0N300041
Model Number (MN): PCIe4 1.6TB NVMe Flash Adapter x8
NVM Subsystem NVMe Qualified Name (SUBNQN): nqn.1994-11.com.samsung:nvme:PM1735::
HHHL:S4WANE0N300041
Supported Events Bitmap: BitMap[0] is 0xfe
BitMap[1] is 0x3f

Persistent Event Entries:
Event Type: 1
Event Type Revision: 1
Event Header Length: 21
Controller Identifier: 66
Event Timestamp: 0
Vendor Specific Information Length: 512
Event Length: 10496
Smart Health Event:
Smart Log for NVME device:nvme0 namespace-id:ffffffff
critical_warning : 0
temperature : 24°C (297 Kelvin)
available_spare : 100%
available_spare_threshold : 10%
percentage_used : 1%
endurance group critical warning summary: 0
data_units_read : 0
data_units_written

Event Type: 82 --------------->wrong event type??
Event Type Revision: 69
Event Header Length: 86
Controller Identifier: 20563
Event Timestamp: 65
Vendor Specific Information Length: 0
Event Length: 88
Reserved Event

Event Type: 242 -------->wrong event type?
Event Type Revision: 206
Event Header Length: 4
Controller Identifier: 0
Event Timestamp: 5039920509769225473
Vendor Specific Information Length: 0
Event Length: 0
Reserved Event

Signed-off-by: Wen Xiong <wenxiong@linux.ibm.com>
3 years agoMerge pull request #98 from martin-belanger/fix-iface-offset
Daniel Wagner [Thu, 11 Nov 2021 15:22:31 +0000 (16:22 +0100)]
Merge pull request #98 from martin-belanger/fix-iface-offset

Fix host_iface offset.

3 years agoFix host_iface offset.
Martin Belanger [Thu, 11 Nov 2021 15:07:00 +0000 (10:07 -0500)]
Fix host_iface offset.

This was a copy-paste typo.

Signed-off-by: Martin Belanger <martin.belanger@dell.com>
3 years agoMerge pull request #93 from tbzatek/docs-updates-4
Daniel Wagner [Mon, 8 Nov 2021 08:32:20 +0000 (09:32 +0100)]
Merge pull request #93 from tbzatek/docs-updates-4

Docs updates + minor fixes

3 years agobuild: Change library version to be a valid number
Tomas Bzatek [Thu, 4 Nov 2021 16:43:02 +0000 (17:43 +0100)]
build: Change library version to be a valid number

pkg-config file version number should be a valid number
to make version comparison actually work.

3 years agotypes: Doc strings update for Sanitize and Format operations
Tomas Bzatek [Thu, 4 Nov 2021 16:34:29 +0000 (17:34 +0100)]
types: Doc strings update for Sanitize and Format operations

3 years agotypes: Fix a typo in the NVME_FORMAT_MSET_EXTENEDED constant
Tomas Bzatek [Thu, 4 Nov 2021 12:01:30 +0000 (13:01 +0100)]
types: Fix a typo in the NVME_FORMAT_MSET_EXTENEDED constant

3 years agoMerge pull request #89 from martin-belanger/rm-duplicate-line
Daniel Wagner [Wed, 3 Nov 2021 12:40:15 +0000 (13:40 +0100)]
Merge pull request #89 from martin-belanger/rm-duplicate-line

Remove a duplicate read() statement

3 years agoFix reading of system UUID on Debian
Martin Belanger [Tue, 2 Nov 2021 19:21:50 +0000 (15:21 -0400)]
Fix reading of system UUID on Debian

The system UUID can be read from the sysfs in two different locations:

1) /sys/class/dmi/id/product_uuid
2) /sys/firmware/dmi/entries

Location 1) is present on all the systems I've tested: SUSE, Red Hat,
Fedora, and Ubuntu. Unfortunately, location 2) does not exist on
Debian-based systems.

Currently, uuid_from_dmi() only reads from location 2), which fails
on Debian.

This patch adds code that reads from location 1) first, and will
only try location 2) if reading from 1) fails.

Signed-off-by: Martin Belanger <martin.belanger@dell.com>
[dwagner: Updated return value from -1 to -ENXIO]
Signed-off-by: Daniel Wagner <dwagner@suse.de>
3 years agoFix python unit tests when run as a subproject of another project (#91)
Martin Belanger [Wed, 3 Nov 2021 09:03:24 +0000 (05:03 -0400)]
Fix python unit tests when run as a subproject of another project (#91)

* Fix python unit tests when run as a subproject of another
project, i.e. nvme-cli.

Signed-off-by: Martin Belanger <martin.belanger@dell.com>
3 years agoRemoved a duplicate line (read from file). I checked with
Martin Belanger [Tue, 2 Nov 2021 12:19:52 +0000 (08:19 -0400)]
Removed a duplicate line (read from file). I checked with
Hannes and he confirmed that the line was added by mistake.

Signed-off-by: Martin Belanger <martin.belanger@dell.com>
3 years agoMerge pull request #83 from igaw/ccan-build-c-files
Daniel Wagner [Tue, 2 Nov 2021 11:38:03 +0000 (12:38 +0100)]
Merge pull request #83 from igaw/ccan-build-c-files

ccan: Add *.c files to the build

3 years agoMerge pull request #87 from martin-belanger/add-python-testsv2
Daniel Wagner [Thu, 28 Oct 2021 12:30:01 +0000 (14:30 +0200)]
Merge pull request #87 from martin-belanger/add-python-testsv2

Add Python tests to meson framework.

3 years agoAdd Python tests to meson framework.
Martin Belanger [Wed, 27 Oct 2021 12:20:10 +0000 (08:20 -0400)]
Add Python tests to meson framework.

Python has this strict directory layout requirement. A Python package is a
directory that must contain a __init__.py file in addition to containing
modules.

To be able to run Python tests and load modules directly from the build
directory, the Python package (libnvme) and module (nvme.py) must be organized
in the build directory the same way they would be in the install directory. And
the PYTHONPATH must be set to point to the build directory. In other words,
like this:

  .build                <- PYTHONPATH points to here.
   \_ libnvme           <- Package
       \_ nvme.py       <- Module
       \_ __init__.py
       \_ _nvme.cpython-38-x86_64-linux-gnu.so

This patch changes the directory layout so that meson will organize the Python
package and module as shown above. The patch also defines Python tests and sets
the PYTHONPATH to allow importing directly from the build directory.

Signed-off-by: Martin Belanger <martin.belanger@dell.com>
3 years agoMerge pull request #86 from birkelund/fix-virt-mgmt
Daniel Wagner [Wed, 27 Oct 2021 09:31:25 +0000 (11:31 +0200)]
Merge pull request #86 from birkelund/fix-virt-mgmt

ioctl: fix mask values for virt mgmt

3 years agoioctl: fix mask values for virt mgmt
Klaus Jensen [Tue, 26 Oct 2021 18:12:36 +0000 (20:12 +0200)]
ioctl: fix mask values for virt mgmt

Fix the the Virtualization Managemtn CDW10 masks for ACT, RT and CNTLID.

Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
3 years agoMerge pull request #60 from martin-belanger/add-init-method
Daniel Wagner [Mon, 25 Oct 2021 07:46:09 +0000 (09:46 +0200)]
Merge pull request #60 from martin-belanger/add-init-method

[Python]: Add init() method to class nvme_ctrl.

3 years agoAdd Python init() method. Move nvme_init_ctrl() from private.h to tree.h
Martin Belanger [Thu, 21 Oct 2021 12:42:24 +0000 (08:42 -0400)]
Add Python init() method. Move nvme_init_ctrl() from private.h to tree.h
Addess review comments.

Signed-off-by: Martin Belanger <martin.belanger@dell.com>