lib/nvmf: Do one memset per new PDU recv
While waiting for a new PDU, target will not do too many useless memcpy. Signed-off-by: MengjinWu <mengjin.wu@intel.com> Change-Id: Ie0825c2b1e44444b210040c4a1761010e0e4cfe5 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/14444 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Community-CI: Mellanox Build Bot Reviewed-by: Changpeng Liu <changpeng.liu@intel.com> Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
This commit is contained in:
parent
6045458cb6
commit
12807c5bc6
@ -2140,6 +2140,7 @@ nvmf_tcp_sock_process(struct spdk_nvmf_tcp_qpair *tqpair)
|
||||
tqpair->pdu_in_progress = pdu;
|
||||
}
|
||||
memset(pdu, 0, offsetof(struct nvme_tcp_pdu, qpair));
|
||||
nvmf_tcp_qpair_set_recv_state(tqpair, NVME_TCP_PDU_RECV_STATE_AWAIT_PDU_CH);
|
||||
/* FALLTHROUGH */
|
||||
case NVME_TCP_PDU_RECV_STATE_AWAIT_PDU_CH:
|
||||
if (spdk_unlikely(tqpair->state == NVME_TCP_QPAIR_STATE_INITIALIZING)) {
|
||||
@ -2155,9 +2156,6 @@ nvmf_tcp_sock_process(struct spdk_nvmf_tcp_qpair *tqpair)
|
||||
} else if (rc > 0) {
|
||||
pdu->ch_valid_bytes += rc;
|
||||
spdk_trace_record(TRACE_TCP_READ_FROM_SOCKET_DONE, tqpair->qpair.qid, rc, 0, tqpair);
|
||||
if (spdk_likely(tqpair->recv_state == NVME_TCP_PDU_RECV_STATE_AWAIT_PDU_READY)) {
|
||||
nvmf_tcp_qpair_set_recv_state(tqpair, NVME_TCP_PDU_RECV_STATE_AWAIT_PDU_CH);
|
||||
}
|
||||
}
|
||||
|
||||
if (pdu->ch_valid_bytes < sizeof(struct spdk_nvme_tcp_common_pdu_hdr)) {
|
||||
|
Loading…
Reference in New Issue
Block a user