nvmf: add Get Features with Host Behavior Support

We already support Set Features with Host Behavior, so here also
add the support in Get Features.

Change-Id: I27d973e81fd6be89cc67ad559439334fc1087c9e
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/9818
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: GangCao <gang.cao@intel.com>
Reviewed-by: Dong Yi <dongx.yi@intel.com>
Reviewed-by: John Levon <levon@movementarian.org>
This commit is contained in:
Changpeng Liu 2021-10-11 23:02:30 +08:00 committed by Tomasz Zawadzki
parent 9f7cb6aa2d
commit 8a1862c0f0

View File

@ -1679,6 +1679,28 @@ nvmf_ctrlr_set_features_reservation_persistence(struct spdk_nvmf_request *req)
return SPDK_NVMF_REQUEST_EXEC_STATUS_COMPLETE;
}
static int
nvmf_ctrlr_get_features_host_behavior_support(struct spdk_nvmf_request *req)
{
struct spdk_nvmf_ctrlr *ctrlr = req->qpair->ctrlr;
struct spdk_nvme_cpl *response = &req->rsp->nvme_cpl;
struct spdk_nvme_host_behavior host_behavior = {};
SPDK_DEBUGLOG(nvmf, "Get Features - Host Behavior Support\n");
if (req->data == NULL || req->length < sizeof(struct spdk_nvme_host_behavior)) {
SPDK_ERRLOG("invalid data buffer for Host Behavior Support\n");
response->status.sct = SPDK_NVME_SCT_GENERIC;
response->status.sc = SPDK_NVME_SC_INVALID_FIELD;
return SPDK_NVMF_REQUEST_EXEC_STATUS_COMPLETE;
}
host_behavior.acre = ctrlr->acre_enabled;
memcpy(req->data, &host_behavior, sizeof(host_behavior));
return SPDK_NVMF_REQUEST_EXEC_STATUS_COMPLETE;
}
static int
nvmf_ctrlr_set_features_host_behavior_support(struct spdk_nvmf_request *req)
{
@ -2909,6 +2931,8 @@ nvmf_ctrlr_get_features(struct spdk_nvmf_request *req)
return nvmf_ctrlr_get_features_reservation_notification_mask(req);
case SPDK_NVME_FEAT_HOST_RESERVE_PERSIST:
return nvmf_ctrlr_get_features_reservation_persistence(req);
case SPDK_NVME_FEAT_HOST_BEHAVIOR_SUPPORT:
return nvmf_ctrlr_get_features_host_behavior_support(req);
default:
SPDK_INFOLOG(nvmf, "Get Features command with unsupported feature ID 0x%02x\n", feature);
response->status.sc = SPDK_NVME_SC_INVALID_FIELD;