lib/iscsi: Add MaxR2TPerConnection to iSCSI options

Add MaxR2TPerConnection to iSCSI global options and make it configurable
by JSON RPC.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Ida95e5c7dac301a22520656709e1aa4d611f31ef
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/3777
Community-CI: Broadcom CI
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
Shuhei Matsumoto 2020-08-14 10:26:31 +09:00 committed by Tomasz Zawadzki
parent 5af42000c1
commit 05cd697757
7 changed files with 24 additions and 4 deletions

View File

@ -2978,6 +2978,7 @@ immediate_data | Optional | boolean | Session specific paramete
error_recovery_level | Optional | number | Session specific parameter, ErrorRecoveryLevel (default: 0)
allow_duplicated_isid | Optional | boolean | Allow duplicated initiator session ID (default: `false`)
max_large_datain_per_connection | Optional | number | Max number of outstanding split read I/Os per connection (default: 64)
max_r2t_per_connection | Optional | number | Max number of outstanding R2Ts per connection (default: 4)
To load CHAP shared secret file, its path is required to specify explicitly in the parameter `auth_file`.
@ -3063,7 +3064,8 @@ Example response:
"disable_chap": true,
"default_time2wait": 2,
"require_chap": false,
"max_large_datain_per_connection": 64
"max_large_datain_per_connection": 64,
"max_r2t_per_connection": 4
}
}
~~~

View File

@ -321,6 +321,7 @@ struct spdk_iscsi_opts {
uint32_t ErrorRecoveryLevel;
bool AllowDuplicateIsid;
uint32_t MaxLargeDataInPerConnection;
uint32_t MaxR2TPerConnection;
};
struct spdk_iscsi_globals {

View File

@ -1717,6 +1717,7 @@ static const struct spdk_json_object_decoder rpc_set_iscsi_opts_decoders[] = {
{"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},
{"max_large_datain_per_connection", offsetof(struct spdk_iscsi_opts, MaxLargeDataInPerConnection), spdk_json_decode_uint32, true},
{"max_r2t_per_connection", offsetof(struct spdk_iscsi_opts, MaxR2TPerConnection), spdk_json_decode_uint32, true},
};
static void

View File

@ -407,6 +407,7 @@ iscsi_opts_init(struct spdk_iscsi_opts *opts)
opts->authfile = NULL;
opts->nodebase = NULL;
opts->MaxLargeDataInPerConnection = DEFAULT_MAX_LARGE_DATAIN_PER_CONNECTION;
opts->MaxR2TPerConnection = DEFAULT_MAXR2T;
}
struct spdk_iscsi_opts *
@ -480,6 +481,7 @@ iscsi_opts_copy(struct spdk_iscsi_opts *src)
dst->mutual_chap = src->mutual_chap;
dst->chap_group = src->chap_group;
dst->MaxLargeDataInPerConnection = src->MaxLargeDataInPerConnection;
dst->MaxR2TPerConnection = src->MaxR2TPerConnection;
return dst;
}
@ -709,6 +711,11 @@ iscsi_opts_verify(struct spdk_iscsi_opts *opts)
return -EINVAL;
}
if (opts->MaxR2TPerConnection == 0) {
SPDK_ERRLOG("0 is invalid. MaxR2TPerConnection must be more than 0\n");
return -EINVAL;
}
return 0;
}
@ -783,7 +790,7 @@ iscsi_set_global_params(struct spdk_iscsi_opts *opts)
g_iscsi.mutual_chap = opts->mutual_chap;
g_iscsi.chap_group = opts->chap_group;
g_iscsi.MaxLargeDataInPerConnection = opts->MaxLargeDataInPerConnection;
g_iscsi.MaxR2TPerConnection = DEFAULT_MAXR2T;
g_iscsi.MaxR2TPerConnection = opts->MaxR2TPerConnection;
iscsi_log_globals();
@ -1502,6 +1509,8 @@ iscsi_opts_info_json(struct spdk_json_write_ctx *w)
spdk_json_write_named_uint32(w, "max_large_datain_per_connection",
g_iscsi.MaxLargeDataInPerConnection);
spdk_json_write_named_uint32(w, "max_r2t_per_connection",
g_iscsi.MaxR2TPerConnection);
spdk_json_write_object_end(w);
}

View File

@ -853,7 +853,8 @@ if __name__ == "__main__":
immediate_data=args.immediate_data,
error_recovery_level=args.error_recovery_level,
allow_duplicated_isid=args.allow_duplicated_isid,
max_large_datain_per_connection=args.max_large_datain_per_connection)
max_large_datain_per_connection=args.max_large_datain_per_connection,
max_r2t_per_connection=args.max_r2t_per_connection)
p = subparsers.add_parser('iscsi_set_options', aliases=['set_iscsi_options'],
help="""Set options of iSCSI subsystem""")
@ -878,6 +879,7 @@ if __name__ == "__main__":
p.add_argument('-l', '--error-recovery-level', help='Negotiated parameter, ErrorRecoveryLevel', type=int)
p.add_argument('-p', '--allow-duplicated-isid', help='Allow duplicated initiator session ID.', action='store_true')
p.add_argument('-x', '--max-large-datain-per-connection', help='Max number of outstanding split read I/Os per connection', type=int)
p.add_argument('-k', '--max-r2t-per-connection', help='Max number of outstanding R2Ts per connection', type=int)
p.set_defaults(func=iscsi_set_options)
def iscsi_set_discovery_auth(args):

View File

@ -21,7 +21,8 @@ def iscsi_set_options(
immediate_data=None,
error_recovery_level=None,
allow_duplicated_isid=None,
max_large_datain_per_connection=None):
max_large_datain_per_connection=None,
max_r2t_per_connection=None):
"""Set iSCSI target options.
Args:
@ -43,6 +44,7 @@ def iscsi_set_options(
error_recovery_level: Negotiated parameter, ErrorRecoveryLevel
allow_duplicated_isid: Allow duplicated initiator session ID
max_large_datain_per_connection: Max number of outstanding split read I/Os per connection (optional)
max_r2t_per_connection: Max number of outstanding R2Ts per connection (optional)
Returns:
True or False
@ -85,6 +87,8 @@ def iscsi_set_options(
params['allow_duplicated_isid'] = allow_duplicated_isid
if max_large_datain_per_connection:
params['max_large_datain_per_connection'] = max_large_datain_per_connection
if max_r2t_per_connection:
params['max_r2t_per_connection'] = max_r2t_per_connection
return client.call('iscsi_set_options', params)

View File

@ -18,6 +18,7 @@ o- iscsi .......................................................................
| o- max_connections_per_session: 2 ........................................................................................ [...]
| o- max_large_datain_per_connection: 64 ................................................................................... [...]
| o- max_queue_depth: 64 ................................................................................................... [...]
| o- max_r2t_per_connection: 4 ............................................................................................. [...]
| o- max_sessions: 128 ..................................................................................................... [...]
| o- mutual_chap: False .................................................................................................... [...]
| o- node_base: iqn.2016-06.io.spdk ........................................................................................ [...]