Commit Graph

17 Commits

Author SHA1 Message Date
Wanpeng Qian
3a194eac3c 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
2022-11-11 12:15:52 -07:00
Emmanuel Vadot
5f9db65d8a pkgbase: Put nvmecontrol in its own package
It doesn't really make sense to have it in runtime and let's not
bloat utilities more.

Reviewed by:	emaste
Differential Revision:	https://reviews.freebsd.org/D36221
2022-10-26 19:46:22 +02:00
Cy Schubert
142c3c7fef nvmecontrol: Apply cast
The proper fix also casts to uintmax_t.

Reported by:	imp
Fixes:		a7b568109e
2022-10-06 11:58:16 -07:00
Cy Schubert
a7b568109e nvmecontrol: Fix i386 build
Fix:

--- all_subdir_sbin ---
/opt/src/git-src/sbin/nvmecontrol/modules/samsung/samsung.c:149:64:
error: format specifies type 'unsigned long' but the argument has type
'uint64_t' (aka 'unsigned long long') [-Werror,-Wformat]
        printf("   Read Reclaim Count                       : %lu\n",
le64dec(&temp->rrc));
                                                              ~~~
^~~~~~~~~~~~~~~~~~~
                                                              %llu
/opt/src/git-src/sbin/nvmecontrol/modules/samsung/samsung.c:150:64:
error: forma t specifies type 'unsigned long' but the argument has type
'uint64_t' (aka 'unsigned long long') [-Werror,-Wformat]
        printf("   Lifetime Uncorrectable ECC Count         : %lu\n",
le64dec(&temp->lueccc));
                                                              ~~~
^~~~~~~~~~~~~~~~~~~~~~
                                                              %llu
2 errors generated.

Fixes:		84e8678870
2022-10-06 11:26:50 -07:00
Wanpeng Qian
84e8678870 nvmecontrol: Add Samsung Extended SMART Information logpage support
Samsung PM983 SSD has a 0xca logpage. It has more information compared
to Intel's this patch tested on PM983 M2 SSD and works as expected.

Reviewed by:		imp@
Approved by:		kp@
Event:			Aberdeen Hackathon 2022
Differential revision:	https://reviews.freebsd.org/D33749
2022-10-06 10:24:02 +00:00
John Baldwin
1187e46d1b nvmecontrol wdc: Don't pass a bogus pointer to free().
wdc_get_dui_log_size allocates a buffer and then advances the
returned pointer.  Passing this advanced pointer to free() is UB,
so save the original pointer to pass to free() instead.

Reviewed by:	imp
Reported by:	GCC 12 -Wfree-nonheap-object
Differential Revision:	https://reviews.freebsd.org/D36827
2022-10-03 16:10:44 -07:00
John Baldwin
d81082a7ad nvmecontrol wdc: Remove unused but set variable.
Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D36812
2022-10-03 16:10:42 -07:00
Alexander Motin
329327e272 Stop using NVME_MAX_XFER_SIZE constant.
This constant depends on MAXPHYS and does not respect device capabilities.
Use proper dynamic ioctl(NVME_GET_MAX_XFER_SIZE) instead.

MFC after:	1 month
2020-11-17 16:34:58 +00:00
Alexander Motin
5dc463f9a5 Improve nvmecontrol error reporting.
MFC after:	1 week
Sponsored by:	iXsystems, Inc.
2020-11-13 02:05:45 +00:00
Warner Losh
edad03308b Use intmax_t to print uint64_t values.
This fixes the 32-bit build where the types are different.
2020-10-07 07:55:55 +00:00
Warner Losh
c03b1920fb nvmecontrol: Update wdc module for newer WDC NVMe products
Update the to log fetch operation for latest WDC NVMe products.

Tested on HGST SN100 (a few years old) and WDC SN720 (more recent).

Submitted by: Akhilesh Rn <Akhilesh.RN@wdc.com> (minor style tweak by me)
Github PR: 435
2020-10-07 05:36:05 +00:00
David Bright
6995fb5eb7 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
2020-04-02 13:52:54 +00:00
Warner Losh
f634b4c1be 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
2019-07-16 17:24:03 +00:00
Warner Losh
52467047aa Regularize the Netflix copyright
Use recent best practices for Copyright form at the top of
the license:
1. Remove all the All Rights Reserved clauses on our stuff. Where we
   piggybacked others, use a separate line to make things clear.
2. Use "Netflix, Inc." everywhere.
3. Use a single line for the copyright for grep friendliness.
4. Use date ranges in all places for our stuff.

Approved by: Netflix Legal (who gave me the form), adrian@ (pmc files)
2019-02-04 21:28:25 +00:00
Warner Losh
e4aa091bd1 It's useful to have this be a global function.
Other vendors base their additional smart info pages on what Intel did
plus some other bits. So it's convenient to have this be global.

Sponsored by: Netflix
2018-12-06 22:59:18 +00:00
Warner Losh
8775459902 This is not a samsung standard, so remove that alias.
This was never documented, and isn't needed, so it's best removed to
avoid confusion.

Sponsored by: Netflix
Differential Revision:	https://reviews.freebsd.org/D18460
2018-12-06 22:59:08 +00:00
Warner Losh
eac8e82796 Move intel and wdc files to their own modules
Move the intel and wdc vendor specific stuff to their own modules.

Sponsored by: Netflix
Differential Revision:  https://reviews.freebsd.org/D18460
2018-12-06 22:58:55 +00:00