nvmf/tcp: Increase buffer to insert/strip DIF in spdk_nvmf_tcp_req_parse_sgl

If tcp_req->dif_insert_or_strip, increase the length from LBA based
to extended LBA based by using its own DIF context.

Change-Id: Ie9f5cf757328dda795b43a7b6c70a72259865115
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/458925
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
This commit is contained in:
Shuhei Matsumoto 2019-07-05 14:26:14 +09:00 committed by Darek Stojaczyk
parent 536bd70eb4
commit 51b643648c

View File

@ -188,6 +188,9 @@ struct spdk_nvmf_tcp_req {
uint32_t c2h_data_offset;
uint32_t c2h_data_pdu_num;
struct spdk_dif_ctx dif_ctx;
bool dif_insert_or_strip;
TAILQ_ENTRY(spdk_nvmf_tcp_req) link;
TAILQ_ENTRY(spdk_nvmf_tcp_req) state_link;
};
@ -361,6 +364,7 @@ spdk_nvmf_tcp_req_get(struct spdk_nvmf_tcp_qpair *tqpair)
tcp_req->r2tl_remain = 0;
tcp_req->c2h_data_offset = 0;
tcp_req->has_incapsule_data = false;
tcp_req->dif_insert_or_strip = false;
spdk_nvmf_tcp_req_set_state(tcp_req, TCP_REQUEST_STATE_NEW);
return tcp_req;
@ -2144,6 +2148,10 @@ spdk_nvmf_tcp_req_parse_sgl(struct spdk_nvmf_tcp_transport *ttransport,
SPDK_DEBUGLOG(SPDK_LOG_NVMF_TCP, "Data requested length= 0x%x\n", length);
if (spdk_unlikely(tcp_req->dif_insert_or_strip)) {
length = spdk_dif_get_length_with_md(length, &tcp_req->dif_ctx);
}
if (spdk_nvmf_tcp_req_fill_iovs(ttransport, tcp_req, length) < 0) {
/* No available buffers. Queue this request up. */
SPDK_DEBUGLOG(SPDK_LOG_NVMF_TCP, "No available large data buffers. Queueing request %p\n",
@ -2187,6 +2195,10 @@ spdk_nvmf_tcp_req_parse_sgl(struct spdk_nvmf_tcp_transport *ttransport,
tcp_req->data_from_pool = false;
tcp_req->req.length = length;
if (spdk_unlikely(tcp_req->dif_insert_or_strip)) {
length = spdk_dif_get_length_with_md(length, &tcp_req->dif_ctx);
}
tcp_req->req.iov[0].iov_base = tcp_req->req.data;
tcp_req->req.iov[0].iov_len = length;
tcp_req->req.iovcnt = 1;