]> www.infradead.org Git - users/sagi/libnvme.git/log
users/sagi/libnvme.git
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 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 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 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>
3 years agoccan: Add *.c files to the build
Daniel Wagner [Fri, 22 Oct 2021 07:15:39 +0000 (09:15 +0200)]
ccan: Add *.c files to the build

We are missing the *.c files from the ccan code base in the build.
As we currently don't use any function implemented in the *.c files
all just works.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
3 years agoMerge pull request #81 from igaw/fix-python-lib
Daniel Wagner [Fri, 22 Oct 2021 06:42:50 +0000 (08:42 +0200)]
Merge pull request #81 from igaw/fix-python-lib

libnvme.map: Expose symbols for Python binding

3 years agoMerge pull request #75 from jk-ozlabs/fixes
Daniel Wagner [Fri, 22 Oct 2021 06:42:25 +0000 (08:42 +0200)]
Merge pull request #75 from jk-ozlabs/fixes

Minor header definition fixes

3 years agolibnvme.map: Expose symbols for Python binding
Daniel Wagner [Fri, 22 Oct 2021 06:13:52 +0000 (08:13 +0200)]
libnvme.map: Expose symbols for Python binding

There a few missing symbols for the Python binding. Add them to the
libnvme.map.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
3 years agoMerge pull request #79 from birkelund/meson-install-missing-header
Daniel Wagner [Thu, 21 Oct 2021 10:47:46 +0000 (12:47 +0200)]
Merge pull request #79 from birkelund/meson-install-missing-header

src/meson.build: install missing linux.h

3 years agosrc/meson.build: install missing linux.h
Klaus Jensen [Thu, 21 Oct 2021 10:43:46 +0000 (12:43 +0200)]
src/meson.build: install missing linux.h

src/nvme/linux.h is missing from install_headers.

Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
3 years agoMerge pull request #77 from jk-ozlabs/ccan-fix
Daniel Wagner [Thu, 21 Oct 2021 08:41:50 +0000 (10:41 +0200)]
Merge pull request #77 from jk-ozlabs/ccan-fix

meson + ccan configuration fixes

3 years agomeson: use correct byteswap macro name
Jeremy Kerr [Thu, 21 Oct 2021 01:44:18 +0000 (09:44 +0800)]
meson: use correct byteswap macro name

We're declaring HAVE_BSWAP64, but ccan expects HAVE_BSWAP_64.

Fixes: bb84156 ("meson.build: Add ccan-required configuration macros")
Reported-by: Klaus Jensen <k.jensen@samsung.com>
Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
3 years agoconfigure: include ccan config from top-level config.h
Jeremy Kerr [Wed, 20 Oct 2021 13:14:25 +0000 (21:14 +0800)]
configure: include ccan config from top-level config.h

In 3a84d900, we moved the ccan config.h to ccan-config.h, but didn't end
up including it in the top-level config.h.

To complete the simplification, config.h should include the
(configurator-generated) ccan-config.h.

Fixes: 3a84d90084b5 ("configure: simplify config-host.h & config-host.mak generation")
Reported-by: Klaus Jensen <k.jensen@samsung.com>
Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
3 years agomakefiles: use config.h in examples/ & tests/
Jeremy Kerr [Thu, 21 Oct 2021 08:20:42 +0000 (16:20 +0800)]
makefiles: use config.h in examples/ & tests/

After the recent reverts, we now need to use the proper config.h in
examples/ and tests/ too.

Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
3 years agoRevert "meson: revert to using the ccan configurator"
Jeremy Kerr [Thu, 21 Oct 2021 08:08:01 +0000 (16:08 +0800)]
Revert "meson: revert to using the ccan configurator"

We have a fix queued for the issue that the original revert is
working-around.

This also includes adjustments to the examples/ & tests/ meson
definitions to suit.

This reverts commit b66a139f12357757c54adf7f38031f0f9105c501.
Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
3 years agoRevert "src/Makefile: fix ccan config.h"
Jeremy Kerr [Thu, 21 Oct 2021 08:07:08 +0000 (16:07 +0800)]
Revert "src/Makefile: fix ccan config.h"

This reverts commit 859bd459dee308639eedb490d348d311dc08f859.

We have the proper fixes in progress, no need for the revert-workaround.

Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
3 years agoMerge pull request #78 from igaw/json-c.wrap
Daniel Wagner [Thu, 21 Oct 2021 07:30:11 +0000 (09:30 +0200)]
Merge pull request #78 from igaw/json-c.wrap

build: Add missing json-c.wrap

3 years agoMerge pull request #8 from birkelund/types
Daniel Wagner [Thu, 21 Oct 2021 07:19:38 +0000 (09:19 +0200)]
Merge pull request #8 from birkelund/types

Header cleanup (make nvme/types.h independent of Linux and usable without linking)

3 years agobuild: Add missing json-c.wrap
Daniel Wagner [Thu, 21 Oct 2021 07:16:58 +0000 (09:16 +0200)]
build: Add missing json-c.wrap

Commit 6af90f95fd1b ("build: Add fallback dependency for json-c") is
missing the wrap file.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
3 years agoMerge pull request #73 from martin-belanger/fix-python-dependency
Daniel Wagner [Thu, 21 Oct 2021 07:11:12 +0000 (09:11 +0200)]
Merge pull request #73 from martin-belanger/fix-python-dependency

Make Python Bindings optional

3 years agoMerge pull request #71 from martin-belanger/update-python-examples
Daniel Wagner [Thu, 21 Oct 2021 07:08:05 +0000 (09:08 +0200)]
Merge pull request #71 from martin-belanger/update-python-examples

[Python]: Fix inaccurate Python examples

3 years agoprivate.h: Add required includes
Jeremy Kerr [Wed, 20 Oct 2021 04:21:13 +0000 (12:21 +0800)]
private.h: Add required includes

In private.h, we use the list, nvme_fabrics_config and (optional) UUID
types, so add their appropriate #includes.

Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
3 years agotypes.h: heal -> health
Jeremy Kerr [Wed, 20 Oct 2021 03:59:03 +0000 (11:59 +0800)]
types.h: heal -> health

We currently have an abbreviation 'heal' in nvme_mi_ctrl_heal_status;
while the subsystem health status uses the full 'health'. This change
unifies these by using the full term instead of the abbreviation.

Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
3 years agotypes: remove endian/mmio helpers
Klaus Jensen [Wed, 29 Sep 2021 19:07:41 +0000 (21:07 +0200)]
types: remove endian/mmio helpers

The endian/mmio helpers do not belong in types.h.

Since we are already using ccan and have ccan/endian available, just
include that where needed. The implementation is 100% equivalent, even
with sparse annotations.

Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
3 years agolinux: move linux specific stuff from util.{c,h}
Klaus Jensen [Wed, 29 Sep 2021 18:20:23 +0000 (20:20 +0200)]
linux: move linux specific stuff from util.{c,h}

Add the nvme/linux.h header for Linux specific helpers. This leaves
util.{c,h} with only system-agnostic utilities.

Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
3 years agotypes: move the feature shift/masks from util.h
Klaus Jensen [Mon, 18 Oct 2021 18:48:48 +0000 (20:48 +0200)]
types: move the feature shift/masks from util.h

Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
3 years agotypes: move command parameters from ioctl.h
Klaus Jensen [Wed, 29 Sep 2021 17:44:55 +0000 (19:44 +0200)]
types: move command parameters from ioctl.h

Move spec-defined command parameters out of nvme/ioctl.h and into
nvme/types.h. This allows third-party libraries and applications to use
the type definitions of libnvme without potentially clashing with
various function prototypes that are ioctl specific.

Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
3 years agomeson: revert to using the ccan configurator
Klaus Jensen [Tue, 19 Oct 2021 20:13:53 +0000 (22:13 +0200)]
meson: revert to using the ccan configurator

Something fishy is going on with the -include config.h and #include
"config.h" in the ccan sources. If examples/tests use ccan, they end up
with redefinitions caused by the ccan config defines not being properly set.

Revert to generating a ccan-specific config.h using the configurator (like the
Make-based setup).

Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
3 years agosrc/Makefile: fix ccan config.h
Klaus Jensen [Tue, 19 Oct 2021 19:34:38 +0000 (21:34 +0200)]
src/Makefile: fix ccan config.h

The ccan/ccan-config.h generated by the ccan configurator is never read
by the ccan sources which expect config.h. Instead, because of -I.. in
src/Makefile, the ccan sources picks up the base config.h (as generated
by configure). All kinds of wrong since config.h should actually have
been config-host.h.

Fix the compiler args to not include the base directory and generate the
ccan config file as ccan/config.h. Rename ./config.h to ./config-host.h.

Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
3 years ago[Python]: Fix inaccurate Python examples
Martin Belanger [Tue, 19 Oct 2021 12:56:27 +0000 (08:56 -0400)]
[Python]: Fix inaccurate Python examples

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