From 334aeff9e109ae16d4828fbda590ee50aa6400a1 Mon Sep 17 00:00:00 2001 From: Maciej Szwed Date: Thu, 5 Dec 2019 13:11:20 +0100 Subject: [PATCH] nvme: Don't ring a doorbell for first of fused commands This patch adds first_fused_submitted field in spdk_nvme_qpair structure which is used for postponing ringing a doorbell for fused commands. Signed-off-by: Maciej Szwed Change-Id: Ibfc43931891ebaadbafa4895c05af9f228440210 Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/477024 Tested-by: SPDK CI Jenkins Community-CI: SPDK CI Jenkins Reviewed-by: Ben Walker Reviewed-by: Shuhei Matsumoto Reviewed-by: Jim Harris Reviewed-by: Tomasz Zawadzki Reviewed-by: Paul Luse --- lib/nvme/nvme_internal.h | 2 ++ lib/nvme/nvme_pcie.c | 11 +++++++++++ 2 files changed, 13 insertions(+) diff --git a/lib/nvme/nvme_internal.h b/lib/nvme/nvme_internal.h index 109e2e5a4..bd3a914b5 100644 --- a/lib/nvme/nvme_internal.h +++ b/lib/nvme/nvme_internal.h @@ -378,6 +378,8 @@ struct spdk_nvme_qpair { */ uint8_t no_deletion_notification_needed: 1; + uint8_t first_fused_submitted: 1; + enum spdk_nvme_transport_type trtype; STAILQ_HEAD(, nvme_request) free_req; diff --git a/lib/nvme/nvme_pcie.c b/lib/nvme/nvme_pcie.c index 87cbfbee4..3ac4ed741 100644 --- a/lib/nvme/nvme_pcie.c +++ b/lib/nvme/nvme_pcie.c @@ -1244,6 +1244,12 @@ nvme_pcie_qpair_ring_sq_doorbell(struct spdk_nvme_qpair *qpair) struct nvme_pcie_ctrlr *pctrlr = nvme_pcie_ctrlr(qpair->ctrlr); bool need_mmio = true; + if (qpair->first_fused_submitted) { + /* This is first cmd of two fused commands - don't ring doorbell */ + qpair->first_fused_submitted = 0; + return; + } + if (spdk_unlikely(pqpair->flags.has_shadow_doorbell)) { need_mmio = nvme_pcie_qpair_update_mmio_required(qpair, pqpair->sq_tail, @@ -1289,6 +1295,11 @@ nvme_pcie_qpair_submit_tracker(struct spdk_nvme_qpair *qpair, struct nvme_tracke req = tr->req; assert(req != NULL); + if (req->cmd.fuse == SPDK_NVME_IO_FLAGS_FUSE_FIRST) { + /* This is first cmd of two fused commands - don't ring doorbell */ + qpair->first_fused_submitted = 1; + } + /* Copy the command from the tracker to the submission queue. */ nvme_pcie_copy_command(&pqpair->cmd[pqpair->sq_tail], &req->cmd);