]> www.infradead.org Git - users/sagi/nvme-cli.git/log
users/sagi/nvme-cli.git
2 years agofabrics: Honor JSON config file in connect-all command
Daniel Wagner [Thu, 29 Sep 2022 13:44:23 +0000 (15:44 +0200)]
fabrics: Honor JSON config file in connect-all command

When we there is a JSON config file use it when doing a
connect-all.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
2 years agofabrics: nvme config --modify depends on -n and -t argument
Daniel Wagner [Thu, 29 Sep 2022 09:28:50 +0000 (11:28 +0200)]
fabrics: nvme config --modify depends on -n and -t argument

In order to be able to modify a config we need to look it up
first. The nvme_lookup_subsystem() call will crash if we don't
provide a NQN.

The transport is needed to be able lookup a controller.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
2 years agobuild: Update json-c.wrap
Daniel Wagner [Thu, 29 Sep 2022 10:12:09 +0000 (12:12 +0200)]
build: Update json-c.wrap

Update to the latest the json-c wrap version.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
2 years agoMerge pull request #1692 from jeffreyalien/master
Daniel Wagner [Tue, 27 Sep 2022 13:02:06 +0000 (15:02 +0200)]
Merge pull request #1692 from jeffreyalien/master

plugins/wdc: Add support for SN660 drive

2 years agoplugins/wdc: Add support for SN660 drive
Jeff Lien [Mon, 26 Sep 2022 14:17:54 +0000 (09:17 -0500)]
plugins/wdc: Add support for SN660 drive

Update WDC plugin version to 2.1.2

Signed-off-by: Jeff Lien <jeff.lien@wdc.com>
2 years agofabrics: re-read the discovery log page when a discovery controller reconnected
Sagi Grimberg [Thu, 22 Sep 2022 08:15:38 +0000 (11:15 +0300)]
fabrics: re-read the discovery log page when a discovery controller reconnected

When using persistent discovery controllers, if the discovery controller
loses connectivity and manage to reconnect after a while, we need to
retrieve again the discovery log page in order to learn about possible
changes that may have occurred during this time as discovery log change
events were lost.

Upon reception of a udev EVENT=rediscover we can kickstart discovery on
the existing discovery controller device node that generated the event.

Signed-off-by: Sagi Grimberg <sagi@grimberg.me>
Reviewed-by: James Smart <jsmart2021@gmail.com>
[dwagner: added --host_iface argument]
Signed-off-by: Daniel Wagner <dwagner@suse.de
2 years agoMerge pull request #1691 from CodeConstruct/pr/mi-firmware
Daniel Wagner [Tue, 27 Sep 2022 09:10:21 +0000 (11:10 +0200)]
Merge pull request #1691 from CodeConstruct/pr/mi-firmware

nvme: Add wrappers for firmware commands

2 years agonvme: Add wrappers for firmware commands
Jeremy Kerr [Sat, 24 Sep 2022 06:41:03 +0000 (14:41 +0800)]
nvme: Add wrappers for firmware commands

This change adds nvme_dev wrappers for the firmware download and
firmware commit commands, allowing access over a MI channel.

We need a bump to libnvme for the underlying MI firmware calls.

Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
2 years agolibnvme.wrap: Bump to 677075a1
Jeremy Kerr [Sat, 24 Sep 2022 06:41:03 +0000 (14:41 +0800)]
libnvme.wrap: Bump to 677075a1

In an upcoming change we'll want support for the firmware-handling
commands, so bump the libnvme wrap version to suit.

Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
2 years agoMerge pull request #1690 from CodeConstruct/dev/uint128
Daniel Wagner [Mon, 26 Sep 2022 12:58:21 +0000 (14:58 +0200)]
Merge pull request #1690 from CodeConstruct/dev/uint128

util: Fix le128_to_cpu on big-endian

2 years agoMerge pull request #1688 from CodeConstruct/dev/ci-cross
Daniel Wagner [Mon, 26 Sep 2022 12:56:54 +0000 (14:56 +0200)]
Merge pull request #1688 from CodeConstruct/dev/ci-cross

Add warning fixes and enable cross compilation targets in github workflows

2 years agogithub workflows: add armhf and ppc64le cross compile checks
Jeremy Kerr [Sun, 25 Sep 2022 12:48:31 +0000 (20:48 +0800)]
github workflows: add armhf and ppc64le cross compile checks

Like we have done in libnvme, this change adds a couple of cross-compile
definitons for the github workflows: one for armhf, one for powerpc64le.

Fixes: https://github.com/linux-nvme/nvme-cli/issues/1687
Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
2 years agonvme, plugins: fix __u64 -> unsigned long long assumptions
Jeremy Kerr [Mon, 26 Sep 2022 10:04:08 +0000 (18:04 +0800)]
nvme, plugins: fix __u64 -> unsigned long long assumptions

We have a couple of instances which assume __u64 is an unsigned long,
which is not always the case.

For the printf() formats, we would ideally used PRId64, but on ll64
platforms, it looks this macro is broken: it expands to "ld", where
__u64 is an unsigned long long. So, do an explicit cast to unsigned long
long instead, and just use %lld.

With this change, we can compile without warnings on amd64, armhf and
powerpc64le.

Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
2 years agoutil: Fix le128_to_cpu on big-endian
Jeremy Kerr [Mon, 26 Sep 2022 12:02:31 +0000 (20:02 +0800)]
util: Fix le128_to_cpu on big-endian

We currently have a bug when converting from le128, as we'll overwrite
words that we later need to read.

Also, use an if rather than #ifdef, so the BE case can be compiled.
Turns out we need the ccan headers for this.

Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
2 years agoMerge pull request #1685 from CodeConstruct/dev/uint128
Daniel Wagner [Mon, 26 Sep 2022 07:20:16 +0000 (09:20 +0200)]
Merge pull request #1685 from CodeConstruct/dev/uint128

utils: Fix uint128_t usage

2 years agoMerge pull request #1686 from igaw/fix-misc
Daniel Wagner [Mon, 26 Sep 2022 07:17:20 +0000 (09:17 +0200)]
Merge pull request #1686 from igaw/fix-misc

Various small build fixes

2 years agoMerge pull request #1675 from martin-belanger/udev-rule
Daniel Wagner [Mon, 26 Sep 2022 06:39:04 +0000 (08:39 +0200)]
Merge pull request #1675 from martin-belanger/udev-rule

udev: Add HOST_IFACE to udev rule

2 years agoutils: Fix uint128_t usage
Jeremy Kerr [Sun, 25 Sep 2022 12:12:34 +0000 (20:12 +0800)]
utils: Fix uint128_t usage

Currently, nvme-cli will not compile on 32-bit platforms, as uint128_t
is not available.

This change, based on suggestions from Daniel Wagner <dwagner@suse.de>,
adds our own nvme_uint128_t type, which needs a custom to_string()
function.

In order to make the latter straightforward, we use four 32-bit words
for the internal representation of the 128-bit type. We then use 64-bit
arithmetic to avoid having to handle the carry-bit explicitly.

Also, add a small test case for the printing.

Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
2 years agoudev: Add HOST_IFACE to udev rule
Martin Belanger [Tue, 13 Sep 2022 15:19:13 +0000 (11:19 -0400)]
udev: Add HOST_IFACE to udev rule

The HOST_IFACE only applies to TCP connections. When provided, it forces TCP
connections on a specific interface instead of letting the routing table
decide. Some users may prefer to force connections on specific interfaces
instead of configuring the routing table. This change makes sure that the
HOST_IFACE used to set up the persistent connection to the discovery
controller also gets applied to the I/O controller connections.

Signed-off-by: Martin Belanger <martin.belanger@dell.com>
2 years agoMerge pull request #1683 from igaw/fix-wdc-enum-conversion
Daniel Wagner [Fri, 23 Sep 2022 14:39:54 +0000 (16:39 +0200)]
Merge pull request #1683 from igaw/fix-wdc-enum-conversion

plugins/wdc: Add type case for feature id

2 years agonvme: Use correct print format specifier for sizeof arguments
Daniel Wagner [Fri, 23 Sep 2022 14:27:50 +0000 (16:27 +0200)]
nvme: Use correct print format specifier for sizeof arguments

Signed-off-by: Daniel Wagner <dwagner@suse.de>
2 years agoplugins/micron-nvme: Use correct print format specifier for sizeof arguments
Daniel Wagner [Fri, 23 Sep 2022 14:28:19 +0000 (16:28 +0200)]
plugins/micron-nvme: Use correct print format specifier for sizeof arguments

Signed-off-by: Daniel Wagner <dwagner@suse.de>
2 years agoplugins/wdc: Add type case for feature id
Daniel Wagner [Fri, 23 Sep 2022 11:43:57 +0000 (13:43 +0200)]
plugins/wdc: Add type case for feature id

clang reports

../plugins/wdc/wdc-nvme.c:9000:36: warning: implicit conversion from enumeration type 'NVME_FEATURE_IDENTIFIERS' (aka 'enum _NVME_FEATURE_IDENTIFIERS') to different enumeration type 'enum nvme_features_id' [-Wenum-conversion]
                                             deFeatureIdList[listIdx].featureId,
                                             ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~

Add type case to avoid the warning. Ideally, the plugin would not
introduce their own enum value.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
2 years agoplugins: Use PRIu64 format specifier for 64bit types
Daniel Wagner [Fri, 23 Sep 2022 10:32:53 +0000 (12:32 +0200)]
plugins: Use PRIu64 format specifier for 64bit types

Signed-off-by: Daniel Wagner <dwagner@suse.de>
2 years agonvme-print: Use uint128 JSON function for media_units_written
Daniel Wagner [Fri, 23 Sep 2022 10:31:33 +0000 (12:31 +0200)]
nvme-print: Use uint128 JSON function for media_units_written

media_units_written is of type __uint128_t hence we should use the
correct function for serializing to JSON.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
2 years agoMerge pull request #1662 from DebabrataSTX/stx_ocp
Daniel Wagner [Thu, 22 Sep 2022 09:51:18 +0000 (11:51 +0200)]
Merge pull request #1662 from DebabrataSTX/stx_ocp

adding OCP changes for Seagate drives

2 years agodoc: Add and update man pages for seagate plugin
Debabrata Bardhan [Thu, 15 Sep 2022 12:24:44 +0000 (17:54 +0530)]
doc: Add and update man pages for seagate plugin

Adding documentation of Seagate plug-in commands.

Signed-off-by: Debabrata Bardhan <debabrata.bardhan@seagate.com>
2 years agoplugins/seagate: Add support for OCP
Debabrata Bardhan [Thu, 15 Sep 2022 12:08:16 +0000 (17:38 +0530)]
plugins/seagate: Add support for OCP

Added new behavior as defined by Datacenter NVMe SSD Specification, version 2.0.

Signed-off-by: Debabrata Bardhan <debabrata.bardhan@seagate.com>
2 years agoMerge pull request #1677 from tbzatek/json-strings-3
Daniel Wagner [Wed, 14 Sep 2022 12:03:28 +0000 (14:03 +0200)]
Merge pull request #1677 from tbzatek/json-strings-3

nvme-print: Handle NULL hostid in JSON output

2 years agonvme-print: Handle NULL hostid in JSON output
Tomas Bzatek [Tue, 13 Sep 2022 14:54:44 +0000 (16:54 +0200)]
nvme-print: Handle NULL hostid in JSON output

For pcie devices there might be no hostid available, in case the
/etc/nvme/hostid file doesn't exist.

2 years agoMerge pull request #1676 from igaw/doc-update-nvme-list-subsys-example
Daniel Wagner [Wed, 14 Sep 2022 09:44:42 +0000 (11:44 +0200)]
Merge pull request #1676 from igaw/doc-update-nvme-list-subsys-example

doc: Update examples in nvme-list-subsys.txt

2 years agodoc: Update examples in nvme-list-subsys.txt
Daniel Wagner [Wed, 14 Sep 2022 09:12:19 +0000 (11:12 +0200)]
doc: Update examples in nvme-list-subsys.txt

The examples show the output from nvme-cli 1.x. The address field
shows the attributes separated by spaces. The corresponding code in
libnvme doesn't do this. Instead the exact output from sysfs, e.g.

  # cat /sys/class/nvme/nvme0/address
  traddr=192.168.201.101,trsvcid=4420

Update the example in the nvme list-subsys documentation.

Signed-off-by: Daniel Wagner <dwagnwer@suse.de>
2 years agoMerge pull request #1673 from linux-nvme/dependabot/github_actions/actions/checkout-3
Daniel Wagner [Tue, 13 Sep 2022 07:27:47 +0000 (09:27 +0200)]
Merge pull request #1673 from linux-nvme/dependabot/github_actions/actions/checkout-3

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

2 years agobuild(deps): bump actions/checkout from 2 to 3
dependabot[bot] [Mon, 12 Sep 2022 18:21:51 +0000 (18:21 +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 #1666 from igaw/add-uint128-type
Daniel Wagner [Mon, 12 Sep 2022 07:51:45 +0000 (09:51 +0200)]
Merge pull request #1666 from igaw/add-uint128-type

Add uint128 type

2 years agoadd item ddr_ecc_err_cnt in smart-log-add
innogritkenny [Tue, 6 Sep 2022 08:41:56 +0000 (16:41 +0800)]
add item ddr_ecc_err_cnt in smart-log-add

2 years agoplugins/virtium: Output 128bit values as uint128 type instead of double
Steven Seungcheol Lee [Wed, 7 Sep 2022 09:18:59 +0000 (11:18 +0200)]
plugins/virtium: Output 128bit values as uint128 type instead of double

The 128bit types should be printed as integer not as double. The
print function for double type will add decimal points.

While at it drop the local copy of int128_to_double and use the one
from util.

Signed-off-by: Steven Seungcheol Lee <sc108.lee@samsung.com>
[dwagner: refactoring]
Signed-off-by: Daniel Wagner <dwagner@suse.de>
2 years agoplugins/wdc: Output 128bit values as uint128 type instead of double
Steven Seungcheol Lee [Wed, 7 Sep 2022 09:18:02 +0000 (11:18 +0200)]
plugins/wdc: Output 128bit values as uint128 type instead of double

The 128bit types should be printed as integer not as double. The
print function for double type will add decimal points.

While at it drop the local copy of int128_to_double and use the one
from util.

Signed-off-by: Steven Seungcheol Lee <sc108.lee@samsung.com>
[dwagner: refactoring]
Signed-off-by: Daniel Wagner <dwagner@suse.de>
2 years agoplugins/ocp: Output 128bit values as uint128 type instead of double
Steven Seungcheol Lee [Wed, 7 Sep 2022 09:16:27 +0000 (11:16 +0200)]
plugins/ocp: Output 128bit values as uint128 type instead of double

The 128bit types should be printed as integer not as double. The
print function for double type will add decimal points.

While at it drop the local copy of int128_to_double and use the one
from util.

Signed-off-by: Steven Seungcheol Lee <sc108.lee@samsung.com>
[dwagner: refactoring]
Signed-off-by: Daniel Wagner <dwagner@suse.de>
2 years agonvme-print: Output 128bit values as uint128 type instead of double
Steven Seungcheol Lee [Wed, 7 Sep 2022 09:16:11 +0000 (11:16 +0200)]
nvme-print: Output 128bit values as uint128 type instead of double

The 128bit types should be printed as integer not as double. The
print function for double type will add decimal points.

Signed-off-by: Steven Seungcheol Lee <sc108.lee@samsung.com>
[dwagner: refactoring]
Signed-off-by: Daniel Wagner <dwagner@suse.de>
2 years agoutil/json: Add 128 bit JSON helpers
Steven Seungcheol Lee [Wed, 7 Sep 2022 09:11:34 +0000 (11:11 +0200)]
util/json: Add 128 bit JSON helpers

Signed-off-by: Steven Seungcheol Lee <sc108.lee@samsung.com>
[dwagner: refactoring]
Signed-off-by: Daniel Wagner <dwagner@suse.de>
2 years agoutil/types: Add 128 bit conversion helpers
Steven Seungcheol Lee [Wed, 7 Sep 2022 09:10:01 +0000 (11:10 +0200)]
util/types: Add 128 bit conversion helpers

Signed-off-by: Steven Seungcheol Lee <sc108.lee@samsung.com>
[dwagner: refactoring]
Signed-off-by: Daniel Wagner <dwagner@suse.de>
2 years agoutil: Move common type conversion helpers into util section
Daniel Wagner [Wed, 7 Sep 2022 09:05:03 +0000 (11:05 +0200)]
util: Move common type conversion helpers into util section

These helpers are useful not just in the core code. Allow plugins
to use these too.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
2 years agoMerge pull request #1659 from igaw/docs-how-to-prepare-a-pr
Daniel Wagner [Wed, 7 Sep 2022 07:13:12 +0000 (09:13 +0200)]
Merge pull request #1659 from igaw/docs-how-to-prepare-a-pr

doc: Add 'how to contribute' section

2 years agonvme-print: Add missing values in id-ctrl for JSON output
Daniel Wagner [Wed, 7 Sep 2022 07:08:17 +0000 (09:08 +0200)]
nvme-print: Add missing values in id-ctrl for JSON output

Add the missing values in the id-ctrl JSON output.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
2 years agonvme-print: Print fguid as a UUID
Pierre Labat [Fri, 26 Aug 2022 22:02:08 +0000 (17:02 -0500)]
nvme-print: Print fguid as a UUID

Signed-off-by: Pierre Labat <plabat@micron.com>
[dwagner: added json output]
Signed-off-by: Daniel Wagner <dwagner@suse.de>
2 years agoMerge pull request #1637 from igaw/udpate-format-doc-sanitize
Daniel Wagner [Wed, 7 Sep 2022 06:44:17 +0000 (08:44 +0200)]
Merge pull request #1637 from igaw/udpate-format-doc-sanitize

docs: Update formatting for sanact list

2 years agodocs: Update formatting for sanact list
Daniel Wagner [Thu, 11 Aug 2022 13:55:20 +0000 (15:55 +0200)]
docs: Update formatting for sanact list

asciidoc creates list with either a '*' or '-'. Without it this is
rendered as one paragraph which is hard to read.

While at it, also use hex values to match with example.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
2 years agoplugins/innogrit: add smart items for smart-log-add
innogritkenny [Wed, 31 Aug 2022 09:23:02 +0000 (17:23 +0800)]
plugins/innogrit: add smart items for smart-log-add

2 years agoMerge pull request #1656 from sc108-lee/zns_report_zones
Daniel Wagner [Wed, 31 Aug 2022 08:00:33 +0000 (10:00 +0200)]
Merge pull request #1656 from sc108-lee/zns_report_zones

zns.c: report zones should be started after retrieved zone

2 years agodoc: Add 'how to contribute' section
Daniel Wagner [Wed, 31 Aug 2022 07:41:54 +0000 (09:41 +0200)]
doc: Add 'how to contribute' section

Document how to contribute to the project. Highlight the fact, that
it expected that the PRs are also following the Linux community
contributions guidelines (clean series).

Signed-off-by: Daniel Wagner <dwagner@suse.de>
2 years agozns.c: report zones should be started after retrieved zone
Steven Seungcheol Lee [Mon, 29 Aug 2022 11:23:55 +0000 (20:23 +0900)]
zns.c: report zones should be started after retrieved zone

Signed-off-by: Steven Seungcheol Lee <sc108.lee@samsung.com>
2 years agoMerge pull request #1654 from sc108-lee/endurance_log
Daniel Wagner [Tue, 30 Aug 2022 14:47:47 +0000 (16:47 +0200)]
Merge pull request #1654 from sc108-lee/endurance_log

nvme-print: fix wrong json key

2 years agoMerge pull request #1648 from lgdacunha/telemetry_cod
Daniel Wagner [Tue, 30 Aug 2022 12:24:12 +0000 (14:24 +0200)]
Merge pull request #1648 from lgdacunha/telemetry_cod

Added parsing for Solidigm telemetry observable data.

2 years agonvme-print: fix wrong json key
Steven Seungcheol Lee [Mon, 29 Aug 2022 08:43:18 +0000 (17:43 +0900)]
nvme-print: fix wrong json key

Signed-off-by: Steven Seungcheol Lee <sc108.lee@samsung.com>
2 years agoAdded parsing for Solidigm telemetry observable data.
da Cunha, Leonardo [Fri, 15 Jul 2022 02:11:19 +0000 (22:11 -0400)]
Added parsing for Solidigm telemetry observable data.

2 years agoMerge pull request #1650 from igaw/fix-sstat-output
Daniel Wagner [Thu, 25 Aug 2022 15:12:04 +0000 (17:12 +0200)]
Merge pull request #1650 from igaw/fix-sstat-output

nvme: Masks SSTAT in sanize-log output

2 years agonvme: Masks SSTAT in sanize-log output
Daniel Wagner [Thu, 25 Aug 2022 07:36:16 +0000 (09:36 +0200)]
nvme: Masks SSTAT in sanize-log output

The sanitize->sstat needs to be mask. We do this for the JSON output
but not for the normal shell output.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
2 years agoMerge pull request #1649 from CodeConstruct/parse-retval
Daniel Wagner [Thu, 25 Aug 2022 06:24:43 +0000 (08:24 +0200)]
Merge pull request #1649 from CodeConstruct/parse-retval

tree: fail on non-negative return values from parse_and_open

2 years agotree: fail on non-negative return values from parse_and_open
Jeremy Kerr [Wed, 24 Aug 2022 01:20:53 +0000 (09:20 +0800)]
tree: fail on non-negative return values from parse_and_open

Currently, we see a warning with specific compilers:

  ../nvme/nvme.c: In function 'ns_rescan':
  ../nvme/nvme.c:4389:19: warning: 'dev' may be used uninitialized in this function [-Wmaybe-uninitialized]

This is due to a theoretical failure path in parse_and_open(), where
argconfig_parse() returns a positive value - this would require the
global errno to be negative.

Even though the unintialised use of dev is only possible with negative
error (which shouldn't happen), we should still consider any non-zero
return value of parse_and_open a failure. This change fixes the
instances of:

    err = parse_and_open(...);
    if (err < 0)

changing to:

    err = parse_and_open(...);
    if (err)

... and also applies this to the single use of open_exclusive().

The positive return values from parse_and_open() were removed in
11542bbd; beforehand, parse_and_open() would return a fd.

Fixes: 11542bbd ("tree: Combine NVMe file descriptor into struct nvme_dev")
Fixes: https://github.com/linux-nvme/nvme-cli/issues/1647
Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
2 years agoMerge pull request #1646 from jeffreyalien/master
Daniel Wagner [Tue, 23 Aug 2022 06:08:22 +0000 (08:08 +0200)]
Merge pull request #1646 from jeffreyalien/master

print: Add Controller Ready Timeout Exceeded HW error code

2 years agoprint: Add Controller Ready Timeout Exceeded HW error code
Jeff Lien [Fri, 19 Aug 2022 21:23:18 +0000 (16:23 -0500)]
print: Add Controller Ready Timeout Exceeded HW error code

Signed-off-by: Jeff Lien <jeff.lien@wdc.com>
2 years agoMerge pull request #1643 from jeffreyalien/master
Daniel Wagner [Thu, 18 Aug 2022 11:23:13 +0000 (13:23 +0200)]
Merge pull request #1643 from jeffreyalien/master

wdc:  OCP Log page updates and fixes

2 years agowdc: OCP Log page updates and fixes
Jeff Lien [Wed, 3 Aug 2022 13:34:04 +0000 (08:34 -0500)]
wdc:  OCP Log page updates and fixes

Add support for Version 1 Error Recovery log page
Fix fw-activate-history timestamp json data
Update OCP log page capabiliites for SN550, SN650,
  and SN655

Signed-off-by: Jeff Lien <jeff.lien@wdc.com>
2 years agoMerge pull request #1642 from CodeConstruct/mi
Daniel Wagner [Wed, 17 Aug 2022 06:35:59 +0000 (08:35 +0200)]
Merge pull request #1642 from CodeConstruct/mi

MI: Add (and use) `nvme_cli_*` wrappers for more admin functions

2 years agonvme: Add wrappers for Get Log page helpers
Jeremy Kerr [Wed, 20 Jul 2022 04:28:40 +0000 (12:28 +0800)]
nvme: Add wrappers for Get Log page helpers

Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
2 years agonvme: Add wrapper for Sanitize NVM
Jeremy Kerr [Wed, 20 Jul 2022 02:22:39 +0000 (10:22 +0800)]
nvme: Add wrapper for Sanitize NVM

Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
2 years agonvme: Add wrapper for Format NVM
Jeremy Kerr [Tue, 19 Jul 2022 09:46:39 +0000 (17:46 +0800)]
nvme: Add wrapper for Format NVM

Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
2 years agonvme: Add wrappers for NS attach/detach
Jeremy Kerr [Tue, 19 Jul 2022 09:09:23 +0000 (17:09 +0800)]
nvme: Add wrappers for NS attach/detach

Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
2 years agonvme: Add wrappers for Identify controller lists
Jeremy Kerr [Tue, 19 Jul 2022 06:27:02 +0000 (14:27 +0800)]
nvme: Add wrappers for Identify controller lists

Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
2 years agonvme: Add wrappers for NS management functions
Jeremy Kerr [Thu, 14 Jul 2022 07:51:13 +0000 (15:51 +0800)]
nvme: Add wrappers for NS management functions

Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
2 years agonvme: Add wrappers for basic NS identify
Jeremy Kerr [Thu, 14 Jul 2022 07:44:05 +0000 (15:44 +0800)]
nvme: Add wrappers for basic NS identify

Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
2 years agonvme: Add nvme_cmd wrapper for get_features
Jeremy Kerr [Thu, 14 Jul 2022 06:35:27 +0000 (14:35 +0800)]
nvme: Add nvme_cmd wrapper for get_features

Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
2 years agosubprojects/libnvme: update for MI admin command coverage
Jeremy Kerr [Wed, 17 Aug 2022 05:08:58 +0000 (13:08 +0800)]
subprojects/libnvme: update for MI admin command coverage

In upcoming changes, we'll want to use the expanded Admin command
coverage for the MI transport. This change bumps to the merge commit
adding that support:

    commit 501347ffdf6321d42ceabf173792c95bd44dac0d
    Merge: 0e4d1ce d60b04b
    Author: Daniel Wagner <dwagner@suse.de>
    Date:   Tue Aug 16 08:59:33 2022 +0200

Merge pull request #457 from CodeConstruct/mi+admin

MI: expand admin command implementation

Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
2 years agoMerge pull request #1641 from igaw/add-json-uint64-helper
Daniel Wagner [Tue, 16 Aug 2022 16:07:54 +0000 (18:07 +0200)]
Merge pull request #1641 from igaw/add-json-uint64-helper

json: Support uint64 types serialization for older json-c versions

2 years agojson: Support uint64 types serialization for older json-c versions
Daniel Wagner [Tue, 16 Aug 2022 06:12:24 +0000 (08:12 +0200)]
json: Support uint64 types serialization for older json-c versions

Notable json-c 0.13 is lacking support for serializing uint64_t
types. At this point of writing the 0.13 version is widely
deployed. Let's add our own version of the serialization function as
fallback.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
2 years agonvme: Introduce nvme_cli_ wrappers, wrap identify and identify_ctrl
Jeremy Kerr [Thu, 14 Jul 2022 05:59:46 +0000 (13:59 +0800)]
nvme: Introduce nvme_cli_ wrappers, wrap identify and identify_ctrl

This change introduces the first of the libnvme wrapper functions. These
have a nvme_cli_ prefix, and wrap the correspondingly-named libnvme
function.

This allows us to call the correct libnvme transport-specific function,
depending on whether this is a direct or MI device.

This requires an update to a more recent libnvme, for the mi version of
the identify functions.

Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
2 years agotree: Add NVMe-MI support
Jeremy Kerr [Wed, 13 Jul 2022 06:56:59 +0000 (14:56 +0800)]
tree: Add NVMe-MI support

Now that we have a struct containing the NVMe device file descriptor, we
can abstract this to support different transport types.

This change adds support for NVMe-MI transports, by adding a `mi` member
to struct nvme_dev's union, and allowing devices to be specified by an
MCTP address:

    mctp:<network>,<endpoint-id>:<controller-id>

- where the `controller-id` is optional, and defaults to 0 if not
specified.

For this, we need to add suitable linkage to the libnvme-mi component of
the libnvme codebase.

None of the actual commands can use the MI transport at present, as they
currently assume access to dev->direct.fd. We will add facilities for
that in upcoming changes.

Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
2 years agonvme: Introduce a union in struct nvme_dev for different transport types
Jeremy Kerr [Wed, 13 Jul 2022 05:19:24 +0000 (13:19 +0800)]
nvme: Introduce a union in struct nvme_dev for different transport types

This change modifies struct nvme_dev to allow for future transport
types, by moving the transport-specific data into a union. We will add
new types in a future change.

Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
2 years agotree: Add dev_fd() helper
Jeremy Kerr [Wed, 13 Jul 2022 03:07:51 +0000 (11:07 +0800)]
tree: Add dev_fd() helper

We'll want to abstract the access to the direct-ioctl fd in a future
change, so add a simple helper for access to the fd member of
struct nvme_dev.

Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
2 years agonvme: Remove static nvme_dev, allocate on open instead
Jeremy Kerr [Tue, 12 Jul 2022 10:09:39 +0000 (18:09 +0800)]
nvme: Remove static nvme_dev, allocate on open instead

This change completes the transition to a all-local device data. Instead
of using the static nvme_dev, allocate a struct nvme_dev instead, and
free on dev_close()

Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
2 years agonvme: Make static nvme_dev private to open_dev(), use locals elsewhere
Jeremy Kerr [Tue, 12 Jul 2022 10:05:39 +0000 (18:05 +0800)]
nvme: Make static nvme_dev private to open_dev(), use locals elsewhere

Currently nvme_dev is private to nvme.c, with file-scoped access to the
variable.

This reduces the scope of nvme_dev to just open_dev(), and uses locals
for all other references.

We'll change this to an allocated variable in an upcoming change.

Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
2 years agonvme: Use local struct nvme_dev for show_registers & map_registers
Jeremy Kerr [Tue, 12 Jul 2022 09:51:47 +0000 (17:51 +0800)]
nvme: Use local struct nvme_dev for show_registers & map_registers

show_registers() and map_registers() use the global nvme_dev; change to
a local passed as an argument.

Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
2 years agotree: Change nvme_dev from global to static
Jeremy Kerr [Tue, 12 Jul 2022 09:20:25 +0000 (17:20 +0800)]
tree: Change nvme_dev from global to static

We're currently exposing the global struct nvme_dev, to allow the old
users access to the name and statbuf data. Now that users have their
local reference (along with the fd) through parse_and_open instead, we
can drop the public definition, and declare it static to nvme.c.

We still keep the static declaration; this will be removed in an
upcoming change.

Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
2 years agoplugins/ytmc: pass struct nvme_dev rather than fd + name
Jeremy Kerr [Tue, 12 Jul 2022 09:17:30 +0000 (17:17 +0800)]
plugins/ytmc: pass struct nvme_dev rather than fd + name

The ytmc plugin has a few cases where we're passing both a fd and a name
around. Instead, use the struct nvme_dev, which contains both.

Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
2 years agoplugins/wdc: pass struct nvme_dev rather than using global nvme_dev
Jeremy Kerr [Tue, 12 Jul 2022 09:14:09 +0000 (17:14 +0800)]
plugins/wdc: pass struct nvme_dev rather than using global nvme_dev

We have a couple of uses of the global nvme_dev variable, where we could
be passing a local instead. This change updates some of the wdc log
print functions to take a struct nvme_dev, rather than using the global.

Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
2 years agoplugins/ocp: pass struct nvme_dev to internal functions
Jeremy Kerr [Tue, 12 Jul 2022 08:54:53 +0000 (16:54 +0800)]
plugins/ocp: pass struct nvme_dev to internal functions

Currently, we're passing a NVMe file descriptor, then accessing the
global nvme_dev.

This change just passes the local struct nvme_dev instead.

Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
2 years agoplugins/toshiba: pass struct nvme_dev rather than fd + name
Jeremy Kerr [Tue, 12 Jul 2022 08:47:53 +0000 (16:47 +0800)]
plugins/toshiba: pass struct nvme_dev rather than fd + name

We currently pass both fd and name to internal functions. Just pass the
struct nvme_dev, which has both, instead.

While we're doing this, drop the usage of the global nvme_dev variable,
and drop an unnecessary cast from void *.

Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
2 years agoplugins/wdc: pass a struct nvme_dev around rather than a fd
Jeremy Kerr [Tue, 12 Jul 2022 07:22:47 +0000 (15:22 +0800)]
plugins/wdc: pass a struct nvme_dev around rather than a fd

Currently, the wdc plugin (internally) passes the device fd around. This
change passes the struct nvme_dev instead, so we can access other
members in a future change.

Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
2 years agotree: Combine NVMe file descriptor into struct nvme_dev
Jeremy Kerr [Tue, 12 Jul 2022 06:55:34 +0000 (14:55 +0800)]
tree: Combine NVMe file descriptor into struct nvme_dev

Currently, our references to the nvme device are fragmented: we have the
device name and stat buf stored in the global nvme_dev, and then a
separate nvme device file descriptor passed between functions

This change moves the fd into the struct nvme_dev:

     struct nvme_dev {
    +        int fd;
             struct stat stat;
             const char *name;
     };

and changes parse_and_open to now populate a pointer to the dev on
successful return. Callers can now access the fd through dev->fd,
unifying this with the name and statbuf.

[At the moment, this just uses the global nvme_dev variable, but we'll
make that neater in a future change]

There are a large number of functions that use the fd directly, hence
the size of this patch. I've attempted to make this as atomic as
possible, but there are some call sites which warrant some reformatting
as we go here.

There may be some future opportunities to pass around the struct
nvme_dev * rather than the fd, but this change just implements the
minimal change to group our nvme device into the one struct.

Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
2 years agotree: Move global device info to a single struct
Jeremy Kerr [Tue, 12 Jul 2022 02:59:20 +0000 (10:59 +0800)]
tree: Move global device info to a single struct

Currently, we have a couple of globals that refer to the current NVMe
device: the device name, and the stat buffer:

    static struct stat nvme_stat;
    const char *devicename;

This change moves those two globals into a single global struct:

    struct nvme_dev {
            struct stat stat;
            const char *name;
    };

    extern struct nvme_dev *nvme_dev;

This will make it easier to constrain the scope of these globals in a
later change.

Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
2 years agoMerge pull request #1638 from Francis-Pravin/fix-parse-16bit-value
Daniel Wagner [Thu, 11 Aug 2022 17:20:26 +0000 (19:20 +0200)]
Merge pull request #1638 from Francis-Pravin/fix-parse-16bit-value

nvme: Add helper function to parse 16-bit comma separated list

2 years agonvme: Add helper function to parse 16-bit comma separated list
Francis Pravin Antony Michael Raj [Sun, 14 Aug 2022 02:30:08 +0000 (22:30 -0400)]
nvme: Add helper function to parse 16-bit comma separated list

In copy command, nlbs is declared as __u16. While parsing command line argument,
it is typecast to integer pointer. So nlbs[1], nlbs[3], nlbs[5], ... are stored
as zero after getting parsed. Therefore it is passing wrong value to controller.
Hence, adding a helper function to parse the 16-bit comma separated list

Signed-off-by: Francis Pravin Antony Michael Raj <francis.michael@solidigm.com>
Signed-off-by: Jonathan Derrick <jonathan.derrick@solidigm.com>
2 years agobuild: Update version to v2.1.2 v2.1.2
Daniel Wagner [Thu, 11 Aug 2022 13:07:35 +0000 (15:07 +0200)]
build: Update version to v2.1.2

Signed-off-by: Daniel Wagner <dwagner@suse.de>
2 years agoMerge pull request #1636 from igaw/fix-nvme_init_copy_range_f1
Daniel Wagner [Thu, 11 Aug 2022 13:04:15 +0000 (15:04 +0200)]
Merge pull request #1636 from igaw/fix-nvme_init_copy_range_f1

wrapper: Call library version of nvme_init_copy_range_f1

2 years agowrapper: Update SPDIX license
Daniel Wagner [Thu, 11 Aug 2022 12:46:00 +0000 (14:46 +0200)]
wrapper: Update SPDIX license

The indented license is GPL-2.0-or-later. Update the SPDIX identifier
accordingly.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
2 years agowrapper: Call library version of nvme_init_copy_range_f1
Daniel Wagner [Thu, 11 Aug 2022 12:09:44 +0000 (14:09 +0200)]
wrapper: Call library version of nvme_init_copy_range_f1

The wrapper needs to call the library version of the function.

While at it, introduce preprocessor helpers to reduce the amount
boilerplate code.

Fixes: 7ccb7d29afa0 ("wrapper: Add weak nvme_init_copy_range_f1 symbol")
Signed-off-by: Daniel Wagner <dwagner@suse.de>
2 years agoMerge pull request #1635 from igaw/revert-udev-re-read
Daniel Wagner [Thu, 11 Aug 2022 09:55:54 +0000 (11:55 +0200)]
Merge pull request #1635 from igaw/revert-udev-re-read

Revert "udev: re-read the discovery log page when a discovery control…

2 years agoRevert "udev: re-read the discovery log page when a discovery controller reconnected"
Daniel Wagner [Thu, 11 Aug 2022 09:19:53 +0000 (11:19 +0200)]
Revert "udev: re-read the discovery log page when a discovery controller reconnected"

This reverts commit f86faaaa2a1ff319bde188dc8988be1ec054d238.

Observing unwanted side-effects with nvme discovery. For e.g., running
a simple 'nvme discover' command ends up invoking connect-all as well,
creating namespaces on the host.

One can also see spurious discovery controllers in the 'nvme
list-subsys' output, despite having not created any persistent
discovery controllers at all.

Reported-by: Martin George <Martin.George@netapp.com>
Signed-off-by: Daniel Wagner <dwagner@suse.de>
2 years agoMerge pull request #1634 from linux-nvme/fixes-v2
Daniel Wagner [Thu, 11 Aug 2022 07:59:16 +0000 (09:59 +0200)]
Merge pull request #1634 from linux-nvme/fixes-v2

plugins: minor fixes v2