From a158309ce55abedf57eca0d1cd6af7f8d1d6d3fe Mon Sep 17 00:00:00 2001 From: Ziye Yang Date: Wed, 5 Dec 2018 03:35:13 +0800 Subject: [PATCH] nvmf/tcp: Remove the hd_is_read field. Previously, this field is used to optimize the code. When we receive the capsule cmd pdu, we need to allocate the related buffer, if there is read or write request. If the related buffer is not valid, then we cannot enter the next pdu handling phase. So we use this field to mark. After carefully checking the code, I think that we use the tcp_req which is assoicated with the pdu, thus it is efficient. Change-Id: Ic1634d706dd40a706269bce199bf6031ea0462c0 Signed-off-by: Ziye Yang Reviewed-on: https://review.gerrithub.io/435995 Reviewed-by: Jim Harris Reviewed-by: Ben Walker Tested-by: SPDK CI Jenkins Chandler-Test-Pool: SPDK Automated Test System --- include/spdk_internal/nvme_tcp.h | 1 - lib/nvmf/tcp.c | 4 +--- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/include/spdk_internal/nvme_tcp.h b/include/spdk_internal/nvme_tcp.h index c7e19a9e2..6893586ce 100644 --- a/include/spdk_internal/nvme_tcp.h +++ b/include/spdk_internal/nvme_tcp.h @@ -93,7 +93,6 @@ struct nvme_tcp_pdu { uint32_t ch_valid_bytes; uint32_t psh_valid_bytes; - bool hd_is_read; uint32_t data_valid_bytes; nvme_tcp_qpair_xfer_complete_cb cb_fn; diff --git a/lib/nvmf/tcp.c b/lib/nvmf/tcp.c index 7a8fe333b..841574359 100644 --- a/lib/nvmf/tcp.c +++ b/lib/nvmf/tcp.c @@ -1938,7 +1938,7 @@ spdk_nvmf_tcp_sock_process(struct nvme_tcp_qpair *tqpair) /* Wait for the pdu specific header */ case NVME_TCP_PDU_RECV_STATE_AWAIT_PDU_PSH: pdu = &tqpair->pdu_in_progress; - if (pdu->hd_is_read) { + if (pdu->tcp_req) { break; } @@ -1977,8 +1977,6 @@ spdk_nvmf_tcp_sock_process(struct nvme_tcp_qpair *tqpair) } } - pdu->hd_is_read = true; - /* All header(ch, psh, head digist) of this PDU has now been read from the socket. */ spdk_nvmf_tcp_pdu_psh_handle(tqpair); break;