Slightly polish iSCSI parameters negotiation.
MFC after: 1 week
This commit is contained in:
parent
62722f7d5b
commit
3f9e1172b7
@ -2157,6 +2157,10 @@ iscsi_action_scsiio(struct iscsi_session *is, union ccb *ccb)
|
||||
ISCSI_SESSION_DEBUG(is, "len %zd -> %zd", len, is->is_first_burst_length);
|
||||
len = is->is_first_burst_length;
|
||||
}
|
||||
if (len > is->is_max_data_segment_length) {
|
||||
ISCSI_SESSION_DEBUG(is, "len %zd -> %zd", len, is->is_max_data_segment_length);
|
||||
len = is->is_max_data_segment_length;
|
||||
}
|
||||
|
||||
error = icl_pdu_append_data(request, csio->data_ptr, len, M_NOWAIT);
|
||||
if (error != 0) {
|
||||
|
@ -558,7 +558,7 @@ login_negotiate_key(struct pdu *request, const char *name,
|
||||
tmp = MAX_DATA_SEGMENT_LENGTH;
|
||||
}
|
||||
conn->conn_max_data_segment_length = tmp;
|
||||
keys_add_int(response_keys, name, tmp);
|
||||
keys_add_int(response_keys, name, MAX_DATA_SEGMENT_LENGTH);
|
||||
} else if (strcmp(name, "MaxBurstLength") == 0) {
|
||||
tmp = strtoul(value, NULL, 10);
|
||||
if (tmp <= 0) {
|
||||
|
@ -388,6 +388,11 @@ login_negotiate_key(struct connection *conn, const char *name,
|
||||
if (tmp <= 0)
|
||||
log_errx(1, "received invalid "
|
||||
"MaxRecvDataSegmentLength");
|
||||
if (tmp > ISCSI_MAX_DATA_SEGMENT_LENGTH) {
|
||||
log_debugx("capping MaxRecvDataSegmentLength "
|
||||
"from %d to %d", tmp, ISCSI_MAX_DATA_SEGMENT_LENGTH);
|
||||
tmp = ISCSI_MAX_DATA_SEGMENT_LENGTH;
|
||||
}
|
||||
conn->conn_max_data_segment_length = tmp;
|
||||
} else if (strcmp(name, "MaxBurstLength") == 0) {
|
||||
if (conn->conn_immediate_data) {
|
||||
@ -451,10 +456,11 @@ login_negotiate(struct connection *conn)
|
||||
|
||||
keys_add(request_keys, "ImmediateData", "Yes");
|
||||
keys_add_int(request_keys, "MaxBurstLength",
|
||||
ISCSI_MAX_DATA_SEGMENT_LENGTH);
|
||||
2 * ISCSI_MAX_DATA_SEGMENT_LENGTH);
|
||||
keys_add_int(request_keys, "FirstBurstLength",
|
||||
ISCSI_MAX_DATA_SEGMENT_LENGTH);
|
||||
keys_add(request_keys, "InitialR2T", "Yes");
|
||||
keys_add(request_keys, "MaxOutstandingR2T", "1");
|
||||
} else {
|
||||
keys_add(request_keys, "HeaderDigest", "None");
|
||||
keys_add(request_keys, "DataDigest", "None");
|
||||
@ -465,7 +471,6 @@ login_negotiate(struct connection *conn)
|
||||
keys_add(request_keys, "DefaultTime2Wait", "0");
|
||||
keys_add(request_keys, "DefaultTime2Retain", "0");
|
||||
keys_add(request_keys, "ErrorRecoveryLevel", "0");
|
||||
keys_add(request_keys, "MaxOutstandingR2T", "1");
|
||||
keys_save(request_keys, request);
|
||||
keys_delete(request_keys);
|
||||
request_keys = NULL;
|
||||
|
Loading…
Reference in New Issue
Block a user