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:
parent
2d1e009679
commit
49f0d6192a
@ -1633,8 +1633,7 @@ iscsi_op_login_set_conn_info(struct spdk_iscsi_conn *conn,
|
|||||||
static int
|
static int
|
||||||
iscsi_op_login_set_target_info(struct spdk_iscsi_conn *conn,
|
iscsi_op_login_set_target_info(struct spdk_iscsi_conn *conn,
|
||||||
struct spdk_iscsi_pdu *rsp_pdu,
|
struct spdk_iscsi_pdu *rsp_pdu,
|
||||||
enum session_type session_type,
|
enum session_type session_type)
|
||||||
int alloc_len)
|
|
||||||
{
|
{
|
||||||
char buf[MAX_TMPBUF];
|
char buf[MAX_TMPBUF];
|
||||||
const char *val;
|
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,
|
rsp_pdu->data_segment_len = iscsi_append_param(conn,
|
||||||
"TargetAlias",
|
"TargetAlias",
|
||||||
rsp_pdu->data,
|
rsp_pdu->data,
|
||||||
alloc_len,
|
rsp_pdu->data_buf_len,
|
||||||
rsp_pdu->data_segment_len);
|
rsp_pdu->data_segment_len);
|
||||||
}
|
}
|
||||||
if (session_type == SESSION_TYPE_DISCOVERY) {
|
if (session_type == SESSION_TYPE_DISCOVERY) {
|
||||||
rsp_pdu->data_segment_len = iscsi_append_param(conn,
|
rsp_pdu->data_segment_len = iscsi_append_param(conn,
|
||||||
"TargetAddress",
|
"TargetAddress",
|
||||||
rsp_pdu->data,
|
rsp_pdu->data,
|
||||||
alloc_len,
|
rsp_pdu->data_buf_len,
|
||||||
rsp_pdu->data_segment_len);
|
rsp_pdu->data_segment_len);
|
||||||
}
|
}
|
||||||
rsp_pdu->data_segment_len = iscsi_append_param(conn,
|
rsp_pdu->data_segment_len = iscsi_append_param(conn,
|
||||||
"TargetPortalGroupTag",
|
"TargetPortalGroupTag",
|
||||||
rsp_pdu->data,
|
rsp_pdu->data,
|
||||||
alloc_len,
|
rsp_pdu->data_buf_len,
|
||||||
rsp_pdu->data_segment_len);
|
rsp_pdu->data_segment_len);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1708,8 +1707,7 @@ iscsi_op_login_set_target_info(struct spdk_iscsi_conn *conn,
|
|||||||
static int
|
static int
|
||||||
iscsi_op_login_phase_none(struct spdk_iscsi_conn *conn,
|
iscsi_op_login_phase_none(struct spdk_iscsi_conn *conn,
|
||||||
struct spdk_iscsi_pdu *rsp_pdu,
|
struct spdk_iscsi_pdu *rsp_pdu,
|
||||||
struct iscsi_param *params,
|
struct iscsi_param *params, int cid)
|
||||||
int alloc_len, int cid)
|
|
||||||
{
|
{
|
||||||
enum session_type session_type;
|
enum session_type session_type;
|
||||||
char initiator_port_name[MAX_INITIATOR_PORT_NAME];
|
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,
|
return iscsi_op_login_set_target_info(conn, rsp_pdu, session_type);
|
||||||
alloc_len);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -2203,8 +2200,7 @@ iscsi_op_login(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (conn->state == ISCSI_CONN_STATE_INVALID) {
|
if (conn->state == ISCSI_CONN_STATE_INVALID) {
|
||||||
rc = iscsi_op_login_phase_none(conn, rsp_pdu, params,
|
rc = iscsi_op_login_phase_none(conn, rsp_pdu, params, cid);
|
||||||
rsp_pdu->data_buf_len, cid);
|
|
||||||
if (rc == SPDK_ISCSI_LOGIN_ERROR_RESPONSE || rc == SPDK_ISCSI_LOGIN_ERROR_PARAMETER) {
|
if (rc == SPDK_ISCSI_LOGIN_ERROR_RESPONSE || rc == SPDK_ISCSI_LOGIN_ERROR_PARAMETER) {
|
||||||
iscsi_op_login_response(conn, rsp_pdu, params);
|
iscsi_op_login_response(conn, rsp_pdu, params);
|
||||||
return rc;
|
return rc;
|
||||||
|
Loading…
Reference in New Issue
Block a user