Commit d393983d authored by GangCao's avatar GangCao Committed by Jim Harris
Browse files

lib/iscsi: export FirstBurstLength as user configurable parameter

According to https://tools.ietf.org/html/rfc3720

, the
default value for the FirstBurstLength is 65536 bytes
while SPDK iSCSI target picks the smaller 8192 as the
default setting. This value is the communication for
the iSCSI initiator to send the unsolicited data and
instead of having a fixed setting here, expose it as a
user configurable parameter to fit the real use case,
especially for the data out iSCSI write.

Example of usage as following in the iSCSI.conf:

FirstBurstLength 8192

Change-Id: I71690c7c48aa0875f1f975c0ea935389de6d1e6d
Signed-off-by: default avatarGangCao <gang.cao@intel.com>
Reviewed-on: https://review.gerrithub.io/421142


Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
parent 785f6025
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -1784,6 +1784,7 @@ max_queue_depth | number | Maximum number of outstanding I/Os per q
max_connections_per_session | number  | Session specific parameter, MaxConnections (default: 2)
default_time2wait           | number  | Session specific parameter, DefaultTime2Wait (default: 2)
default_time2retain         | number  | Session specific parameter, DefaultTime2Retain (default: 20)
first_burst_length          | number  | Session specific parameter, FirstBurstLength (default: 8192)
immediate_data              | boolean | Session specific parameter, ImmediateData (default: `true`)
error_recovery_level        | number  | Session specific parameter, ErrorRecoveryLevel (default: 0)
allow_duplicated_isid       | boolean | Allow duplicated initiator session ID (default: `false`)
@@ -1800,6 +1801,7 @@ Example request:
  "params": {
    "allow_duplicated_isid": true,
    "default_time2retain": 60,
    "first_burst_length": 8192,
    "immediate_data": true,
    "node_base": "iqn.2016-06.io.spdk",
    "max_sessions": 128,
@@ -1855,6 +1857,7 @@ Example response:
  "result": {
    "allow_duplicated_isid": true,
    "default_time2retain": 60,
    "first_burst_length": 8192,
    "immediate_data": true,
    "node_base": "iqn.2016-06.io.spdk",
    "mutual_chap": false,
+5 −0
Original line number Diff line number Diff line
@@ -63,6 +63,11 @@
  DefaultTime2Wait 2
  DefaultTime2Retain 60

  # Maximum amount in bytes of unsolicited data the iSCSI
  # initiator may send to the target during the execution of
  # a single SCSI command.
  FirstBurstLength 8192

  ImmediateData Yes
  ErrorRecoveryLevel 0

+1 −0
Original line number Diff line number Diff line
@@ -58,6 +58,7 @@ static const struct spdk_json_object_decoder rpc_set_iscsi_opts_decoders[] = {
	{"max_connections_per_session", offsetof(struct spdk_iscsi_opts, MaxConnectionsPerSession), spdk_json_decode_uint32, true},
	{"default_time2wait", offsetof(struct spdk_iscsi_opts, DefaultTime2Wait), spdk_json_decode_uint32, true},
	{"default_time2retain", offsetof(struct spdk_iscsi_opts, DefaultTime2Retain), spdk_json_decode_uint32, true},
	{"first_burst_length", offsetof(struct spdk_iscsi_opts, FirstBurstLength), spdk_json_decode_uint32, true},
	{"immediate_data", offsetof(struct spdk_iscsi_opts, ImmediateData), spdk_json_decode_bool, true},
	{"error_recovery_level", offsetof(struct spdk_iscsi_opts, ErrorRecoveryLevel), spdk_json_decode_uint32, true},
	{"allow_duplicated_isid", offsetof(struct spdk_iscsi_opts, AllowDuplicateIsid), spdk_json_decode_bool, true},
+3 −3
Original line number Diff line number Diff line
@@ -1028,9 +1028,9 @@ spdk_iscsi_check_values(struct spdk_iscsi_conn *conn)
			    conn->sess->MaxBurstLength);
		return -1;
	}
	if (conn->sess->FirstBurstLength > SPDK_ISCSI_FIRST_BURST_LENGTH) {
	if (conn->sess->FirstBurstLength > g_spdk_iscsi.FirstBurstLength) {
		SPDK_ERRLOG("FirstBurstLength(%d) > iSCSI target restriction(%d)\n",
			    conn->sess->FirstBurstLength, SPDK_ISCSI_FIRST_BURST_LENGTH);
			    conn->sess->FirstBurstLength, g_spdk_iscsi.FirstBurstLength);
		return -1;
	}
	if (conn->sess->MaxBurstLength > 0x00ffffff) {
@@ -4384,7 +4384,7 @@ spdk_create_iscsi_sess(struct spdk_iscsi_conn *conn,

	sess->DefaultTime2Wait = g_spdk_iscsi.DefaultTime2Wait;
	sess->DefaultTime2Retain = g_spdk_iscsi.DefaultTime2Retain;
	sess->FirstBurstLength = SPDK_ISCSI_FIRST_BURST_LENGTH;
	sess->FirstBurstLength = g_spdk_iscsi.FirstBurstLength;
	sess->MaxBurstLength = SPDK_ISCSI_MAX_BURST_LENGTH;
	sess->InitialR2T = DEFAULT_INITIALR2T;
	sess->ImmediateData = g_spdk_iscsi.ImmediateData;
+16 −1
Original line number Diff line number Diff line
@@ -46,6 +46,7 @@
#include "iscsi/tgt_node.h"

#include "spdk/assert.h"
#include "spdk/util.h"

#define SPDK_ISCSI_BUILD_ETC "/usr/local/etc/spdk"
#define SPDK_ISCSI_DEFAULT_CONFIG SPDK_ISCSI_BUILD_ETC "/iscsi.conf"
@@ -114,8 +115,20 @@
#define SPDK_ISCSI_MAX_BURST_LENGTH	\
		(SPDK_ISCSI_MAX_RECV_DATA_SEGMENT_LENGTH * MAX_DATA_OUT_PER_CONNECTION)

/*
 * Defines default maximum amount in bytes of unsolicited data the iSCSI
 *  initiator may send to the SPDK iSCSI target during the execution of
 *  a single SCSI command. And it is smaller than the MaxBurstLength.
 */
#define SPDK_ISCSI_FIRST_BURST_LENGTH	8192

/*
 * Defines minimum amount in bytes of unsolicited data the iSCSI initiator
 *  may send to the SPDK iSCSI target during the execution of a single
 *  SCSI command.
 */
#define SPDK_ISCSI_MIN_FIRST_BURST_LENGTH	512

/** Defines how long we should wait for a TCP close after responding to a
 *   logout request, before terminating the connection ourselves.
 */
@@ -280,6 +293,7 @@ struct spdk_iscsi_opts {
	uint32_t MaxQueueDepth;
	uint32_t DefaultTime2Wait;
	uint32_t DefaultTime2Retain;
	uint32_t FirstBurstLength;
	bool ImmediateData;
	uint32_t ErrorRecoveryLevel;
	bool AllowDuplicateIsid;
@@ -308,6 +322,7 @@ struct spdk_iscsi_globals {
	uint32_t MaxQueueDepth;
	uint32_t DefaultTime2Wait;
	uint32_t DefaultTime2Retain;
	uint32_t FirstBurstLength;
	bool ImmediateData;
	uint32_t ErrorRecoveryLevel;
	bool AllowDuplicateIsid;
@@ -412,7 +427,7 @@ spdk_get_immediate_data_buffer_size(void)
	 *  take up much space and we need to make sure the worst-case scenario
	 *  can be satisified by the size returned here.
	 */
	return SPDK_ISCSI_FIRST_BURST_LENGTH +
	return g_spdk_iscsi.FirstBurstLength +
	       ISCSI_DIGEST_LEN + /* data digest */
	       ISCSI_DIGEST_LEN + /* header digest */
	       8 +		   /* bidirectional AHS */
Loading