nvmf: add Set Features - Keep Alive Timer to Direct mode
Move the current Virtual mode implementation to session.c and use it for Direct as well. Change-Id: I3f0ac93b4247b93d158b0dcb77e257b4b91be129 Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
This commit is contained in:
parent
4be1cd85f0
commit
48631ef2b9
@ -159,6 +159,8 @@ nvmf_direct_ctrlr_process_admin_cmd(struct spdk_nvmf_request *req)
|
||||
return SPDK_NVMF_REQUEST_EXEC_STATUS_COMPLETE;
|
||||
case SPDK_NVME_FEAT_HOST_IDENTIFIER:
|
||||
return spdk_nvmf_session_get_features_host_identifier(req);
|
||||
case SPDK_NVME_FEAT_KEEP_ALIVE_TIMER:
|
||||
return spdk_nvmf_session_get_features_keep_alive_timer(req);
|
||||
default:
|
||||
goto passthrough;
|
||||
}
|
||||
@ -181,6 +183,8 @@ nvmf_direct_ctrlr_process_admin_cmd(struct spdk_nvmf_request *req)
|
||||
return SPDK_NVMF_REQUEST_EXEC_STATUS_COMPLETE;
|
||||
case SPDK_NVME_FEAT_HOST_IDENTIFIER:
|
||||
return spdk_nvmf_session_set_features_host_identifier(req);
|
||||
case SPDK_NVME_FEAT_KEEP_ALIVE_TIMER:
|
||||
return spdk_nvmf_session_set_features_keep_alive_timer(req);
|
||||
default:
|
||||
goto passthrough;
|
||||
}
|
||||
|
@ -45,6 +45,8 @@
|
||||
|
||||
#include "spdk_internal/log.h"
|
||||
|
||||
#define MIN_KEEP_ALIVE_TIMEOUT 10000
|
||||
|
||||
static void
|
||||
nvmf_init_discovery_session_properties(struct spdk_nvmf_session *session)
|
||||
{
|
||||
@ -617,3 +619,36 @@ spdk_nvmf_session_get_features_host_identifier(struct spdk_nvmf_request *req)
|
||||
memcpy(req->data, session->hostid, sizeof(session->hostid));
|
||||
return SPDK_NVMF_REQUEST_EXEC_STATUS_COMPLETE;
|
||||
}
|
||||
|
||||
int
|
||||
spdk_nvmf_session_set_features_keep_alive_timer(struct spdk_nvmf_request *req)
|
||||
{
|
||||
struct spdk_nvmf_session *session = req->conn->sess;
|
||||
struct spdk_nvme_cmd *cmd = &req->cmd->nvme_cmd;
|
||||
struct spdk_nvme_cpl *rsp = &req->rsp->nvme_cpl;
|
||||
|
||||
SPDK_TRACELOG(SPDK_TRACE_NVMF, "Set Features - Keep Alive Timer (%u ms)\n", cmd->cdw11);
|
||||
|
||||
if (cmd->cdw11 == 0) {
|
||||
rsp->status.sc = SPDK_NVME_SC_KEEP_ALIVE_INVALID;
|
||||
} else if (cmd->cdw11 < MIN_KEEP_ALIVE_TIMEOUT) {
|
||||
session->kato = MIN_KEEP_ALIVE_TIMEOUT;
|
||||
} else {
|
||||
session->kato = cmd->cdw11;
|
||||
}
|
||||
|
||||
SPDK_TRACELOG(SPDK_TRACE_NVMF, "Set Features - Keep Alive Timer set to %u ms\n", session->kato);
|
||||
|
||||
return SPDK_NVMF_REQUEST_EXEC_STATUS_COMPLETE;
|
||||
}
|
||||
|
||||
int
|
||||
spdk_nvmf_session_get_features_keep_alive_timer(struct spdk_nvmf_request *req)
|
||||
{
|
||||
struct spdk_nvmf_session *session = req->conn->sess;
|
||||
struct spdk_nvme_cpl *rsp = &req->rsp->nvme_cpl;
|
||||
|
||||
SPDK_TRACELOG(SPDK_TRACE_NVMF, "Get Features - Keep Alive Timer\n");
|
||||
rsp->cdw0 = session->kato;
|
||||
return SPDK_NVMF_REQUEST_EXEC_STATUS_COMPLETE;
|
||||
}
|
||||
|
@ -119,4 +119,7 @@ void spdk_nvmf_session_destruct(struct spdk_nvmf_session *session);
|
||||
int spdk_nvmf_session_set_features_host_identifier(struct spdk_nvmf_request *req);
|
||||
int spdk_nvmf_session_get_features_host_identifier(struct spdk_nvmf_request *req);
|
||||
|
||||
int spdk_nvmf_session_set_features_keep_alive_timer(struct spdk_nvmf_request *req);
|
||||
int spdk_nvmf_session_get_features_keep_alive_timer(struct spdk_nvmf_request *req);
|
||||
|
||||
#endif
|
||||
|
@ -48,7 +48,6 @@
|
||||
|
||||
#include "spdk_internal/log.h"
|
||||
|
||||
#define MIN_KEEP_ALIVE_TIMEOUT 10000
|
||||
#define MODEL_NUMBER "SPDK Virtual Controller"
|
||||
#define FW_VERSION "FFFFFFFF"
|
||||
|
||||
@ -290,8 +289,7 @@ nvmf_virtual_ctrlr_get_features(struct spdk_nvmf_request *req)
|
||||
response->cdw0 = 1;
|
||||
return SPDK_NVMF_REQUEST_EXEC_STATUS_COMPLETE;
|
||||
case SPDK_NVME_FEAT_KEEP_ALIVE_TIMER:
|
||||
response->cdw0 = session->kato;
|
||||
return SPDK_NVMF_REQUEST_EXEC_STATUS_COMPLETE;
|
||||
return spdk_nvmf_session_get_features_keep_alive_timer(req);
|
||||
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;
|
||||
@ -330,14 +328,7 @@ nvmf_virtual_ctrlr_set_features(struct spdk_nvmf_request *req)
|
||||
}
|
||||
return SPDK_NVMF_REQUEST_EXEC_STATUS_COMPLETE;
|
||||
case SPDK_NVME_FEAT_KEEP_ALIVE_TIMER:
|
||||
if (cmd->cdw11 == 0) {
|
||||
response->status.sc = SPDK_NVME_SC_KEEP_ALIVE_INVALID;
|
||||
} else if (cmd->cdw11 < MIN_KEEP_ALIVE_TIMEOUT) {
|
||||
session->kato = MIN_KEEP_ALIVE_TIMEOUT;
|
||||
} else {
|
||||
session->kato = cmd->cdw11;
|
||||
}
|
||||
return SPDK_NVMF_REQUEST_EXEC_STATUS_COMPLETE;
|
||||
return spdk_nvmf_session_set_features_keep_alive_timer(req);
|
||||
case SPDK_NVME_FEAT_ASYNC_EVENT_CONFIGURATION:
|
||||
SPDK_TRACELOG(SPDK_TRACE_NVMF, "Set Features - Async Event Configuration, cdw11 0x%08x\n",
|
||||
cmd->cdw11);
|
||||
|
Loading…
Reference in New Issue
Block a user