From 523f2a85d3765ac4521ba9597502650eff4d4780 Mon Sep 17 00:00:00 2001 From: Shuhei Matsumoto Date: Mon, 7 Sep 2020 21:54:03 +0900 Subject: [PATCH] lib/nvmf: Set up ANA Change Notice If the ANA reporting feature is enabled for the subsystem, - set ANA Change Notice of Asynchronous Event Configuration to 1 - set ANA Change Notice of Optional Asynchronus Event Supported to 1 - set ANA Non-Optimized state and ANA Inaccessible state of ANA Capability to 1. ANA Change state is not used and ANA Persistent Loss state is not supported for now. The next patch will actually support ANA Change Notice using an new RPC. Signed-off-by: Shuhei Matsumoto Change-Id: I4db2e33dd2879cdf995adcab41ef53728b27a201 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/4087 Tested-by: SPDK CI Jenkins Community-CI: Broadcom CI Reviewed-by: Jim Harris Reviewed-by: Aleksey Marchuk Reviewed-by: Ben Walker --- lib/nvmf/ctrlr.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lib/nvmf/ctrlr.c b/lib/nvmf/ctrlr.c index d3c4155be..e09e5665f 100644 --- a/lib/nvmf/ctrlr.c +++ b/lib/nvmf/ctrlr.c @@ -349,6 +349,9 @@ nvmf_ctrlr_create(struct spdk_nvmf_subsystem *subsystem, } ctrlr->feat.async_event_configuration.bits.ns_attr_notice = 1; + if (ctrlr->subsys->ana_reporting) { + ctrlr->feat.async_event_configuration.bits.ana_change_notice = 1; + } ctrlr->feat.volatile_write_cache.bits.wce = 1; if (ctrlr->subsys->subtype == SPDK_NVMF_SUBTYPE_DISCOVERY) { @@ -2076,6 +2079,9 @@ spdk_nvmf_ctrlr_identify_ctrlr(struct spdk_nvmf_ctrlr *ctrlr, struct spdk_nvme_c cdata->cmic.ana_reporting = 1; } cdata->oaes.ns_attribute_notices = 1; + if (subsystem->ana_reporting) { + cdata->oaes.ana_change_notices = 1; + } cdata->ctratt.host_id_exhid_supported = 1; /* TODO: Concurrent execution of multiple abort commands. */ cdata->acl = 0; @@ -2100,7 +2106,12 @@ spdk_nvmf_ctrlr_identify_ctrlr(struct spdk_nvmf_ctrlr *ctrlr, struct spdk_nvme_c cdata->oncs.reservations = 1; if (subsystem->ana_reporting) { cdata->anatt = ANA_TRANSITION_TIME_IN_SEC; + /* ANA Change state is not used, and ANA Persistent Loss state + * is not supported for now. + */ cdata->anacap.ana_optimized_state = 1; + cdata->anacap.ana_non_optimized_state = 1; + cdata->anacap.ana_inaccessible_state = 1; /* ANAGRPID does not change while namespace is attached to controller */ cdata->anacap.no_change_anagrpid = 1; cdata->anagrpmax = subsystem->max_nsid;