nvme-cli: ana log support
Subsystems (2)
v4 cover nvme-cli: ana log support
Hi,
This adds nvme-ana-log support for nvme-cli. Please consider this for inclusion so we can start using nvme-cli for ANA related testcases.
Regards,
Chaitanya
Changes since V3:-
1. Fix the comments from Minwoo Im.
2. Generate the patch series on the top of
http://lists.infradead.org/pipermail/linux-nvme/2018-August/019635.html.
Chaitanya Kulkarni (2):
nvme-cli: add minimal ana-log page support
nvme-cli: add ana-log documentation
Documentation/nvme-ana-log.1 | 77 +++ Documentation/nvme-ana-log.html | 815 ++++++++++++++++++++++++++++++++ Documentation/nvme-ana-log.txt | 41 ++ linux/nvme.h | 52 +- nvme-builtin.h | 1 + nvme-ioctl.c | 8 + nvme-ioctl.h | 1 + nvme-print.c | 170 ++++++- nvme-print.h | 2 + nvme.c | 72 +++ 10 files changed, 1232 insertions(+), 7 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
PATCH v4 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.
--- linux/nvme.h | 52 +++++++++++++-- nvme-builtin.h | 1 + nvme-ioctl.c | 8 +++ nvme-ioctl.h | 1 + nvme-print.c | 170 ++++++++++++++++++++++++++++++++++++++++++++++++- nvme-print.h | 2 + nvme.c | 72 +++++++++++++++++++++ 7 files changed, 299 insertions(+), 7 deletions(-)
linux/nvme.h +48 -4
@@ -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 ]; +__le32 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[35 ]; +__u8 rsvd64[28 ]; +__le32 anagrpid; +__u8 rsvd96[4 ];__u8 nsattr;__le16 nvmsetid;__le16 endgid;
@@ -525,6 +533,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 ,
@@ -539,6 +573,7 @@ enum {NVME_AER_CSS =6 ,NVME_AER_VS =7 ,NVME_AER_NOTICE_NS_CHANGED =0x0002 , +NVME_AER_NOTICE_ANA =0x0003 , NVME_AER_NOTICE_FW_ACT_STARTING = 0x0102, };
@@ -891,6 +926,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,
@@ -902,6 +938,7 @@ enum {enum {NVME_NO_LOG_LSP =0x0 ,NVME_NO_LOG_LPO =0x0 , +NVME_LOG_ANA_LSP_RGO =0x1 ,NVME_TELEM_LSP_CREATE =0x1 , };
@@ -1050,7 +1087,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;
@@ -1366,6 +1403,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
@@ -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
@@ -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
@@ -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 +167 -3
246 lines not on this page · raw message
nvme-print.h +2 -0
@@ -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 +72 -0
78 lines not on this page · raw message
Signature · 1 line
2.17.0
PATCH v4 2/2 nvme-cli: add ana-log documentation
In reply to Chaitanya Kulkarni--- Documentation/nvme-ana-log.1 | 77 +++ Documentation/nvme-ana-log.html | 815 ++++++++++++++++++++++++++++++++ Documentation/nvme-ana-log.txt | 41 ++ 3 files changed, 933 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 +77 -0
@@ -0,0 +1,77 @@ +'\" 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: 08/12/2018 +.\" Manual: NVMe Manual +.\" Source: NVMe +.\" Language: English +.\" +.TH "NVME\-ANA\-LOG" "1" "08/12/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> [\-o <fmt> | \-\-output\-format=<fmt>] +.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 +\-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 +815 -0
815 lines not on this page · raw message
Documentation/nvme-ana-log.txt new file +41 -0
41 lines not on this page · raw message
Signature · 1 line
2.17.0
v4 cover nvme-cli: ana log support
In reply to Chaitanya KulkarniQuoted 4 lines · Chaitanya Kulkarni
Hi,
This adds nvme-ana-log support for nvme-cli. Please consider this for inclusion so we can start using nvme-cli for ANA related testcases.
Series applied. Thank you!