]> www.infradead.org Git - users/sagi/libnvme.git/log
users/sagi/libnvme.git
3 years agobuild: make Python memory allocations valgrind friendly
Daniel Wagner [Fri, 11 Feb 2022 12:45:57 +0000 (13:45 +0100)]
build: make Python memory allocations valgrind friendly

When testing with

  meson test -C .build --wrap='valgrind --leak-check=full'

the Python binding will trigger 'Invalid read of size 4' warnings.
Tell Python to use malloc directly for all memory allocation which can
be properly traced by valgrind.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
3 years agotree: Fix memleaks in __nvme_free_ns() and nvme_scan_subsystem()
Daniel Wagner [Fri, 11 Feb 2022 12:20:14 +0000 (13:20 +0100)]
tree: Fix memleaks in __nvme_free_ns() and nvme_scan_subsystem()

valgrind reports that we are leaking memory in __nvme_free_ns() and
nvme_scan_subsystem(). Free ns->generic_name and path which makes
valgrind also happy.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
3 years agoMerge pull request #230 from sc108-lee/fix/io_cmd
Daniel Wagner [Fri, 11 Feb 2022 10:41:54 +0000 (11:41 +0100)]
Merge pull request #230 from sc108-lee/fix/io_cmd

ioctl: nvme_io_args.dspec(Directive Specific) value is 16 bits

3 years agoioctl: nvme_io_args.dspec(Directive Specific) value is 16 bits
Steven Seungcheol Lee [Fri, 11 Feb 2022 10:36:40 +0000 (19:36 +0900)]
ioctl: nvme_io_args.dspec(Directive Specific) value is 16 bits

Command Dword 13 [31:16]

Signed-off-by: Steven Seungcheol Lee <sc108.lee@samsung.com>
3 years agoMerge pull request #229 from igaw/remove-jsonc-ifdefs
Hannes Reinecke [Thu, 10 Feb 2022 09:39:53 +0000 (10:39 +0100)]
Merge pull request #229 from igaw/remove-jsonc-ifdefs

tree: Remove CONFIG_JSONC ifdefs

3 years agotree: Remove CONFIG_JSONC ifdefs
Daniel Wagner [Thu, 10 Feb 2022 09:13:46 +0000 (10:13 +0100)]
tree: Remove CONFIG_JSONC ifdefs

We have an hard dependency on json-c, so we can rely it's always
available. Remove old ifdefs for json-c.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
3 years agoMerge pull request #221 from hreinecke/dump-tree
Daniel Wagner [Thu, 10 Feb 2022 09:09:18 +0000 (10:09 +0100)]
Merge pull request #221 from hreinecke/dump-tree

tree: add nvme_dump_tree()

3 years agotree: add nvme_dump_tree()
Hannes Reinecke [Thu, 3 Feb 2022 11:21:17 +0000 (12:21 +0100)]
tree: add nvme_dump_tree()

Dump the internal tree in JSON format to stdout for debugging.

Signed-off-by: Hannes Reinecke <hare@suse.de>
[dwagner: dropped json wrapper definition usage]
Signed-off-by: Daniel Wagner <dwagner@suse.de>
3 years agoMerge pull request #227 from igaw/cleanup-libuuid-dep
Daniel Wagner [Thu, 10 Feb 2022 08:49:47 +0000 (09:49 +0100)]
Merge pull request #227 from igaw/cleanup-libuuid-dep

tree: Remove dead !LIBUUID code

3 years agotree: Remove dead !LIBUUID code
Daniel Wagner [Tue, 8 Feb 2022 17:40:32 +0000 (18:40 +0100)]
tree: Remove dead !LIBUUID code

We have added a hard dependency to libuuid. Remove the ifdefs and the
dead code.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
3 years agoMerge pull request #226 from linux-nvme/kernel-doc-ci
Daniel Wagner [Tue, 8 Feb 2022 10:42:56 +0000 (11:42 +0100)]
Merge pull request #226 from linux-nvme/kernel-doc-ci

build: Add kernel-doc CI build

3 years agobuild: Add kernel-doc CI build
Daniel Wagner [Mon, 7 Feb 2022 15:01:57 +0000 (16:01 +0100)]
build: Add kernel-doc CI build

We want to catching documentation failures early. Let's add a
dedicated documentation CI build. To keep build times low just
shortcut here and do not call meson to build the complete
documentation.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
3 years agoMerge pull request #213 from jeffreyalien/telemetry-da4-2
Daniel Wagner [Tue, 8 Feb 2022 10:07:41 +0000 (11:07 +0100)]
Merge pull request #213 from jeffreyalien/telemetry-da4-2

[libnvme] Add Support for Telemetry Log Page Data Area 4

3 years agolinux: Add size and data area parm to nvme_get_telemetry_log
Jeff Lien [Mon, 31 Jan 2022 21:14:46 +0000 (15:14 -0600)]
linux: Add size and data area parm to nvme_get_telemetry_log

This is necessary to support the retrieval of data area 4.

Signed-off-by: Jeff Lien <jeff.lien@wdc.com>
3 years agoMerge pull request #223 from hreinecke/json-mandatory
Daniel Wagner [Tue, 8 Feb 2022 09:23:13 +0000 (10:23 +0100)]
Merge pull request #223 from hreinecke/json-mandatory

Make JSON-C mandatory

3 years agoMerge pull request #225 from igaw/fail-on-warnings
Daniel Wagner [Mon, 7 Feb 2022 14:34:04 +0000 (15:34 +0100)]
Merge pull request #225 from igaw/fail-on-warnings

build: Make CI build fail on warnings

3 years agobuild: Make CI build fail on warnings
Daniel Wagner [Mon, 7 Feb 2022 14:31:24 +0000 (15:31 +0100)]
build: Make CI build fail on warnings

Currently, warnings are hidden in the logs and the build is marked as
succeeded. Mark all warnings as error so that we see them show up in
the review process.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
3 years agoMerge pull request #222 from igaw/mesonize-doc
Daniel Wagner [Fri, 4 Feb 2022 11:52:31 +0000 (12:52 +0100)]
Merge pull request #222 from igaw/mesonize-doc

doc: Mesonize documentation generation

3 years agodoc: Regenerate all documentation
Daniel Wagner [Fri, 4 Feb 2022 11:48:45 +0000 (12:48 +0100)]
doc: Regenerate all documentation

Signed-off-by: Daniel Wagner <dwagner@suse.de>
3 years agodoc: Fix sphinx setup
Daniel Wagner [Fri, 4 Feb 2022 11:45:19 +0000 (12:45 +0100)]
doc: Fix sphinx setup

sphinx warns about cyclic refernce. Do not include the index into the
index file.

Also add the build dir and index.rst to the ignore list. This avoids
another type of warnings.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
3 years agodoc: Mesonize documentation generation
Daniel Wagner [Thu, 3 Feb 2022 17:00:15 +0000 (18:00 +0100)]
doc: Mesonize documentation generation

Introduce a new config flag -Ddocs-build=true which controls if the
build system should generate documentation or not. If disabled but
-Ddocs=man is used then the pre compiled documentation will be
installed.

Furthmore, we are hooking up the sphinx tooling so that we generate
the HTML documentation ouf of the rst files.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
3 years agotypes: Fix doc description
Daniel Wagner [Fri, 4 Feb 2022 11:14:54 +0000 (12:14 +0100)]
types: Fix doc description

Signed-off-by: Daniel Wagner <dwagner@suse.de>
3 years agotree: Remove doublicated declaration
Daniel Wagner [Thu, 3 Feb 2022 16:50:49 +0000 (17:50 +0100)]
tree: Remove doublicated declaration

nvme_host_get_hostnqn() and nvme_host_get_hostid() are declared
twice. Remove one.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
3 years agodoc: Remove unused make.bat file
Daniel Wagner [Thu, 3 Feb 2022 10:38:35 +0000 (11:38 +0100)]
doc: Remove unused make.bat file

The file was added by the initial doc experiment commit. It's not
used. Remove it.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
3 years agoMerge pull request #166 from sc108-lee/for-upstream/tp4095
Daniel Wagner [Fri, 4 Feb 2022 10:41:41 +0000 (11:41 +0100)]
Merge pull request #166 from sc108-lee/for-upstream/tp4095

For upstream/tp4095

3 years agonvme: get log domain id included in Log Specific Identifier
Steven Seungcheol Lee [Fri, 4 Feb 2022 08:23:31 +0000 (17:23 +0900)]
nvme: get log domain id included in Log Specific Identifier

domid was not used in nvme_get_log as well

Signed-off-by: Steven Seungcheol Lee <sc108.lee@samsung.com>
3 years agonvme: Add nulbaf(Number of Unique Capability LBA Formats) field on nvmd_id_ns
Steven Seungcheol Lee [Thu, 23 Dec 2021 01:51:38 +0000 (10:51 +0900)]
nvme: Add nulbaf(Number of Unique Capability LBA Formats) field on nvmd_id_ns

Add explaination for mssrl, mcl, src
Based on spec NVMe - TP 4095 Namespace Capability Reporting 2021.06.28 - Ratified

3 years agoioctl: Add identify ioctl for CNS 09h, 0Ah
Steven Seungcheol Lee [Mon, 17 Jan 2022 03:22:22 +0000 (12:22 +0900)]
ioctl: Add identify ioctl for CNS 09h, 0Ah

09h - Identify Namespace data structure for the specified
      User Data Format index containing the namespace capabilities
      for the NVM Command Set.
0Ah - I/O Command Set specific Identify Namespace data structure
      for the specified User Data Format index containing
      the namespace capabilities for the I/O Command Set
      specified in the CSI field.

Signed-off-by: Steven Seungcheol Lee <sc108.lee@samsung.com>
3 years agotypes: Add NVM Command Set id-ns structure
Steven Seungcheol Lee [Mon, 17 Jan 2022 03:12:36 +0000 (12:12 +0900)]
types: Add NVM Command Set id-ns structure

Add uuid index argument on nvme_identify_ns_csi

Signed-off-by: Steven Seungcheol Lee <sc108.lee@samsung.com>
3 years agoioctl: Modify identify command argument based on spec
Steven Seungcheol Lee [Mon, 17 Jan 2022 02:35:54 +0000 (11:35 +0900)]
ioctl: Modify identify command argument based on spec

CNS Specific identifier presents all names below for DWORD11 bits [15:00]
    NVM Set Identifier(NVM Set List (04h))
    Domain Identifier(Domain List (18h))
    Endurance Group Identifier(Endurance Group List (19h))

Signed-off-by: Steven Seungcheol Lee <sc108.lee@samsung.com>
3 years agoMerge pull request #224 from Arunpandian15/Enhanced_ctrl_MD
Daniel Wagner [Fri, 4 Feb 2022 09:32:09 +0000 (10:32 +0100)]
Merge pull request #224 from Arunpandian15/Enhanced_ctrl_MD

nvme: Add Enhanced Controller Meta Data(FID: 0x7D)

3 years agonvme: Add Enhanced Controller Meta Data(FID: 0x7D)
Arunpandian J [Fri, 4 Feb 2022 09:12:36 +0000 (14:42 +0530)]
nvme: Add Enhanced Controller Meta Data(FID: 0x7D)

Reviewed-by: Steven Seungcheol Lee <sc108.lee@samsung.com>
Signed-off-by: Arunpandian J <apj.arun@samsung.com>
3 years agoMake JSON-C mandatory during built
Hannes Reinecke [Fri, 4 Feb 2022 08:06:45 +0000 (09:06 +0100)]
Make JSON-C mandatory during built

We already have a JSON-C subproject, so we can make it mandatory
during build anyway.

Signed-off-by: Hannes Reinecke <hare@suse.de>
3 years agojson: remove wrapper definitions
Hannes Reinecke [Fri, 4 Feb 2022 07:55:14 +0000 (08:55 +0100)]
json: remove wrapper definitions

Switch to JSON-C API.

Signed-off-by: Hannes Reinecke <hare@suse.de>
3 years agotree: do not print function twice
Hannes Reinecke [Fri, 4 Feb 2022 07:44:01 +0000 (08:44 +0100)]
tree: do not print function twice

nvme_msg() already prints out the function name, no need to specify
it in the message itself.

Signed-off-by: Hannes Reinecke <hare@suse.de>
3 years agoMerge pull request #199 from Arunpandian15/Supported_Cap_Config_List_Log_Page
Daniel Wagner [Fri, 4 Feb 2022 07:21:28 +0000 (08:21 +0100)]
Merge pull request #199 from Arunpandian15/Supported_Cap_Config_List_Log_Page

nvme: Add Supported Capacity Configuration List log page(LID: 0x11)

3 years agonvme: Add Supported Capacity Configuration List log page(LID: 0x11)
Arunpandian J [Thu, 3 Feb 2022 08:25:36 +0000 (13:55 +0530)]
nvme: Add Supported Capacity Configuration List log page(LID: 0x11)

Reviewed-by: Steven Seungcheol Lee <sc108.lee@samsung.com>
Signed-off-by: Arunpandian J <apj.arun@samsung.com>
3 years agoMerge pull request #220 from hreinecke/dhchap-fix
Hannes Reinecke [Thu, 3 Feb 2022 13:38:23 +0000 (14:38 +0100)]
Merge pull request #220 from hreinecke/dhchap-fix

tree: do not set dhchap_key to 'none'

3 years agotree: do not set dhchap_key to 'none'
Hannes Reinecke [Thu, 3 Feb 2022 11:28:13 +0000 (12:28 +0100)]
tree: do not set dhchap_key to 'none'

When no dhchap key is set the kernel will set the sysfs attribute
to 'none'. And we shouldn't display this value in our internal tree
as it really means 'not set'.

Signed-off-by: Hannes Reinecke <hare@suse.de>
3 years agoMerge pull request #211 from hreinecke/config-errors
Daniel Wagner [Thu, 3 Feb 2022 11:03:46 +0000 (12:03 +0100)]
Merge pull request #211 from hreinecke/config-errors

Return json parsing errors

3 years agoMerge pull request #219 from hreinecke/lookup-restart
Hannes Reinecke [Thu, 3 Feb 2022 10:43:37 +0000 (11:43 +0100)]
Merge pull request #219 from hreinecke/lookup-restart

Restart controller lookup

3 years agotree: loop address may be NULL
Hannes Reinecke [Thu, 3 Feb 2022 10:34:51 +0000 (11:34 +0100)]
tree: loop address may be NULL

Return an empty string in nvme_ctrl_get_address() and not a NULL
to get a better output.

Signed-off-by: Hannes Reinecke <hare@suse.de>
3 years agotree: loop controllers can have transport addresses
Hannes Reinecke [Thu, 3 Feb 2022 10:05:49 +0000 (11:05 +0100)]
tree: loop controllers can have transport addresses

Loop controllers may have transport addresses, so we need to parse
them to allocated correct objects.

Signed-off-by: Hannes Reinecke <hare@suse.de>
3 years agoMerge pull request #215 from hreinecke/regen-doc
Daniel Wagner [Thu, 3 Feb 2022 10:02:59 +0000 (11:02 +0100)]
Merge pull request #215 from hreinecke/regen-doc

Scripts for regenerating documentation

3 years agoAdd scripts to regenerate documentation
Hannes Reinecke [Wed, 2 Feb 2022 12:18:27 +0000 (13:18 +0100)]
Add scripts to regenerate documentation

Import the 'kernel-doc' script from the linux kernel sources and
add scripts to regenerate libnvme.rst and man-pages.

Signed-off-by: Hannes Reinecke <hare@suse.de>
[dwagner: moved scripts from internal to doc]
Signed-off-by: Daniel Wagner <dwagner@suse.de>
3 years agotree: restart controller lookup
Hannes Reinecke [Thu, 3 Feb 2022 08:46:33 +0000 (09:46 +0100)]
tree: restart controller lookup

nvme_lookup_ctrl() might match more than one controller (eg for loop
devices), in which case the iterator will only ever find the first one.
So add a parameter 'p' to nvme_lookup_ctrl() to re-start the iteration
at a given point instead of just the first one.

Signed-off-by: Hannes Reinecke <hare@suse.de>
3 years agotree: fixup memory leak in nvme_scan_ctrl()
Hannes Reinecke [Thu, 3 Feb 2022 07:45:51 +0000 (08:45 +0100)]
tree: fixup memory leak in nvme_scan_ctrl()

'subsysname' was never freed.

Signed-off-by: Hannes Reinecke <hare@suse.de>
3 years agoMerge pull request #217 from martin-belanger/fix-license
Daniel Wagner [Wed, 2 Feb 2022 14:51:33 +0000 (15:51 +0100)]
Merge pull request #217 from martin-belanger/fix-license

Fix license info

3 years agofix license info
Martin Belanger [Wed, 2 Feb 2022 14:41:02 +0000 (09:41 -0500)]
fix license info

Signed-off-by: Martin Belanger <martin.belanger@dell.com>
3 years agoFixup wrong kernel-doc annotations
Hannes Reinecke [Wed, 2 Feb 2022 12:17:00 +0000 (13:17 +0100)]
Fixup wrong kernel-doc annotations

Some function descriptions weren't properly specified.

Signed-off-by: Hannes Reinecke <hare@suse.de>
3 years agoAdd documentation section descriptions
Hannes Reinecke [Wed, 2 Feb 2022 12:00:08 +0000 (13:00 +0100)]
Add documentation section descriptions

Add DOC: statements to the header files to have each header file
start its own section in the API documentation.

Signed-off-by: Hannes Reinecke <hare@suse.de>
3 years agoMerge pull request #214 from hreinecke/kdoc
Daniel Wagner [Wed, 2 Feb 2022 11:47:06 +0000 (12:47 +0100)]
Merge pull request #214 from hreinecke/kdoc

Sanitize kernel-doc comments

3 years agoRegenerate libnvme.rst
Hannes Reinecke [Wed, 2 Feb 2022 10:24:47 +0000 (11:24 +0100)]
Regenerate libnvme.rst

Regenerate libnvme.rst with 'kernel-doc src/nvme/{filters,ioctl,linux,tree,types,fabrics,util}.h > doc/libnvme.rst'

Signed-off-by: Hannes Reinecke <hare@suse.de>
3 years agoFixup sphinx warnings
Hannes Reinecke [Wed, 2 Feb 2022 10:04:13 +0000 (11:04 +0100)]
Fixup sphinx warnings

When configuring with 'meson -Dman=true' sphinx is printing out errors
on the generated libnvme.rst file. This patch fixes up the function
documentations to fixup these warnings.

Signed-off-by: Hannes Reinecke <hare@suse.de>
3 years agoutil.h: fixup kernel-doc comments
Hannes Reinecke [Wed, 2 Feb 2022 07:23:49 +0000 (08:23 +0100)]
util.h: fixup kernel-doc comments

To keep sphinx happy.

Signed-off-by: Hannes Reinecke <hare@suse.de>
3 years agofabrics.c: fixup kernel-doc comments
Hannes Reinecke [Wed, 2 Feb 2022 07:23:49 +0000 (08:23 +0100)]
fabrics.c: fixup kernel-doc comments

To keep sphinx happy.

Signed-off-by: Hannes Reinecke <hare@suse.de>
3 years agotypes.h: fixup kernel-doc comments
Hannes Reinecke [Wed, 2 Feb 2022 07:23:49 +0000 (08:23 +0100)]
types.h: fixup kernel-doc comments

To keep sphinx happy.

Signed-off-by: Hannes Reinecke <hare@suse.de>
3 years agotree.h: fixup kernel-doc comments
Hannes Reinecke [Wed, 2 Feb 2022 07:23:49 +0000 (08:23 +0100)]
tree.h: fixup kernel-doc comments

To keep sphinx happy.

Signed-off-by: Hannes Reinecke <hare@suse.de>
3 years agolinux.h: fixup kernel-doc comments
Hannes Reinecke [Wed, 2 Feb 2022 07:23:49 +0000 (08:23 +0100)]
linux.h: fixup kernel-doc comments

To keep sphinx happy.

Signed-off-by: Hannes Reinecke <hare@suse.de>
3 years agoioctl.h: fixup kernel-doc comments
Hannes Reinecke [Wed, 2 Feb 2022 07:23:49 +0000 (08:23 +0100)]
ioctl.h: fixup kernel-doc comments

To keep sphinx happy.

Signed-off-by: Hannes Reinecke <hare@suse.de>
3 years agoMerge pull request #209 from hreinecke/doc-proto
Hannes Reinecke [Wed, 2 Feb 2022 06:59:43 +0000 (07:59 +0100)]
Merge pull request #209 from hreinecke/doc-proto

Document function prototypes

3 years agoIgnore errors when opening JSON configuration file
Hannes Reinecke [Tue, 1 Feb 2022 13:00:24 +0000 (14:00 +0100)]
Ignore errors when opening JSON configuration file

The JSON configuration file is optional, so any errors during
opening can be ignored.

Signed-off-by: Hannes Reinecke <hare@suse.de>
3 years agoReturn error from nvme_read_config()
Hannes Reinecke [Tue, 1 Feb 2022 12:49:04 +0000 (13:49 +0100)]
Return error from nvme_read_config()

nvme_read_config() can fail, so we should be returning an error code
to inform the caller about it.

Signed-off-by: Hannes Reinecke <hare@suse.de>
3 years agotree: document function prototypes
Hannes Reinecke [Tue, 1 Feb 2022 12:27:28 +0000 (13:27 +0100)]
tree: document function prototypes

Document all function prototypes in tree.h.

Signed-off-by: Hannes Reinecke <hare@suse.de>
3 years agoMerge pull request #205 from igaw/fix-64bit-alignment v1.0-rc2
Daniel Wagner [Tue, 1 Feb 2022 10:44:20 +0000 (11:44 +0100)]
Merge pull request #205 from igaw/fix-64bit-alignment

ioctl: Sort members their natural size

3 years agoRename nvme_path_get_subsystem()
Hannes Reinecke [Tue, 1 Feb 2022 10:31:05 +0000 (11:31 +0100)]
Rename nvme_path_get_subsystem()

Misnamed, should be nvme_path_get_ctrl() to be consistent with the
other library functions.

Signed-off-by: Hannes Reinecke <hare@suse.de>
3 years agoMerge pull request #207 from igaw/rename-__nvme_get_log_page
Daniel Wagner [Tue, 1 Feb 2022 10:31:03 +0000 (11:31 +0100)]
Merge pull request #207 from igaw/rename-__nvme_get_log_page

Rename   nvme get log page

3 years agoRemove nvme_reset_topology()
Hannes Reinecke [Tue, 1 Feb 2022 10:28:23 +0000 (11:28 +0100)]
Remove nvme_reset_topology()

Identical to nvme_refresh_topology().

Signed-off-by: Hannes Reinecke <hare@suse.de>
3 years agolibvnme: Remove __nvme_msg from export map
Daniel Wagner [Mon, 31 Jan 2022 12:24:56 +0000 (13:24 +0100)]
libvnme: Remove __nvme_msg from export map

nvme-cli was using the library infrastructure for logging. In the
meantime this has been removed, hence we can remove this function from
the export map.

Furthermore, move nvme_msg() and __nvme_msg() to private header.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
3 years agolinux: Rename __nvme_get_log_page()
Daniel Wagner [Mon, 31 Jan 2022 12:22:15 +0000 (13:22 +0100)]
linux: Rename __nvme_get_log_page()

The prefix of __nvme_get_log_page() is confusing as it usually
indicates this is a private function. Rename this function to
nvme_get_log_page().

The already existing one nvme_get_log_page() is renamed to
nvme_get_log_page_padded() which is asking for 4k transfers.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
3 years agoMerge pull request #202 from hreinecke/msg-redirect
Hannes Reinecke [Tue, 1 Feb 2022 10:22:58 +0000 (11:22 +0100)]
Merge pull request #202 from hreinecke/msg-redirect

Redirect error messages

3 years agoRework nvme_scan_filter()
Hannes Reinecke [Tue, 1 Feb 2022 06:50:40 +0000 (07:50 +0100)]
Rework nvme_scan_filter()

Split off nvme_scan_filter() into nvme_create_root() and export the
remaining functionality as nvme_scan_topology(). With that
nvme_scan_filter() becomes pointless as the component functions
can be called directly.

Signed-off-by: Hannes Reinecke <hare@suse.de>
3 years agoioctl: Sort members their natural size
Daniel Wagner [Mon, 31 Jan 2022 09:43:58 +0000 (10:43 +0100)]
ioctl: Sort members their natural size

Previous attempt to align the members of all *_args structure didn't
take into account that pointer types vary between 32bit and 64bit
depending the arch. The only reliable alignemnt is to sort the members
according their natural size: 64bit, pointers, 32bit, 16bit, 8bit.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
3 years agoMerge pull request #204 from igaw/fix-nvme_get_log_args-layout
Hannes Reinecke [Mon, 31 Jan 2022 08:53:48 +0000 (09:53 +0100)]
Merge pull request #204 from igaw/fix-nvme_get_log_args-layout

ioctl: Fix struct nvme_get_log_args memberm alignment

3 years agolibnvme/tests: fixup create-ctrl-obj.py
Hannes Reinecke [Mon, 31 Jan 2022 08:12:13 +0000 (09:12 +0100)]
libnvme/tests: fixup create-ctrl-obj.py

Add the new 'root' argument to nvme.ctrl()

Signed-off-by: Hannes Reinecke <hare@suse.de>
3 years agoioctl: Fix struct nvme_get_log_args memberm alignment
Daniel Wagner [Mon, 31 Jan 2022 08:17:50 +0000 (09:17 +0100)]
ioctl: Fix struct nvme_get_log_args memberm alignment

Commit 781b9105cc43 ("nvme: Add Media Unit Status log page(LID:
0x10)") placed the domid member between two u8 members. The access
domid member would not be 16 bit aligned which is caused problems on
certain architectures. Let's fix the aligemnt by moving domid before
lsp. This give us following layout

struct nvme_get_log_args {
        int                        args_size;            /*     0     4 */
        int                        fd;                   /*     4     4 */
        __u32 *                    result;               /*     8     8 */
        __u32                      timeout;              /*    16     4 */
        enum nvme_cmd_get_log_lid  lid;                  /*    20     4 */
        __u64                      lpo;                  /*    24     8 */
        void *                     log;                  /*    32     8 */
        __u32                      len;                  /*    40     4 */
        __u32                      nsid;                 /*    44     4 */
        enum nvme_csi              csi;                  /*    48     4 */
        __u16                      lsi;                  /*    52     2 */
        __u16                      domid;                /*    54     2 */
        __u8                       lsp;                  /*    56     1 */
        __u8                       uuidx;                /*    57     1 */
        _Bool                      rae;                  /*    58     1 */
        _Bool                      ot;                   /*    59     1 */

        /* size: 64, cachelines: 1, members: 16 */
        /* padding: 4 */
} __attribute__((__aligned__(8)));

Signed-off-by: Daniel Wagner <dwagner@suse.de>
3 years agoRemove stale definition for nvme_log_message
Hannes Reinecke [Mon, 31 Jan 2022 08:07:02 +0000 (09:07 +0100)]
Remove stale definition for nvme_log_message

No functionality anymore.

Signed-off-by: Hannes Reinecke <hare@suse.de>
3 years agoMove global logging variables into nvme_root_t
Hannes Reinecke [Mon, 31 Jan 2022 08:04:46 +0000 (09:04 +0100)]
Move global logging variables into nvme_root_t

Move the global logging variables into nvme_root_t to make them
settable by the application.

Signed-off-by: Hannes Reinecke <hare@suse.de>
3 years agoAdd 'nvme_root_t' argument to nvme_msg()
Hannes Reinecke [Fri, 28 Jan 2022 13:18:25 +0000 (14:18 +0100)]
Add 'nvme_root_t' argument to nvme_msg()

Add a 'nvme_root_t' argument to nvme_msg() to allow for error
messages to be redirected to a different filedescriptor than
'stderr'.

Signed-off-by: Hannes Reinecke <hare@suse.de>
3 years agoMerge hostname2traddr()
Hannes Reinecke [Fri, 28 Jan 2022 12:42:58 +0000 (13:42 +0100)]
Merge hostname2traddr()

For some reason we have two versions of hostname2traddr().

Signed-off-by: Hannes Reinecke <hare@suse.de>
3 years agoMerge pull request #203 from igaw/fix-error-codes
Hannes Reinecke [Mon, 31 Jan 2022 06:53:31 +0000 (07:53 +0100)]
Merge pull request #203 from igaw/fix-error-codes

Fix error codes

3 years agoutil: Set errno in error case nvme_get_directive_receive_length
Daniel Wagner [Fri, 28 Jan 2022 16:58:40 +0000 (17:58 +0100)]
util: Set errno in error case nvme_get_directive_receive_length

The API says we return -1 in the error case and set the errno
accordingly. Update nvme_get_directive_receive_length
to fulfill the promise.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
3 years agoioctl: Set errno when command args check fails
Daniel Wagner [Fri, 28 Jan 2022 16:52:14 +0000 (17:52 +0100)]
ioctl: Set errno when command args check fails

In error the function is supposed to return -1 and set the errno
accordingly.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
3 years agoMerge pull request #201 from Arunpandian15/types_h_cleanup
Daniel Wagner [Fri, 28 Jan 2022 13:18:15 +0000 (14:18 +0100)]
Merge pull request #201 from Arunpandian15/types_h_cleanup

Clean up Patch for types.h, ioctl.h

3 years agoClean up Patch for types.h, ioctl.h
Arunpandian J [Fri, 28 Jan 2022 11:49:32 +0000 (17:19 +0530)]
Clean up Patch for types.h, ioctl.h

Signed-off-by: Arunpandian J <apj.arun@samsung.com>
3 years agoUpdate README.md
Hannes Reinecke [Fri, 28 Jan 2022 10:44:59 +0000 (11:44 +0100)]
Update README.md

Add documentation on how to build a static library.

3 years agoMerge pull request #196 from hreinecke/rc-cleanup
Hannes Reinecke [Fri, 21 Jan 2022 16:52:07 +0000 (17:52 +0100)]
Merge pull request #196 from hreinecke/rc-cleanup

Cleanups for release candidate

3 years agofabrics: remove documentation for nvmf_add_ctrl_opts()
Hannes Reinecke [Fri, 21 Jan 2022 16:42:21 +0000 (17:42 +0100)]
fabrics: remove documentation for nvmf_add_ctrl_opts()

function is gone, no need for the documentation.

Signed-off-by: Hannes Reinecke <hare@suse.de>
3 years agofabrics: Update prototype documentation
Hannes Reinecke [Fri, 21 Jan 2022 16:28:00 +0000 (17:28 +0100)]
fabrics: Update prototype documentation

Fill out missing bits in the function prototyp documentation.

Signed-off-by: Hannes Reinecke <hare@suse.de>
3 years agofabrics: Remove nvmf_add_ctrl_opts()
Hannes Reinecke [Fri, 21 Jan 2022 16:13:20 +0000 (17:13 +0100)]
fabrics: Remove nvmf_add_ctrl_opts()

Unused, and nvmf_add_ctrl() is doing exactly the same.

Signed-off-by: Hannes Reinecke <hare@suse.de>
3 years agoMerge pull request #195 from hreinecke/disable-sqflow v1.0-rc1
Hannes Reinecke [Fri, 21 Jan 2022 12:53:30 +0000 (13:53 +0100)]
Merge pull request #195 from hreinecke/disable-sqflow

fabrics: kill 'disable_sqflow' argument to nvmf_add_ctrl()

3 years agofabrics: kill 'disable_sqflow' argument to nvmf_add_ctrl()
Hannes Reinecke [Fri, 21 Jan 2022 12:47:20 +0000 (13:47 +0100)]
fabrics: kill 'disable_sqflow' argument to nvmf_add_ctrl()

The 'disable_sqflow' argument to nvmf_add_ctrl() is pointless, as
'struct fabrics_config' is exported and the caller can set it
directly there, without having to involve library functions at all.
And consequently we can also remove nvme_ctrl_disable_sqflow().

Signed-off-by: Hannes Reinecke <hare@suse.de>
3 years agoMerge pull request #194 from hreinecke/ctrl-init
Hannes Reinecke [Fri, 21 Jan 2022 12:00:46 +0000 (13:00 +0100)]
Merge pull request #194 from hreinecke/ctrl-init

tree: only open controller device node if required

3 years agotree: only open controller device node if required
Hannes Reinecke [Fri, 21 Jan 2022 11:53:51 +0000 (12:53 +0100)]
tree: only open controller device node if required

Opening the controller device will fail if the controller is resetting,
so trying to open it during controller initialisation will fail, and
the controller will not displayed correctly.
So only try to open the controller device if required, allowing the
initialisation to continue.

Signed-off-by: Hannes Reinecke <hare@suse.de>
3 years agoMerge pull request #192 from igaw/fix-nvme_get_log_args
Daniel Wagner [Fri, 21 Jan 2022 09:45:58 +0000 (10:45 +0100)]
Merge pull request #192 from igaw/fix-nvme_get_log_args

ioctl: Initialize all members in nvme_get_log_args

3 years agoioctl: Initialize all members in nvme_get_log_args
Daniel Wagner [Fri, 21 Jan 2022 09:39:53 +0000 (10:39 +0100)]
ioctl: Initialize all members in nvme_get_log_args

Commit 781b9105cc43 ("nvme: Add Media Unit Status log page(LID:
0x10)") introduces a new member in nvme_get_log_args. Older compilers
are not happy when we don't initialize all members in the inline
functions.

In file included from ../subprojects/libnvme/src/libnvme.h:19:0,
                 from ../subprojects/libnvme/test/cpp.cc:10:
../subprojects/libnvme/src/nvme/ioctl.h: In function ‘int nvme_get_log_cmd_effects(int, nvme_csi, nvme_cmd_effects_log*)’:
../subprojects/libnvme/src/nvme/ioctl.h:1328:2: sorry, unimplemented: non-trivial designated initializers not supported
  };

Signed-off-by: Daniel Wagner <dwagner@suse.de>
3 years agoMerge pull request #191 from hreinecke/tls
Daniel Wagner [Fri, 21 Jan 2022 09:20:35 +0000 (10:20 +0100)]
Merge pull request #191 from hreinecke/tls

fabrics: add fabrics config option 'tls'

3 years agoMerge pull request #157 from Arunpandian15/Media_Unit_Status_Log_Page
Daniel Wagner [Fri, 21 Jan 2022 09:02:10 +0000 (10:02 +0100)]
Merge pull request #157 from Arunpandian15/Media_Unit_Status_Log_Page

nvme: Add Media Unit Status log page(LID: 0x10)

3 years agofabrics: add fabrics config option 'tls'
Hannes Reinecke [Thu, 20 Jan 2022 14:39:48 +0000 (15:39 +0100)]
fabrics: add fabrics config option 'tls'

Add an option 'tls' to the fabrics config to start TLS encryption
on the connection.

Signed-off-by: Hannes Reinecke <hare@suse.de>
3 years agoMerge pull request #186 from igaw/print-format-specifier
Hannes Reinecke [Thu, 20 Jan 2022 18:47:51 +0000 (19:47 +0100)]
Merge pull request #186 from igaw/print-format-specifier

src: Use PRIu64 format specifier for uint64 types