nvme: Cache the cb_fn and cb_arg in the tracker
This avoids a data dependent load to find which callback to call in the completion path. Change-Id: Ifa20790a7af3332a74bc45037e589668744af797 Signed-off-by: Ben Walker <benjamin.walker@intel.com> Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/450558 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
This commit is contained in:
parent
f7d3dd9bd6
commit
d02950e6f5
@ -529,7 +529,7 @@ spdk_nvme_ctrlr_cmd_abort_cpl(void *ctx, const struct spdk_nvme_cpl *cpl)
|
|||||||
next->cpl.status.sct = SPDK_NVME_SCT_GENERIC;
|
next->cpl.status.sct = SPDK_NVME_SCT_GENERIC;
|
||||||
next->cpl.status.sc = SPDK_NVME_SC_INTERNAL_DEVICE_ERROR;
|
next->cpl.status.sc = SPDK_NVME_SC_INTERNAL_DEVICE_ERROR;
|
||||||
next->cpl.status.dnr = 1;
|
next->cpl.status.dnr = 1;
|
||||||
nvme_complete_request(next, &req->cpl);
|
nvme_complete_request(next->cb_fn, next->cb_arg, next, &req->cpl);
|
||||||
nvme_free_request(next);
|
nvme_free_request(next);
|
||||||
} else {
|
} else {
|
||||||
/* If the first abort succeeds, stop iterating. */
|
/* If the first abort succeeds, stop iterating. */
|
||||||
|
@ -908,7 +908,8 @@ struct nvme_request *nvme_allocate_request_user_copy(struct spdk_nvme_qpair *qpa
|
|||||||
spdk_nvme_cmd_cb cb_fn, void *cb_arg, bool host_to_controller);
|
spdk_nvme_cmd_cb cb_fn, void *cb_arg, bool host_to_controller);
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
nvme_complete_request(struct nvme_request *req, struct spdk_nvme_cpl *cpl)
|
nvme_complete_request(spdk_nvme_cmd_cb cb_fn, void *cb_arg,
|
||||||
|
struct nvme_request *req, struct spdk_nvme_cpl *cpl)
|
||||||
{
|
{
|
||||||
struct spdk_nvme_qpair *qpair = req->qpair;
|
struct spdk_nvme_qpair *qpair = req->qpair;
|
||||||
struct spdk_nvme_cpl err_cpl;
|
struct spdk_nvme_cpl err_cpl;
|
||||||
@ -938,8 +939,8 @@ nvme_complete_request(struct nvme_request *req, struct spdk_nvme_cpl *cpl)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (req->cb_fn) {
|
if (cb_fn) {
|
||||||
req->cb_fn(req->cb_arg, cpl);
|
cb_fn(cb_arg, cpl);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -70,7 +70,7 @@ nvme_cb_complete_child(void *child_arg, const struct spdk_nvme_cpl *cpl)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (parent->num_children == 0) {
|
if (parent->num_children == 0) {
|
||||||
nvme_complete_request(parent, &parent->parent_status);
|
nvme_complete_request(parent->cb_fn, parent->cb_arg, parent, &parent->parent_status);
|
||||||
nvme_free_request(parent);
|
nvme_free_request(parent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -55,9 +55,9 @@
|
|||||||
* NVME_MAX_SGL_DESCRIPTORS defines the maximum number of descriptors in one SGL
|
* NVME_MAX_SGL_DESCRIPTORS defines the maximum number of descriptors in one SGL
|
||||||
* segment.
|
* segment.
|
||||||
*/
|
*/
|
||||||
#define NVME_MAX_SGL_DESCRIPTORS (253)
|
#define NVME_MAX_SGL_DESCRIPTORS (251)
|
||||||
|
|
||||||
#define NVME_MAX_PRP_LIST_ENTRIES (506)
|
#define NVME_MAX_PRP_LIST_ENTRIES (505)
|
||||||
|
|
||||||
struct nvme_pcie_enum_ctx {
|
struct nvme_pcie_enum_ctx {
|
||||||
struct spdk_nvme_probe_ctx *probe_ctx;
|
struct spdk_nvme_probe_ctx *probe_ctx;
|
||||||
@ -114,11 +114,11 @@ struct nvme_tracker {
|
|||||||
struct nvme_request *req;
|
struct nvme_request *req;
|
||||||
uint16_t cid;
|
uint16_t cid;
|
||||||
|
|
||||||
uint16_t rsvd1;
|
uint16_t rsvd0;
|
||||||
|
uint32_t rsvd1;
|
||||||
|
|
||||||
uint32_t rsvd2;
|
spdk_nvme_cmd_cb cb_fn;
|
||||||
|
void *cb_arg;
|
||||||
uint64_t rsvd3;
|
|
||||||
|
|
||||||
uint64_t prp_sgl_bus_addr;
|
uint64_t prp_sgl_bus_addr;
|
||||||
|
|
||||||
@ -1153,7 +1153,7 @@ nvme_pcie_qpair_complete_pending_admin_request(struct spdk_nvme_qpair *qpair)
|
|||||||
|
|
||||||
assert(req->pid == pid);
|
assert(req->pid == pid);
|
||||||
|
|
||||||
nvme_complete_request(req, &req->cpl);
|
nvme_complete_request(req->cb_fn, req->cb_arg, req, &req->cpl);
|
||||||
nvme_free_request(req);
|
nvme_free_request(req);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1286,7 +1286,7 @@ nvme_pcie_qpair_complete_tracker(struct spdk_nvme_qpair *qpair, struct nvme_trac
|
|||||||
req_from_current_proc = false;
|
req_from_current_proc = false;
|
||||||
nvme_pcie_qpair_insert_pending_admin_request(qpair, req, cpl);
|
nvme_pcie_qpair_insert_pending_admin_request(qpair, req, cpl);
|
||||||
} else {
|
} else {
|
||||||
nvme_complete_request(req, cpl);
|
nvme_complete_request(tr->cb_fn, tr->cb_arg, req, cpl);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (req_from_current_proc == true) {
|
if (req_from_current_proc == true) {
|
||||||
@ -2003,6 +2003,8 @@ nvme_pcie_qpair_submit_request(struct spdk_nvme_qpair *qpair, struct nvme_reques
|
|||||||
TAILQ_REMOVE(&pqpair->free_tr, tr, tq_list); /* remove tr from free_tr */
|
TAILQ_REMOVE(&pqpair->free_tr, tr, tq_list); /* remove tr from free_tr */
|
||||||
TAILQ_INSERT_TAIL(&pqpair->outstanding_tr, tr, tq_list);
|
TAILQ_INSERT_TAIL(&pqpair->outstanding_tr, tr, tq_list);
|
||||||
tr->req = req;
|
tr->req = req;
|
||||||
|
tr->cb_fn = req->cb_fn;
|
||||||
|
tr->cb_arg = req->cb_arg;
|
||||||
req->cmd.cid = tr->cid;
|
req->cmd.cid = tr->cid;
|
||||||
|
|
||||||
if (req->payload_size && req->payload.md) {
|
if (req->payload_size && req->payload.md) {
|
||||||
|
@ -382,7 +382,7 @@ nvme_qpair_manual_complete_request(struct spdk_nvme_qpair *qpair,
|
|||||||
nvme_qpair_print_completion(qpair, &cpl);
|
nvme_qpair_print_completion(qpair, &cpl);
|
||||||
}
|
}
|
||||||
|
|
||||||
nvme_complete_request(req, &cpl);
|
nvme_complete_request(req->cb_fn, req->cb_arg, req, &cpl);
|
||||||
nvme_free_request(req);
|
nvme_free_request(req);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -209,7 +209,7 @@ static void
|
|||||||
nvme_rdma_req_complete(struct nvme_request *req,
|
nvme_rdma_req_complete(struct nvme_request *req,
|
||||||
struct spdk_nvme_cpl *rsp)
|
struct spdk_nvme_cpl *rsp)
|
||||||
{
|
{
|
||||||
nvme_complete_request(req, rsp);
|
nvme_complete_request(req->cb_fn, req->cb_arg, req, rsp);
|
||||||
nvme_free_request(req);
|
nvme_free_request(req);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -755,7 +755,7 @@ static void
|
|||||||
nvme_tcp_req_complete(struct nvme_request *req,
|
nvme_tcp_req_complete(struct nvme_request *req,
|
||||||
struct spdk_nvme_cpl *rsp)
|
struct spdk_nvme_cpl *rsp)
|
||||||
{
|
{
|
||||||
nvme_complete_request(req, rsp);
|
nvme_complete_request(req->cb_fn, req->cb_arg, req, rsp);
|
||||||
nvme_free_request(req);
|
nvme_free_request(req);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user