Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 13 May 2019 13:28:42 +0000 (UTC)
From:      Alexander Motin <mav@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org
Subject:   svn commit: r347523 - in stable/12: sbin/nvmecontrol sys/dev/nvme
Message-ID:  <201905131328.x4DDSgP0082093@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mav
Date: Mon May 13 13:28:42 2019
New Revision: 347523
URL: https://svnweb.freebsd.org/changeset/base/347523

Log:
  MFC r347158: Decode Deallocate Logical Block Features.

Modified:
  stable/12/sbin/nvmecontrol/identify.c
  stable/12/sys/dev/nvme/nvme.h
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sbin/nvmecontrol/identify.c
==============================================================================
--- stable/12/sbin/nvmecontrol/identify.c	Mon May 13 12:38:33 2019	(r347522)
+++ stable/12/sbin/nvmecontrol/identify.c	Mon May 13 13:28:42 2019	(r347523)
@@ -49,7 +49,7 @@ print_namespace(struct nvme_namespace_data *nsdata)
 	uint32_t	i;
 	uint32_t	lbaf, lbads, ms, rp;
 	uint8_t		thin_prov, ptype;
-	uint8_t		flbas_fmt;
+	uint8_t		flbas_fmt, t;
 
 	thin_prov = (nsdata->nsfeat >> NVME_NS_DATA_NSFEAT_THIN_PROV_SHIFT) &
 		NVME_NS_DATA_NSFEAT_THIN_PROV_MASK;
@@ -122,6 +122,16 @@ print_namespace(struct nvme_namespace_data *nsdata)
 		    NVME_NS_DATA_FPI_PERC_MASK);
 	} else
 		printf("Not Supported\n");
+	t = (nsdata->dlfeat >> NVME_NS_DATA_DLFEAT_READ_SHIFT) &
+	    NVME_NS_DATA_DLFEAT_READ_MASK;
+	printf("Deallocate Logical Block:    Read %s%s%s\n",
+	    (t == NVME_NS_DATA_DLFEAT_READ_NR) ? "Not Reported" :
+	    (t == NVME_NS_DATA_DLFEAT_READ_00) ? "00h" :
+	    (t == NVME_NS_DATA_DLFEAT_READ_FF) ? "FFh" : "Unknown",
+	    (nsdata->dlfeat >> NVME_NS_DATA_DLFEAT_DWZ_SHIFT) &
+	     NVME_NS_DATA_DLFEAT_DWZ_MASK ? ", Write Zero" : "",
+	    (nsdata->dlfeat >> NVME_NS_DATA_DLFEAT_GCRC_SHIFT) &
+	     NVME_NS_DATA_DLFEAT_GCRC_MASK ? ", Guard CRC" : "");
 	printf("Optimal I/O Boundary (LBAs): %u\n", nsdata->noiob);
 	printf("Globally Unique Identifier:  ");
 	for (i = 0; i < sizeof(nsdata->nguid); i++)

Modified: stable/12/sys/dev/nvme/nvme.h
==============================================================================
--- stable/12/sys/dev/nvme/nvme.h	Mon May 13 12:38:33 2019	(r347522)
+++ stable/12/sys/dev/nvme/nvme.h	Mon May 13 13:28:42 2019	(r347523)
@@ -349,6 +349,20 @@
 #define NVME_NS_DATA_FPI_SUPP_SHIFT		(7)
 #define NVME_NS_DATA_FPI_SUPP_MASK		(0x1)
 
+/** Deallocate Logical Block Features */
+/* deallocated logical block read behavior */
+#define NVME_NS_DATA_DLFEAT_READ_SHIFT		(0)
+#define NVME_NS_DATA_DLFEAT_READ_MASK		(0x07)
+#define NVME_NS_DATA_DLFEAT_READ_NR		(0x00)
+#define NVME_NS_DATA_DLFEAT_READ_00		(0x01)
+#define NVME_NS_DATA_DLFEAT_READ_FF		(0x02)
+/* supports the Deallocate bit in the Write Zeroes */
+#define NVME_NS_DATA_DLFEAT_DWZ_SHIFT		(3)
+#define NVME_NS_DATA_DLFEAT_DWZ_MASK		(0x01)
+/* Guard field for deallocated logical blocks is set to the CRC  */
+#define NVME_NS_DATA_DLFEAT_GCRC_SHIFT		(4)
+#define NVME_NS_DATA_DLFEAT_GCRC_MASK		(0x01)
+
 /** lba format support */
 /* metadata size */
 #define NVME_NS_DATA_LBAF_MS_SHIFT			(0)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201905131328.x4DDSgP0082093>