From 4cbdeb9479b5d26fd02586c0b4597eca559f0dfe Mon Sep 17 00:00:00 2001 From: Changpeng Liu Date: Mon, 7 Jan 2019 01:57:14 -0500 Subject: [PATCH] nvme: add reservation notificaiton log page and mask definition Upcoming patches will add reservation support to NVMoF target, a reservation notificaiton log is generated when registration/ reservation was preempted or released. Change-Id: I9ae0c1995fbecef3e3666dfe624a3e635e20cdfc Signed-off-by: Changpeng Liu Reviewed-on: https://review.gerrithub.io/c/439340 Tested-by: SPDK CI Jenkins Reviewed-by: Shuhei Matsumoto Reviewed-by: Jim Harris --- include/spdk/nvme_spec.h | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/include/spdk/nvme_spec.h b/include/spdk/nvme_spec.h index b87468bc7..a24b00963 100644 --- a/include/spdk/nvme_spec.h +++ b/include/spdk/nvme_spec.h @@ -1734,6 +1734,39 @@ enum spdk_nvme_reservation_release_action { SPDK_NVME_RESERVE_CLEAR = 0x1, }; +/** + * Reservation notification log page type + */ +enum spdk_nvme_reservation_notification_log_page_type { + SPDK_NVME_RESERVATION_LOG_PAGE_EMPTY = 0x0, + SPDK_NVME_REGISTRATION_PREEMPTED = 0x1, + SPDK_NVME_RESERVATION_RELEASED = 0x2, + SPDK_NVME_RESERVATION_PREEMPTED = 0x3, +}; + +/** + * Reservation notification log + */ +struct spdk_nvme_reservation_notification_log { + /** 64-bit incrementing reservation notification log page count */ + uint64_t log_page_count; + /** Reservation notification log page type */ + uint8_t type; + /** Number of additional available reservation notification log pages */ + uint8_t num_avail_log_pages; + uint8_t reserved[2]; + uint32_t nsid; + uint8_t reserved1[48]; +}; +SPDK_STATIC_ASSERT(sizeof(struct spdk_nvme_reservation_notification_log) == 64, "Incorrect size"); + +/* Mask Registration Preempted Notificaton */ +#define SPDK_NVME_REGISTRATION_PREEMPTED_MASK (1U << 1) +/* Mask Reservation Released Notification */ +#define SPDK_NVME_RESERVATION_RELEASED_MASK (1U << 2) +/* Mask Reservation Preempted Notification */ +#define SPDK_NVME_RESERVATION_PREEMPTED_MASK (1U << 3) + /** * Log page identifiers for SPDK_NVME_OPC_GET_LOG_PAGE */