Commit acdeb53f authored by Shuhei Matsumoto's avatar Shuhei Matsumoto Committed by Tomasz Zawadzki
Browse files

lib/iscsi: Increase buffer size to 64KB at most when more Data-OUT PDUs follow



The following patches will want to aggregate multiple Data-OUT PDUs
into the same data buffer, but it will be 64KB at most.

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


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
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 2ef97692
Loading
Loading
Loading
Loading
+12 −2
Original line number Diff line number Diff line
@@ -4247,6 +4247,15 @@ iscsi_pdu_hdr_op_data(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu)
		pdu->dif_insert_or_strip = true;
	}

	if (!F_bit && !pdu->dif_insert_or_strip) {
		/* More Data-OUT PDUs will follow in this sequence. Increase the buffer size
		 * up to SPDK_ISCSI_MAX_RECV_DATA_SEGMENT_LENGTH to merge them into a single
		 * subtask.
		 */
		pdu->data_buf_len = spdk_min(task->desired_data_transfer_length,
					     SPDK_ISCSI_MAX_RECV_DATA_SEGMENT_LENGTH);
	}

	return 0;
}

@@ -4545,10 +4554,10 @@ iscsi_pdu_payload_read(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu)
	data_len = pdu->data_segment_len;

	if (pdu->data == NULL) {
		if (data_len <= iscsi_get_max_immediate_data_size()) {
		if (pdu->data_buf_len <= iscsi_get_max_immediate_data_size()) {
			pool = g_iscsi.pdu_immediate_data_pool;
			pdu->data_buf_len = SPDK_BDEV_BUF_SIZE_WITH_MD(iscsi_get_max_immediate_data_size());
		} else if (data_len <= SPDK_ISCSI_MAX_RECV_DATA_SEGMENT_LENGTH) {
		} else if (pdu->data_buf_len <= SPDK_ISCSI_MAX_RECV_DATA_SEGMENT_LENGTH) {
			pool = g_iscsi.pdu_data_out_pool;
			pdu->data_buf_len = SPDK_BDEV_BUF_SIZE_WITH_MD(SPDK_ISCSI_MAX_RECV_DATA_SEGMENT_LENGTH);
		} else {
@@ -4663,6 +4672,7 @@ iscsi_read_pdu(struct spdk_iscsi_conn *conn)
			}

			pdu->data_segment_len = ISCSI_ALIGN(DGET24(pdu->bhs.data_segment_len));
			pdu->data_buf_len = pdu->data_segment_len;

			/* AHS */
			ahs_len = pdu->bhs.total_ahs_len * 4;
+1 −0
Original line number Diff line number Diff line
@@ -1967,6 +1967,7 @@ pdu_hdr_op_data_test(void)
	rc = iscsi_pdu_hdr_op_data(&conn, &pdu);
	CU_ASSERT(rc == 0);
	CU_ASSERT(!pdu.is_rejected);
	CU_ASSERT(pdu.data_buf_len == SPDK_ISCSI_MAX_RECV_DATA_SEGMENT_LENGTH);
	pdu.task = NULL;

	/* Case 11 - SCSI Data-Out PDU is correct and processed. Its F bit is 1 and hence