lib/iscsi: Move up iscsi_op_login_check_session in a file

This patch series orders login related functions top down in iscsi.c.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I23ea7101030c6d2d3fbccba878bdf77d89b814cf
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/476415
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 2019-12-01 19:06:59 -05:00 committed by Tomasz Zawadzki
parent d1833a9f52
commit 30235a0b2a

View File

@ -1449,6 +1449,47 @@ iscsi_op_login_check_target(struct spdk_iscsi_conn *conn,
return 0;
}
/*
* This function use to check the session
* return:
* 0, success
* otherwise: error
*/
static int
iscsi_op_login_check_session(struct spdk_iscsi_conn *conn,
struct spdk_iscsi_pdu *rsp_pdu,
char *initiator_port_name, int cid)
{
int rc = 0;
struct iscsi_bhs_login_rsp *rsph;
rsph = (struct iscsi_bhs_login_rsp *)&rsp_pdu->bhs;
/* check existing session */
SPDK_DEBUGLOG(SPDK_LOG_ISCSI, "isid=%"PRIx64", tsih=%u, cid=%u\n",
iscsi_get_isid(rsph->isid), from_be16(&rsph->tsih), cid);
if (rsph->tsih != 0) {
/* multiple connections */
rc = append_iscsi_sess(conn, initiator_port_name,
from_be16(&rsph->tsih), cid);
if (rc != 0) {
SPDK_ERRLOG("isid=%"PRIx64", tsih=%u, cid=%u:"
"spdk_append_iscsi_sess() failed\n",
iscsi_get_isid(rsph->isid), from_be16(&rsph->tsih),
cid);
/* Can't include in session */
rsph->status_class = ISCSI_CLASS_INITIATOR_ERROR;
rsph->status_detail = rc;
return SPDK_ISCSI_LOGIN_ERROR_RESPONSE;
}
} else if (!g_spdk_iscsi.AllowDuplicateIsid) {
/* new session, drop old sess by the initiator */
spdk_iscsi_drop_conns(conn, initiator_port_name, 0 /* drop old */);
}
return rc;
}
/*
* This function is used to del the original param and update it with new
* value
@ -1568,47 +1609,6 @@ iscsi_op_login_negotiate_digest_param(struct spdk_iscsi_conn *conn,
return 0;
}
/*
* This function use to check the session
* return:
* 0, success
* otherwise: error
*/
static int
iscsi_op_login_check_session(struct spdk_iscsi_conn *conn,
struct spdk_iscsi_pdu *rsp_pdu,
char *initiator_port_name, int cid)
{
int rc = 0;
struct iscsi_bhs_login_rsp *rsph;
rsph = (struct iscsi_bhs_login_rsp *)&rsp_pdu->bhs;
/* check existing session */
SPDK_DEBUGLOG(SPDK_LOG_ISCSI, "isid=%"PRIx64", tsih=%u, cid=%u\n",
iscsi_get_isid(rsph->isid), from_be16(&rsph->tsih), cid);
if (rsph->tsih != 0) {
/* multiple connections */
rc = append_iscsi_sess(conn, initiator_port_name,
from_be16(&rsph->tsih), cid);
if (rc != 0) {
SPDK_ERRLOG("isid=%"PRIx64", tsih=%u, cid=%u:"
"spdk_append_iscsi_sess() failed\n",
iscsi_get_isid(rsph->isid), from_be16(&rsph->tsih),
cid);
/* Can't include in session */
rsph->status_class = ISCSI_CLASS_INITIATOR_ERROR;
rsph->status_detail = rc;
return SPDK_ISCSI_LOGIN_ERROR_RESPONSE;
}
} else if (!g_spdk_iscsi.AllowDuplicateIsid) {
/* new session, drop old sess by the initiator */
spdk_iscsi_drop_conns(conn, initiator_port_name, 0 /* drop old */);
}
return rc;
}
/*
* The function which is used to handle the part of normal login session
* return: