Commit 51b64364 authored by Shuhei Matsumoto's avatar Shuhei Matsumoto Committed by Darek Stojaczyk
Browse files

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: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/458925


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarDarek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: default avatarZiye Yang <ziye.yang@intel.com>
Reviewed-by: default avatarChangpeng Liu <changpeng.liu@intel.com>
parent 536bd70e
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -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;