nvme: add ctrlr function to set initial CAP value
Change-Id: Id7f68f279f87a08844015efcd35a790944b3bfbe Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
This commit is contained in:
parent
fb31963c4b
commit
f505f57b36
@ -1285,9 +1285,6 @@ nvme_ctrlr_construct(struct spdk_nvme_ctrlr *ctrlr)
|
||||
nvme_ctrlr_set_state(ctrlr, NVME_CTRLR_STATE_INIT, NVME_TIMEOUT_INFINITE);
|
||||
ctrlr->flags = 0;
|
||||
ctrlr->free_io_qids = NULL;
|
||||
|
||||
ctrlr->min_page_size = 1 << (12 + ctrlr->cap.bits.mpsmin);
|
||||
|
||||
ctrlr->is_resetting = false;
|
||||
ctrlr->is_failed = false;
|
||||
|
||||
@ -1306,6 +1303,15 @@ nvme_ctrlr_construct(struct spdk_nvme_ctrlr *ctrlr)
|
||||
return rc;
|
||||
}
|
||||
|
||||
/* This function should be called once at ctrlr initialization to set up constant properties. */
|
||||
void
|
||||
nvme_ctrlr_init_cap(struct spdk_nvme_ctrlr *ctrlr, const union spdk_nvme_cap_register *cap)
|
||||
{
|
||||
ctrlr->cap = *cap;
|
||||
|
||||
ctrlr->min_page_size = 1u << (12 + ctrlr->cap.bits.mpsmin);
|
||||
}
|
||||
|
||||
void
|
||||
nvme_ctrlr_destruct(struct spdk_nvme_ctrlr *ctrlr)
|
||||
{
|
||||
|
@ -528,6 +528,7 @@ int nvme_ctrlr_start(struct spdk_nvme_ctrlr *ctrlr);
|
||||
int nvme_ctrlr_submit_admin_request(struct spdk_nvme_ctrlr *ctrlr,
|
||||
struct nvme_request *req);
|
||||
int nvme_ctrlr_get_cap(struct spdk_nvme_ctrlr *ctrlr, union spdk_nvme_cap_register *cap);
|
||||
void nvme_ctrlr_init_cap(struct spdk_nvme_ctrlr *ctrlr, const union spdk_nvme_cap_register *cap);
|
||||
int nvme_qpair_construct(struct spdk_nvme_qpair *qpair, uint16_t id,
|
||||
uint16_t num_entries,
|
||||
struct spdk_nvme_ctrlr *ctrlr,
|
||||
|
@ -623,7 +623,7 @@ struct spdk_nvme_ctrlr *nvme_pcie_ctrlr_construct(const struct spdk_nvme_transpo
|
||||
return NULL;
|
||||
}
|
||||
|
||||
pctrlr->ctrlr.cap = cap;
|
||||
nvme_ctrlr_init_cap(&pctrlr->ctrlr, &cap);
|
||||
|
||||
/* Doorbell stride is 2 ^ (dstrd + 2),
|
||||
* but we want multiples of 4, so drop the + 2 */
|
||||
|
@ -1263,7 +1263,7 @@ struct spdk_nvme_ctrlr *nvme_rdma_ctrlr_construct(const struct spdk_nvme_transpo
|
||||
return NULL;
|
||||
}
|
||||
|
||||
rctrlr->ctrlr.cap = cap;
|
||||
nvme_ctrlr_init_cap(&rctrlr->ctrlr, &cap);
|
||||
|
||||
SPDK_TRACELOG(SPDK_TRACE_DEBUG, "succesully initialized the nvmf ctrlr\n");
|
||||
return &rctrlr->ctrlr;
|
||||
|
Loading…
x
Reference in New Issue
Block a user