nvmf: add AER error event API support
We still don't support get log page with error information LID. Change-Id: I92db361dc956ea3ed4f6e7bdfdca763d0fea6886 Signed-off-by: Changpeng Liu <changpeng.liu@intel.com> Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/9583 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Community-CI: Mellanox Build Bot Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com> Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
parent
fb335cb29c
commit
86ad145bc1
@ -1925,7 +1925,8 @@ enum spdk_nvme_async_event_mask_bit {
|
||||
SPDK_NVME_ASYNC_EVENT_DISCOVERY_LOG_CHANGE_MASK_BIT = 2,
|
||||
/* Mask Reservation Log Page Available Notification */
|
||||
SPDK_NVME_ASYNC_EVENT_RESERVATION_LOG_AVAIL_MASK_BIT = 3,
|
||||
|
||||
/* Mask Error Event */
|
||||
SPDK_NVME_ASYNC_EVENT_ERROR_MASK_BIT = 4,
|
||||
/* 4 - 63 Reserved */
|
||||
};
|
||||
|
||||
@ -1979,6 +1980,17 @@ nvmf_ctrlr_get_ana_state_from_nsid(struct spdk_nvmf_ctrlr *ctrlr, uint32_t nsid)
|
||||
return nvmf_ctrlr_get_ana_state(ctrlr, ns->anagrpid);
|
||||
}
|
||||
|
||||
static void
|
||||
nvmf_get_error_log_page(struct spdk_nvmf_ctrlr *ctrlr, struct iovec *iovs, int iovcnt,
|
||||
uint64_t offset, uint32_t length, uint32_t rae)
|
||||
{
|
||||
if (!rae) {
|
||||
nvmf_ctrlr_unmask_aen(ctrlr, SPDK_NVME_ASYNC_EVENT_ERROR_MASK_BIT);
|
||||
}
|
||||
|
||||
/* TODO: actually fill out log page data */
|
||||
}
|
||||
|
||||
static void
|
||||
nvmf_get_ana_log_page(struct spdk_nvmf_ctrlr *ctrlr, struct iovec *iovs, int iovcnt,
|
||||
uint64_t offset, uint32_t length, uint32_t rae)
|
||||
@ -2288,6 +2300,8 @@ nvmf_ctrlr_get_log_page(struct spdk_nvmf_request *req)
|
||||
} else {
|
||||
switch (lid) {
|
||||
case SPDK_NVME_LOG_ERROR:
|
||||
nvmf_get_error_log_page(ctrlr, req->iov, req->iovcnt, offset, len, rae);
|
||||
return SPDK_NVMF_REQUEST_EXEC_STATUS_COMPLETE;
|
||||
case SPDK_NVME_LOG_HEALTH_INFORMATION:
|
||||
/* TODO: actually fill out log page data */
|
||||
return SPDK_NVMF_REQUEST_EXEC_STATUS_COMPLETE;
|
||||
@ -3315,6 +3329,31 @@ nvmf_ctrlr_async_event_discovery_log_change_notice(struct spdk_nvmf_ctrlr *ctrlr
|
||||
return nvmf_ctrlr_async_event_notification(ctrlr, &event);
|
||||
}
|
||||
|
||||
int
|
||||
nvmf_ctrlr_async_event_error_event(struct spdk_nvmf_ctrlr *ctrlr,
|
||||
union spdk_nvme_async_event_completion event)
|
||||
{
|
||||
if (!nvmf_ctrlr_mask_aen(ctrlr, SPDK_NVME_ASYNC_EVENT_ERROR_MASK_BIT)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (event.bits.async_event_type != SPDK_NVME_ASYNC_EVENT_TYPE_ERROR ||
|
||||
event.bits.async_event_info > SPDK_NVME_ASYNC_EVENT_FW_IMAGE_LOAD) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* If there is no outstanding AER request, queue the event. Then
|
||||
* if an AER is later submitted, this event can be sent as a
|
||||
* response.
|
||||
*/
|
||||
if (ctrlr->nr_aer_reqs == 0) {
|
||||
nvmf_ctrlr_queue_pending_async_event(ctrlr, &event);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return nvmf_ctrlr_async_event_notification(ctrlr, &event);
|
||||
}
|
||||
|
||||
void
|
||||
nvmf_qpair_free_aer(struct spdk_nvmf_qpair *qpair)
|
||||
{
|
||||
|
@ -425,6 +425,8 @@ int nvmf_ctrlr_async_event_ns_notice(struct spdk_nvmf_ctrlr *ctrlr);
|
||||
int nvmf_ctrlr_async_event_ana_change_notice(struct spdk_nvmf_ctrlr *ctrlr);
|
||||
int nvmf_ctrlr_async_event_discovery_log_change_notice(struct spdk_nvmf_ctrlr *ctrlr);
|
||||
void nvmf_ctrlr_async_event_reservation_notification(struct spdk_nvmf_ctrlr *ctrlr);
|
||||
int nvmf_ctrlr_async_event_error_event(struct spdk_nvmf_ctrlr *ctrlr,
|
||||
union spdk_nvme_async_event_completion event);
|
||||
void nvmf_ns_reservation_request(void *ctx);
|
||||
void nvmf_ctrlr_reservation_notice_log(struct spdk_nvmf_ctrlr *ctrlr,
|
||||
struct spdk_nvmf_ns *ns,
|
||||
|
Loading…
Reference in New Issue
Block a user