Martin George [Fri, 28 Oct 2022 16:19:29 +0000 (21:49 +0530)]
solidgm: fix initialization warning
Seeing the below warning while compiling nvme-cli:
ninja: Entering directory `.build'
[27/51] Compiling C object nvme.p/plugins_solidigm_solidigm-telemetry.c.o
../plugins/solidigm/solidigm-telemetry.c: In function ‘solidigm_get_telemetry_log’:
../plugins/solidigm/solidigm-telemetry.c:126:22: warning: ‘length’ may be used uninitialized in this function [-Wmaybe-uninitialized]
tl.configuration = json_tokener_parse_ex(jstok, conf_str, length);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[51/51] Linking target nvme
Fix this by initializing the 'length' variable to zero.
Daniel Wagner [Fri, 28 Oct 2022 09:32:30 +0000 (11:32 +0200)]
build: Fix endian check for cross build
The endian check is supposed to figure it the ordering on the machine
which the binary will run on. Hence we need to check the host not the
build machine.
leonardo.da.cunha [Thu, 27 Oct 2022 22:46:22 +0000 (15:46 -0700)]
utils/json: Add json_object_new_uint64 for json-c < 0.14
json-c 0.14 added json_object_new_uint64 but older version are missing
this function. Instead defining two different json_object_object_add
version we can just define the fallback function first.
[dwagner: rewrote the commit message] Signed-off-by: Daniel Wagner <dwagner@suse.de>
Jeremy Kerr [Sun, 23 Oct 2022 03:13:00 +0000 (11:13 +0800)]
nvme-print: decode status types
With the new nvme_status_get_type/nvme_status_get_value() accessors in
libnvme, restructure nvme_show_status to allow type-specific deciding in
future.
Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
Daniel Wagner [Mon, 26 Sep 2022 16:17:01 +0000 (18:17 +0200)]
nvme: Add show-topology command
Add nvme show-topology which displays the entire nvme topology on the
host - all the subsystems with all the underlying controllers and its
states including ANA for all nvme devices.
Tokunori Ikegami [Thu, 13 Oct 2022 16:13:22 +0000 (01:13 +0900)]
nvme: Fix set feature command to get feature identifier 0Dh length as zero
The nvme_get_feature_length() function does not handle the direction
information correctly. Thus libnvme introduced a new version of this
function. Use it when available.
Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
[dwagner: Add wrapper code when nvme_get_feature_length2
is not available] Signed-off-by: Daniel Wagner <dwagner@suse.de>
Daniel Wagner [Mon, 24 Oct 2022 13:43:04 +0000 (15:43 +0200)]
libnvme-wrap: Avoid fallback as variable name
The libnvme util.h header file has support for the 'fallback
statement' for older compilers. This is done by precompiler tricks
which will replace all 'fallback' texts. So we should avoid fallback
as variable name.
Daniel Wagner [Mon, 24 Oct 2022 13:32:15 +0000 (15:32 +0200)]
libvnme-wrap: Rename file
The name 'wrapper' is a bit too generic. The functions in this file are
fallback implementations for older libnvme libraries. Hence prefix the
file with libnvme.
Simon A. F. Lund [Thu, 20 Oct 2022 10:09:44 +0000 (12:09 +0200)]
Makefile: add 'make uninstall'
An uninstall option, in addition to RPM install/uninstall, is arguably
quite convenient. Yet, Makefiles usually do not provide an 'uninstall'
target since that would require recording an installation manifest and
custom logic for removal.
However, meson has an internal feature doing precisely that.
This change invokes the meson uninstall feature via "make uninstall".
Signed-off-by: Simon A. F. Lund <simon.lund@samsung.com>
Daniel Wagner [Tue, 17 May 2022 06:14:56 +0000 (08:14 +0200)]
tests: Update license to GPL-2.0-or-later
When I reviewed the tests I asked wrongly for GPL-2.0-only. The
project is using the GPL-2.0-or-later license. Relax the license
requirement to GPL-2.0-or-later.
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
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>
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>
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>
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.
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.
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).