Skip to content

Commit da36c5a

Browse files
ikegami-tigaw
authored andcommitted
types: add performance attribute structures
These for the performance characteristics feature: 1Ch. Signed-off-by: Tokunori Ikegami <[email protected]>
1 parent 745f929 commit da36c5a

2 files changed

Lines changed: 72 additions & 3 deletions

File tree

src/nvme/types.h

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@
2121
* NVMe standard definitions
2222
*/
2323

24+
#define NVME_UUID_LEN 16
25+
#define NVME_UUID_LEN_STRING 37 /* 1b4e28ba-2fa1-11d2-883f-0016d3cca427 + \0 */
26+
2427
/**
2528
* NVME_GET() - extract field from complex value
2629
* @value: The original value of a complex field
@@ -6005,6 +6008,75 @@ enum nvme_apst_entry {
60056008
NVME_APST_ENTRY_ITPT_MASK = 0xffffff,
60066009
};
60076010

6011+
/**
6012+
* struct nvme_std_perf_attr - Standard performance attribute structure
6013+
* @rsvd0: Reserved
6014+
* @r4karl: Random 4 KiB average read latency
6015+
* @rsvd5: Reserved
6016+
*/
6017+
struct nvme_std_perf_attr {
6018+
__u8 rsvd0[4];
6019+
__u8 r4karl;
6020+
__u8 rsvd5[4091];
6021+
};
6022+
6023+
/**
6024+
* struct nvme_perf_attr_id - Performance attribute identifier structure
6025+
* @id: Performance attribute identifier
6026+
*/
6027+
struct nvme_perf_attr_id {
6028+
__u8 id[NVME_UUID_LEN];
6029+
};
6030+
6031+
/**
6032+
* struct nvme_perf_attr_id_list - Performance attribute identifier list structure
6033+
* @attrtyp: Bits 7-3: Reserved
6034+
* Bits 2-0: Attribute type
6035+
* @msvspa: Maximum saveable vendor specific performance attributes
6036+
* @usvspa: Unused saveable vendor specific performance attributes
6037+
* @rsvd3: Reserved
6038+
* @id_list: Performance attribute identifier list
6039+
* @rsvd1024: Reserved
6040+
*/
6041+
struct nvme_perf_attr_id_list {
6042+
__u8 attrtyp;
6043+
__u8 msvspa;
6044+
__u8 usvspa;
6045+
__u8 rsvd3[13];
6046+
struct nvme_perf_attr_id id_list[63];
6047+
__u8 rsvd1024[3072];
6048+
};
6049+
6050+
/**
6051+
* struct nvme_vs_perf_attr - Vendor specific performance attribute structure
6052+
* @paid: Performance attribute identifier
6053+
* @rsvd16: Reserved
6054+
* @attrl: Attribute Length
6055+
* @vs: Vendor specific
6056+
*/
6057+
struct nvme_vs_perf_attr {
6058+
__u8 paid[16];
6059+
__u8 rsvd16[14];
6060+
__le16 attrl;
6061+
__u8 vs[4064];
6062+
};
6063+
6064+
/**
6065+
* struct nvme_perf_characteristics - Performance attribute structure
6066+
* @std_perf: Standard performance attribute
6067+
* @id_list: Performance attribute identifier list
6068+
* @vs_perf: Vendor specific performance attribute
6069+
* @attr_buf: Attribute buffer
6070+
*/
6071+
struct nvme_perf_characteristics {
6072+
union {
6073+
struct nvme_std_perf_attr std_perf[0];
6074+
struct nvme_perf_attr_id_list id_list[0];
6075+
struct nvme_vs_perf_attr vs_perf[0];
6076+
__u8 attr_buf[4096];
6077+
};
6078+
};
6079+
60086080
/**
60096081
* struct nvme_metadata_element_desc - Metadata Element Descriptor
60106082
* @type: Element Type (ET)

src/nvme/util.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -646,9 +646,6 @@ enum nvme_version {
646646
*/
647647
const char *nvme_get_version(enum nvme_version type);
648648

649-
#define NVME_UUID_LEN_STRING 37 /* 1b4e28ba-2fa1-11d2-883f-0016d3cca427 + \0 */
650-
#define NVME_UUID_LEN 16
651-
652649
/**
653650
* nvme_uuid_to_string - Return string represenation of encoded UUID
654651
* @uuid: Binary encoded input UUID

0 commit comments

Comments
 (0)