]> www.infradead.org Git - users/sagi/libnvme.git/log
users/sagi/libnvme.git
2 years agofabrics: Add new TP8010 definitions
Martin Belanger [Thu, 22 Sep 2022 15:59:17 +0000 (11:59 -0400)]
fabrics: Add new TP8010 definitions

Signed-off-by: Martin Belanger <martin.belanger@dell.com>
2 years agoMerge pull request #473 from martin-belanger/add-lsp-to-get-dlp4
Daniel Wagner [Thu, 22 Sep 2022 09:59:44 +0000 (11:59 +0200)]
Merge pull request #473 from martin-belanger/add-lsp-to-get-dlp4

examples: Add missing free()

2 years agoexamples: Add missing free()
Martin Belanger [Wed, 21 Sep 2022 18:01:26 +0000 (14:01 -0400)]
examples: Add missing free()

Signed-off-by: Martin Belanger <martin.belanger@dell.com>
2 years agoMerge pull request #470 from linux-nvme/dependabot/github_actions/actions/checkout-3
Daniel Wagner [Mon, 12 Sep 2022 07:45:42 +0000 (09:45 +0200)]
Merge pull request #470 from linux-nvme/dependabot/github_actions/actions/checkout-3

build(deps): bump actions/checkout from 2 to 3

2 years agomi: Fix C++ compiler errors
Hao Jiang [Wed, 7 Sep 2022 22:32:24 +0000 (15:32 -0700)]
mi: Fix C++ compiler errors

C++20 compiler reported the following errors:

  error: invalid conversion from 'int' to 'nvme_mi_config_smbus_freq'
  error: designator order for field 'nvme_ns_mgmt_args::nsid' does not match declaration order in 'nvme_ns_mgmt_args'

Signed-off-by: Hao Jiang <jianghao@google.com>
2 years agobuild(deps): bump actions/checkout from 2 to 3
dependabot[bot] [Mon, 12 Sep 2022 02:17:16 +0000 (02:17 +0000)]
build(deps): bump actions/checkout from 2 to 3

Bumps [actions/checkout](https://github.com/actions/checkout) from 2 to 3.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v2...v3)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2 years agoMerge pull request #469 from CodeConstruct/action-warn-fix
Daniel Wagner [Fri, 9 Sep 2022 11:11:16 +0000 (13:11 +0200)]
Merge pull request #469 from CodeConstruct/action-warn-fix

examples/mi-mctp: fix warning for possibly uninitialised variable

2 years agoexamples/mi-mctp: fix warning for possibly uninitialised variable
Jeremy Kerr [Fri, 9 Sep 2022 10:10:10 +0000 (18:10 +0800)]
examples/mi-mctp: fix warning for possibly uninitialised variable

gcc-12 with -Wuninitialized-var reports a warning for mi-mctp:

    examples/mi-mctp.c: In function ‘do_action_endpoint’:
    examples/mi-mctp.c:665:16: warning: ‘rc’ may be used uninitialized [-Wmaybe-uninitialized]
      665 |         return rc;
          |                ^~
    examples/mi-mctp.c:637:13: note: ‘rc’ was declared here
      637 |         int rc;
          |             ^~

We shouldn't be able to hit this path, but explicitly set rc to an error
if we miss an enum case.

Fixes: https://github.com/linux-nvme/libnvme/issues/467
Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
2 years agoMerge pull request #465 from martin-gpy/update_schema
Daniel Wagner [Wed, 7 Sep 2022 10:19:47 +0000 (12:19 +0200)]
Merge pull request #465 from martin-gpy/update_schema

json-schema: add dhchap_key details to host section

2 years agojson-schema: add dhchap_key details to host section
Martin George [Wed, 7 Sep 2022 08:54:05 +0000 (14:24 +0530)]
json-schema: add dhchap_key details to host section

One can set the dhchap_key in the host section as well of
the config JSON file. So update the JSON schema to reflect
the same.

Signed-off-by: Martin George <marting@netapp.com>
2 years agodocs: Relax regex in identifier match in list-man-pages.sh
Daniel Wagner [Fri, 2 Sep 2022 06:24:35 +0000 (08:24 +0200)]
docs: Relax regex in identifier match in list-man-pages.sh

Function, struct and enum identifiers are allowed to have digits in
their name, just not as first character. Relax the regex accordingly.

Reported-by: Lee Duncan <lduncan@suse.com>
Signed-off-by: Daniel Wagner <dwagner@suse.de>
2 years agoMerge pull request #464 from igaw/fix-man-page-dir
Daniel Wagner [Tue, 30 Aug 2022 15:24:47 +0000 (17:24 +0200)]
Merge pull request #464 from igaw/fix-man-page-dir

doc: Install pre-compiled man pages to the correct path

2 years agodoc: Install pre-compiled man pages to the correct path
Daniel Wagner [Tue, 30 Aug 2022 14:03:56 +0000 (16:03 +0200)]
doc: Install pre-compiled man pages to the correct path

The install_subdir('man', ...) command installs the man pages under
$mandir/man/ instead of $mandir. Use and external script to get the
list of man pages to avoid having to list all the man pages
explicitly.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
2 years agoMerge pull request #463 from martin-gpy/authkey_unavailable_segfault
Daniel Wagner [Tue, 30 Aug 2022 12:22:44 +0000 (14:22 +0200)]
Merge pull request #463 from martin-gpy/authkey_unavailable_segfault

nvme-tree: avoid segfault if auth keys are unavailable

2 years agonvme-tree: avoid segfault if auth keys are unavailable
Martin George [Fri, 26 Aug 2022 13:17:57 +0000 (18:47 +0530)]
nvme-tree: avoid segfault if auth keys are unavailable

Seeing multiple segfaults in nvme_configure_ctrl() when the
respective controller attributes (including auth keys) are
unavailable. For e.g. attempting a nvme connect with bidirectional
auth hits the following segfault:

nvme connect -t tcp -w 192.168.1.16 -a 192.168.1.116 -n
nqn.1992-08.com.netapp:sn.48391d66c0a611ecaaa5d039ea165514:subsystem.subsys_CLIENT116
-S DHHC-1:01:k+fO3MFyRpOwrPTUQh0ewZI58uf8bwn5H9RnHle4Q8U37aJe:
-C DHHC-1:03:KEVxLQLJxugDXw/tWm9VmZuas38ath9HWzpq+cDprHafC4yuVg+McEQgEltOJAIIziNfWWKaw8mpPrnSQqqQuHKE5zQ=:
Segmentation fault (core dumped)

In another instance, a segfault is seen if no keys are specified
in the nvme connect:

nvme connect -t tcp -w 192.168.1.16 -a 192.168.1.116
-n nqn.1992-08.com.netapp:sn.48391d66c0a611ecaaa5d039ea165514:subsystem.subsys_CLIENT116
Segmentation fault (core dumped)

Avoid these segfaults by checking if the respective controller attributes
(including auth keys) are available before dereferencing them.

Fixes: 6614a55 ("Parse dhchap_host_key at controller level")
Signed-off-by: Martin George <marting@netapp.com>
2 years agoMerge pull request #461 from hreinecke/dhchap-templating.v2
Daniel Wagner [Thu, 25 Aug 2022 15:10:22 +0000 (17:10 +0200)]
Merge pull request #461 from hreinecke/dhchap-templating.v2

Allow to get and set DHCHAP host key on controller level

2 years agoMerge pull request #460 from CodeConstruct/mpr
Daniel Wagner [Thu, 25 Aug 2022 11:44:36 +0000 (13:44 +0200)]
Merge pull request #460 from CodeConstruct/mpr

mi: Allow Admin-message sized More Processing Required responses

2 years agoUpdate json config schema for missing dhchap host key
Hannes Reinecke [Thu, 25 Aug 2022 08:35:53 +0000 (10:35 +0200)]
Update json config schema for missing dhchap host key

The dhchap key definition for the host was missing.

Signed-off-by: Hannes Reinecke <hare@suse.de>
2 years agoParse dhchap_host_key on controller level
Hannes Reinecke [Thu, 25 Aug 2022 08:27:02 +0000 (10:27 +0200)]
Parse dhchap_host_key on controller level

The json config schema declares an 'dhchap_key' element representing
the dhchap host key on the controller level, but the implementation
was missing. Add the missing parsing elements and ensure to pick the
correct one (either host or controller setting) when creating the
nvme connect string.

Signed-off-by: Hannes Reinecke <hare@suse.de>
2 years agotree: rename controller 'dhchap_key' to 'dhchap_ctrl_key'
Hannes Reinecke [Thu, 28 Jul 2022 16:19:41 +0000 (18:19 +0200)]
tree: rename controller 'dhchap_key' to 'dhchap_ctrl_key'

To differentiate between 'host' and 'controller' keys within
the controller structure.

Signed-off-by: Hannes Reinecke <hare@suse.de>
2 years agolibnvme: accessors for dhchap_key variables
Hannes Reinecke [Thu, 28 Jul 2022 16:12:07 +0000 (18:12 +0200)]
libnvme: accessors for dhchap_key variables

To insulate against changes with the dhchap key handling
in the library itself introduce accessor functions for the
SWIG wrapper.

Signed-off-by: Hannes Reinecke <hare@suse.de>
2 years agomi: Allow Admin-message sized More Processing Required responses
Jeremy Kerr [Fri, 12 Aug 2022 04:44:50 +0000 (12:44 +0800)]
mi: Allow Admin-message sized More Processing Required responses

Devices may implement their MPR response as an actual Admin response
message, rather than the simple MI-only message described in 4.1.2.3 of
NVMe-MI v1.2b.

Allow this, but with some fairly stringent header checks. Add a test for
this behaviour too.

Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
2 years agoMerge pull request #458 from CodeConstruct/mi-mtu-conf
Daniel Wagner [Wed, 17 Aug 2022 06:20:30 +0000 (08:20 +0200)]
Merge pull request #458 from CodeConstruct/mi-mtu-conf

example/mi-conf: Add an example for MI transport configuration

2 years agoexample/mi-conf: Add an example for MI transport configuration
Jeremy Kerr [Thu, 21 Jul 2022 08:21:30 +0000 (16:21 +0800)]
example/mi-conf: Add an example for MI transport configuration

With the Read MI Data Structure and MI Configuration Set functions
available, we can query a device for its maximum MTU, and update the
current MTU to suit.

This also requires telling the local MCTP stack about the new MTU too,
by sending a d-bus message to `mctpd`.

This change adds a little example for this functionality, where we
perform the MI query and configuration, and implements the d-bus
communication for the local stack control.

Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
2 years agoMerge pull request #457 from CodeConstruct/mi+admin
Daniel Wagner [Tue, 16 Aug 2022 06:59:33 +0000 (08:59 +0200)]
Merge pull request #457 from CodeConstruct/mi+admin

MI: expand admin command implementation

2 years agomi: Add Get Log Page helpers
Jeremy Kerr [Wed, 20 Jul 2022 03:54:48 +0000 (11:54 +0800)]
mi: Add Get Log Page helpers

This change adds a few helpers for the Get Log Page command, as the
usual inlines in mi.h. These mirror the ioctl-based definitions.

Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
2 years agomi: Implement Sanitize command
Jeremy Kerr [Wed, 20 Jul 2022 02:29:15 +0000 (10:29 +0800)]
mi: Implement Sanitize command

Add support for the Sanitize command, using the existing
struct nvme_sanitize_nvm_args argument format.

Include a test for the cdw10/cdw11 message encoding.

Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
2 years agomi: Implement Format NVM command
Jeremy Kerr [Tue, 19 Jul 2022 09:47:04 +0000 (17:47 +0800)]
mi: Implement Format NVM command

Add support for the Format NVM command, using the existing
struct nvme_format_nvm_args, plus a small test.

Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
2 years agomi: Implement NS attach command and helpers
Jeremy Kerr [Tue, 19 Jul 2022 08:55:40 +0000 (16:55 +0800)]
mi: Implement NS attach command and helpers

This change adds support for the NVMe Namespace Attach Admin command:

    nvme_mi_admin_ns_attach

plus a couple of helpers for constructing the attach and detach args:

    nvme_mi_admin_ns_attach_ctrls
    nvme_mi_admin_ns_detach_ctrls

Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
2 years agomi: Implement Namespace Management command and create/delete helpers
Jeremy Kerr [Wed, 8 Jun 2022 08:40:20 +0000 (16:40 +0800)]
mi: Implement Namespace Management command and create/delete helpers

This change adds a function for the base Namespace Management command:

    nvme_mi_admin_ns_mgmt(...)

And helpers for the create and delete actions.

Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
2 years agomi: Add identify helper for nsid-capable Controller List
Jeremy Kerr [Tue, 19 Jul 2022 06:23:13 +0000 (14:23 +0800)]
mi: Add identify helper for nsid-capable Controller List

Add an Identify command helper, similar to the controller list, to query
a controller list for a specific namespace ID.

Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
2 years agomi: Add identify helpers for namespaces
Jeremy Kerr [Thu, 14 Jul 2022 07:18:51 +0000 (15:18 +0800)]
mi: Add identify helpers for namespaces

This change adds Identify command helpers for the active and allocated
namespace, allowing query of a struct nvme_id_ns for each namespace.

Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
2 years agomi: Add identify helpers for namespace lists
Jeremy Kerr [Wed, 8 Jun 2022 07:20:38 +0000 (15:20 +0800)]
mi: Add identify helpers for namespace lists

This change implements the Identify command helper for the active
and allocated namespace lists.

Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
2 years agomi: Implement Get & Set Features Admin commands
Jeremy Kerr [Wed, 8 Jun 2022 04:03:12 +0000 (12:03 +0800)]
mi: Implement Get & Set Features Admin commands

This change adds a new MI Admin functions:

 nvme_mi_admin_get_features()
 nvme_mi_admin_set_features()

And a couple of helpers:

 nvme_mi_admin_get_features_data()
 nvme_mi_admin_get_features_simple()

These using the existing _args definitions, in a similar pattern to the
direct ioctl API.

Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
2 years agobuild: Extend release script to support micro version releases
Daniel Wagner [Mon, 1 Aug 2022 15:14:49 +0000 (17:14 +0200)]
build: Extend release script to support micro version releases

In case we need to fix up a a maj.min release extend the release
script to accept x.y.z version strings.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
2 years agoMerge pull request #453 from igaw/add-line-max-define
Daniel Wagner [Thu, 11 Aug 2022 09:06:36 +0000 (11:06 +0200)]
Merge pull request #453 from igaw/add-line-max-define

util: Add LINE_MAX define

2 years agoutil: Add LINE_MAX define
Daniel Wagner [Wed, 3 Aug 2022 11:56:48 +0000 (13:56 +0200)]
util: Add LINE_MAX define

The bionic libc implementation doesn't implement the complete
POSIX API. Apperantly we just need this define to be able
to compile for Android OS. Thus, keep it as simple as possible
and just define it here.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
2 years agoMerge pull request #433 from igaw/build-support-pypi-rc-uploads
Daniel Wagner [Mon, 1 Aug 2022 12:53:51 +0000 (14:53 +0200)]
Merge pull request #433 from igaw/build-support-pypi-rc-uploads

Add support for uploading release candidates to PyPI

2 years agoRegenerate all documentation v1.1
Daniel Wagner [Mon, 1 Aug 2022 12:45:26 +0000 (14:45 +0200)]
Regenerate all documentation

Regenerate documentation for v1.1 release

Signed-off-by: Daniel Wagner <dwagner@suse.de>
2 years agoMerge pull request #450 from hreinecke/json-sync
Daniel Wagner [Mon, 1 Aug 2022 12:08:48 +0000 (14:08 +0200)]
Merge pull request #450 from hreinecke/json-sync

json: fixup dhchap_ctrl_key definitions

2 years agoMerge pull request #449 from tbzatek/errno-fixes-2
Daniel Wagner [Mon, 1 Aug 2022 11:34:05 +0000 (13:34 +0200)]
Merge pull request #449 from tbzatek/errno-fixes-2

fabrics: Fix build_options() return values

2 years agojson: fixup dhchap_ctrl_key definitions
Hannes Reinecke [Fri, 29 Jul 2022 06:14:14 +0000 (08:14 +0200)]
json: fixup dhchap_ctrl_key definitions

The config schema declared a 'dhchap_key' and a 'dhchap_ctrl_key'
value for the port structure, but the json parser implemented a
'dhchap_key' entry for the port (holding the controller key), and
a 'dhchap_key' entry for the host (holding the host key).
Fixup the config schema to declared the correct entries and the
json parser to check for 'dhchap_ctrl_key' instead of 'dhchap_key'.

Signed-off-by: Hannes Reinecke <hare@suse.de>
2 years agofabrics: Fix build_options() return values
Tomas Bzatek [Thu, 28 Jul 2022 16:41:15 +0000 (18:41 +0200)]
fabrics: Fix build_options() return values

Make the returned error values consistent with the rest of the code.

3 years agoMerge pull request #442 from ismaell/posix
Daniel Wagner [Mon, 25 Jul 2022 17:01:39 +0000 (19:01 +0200)]
Merge pull request #442 from ismaell/posix

Fix poll.h includes

3 years agoMerge pull request #440 from igaw/fix-rae-users
Daniel Wagner [Mon, 25 Jul 2022 16:57:25 +0000 (18:57 +0200)]
Merge pull request #440 from igaw/fix-rae-users

ioctl: Honor rae in nvme_get_nsid_log

3 years agoMerge pull request #443 from martin-gpy/dump_output
Daniel Wagner [Sat, 23 Jul 2022 11:24:50 +0000 (13:24 +0200)]
Merge pull request #443 from martin-gpy/dump_output

fabrics: sanitize dump-config output

3 years agofabrics: sanitize dump-config output
Martin George [Fri, 22 Jul 2022 16:47:43 +0000 (22:17 +0530)]
fabrics: sanitize dump-config output

Trivial fix to sanitize the dump-config output by appending a
new line at the end.

Signed-off-by: Martin George <marting@netapp.com>
Signed-off-by: Daniel Wagner <dwagner@suse.de>
3 years agoFix poll.h includes
Ismael Luceno [Mon, 18 Jul 2022 16:43:20 +0000 (18:43 +0200)]
Fix poll.h includes

According to POSIX it's <poll.h> since before the Linux era.

Signed-off-by: Ismael Luceno <ismael@iodev.co.uk>
3 years agoMerge pull request #441 from igaw/drop-nostdinc-libressl
Daniel Wagner [Fri, 22 Jul 2022 13:39:50 +0000 (15:39 +0200)]
Merge pull request #441 from igaw/drop-nostdinc-libressl

build: Drop -nostdinc for LibreSSL header checks

3 years agobuild: Drop -nostdinc for LibreSSL header checks
Daniel Wagner [Fri, 22 Jul 2022 13:30:31 +0000 (15:30 +0200)]
build: Drop -nostdinc for LibreSSL header checks

-nostdinc is only necessary when the LibreSSL is not the default SSL
library on the system and OpenSSL header files are present in the
default include paths.

Though if LibreSSL found in standard paths 'pkg-config --cflags' will
include the standard include paths and hence the header files are not
found.

So -nostdinc is only useful for mixed installations which is very
unlikely a very common setup. So let's just drop the -nostdinc and if
the need is to support such setups, we can still try to figure out
how to support this.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
3 years agoioctl: Honor rae in nvme_get_nsid_log
Daniel Wagner [Fri, 22 Jul 2022 12:29:48 +0000 (14:29 +0200)]
ioctl: Honor rae in nvme_get_nsid_log

The nvme_get_nsid_log() helper has a rae (Retain Asynchronous Events)
parameter, but we currently ignore this when constructing the Get Log
Page command arguments.

This is a behavior change and not an API change. But the good thing is
only for newly build binaries because all helpers are static inline
fuctions.

Reported-by: Reported-by: Jeremy Kerr <jk@codeconstruct.com.au>
Signed-off-by: Daniel Wagner <dwagner@suse.de>
3 years agoMerge pull request #439 from igaw/add-libressl-support
Daniel Wagner [Fri, 22 Jul 2022 12:02:17 +0000 (14:02 +0200)]
Merge pull request #439 from igaw/add-libressl-support

build: Add support to build against LibreSSL

3 years agobuild: Add support to build against LibreSSL
Daniel Wagner [Fri, 22 Jul 2022 11:43:10 +0000 (13:43 +0200)]
build: Add support to build against LibreSSL

LibreSSL ships with the same API but has a different version number
scheme. That is LibreSSL 3.x is not providing the OpenSSL 3.x
APIs. Hence we need to test if the OpenSSL 3 APIs are available if
LibreSSL is present.

Reported-by: Ismael Luceno <ismael@linux.com>
Signed-off-by: Daniel Wagner <dwagner@suse.de>
3 years agoMerge pull request #414 from sc108-lee/rpm
Daniel Wagner [Wed, 20 Jul 2022 12:52:57 +0000 (14:52 +0200)]
Merge pull request #414 from sc108-lee/rpm

rpmbuild: Enable 'make rpm' to build rpm pkgs #408

3 years agoMerge pull request #436 from CodeConstruct/mi-glp
Daniel Wagner [Wed, 20 Jul 2022 12:21:36 +0000 (14:21 +0200)]
Merge pull request #436 from CodeConstruct/mi-glp

mi: unify MI Get Log Page function with ioctl API

3 years agoMerge pull request #435 from martin-belanger/add-missing-attrs-to-python
Daniel Wagner [Wed, 20 Jul 2022 12:12:56 +0000 (14:12 +0200)]
Merge pull request #435 from martin-belanger/add-missing-attrs-to-python

python: add missing ctrl attrs to Python bindings

3 years agorpmbuild: Enable 'make rpm' to build rpm pkgs #408
Steven Seungcheol Lee [Mon, 4 Jul 2022 05:31:46 +0000 (14:31 +0900)]
rpmbuild: Enable 'make rpm' to build rpm pkgs #408

- meson is needed higher version then what rpm repo offering (use pip install)
- Enable building static library (default: shared)
- Add gitignore since make rpm generates tar.gz (when it is failed)
- libuuid-devel dose not needed as rpm pkgs
    it could be installed as some files
    if it's not installed, will be downloaded from subprojects of meson
- gcc does not needed as rpm pkgs
    meson detect compiler with meson.get_compiler('c')

error: Failed build dependencies:
gcc is needed by libnvme-1.0-0.x86_64
libuuid-devel is needed by libnvme-1.0-0.x86_64
Makefile:43: recipe for target 'rpm' failed
make: *** [rpm] Error 1

Signed-off-by: Steven Seungcheol Lee <sc108.lee@samsung.com>
3 years agomi: unify MI Get Log Page function with ioctl API
Jeremy Kerr [Wed, 20 Jul 2022 02:32:18 +0000 (10:32 +0800)]
mi: unify MI Get Log Page function with ioctl API

In the MI interface, we currently have:

  nvme_mi_admin_get_log_page(...)

However, the ioctl-backed API equivalent doesn't use the _page:

  nvme_get_log(...)

This change makes the MI version consistent, where we have the
equivalent names, just with the mi_<type> prefix:

   nvme_mi_admin_get_log(...)

Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
3 years agopython: add missing ctrl attrs to Python bindings
Martin Belanger [Tue, 19 Jul 2022 17:15:34 +0000 (13:15 -0400)]
python: add missing ctrl attrs to Python bindings

Some controller attributes were missing from the Python bindings.
For example: dctype, cntrltype, etc.

Signed-off-by: Martin Belanger <martin.belanger@dell.com>
3 years agobuild: Update version before regenerating docs
Daniel Wagner [Mon, 18 Jul 2022 14:37:29 +0000 (16:37 +0200)]
build: Update version before regenerating docs

The docs contain the version string. Let's set new version before
regenerating the documentation to keep it consistent.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
3 years agobuild: Update release version rules
Daniel Wagner [Mon, 18 Jul 2022 14:08:38 +0000 (16:08 +0200)]
build: Update release version rules

Include the release candidate version string into the project
version. This allows to upload every release candidate to PyPI instead
just the final release.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
3 years agobuild: Support release candidate version strings
Daniel Wagner [Mon, 18 Jul 2022 14:06:29 +0000 (16:06 +0200)]
build: Support release candidate version strings

The library_version is constructed from the project_version() which
might be a release candidate version. Let's strip away the release
candidate for the library versioning.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
3 years agoworkflow: Only publish proper releases to PyPI
Daniel Wagner [Mon, 18 Jul 2022 13:26:32 +0000 (15:26 +0200)]
workflow: Only publish proper releases to PyPI

Match the tag name against the release only sematic versioning regex
for the PyPI upload build step.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
3 years agoMerge pull request #432 from CodeConstruct/mi-timeout
Daniel Wagner [Mon, 18 Jul 2022 11:33:32 +0000 (13:33 +0200)]
Merge pull request #432 from CodeConstruct/mi-timeout

MI: add command timeouts

3 years agomi-mctp: Add timeout support to MCTP transport
Jeremy Kerr [Mon, 18 Jul 2022 06:37:21 +0000 (14:37 +0800)]
mi-mctp: Add timeout support to MCTP transport

Now that we have timeout values in the endpoint, implement a per-command
timeout using poll(), and clamp the maximum MPR time.

Add tests to suit.

Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
3 years agomi: Add maximum More Processing Required limit API
Jeremy Kerr [Mon, 18 Jul 2022 06:33:58 +0000 (14:33 +0800)]
mi: Add maximum More Processing Required limit API

This change adds a function to set the maximum time we're prepared to
wait for a response after a More Processing Required message.

Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
3 years agomi: Add endpoint get/set timeout API
Jeremy Kerr [Mon, 18 Jul 2022 05:10:57 +0000 (13:10 +0800)]
mi: Add endpoint get/set timeout API

This change introduces an API for querying and modifying the endpoint
timeout. Transports may provide a function for valiating a new timeout
value before setting.

Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
3 years agoRelease v1.1-rc0 v1.1-rc0
Daniel Wagner [Thu, 14 Jul 2022 12:47:51 +0000 (14:47 +0200)]
Release v1.1-rc0

Signed-off-by: Daniel Wagner <dwagner@suse.de>
3 years agoRegenerate all documentation
Daniel Wagner [Thu, 14 Jul 2022 12:47:51 +0000 (14:47 +0200)]
Regenerate all documentation

Regenerate documentation for v1.1-rc0 release

Signed-off-by: Daniel Wagner <dwagner@suse.de>
3 years agoMerge pull request #428 from igaw/fix-doc-build
Daniel Wagner [Thu, 14 Jul 2022 11:53:39 +0000 (13:53 +0200)]
Merge pull request #428 from igaw/fix-doc-build

Fix doc build

3 years agoMerge pull request #427 from CodeConstruct/docs
Daniel Wagner [Thu, 14 Jul 2022 11:50:26 +0000 (13:50 +0200)]
Merge pull request #427 from CodeConstruct/docs

doc: Use correct variable in configure_file input

3 years agodoc: Use correct variable in configure_file input
Jeremy Kerr [Thu, 14 Jul 2022 10:18:54 +0000 (18:18 +0800)]
doc: Use correct variable in configure_file input

In e33cc17 we removed an inner loop on the result of files(), but didn't
update the local variable to suit.

This change uses the correct iterator variable for the configure_file()
invocation.

Reported-by: Daniel Wagner <dwagner@suse.de>
Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
3 years agobuild: Explicitly check return values when using run_command
Daniel Wagner [Thu, 14 Jul 2022 10:05:00 +0000 (12:05 +0200)]
build: Explicitly check return values when using run_command

meson warns about not providing explicitly the check argument.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
3 years agoMerge pull request #423 from martin-belanger/eflag-3
Daniel Wagner [Tue, 12 Jul 2022 09:40:35 +0000 (11:40 +0200)]
Merge pull request #423 from martin-belanger/eflag-3

python: add __version__ to libnvme python package

3 years agopython: add __version__ to libnvme python package
Martin Belanger [Mon, 11 Jul 2022 12:28:27 +0000 (08:28 -0400)]
python: add __version__ to libnvme python package

It is customary for Python packages to provide a __version__ attribute.

It's not enough just to copy the files to the build directory, we need
also to run the configure step.

Signed-off-by: Martin Belanger <martin.belanger@dell.com>
[dwagner: Added information why meson.build has to be changed]
Singed-off-by: Daniel Wagner <dwagner@suse.de>
3 years agoMerge pull request #424 from igaw/add-release-script
Daniel Wagner [Tue, 12 Jul 2022 09:19:42 +0000 (11:19 +0200)]
Merge pull request #424 from igaw/add-release-script

Add release script

3 years agobuild: Add release automation script
Daniel Wagner [Fri, 8 Jul 2022 14:49:05 +0000 (16:49 +0200)]
build: Add release automation script

Add a script for generating a release.

Note, meson's project version is updated only once, either at the
begin of a RC phase or directly when there was no RC.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
3 years agoMerge pull request #416 from CodeConstruct/kdoc-test
Daniel Wagner [Tue, 12 Jul 2022 07:50:41 +0000 (09:50 +0200)]
Merge pull request #416 from CodeConstruct/kdoc-test

doc: Add a kdoc test for API docs

3 years agobuild: Add workflow to create release from tags
Daniel Wagner [Mon, 11 Jul 2022 12:36:06 +0000 (14:36 +0200)]
build: Add workflow to create release from tags

Let's automate the release process. The trigger to build a release is
the release tag.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
3 years agoMerge pull request #422 from martin-belanger/eflag-2
Daniel Wagner [Mon, 11 Jul 2022 12:43:24 +0000 (14:43 +0200)]
Merge pull request #422 from martin-belanger/eflag-2

python: add eflags to discovery log page

3 years agoMerge pull request #421 from martin-belanger/eflag-1
Daniel Wagner [Mon, 11 Jul 2022 12:41:55 +0000 (14:41 +0200)]
Merge pull request #421 from martin-belanger/eflag-1

fabrics: add NCC to nvmf_disc_eflags

3 years agopython: add eflags to discovery log page
Martin Belanger [Mon, 11 Jul 2022 12:26:27 +0000 (08:26 -0400)]
python: add eflags to discovery log page

Python bindings are extended to report the EFLAGS when a discovery
command is issued. This was previously missing.

Signed-off-by: Martin Belanger <martin.belanger@dell.com>
3 years agofabrics: add NCC to nvmf_disc_eflags
Martin Belanger [Mon, 11 Jul 2022 12:19:39 +0000 (08:19 -0400)]
fabrics: add NCC to nvmf_disc_eflags

TP8010 defines an additional EFLAG: No CDC Connectivity (NCC)

Signed-off-by: Martin Belanger <martin.belanger@dell.com>
3 years agodoc: remove github workflow for doc check
Jeremy Kerr [Mon, 11 Jul 2022 10:12:42 +0000 (18:12 +0800)]
doc: remove github workflow for doc check

We now do the doc check as part of the docs test target, no need to
repeat it as a separate workflow.

Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
3 years agodoc: Add a kdoc test for API docs
Jeremy Kerr [Wed, 6 Jul 2022 06:31:41 +0000 (14:31 +0800)]
doc: Add a kdoc test for API docs

Even when we're not building docs, it would be handy to have an easy
check that the kernel-doc comments do not produce warnings or errors.

This change adds a test() defintion to docs/, which calls a simple
script, kernel-doc-check. This script invokes kernel-doc, looking for
error and/or warning output.

Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
3 years agodoc/meson: provide a full-path version of api_files
Jeremy Kerr [Mon, 11 Jul 2022 10:08:47 +0000 (18:08 +0800)]
doc/meson: provide a full-path version of api_files

We currently expand api_files into their full paths when constructing
the manpage build rules. However, we'll want to use this same set of
paths for a future change, so provide an expanded version of the array
globally.

Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
3 years agoMerge pull request #419 from igaw/spell-checking
Daniel Wagner [Fri, 8 Jul 2022 12:12:23 +0000 (14:12 +0200)]
Merge pull request #419 from igaw/spell-checking

Fixing typos and whitespace damage in header files

3 years agonvme: More whitespace cleanup reported by checkpatch
Daniel Wagner [Thu, 7 Jul 2022 16:21:32 +0000 (18:21 +0200)]
nvme: More whitespace cleanup reported by checkpatch

While checkpatch can be very noise, it finds a lot of style
inconsistency. Let's cleanup most of them in the public headers.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
3 years agonvme: Whitespace cleanups in header files
Daniel Wagner [Thu, 7 Jul 2022 16:05:47 +0000 (18:05 +0200)]
nvme: Whitespace cleanups in header files

Cleanup whitespace damages with emacs whitespace cleanup tool.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
3 years agonvme: Fix typos in header files
Daniel Wagner [Thu, 7 Jul 2022 15:30:39 +0000 (17:30 +0200)]
nvme: Fix typos in header files

A quick run with ispell to fix the obvious typos.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
3 years agoMerge pull request #378 from igaw/fix-nvmf_get_discovery_log
Daniel Wagner [Thu, 7 Jul 2022 09:36:31 +0000 (11:36 +0200)]
Merge pull request #378 from igaw/fix-nvmf_get_discovery_log

fabrics: restructrure nvmf_get_discovery_log

3 years agoMerge pull request #418 from CodeConstruct/mi-retvals
Daniel Wagner [Thu, 7 Jul 2022 09:16:18 +0000 (11:16 +0200)]
Merge pull request #418 from CodeConstruct/mi-retvals

MI:  return value + errno unification

3 years agomi: make return values + errno consistent across error paths
Jeremy Kerr [Thu, 7 Jul 2022 07:06:19 +0000 (15:06 +0800)]
mi: make return values + errno consistent across error paths

This change unifies and documents the error return values for the MI
implementation. This gives us the following semantics:

 - zero on success

 - -1 for errors in the MI communication with an endpoint, with errno
   set accordingly

 - positive values where the MI communication succeeded, but we received
   an error response from the endpoint. The return value will be that
   from the MI response status field, and should correspond to one of
   the nvme_mi_resp_status values.

We add these semantics to the file-level kdoc comments in mi.h.

Most of the changes here are replacing the negative-errno returns:

    return -EIO;

with:

    errno = EIO;
    return -1;

but there are a few slightly-more-involved changes where we need to
preserve errno across a cleanup/log that might clobber it.

For the dbus code in mi-mctp.c, we need to convert the sd_bus convention of
negative-errno values into errno; we can do most of these through the
dbus_err() helper.

Fixes: https://github.com/linux-nvme/libnvme/issues/417
Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
3 years agomi-mctp: suppress error on scanning endpoints we already have
Jeremy Kerr [Thu, 7 Jul 2022 08:14:38 +0000 (16:14 +0800)]
mi-mctp: suppress error on scanning endpoints we already have

It's not an error to have an endpoint in our list prior to scanning;
just suppress the duplicate and keep going.

Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
3 years agomi: Add extended MI response status values
Jeremy Kerr [Thu, 7 Jul 2022 05:55:34 +0000 (13:55 +0800)]
mi: Add extended MI response status values

We'll want to make further use of the MI status values in an upcoming
change, so add the full set of values from NVMe-MI v1.2b.

Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
3 years agoMerge pull request #415 from CodeConstruct/mi-config
Daniel Wagner [Wed, 6 Jul 2022 10:09:48 +0000 (12:09 +0200)]
Merge pull request #415 from CodeConstruct/mi-config

mi: Add MI configuration commands

3 years agomi: Add examples for MI configuration commands
Jeremy Kerr [Wed, 6 Jul 2022 05:35:22 +0000 (13:35 +0800)]
mi: Add examples for MI configuration commands

Now that we have the MI Get/Set Configuration commands implemented, add
support in examples/mi-mctp to illustrate some basic configuration
interactions.

Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
3 years agomi: Add MI configuration commands
Jeremy Kerr [Tue, 12 Oct 2021 03:13:58 +0000 (11:13 +0800)]
mi: Add MI configuration commands

This change adds an API to send MI Get / Set Configuration commands to
an endpoint, allowing control of endpoint SMBus frequenct, MCTP MTU and
clearing the subsystem health status bits.

We do this with a new couple of functions:

    int nvme_mi_mi_config_get(nvme_mi_ep_t ep, __u32 dw0, __u32 dw1,
                              __u32 *nmresp)

    int nvme_mi_mi_config_set(nvme_mi_ep_t ep, __u32 dw0, __u32 dw1)

The dw0, dw1 and nmresp formats depend on the type of configuration
accessed, which can be a little opaque. Se we add a bunch of helpers
too, to get/set the three configuration params:

    nvme_mi_mi_config_get_smbus_freq(...);
    nvme_mi_mi_config_set_smbus_freq(...);
    nvme_mi_mi_config_get_mctp_mtu(...);
    nvme_mi_mi_config_set_mctp_mtu(...);
    nvme_mi_mi_config_set_health_status_change(...);

[there's no getter for the latter, as this just clears polled bits]

Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
3 years agomi: Add types for MI Get/Set Configuration data
Jeremy Kerr [Tue, 12 Oct 2021 03:13:58 +0000 (11:13 +0800)]
mi: Add types for MI Get/Set Configuration data

This change adds the mi-specific types for Get/Set configuration
commands: enum nvme_mi_config_id for the currently-defined IDs, and enum
nvme_mi_config_smbus_freq for the possible SMBus frequency configuration
values.

Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
3 years agoMerge pull request #413 from CodeConstruct/not-cascading-style-sheets
Daniel Wagner [Mon, 4 Jul 2022 17:08:21 +0000 (19:08 +0200)]
Merge pull request #413 from CodeConstruct/not-cascading-style-sheets

types: fix typo on nvme_mi_ccs definitions in public API