aboutsummaryrefslogtreecommitdiff
path: root/sbin/nvmecontrol
Commit message (Collapse)AuthorAgeFilesLines
* nvmecontrol: document power commandWarner Losh2021-07-101-1/+32
| | | | | | | | | | The description of the power command is missing. While the synopsis is present, there's no explanation. Add one. Reviewed by: mav, chuck PR: 237866 Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D31122
* nvmecontrol: fix typo (s/Managment/Management/)Edward Tomasz Napierala2021-05-071-1/+1
| | | | Reported By: pstef
* nvmecontrol: update copyright on passthru commandWarner Losh2021-05-061-2/+1
| | | | | | | I wrote this code, not Intel, so put my copyright on this. I mistakenly copied it for the initial commit. Sponsored by: Netflix
* nvmecontrol: Report status from passthru commandsWarner Losh2021-05-061-1/+2
| | | | | | | | Report status from dword0 for passthru commands. Many commands report some status or information here, so reporting it can help know what's going on. Sponsored by: Netflix
* Fix 32-bit build post 6733401935f83754b4b2744bc3d33ef84b1271e0Dimitry Andric2021-01-081-1/+1
| | | | | | The general style in sbin/nvmecontrol apppears to print uint64_t types using %j, so I'm using that instead of the more general (but admittedly ugly) PRIu64.
* nvmecontrol: add device self-test op and log pageChuck Tuffli2021-01-084-1/+263
| | | | | | | | | | Add decoding of the Device Self-test log page and the ability to start or abort a test. Reviewed by: imp, mav Tested by: Muhammad Ahmad <muhammad.ahmad@seagate.com> MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D27517
* nvmecontrol(8): Fix a few mandoc related issues and add a SEE ALSO sectionGordon Bergling2020-12-191-5/+9
| | | | | | | | | | | | | | | - inserting missing end of block: Ss breaks Bl - skipping paragraph macro: Pp before Ss - referenced manual not found: Xr nvme 4 (2 times) - unknown standard specifier: St The The macro .St can only be used for standards known by mdoc(7). So add a SEE ALSO section and add a reference to the NVM Express Base Specification. MFC after: 2 weeks Notes: svn path=/head/; revision=368802
* Make use of the getlocalbase() function for run-time adjustment of theStefan Eßer2020-11-182-2/+5
| | | | | | | | | | | | | | | | | | local software base directory, as committed in SVN rev. 367813. The pkg and mailwrapper programs used the LOCALBASE environment variable for this purpose and this functionality is preserved by getlocalbase(). After this change, the value of the user.localbase sysctl variable is used if present (and not overridden in the environment). The nvmecontrol program gains support of a dynamic path to its plugin directory with this update. Differential Revision: https://reviews.freebsd.org/D27237 Notes: svn path=/head/; revision=367816
* [nvmecontrol] Fix type signedness warning-to-error on gcc-6.4Adrian Chadd2020-11-171-4/+4
| | | | | | | | | | | | This fixes a type signedness comparison warning-to-error on gcc-6.4. The ternary operation casts it right but the actual assignment doesn't. Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D26791 Notes: svn path=/head/; revision=367771
* Stop using NVME_MAX_XFER_SIZE constant.Alexander Motin2020-11-172-10/+14
| | | | | | | | | | 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 Notes: svn path=/head/; revision=367768
* Revert the whole getlocalbase() set of changes while a different design isScott Long2020-11-153-11/+4
| | | | | | | hashed out. Notes: svn path=/head/; revision=367711
* Fix the previous revision, it suffered from an incomplete change to theScott Long2020-11-151-1/+1
| | | | | | | | getlocalbase API. Also don't erroneously subtract the lenth from the buffer a second time. Notes: svn path=/head/; revision=367702
* Replace hardcoded references to _PATH_LOCALBASE with calls to getlocalbase.3Scott Long2020-11-143-4/+11
| | | | | | | Reviewed by: imp, se Notes: svn path=/head/; revision=367687
* Improve nvmecontrol error reporting.Alexander Motin2020-11-1316-143/+180
| | | | | | | | MFC after: 1 week Sponsored by: iXsystems, Inc. Notes: svn path=/head/; revision=367630
* Use proper variable for device path.Alexander Motin2020-10-283-4/+4
| | | | | | | | | | | | It seems *-passthru commands were broken from the day one, since the device path is fetched into opt.dev variable and not left in argv[optind]. The other three wrong argv[optind] instances are just in error messages. MFC after: 1 week Sponsored by: iXsystems, Inc. Notes: svn path=/head/; revision=367112
* Replace literal uses of /usr/local in C sources with _PATH_LOCALBASEStefan Eßer2020-10-271-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | Literal references to /usr/local exist in a large number of files in the FreeBSD base system. Many are in contributed software, in configuration files, or in the documentation, but 19 uses have been identified in C source files or headers outside the contrib and sys/contrib directories. This commit makes it possible to set _PATH_LOCALBASE in paths.h to use a different prefix for locally installed software. In order to avoid changes to openssh source files, LOCALBASE is passed to the build via Makefiles under src/secure. While _PATH_LOCALBASE could have been used here, there is precedent in the construction of the path used to a xauth program which depends on the LOCALBASE value passed on the compiler command line to select a non-default directory. This could be changed in a later commit to make the openssh build consistently use _PATH_LOCALBASE. It is considered out-of-scope for this commit. Reviewed by: imp MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D26942 Notes: svn path=/head/; revision=367075
* Fix nvmecontrol logpage -i parameter.Alexander Motin2020-10-151-1/+1
| | | | | | | MFC after: 3 days Notes: svn path=/head/; revision=366730
* Use intmax_t to print uint64_t values.Warner Losh2020-10-071-2/+2
| | | | | | | This fixes the 32-bit build where the types are different. Notes: svn path=/head/; revision=366511
* nvmecontrol: Update wdc module for newer WDC NVMe productsWarner Losh2020-10-071-19/+206
| | | | | | | | | | | | 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 Notes: svn path=/head/; revision=366506
* Whitespace fix after r365948David Bright2020-09-211-3/+3
| | | | | | | | MFC after: 1 week Sponsored by: Dell EMC Isilon Notes: svn path=/head/; revision=365967
* Honor the FWUG value of some drives in nvmecontrolDavid Bright2020-09-212-6/+23
| | | | | | | | | | | | | | | | | | | | | | nvmecontrol tries to upload firmware in chunks as large as it thinks the device permits. It fails to take into account the FWUG value used by some drives to advertise the size and alignment limits for firmware chunks. - Use the firwmare update granularity value from the - If the granularity is not reported or not restricted, fall back to the previously existing logic that calculates the max transfer size based on MDTS. - Add firmware update granularity to the identify-controller output. Reviewed by: imp (previous version), chuck Obtained from: Dell EMC Isilon MFC after: 1 week Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D26390 Notes: svn path=/head/; revision=365948
* Add missing newlines.Alexander Motin2020-07-231-5/+5
| | | | | | | MFC after: 3 days Notes: svn path=/head/; revision=363448
* Document the passthru commands.Warner Losh2020-05-012-1/+71
| | | | | | | | Reviewed by: bcr@ (earlier version) Differential Revision: https://reviews.freebsd.org/D24639 Notes: svn path=/head/; revision=360547
* Various improvements to this man page:Warner Losh2020-05-011-34/+125
| | | | | | | | | | | | | | o Be consistent about device-id and namespace-id o Use consistent arg markup for these o document you can use disk names too o document nsid command better o document the idenntify command o add a couple of examples. Differential Revision: https://reviews.freebsd.org/D24638 Notes: svn path=/head/; revision=360546
* Allow namespace-id specification where it makes sense.Alexander Motin2020-04-204-42/+142
| | | | | | | | | | | It makes tool more convenient to not require user to explicitly convert namespace device name into controller device name. There should be no changes to already existing syntaxes. MFC after: 1 week Notes: svn path=/head/; revision=360123
* Open device with O_RDONLY when command is non-invasive.Alexander Motin2020-04-207-22/+21
| | | | | | | | | | This allows to use some of the subcommands against mounted nvd devices. MFC after: 1 week Sponsored by: iXystems, Inc. Notes: svn path=/head/; revision=360117
* Ensure `kyua list` working when there is no /dev/nvme*Li-Wen Hsu2020-04-131-1/+1
| | | | | | | Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=359903
* Add a basic test for nvmecontrolDavid Bright2020-04-074-2/+250
| | | | | | | | | | | | | | | | | | | I recently made some bug fixes in nvmecontrol. It occurred to me that since nvmecontrol lacks any kyua tests, I should convert the informal testing I did into a more formal automated test. The test in this change should be considered just a starting point; it is neither complete nor thorough. While converting the test to ATF/kyua, I discovered a small bug in nvmecontrol; the nvmecontrol devlist command would always exit with an unsuccessful status. So I included the fix for that, too, so that the test won't fail. Reviewed by: imp@ MFC after: 3 days Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D24269 Notes: svn path=/head/; revision=359717
* Fix various Coverity-detected errors in nvmecontrolDavid Bright2020-04-028-11/+27
| | | | | | | | | | | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=359562
* Fix host memory buffer sizes reporting.Alexander Motin2020-01-061-2/+4
| | | | | | | | | Hardware reports values in 4KB units, not in bytes. MFC after: 3 days Notes: svn path=/head/; revision=356392
* Size is unsigned, so remove the test entirely.Warner Losh2019-09-251-4/+0
| | | | | | | | | The kernel won't crash if you have a bad value and I'd rather not have nvmecontrol know the internal details about how the nvme driver limits the transfer size. Notes: svn path=/head/; revision=352671
* After my comnd changes, the number of threads and size weren't set. InWarner Losh2019-09-251-2/+8
| | | | | | | | | | | addition, the flags are optional, but were made to be mandatory. Set these things, as well as santiy check the specified size. Submitted by: Stefan Rink PR: 240798 Notes: svn path=/head/; revision=352665
* Assume all the short args have optional args so allocate space for theWarner Losh2019-09-111-1/+1
| | | | | | | | | | ':'. It's slightly wasteful, but much easier (and the savings in bytes at runtime would be tiny, but the code to do it larger). Submitted by: Sebastian Huber Notes: svn path=/head/; revision=352212
* Report the Host Buffer Memory minimum and preferred sizes.Warner Losh2019-09-041-0/+2
| | | | | | | | | | The Host Buffer feature (NVMe 1.4 section 89) allows for the NVMe card request the host provide it buffer for lookaside tables and maybe other things. Report the card's minimum and preferred sizes with nvmecontrol/camcontrol identify. Notes: svn path=/head/; revision=351824
* Print few more useful identify fields.Alexander Motin2019-08-142-20/+34
| | | | | | | MFC after: 2 weeks Notes: svn path=/head/; revision=351038
* Fix mismerge.Warner Losh2019-08-062-6/+22
| | | | | | | | I merged passthru.c from the wrong branch (it was a branch that went further in a direction I wound up not taking). Fix the mismerge and turn passthru on. Notes: svn path=/head/; revision=350652
* Fix alignment issue r350599.Alexander Motin2019-08-051-1/+1
| | | | | | | MFC after: 10 days Notes: svn path=/head/; revision=350609
* Add `nvmecontrol resv` to handle NVMe reservations.Alexander Motin2019-08-054-5/+564
| | | | | | | | | | | | NVMe reservations are quite alike to SCSI persistent reservations and can be used in clustered setups with shared multiport storage. MFC after: 10 days Relnotes: yes Sponsored by: iXsystems, Inc. Notes: svn path=/head/; revision=350599
* Add `nvmecontrol sanitize` command.Alexander Motin2019-08-034-5/+296
| | | | | | | | | | | | | | | It allows to delete all user data from NVM subsystem in one of 3 methods. It is a close equivalent of SCSI SANITIZE command of `camcontrol sanitize`, so I tried to keep arguments as close as possible. While there, fix supported sanitize methods reporting in `identify`. MFC after: 2 weeks Relnotes: yes Sponsored by: iXsystems, Inc. Notes: svn path=/head/; revision=350563
* Fix parameter check broken at r350057.Alexander Motin2019-08-031-1/+1
| | | | | | | MFC after: 2 weeks Notes: svn path=/head/; revision=350555
* Decode few more NVMe log pages.Alexander Motin2019-08-024-14/+292
| | | | | | | | | | | | | 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. Notes: svn path=/head/; revision=350541
* Add more new fields and values from NVMe 1.4.Alexander Motin2019-08-021-0/+7
| | | | | | | MFC after: 2 weeks Notes: svn path=/head/; revision=350529
* Rename function added in r350523 to make gcc happy.Alexander Motin2019-08-011-3/+3
| | | | | | | MFC after: 2 weeks Notes: svn path=/head/; revision=350524
* Add IOCTL to translate nvdX into nvmeY and NSID.Alexander Motin2019-08-0112-110/+157
| | | | | | | | | | | | | | | 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. Notes: svn path=/head/; revision=350523
* Feature-complete NVMe Namespace Management.Alexander Motin2019-07-316-39/+442
| | | | | | | | | | | | | | | | | | 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. Notes: svn path=/head/; revision=350477
* Tune some commands desctiption.Alexander Motin2019-07-315-12/+12
| | | | | | | MFC after: 2 weeks Notes: svn path=/head/; revision=350462
* Fix usage printing for nested subcommands.Alexander Motin2019-07-311-2/+15
| | | | | | | | | Instead of `nvmecontrol create` should be `nvmecontrol ns create`, etc. MFC after: 2 weeks Notes: svn path=/head/; revision=350461
* Add some new fields and bits from NVMe 1.4.Alexander Motin2019-07-291-7/+30
| | | | | | | | MFC after: 2 weeks Sponsored by: iXsystems, Inc. Notes: svn path=/head/; revision=350399
* Fix the fix to the logic bug. Upon further testing, the bug is that we shadoowWarner Losh2019-07-241-3/+2
| | | | | | | | opt.vendor with vendor. We shouldn't. Delete the latter and use the former everywhere and restore the prior logic which is now correct. Notes: svn path=/head/; revision=350311
* Fix several related coverity issues:Warner Losh2019-07-242-2/+6
| | | | | | | | | | Make sure to always free shortopts and lopts when returning. Fix minor logic bug to guard against NULLs properly. CID: 1403654, 1403656, 1403658 Notes: svn path=/head/; revision=350309