From 8a80461ac62c7c53c90caab04c48db9078d450cd Mon Sep 17 00:00:00 2001 From: Shuhei Matsumoto Date: Thu, 29 Aug 2019 08:44:52 +0900 Subject: [PATCH] nvmf/tcp: execute buffer allocation only if request is the first of pendings RDMA transport executes spdk_nvmf_rdma_request_parse_sgl() only if the request is the first of the pending requests in the case RDMA_REQUEST_STATE_NEED_BUFFER in the state machine spdk_nvmf_rdma_requests_process(). This made RDMA transport possible to use STAILQ for pending requests because STAILQ_REMOVE parses from head and is slow when the target is in the middle of STAILQ. On the other hand, TCP transport executes spdk_nvmf_tcp_req_parse_sgl() even if the request is in the middle of the pending request in the case TCP_REQUEST_STATE_NEED_BUFFER in the state machine spdk_nvmf_tcp_req_process() if the request has in-capsule data. Hence TCP transport have used TAILQ for pending requests. This patch removes the condition if the request has in-capsule data from the case TCP_REQUEST_STATE_NEED_BUFFER. The purpose of this patch is to unify I/O buffer management further. Performance degradation was not observed even after this patch. Signed-off-by: Shuhei Matsumoto Change-Id: Idc97fe20f7013ca66fd58587773edb81ef7cbbfc Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/466636 Tested-by: SPDK CI Jenkins Reviewed-by: Changpeng Liu Reviewed-by: Broadcom SPDK FC-NVMe CI Reviewed-by: Ben Walker --- lib/nvmf/tcp.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/nvmf/tcp.c b/lib/nvmf/tcp.c index d3e9bf866..40cad4d21 100644 --- a/lib/nvmf/tcp.c +++ b/lib/nvmf/tcp.c @@ -2568,8 +2568,7 @@ spdk_nvmf_tcp_req_process(struct spdk_nvmf_tcp_transport *ttransport, assert(tcp_req->req.xfer != SPDK_NVME_DATA_NONE); - if (!tcp_req->has_incapsule_data && - (tcp_req != TAILQ_FIRST(&tqpair->group->pending_data_buf_queue))) { + if (tcp_req != TAILQ_FIRST(&tqpair->group->pending_data_buf_queue)) { SPDK_DEBUGLOG(SPDK_LOG_NVMF_TCP, "Not the first element to wait for the buf for tcp_req(%p) on tqpair=%p\n", tcp_req, tqpair);