nvmf_tgt: stub out Async Event Config feature

Record the user-provided asynchronous event configuration set via Set
Features, and return it in Get Features.

This value is not actually used, since AER is not implemented yet in the
virtual controller model, but it at least implements the mandatory
Set/Get Features.

This allows the hack in the NVMe host code that ignored the Set Features
failure to be reverted.

Change-Id: I2ac639eb8b069ef8e87230a21fa77225f32aedde
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
This commit is contained in:
Daniel Verkamp 2016-11-18 15:32:02 -07:00
parent be54ddb05c
commit fd36d11e17
4 changed files with 19 additions and 2 deletions

View File

@ -785,8 +785,7 @@ nvme_ctrlr_configure_aer(struct spdk_nvme_ctrlr *ctrlr)
}
if (spdk_nvme_cpl_is_error(&status.cpl)) {
SPDK_ERRLOG("nvme_ctrlr_cmd_set_async_event_config failed!\n");
/* change the return value since NVMf target does not suppport aer, should be fixed later*/
return 0;
return -ENXIO;
}
/* aerl is a zero-based value, so we need to add 1 here. */

View File

@ -257,6 +257,7 @@ spdk_nvmf_session_connect(struct spdk_nvmf_conn *conn,
TAILQ_INIT(&session->connections);
session->id = subsystem->session_id++;
session->kato = cmd->kato;
session->async_event_config.raw = 0;
session->num_connections = 0;
session->subsys = subsystem;
session->max_connections_allowed = g_nvmf_tgt.max_queues_per_session;

View File

@ -82,6 +82,14 @@ struct spdk_nvmf_session {
int num_connections;
int max_connections_allowed;
uint32_t kato;
union {
uint32_t raw;
struct {
union spdk_nvme_critical_warning_state crit_warn;
uint8_t ns_attr_notice : 1;
uint8_t fw_activation_notice : 1;
} bits;
} async_event_config;
const struct spdk_nvmf_transport *transport;
TAILQ_ENTRY(spdk_nvmf_session) link;

View File

@ -286,6 +286,10 @@ nvmf_virtual_ctrlr_get_features(struct spdk_nvmf_request *req)
case SPDK_NVME_FEAT_KEEP_ALIVE_TIMER:
response->cdw0 = session->kato;
return SPDK_NVMF_REQUEST_EXEC_STATUS_COMPLETE;
case SPDK_NVME_FEAT_ASYNC_EVENT_CONFIGURATION:
SPDK_TRACELOG(SPDK_TRACE_NVMF, "Get Features - Async Event Configuration\n");
response->cdw0 = session->async_event_config.raw;
return SPDK_NVMF_REQUEST_EXEC_STATUS_COMPLETE;
default:
SPDK_ERRLOG("get features command with invalid code\n");
response->status.sc = SPDK_NVME_SC_INVALID_OPCODE;
@ -326,6 +330,11 @@ nvmf_virtual_ctrlr_set_features(struct spdk_nvmf_request *req)
session->kato = cmd->cdw11;
}
return SPDK_NVMF_REQUEST_EXEC_STATUS_COMPLETE;
case SPDK_NVME_FEAT_ASYNC_EVENT_CONFIGURATION:
SPDK_TRACELOG(SPDK_TRACE_NVMF, "Set Features - Async Event Configuration, cdw11 0x%08x\n",
cmd->cdw11);
session->async_event_config.raw = cmd->cdw11;
return SPDK_NVMF_REQUEST_EXEC_STATUS_COMPLETE;
default:
SPDK_ERRLOG("set features command with invalid code\n");
response->status.sc = SPDK_NVME_SC_INVALID_OPCODE;