Daniel Wagner [Wed, 11 Oct 2023 12:29:52 +0000 (14:29 +0200)]
nvme: use block-count arg if provided
When the user provides the --block-count argument use this value and
don't be clever and try to calculate the value. This is not what
the user asked us to do.
Steven Seungcheol Lee [Fri, 8 Sep 2023 05:10:22 +0000 (14:10 +0900)]
Makefile: add standalone build
To handover build binary for different environment users
Build result checked with ldd below
[root@localhost .build]# ldd nvme
not a dynamic executable
Do not run libnvme tests(set subproject revision successful build)
Disable keyutils on libnvme(pkgconfig always find shared first when -llib is given)
Signed-off-by: Steven Seungcheol Lee <sc108.lee@samsung.com>
Martin George [Thu, 5 Oct 2023 06:42:46 +0000 (12:12 +0530)]
udev-rules: rename netapp udev rule
Rename 71-nvmf-iopolicy-netapp.rules.in to 71-nvmf-netapp.rules.in
so as to make the name generic, since this not only sets the
iopolicy here but also modifies the ctrl_loss_tmo.
Martin George [Tue, 3 Oct 2023 10:35:23 +0000 (16:05 +0530)]
udev-rules: set ctrl_loss_tmo to -1 for ONTAP NVMe/TCP
Setting ctrl_loss_tmo to -1 for ONTAP NVMe/TCP controllers would enable
indefinite reconnect attempts during a path loss and help avoid purging
the path on the host, which otherwise may lead to mounted fs read-only
behavior. So add a rule towards enabling the same.
Jeremy Kerr [Sat, 23 Sep 2023 18:06:40 +0000 (11:06 -0700)]
nvme: fw-download offset only describes FW offset, not file offset
In e7ca3bcbdba, we (unintentionally) changed the semantics of the
fw-download's --offset argument to also apply an offset to the source
file.
According to https://github.com/linux-nvme/nvme-cli/issues/2013, the old
behaviour is useful when the source firmware image was provided in
separate chunks.
This change restored to the old hehaviour, where --offset only applies
to the destination firmware buffer on the device. This means that the
start of the source file will end up at the destination offset.
Fixes: https://github.com/linux-nvme/nvme-cli/issues/2013 Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
Daniel Wagner [Mon, 25 Sep 2023 12:32:23 +0000 (14:32 +0200)]
util: handle utf-8 thousend separators correctly
The separator char can be an utf-8 encoded symbol thus the length
of the string is necessarly one.
The check if we have to issue an separator needs to a fixed modulo of 3
or 4 (without or with l10n enabled) to place the symbol at the right
position in the string.
The copy loop needs to copy the all bytes from the back of the separator
byte sequence to the front, the same order we print the number.
This implements support for TP4119a, adding a new command nvme
phy-rx-eom-log for issuing Get Log Page with the new Log Identifier and
allowing for configuration/validation of the Log Specific Parameters.
Martin George [Thu, 21 Sep 2023 06:48:26 +0000 (12:18 +0530)]
udev-rule: apply round-robin iopolicy on i/o subsystems alone
The current 71-nvmf-iopolicy-netapp.rules.in sets the round-robin
iopolicy not just on nvme i/o subsystems, but on discovery subsystems
too. Update this rule to have this applied to i/o subsystems alone.
Signed-off-by: Martin George <marting@netapp.com> Cc: Clayton Skaggs <claytons@netapp.com>
Daniel Wagner [Thu, 21 Sep 2023 07:17:12 +0000 (09:17 +0200)]
plugins/solidigm: use static log macro to calc bitmask
The mask is using the log2 function which pulls in the libm. The library
is not always available, e.g when building statically. This makes the
whole build logic way to complex for something like this.
Instead calculating during runtime the bitmask just use the static ilog
macros from ccan.
Daniel Wagner [Thu, 14 Sep 2023 12:33:35 +0000 (14:33 +0200)]
nvme: allocate aligned payloads for all nvme commands
The kernel supports since v5.2 direct mapped DMA buffers to userspace.
Up to this point a bounce buffer was involved. Because the buffers are
now directly accessed by the device, the rules of alignment also apply
for the payloads.
Use the newly introduced nvme_alloc helper to allocate correctly aligned
payloads for all nvme commands.
Daniel Wagner [Thu, 14 Sep 2023 08:53:20 +0000 (10:53 +0200)]
nvme: introduce alloc helper with alignment support
The kernel supports since v5.2 direct mapped DMA buffers to userspace.
Up to this point a bounce buffer was involved. Because the buffers are
now directly accessed by the device, the rules of alignment also apply
for the payloads.
Introduce a helper to allocate all correctly buffers aligned.
Furthermore, ensure that the buffer is a multiple of 4k, because there
are devices on the market which will always transfer a multiple of 4k,
even if we ask for less, e.g 512 bytes. This avoid stack smashes.
Daniel Wagner [Thu, 14 Sep 2023 08:12:56 +0000 (10:12 +0200)]
nvme: append huge to nvme_{alloc|free} function
These two function are abstracting the libhugebtl API. Let's rename
Rename these functions because we want to introduce a generic alloc
function with alignment support.
Daniel Wagner [Thu, 14 Sep 2023 08:01:56 +0000 (10:01 +0200)]
nvme: fw_download use nvme_alloc only
The nvme_alloc has already a built in check which version of the
allocation strategy should be used based on the len argument. There is
no need for fw_download to do this as well.
Vincent Fu [Thu, 14 Sep 2023 19:01:17 +0000 (19:01 +0000)]
nvme-print: omit size of protection information
Protection information size is not always 8 bytes. For 16b Guard PI
format, the PI size is 8 bytes but for 32b and 64b Guard PI formats the
PI size is 16 bytes.
See Section 5.2.1 (pp. 76-79) of the NVM Command Set Specification
Revision 1.0c: https://nvmexpress.org/wp-content/uploads/NVM-Express-NVM-Command-Set-Specification-1.0c-2022.10.03-Ratified.pdf
To avoid confusion, omit the PI size.
Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
Martin Belanger [Wed, 2 Aug 2023 13:44:35 +0000 (09:44 -0400)]
fabrics: For TCP/RDMA, compare IP addresses with nvme_ipaddrs_eq()
These are the same changes we've already made to __nvme_lookup_ctrl
in libnvme. IP addresses (especially IPv6) cannot be compared with
a simple strcmp() or strcmpcase().
Also, for consistency with libnvme and improved readability,
replace strcmp0()/strcmpcase0() by streq0()/streqcase0().
Signed-off-by: Martin Belanger <martin.belanger@dell.com>
Martin Belanger [Wed, 2 Aug 2023 13:38:56 +0000 (09:38 -0400)]
fabrics: lookup_discovery_ctrl() must look under host and not root
lookup_discovery_ctrl() was scanning the whole root looking for any
matching discovery controller (DC). Instead, it must look under the
host object. The problem happens when there are more than one Host
NQN used to connect to the same DC. In this case, we will have more
than 1 host object and it is important to search for existing DCs
under the right host object.
Signed-off-by: Martin Belanger <martin.belanger@dell.com>
Add some functions to argconfig so that we can directly pass in
__u16/__u32/__u64 arrays without casting to int/long/etc, since an int
isn't always 32 bits, an unsigned long long isn't always 64 bits, etc.
Suggested-by: Randy Jennings <randyj@purestorage.com>
Daniel Wagner [Thu, 31 Aug 2023 14:26:11 +0000 (16:26 +0200)]
build: use latest container instead fixed version
We control the build containers so there is little risk
that these randomly break. So let's go with the latest
version and avoid updating the build files all the time.
Shin'ichiro Kawasaki [Thu, 3 Aug 2023 11:21:39 +0000 (20:21 +0900)]
fabrics: Use corresponding hostid when hostnqn is generated
After the kernel commit ae8bd606e09b ("nvme-fabrics: prevent overriding
of existing host"), kernel ensures hostid and hostnqn maintain 1:1
mapping and "non 1:1 mapping will be rejected". This makes 'nvme
discover' and 'nvme connect' commands fail when they generate hostnqn,
since it does not use corresponding hostid.
To avoid the failures, prepare and use corresponding hostid to the
generated hostnqn, taking the hostid from the hostnqn string. Also add
checks for prepared hostnqn and hostid. If the hostid taken from the
generated hostnqn is different from the hostid from file, print a
warning message. Also, if the prepared hostnqn are inconsistent with the
prepared hostid, print a warning.
Martin Belanger [Thu, 3 Aug 2023 17:15:28 +0000 (13:15 -0400)]
json: fix seg. fault converting NULL to JSON string
The function json_object_new_string() seg. faults when passed a
NULL pointer. This can happen, for example, when parameters retuned
by a controller (e.g. Firmware, Model Number, Serial Number, etc.)
are undefined and therefore NULL. This will cause the following
command to crash:
nvme list -v -o json
Signed-off-by: Martin Belanger <martin.belanger@dell.com>
Keith Busch [Thu, 27 Jul 2023 08:14:37 +0000 (10:14 +0200)]
nvme-cli: fix extended metadata size calculation
With commit 8a2bfa5be4d3 ("nvme: fix block count and data size logic")
we are rounding the request size up. And later we are adding the
extended metadata on top. Thus first figure out if extended metadata is
used and then do the rounding.
Signed-off-by: Keith Busch <kbusch@kernel.org>
[dwagner: added commit message] Signed-off-by: Daniel Wagner <dwagner@suse.de>
Daniel Wagner [Wed, 26 Jul 2023 13:46:55 +0000 (15:46 +0200)]
nvme-print-stdout: Do not show non reachable ns in namespace topology
If the host is connected to the target with two different hostnqn we can
have the situation where a namespace is only reachable via one ctrl and
a second namespace only by a different controller. Thus we should only
show a namespace in the topology if there is a path.