]> www.infradead.org Git - users/sagi/libnvme.git/commitdiff
types: add identify endurance group list (cns 0x19) support
authorGollu Appalanaidu <anaidu.gollu@samsung.com>
Fri, 5 Nov 2021 16:35:24 +0000 (17:35 +0100)
committerDaniel Wagner <dwagner@suse.de>
Tue, 16 Nov 2021 15:29:00 +0000 (16:29 +0100)
Signed-off-by: Gollu Appalanaidu <anaidu.gollu@samsung.com>
[dwagner: ported from nvme-cli-monolithic]
Signed-off-by: Daniel Wagner <dwagner@suse.de>
src/libnvme.map
src/nvme/ioctl.c
src/nvme/ioctl.h
src/nvme/types.h

index 82304c837ab279df46bcb3da818d97e0dac5c469..aeed21c010b6d87b36c64a3f6d5928083d751ae8 100644 (file)
                nvme_identify_ctrl;
                nvme_identify_ctrl_list;
                nvme_identify_domain_list;
+               nvme_identify_endurance_group_list;
                nvme_identify_independent_identify_ns;
                nvme_identify_iocs;
                nvme_identify_ns;
index d5d8207da29c96085bf1079a3fae4bb636320b3c..d1060dedaf234fa9079a1b9530f734970474a312 100644 (file)
@@ -531,6 +531,16 @@ int nvme_identify_domain_list(int fd, __u16 domid,
                             domid, NVME_UUID_NONE, NVME_CSI_NVM, list);
 }
 
+int nvme_identify_endurance_group_list(int fd, __u16 endgrp_id,
+                               struct nvme_id_endurance_group_list *list)
+{
+       BUILD_ASSERT(sizeof(struct nvme_id_endurance_group_list) == 4096);
+       return nvme_identify(fd, NVME_IDENTIFY_CNS_ENDURANCE_GROUP_ID,
+                            NVME_NSID_NONE, NVME_CNTLID_NONE,
+                            NVME_NVMSETID_NONE, endgrp_id, NVME_UUID_NONE,
+                            NVME_CSI_NVM, list);
+}
+
 int nvme_identify_independent_identify_ns(int fd, __u32 nsid,
                                          struct nvme_id_independent_id_ns *ns)
 {
index 82c1ea0dad113aa9131823402fdf751aa0d3ca03..0a0e3046920d4605d09324656db2db748167260b 100644 (file)
@@ -724,6 +724,18 @@ int nvme_nvm_identify_ctrl(int fd, struct nvme_id_ctrl_nvm *id);
 int nvme_identify_domain_list(int fd, __u16 domid,
                              struct nvme_id_domain_list *list);
 
+/**
+ * nvme_identifiy_endurance_group_list() -
+ * @fd:                File descriptor of nvme device
+ * @endgrp_id: Endurance group identifier
+ * @list:      Array of endurance group identifiers
+ *
+ * Return: The nvme command status if a response was received (see
+ * &enum nvme_status_field) or -1 with errno set otherwise.
+ */
+int nvme_identify_endurance_group_list(int fd, __u16 endgrp_id,
+                               struct nvme_id_endurance_group_list *list);
+
 /**
  * nvme_identify_iocs() -
  * @fd:                File descriptor of nvme device
index bdbcb7b9aad127c461f38c4f70ae4ad26e51fee0..f020bab05ea7c76fd5e8e32cd020208332e4b340 100644 (file)
@@ -98,6 +98,7 @@ enum nvme_constants {
        NVME_ID_NS_LIST_MAX                     = 1024,
        NVME_ID_SECONDARY_CTRL_MAX              = 127,
        NVME_ID_DOMAIN_LIST_MAX                 = 31,
+       NVME_ID_ENDURANCE_GROUP_LIST_MAX        = 2047,
        NVME_ID_ND_DESCRIPTOR_MAX               = 16,
        NVME_FEAT_LBA_RANGE_MAX                 = 64,
        NVME_LOG_ST_MAX_RESULTS                 = 20,
@@ -2210,6 +2211,16 @@ struct nvme_id_domain_list {
        struct nvme_id_domain_attr domain_attr[NVME_ID_DOMAIN_LIST_MAX];
 };
 
+/**
+ * struct nvme_id_endurance_group_list -
+ * @num:
+ * @identifier:
+ */
+struct nvme_id_endurance_group_list {
+       __le16  num;
+       __le16  identifier[NVME_ID_ENDURANCE_GROUP_LIST_MAX];
+};
+
 /**
  * struct nvme_supported_log_pages -
  * @lid_support:
@@ -5066,6 +5077,7 @@ enum nvme_admin_opcode {
  * @NVME_IDENTIFY_CNS_NS_GRANULARITY:
  * @NVME_IDENTIFY_CNS_UUID_LIST:
  * @NVME_IDENTIFY_CNS_DOMAIN_LIST:
+ * @NVME_IDENTIFY_CNS_ENDURANCE_GROUP_ID:
  * @NVME_IDENTIFY_CNS_CSI_ALLOCATED_NS_LIST:
  * @NVME_IDENTIFY_CNS_COMMAND_SET_STRUCTURE: Base Specification 2.0a section 5.17.2.21
  */
@@ -5088,6 +5100,7 @@ enum nvme_identify_cns {
        NVME_IDENTIFY_CNS_NS_GRANULARITY                        = 0x16,
        NVME_IDENTIFY_CNS_UUID_LIST                             = 0x17,
        NVME_IDENTIFY_CNS_DOMAIN_LIST                           = 0x18,
+       NVME_IDENTIFY_CNS_ENDURANCE_GROUP_ID                    = 0x19,
        NVME_IDENTIFY_CNS_CSS_ALLOCATED_NS_LIST                 = 0x1A,
        NVME_IDENTIFY_CNS_COMMAND_SET_STRUCTURE                 = 0x1C,
 };