lib/iscsi: Use rsp_pdu->data_buf_len in iscsi_op_login_phase_none()

Use rsp_pdu->data_buf_len in iscsi_op_login_phase_none() and its
calling functions.

This makes the code a little clearer.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Id9c1f01bdfa95e8a2e9f6512777341334cb621e0
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/471469
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
Shuhei Matsumoto 2019-10-16 17:12:11 +09:00 committed by Jim Harris
parent 2d1e009679
commit 49f0d6192a

View File

@ -1633,8 +1633,7 @@ iscsi_op_login_set_conn_info(struct spdk_iscsi_conn *conn,
static int
iscsi_op_login_set_target_info(struct spdk_iscsi_conn *conn,
struct spdk_iscsi_pdu *rsp_pdu,
enum session_type session_type,
int alloc_len)
enum session_type session_type)
{
char buf[MAX_TMPBUF];
const char *val;
@ -1677,20 +1676,20 @@ iscsi_op_login_set_target_info(struct spdk_iscsi_conn *conn,
rsp_pdu->data_segment_len = iscsi_append_param(conn,
"TargetAlias",
rsp_pdu->data,
alloc_len,
rsp_pdu->data_buf_len,
rsp_pdu->data_segment_len);
}
if (session_type == SESSION_TYPE_DISCOVERY) {
rsp_pdu->data_segment_len = iscsi_append_param(conn,
"TargetAddress",
rsp_pdu->data,
alloc_len,
rsp_pdu->data_buf_len,
rsp_pdu->data_segment_len);
}
rsp_pdu->data_segment_len = iscsi_append_param(conn,
"TargetPortalGroupTag",
rsp_pdu->data,
alloc_len,
rsp_pdu->data_buf_len,
rsp_pdu->data_segment_len);
}
@ -1708,8 +1707,7 @@ iscsi_op_login_set_target_info(struct spdk_iscsi_conn *conn,
static int
iscsi_op_login_phase_none(struct spdk_iscsi_conn *conn,
struct spdk_iscsi_pdu *rsp_pdu,
struct iscsi_param *params,
int alloc_len, int cid)
struct iscsi_param *params, int cid)
{
enum session_type session_type;
char initiator_port_name[MAX_INITIATOR_PORT_NAME];
@ -1776,8 +1774,7 @@ iscsi_op_login_phase_none(struct spdk_iscsi_conn *conn,
}
}
return iscsi_op_login_set_target_info(conn, rsp_pdu, session_type,
alloc_len);
return iscsi_op_login_set_target_info(conn, rsp_pdu, session_type);
}
/*
@ -2203,8 +2200,7 @@ iscsi_op_login(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu)
}
if (conn->state == ISCSI_CONN_STATE_INVALID) {
rc = iscsi_op_login_phase_none(conn, rsp_pdu, params,
rsp_pdu->data_buf_len, cid);
rc = iscsi_op_login_phase_none(conn, rsp_pdu, params, cid);
if (rc == SPDK_ISCSI_LOGIN_ERROR_RESPONSE || rc == SPDK_ISCSI_LOGIN_ERROR_PARAMETER) {
iscsi_op_login_response(conn, rsp_pdu, params);
return rc;