Page MenuHomeFreeBSD

nvmecontrol: Display Metadata and Sanitize capabilities of the device
ClosedPublic

Authored by allanjude on Jul 5 2021, 7:07 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, May 9, 12:25 AM
Unknown Object (File)
Wed, May 8, 12:08 PM
Unknown Object (File)
Wed, May 8, 9:58 AM
Unknown Object (File)
Wed, May 8, 9:58 AM
Unknown Object (File)
Mar 22 2024, 9:26 PM
Unknown Object (File)
Mar 22 2024, 9:26 PM
Unknown Object (File)
Mar 22 2024, 9:26 PM
Unknown Object (File)
Mar 22 2024, 9:26 PM
Subscribers

Details

Summary

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

Also determine if the device supports:

  • Sanitize Crypto Erase
  • Sanitize Block Erase
  • Sanitize Overwrite

Sponsored by: NetApp, Inc.
Sponsored by: Klara, Inc.
X-NetApp-PR: #49

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

chuck requested changes to this revision.Jul 5 2021, 9:47 PM
chuck added inline comments.
sbin/nvmecontrol/identify.c
189

It might be better to report this with FLBAS (near the beginning of this function). Note that bit 4 of FLBAS indicates Separate vs Extended IFF MS is non-zero. Using this bit simplifies the logic a little. Perhaps something along the lines of:

	printf("Current LBA Format:          LBA Format #%02d", flbas_fmt);
	if (nsdata->lbaf[flbas_fmt] >> NVME_NS_DATA_LBAF_MS_SHIFT & NVME_NS_DATA_LBAF_MS_MASK)
		printf(" %s metadata\n", nsdata->flbas >> NVME_NS_DATA_FLBAS_EXTENDED_SHIFT &
		    NVME_NS_DATA_FLBAS_EXTENDED_MASK ? "Extended" : "Separate");
	else
		printf("\n");
sbin/nvmecontrol/identify_ext.c
283

It would be better to print these capabilities in the "Controller Capabilities/Features" section at the beginning.

290

Note that sys/dev/nvme/nvme.h defines macros for the sanitize capability bits.

This revision now requires changes to proceed.Jul 5 2021, 9:47 PM
allanjude added inline comments.
sbin/nvmecontrol/identify.c
189

I agree this makes more sense

sbin/nvmecontrol/identify_ext.c
290

Thanks, I've also added the 2 extra bits that were defined in the header.

The '((cap >> shift) & mask)' thing is so prevalent in this code, I almost wonder if we could make a macro

instead of:

((cdata->sanicap >> NVME_CTRLR_DATA_SANICAP_BES_SHIFT) &
    NVME_CTRLR_DATA_SANICAP_BES_MASK) ?
    "Supported" : "Not Supported");

have:

#define NVME_CAP(cap, prefix) ((cap >> prefix##_SHIFT) & prefix##_MASK)

               NVME_CAP(cdata->sanicap, NVME_CTRLR_DATA_SANICAP_BES) ? "Supported" : "Not Supported");
allanjude marked 2 inline comments as done.

Address feedback from Chuck

chuck added inline comments.
sbin/nvmecontrol/identify.c
184

I'd still prefer this being reported above with the other capabilities, between "Current LBA Format" and "Data Protection Caps" to match the spec. But, perhaps, there is a reason to list it here?

This revision is now accepted and ready to land.Jul 26 2021, 4:18 PM