lib/iscsi: Add a helper function iscsi_conn_params_update
Purpose: To reduce the duplicated code. Signed-off-by: Ziye Yang <ziye.yang@intel.com> Change-Id: I6f6e79af602281ed50fa0fde7651238065c9bd31 Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/482291 Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Community-CI: SPDK CI Jenkins <sys_sgci@intel.com> Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
parent
b03612bf4d
commit
67067ea4de
@ -1096,6 +1096,33 @@ iscsi_check_values(struct spdk_iscsi_conn *conn)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
iscsi_conn_params_update(struct spdk_iscsi_conn *conn)
|
||||||
|
{
|
||||||
|
int rc;
|
||||||
|
|
||||||
|
/* update internal variables */
|
||||||
|
rc = spdk_iscsi_copy_param2var(conn);
|
||||||
|
if (rc < 0) {
|
||||||
|
SPDK_ERRLOG("spdk_iscsi_copy_param2var() failed\n");
|
||||||
|
if (conn->state < ISCSI_CONN_STATE_EXITING) {
|
||||||
|
conn->state = ISCSI_CONN_STATE_EXITING;
|
||||||
|
}
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* check value */
|
||||||
|
rc = iscsi_check_values(conn);
|
||||||
|
if (rc < 0) {
|
||||||
|
SPDK_ERRLOG("iscsi_check_values() failed\n");
|
||||||
|
if (conn->state < ISCSI_CONN_STATE_EXITING) {
|
||||||
|
conn->state = ISCSI_CONN_STATE_EXITING;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The response function of spdk_iscsi_op_login
|
* The response function of spdk_iscsi_op_login
|
||||||
* return:
|
* return:
|
||||||
@ -1107,7 +1134,6 @@ iscsi_op_login_response(struct spdk_iscsi_conn *conn,
|
|||||||
struct spdk_iscsi_pdu *rsp_pdu, struct iscsi_param *params)
|
struct spdk_iscsi_pdu *rsp_pdu, struct iscsi_param *params)
|
||||||
{
|
{
|
||||||
struct iscsi_bhs_login_rsp *rsph;
|
struct iscsi_bhs_login_rsp *rsph;
|
||||||
int rc;
|
|
||||||
|
|
||||||
rsph = (struct iscsi_bhs_login_rsp *)&rsp_pdu->bhs;
|
rsph = (struct iscsi_bhs_login_rsp *)&rsp_pdu->bhs;
|
||||||
rsph->version_max = ISCSI_VERSION;
|
rsph->version_max = ISCSI_VERSION;
|
||||||
@ -1140,18 +1166,7 @@ iscsi_op_login_response(struct spdk_iscsi_conn *conn,
|
|||||||
|
|
||||||
/* after send PDU digest on/off */
|
/* after send PDU digest on/off */
|
||||||
if (conn->full_feature) {
|
if (conn->full_feature) {
|
||||||
/* update internal variables */
|
return iscsi_conn_params_update(conn);
|
||||||
rc = spdk_iscsi_copy_param2var(conn);
|
|
||||||
if (rc < 0) {
|
|
||||||
SPDK_ERRLOG("spdk_iscsi_copy_param2var() failed\n");
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
/* check value */
|
|
||||||
rc = iscsi_check_values(conn);
|
|
||||||
if (rc < 0) {
|
|
||||||
SPDK_ERRLOG("iscsi_check_values() failed\n");
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@ -2283,26 +2298,8 @@ static void
|
|||||||
spdk_iscsi_conn_text_pdu_complete(void *arg)
|
spdk_iscsi_conn_text_pdu_complete(void *arg)
|
||||||
{
|
{
|
||||||
struct spdk_iscsi_conn *conn = arg;
|
struct spdk_iscsi_conn *conn = arg;
|
||||||
int rc;
|
|
||||||
|
|
||||||
/* update internal variables */
|
iscsi_conn_params_update(conn);
|
||||||
rc = spdk_iscsi_copy_param2var(conn);
|
|
||||||
if (rc < 0) {
|
|
||||||
SPDK_ERRLOG("spdk_iscsi_copy_param2var() failed\n");
|
|
||||||
if (conn->state < ISCSI_CONN_STATE_EXITING) {
|
|
||||||
conn->state = ISCSI_CONN_STATE_EXITING;
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* check value */
|
|
||||||
rc = iscsi_check_values(conn);
|
|
||||||
if (rc < 0) {
|
|
||||||
SPDK_ERRLOG("iscsi_check_values() failed\n");
|
|
||||||
if (conn->state < ISCSI_CONN_STATE_EXITING) {
|
|
||||||
conn->state = ISCSI_CONN_STATE_EXITING;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
Loading…
Reference in New Issue
Block a user