Skip to contentSkip to conversation

nvme-cli: add ana-log support

PATCH Superseded Chaitanya Kulkarni 3 participants 7 messages Jul 26, 2018 – Jul 31, 2018

Subsystems (2)

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

v2 cover nvme-cli: add ana-log support

This allows reading NVMe Asynchronous Namespace Access log page support to the nvme-cli.

Changes Since V1:-

1. Add JSON output format support.
2. Use RAE bit to retain the AEN when reading the ANA log page.
3. Fix for the Christoph's comments.

Regards,
Chaitanya

Chaitanya Kulkarni (2):
nvme-cli: add minimal ana-log page support
nvme-cli: add ana-log documentation

 Documentation/nvme-ana-log.1    |  82 ++++
 Documentation/nvme-ana-log.html | 826 ++++++++++++++++++++++++++++++++
 Documentation/nvme-ana-log.txt  |  45 ++
 linux/nvme.h                    |  52 +-
 nvme-builtin.h                  |   1 +
 nvme-ioctl.c                    |   8 +
 nvme-ioctl.h                    |   1 +
 nvme-print.c                    | 130 ++++-
 nvme-print.h                    |   2 +
 nvme.c                          |  77 +++
 10 files changed, 1219 insertions(+), 5 deletions(-)
 create mode 100644 Documentation/nvme-ana-log.1
 create mode 100644 Documentation/nvme-ana-log.html
 create mode 100644 Documentation/nvme-ana-log.txt
Signature · 1 line
2.17.0
#1 lore raw

PATCH v2 1/2 nvme-cli: add minimal ana-log page support

This patch adds a new command to retrieve the ANA Log page. We update identify ctrl/ns data structure to support this command. We also add ana based error codes and different identifiers to the linux/nvme.h header file in order to support this command.

Signed-off-by Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>
---
 linux/nvme.h   |  52 ++++++++++++++++++--
 nvme-builtin.h |   1 +
 nvme-ioctl.c   |   8 +++
 nvme-ioctl.h   |   1 +
 nvme-print.c   | 130 ++++++++++++++++++++++++++++++++++++++++++++++++-
 nvme-print.h   |   2 +
 nvme.c         |  77 +++++++++++++++++++++++++++++
 7 files changed, 266 insertions(+), 5 deletions(-)
linux/nvme.h +48 -4
index dc8ea89..50faaf0 100644
@@ -241,7 +241,12 @@ struct nvme_id_ctrl {
 	__le32			hmminds;
 	__le16			hmmaxd;
 	__le16			nsetidmax;
-	__u8			rsvd340[172];
+	__u8			rsvd340[2];
+	__u8			anatt;
+	__u8			anacap;
+	__le32			anagrpmax;
+	__le32			nanagrpid;
+	__u8			rsvd352[160];
 	__u8			sqes;
 	__u8			cqes;
 	__le16			maxcmd;
@@ -257,7 +262,8 @@ struct nvme_id_ctrl {
 	__le16			acwu;
 	__u8			rsvd534[2];
 	__le32			sgls;
-	__u8			rsvd540[228];
+	__u8			mnan;
+	__u8			rsvd544[224];
 	char			subnqn[256];
 	__u8			rsvd1024[768];
 	__le32			ioccsz;
@@ -317,7 +323,9 @@ struct nvme_id_ns {
 	__le16			nabspf;
 	__le16			noiob;
 	__u8			nvmcap[16];
-	__u8			rsvd64[36];
+	__u8			rsvd64[28];
+	__le32			anagrpid;
+	__u8			rsvd95[4];
 	__le16			nvmsetid;
 	__le16			endgid;
 	__u8			nguid[16];
@@ -516,6 +524,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,
@@ -531,6 +565,7 @@ enum {
 	NVME_AER_VS			= 7,
 	NVME_AER_NOTICE_NS_CHANGED	= 0x0002,
 	NVME_AER_NOTICE_FW_ACT_STARTING = 0x0102,
+	NVME_AER_NOTICE_ANA		= 0x03,
 };
 
 struct nvme_lba_range_type {
@@ -881,6 +916,7 @@ enum {
 	NVME_LOG_TELEMETRY_HOST = 0x07,
 	NVME_LOG_TELEMETRY_CTRL = 0x08,
 	NVME_LOG_ENDURANCE_GROUP = 0x09,
+	NVME_LOG_ANA		= 0x0c,
 	NVME_LOG_DISC		= 0x70,
 	NVME_LOG_RESERVATION	= 0x80,
 	NVME_LOG_SANITIZE	= 0x81,
@@ -892,6 +928,7 @@ enum {
 enum {
 	NVME_NO_LOG_LSP       = 0x0,
 	NVME_NO_LOG_LPO       = 0x0,
+	NVME_LOG_ANA_RGO      = 0x1,
 	NVME_TELEM_LSP_CREATE = 0x1,
 };
 
@@ -1040,7 +1077,7 @@ struct nvme_get_log_page_command {
 	__u64			rsvd2[2];
 	union nvme_data_ptr	dptr;
 	__u8			lid;
-	__u8			rsvd10;
+	__u8			lsp;
 	__le16			numdl;
 	__le16			numdu;
 	__u16			rsvd11;
@@ -1354,6 +1391,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,
 };
 
nvme-builtin.h +1 -0
index 2c26d57..f9e47b3 100644
@@ -25,6 +25,7 @@ COMMAND_LIST(
 	ENTRY("fw-log", "Retrieve FW Log, show it", get_fw_log)
 	ENTRY("changed-ns-list-log", "Retrieve Changed Namespace List, show it", get_changed_ns_list_log)
 	ENTRY("smart-log", "Retrieve SMART Log, show it", get_smart_log)
+	ENTRY("ana-log", "Retrieve ANA Log, show it", get_ana_log)
 	ENTRY("error-log", "Retrieve Error Log, show it", get_error_log)
 	ENTRY("effects-log", "Retrieve Command Effects Log, show it", get_effects_log)
 	ENTRY("endurance-log", "Retrieve Endurance Group Log, show it", get_endurance_log)
nvme-ioctl.c +8 -0
index 9cf2a33..d63c863 100644
@@ -467,6 +467,14 @@ int nvme_smart_log(int fd, __u32 nsid, struct nvme_smart_log *smart_log)
 	return nvme_get_log(fd, nsid, NVME_LOG_SMART, sizeof(*smart_log), smart_log);
 }
 
+int nvme_ana_log(int fd, void *ana_log, size_t ana_log_len, int rgo)
+{
+	__u64 lpo = 0;
+
+	return nvme_get_log13(fd, NVME_NSID_ALL, NVME_LOG_ANA, rgo, lpo, 0,
+			true, ana_log_len, ana_log);
+}
+
 int nvme_self_test_log(int fd, struct nvme_self_test_log *self_test_log)
 {
 	return nvme_get_log(fd, NVME_NSID_ALL, NVME_LOG_DEVICE_SELF_TEST,
nvme-ioctl.h +1 -0
index b34f5de..d3823a4 100644
@@ -92,6 +92,7 @@ int nvme_changed_ns_list_log(int fd,
 		struct nvme_changed_ns_list_log *changed_ns_list_log);
 int nvme_error_log(int fd, int entries, struct nvme_error_log_page *err_log);
 int nvme_smart_log(int fd, __u32 nsid, struct nvme_smart_log *smart_log);
+int nvme_ana_log(int fd, void *ana_log, size_t ana_log_len, int rgo);
 int nvme_effects_log(int fd, struct nvme_effects_log_page *effects_log);
 int nvme_discovery_log(int fd, struct nvmf_disc_rsp_page_hdr *log, __u32 size);
 int nvme_sanitize_log(int fd, struct nvme_sanitize_log_page *sanitize_log);
nvme-print.c +129 -1

190 lines not on this page · raw message

nvme-print.h +2 -0
index da287c2..367347c 100644
@@ -24,6 +24,7 @@ void show_nvme_resv_report(struct nvme_reservation_status *status, int bytes, __
 void show_lba_range(struct nvme_lba_range_type *lbrt, int nr_ranges);
 void show_error_log(struct nvme_error_log_page *err_log, int entries, const char *devname);
 void show_smart_log(struct nvme_smart_log *smart, unsigned int nsid, const char *devname);
+void show_ana_log(struct nvme_ana_rsp_hdr *ana_log, const char *devname);
 void show_self_test_log(struct nvme_self_test_log *self_test, const char *devname);
 void show_fw_log(struct nvme_firmware_log_page *fw_log, const char *devname);
 void show_effects_log(struct nvme_effects_log_page *effects, unsigned int flags);
@@ -50,6 +51,7 @@ void json_nvme_id_ns(struct nvme_id_ns *ns, unsigned int flags);
 void json_nvme_resv_report(struct nvme_reservation_status *status, int bytes, __u32 cdw11);
 void json_error_log(struct nvme_error_log_page *err_log, int entries, const char *devname);
 void json_smart_log(struct nvme_smart_log *smart, unsigned int nsid, const char *devname);
+void json_ana_log(struct nvme_ana_rsp_hdr *ana_log, const char *devname);
 void json_effects_log(struct nvme_effects_log_page *effects_log, const char *devname);
 void json_sanitize_log(struct nvme_sanitize_log_page *sanitize_log, const char *devname);
 void json_fw_log(struct nvme_firmware_log_page *fw_log, const char *devname);
nvme.c +77 -0

84 lines not on this page · raw message

Signature · 1 line
2.17.0
#2 lore raw

PATCH v2 1/2 nvme-cli: add minimal ana-log page support

Hi Chaitanya,

some comments inline:

Quoted 34 lines · Chaitanya Kulkarni

This patch adds a new command to retrieve the ANA Log page. We update identify ctrl/ns data structure to support this command. We also add ana based error codes and different identifiers to the linux/nvme.h header file in order to support this command.

Signed-off-by Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>
---
 linux/nvme.h   |  52 ++++++++++++++++++--
 nvme-builtin.h |   1 +
 nvme-ioctl.c   |   8 +++
 nvme-ioctl.h   |   1 +
 nvme-print.c   | 130 ++++++++++++++++++++++++++++++++++++++++++++++++-
 nvme-print.h   |   2 +
 nvme.c         |  77 +++++++++++++++++++++++++++++
 7 files changed, 266 insertions(+), 5 deletions(-)
linux/nvme.h +6 -1
index dc8ea89..50faaf0 100644
@@ -241,7 +241,12 @@ struct nvme_id_ctrl {
 	__le32			hmminds;
 	__le16			hmmaxd;
 	__le16			nsetidmax;
-	__u8			rsvd340[172];
+	__u8			rsvd340[2];
+	__u8			anatt;
+	__u8			anacap;
+	__le32			anagrpmax;
+	__le32			nanagrpid;
+	__u8			rsvd352[160];
 	__u8			sqes;
 	__u8			cqes;
 	__le16			maxcmd;> @@ -257,7 +262,8 @@ struct nvme_id_ctrl {

linux/nvme.h struct nvme_id_ctrl { · line 269

Quoted 9 lines
linux/nvme.h +2 -1
 	__le16			acwu;
 	__u8			rsvd534[2];
 	__le32			sgls;
-	__u8			rsvd540[228];
+	__u8			mnan;
+	__u8			rsvd544[224];
 	char			subnqn[256];
 	__u8			rsvd1024[768];
 	__le32			ioccsz;

This is wrong; 'mnan' is a 32-bit integer.
(Hence the next field is called 'rsvd544', as it starts at offset 544...)

linux/nvme.h struct nvme_id_ns { · line 331

Quoted 11 lines
linux/nvme.h +3 -1
@@ -317,7 +323,9 @@ struct nvme_id_ns {
 	__le16			nabspf;
 	__le16			noiob;
 	__u8			nvmcap[16];
-	__u8			rsvd64[36];
+	__u8			rsvd64[28];
+	__le32			anagrpid;
+	__u8			rsvd95[4];
 	__le16			nvmsetid;
 	__le16			endgid;
 	__u8			nguid[16];

The 'reserved' space starts at offset 96, so the field should be named 'rsvd96'.

[ .. ]

Quoted 9 lines
linux/nvme.h +1 -0
@@ -881,6 +916,7 @@ enum {
 	NVME_LOG_TELEMETRY_HOST = 0x07,
 	NVME_LOG_TELEMETRY_CTRL = 0x08,
 	NVME_LOG_ENDURANCE_GROUP = 0x09,
+	NVME_LOG_ANA		= 0x0c,
 	NVME_LOG_DISC		= 0x70,
 	NVME_LOG_RESERVATION	= 0x80,
 	NVME_LOG_SANITIZE	= 0x81,

linux/nvme.h enum { · line 934

Quoted 7 lines
linux/nvme.h +1 -0
@@ -892,6 +928,7 @@ enum {
 enum {
 	NVME_NO_LOG_LSP       = 0x0,
 	NVME_NO_LOG_LPO       = 0x0,
+	NVME_LOG_ANA_RGO      = 0x1,
 	NVME_TELEM_LSP_CREATE = 0x1,
 };
 

Shouldn't this rather be named

NVME_ANA_LSP_RGO

for consistency?

Quoted 9 lines
linux/nvme.h +1 -1
@@ -1040,7 +1077,7 @@ struct nvme_get_log_page_command {
 	__u64			rsvd2[2];
 	union nvme_data_ptr	dptr;
 	__u8			lid;
-	__u8			rsvd10;
+	__u8			lsp;
 	__le16			numdl;
 	__le16			numdu;
 	__u16			rsvd11;

[ .. ]

Quoted 4 lines
nvme-print.c +0 -0
index daf2929..89a7075 100644

[ .. ]

nvme-print.c void __show_nvme_id_ctrl(struct nvme_id_ctrl *ctrl, unsigned int mode, void (*ve · line 951

Quoted 11 lines
nvme-print.c +4 -0
@@ -924,6 +942,10 @@ void __show_nvme_id_ctrl(struct nvme_id_ctrl *ctrl, unsigned int mode, void (*ve
 	printf("hmminds   : %d\n", le32_to_cpu(ctrl->hmminds));
 	printf("hmmaxd    : %d\n", le16_to_cpu(ctrl->hmmaxd));
 	printf("nsetidmax : %d\n", le16_to_cpu(ctrl->nsetidmax));
+	printf("anatt     : %d\n", ctrl->anatt);
+	printf("anacap    : %d\n", ctrl->anacap);
+	printf("anagrpmax : %d\n", ctrl->anagrpmax);
+	printf("nanagrpid : %d\n", le32_to_cpu(ctrl->nanagrpid));
 	printf("sqes      : %#x\n", ctrl->sqes);
 	if (human)
 		show_nvme_id_ctrl_sqes(ctrl->sqes);

'anacap' is a bitfield, each bit of which has a distinct meaning. Hence we should implement a 'human' decoding here, too.

nvme-print.c void __show_nvme_id_ctrl(struct nvme_id_ctrl *ctrl, unsigned int mode, void (*ve · line 979

Quoted 8 lines
nvme-print.c +1 -0
@@ -951,6 +973,7 @@ void __show_nvme_id_ctrl(struct nvme_id_ctrl *ctrl, unsigned int mode, void (*ve
 		show_nvme_id_ctrl_nvscc(ctrl->nvscc);
 	printf("acwu      : %d\n", le16_to_cpu(ctrl->acwu));
 	printf("sgls      : %x\n", le32_to_cpu(ctrl->sgls));
+	printf("mnan      : %d\n", ctrl->mnan);
 	if (human)
 		show_nvme_id_ctrl_sgls(ctrl->sgls);
 	printf("subnqn    : %-.*s\n", (int)sizeof(ctrl->subnqn), ctrl->subnqn);

'mnan' should be called with le32_to_cpu().
And 'cmic' decoding is missing.

Wouldn't it be more sensible to drop these things, and include them in a different patch?
With that this patch would just be dealing with the actual ANA Log page implementation, and the other patch would be centered around ANA enablement for the nvme cli in general.

Cheers,

Hannes

Signature · 5 lines
Dr. Hannes Reinecke		   Teamlead Storage & Networking
hare at suse.de			               +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 N?rnberg
GF: F. Imend?rffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG N?rnberg)
#3 lore raw

PATCH v2 1/2 nvme-cli: add minimal ana-log page support

Quoted 2 lines · Hannes Reinecke

This is wrong; 'mnan' is a 32-bit integer.
(Hence the next field is called 'rsvd544', as it starts at offset 544...)

As a rule of thumb please always add fields in the kernel nvme.h and then sync it over to nvme-cli.

I guess we need to document that somewhere in nvme-cli..

#4 lore raw

PATCH v2 1/2 nvme-cli: add minimal ana-log page support

In reply to Hannes Reinecke

Thanks Hannes for the comments, I'll send out the next version soon.

From: Hannes Reinecke <[email protected]>
Sent: Monday, July 30, 2018 12:43 AM
To: Chaitanya Kulkarni; linux-nvme at lists.infradead.org
Cc: keith.busch at intel.com; hch at lst.de
Subject: Re: [PATCH V2 1/2] nvme-cli: add minimal ana-log page support ?

Hi Chaitanya,

some comments inline:

Quoted 35 lines · Chaitanya Kulkarni

This patch adds a new command to retrieve the ANA Log page. We update identify ctrl/ns data structure to support this command. We also add ana based error codes and different identifiers to the linux/nvme.h header file in order to support this command.

Signed-off-by Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>

---

? linux/nvme.h?? |? 52 ++++++++++++++++++--
? nvme-builtin.h |?? 1 +
? nvme-ioctl.c?? |?? 8 +++
? nvme-ioctl.h?? |?? 1 +
? nvme-print.c?? | 130 ++++++++++++++++++++++++++++++++++++++++++++++++-
? nvme-print.h?? |?? 2 +
? nvme.c???????? |? 77 +++++++++++++++++++++++++++++

? 7 files changed, 266 insertions(+), 5 deletions(-)

linux/nvme.h +6 -1
index dc8ea89..50faaf0 100644
@@ -241,7 +241,12 @@ struct nvme_id_ctrl {
 ??????? __le32????????????????? hmminds;
 ??????? __le16????????????????? hmmaxd;
 ??????? __le16????????????????? nsetidmax;
-???? __u8??????????????????? rsvd340[172];
+???? __u8??????????????????? rsvd340[2];
+???? __u8??????????????????? anatt;
+???? __u8??????????????????? anacap;
+???? __le32????????????????? anagrpmax;
+???? __le32????????????????? nanagrpid;
+???? __u8??????????????????? rsvd352[160];
 ??????? __u8??????????????????? sqes;
 ??????? __u8??????????????????? cqes;
 ??????? __le16????????????????? maxcmd;> @@ -257,7 +262,8 @@ struct nvme_id_ctrl {

??????? __le16????????????????? acwu;

Quoted 8 lines

??????? __u8??????????????????? rsvd534[2];
??????? __le32????????????????? sgls;
-???? __u8??????????????????? rsvd540[228];
+???? __u8??????????????????? mnan;
+???? __u8??????????????????? rsvd544[224];
??????? char??????????????????? subnqn[256];
??????? __u8??????????????????? rsvd1024[768];
??????? __le32????????????????? ioccsz;

This is wrong; 'mnan' is a 32-bit integer.
(Hence the next field is called 'rsvd544', as it starts at offset 544...)

linux/nvme.h struct nvme_id_ns { · line 331

Quoted 11 lines
linux/nvme.h +3 -1
@@ -317,7 +323,9 @@ struct nvme_id_ns {
 ??????? __le16????????????????? nabspf;
 ??????? __le16????????????????? noiob;
 ??????? __u8??????????????????? nvmcap[16];
-???? __u8??????????????????? rsvd64[36];
+???? __u8??????????????????? rsvd64[28];
+???? __le32????????????????? anagrpid;
+???? __u8??????????????????? rsvd95[4];
 ??????? __le16????????????????? nvmsetid;
 ??????? __le16????????????????? endgid;
 ??????? __u8??????????????????? nguid[16];

The 'reserved' space starts at offset 96, so the field should be named 'rsvd96'.

[ .. ]

Quoted 15 lines
linux/nvme.h +2 -0
@@ -881,6 +916,7 @@ enum {
 ??????? NVME_LOG_TELEMETRY_HOST = 0x07,
 ??????? NVME_LOG_TELEMETRY_CTRL = 0x08,
 ??????? NVME_LOG_ENDURANCE_GROUP = 0x09,
+???? NVME_LOG_ANA??????????? = 0x0c,
 ??????? NVME_LOG_DISC?????????? = 0x70,
 ??????? NVME_LOG_RESERVATION??? = 0x80,
 ??????? NVME_LOG_SANITIZE?????? = 0x81,
@@ -892,6 +928,7 @@ enum {
 ? enum {
 ??????? NVME_NO_LOG_LSP?????? = 0x0,
 ??????? NVME_NO_LOG_LPO?????? = 0x0,
+???? NVME_LOG_ANA_RGO????? = 0x1,
 ??????? NVME_TELEM_LSP_CREATE = 0x1,
 ? };
Quoted 1 line

?

Shouldn't this rather be named

NVME_ANA_LSP_RGO

for consistency?

Quoted 9 lines
linux/nvme.h +1 -1
@@ -1040,7 +1077,7 @@ struct nvme_get_log_page_command {
 ??????? __u64?????????????????? rsvd2[2];
 ??????? union nvme_data_ptr???? dptr;
 ??????? __u8??????????????????? lid;
-???? __u8??????????????????? rsvd10;
+???? __u8??????????????????? lsp;
 ??????? __le16????????????????? numdl;
 ??????? __le16????????????????? numdu;
 ??????? __u16?????????????????? rsvd11;

[ .. ]

Quoted 4 lines
nvme-print.c +0 -0
index daf2929..89a7075 100644

[ .. ]

nvme-print.c void __show_nvme_id_ctrl(struct nvme_id_ctrl *ctrl, unsigned int mode, void (*ve · line 951

Quoted 11 lines
nvme-print.c +4 -0
@@ -924,6 +942,10 @@ void __show_nvme_id_ctrl(struct nvme_id_ctrl *ctrl, unsigned int mode, void (*ve
 ??????? printf("hmminds?? : %d\n", le32_to_cpu(ctrl->hmminds));
 ??????? printf("hmmaxd??? : %d\n", le16_to_cpu(ctrl->hmmaxd));
 ??????? printf("nsetidmax : %d\n", le16_to_cpu(ctrl->nsetidmax));
+???? printf("anatt???? : %d\n", ctrl->anatt);
+???? printf("anacap??? : %d\n", ctrl->anacap);
+???? printf("anagrpmax : %d\n", ctrl->anagrpmax);
+???? printf("nanagrpid : %d\n", le32_to_cpu(ctrl->nanagrpid));
 ??????? printf("sqes????? : %#x\n", ctrl->sqes);
 ??????? if (human)
 ??????????????? show_nvme_id_ctrl_sqes(ctrl->sqes);

'anacap' is a bitfield, each bit of which has a distinct meaning. Hence we should implement a 'human' decoding here, too.

nvme-print.c void __show_nvme_id_ctrl(struct nvme_id_ctrl *ctrl, unsigned int mode, void (*ve · line 979

Quoted 8 lines
nvme-print.c +1 -0
@@ -951,6 +973,7 @@ void __show_nvme_id_ctrl(struct nvme_id_ctrl *ctrl, unsigned int mode, void (*ve
 ??????????????? show_nvme_id_ctrl_nvscc(ctrl->nvscc);
 ??????? printf("acwu????? : %d\n", le16_to_cpu(ctrl->acwu));
 ??????? printf("sgls????? : %x\n", le32_to_cpu(ctrl->sgls));
+???? printf("mnan????? : %d\n", ctrl->mnan);
 ??????? if (human)
 ??????????????? show_nvme_id_ctrl_sgls(ctrl->sgls);
 ??????? printf("subnqn??? : %-.*s\n", (int)sizeof(ctrl->subnqn), ctrl->subnqn);

'mnan' should be called with le32_to_cpu().
And 'cmic' decoding is missing.

Wouldn't it be more sensible to drop these things, and include them in a different patch?
With that this patch would just be dealing with the actual ANA Log page implementation, and the other patch would be centered around ANA enablement for the nvme cli in general.

[CK] I agree, we can keep the ANA-LOG-PAGE isolated.

Cheers,

Hannes

Signature · 5 lines
Dr. Hannes Reinecke??????????????? Teamlead Storage & Networking
hare at suse.de?????????????????????????????????? +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 N?rnberg
GF: F. Imend?rffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG N?rnberg)
#5 lore raw

PATCH v2 2/2 nvme-cli: add ana-log documentation

In reply to Chaitanya Kulkarni
Signed-off-by Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>
---
 Documentation/nvme-ana-log.1    |  82 ++++
 Documentation/nvme-ana-log.html | 826 ++++++++++++++++++++++++++++++++
 Documentation/nvme-ana-log.txt  |  45 ++
 3 files changed, 953 insertions(+)
 create mode 100644 Documentation/nvme-ana-log.1
 create mode 100644 Documentation/nvme-ana-log.html
 create mode 100644 Documentation/nvme-ana-log.txt
Documentation/nvme-ana-log.1 new file +82 -0
new file mode 100644
index 0000000..6baea09
@@ -0,0 +1,82 @@
+'\" t
+.\"     Title: nvme-ana-log
+.\"    Author: [FIXME: author] [see http://docbook.sf.net/el/author]
+.\" Generator: DocBook XSL Stylesheets v1.78.1 <http://docbook.sf.net/>
+.\"      Date: 07/25/2018
+.\"    Manual: NVMe Manual
+.\"    Source: NVMe
+.\"  Language: English
+.\"
+.TH "NVME\-ANA\-LOG" "1" "07/25/2018" "NVMe" "NVMe Manual"
+.\" -----------------------------------------------------------------
+.\" * Define some portability stuff
+.\" -----------------------------------------------------------------
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" http://bugs.debian.org/507673
+.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.ie \n(.g .ds Aq \(aq
+.el       .ds Aq '
+.\" -----------------------------------------------------------------
+.\" * set default formatting
+.\" -----------------------------------------------------------------
+.\" disable hyphenation
+.nh
+.\" disable justification (adjust text to left margin only)
+.ad l
+.\" -----------------------------------------------------------------
+.\" * MAIN CONTENT STARTS HERE *
+.\" -----------------------------------------------------------------
+.SH "NAME"
+nvme-ana-log \- Send NVMe ANA log page request, returns result and log
+.SH "SYNOPSIS"
+.sp
+.nf
+\fInvme ana\-log\fR <device>
+.fi
+.SH "DESCRIPTION"
+.sp
+Retrieves the NVMe Asymmetric Namespace Access log page from an NVMe device and provides the returned structure\&.
+.sp
+The <device> parameter is mandatory NVMe character device (ex: /dev/nvme0)\&.
+.sp
+On success, the returned ANA log structure may be returned in one of several ways depending on the option flags; the structure may parsed by the program and printed in a readable format or the raw buffer may be printed to stdout for another program to parse\&.
+.SH "OPTIONS"
+.PP
+\-b, \-\-raw\-binary
+.RS 4
+Print the raw ANA log buffer to stdout\&.
+.RE
+.PP
+\-o <format>, \-\-output\-format=<format>
+.RS 4
+Set the reporting format to
+\fInormal\fR,
+\fIjson\fR, or
+\fIbinary\fR\&. Only one output format can be used at a time\&.
+.RE
+.SH "EXAMPLES"
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+Print the ANA log page in a human readable format:
+.RE
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+# nvme ana\-log /dev/nvme0
+.fi
+.if n \{\
+.RE
+.\}
+.SH "NVME"
+.sp
+Part of the nvme\-user suite
Documentation/nvme-ana-log.html new file +826 -0

826 lines not on this page · raw message

Documentation/nvme-ana-log.txt new file +45 -0

45 lines not on this page · raw message

Signature · 1 line
2.17.0
#6 lore raw

PATCH v2 2/2 nvme-cli: add ana-log documentation

Quoted 10 lines · Chaitanya Kulkarni
Signed-off-by Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>
---
 Documentation/nvme-ana-log.1    |  82 ++++
 Documentation/nvme-ana-log.html | 826 ++++++++++++++++++++++++++++++++
 Documentation/nvme-ana-log.txt  |  45 ++
 3 files changed, 953 insertions(+)
 create mode 100644 Documentation/nvme-ana-log.1
 create mode 100644 Documentation/nvme-ana-log.html
 create mode 100644 Documentation/nvme-ana-log.txt
Reviewed-by Hannes Reinecke <hare at suse.com>

Cheers,

Hannes

Signature · 5 lines
Dr. Hannes Reinecke		   Teamlead Storage & Networking
hare at suse.de			               +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 N?rnberg
GF: F. Imend?rffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG N?rnberg)