]> www.infradead.org Git - users/sagi/libnvme.git/log
users/sagi/libnvme.git
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

3 years agoMerge pull request #135 from hreinecke/ctrl-loss-args
Hannes Reinecke [Thu, 20 Jan 2022 15:55:05 +0000 (16:55 +0100)]
Merge pull request #135 from hreinecke/ctrl-loss-args

Fix up handling of '-1' values

3 years agosrc: Use PRIu64 format specifier for uint64 types
Daniel Wagner [Wed, 19 Jan 2022 14:54:50 +0000 (15:54 +0100)]
src: Use PRIu64 format specifier for uint64 types

When compiling for 32bit architectures the compiler is complaining
about the wrong format specifier for uint64. Use the the PRIu64 format
specifier in this case which is supported from 32bit and 64bit.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
3 years agoMerge pull request #185 from martin-belanger/ccan-static-lib
Daniel Wagner [Wed, 19 Jan 2022 13:27:05 +0000 (14:27 +0100)]
Merge pull request #185 from martin-belanger/ccan-static-lib

Define ccan as a static library

3 years agoDefine ccan as a static library
Martin Belanger [Tue, 18 Jan 2022 16:14:14 +0000 (11:14 -0500)]
Define ccan as a static library

ccan gets built as a static library, which gets linked
to libnvme.so.

Signed-off-by: Martin Belanger <martin.belanger@dell.com>
3 years agonvme: Add Media Unit Status log page(LID: 0x10)
Arunpandian J [Wed, 19 Jan 2022 12:44:34 +0000 (18:14 +0530)]
nvme: Add Media Unit Status log page(LID: 0x10)

Reviewed-by: Steven Seungcheol Lee <sc108.lee@samsung.com>
Signed-off-by: Arunpandian J <apj.arun@samsung.com>
3 years agoMerge pull request #164 from sc108-lee/add/flbas_to_lbaf_inuse
Daniel Wagner [Wed, 19 Jan 2022 08:23:58 +0000 (09:23 +0100)]
Merge pull request #164 from sc108-lee/add/flbas_to_lbaf_inuse

util: modify flbas rsvd bits to be used

3 years agoutil: modify flbas rsvd bits to be used
Steven Seungcheol Lee [Wed, 19 Jan 2022 02:47:18 +0000 (11:47 +0900)]
util: modify flbas rsvd bits to be used

flbas Bits 6:5 indicate the most significant 2 bits of
the Format Index of the supported LBA Format indicated
in this data structure that was used to format the namespace

Signed-off-by: Steven Seungcheol Lee <sc108.lee@samsung.com>
3 years agoMerge pull request #183 from igaw/add-missing-stddef
Daniel Wagner [Tue, 18 Jan 2022 08:13:16 +0000 (09:13 +0100)]
Merge pull request #183 from igaw/add-missing-stddef

linux: Include missing stddef.h

3 years agolinux: Include missing stddef.h
Daniel Wagner [Tue, 18 Jan 2022 08:10:11 +0000 (09:10 +0100)]
linux: Include missing stddef.h

The header is not self contained because nvme_get_ana_log_len() is
using the size_t type.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
3 years agoMerge pull request #180 from sc108-lee/fix/ssl
Daniel Wagner [Tue, 18 Jan 2022 08:03:07 +0000 (09:03 +0100)]
Merge pull request #180 from sc108-lee/fix/ssl

meson: ssl version checking allow version >=1.1.0

3 years agomeson: ssl version checking allowed version only
Steven Seungcheol Lee [Mon, 17 Jan 2022 06:27:34 +0000 (15:27 +0900)]
meson: ssl version checking allowed version only

>=1.1.0 & <2.0.0 or >=3.0.0

For lower version of ssl or 2.x, config will be below
define CONFIG_OPENSSL
undef CONFIG_OPENSSL_1
undef CONFIG_OPENSSL_3

so function nvme_gen_dhchap_key is not defined in c file

Signed-off-by: Steven Seungcheol Lee <sc108.lee@samsung.com>
3 years agoMerge pull request #178 from tbzatek/docs-updates-5
Hannes Reinecke [Mon, 17 Jan 2022 09:10:31 +0000 (10:10 +0100)]
Merge pull request #178 from tbzatek/docs-updates-5

Docs strings updates (#5)

3 years agofabrics: do not treat ctrl_loss_tmo values of '-1' as invalid
Hannes Reinecke [Mon, 17 Jan 2022 09:03:34 +0000 (10:03 +0100)]
fabrics: do not treat ctrl_loss_tmo values of '-1' as invalid

'-1' is perfectly valid for ctrl_loss_tmo as it indicates an infinite
timeout.

Signed-off-by: Hannes Reinecke <hare@suse.de>
3 years agoMerge pull request #177 from hreinecke/connect_err
Hannes Reinecke [Mon, 17 Jan 2022 06:47:18 +0000 (07:47 +0100)]
Merge pull request #177 from hreinecke/connect_err

Implement nvme_errno_to_string()

3 years agoImplement nvme_errno_to_string()
Hannes Reinecke [Sun, 16 Jan 2022 09:38:01 +0000 (10:38 +0100)]
Implement nvme_errno_to_string()

Add a function nvme_errno_to_string() to provide a string describing
the error from nvme_add_ctrl().

Signed-off-by: Hannes Reinecke <hare@suse.de>
3 years agotypes: TP8013 and TP8014 doc strings updates
Tomas Bzatek [Sun, 16 Jan 2022 11:34:29 +0000 (12:34 +0100)]
types: TP8013 and TP8014 doc strings updates

Also changed NVMF_DISC_EFLAGS defines into an enum for consistency
with other definitions.

3 years agodocs: Fix a typo in README.md
Tomas Bzatek [Sun, 16 Jan 2022 10:46:44 +0000 (11:46 +0100)]
docs: Fix a typo in README.md

3 years agoMerge pull request #176 from igaw/fix-exports v1.0-rc0
Daniel Wagner [Fri, 14 Jan 2022 17:28:48 +0000 (18:28 +0100)]
Merge pull request #176 from igaw/fix-exports

build: Add __nvme_msg back to exported symbols

3 years agobuild: Add __nvme_msg back to exported symbols
Daniel Wagner [Fri, 14 Jan 2022 17:24:34 +0000 (18:24 +0100)]
build: Add __nvme_msg back to exported symbols

nvme_msg() is a macro which call __nvme_msg(). The naming scheme is
not great but until we figured it out, add it back to the list of
exported symbols.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
3 years agoMerge pull request #175 from igaw/fix-tests
Daniel Wagner [Fri, 14 Jan 2022 16:25:10 +0000 (17:25 +0100)]
Merge pull request #175 from igaw/fix-tests

Fix tests

3 years agotree: Skip invalid pointer when scanning topology
Daniel Wagner [Fri, 14 Jan 2022 16:13:16 +0000 (17:13 +0100)]
tree: Skip invalid pointer when scanning topology

Do not try to dereference a NULL pointer. Just ignore it.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
3 years agoioctl: Set provided timestamp nvme_set_features_timestamp
Daniel Wagner [Fri, 14 Jan 2022 15:59:05 +0000 (16:59 +0100)]
ioctl: Set provided timestamp nvme_set_features_timestamp

The argument order for memcpy is clearly the wrong way around. The
provided timestamp should be stored into the ts variable. The
compiler was warning about ts not being initialized.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
3 years agoMerge pull request #108 from hreinecke/scan-rework
Daniel Wagner [Fri, 14 Jan 2022 15:18:34 +0000 (16:18 +0100)]
Merge pull request #108 from hreinecke/scan-rework

Rework scanning logic

3 years agoMerge pull request #171 from igaw/struct-layout-v2
Daniel Wagner [Fri, 14 Jan 2022 14:33:56 +0000 (15:33 +0100)]
Merge pull request #171 from igaw/struct-layout-v2

Fill holes in ioctl's argument structs (alternative version)

3 years agoMerge pull request #173 from igaw/add-error-codes
Daniel Wagner [Fri, 14 Jan 2022 13:08:33 +0000 (14:08 +0100)]
Merge pull request #173 from igaw/add-error-codes

log: Introduce libnvme error codes

3 years agolog: Introduce libnvme error codes
Daniel Wagner [Fri, 14 Jan 2022 10:10:08 +0000 (11:10 +0100)]
log: Introduce libnvme error codes

Add libnvme specific error codes which map to a specific error
message. The system error codes in errno are too overloaded to figure
out what is going wrong.

With this we can remove the nvme_log_message buffer. This avoids
having a global library buffer.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
3 years agoioctl: Rearrange members in nvme_zns_append_args
Daniel Wagner [Thu, 13 Jan 2022 18:09:35 +0000 (19:09 +0100)]
ioctl: Rearrange members in nvme_zns_append_args

Avoid any holes in the struct by rearranging the members. Also add the
attribute packed to struct definition to reduce ABI breakage.

struct nvme_zns_append_args {
        int                        args_size;            /*     0     4 */
        int                        fd;                   /*     4     4 */
        __u64 *                    result;               /*     8     8 */
        __u32                      timeout;              /*    16     4 */
        __u32                      nsid;                 /*    20     4 */
        __u64                      zslba;                /*    24     8 */
        __u16                      nlb;                  /*    32     2 */
        __u16                      control;              /*    34     2 */
        __u32                      ilbrt;                /*    36     4 */
        __u16                      lbat;                 /*    40     2 */
        __u16                      lbatm;                /*    42     2 */
        __u32                      data_len;             /*    44     4 */
        void *                     data;                 /*    48     8 */
        void *                     metadata;             /*    56     8 */
        /* --- cacheline 1 boundary (64 bytes) --- */
        __u32                      metadata_len;         /*    64     4 */

        /* size: 72, cachelines: 2, members: 15 */
        /* padding: 4 */
        /* last cacheline: 8 bytes */
} __attribute__((__aligned__(8)));

Signed-off-by: Daniel Wagner <dwagner@suse.de>
3 years agoioctl: Rearrange members in nvme_zns_mgmt_recv_args
Daniel Wagner [Thu, 13 Jan 2022 18:07:18 +0000 (19:07 +0100)]
ioctl: Rearrange members in nvme_zns_mgmt_recv_args

Avoid any holes in the struct by rearranging the members. Also add the
attribute packed to struct definition to reduce ABI breakage.

struct nvme_zns_mgmt_recv_args {
        int                        args_size;            /*     0     4 */
        int                        fd;                   /*     4     4 */
        __u32 *                    result;               /*     8     8 */
        __u32                      timeout;              /*    16     4 */
        __u32                      nsid;                 /*    20     4 */
        __u64                      slba;                 /*    24     8 */
        enum nvme_zns_recv_action  zra;                  /*    32     4 */
        __u32                      data_len;             /*    36     4 */
        void *                     data;                 /*    40     8 */
        __u16                      zrasf;                /*    48     2 */
        _Bool                      zras_feat;            /*    50     1 */

        /* size: 56, cachelines: 1, members: 11 */
        /* padding: 5 */
        /* last cacheline: 56 bytes */
} __attribute__((__aligned__(8)));

Signed-off-by: Daniel Wagner <dwagner@suse.de>
3 years agoioctl: Rearrange members in nvme_zns_mgmt_send_args
Daniel Wagner [Thu, 13 Jan 2022 18:04:09 +0000 (19:04 +0100)]
ioctl: Rearrange members in nvme_zns_mgmt_send_args

Avoid any holes in the struct by rearranging the members. Also add the
attribute packed to struct definition to reduce ABI breakage.

struct nvme_zns_mgmt_send_args {
        int                        args_size;            /*     0     4 */
        int                        fd;                   /*     4     4 */
        __u32 *                    result;               /*     8     8 */
        __u32                      timeout;              /*    16     4 */
        __u32                      nsid;                 /*    20     4 */
        __u64                      slba;                 /*    24     8 */
        enum nvme_zns_send_action  zsa;                  /*    32     4 */
        __u32                      data_len;             /*    36     4 */
        void *                     data;                 /*    40     8 */
        _Bool                      select_all;           /*    48     1 */
        __u8                       zsaso;                /*    49     1 */

        /* size: 56, cachelines: 1, members: 11 */
        /* padding: 6 */
        /* last cacheline: 56 bytes */
} __attribute__((__aligned__(8)));

Signed-off-by: Daniel Wagner <dwagner@suse.de>
3 years agoioctl: Rearrange members in nvme_resv_report_args
Daniel Wagner [Thu, 13 Jan 2022 18:01:48 +0000 (19:01 +0100)]
ioctl: Rearrange members in nvme_resv_report_args

Avoid any holes in the struct by rearranging the members. Also add the
attribute packed to struct definition to reduce ABI breakage.

struct nvme_resv_report_args {
        int                        args_size;            /*     0     4 */
        int                        fd;                   /*     4     4 */
        __u32 *                    result;               /*     8     8 */
        __u32                      timeout;              /*    16     4 */
        __u32                      nsid;                 /*    20     4 */
        struct nvme_resv_status *  report;               /*    24     8 */
        __u32                      len;                  /*    32     4 */
        _Bool                      eds;                  /*    36     1 */

        /* size: 40, cachelines: 1, members: 8 */
        /* padding: 3 */
        /* last cacheline: 40 bytes */
} __attribute__((__aligned__(8)));

Signed-off-by: Daniel Wagner <dwagner@suse.de>
3 years agoioctl: Rearrange members in nvme_resv_release_args
Daniel Wagner [Thu, 13 Jan 2022 17:57:44 +0000 (18:57 +0100)]
ioctl: Rearrange members in nvme_resv_release_args

Avoid any holes in the struct by rearranging the members. Also add the
attribute packed to struct definition to reduce ABI breakage.

struct nvme_resv_release_args {
        int                        args_size;            /*     0     4 */
        int                        fd;                   /*     4     4 */
        __u32 *                    result;               /*     8     8 */
        __u32                      timeout;              /*    16     4 */
        __u32                      nsid;                 /*    20     4 */
        enum nvme_resv_rtype       rtype;                /*    24     4 */
        enum nvme_resv_rrela       rrela;                /*    28     4 */
        __u64                      crkey;                /*    32     8 */
        _Bool                      iekey;                /*    40     1 */

        /* size: 48, cachelines: 1, members: 9 */
        /* padding: 7 */
        /* last cacheline: 48 bytes */
} __attribute__((__aligned__(8)));

Signed-off-by: Daniel Wagner <dwagner@suse.de>
3 years agoioctl: Rearrange members in nvme_resv_register_args
Daniel Wagner [Thu, 13 Jan 2022 17:56:22 +0000 (18:56 +0100)]
ioctl: Rearrange members in nvme_resv_register_args

Avoid any holes in the struct by rearranging the members. Also add the
attribute packed to struct definition to reduce ABI breakage.

struct nvme_resv_register_args {
        int                        args_size;            /*     0     4 */
        int                        fd;                   /*     4     4 */
        __u32 *                    result;               /*     8     8 */
        __u32                      timeout;              /*    16     4 */
        __u32                      nsid;                 /*    20     4 */
        enum nvme_resv_rrega       rrega;                /*    24     4 */
        enum nvme_resv_cptpl       cptpl;                /*    28     4 */
        __u64                      crkey;                /*    32     8 */
        __u64                      nrkey;                /*    40     8 */
        _Bool                      iekey;                /*    48     1 */

        /* size: 56, cachelines: 1, members: 10 */
        /* padding: 7 */
        /* last cacheline: 56 bytes */
} __attribute__((__aligned__(8)));

Signed-off-by: Daniel Wagner <dwagner@suse.de>
3 years agoioctl: Rearrange members in nvme_resv_acquire_args
Daniel Wagner [Thu, 13 Jan 2022 17:54:43 +0000 (18:54 +0100)]
ioctl: Rearrange members in nvme_resv_acquire_args

Avoid any holes in the struct by rearranging the members. Also add the
attribute packed to struct definition to reduce ABI breakage.

struct nvme_resv_acquire_args {
        int                        args_size;            /*     0     4 */
        int                        fd;                   /*     4     4 */
        __u32 *                    result;               /*     8     8 */
        __u32                      timeout;              /*    16     4 */
        __u32                      nsid;                 /*    20     4 */
        enum nvme_resv_rtype       rtype;                /*    24     4 */
        enum nvme_resv_racqa       racqa;                /*    28     4 */
        __u64                      crkey;                /*    32     8 */
        __u64                      nrkey;                /*    40     8 */
        _Bool                      iekey;                /*    48     1 */

        /* size: 56, cachelines: 1, members: 10 */
        /* padding: 7 */
        /* last cacheline: 56 bytes */
} __attribute__((__aligned__(8)));

Signed-off-by: Daniel Wagner <dwagner@suse.de>