History log of /freebsd-current/sbin/nvmecontrol/nvmecontrol.h
Revision Date Author Comments
# 6573ce29 20-Apr-2024 Gordon Bergling <gbe@FreeBSD.org>

nvmecontrol(8): Remove a double word in a source code comment

- s/the the/the/

MFC after: 3 days


# 98ab7d0a 16-Apr-2024 Warner Losh <imp@FreeBSD.org>

nvmecontrol: Add nvme 2.0 fields to read_logpage

Add the lpo, ot, csi and uuid_index fields to read_logpage. The logpage
command has not been updated to allow these to be specified.

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


# 1c4b7eff 16-Apr-2024 Warner Losh <imp@FreeBSD.org>

nvmecontrol: Fix to128 for big endian targets

The source is always 128-bits in little endian format. For big endian
hosts, we have to convert, or we print bogus numbers.

Sponsored by: Netflix
Reviewed by: chuck
Differential Revision: https://reviews.freebsd.org/D44651


# e098d24b 16-Apr-2024 Warner Losh <imp@FreeBSD.org>

nvmecontrol: Have to truncate on all 32-bit architectures

armv7, powerpc, powerpcspe and i386 all lack 128-bit integer
types. Adjust the comment and #ifdef. I don't think we support nvme on
any of these other architectures at the moment, but it won't hurt to be
more precise.

Sponsored by: Netflix
Reviewed by: chuck
Differential Revision: https://reviews.freebsd.org/D44650


# 67163bc4 16-Apr-2024 Warner Losh <imp@FreeBSD.org>

nvmecontrol: Create letoh to generically convert to host order

Using _Generic, create letoh which will generically convert uintXX_t
types from little endian to host, regardless of the size. This name has
been floated as a possible addition to endian.h.

Sponsored by: Netflix
Discussed with: jhb
Reviewed by: chuck
Differential Revision: https://reviews.freebsd.org/D44649


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

Remove $FreeBSD$: two-line .h pattern

Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/


# 589fe499 01-Jun-2023 Elyes Haouas <ehaouas@noos.fr>

nvmecontrol: Fix typos

Signed-off-by: Elyes Haouas <ehaouas@noos.fr>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/653


# 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


# 3a194eac 11-Nov-2022 Wanpeng Qian <wanpengqian@gmail.com>

nvmecontrol: fix wrong temperature unit for INTEL SSDs.

Although intel's specification did not tell which unit for Temperature
Statistics (Log Identifier C5h), I believe it is based on Celsius
instead of Kelvin.

here is my P3700 SSDs result(before):

Intel Temperature Log
=====================
Current: 30 K, -243.15 C, -405.67 F
Overtemp Last Flags 0
Overtemp Lifetime Flags 0
Max Temperature 53 K, -220.15 C, -364.27 F
Min Temperature 17 K, -256.15 C, -429.07 F
Max Operating Temperature 63 K, -210.15 C, -346.27 F
Min Operating Temperature 0 K, -273.15 C, -459.67 F
Estimated Temperature Offset: 0 C/K
after apply the patch, result is

Intel Temperature Log
=====================
Current: 303.15 K, 30 C, 86.00 F
Overtemp Last Flags 0
Overtemp Lifetime Flags 0
Max Temperature 326.15 K, 53 C, 127.40 F
Min Temperature 290.15 K, 17 C, 62.60 F
Max Operating Temperature 336.15 K, 63 C, 145.40 F
Min Operating Temperature 273.15 K, 0 C, 32.00 F
Estimated Temperature Offset: 0 C/K
I also compare to smartctl's report. it match very well.

also tested on Intel P3600, it fixed the problem.

Signed-off-by: Wanpeng Qian <wanpengqian@gmail.com>
Reviewed by: imp (added tweak to samsung.c so it still compiles)
Differential Revision: https://reviews.freebsd.org/D32845


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

Improve nvmecontrol error reporting.

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


# 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.


# 6c99d132 02-Aug-2019 Alexander Motin <mav@FreeBSD.org>

Decode few more NVMe log pages.

In particular: Changed Namespace List, Commands Supported and Effects,
Reservation Notification, Sanitize Status.

Add few new arguments to `nvmecontrol log` subcommand.

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


# 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


# f428a90a 22-Feb-2019 Warner Losh <imp@FreeBSD.org>

Rework logpage extensibility.

Move from using a linker set to a constructor function that's
called. This simplifies the code and is slightly more obvious. We now
keep a list of page decoders rather than having an array we managed
before. Commands will move to something similar in the future.

Reviewed by: jhb@
Differential Revision: https://reviews.freebsd.org/D19275


# 44d31a44 06-Dec-2018 Warner Losh <imp@FreeBSD.org>

Declare global function print_intel_add_smart in header


# 4b639af1 06-Dec-2018 Warner Losh <imp@FreeBSD.org>

Use proper prototypes.


# 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


# 228c4255 06-Dec-2018 Warner Losh <imp@FreeBSD.org>

Dynamically load .so modules to expand functionality

o Dynamically load all the .so files found in /libexec/nvmecontrol and
/usr/local/libexec/nvmecontrol.
o Link nvmecontrol -rdynamic so that its symbols are visible to the
libraries we load.
o Create concatinated linker sets that we dynamically expand.
o Add the linked-in top and logpage linker sets to the mirrors for them
and add those sets to the mirrors when we load a new .so.
o Add some macros to help hide the names of the linker sets.
o Update the man page.

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

fold


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

Move Intel specific log pages to intel.c

Move the Intel specific log pages (including the one that samsung
implements) to intel.c. Add comment to the samsung vendor that it will
be going away soon.

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


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

Move common logpage routines into nvmecontrol.h

For the upcoming move of vendor specific code into vendor specific
files, make the common logpage routines global and move them to
nvmecontrol.h.

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


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

Make logpage functions a linker set.

Move logpage function def to header. Convert all the logpage_function
elements to elements of the linker set. Leave them all in logpage.c
for the moment.

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


# ba405bc8 05-May-2018 Alexander Motin <mav@FreeBSD.org>

Add NVMe Namespace Management support to nvmecontrol(8).

This allows create/delete/attach/detach namespaces on new NVMe controllers.
This is only a first user-level part of the bigger change set. Kernel part
required to detect and handle the configuration changes without reboot is
completely independent and will be added separately.

Submitted by: Matt Williams <mffbsdw@gmail.com> (original version)
Differential Revision: https://reviews.freebsd.org/D11399


# 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.


# 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.


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

Move 128-bit integer routines to util.c so they can be used by more
than just the log page code.

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


# d8fab838 24-Feb-2017 Warner Losh <imp@FreeBSD.org>

Make nvmecontrol logpage -p help list known pages.

Make -p help and -v help list all the pages we know about.
Add -v to usage.
Update the man page.

Sponsored by: Netflix


# ffce99f5 03-Feb-2017 Warner Losh <imp@FreeBSD.org>

Implement 5 wdc-specific nvme control options for their HGST drives:
wdc cap-diag Capture diagnostic data from drive
wdc drive-log Capture drive history data from drive
wdc get-crash-dump Retrieve firmware crash dump from drive


# ccac2ba7 03-Feb-2017 Warner Losh <imp@FreeBSD.org>

Move the usage and command name lookup into functions.


# 038659e7 30-Jan-2016 Warner Losh <imp@FreeBSD.org>

Implement power command to list all power modes, find out the power
mode we're in and to set the power mode.


# a2d0c525 30-Jan-2016 Enji Cooper <ngie@FreeBSD.org>

Revert r295062 to unbreak buildworld

Some of the structures referenced in power.c (in particular
struct nvme_power_state) are missing from sbin/nvmecontrol/

Pointyhat to: imp
Reported by: Jenkins [*], O. Hartmann <ohartman@zedat.fu-berlin.de>, Outback Dingo <outbackdingo@gmail.com>


# d636ad2e 29-Jan-2016 Warner Losh <imp@FreeBSD.org>

Implement power command to list all power modes, find out the power
mode we're in and to set the power mode.


# 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


# 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


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

Add firmware replacement and activation support to nvmecontrol(8) through
a new firmware command.

NVMe controllers may support up to 7 firmware slots for storing of
different firmware revisions. This new firmware command supports
firmware replacement (i.e. firmware download) with or without immediate
activation, or activation of a previously stored firmware image. It
also supports selection of the firmware slot during replacement
operations, using IDENTIFY information from the controller to
check that the specified slot is valid.

Newly activated firmware does not take effect until the new controller
reset, either via a reboot or separate 'nvmecontrol reset' command to the
same controller.

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


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

Add log page support to nvmecontrol(8) through a new logpage command.

This includes pretty printers for all of the standard NVMe log pages
(Error, SMART/Health, Firmware), as well as hex output for non-standard
or vendor-specific log pages.

Submitted by: Joe Golio <joseph.golio@emc.com>
Obtained from: EMC / Isilon Storage Division
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


# 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


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

Add an nvme_function structure array, defining the name, C function and
usage message for each nvmecontrol command. This helps reduce some code
clutter both now and for future commits which will add logpage and
firmware support to nvmecontrol(8).

Also move helper function prototypes to the end of the header file, after
the per-command functions.

Sponsored by: Intel
MFC after: 3 days


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

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

Sponsored by: Intel
MFC after: 3 days


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

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

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


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

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

Sponsored by: Intel
MFC after: 3 days