Skip to content

Commit 1900e1a

Browse files
guixinliu1995keithbusch
authored andcommitted
nvme: add reservation command's defines
This is a preparation patch for NVMeOF target reservation commands implantation. Add the defines of reservation command, such as reservation log and sub operations. Signed-off-by: Guixin Liu <[email protected]> Tested-by: Chaitanya Kulkarni <[email protected]> Reviewed-by: Chaitanya Kulkarni <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]> Signed-off-by: Keith Busch <[email protected]>
1 parent 43d5d3b commit 1900e1a

File tree

1 file changed

+68
-0
lines changed

1 file changed

+68
-0
lines changed

include/linux/nvme.h

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2037,4 +2037,72 @@ struct nvme_completion {
20372037
#define NVME_MINOR(ver) (((ver) >> 8) & 0xff)
20382038
#define NVME_TERTIARY(ver) ((ver) & 0xff)
20392039

2040+
enum {
2041+
NVME_AEN_RESV_LOG_PAGE_AVALIABLE = 0x00,
2042+
};
2043+
2044+
enum {
2045+
NVME_PR_LOG_EMPTY_LOG_PAGE = 0x00,
2046+
NVME_PR_LOG_REGISTRATION_PREEMPTED = 0x01,
2047+
NVME_PR_LOG_RESERVATION_RELEASED = 0x02,
2048+
NVME_PR_LOG_RESERVATOPM_PREEMPTED = 0x03,
2049+
};
2050+
2051+
enum {
2052+
NVME_PR_NOTIFY_BIT_REG_PREEMPTED = 1,
2053+
NVME_PR_NOTIFY_BIT_RESV_RELEASED = 2,
2054+
NVME_PR_NOTIFY_BIT_RESV_PREEMPTED = 3,
2055+
};
2056+
2057+
struct nvme_pr_log {
2058+
__le64 count;
2059+
__u8 type;
2060+
__u8 nr_pages;
2061+
__u8 rsvd1[2];
2062+
__le32 nsid;
2063+
__u8 rsvd2[48];
2064+
};
2065+
2066+
struct nvmet_pr_register_data {
2067+
__le64 crkey;
2068+
__le64 nrkey;
2069+
};
2070+
2071+
struct nvmet_pr_acquire_data {
2072+
__le64 crkey;
2073+
__le64 prkey;
2074+
};
2075+
2076+
struct nvmet_pr_release_data {
2077+
__le64 crkey;
2078+
};
2079+
2080+
enum nvme_pr_capabilities {
2081+
NVME_PR_SUPPORT_PTPL = 1,
2082+
NVME_PR_SUPPORT_WRITE_EXCLUSIVE = 1 << 1,
2083+
NVME_PR_SUPPORT_EXCLUSIVE_ACCESS = 1 << 2,
2084+
NVME_PR_SUPPORT_WRITE_EXCLUSIVE_REG_ONLY = 1 << 3,
2085+
NVME_PR_SUPPORT_EXCLUSIVE_ACCESS_REG_ONLY = 1 << 4,
2086+
NVME_PR_SUPPORT_WRITE_EXCLUSIVE_ALL_REGS = 1 << 5,
2087+
NVME_PR_SUPPORT_EXCLUSIVE_ACCESS_ALL_REGS = 1 << 6,
2088+
NVME_PR_SUPPORT_IEKEY_VER_1_3_DEF = 1 << 7,
2089+
};
2090+
2091+
enum nvme_pr_register_action {
2092+
NVME_PR_REGISTER_ACT_REG = 0,
2093+
NVME_PR_REGISTER_ACT_UNREG = 1,
2094+
NVME_PR_REGISTER_ACT_REPLACE = 1 << 1,
2095+
};
2096+
2097+
enum nvme_pr_acquire_action {
2098+
NVME_PR_ACQUIRE_ACT_ACQUIRE = 0,
2099+
NVME_PR_ACQUIRE_ACT_PREEMPT = 1,
2100+
NVME_PR_ACQUIRE_ACT_PREEMPT_AND_ABORT = 1 << 1,
2101+
};
2102+
2103+
enum nvme_pr_release_action {
2104+
NVME_PR_RELEASE_ACT_RELEASE = 0,
2105+
NVME_PR_RELEASE_ACT_CLEAR = 1,
2106+
};
2107+
20402108
#endif /* _LINUX_NVME_H */

0 commit comments

Comments
 (0)