Commit e1785131 authored by Shuhei Matsumoto's avatar Shuhei Matsumoto Committed by Changpeng Liu
Browse files

iscsi: Hold size of buffer to store PDU data segment in struct spdk_iscsi_pdu



Upcoming patches will store larger data in the data buffer than
iSCSI Initiator transfers, and size of metadata is not known until
asking to SCSI layer. This addition will be used to avoid overflow
in them.

Change-Id: I43e15d0cfbfddcf01342325b134d90e3d7dae038
Signed-off-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/446378


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarChangpeng Liu <changpeng.liu@intel.com>
Reviewed-by: default avatarZiye Yang <ziye.yang@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
parent af85c0ff
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -468,8 +468,10 @@ spdk_iscsi_read_pdu(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu **_pdu)
		if (pdu->data_buf == NULL) {
			if (data_len <= spdk_get_immediate_data_buffer_size()) {
				pool = g_spdk_iscsi.pdu_immediate_data_pool;
				pdu->data_buf_len = spdk_get_immediate_data_buffer_size();
			} else if (data_len <= SPDK_ISCSI_MAX_RECV_DATA_SEGMENT_LENGTH) {
				pool = g_spdk_iscsi.pdu_data_out_pool;
				pdu->data_buf_len = SPDK_ISCSI_MAX_RECV_DATA_SEGMENT_LENGTH;
			} else {
				SPDK_ERRLOG("Data(%d) > MaxSegment(%d)\n",
					    data_len, SPDK_ISCSI_MAX_RECV_DATA_SEGMENT_LENGTH);
@@ -2595,6 +2597,7 @@ spdk_iscsi_send_datain(struct spdk_iscsi_conn *conn,
	rsp_pdu = spdk_get_pdu();
	rsph = (struct iscsi_bhs_data_in *)&rsp_pdu->bhs;
	rsp_pdu->data = task->scsi.iovs[0].iov_base + offset;
	rsp_pdu->data_buf_len = task->scsi.iovs[0].iov_len - offset;
	rsp_pdu->data_from_mempool = true;

	task_tag = task->tag;
+1 −0
Original line number Diff line number Diff line
@@ -172,6 +172,7 @@ struct spdk_iscsi_pdu {
	struct spdk_iscsi_task *task; /* data tied to a task buffer */
	uint32_t cmd_sn;
	uint32_t writev_offset;
	uint32_t data_buf_len;
	TAILQ_ENTRY(spdk_iscsi_pdu)	tailq;