lib/nvmf: Refactor the code to generate _nvmf_tcp_pdu_payload_handle

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

Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Change-Id: I49f84ea1966f0acdd6f5aeb7192896f91fd16dee
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7793
Community-CI: Broadcom CI
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:28:03 +08:00 committed by Tomasz Zawadzki
parent 4e0ca20a8a
commit bc35dab91c

View File

@ -1662,6 +1662,31 @@ nvmf_tcp_h2c_term_req_payload_handle(struct spdk_nvmf_tcp_qpair *tqpair,
nvmf_tcp_qpair_set_recv_state(tqpair, NVME_TCP_PDU_RECV_STATE_ERROR);
}
static void
_nvmf_tcp_pdu_payload_handle(struct spdk_nvmf_tcp_qpair *tqpair,
struct spdk_nvmf_tcp_transport *ttransport)
{
struct nvme_tcp_pdu *pdu = tqpair->pdu_in_progress;
switch (pdu->hdr.common.pdu_type) {
case SPDK_NVME_TCP_PDU_TYPE_CAPSULE_CMD:
nvmf_tcp_capsule_cmd_payload_handle(ttransport, tqpair, pdu);
break;
case SPDK_NVME_TCP_PDU_TYPE_H2C_DATA:
nvmf_tcp_h2c_data_payload_handle(ttransport, tqpair, pdu);
break;
case SPDK_NVME_TCP_PDU_TYPE_H2C_TERM_REQ:
nvmf_tcp_h2c_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
nvmf_tcp_pdu_payload_handle(struct spdk_nvmf_tcp_qpair *tqpair,
struct spdk_nvmf_tcp_transport *ttransport)
@ -1688,23 +1713,7 @@ nvmf_tcp_pdu_payload_handle(struct spdk_nvmf_tcp_qpair *tqpair,
}
}
switch (pdu->hdr.common.pdu_type) {
case SPDK_NVME_TCP_PDU_TYPE_CAPSULE_CMD:
nvmf_tcp_capsule_cmd_payload_handle(ttransport, tqpair, pdu);
break;
case SPDK_NVME_TCP_PDU_TYPE_H2C_DATA:
nvmf_tcp_h2c_data_payload_handle(ttransport, tqpair, pdu);
break;
case SPDK_NVME_TCP_PDU_TYPE_H2C_TERM_REQ:
nvmf_tcp_h2c_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;
}
_nvmf_tcp_pdu_payload_handle(tqpair, ttransport);
}
static void