nvme: move AER handling to a separate function
This prepares for an upcoming patch to fix issue #1701 which requires handling async events outside of the check completions loop. Fixes: #1701 Signed-off-by: G.Balaji <gbalajieie@gmail.com> Change-Id: I4985d814903143511383172b1a443580db33a78f Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7416 Community-CI: Broadcom CI Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
This commit is contained in:
parent
ebeac5decc
commit
391d89b873
@ -2578,14 +2578,46 @@ fail:
|
||||
return rc;
|
||||
}
|
||||
|
||||
void
|
||||
nvme_ctrlr_process_async_event(struct spdk_nvme_ctrlr *ctrlr,
|
||||
const struct spdk_nvme_cpl *cpl)
|
||||
{
|
||||
union spdk_nvme_async_event_completion event;
|
||||
struct spdk_nvme_ctrlr_process *active_proc;
|
||||
int rc;
|
||||
|
||||
event.raw = cpl->cdw0;
|
||||
|
||||
if ((event.bits.async_event_type == SPDK_NVME_ASYNC_EVENT_TYPE_NOTICE) &&
|
||||
(event.bits.async_event_info == SPDK_NVME_ASYNC_EVENT_NS_ATTR_CHANGED)) {
|
||||
rc = nvme_ctrlr_identify_active_ns(ctrlr);
|
||||
if (rc) {
|
||||
return;
|
||||
}
|
||||
nvme_ctrlr_update_namespaces(ctrlr);
|
||||
nvme_io_msg_ctrlr_update(ctrlr);
|
||||
}
|
||||
|
||||
if ((event.bits.async_event_type == SPDK_NVME_ASYNC_EVENT_TYPE_NOTICE) &&
|
||||
(event.bits.async_event_info == SPDK_NVME_ASYNC_EVENT_ANA_CHANGE)) {
|
||||
rc = nvme_ctrlr_update_ana_log_page(ctrlr);
|
||||
if (rc) {
|
||||
return;
|
||||
}
|
||||
nvme_ctrlr_parse_ana_log_page(ctrlr, nvme_ctrlr_update_ns_ana_states, ctrlr);
|
||||
}
|
||||
|
||||
active_proc = nvme_ctrlr_get_current_process(ctrlr);
|
||||
if (active_proc && active_proc->aer_cb_fn) {
|
||||
active_proc->aer_cb_fn(active_proc->aer_cb_arg, cpl);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
nvme_ctrlr_async_event_cb(void *arg, const struct spdk_nvme_cpl *cpl)
|
||||
{
|
||||
struct nvme_async_event_request *aer = arg;
|
||||
struct spdk_nvme_ctrlr *ctrlr = aer->ctrlr;
|
||||
struct spdk_nvme_ctrlr_process *active_proc;
|
||||
union spdk_nvme_async_event_completion event;
|
||||
int rc;
|
||||
|
||||
if (cpl->status.sct == SPDK_NVME_SCT_GENERIC &&
|
||||
cpl->status.sc == SPDK_NVME_SC_ABORTED_SQ_DELETION) {
|
||||
@ -2610,30 +2642,7 @@ nvme_ctrlr_async_event_cb(void *arg, const struct spdk_nvme_cpl *cpl)
|
||||
return;
|
||||
}
|
||||
|
||||
event.raw = cpl->cdw0;
|
||||
if ((event.bits.async_event_type == SPDK_NVME_ASYNC_EVENT_TYPE_NOTICE) &&
|
||||
(event.bits.async_event_info == SPDK_NVME_ASYNC_EVENT_NS_ATTR_CHANGED)) {
|
||||
rc = nvme_ctrlr_identify_active_ns(ctrlr);
|
||||
if (rc) {
|
||||
return;
|
||||
}
|
||||
nvme_ctrlr_update_namespaces(ctrlr);
|
||||
nvme_io_msg_ctrlr_update(ctrlr);
|
||||
}
|
||||
|
||||
if ((event.bits.async_event_type == SPDK_NVME_ASYNC_EVENT_TYPE_NOTICE) &&
|
||||
(event.bits.async_event_info == SPDK_NVME_ASYNC_EVENT_ANA_CHANGE)) {
|
||||
rc = nvme_ctrlr_update_ana_log_page(ctrlr);
|
||||
if (rc) {
|
||||
return;
|
||||
}
|
||||
nvme_ctrlr_parse_ana_log_page(ctrlr, nvme_ctrlr_update_ns_ana_states, ctrlr);
|
||||
}
|
||||
|
||||
active_proc = nvme_ctrlr_get_current_process(ctrlr);
|
||||
if (active_proc && active_proc->aer_cb_fn) {
|
||||
active_proc->aer_cb_fn(active_proc->aer_cb_arg, cpl);
|
||||
}
|
||||
nvme_ctrlr_process_async_event(ctrlr, cpl);
|
||||
|
||||
/* If the ctrlr was removed or in the destruct state, we should not send aer again */
|
||||
if (ctrlr->is_removed || ctrlr->is_destructed) {
|
||||
|
@ -1023,6 +1023,8 @@ int nvme_ctrlr_get_pmrcap(struct spdk_nvme_ctrlr *ctrlr, union spdk_nvme_pmrcap_
|
||||
bool nvme_ctrlr_multi_iocs_enabled(struct spdk_nvme_ctrlr *ctrlr);
|
||||
void nvme_ctrlr_init_cap(struct spdk_nvme_ctrlr *ctrlr, const union spdk_nvme_cap_register *cap,
|
||||
const union spdk_nvme_vs_register *vs);
|
||||
void nvme_ctrlr_process_async_event(struct spdk_nvme_ctrlr *ctrlr,
|
||||
const struct spdk_nvme_cpl *cpl);
|
||||
void nvme_ctrlr_disconnect_qpair(struct spdk_nvme_qpair *qpair);
|
||||
int nvme_qpair_init(struct spdk_nvme_qpair *qpair, uint16_t id,
|
||||
struct spdk_nvme_ctrlr *ctrlr,
|
||||
|
@ -134,6 +134,8 @@ DEFINE_STUB(spdk_nvme_ctrlr_get_regs_csts, union spdk_nvme_csts_register,
|
||||
DEFINE_STUB(nvme_ctrlr_get_process, struct spdk_nvme_ctrlr_process *,
|
||||
(struct spdk_nvme_ctrlr *ctrlr, pid_t pid), NULL);
|
||||
DEFINE_STUB(nvme_completion_is_retry, bool, (const struct spdk_nvme_cpl *cpl), false);
|
||||
DEFINE_STUB_V(nvme_ctrlr_process_async_event, (struct spdk_nvme_ctrlr *ctrlr,
|
||||
const struct spdk_nvme_cpl *cpl));
|
||||
DEFINE_STUB_V(spdk_nvme_qpair_print_command, (struct spdk_nvme_qpair *qpair,
|
||||
struct spdk_nvme_cmd *cmd));
|
||||
DEFINE_STUB_V(spdk_nvme_qpair_print_completion, (struct spdk_nvme_qpair *qpair,
|
||||
|
@ -53,6 +53,9 @@ DEFINE_STUB(nvme_wait_for_completion, int,
|
||||
|
||||
DEFINE_STUB(nvme_completion_is_retry, bool, (const struct spdk_nvme_cpl *cpl), false);
|
||||
|
||||
DEFINE_STUB_V(nvme_ctrlr_process_async_event, (struct spdk_nvme_ctrlr *ctrlr,
|
||||
const struct spdk_nvme_cpl *cpl));
|
||||
|
||||
DEFINE_STUB_V(spdk_nvme_qpair_print_command, (struct spdk_nvme_qpair *qpair,
|
||||
struct spdk_nvme_cmd *cmd));
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user