Keith Busch [Tue, 30 Oct 2018 14:33:41 +0000 (08:33 -0600)]
nvme: Handle supported capabilities result for get features
When using the supported capabilities for get feature, SEL set to 3,
no data is transfered and the completion result is the controller
capabilities for the requested feature, not the actual feature. Handle
this accordingly.
Keith Busch [Wed, 24 Oct 2018 16:21:56 +0000 (10:21 -0600)]
wdc: Fix strncpy warning
Some compilers were complaining copying from the constant source was
truncating it. The size is supposed to protect the destination buffer,
so this patch uses that size instead.
Signed-off-by: Keith Busch <keith.busch@intel.com>
Warner Losh [Fri, 5 Oct 2018 04:08:01 +0000 (22:08 -0600)]
nvme-cli: fix ioctl argument
The command argument for ioctl is unsigned long, not int. Fix all the
places that we pass cmd through to the ioctl call to handle it as an
unsigned long. This prevents a sign extension bug when IOCTL commands
encode with the top bit set.
M. Warner Losh [Thu, 4 Oct 2018 21:37:17 +0000 (15:37 -0600)]
Use standard interfaces to get timezone offsets.
Use the tm_gmtoff returned from localtime() rather than the global
timezone. The formal is more portable, while the latter is specific
to glibc. There's no good reason to use the glibc specific interface.
Warner Losh [Thu, 4 Oct 2018 05:29:04 +0000 (23:29 -0600)]
Include libgen.h for basename prototype.
Also, convert open_dev to take a char * and remove the cast from where
it's called. basenmae takes a char * and modifies the string. In this
case, such modifications are fine and only the const char * type was
in error.
Warner Losh [Thu, 4 Oct 2018 05:18:38 +0000 (23:18 -0600)]
Use sys/ioctl.h to pull in definitions.
_IO* are part of the ioctl intereface, so use the more portable
sys/ioctl.h to get the definitions. Eliminate all uses of linux/fs.h
that were needed only for this.
Hannes Reinecke [Thu, 20 Sep 2018 09:09:39 +0000 (11:09 +0200)]
nvme-cli: kill nvme_passthru_admin()
The seagate plugin is the only one using it, and it's identical
to nvme_get_log13(). So replace the invocation with nvme_get_log13()
and remove the function.
Hannes Reinecke [Thu, 20 Sep 2018 09:09:36 +0000 (11:09 +0200)]
nvme-discover: Re-check generation counter after log page transfer
The log page transfer might have been split up in several chunks, so
it might happen that the generation counter changed inbetween these
transfer. Hence we need to re-fetch the header again to figure out
if there had been changes to the generation counter; if so we need
to fetch the entire page again.
Hannes Reinecke [Thu, 20 Sep 2018 09:09:35 +0000 (11:09 +0200)]
nvme-ioctl: retrieve log pages in 4k chunks
Some log pages increase with the scale of the subsystem, so the
overall size might be larger than the MDTS value for that controller.
In order to avoid having to pass in the MDTS value we should restrict
the transfer size to 4k and retrieve the log page in 4k chunks.
Hannes Reinecke [Thu, 20 Sep 2018 09:09:34 +0000 (11:09 +0200)]
nvme-discover: Retry discovery log if the generation counter changes
If the generation counter changes we need to validate if the number
of records has changed, too.
If so we need to retry retrieving the discovery log to the most recent
values. The retry will be terminated after MAX_DISC_RETRIES (currently
set to 10) to avoid infinite recursion.
Ralph Corderoy [Wed, 5 Sep 2018 21:16:07 +0000 (22:16 +0100)]
Enlarge local char[] so snprintf(3) can't truncate path.
The path is in a char[310], contributing at most 309 chars for the ‘%s’.
‘/subsysnqn’ is a further 10. Plus one for the NUL.
309 + 10 + 1 = 320 so sspath[319] is too short.
Jeff Lien [Fri, 24 Aug 2018 18:34:27 +0000 (13:34 -0500)]
nvme-cli: Fix the displayed metadata length value on Big Endian systems.
On BE systems, the metadata length value displayed as part of the
format in the nvme list command is byte swapped. So a value of 0
appears just fine but a value of 8 bytes is displayed as 0x0800.
This patch fixes that is the value is correct for both LE and BE
systems.
Hannes Reinecke [Fri, 17 Aug 2018 07:29:05 +0000 (09:29 +0200)]
nvme-discover: sanitize options
The discovery controller doesn't accept any KATO or number of I/O
queue changes, but we do want to change the reconnect delay and
the controller loss timeout.
Chaitanya Kulkarni [Mon, 13 Aug 2018 05:59:19 +0000 (22:59 -0700)]
nvme-cli: add minimal ana-log page support
This patch adds a new command to retrieve the ANA Log page.
We update identify ctrl/ns data structure to support this command.
We also add ana based error codes and different identifiers to the
linux/nvme.h header file in order to support this command.
Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com> Signed-off-by: Hannes Reinecke <hare@suse.com>
Johannes Thumshirn [Thu, 9 Aug 2018 09:25:23 +0000 (11:25 +0200)]
fabrics: write keep-alive-timeout to fabrics device on connect
Commit 7099227b07a8 ("fabrics: add option to supply keep-alive-timeout
for connect-all") introduced a keep-alive-timeout option for
connect-all but forgot to write it down to the kernel's fabrics
device in connect_ctrl().
Pass down the keep-alove-timeouts if we're connecting to a non
discovery controller.
Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de> Fixes: 7099227b07a8 ("fabrics: add option to supply keep-alive-timeout for connect-all") Signed-off-by: Keith Busch <keith.busch@intel.com>
Johannes Thumshirn [Thu, 9 Aug 2018 09:25:22 +0000 (11:25 +0200)]
fabrics: write ctrl_loss_tmo to fabrics device on connect
Commit 388c9dbe86be ("fabrics: add ctrl-loss-tmo to connect-all")
introduced the '--ctrl-loss-tmo' option for the connect-all command,
but we forgor to pass down the option to the kernel in connect_ctrl().
Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de> Fixes: 388c9dbe86be ("fabrics: add ctrl-loss-tmo to connect-all")
fixup! fabrics: write ctrl_loss_tmo to fabrics device on connect Signed-off-by: Keith Busch <keith.busch@intel.com>