summaryrefslogtreecommitdiffstats
path: root/src/nvme/types.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/nvme/types.h')
-rw-r--r--src/nvme/types.h111
1 files changed, 111 insertions, 0 deletions
diff --git a/src/nvme/types.h b/src/nvme/types.h
index 3d67bc8..94066fc 100644
--- a/src/nvme/types.h
+++ b/src/nvme/types.h
@@ -4857,6 +4857,34 @@ enum nvmf_tcp_sectype {
};
/**
+ * enum nvmf_log_discovery_lid_support - Discovery log specific support
+ * @NVMF_LOG_DISC_LID_NONE: None
+ * @NVMF_LOG_DISC_LID_EXTDLPES: Extended Discovery Log Page Entries Supported
+ * @NVMF_LOG_DISC_LID_PLEOS: Port Local Entries Only Supported
+ * @NVMF_LOG_DISC_LID_ALLSUBES: All NVM Subsystem Entries Supported
+ */
+enum nvmf_log_discovery_lid_support {
+ NVMF_LOG_DISC_LID_NONE = 0,
+ NVMF_LOG_DISC_LID_EXTDLPES = (1 << 0),
+ NVMF_LOG_DISC_LID_PLEOS = (1 << 1),
+ NVMF_LOG_DISC_LID_ALLSUBES = (1 << 2),
+};
+
+/**
+ * enum nvmf_log_discovery_lsp - Discovery log specific field
+ * @NVMF_LOG_DISC_LSP_NONE: None
+ * @NVMF_LOG_DISC_LSP_EXTDLPE: Extended Discovery Log Page Entries
+ * @NVMF_LOG_DISC_LSP_PLEO: Port Local Entries Only
+ * @NVMF_LOG_DISC_LSP_ALLSUBE: All NVM Subsystem Entries
+ */
+enum nvmf_log_discovery_lsp {
+ NVMF_LOG_DISC_LSP_NONE = 0,
+ NVMF_LOG_DISC_LSP_EXTDLPE = (1 << 0),
+ NVMF_LOG_DISC_LSP_PLEO = (1 << 1),
+ NVMF_LOG_DISC_LSP_ALLSUBE = (1 << 2),
+};
+
+/**
* struct nvmf_discovery_log - Discovery Log Page (Log Identifier 70h)
* @genctr: Generation Counter (GENCTR): Indicates the version of the discovery
* information, starting at a value of 0h. For each change in the
@@ -6114,6 +6142,75 @@ static inline __u16 nvme_status_code(__u16 status_field)
}
/**
+ * enum nvme_status_type - type encoding for NVMe return values, when
+ * represented as an int.
+ *
+ * The nvme_* api returns an int, with negative values indicating an internal
+ * or syscall error, zero signifying success, positive values representing
+ * the NVMe status.
+ *
+ * That latter case (the NVMe status) may represent status values from
+ * different parts of the transport/controller/etc, and are at most 16 bits of
+ * data. So, we use the most-significant 3 bits of the signed int to indicate
+ * which type of status this is.
+ *
+ * @NVME_STATUS_TYPE_SHIFT: shift value for status bits
+ * @NVME_STATUS_TYPE_MASK: mask value for status bits
+ *
+ * @NVME_STATUS_TYPE_NVME: NVMe command status value, typically from CDW3
+ * @NVME_STATUS_TYPE_MI: NVMe-MI header status
+ */
+enum nvme_status_type {
+ NVME_STATUS_TYPE_SHIFT = 27,
+ NVME_STATUS_TYPE_MASK = 0x7,
+
+ NVME_STATUS_TYPE_NVME = 0,
+ NVME_STATUS_TYPE_MI = 1,
+};
+
+/**
+ * nvme_status_get_type() - extract the type from a nvme_* return value
+ * @status: the (non-negative) return value from the NVMe API
+ *
+ * Returns: the type component of the status.
+ */
+static inline __u32 nvme_status_get_type(int status)
+{
+ return NVME_GET(status, STATUS_TYPE);
+}
+
+/**
+ * nvme_status_get_value() - extract the status value from a nvme_* return
+ * value
+ * @status: the (non-negative) return value from the NVMe API
+ *
+ * Returns: the value component of the status; the set of values will depend
+ * on the status type.
+ */
+static inline __u32 nvme_status_get_value(int status)
+{
+ return status & ~(NVME_STATUS_TYPE_MASK << NVME_STATUS_TYPE_SHIFT);
+}
+
+/**
+ * nvme_status_equals() - helper to check a status against a type and value
+ * @status: the (non-negative) return value from the NVMe API
+ * @type: the status type
+ * @value: the status value
+ *
+ * Returns: true if @status is of the specified type and value
+ */
+static inline __u32 nvme_status_equals(int status, enum nvme_status_type type,
+ unsigned int value)
+{
+ if (status < 0)
+ return false;
+
+ return nvme_status_get_type(status) == type &&
+ nvme_status_get_value(status) == value;
+}
+
+/**
* enum nvme_admin_opcode - Known NVMe admin opcodes
* @nvme_admin_delete_sq: Delete I/O Submission Queue
* @nvme_admin_create_sq: Create I/O Submission Queue
@@ -6950,6 +7047,20 @@ enum nvme_fctype {
};
/**
+ * enum nvme_data_tfr - Data transfer direction of the command
+ * @NVME_DATA_TFR_NO_DATA_TFR: No data transfer
+ * @NVME_DATA_TFR_HOST_TO_CTRL: Host to controller
+ * @NVME_DATA_TFR_CTRL_TO_HOST: Controller to host
+ * @NVME_DATA_TFR_BIDIRECTIONAL: Bidirectional
+ */
+enum nvme_data_tfr {
+ NVME_DATA_TFR_NO_DATA_TFR = 0x0,
+ NVME_DATA_TFR_HOST_TO_CTRL = 0x1,
+ NVME_DATA_TFR_CTRL_TO_HOST = 0x2,
+ NVME_DATA_TFR_BIDIRECTIONAL = 0x3,
+};
+
+/**
* enum nvme_io_opcode - Opcodes for I/O Commands
* @nvme_cmd_flush: Flush
* @nvme_cmd_write: Write