nvmf: Move some stray session init code to the right place
A connection function was initializing some session data, so move that code to the function that initializes the session. Change-Id: I5f2d4349585cb97985a7bbd9fb8d6c66eeaa7d4e Signed-off-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
parent
64f6abea9c
commit
828dca7351
@ -340,35 +340,8 @@ nvmf_init_conn_properites(struct spdk_nvmf_conn *conn,
|
||||
struct nvmf_session *session,
|
||||
struct spdk_nvmf_fabric_connect_rsp *response)
|
||||
{
|
||||
|
||||
struct spdk_nvmf_extended_identify_ctrlr_data *lcdata;
|
||||
uint32_t mdts;
|
||||
|
||||
conn->cntlid = response->status_code_specific.success.cntlid;
|
||||
session->max_connections_allowed = g_nvmf_tgt.MaxConnectionsPerSession;
|
||||
nvmf_init_session_properties(session, conn->rdma.queue_depth);
|
||||
|
||||
/* Update the session logical controller data with any
|
||||
* application fabric side limits
|
||||
*/
|
||||
/* reset mdts in vcdata to equal the application default maximum */
|
||||
mdts = SPDK_NVMF_MAX_RECV_DATA_TRANSFER_SIZE /
|
||||
(1 << (12 + session->vcprop.cap.bits.mpsmin));
|
||||
if (mdts == 0) {
|
||||
SPDK_ERRLOG("Min page size exceeds max transfer size!\n");
|
||||
SPDK_ERRLOG("Verify setting of SPDK_NVMF_MAX_RECV_DATA_TRANSFER_SIZE and mpsmin\n");
|
||||
session->vcdata.mdts = 1; /* Support single page for now */
|
||||
} else {
|
||||
/* set mdts as a power of 2 representing number of mpsmin units */
|
||||
session->vcdata.mdts = 0;
|
||||
while ((1ULL << session->vcdata.mdts) < mdts) {
|
||||
session->vcdata.mdts++;
|
||||
}
|
||||
}
|
||||
|
||||
/* increase the I/O recv capsule size for in_capsule data */
|
||||
lcdata = (struct spdk_nvmf_extended_identify_ctrlr_data *)session->vcdata.nvmf_specific;
|
||||
lcdata->ioccsz += (SPDK_NVMF_MAX_RECV_DATA_TRANSFER_SIZE / 16);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -68,6 +68,7 @@ nvmf_create_session(const char *subnqn)
|
||||
session->num_connections = 0;
|
||||
session->is_valid = 1;
|
||||
session->subsys = subsystem;
|
||||
session->max_connections_allowed = g_nvmf_tgt.MaxConnectionsPerSession;
|
||||
|
||||
exit:
|
||||
return session;
|
||||
@ -136,25 +137,22 @@ nvmf_init_nvme_session_properties(struct nvmf_session *session, int aq_depth)
|
||||
|
||||
/* Init the virtual controller details using actual HW details */
|
||||
cdata = spdk_nvme_ctrlr_get_data(session->subsys->ctrlr);
|
||||
memcpy((char *)&session->vcdata, (char *)cdata, sizeof(struct spdk_nvme_ctrlr_data));
|
||||
memcpy(&session->vcdata, cdata, sizeof(struct spdk_nvme_ctrlr_data));
|
||||
|
||||
/* indicate support for only a single AER */
|
||||
session->vcdata.aerl = 0;
|
||||
|
||||
/* reset cntlid in vcdata to match the logical cntlid known to NVMf */
|
||||
session->vcdata.cntlid = session->cntlid;
|
||||
|
||||
/* initialize the nvmf new and extension details in controller data */
|
||||
session->vcdata.kas = 10;
|
||||
session->vcdata.maxcmd = SPDK_NVMF_DEFAULT_MAX_QUEUE_DEPTH;
|
||||
session->vcdata.mdts = SPDK_NVMF_MAX_RECV_DATA_TRANSFER_SIZE / 4096;
|
||||
session->vcdata.sgls.keyed_sgl = 1;
|
||||
session->vcdata.sgls.sgl_offset = 1;
|
||||
|
||||
nvmfdata = (struct spdk_nvmf_extended_identify_ctrlr_data *)session->vcdata.nvmf_specific;
|
||||
nvmfdata->ioccsz = (NVMF_H2C_MAX_MSG / 16);
|
||||
nvmfdata->iorcsz = (NVMF_C2H_MAX_MSG / 16);
|
||||
nvmfdata->icdoff = 0; /* offset starts directly after SQE */
|
||||
nvmfdata->ctrattr = 0; /* dynamic controller model */
|
||||
nvmfdata->msdbd = 1; /* target supports single SGL in capsule */
|
||||
session->vcdata.sgls.keyed_sgl = 1;
|
||||
session->vcdata.sgls.sgl_offset = 1;
|
||||
|
||||
SPDK_TRACELOG(SPDK_TRACE_NVMF, " nvmf_init_session_properties: ctrlr data: maxcmd %x\n",
|
||||
session->vcdata.maxcmd);
|
||||
|
Loading…
Reference in New Issue
Block a user