Linux-NVME Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: hch@lst.de (Christoph Hellwig)
Subject: [PATCH 02/10] nvme.h: add ANA definitions
Date: Wed,  6 Jun 2018 16:33:03 +0200	[thread overview]
Message-ID: <20180606143311.23076-3-hch@lst.de> (raw)
In-Reply-To: <20180606143311.23076-1-hch@lst.de>

Add various defintions from NVMe 1.3 TP 4004.

Signed-off-by: Christoph Hellwig <hch at lst.de>
---
 include/linux/nvme.h | 50 +++++++++++++++++++++++++++++++++++++++++++++++---
 1 file changed, 47 insertions(+), 3 deletions(-)

diff --git a/include/linux/nvme.h b/include/linux/nvme.h
index 32f24f4ca763..fdff3c37bdd9 100644
--- a/include/linux/nvme.h
+++ b/include/linux/nvme.h
@@ -242,7 +242,12 @@ struct nvme_id_ctrl {
 	__le32			sanicap;
 	__le32			hmminds;
 	__le16			hmmaxd;
-	__u8			rsvd338[174];
+	__u8			rsvd338[4];
+	__u8			anatt;
+	__u8			anacap;
+	__le32			anagrpmax;
+	__le32			nanagrpid;
+	__u8			rsvd352[160];
 	__u8			sqes;
 	__u8			cqes;
 	__le16			maxcmd;
@@ -258,7 +263,8 @@ struct nvme_id_ctrl {
 	__le16			acwu;
 	__u8			rsvd534[2];
 	__le32			sgls;
-	__u8			rsvd540[228];
+	__le32			mnan;
+	__u8			rsvd544[224];
 	char			subnqn[256];
 	__u8			rsvd1024[768];
 	__le32			ioccsz;
@@ -312,7 +318,9 @@ struct nvme_id_ns {
 	__le16			nabspf;
 	__le16			noiob;
 	__u8			nvmcap[16];
-	__u8			rsvd64[40];
+	__u8			rsvd64[28];
+	__le32			anagrpid;
+	__u8			rsvd96[8];
 	__u8			nguid[16];
 	__u8			eui64[8];
 	struct nvme_lbaf	lbaf[16];
@@ -425,6 +433,32 @@ struct nvme_effects_log {
 	__u8   resv[2048];
 };
 
+enum nvme_ana_state {
+	NVME_ANA_OPTIMIZED		= 0x01,
+	NVME_ANA_NONOPTIMIZED		= 0x02,
+	NVME_ANA_INACCESSIBLE		= 0x03,
+	NVME_ANA_PERSISTENT_LOSS	= 0x04,
+	NVME_ANA_CHANGE			= 0x0f,
+};
+
+struct nvme_ana_group_desc {
+	__le32	grpid;
+	__le32	nnsids;
+	__le64	chgcnt;
+	__u8	state;
+	__u8	rsvd17[7];
+	__le32	nsids[];
+};
+
+/* flag for the log specific field of the ANA log */
+#define NVME_ANA_LOG_RGO	(1 << 0)
+
+struct nvme_ana_rsp_hdr {
+	__le64	chgcnt;
+	__le16	ngrps;
+	__le16	rsvd10[3];
+};
+
 enum {
 	NVME_SMART_CRIT_SPARE		= 1 << 0,
 	NVME_SMART_CRIT_TEMPERATURE	= 1 << 1,
@@ -444,11 +478,13 @@ enum {
 enum {
 	NVME_AER_NOTICE_NS_CHANGED	= 0x00,
 	NVME_AER_NOTICE_FW_ACT_STARTING = 0x01,
+	NVME_AER_NOTICE_ANA		= 0x03,
 };
 
 enum {
 	NVME_AEN_CFG_NS_ATTR		= 1 << 8,
 	NVME_AEN_CFG_FW_ACT		= 1 << 9,
+	NVME_AEN_CFG_ANA_CHANGE		= 1 << 11,
 };
 
 struct nvme_lba_range_type {
@@ -758,6 +794,7 @@ enum {
 	NVME_LOG_FW_SLOT	= 0x03,
 	NVME_LOG_CHANGED_NS	= 0x04,
 	NVME_LOG_CMD_EFFECTS	= 0x05,
+	NVME_LOG_ANA		= 0x0c,
 	NVME_LOG_DISC		= 0x70,
 	NVME_LOG_RESERVATION	= 0x80,
 	NVME_FWACT_REPL		= (0 << 3),
@@ -1180,6 +1217,13 @@ enum {
 	NVME_SC_ACCESS_DENIED		= 0x286,
 	NVME_SC_UNWRITTEN_BLOCK		= 0x287,
 
+	/*
+	 * Path-related Errors:
+	 */
+	NVME_SC_ANA_PERSISTENT_LOSS	= 0x301,
+	NVME_SC_ANA_INACCESSIBLE	= 0x302,
+	NVME_SC_ANA_TRANSITION		= 0x303,
+
 	NVME_SC_DNR			= 0x4000,
 };
 
-- 
2.14.2

  parent reply	other threads:[~2018-06-06 14:33 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-06 14:33 draft ANA support v3 Christoph Hellwig
2018-06-06 14:33 ` [PATCH 01/10] nvme.h: add support for the log specific field Christoph Hellwig
2018-06-07  7:27   ` Johannes Thumshirn
2018-06-07  7:58   ` Hannes Reinecke
2018-06-07 12:34   ` Sagi Grimberg
2018-06-06 14:33 ` Christoph Hellwig [this message]
2018-06-07  7:59   ` [PATCH 02/10] nvme.h: add ANA definitions Hannes Reinecke
2018-06-07  8:30   ` Johannes Thumshirn
2018-06-07 12:35   ` Sagi Grimberg
2018-06-06 14:33 ` [PATCH 03/10] nvme: simplify the API for getting log pages Christoph Hellwig
2018-06-07  7:39   ` Johannes Thumshirn
2018-06-07  7:59   ` Hannes Reinecke
2018-06-07 12:35   ` Sagi Grimberg
2018-06-06 14:33 ` [PATCH 04/10] nvme: remove nvme_req_needs_failover Christoph Hellwig
2018-06-07  7:40   ` Johannes Thumshirn
2018-06-07  8:01   ` Hannes Reinecke
2018-06-07 11:57     ` Christoph Hellwig
2018-06-07 12:36   ` Sagi Grimberg
2018-06-06 14:33 ` [PATCH 05/10] nvme: add ANA support Christoph Hellwig
2018-06-07  8:01   ` Hannes Reinecke
2018-06-07 12:49   ` Sagi Grimberg
2018-06-07 13:05     ` Christoph Hellwig
2018-06-07 13:55       ` Christoph Hellwig
2018-06-06 14:33 ` [PATCH 06/10] nvme: don't set gendisks live that don't have an I/O capable path Christoph Hellwig
2018-06-06 14:33 ` [PATCH 07/10] nvmet: track and limit the number of namespaces per subsystem Christoph Hellwig
2018-06-07  7:54   ` Johannes Thumshirn
2018-06-07  8:02   ` Hannes Reinecke
2018-06-06 14:33 ` [PATCH 08/10] nvmet: add minimal ANA support Christoph Hellwig
2018-06-07  8:03   ` Hannes Reinecke
2018-06-07 12:52   ` Sagi Grimberg
2018-06-06 14:33 ` [PATCH 09/10] nvmet: support configuring ANA groups Christoph Hellwig
2018-06-07  8:09   ` Hannes Reinecke
2018-06-07 12:02     ` Christoph Hellwig
2018-06-07 12:58   ` Sagi Grimberg
2018-06-07 13:08     ` Christoph Hellwig
2018-06-06 14:33 ` [PATCH 10/10] host fold Christoph Hellwig
2018-06-06 14:46   ` Christoph Hellwig
2018-06-06 15:18     ` Hannes Reinecke
2018-06-07 12:34 ` draft ANA support v3 Sagi Grimberg
2018-06-07 13:06   ` Christoph Hellwig

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180606143311.23076-3-hch@lst.de \
    --to=hch@lst.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox