Add negotiation of MaxOutstandingR2T and ErrorRecoveryLevel during login phase
This commit is contained in:
52
lib/login.c
52
lib/login.c
@@ -348,6 +348,46 @@ iscsi_login_add_defaulttime2retain(struct iscsi_context *iscsi, struct iscsi_pdu
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
iscsi_login_add_maxoutstandingr2t(struct iscsi_context *iscsi, struct iscsi_pdu *pdu)
|
||||
{
|
||||
char *str;
|
||||
|
||||
/* We only send MaxOutstandingR2T during opneg */
|
||||
if (iscsi->current_phase != ISCSI_PDU_LOGIN_CSG_OPNEG) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
str = (char *)"MaxOutstandingR2T=1";
|
||||
if (iscsi_pdu_add_data(iscsi, pdu, (unsigned char *)str, strlen(str)+1)
|
||||
!= 0) {
|
||||
iscsi_set_error(iscsi, "Out-of-memory: pdu add data failed.");
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
iscsi_login_add_errorrecoverylevel(struct iscsi_context *iscsi, struct iscsi_pdu *pdu)
|
||||
{
|
||||
char *str;
|
||||
|
||||
/* We only send ErrorRecoveryLevel during opneg */
|
||||
if (iscsi->current_phase != ISCSI_PDU_LOGIN_CSG_OPNEG) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
str = (char *)"ErrorRecoveryLevel=0";
|
||||
if (iscsi_pdu_add_data(iscsi, pdu, (unsigned char *)str, strlen(str)+1)
|
||||
!= 0) {
|
||||
iscsi_set_error(iscsi, "Out-of-memory: pdu add data failed.");
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
iscsi_login_add_datasequenceinorder(struct iscsi_context *iscsi, struct iscsi_pdu *pdu)
|
||||
{
|
||||
@@ -683,6 +723,18 @@ iscsi_login_async(struct iscsi_context *iscsi, iscsi_command_cb cb,
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* max outstanding r2t */
|
||||
if (iscsi_login_add_maxoutstandingr2t(iscsi, pdu) != 0) {
|
||||
iscsi_free_pdu(iscsi, pdu);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* errorrecoverylevel */
|
||||
if (iscsi_login_add_errorrecoverylevel(iscsi, pdu) != 0) {
|
||||
iscsi_free_pdu(iscsi, pdu);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* max recv data segment length */
|
||||
if (iscsi_login_add_maxrecvdatasegmentlength(iscsi, pdu) != 0) {
|
||||
iscsi_free_pdu(iscsi, pdu);
|
||||
|
||||
Reference in New Issue
Block a user