lib/nvmf: Add nvmf_ctrlr_async_event_ana_change_notice() to notice ANA change

The new function () will be used in the following patches.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I788cfb38d75c3f1f64e1754912b776a80f0f1be8
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/4007
Community-CI: Mellanox Build Bot
Community-CI: Broadcom CI
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
This commit is contained in:
Shuhei Matsumoto 2020-09-01 21:00:20 +09:00 committed by Tomasz Zawadzki
parent ccdbd2ed51
commit 58da62239e
2 changed files with 32 additions and 0 deletions

View File

@ -2670,6 +2670,37 @@ nvmf_ctrlr_async_event_ns_notice(struct spdk_nvmf_ctrlr *ctrlr)
return nvmf_ctrlr_async_event_notification(ctrlr, &event); return nvmf_ctrlr_async_event_notification(ctrlr, &event);
} }
int
nvmf_ctrlr_async_event_ana_change_notice(struct spdk_nvmf_ctrlr *ctrlr)
{
union spdk_nvme_async_event_completion event = {0};
/* Users may disable the event notification */
if (!ctrlr->feat.async_event_configuration.bits.ana_change_notice) {
return 0;
}
event.bits.async_event_type = SPDK_NVME_ASYNC_EVENT_TYPE_NOTICE;
event.bits.async_event_info = SPDK_NVME_ASYNC_EVENT_ANA_CHANGE;
event.bits.log_page_identifier = SPDK_NVME_LOG_ASYMMETRIC_NAMESPACE_ACCESS;
/* If there is no outstanding AER request, queue the event. Then
* if an AER is later submited, this event can be sent as a
* response.
*/
if (ctrlr->nr_aer_reqs == 0) {
if (ctrlr->notice_event.bits.async_event_type ==
SPDK_NVME_ASYNC_EVENT_TYPE_NOTICE) {
return 0;
}
ctrlr->notice_event.raw = event.raw;
return 0;
}
return nvmf_ctrlr_async_event_notification(ctrlr, &event);
}
void void
nvmf_ctrlr_async_event_reservation_notification(struct spdk_nvmf_ctrlr *ctrlr) nvmf_ctrlr_async_event_reservation_notification(struct spdk_nvmf_ctrlr *ctrlr)
{ {

View File

@ -333,6 +333,7 @@ struct spdk_nvmf_listener *nvmf_transport_find_listener(
const struct spdk_nvme_transport_id *trid); const struct spdk_nvme_transport_id *trid);
int nvmf_ctrlr_async_event_ns_notice(struct spdk_nvmf_ctrlr *ctrlr); 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);
void nvmf_ctrlr_async_event_reservation_notification(struct spdk_nvmf_ctrlr *ctrlr); void nvmf_ctrlr_async_event_reservation_notification(struct spdk_nvmf_ctrlr *ctrlr);
void nvmf_ns_reservation_request(void *ctx); void nvmf_ns_reservation_request(void *ctx);
void nvmf_ctrlr_reservation_notice_log(struct spdk_nvmf_ctrlr *ctrlr, void nvmf_ctrlr_reservation_notice_log(struct spdk_nvmf_ctrlr *ctrlr,