History log of /freebsd-current/sbin/nvmecontrol/identify.c
Revision Date Author Comments
# fba73a40 29-Jan-2024 John Baldwin <jhb@FreeBSD.org>

nvmecontrol: Use the NVMEV macro instead of expanded versions

Reviewed by: imp
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D43597


# 32e86a82 24-Nov-2023 Warner Losh <imp@FreeBSD.org>

sbin: Automated cleanup of cdefs and other formatting

Apply the following automated changes to try to eliminate
no-longer-needed sys/cdefs.h includes as well as now-empty
blank lines in a row.

Remove /^#if.*\n#endif.*\n#include\s+<sys/cdefs.h>.*\n/
Remove /\n+#include\s+<sys/cdefs.h>.*\n+#if.*\n#endif.*\n+/
Remove /\n+#if.*\n#endif.*\n+/
Remove /^#if.*\n#endif.*\n/
Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/types.h>/
Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/param.h>/
Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/capsicum.h>/

Sponsored by: Netflix


# 1d386b48 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

Remove $FreeBSD$: one-line .c pattern

Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/


# 4d846d26 10-May-2023 Warner Losh <imp@FreeBSD.org>

spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD

The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch
up to that fact and revert to their recommended match of BSD-2-Clause.

Discussed with: pfg
MFC After: 3 days
Sponsored by: Netflix


# ae5a522c 21-Sep-2021 Allan Jude <allanjude@FreeBSD.org>

nvmecontrol: Display Metadata and Sanitize capabilities of the device

Determine if a device supports "Extended" or "Separate" metadata, and
what the current metadata setting is (None, Extended, Separate)

Also determine if the device supports:
- Sanitize Crypto Erase
- Sanitize Block Erase
- Sanitize Overwrite

Reviewed by: chuck
Sponsored by: NetApp, Inc.
Sponsored by: Klara, Inc.
X-NetApp-PR: #49
Differential Revision: https://reviews.freebsd.org/D31067


# d379886a 14-Jul-2021 Alexander Motin <mav@FreeBSD.org>

Filter out LBA formats with LBA Data Size of 0.

According to the spec: "If the value reported is 0h, then LBA format
is not supported / used or is not currently available".

MFC after: 1 week


# 5dc463f9 12-Nov-2020 Alexander Motin <mav@FreeBSD.org>

Improve nvmecontrol error reporting.

MFC after: 1 week
Sponsored by: iXsystems, Inc.


# 81614d23 23-Jul-2020 Alexander Motin <mav@FreeBSD.org>

Add missing newlines.

MFC after: 3 days


# 1f15d49e 20-Apr-2020 Alexander Motin <mav@FreeBSD.org>

Open device with O_RDONLY when command is non-invasive.

This allows to use some of the subcommands against mounted nvd devices.

MFC after: 1 week
Sponsored by: iXystems, Inc.


# 6995fb5e 02-Apr-2020 David Bright <dab@FreeBSD.org>

Fix various Coverity-detected errors in nvmecontrol

This fixes several Coverity-detected errors in nvmecontrol. While in
here, a couple additional errors with shift/mask confusion that were
not diagnosed by Coverity are also fixed.

CIDs addressed: 1040299, 1040300, 1403972, 1403973, 1403985, 1403988,
1403990, 1404374, 1404427, 1404469, 1404510, 1404534, 1418118

CID 1403657 (resource leak of shared library handle) was marked
"intentional" in the Coverity scan database.

Reviewed by: vangyzen, robert.herndon_dell.com
Reviewed by: daniel.william.ryan_gmail.com (earlier version)
Reviewed by: rramsden_isilon.com (earlier version), imp
MFC after: 5 days
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D24203


# 4035e778 14-Aug-2019 Alexander Motin <mav@FreeBSD.org>

Print few more useful identify fields.

MFC after: 2 weeks


# a7bf63be 01-Aug-2019 Alexander Motin <mav@FreeBSD.org>

Add IOCTL to translate nvdX into nvmeY and NSID.

While very useful by itself, it also makes `nvmecontrol` not depend on
hardcoded device names parsing, that in its turn makes simple to take
nvdX (and potentially any other) device names as arguments.

Also added IOCTL bypass from nvdX to respective nvmeYnsZ makes them
interchangeable for management purposes.

MFC after: 2 weeks
Sponsored by: iXsystems, Inc.


# 3b3dd3f7 31-Jul-2019 Alexander Motin <mav@FreeBSD.org>

Feature-complete NVMe Namespace Management.

This adds several previously missed but important subcommands to list
namespaces and controllers. It also fixes few previously added but
just found with real testing to be broken subcommands.

Also while there, add possibility to explicitly specify nsid for
`nvmecontrol identify` subcommand. It may be useful to specify nsids
not having own devices, for example 0xffffffff, or just newly created
ones.

MFC after: 2 weeks
Relnotes: yes
Sponsored by: iXsystems, Inc.


# f634b4c1 16-Jul-2019 Warner Losh <imp@FreeBSD.org>

Create generic command / arg parsing routines

Create a set of routines and structures to hold the data for the args
for a command. Use them to generate help and to parse args. Convert
all the current commands over to the new format. "comnd" is a hat-tip
to the TOPS-20 %COMND JSYS that (very) loosely inspired much of the
subsequent command line notions in the industry, but this is far
simpler (the %COMND man page is longer than this code) and not in the
kernel... Also, it implements today's de-facto
command [verb]+ [opts]* [args]*
format rather than the old, archaic TOPS-20 command format :)

This is a snapshot of a work in progress to get the nvme passthru
stuff committed. In time it will become a private library and used
by some other programs in the tree that conform to the above pattern.

Differential Revision: https://reviews.freebsd.org/D19296


# 1aed4995 05-May-2019 Alexander Motin <mav@FreeBSD.org>

Decode Deallocate Logical Block Features.

MFC after: 1 week


# 0d095c23 06-Dec-2018 Warner Losh <imp@FreeBSD.org>

Const poison the command interface

Make the pointers we pass into the commands const, also make the
linker set mirrors const.

Suggested by: cem@
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D18459


# d4fdb249 02-Dec-2018 Warner Losh <imp@FreeBSD.org>

Usage cleanup pt 2

Eliminage redundant spaces and nvmecontrol at start of all the usage
strings. Update the usage printing code to add them back when
presenting to the user. Allow multi-line usage messages and print
proper leading spaces for lines starting with a space.

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D18403


# 7d923c13 02-Dec-2018 Warner Losh <imp@FreeBSD.org>

Usage cleanup pt 1

Provide a usage() function that takes a struct nvme_function pointer
and produces a usage mssage. Eliminate all now-redundant usage
functions. Propigate the new argument through the program as needed.
Use common routine to print usage.

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D18403


# a13a291a 02-Dec-2018 Warner Losh <imp@FreeBSD.org>

Move nvmecontrol to using linker sets for commands

More commands will be added to nvmecontrol. Also, there will be a few
more vendor commands (some of which may need to remain private to
companies writing them). The first step on that journey is to move to
using linker sets to dispatch commands. The next step will be using
dlopen to bring in the .so's that have the command that might need
to remain private for seamless integration.

Similar changes to this will be needed for vendor specific log pages.

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D18403


# e505b7ec 13-Jun-2018 Warner Losh <imp@FreeBSD.org>

Make it possible to use print_controller from another program

Rename print_controller to nvme_print_controller. Put it in its
own file for easy inclusion. Move util.c to be nc_util.c to not
conflict with camcontrol. add nvecontrol_ext.h to define shared
interfaces.

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D15371


# 2bac48c2 06-Jun-2018 Justin Hibbits <jhibbits@FreeBSD.org>

Print Maximum Data Transfer Size as a long rather than int

PowerPC has PAGE_SIZE as a long, not an int. This causes the compiler to throw
a format mismatch warning on this print. To work around the difference, print
it as a long instead of an int, and force the argument to a long.

Reviewed By: imp
Differential Revision: https://reviews.freebsd.org/D15653


# 635c517a 12-Mar-2018 Alexander Motin <mav@FreeBSD.org>

Add `nvmecontrol format` subcommand.

It allows to change namespace parameters, such as block size, metadata,
protection information, etc. and/or erase the data.

MFC after: 2 weeks
Sponsored by: iXsystems, Inc.


# 01c1be35 12-Mar-2018 Alexander Motin <mav@FreeBSD.org>

Print fuses and fna fields in identify data.

MFC after: 2 weeks
Sponsored by: iXsystems, Inc.


# 3fa5467a 10-Mar-2018 Alexander Motin <mav@FreeBSD.org>

Add new identify data structures fields from NVMe 1.3a.

Some of them are already supported by existing hardware, so reporting
them `nvmecontrol identify` can be useful.


# deeec772 22-Feb-2018 Alan Somers <asomers@FreeBSD.org>

nvmecontrol: fix build on amd64/clang

Broken by: 329824
Sponsored by: Spectra Logic Corp


# 0d787e9b 22-Feb-2018 Wojciech Macek <wma@FreeBSD.org>

NVMe: Add big-endian support

Remove bitfields from defined structures as they are not portable.
Instead use shift and mask macros in the driver and nvmecontrol application.

NVMe is now working on powerpc64 host.

Submitted by: Michal Stanek <mst@semihalf.com>
Obtained from: Semihalf
Reviewed by: imp, wma
Sponsored by: IBM, QCM Technologies
Differential revision: https://reviews.freebsd.org/D13916


# 1de7b4b8 27-Nov-2017 Pedro F. Giffuni <pfg@FreeBSD.org>

various: general adoption of SPDX licensing ID tags.

Mainly focus on files that use BSD 2-Clause license, however the tool I
was using misidentified many licenses so this was mostly a manual - error
prone - task.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.

No functional change intended.


# 781fe538 28-Aug-2017 Warner Losh <imp@FreeBSD.org>

Print the controller's ID in identify.

Submitted by: Matt Williams
Sponsored by: Netflix


# bbd508ca 27-Jun-2017 Warner Losh <imp@FreeBSD.org>

Report some aspects of namespaces and namespace support in identify
command.

Sponsored by: Netflix
Submitted by: Matt Williams (via D11330)


# 38441bd9 19-Jul-2013 Jim Harris <jimharris@FreeBSD.org>

Add message when nvd disks are attached and detached.

As part of this commit, add an nvme_strvis() function which borrows
heavily from cam_strvis(). This will allow stripping of
leading/trailing whitespace and also handle unprintable characters
in model/serial numbers. This function goes into a new nvme_util.c
file which is used by both the driver and nvmecontrol.

Sponsored by: Intel
Reviewed by: carl
MFC after: 3 days


# e8f25c62 17-Jul-2013 Jim Harris <jimharris@FreeBSD.org>

Define constants for the lengths of the serial number, model number
and firmware revision in the controller's identify structure.

Also modify consumers of these fields to ensure they only use the
specified number of bytes for their respective fields.

Sponsored by: Intel
Reviewed by: carl
MFC after: 3 days


# 08c29873 09-Jul-2013 Jim Harris <jimharris@FreeBSD.org>

Ensure controller or namespace node name is specified before trying to
access it.

While here, also fix the identify usage message to show the -v and -x
parameters.

Sponsored by: Intel
MFC after: 3 days


# 9c0871b2 09-Jul-2013 Jim Harris <jimharris@FreeBSD.org>

Condense the output for displaying LBA formats.

Sponsored by: Intel
MFC after: 3 days


# 2528d6a3 09-Jul-2013 Jim Harris <jimharris@FreeBSD.org>

Send per-namespace logpage commands to the controller devnode, so they
are processed as admin commands, not I/O commands.

As part of this change, pull out the code for parsing a namespace node
string into a separate function, since it is used for both identify and
logpage commands.

Sponsored by: Intel
MFC after: 3 days


# 821ef73c 09-Jul-2013 Jim Harris <jimharris@FreeBSD.org>

Incorporate feedback from bde@ based on r252672 changes:

* Use 0/1 instead of sysexits. Man pages are confusing on this topic,
but 0/1 is sufficient for nvmecontrol.
* Use err function family where possible instead of fprintf/exit.
* Fix some typing errors.
* Clean up some error message inconsistencies.

Sponsored by: Intel
Submitted by: bde (parts of firmware.c changes)
MFC after: 3 days


# e83c9e35 26-Jun-2013 Jim Harris <jimharris@FreeBSD.org>

Add generalized helper functions for printing hex data as part of
nvmecontrol commands.

Submitted by: Joe Golio <joseph.golio@emc.com>
Obtained from: EMC / Isilon Storage Division
MFC after: 3 days


# d2cdb28b 26-Jun-2013 Jim Harris <jimharris@FreeBSD.org>

Ensure that a device node is specified when invoking the identify or reset
commands.

Also improve the checking of device node names, so that better error
messages are displayed when incorrect names are specified.

Sponsored by: Intel
MFC after: 3 days


# 6420873c 26-Jun-2013 Jim Harris <jimharris@FreeBSD.org>

Create #defines for NVME_CTRLR_PREFIX and NVME_NS_PREFIX for the "nvme"
and "ns" strings, rather than hardcoding the string values throughout the
nvmecontrol code base.

Sponsored by: Intel
MFC after: 3 days


# 6f0823e4 26-Jun-2013 Jim Harris <jimharris@FreeBSD.org>

Break out code related to the identify command into a separate source file.

Sponsored by: Intel
MFC after: 3 days