nvmf: support get_features with Interrupt Coalescing and Interrupt Vector Configuration

The NVMf library will not implement interrupt coalescing and ignore them, but we can
report this via get_features.

Some OS may check the result from get_features so that it will not send set_features
for interrupt coalescing.

Change-Id: I7466bcbc0ea5b3b067751cdf1979b2e0681c0043
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8765
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
Changpeng Liu 2021-07-13 23:51:06 +08:00 committed by Tomasz Zawadzki
parent df559ab6e0
commit 3eed8456d9
2 changed files with 25 additions and 0 deletions

View File

@ -359,6 +359,8 @@ nvmf_ctrlr_create(struct spdk_nvmf_subsystem *subsystem,
ctrlr->feat.async_event_configuration.bits.ana_change_notice = 1;
}
ctrlr->feat.volatile_write_cache.bits.wce = 1;
/* Coalescing Disable */
ctrlr->feat.interrupt_vector_configuration.bits.cd = 1;
if (ctrlr->subsys->subtype == SPDK_NVMF_SUBTYPE_DISCOVERY) {
/*
@ -1427,6 +1429,23 @@ nvmf_ctrlr_get_features_temperature_threshold(struct spdk_nvmf_request *req)
return SPDK_NVMF_REQUEST_EXEC_STATUS_COMPLETE;
}
static int
nvmf_ctrlr_get_features_interrupt_vector_configuration(struct spdk_nvmf_request *req)
{
struct spdk_nvmf_ctrlr *ctrlr = req->qpair->ctrlr;
struct spdk_nvme_cmd *cmd = &req->cmd->nvme_cmd;
struct spdk_nvme_cpl *rsp = &req->rsp->nvme_cpl;
union spdk_nvme_feat_interrupt_vector_configuration iv_conf = {};
SPDK_DEBUGLOG(nvmf, "Get Features - Interrupt Vector Configuration (cdw11 = 0x%0x)\n", cmd->cdw11);
iv_conf.bits.iv = cmd->cdw11_bits.feat_interrupt_vector_configuration.bits.iv;
iv_conf.bits.cd = ctrlr->feat.interrupt_vector_configuration.bits.cd;
rsp->cdw0 = iv_conf.raw;
return SPDK_NVMF_REQUEST_EXEC_STATUS_COMPLETE;
}
static int
nvmf_ctrlr_set_features_error_recovery(struct spdk_nvmf_request *req)
{
@ -2779,6 +2798,10 @@ nvmf_ctrlr_get_features(struct spdk_nvmf_request *req)
return get_features_generic(req, ctrlr->feat.volatile_write_cache.raw);
case SPDK_NVME_FEAT_NUMBER_OF_QUEUES:
return get_features_generic(req, ctrlr->feat.number_of_queues.raw);
case SPDK_NVME_FEAT_INTERRUPT_COALESCING:
return get_features_generic(req, ctrlr->feat.interrupt_coalescing.raw);
case SPDK_NVME_FEAT_INTERRUPT_VECTOR_CONFIGURATION:
return nvmf_ctrlr_get_features_interrupt_vector_configuration(req);
case SPDK_NVME_FEAT_WRITE_ATOMICITY:
return get_features_generic(req, ctrlr->feat.write_atomicity.raw);
case SPDK_NVME_FEAT_ASYNC_EVENT_CONFIGURATION:

View File

@ -198,6 +198,8 @@ struct spdk_nvmf_ctrlr_feat {
union spdk_nvme_feat_error_recovery error_recovery;
union spdk_nvme_feat_volatile_write_cache volatile_write_cache;
union spdk_nvme_feat_number_of_queues number_of_queues;
union spdk_nvme_feat_interrupt_coalescing interrupt_coalescing;
union spdk_nvme_feat_interrupt_vector_configuration interrupt_vector_configuration;
union spdk_nvme_feat_write_atomicity write_atomicity;
union spdk_nvme_feat_async_event_configuration async_event_configuration;
union spdk_nvme_feat_keep_alive_timer keep_alive_timer;