lib/nvme_tcp: Refactor the code to generate _nvme_tcp_pdu_payload_handle

The purpose is to prepared for implement the async crc32 caculation
in the future patch.

Change-Id: Ia75f28154c49f08b527d48c63b9da79a6bdfede8
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7794
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
This commit is contained in:
Ziye Yang 2021-05-07 18:34:35 +08:00 committed by Tomasz Zawadzki
parent bc35dab91c
commit bcbccf8bb5

View File

@ -1041,6 +1041,30 @@ nvme_tcp_c2h_term_req_payload_handle(struct nvme_tcp_qpair *tqpair,
nvme_tcp_qpair_set_recv_state(tqpair, NVME_TCP_PDU_RECV_STATE_ERROR);
}
static void
_nvme_tcp_pdu_payload_handle(struct nvme_tcp_qpair *tqpair, uint32_t *reaped)
{
struct nvme_tcp_pdu *pdu;
assert(tqpair != NULL);
pdu = tqpair->recv_pdu;
switch (pdu->hdr.common.pdu_type) {
case SPDK_NVME_TCP_PDU_TYPE_C2H_DATA:
nvme_tcp_c2h_data_payload_handle(tqpair, pdu, reaped);
break;
case SPDK_NVME_TCP_PDU_TYPE_C2H_TERM_REQ:
nvme_tcp_c2h_term_req_payload_handle(tqpair, pdu);
break;
default:
/* The code should not go to here */
SPDK_ERRLOG("The code should not go to here\n");
break;
}
}
static void
nvme_tcp_pdu_payload_handle(struct nvme_tcp_qpair *tqpair,
uint32_t *reaped)
@ -1067,20 +1091,7 @@ nvme_tcp_pdu_payload_handle(struct nvme_tcp_qpair *tqpair,
}
}
switch (pdu->hdr.common.pdu_type) {
case SPDK_NVME_TCP_PDU_TYPE_C2H_DATA:
nvme_tcp_c2h_data_payload_handle(tqpair, pdu, reaped);
break;
case SPDK_NVME_TCP_PDU_TYPE_C2H_TERM_REQ:
nvme_tcp_c2h_term_req_payload_handle(tqpair, pdu);
break;
default:
/* The code should not go to here */
SPDK_ERRLOG("The code should not go to here\n");
break;
}
_nvme_tcp_pdu_payload_handle(tqpair, reaped);
}
static void