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 <optimistyzy@gmail.com>
Reviewed-on: https://review.gerrithub.io/435995
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
This commit is contained in:
Ziye Yang 2018-12-05 03:35:13 +08:00 committed by Jim Harris
parent 9ff6da9961
commit a158309ce5
2 changed files with 1 additions and 4 deletions

View File

@ -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;

View File

@ -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;