lib/iscsi: Move spdk_iscsi_send_nopin() up in the file

Move spdk_iscsi_send_nopin() up to the location just above
iscsi_op_nopout().

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I8792f838ac482d93ae347a355c7964f587e78daf
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/470269
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-10-03 09:29:10 +09:00 committed by Changpeng Liu
parent e1a6f2b70d
commit b422cee886

View File

@ -3988,6 +3988,49 @@ iscsi_op_task(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu)
return 0;
}
void spdk_iscsi_send_nopin(struct spdk_iscsi_conn *conn)
{
struct spdk_iscsi_pdu *rsp_pdu;
struct iscsi_bhs_nop_in *rsp;
/* Only send nopin if we have logged in and are in a normal session. */
if (conn->sess == NULL ||
!conn->full_feature ||
!spdk_iscsi_param_eq_val(conn->sess->params, "SessionType", "Normal")) {
return;
}
SPDK_DEBUGLOG(SPDK_LOG_ISCSI, "send NOPIN isid=%"PRIx64", tsih=%u, cid=%u\n",
conn->sess->isid, conn->sess->tsih, conn->cid);
SPDK_DEBUGLOG(SPDK_LOG_ISCSI, "StatSN=%u, ExpCmdSN=%u, MaxCmdSN=%u\n",
conn->StatSN, conn->sess->ExpCmdSN,
conn->sess->MaxCmdSN);
rsp_pdu = spdk_get_pdu();
rsp = (struct iscsi_bhs_nop_in *) &rsp_pdu->bhs;
rsp_pdu->data = NULL;
/*
* spdk_get_pdu() memset's the PDU for us, so only fill out the needed
* fields.
*/
rsp->opcode = ISCSI_OP_NOPIN;
rsp->flags = 0x80;
/*
* Technically the to_be32() is not needed here, since
* to_be32(0xFFFFFFFU) returns 0xFFFFFFFFU.
*/
to_be32(&rsp->itt, 0xFFFFFFFFU);
to_be32(&rsp->ttt, conn->id);
to_be32(&rsp->stat_sn, conn->StatSN);
to_be32(&rsp->exp_cmd_sn, conn->sess->ExpCmdSN);
to_be32(&rsp->max_cmd_sn, conn->sess->MaxCmdSN);
spdk_iscsi_conn_write_pdu(conn, rsp_pdu);
conn->last_nopin = spdk_get_ticks();
conn->nop_outstanding = true;
}
static int
iscsi_op_nopout(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu)
{
@ -4564,49 +4607,6 @@ reject_return:
return iscsi_reject(conn, pdu, reject_reason);
}
void spdk_iscsi_send_nopin(struct spdk_iscsi_conn *conn)
{
struct spdk_iscsi_pdu *rsp_pdu;
struct iscsi_bhs_nop_in *rsp;
/* Only send nopin if we have logged in and are in a normal session. */
if (conn->sess == NULL ||
!conn->full_feature ||
!spdk_iscsi_param_eq_val(conn->sess->params, "SessionType", "Normal")) {
return;
}
SPDK_DEBUGLOG(SPDK_LOG_ISCSI, "send NOPIN isid=%"PRIx64", tsih=%u, cid=%u\n",
conn->sess->isid, conn->sess->tsih, conn->cid);
SPDK_DEBUGLOG(SPDK_LOG_ISCSI, "StatSN=%u, ExpCmdSN=%u, MaxCmdSN=%u\n",
conn->StatSN, conn->sess->ExpCmdSN,
conn->sess->MaxCmdSN);
rsp_pdu = spdk_get_pdu();
rsp = (struct iscsi_bhs_nop_in *) &rsp_pdu->bhs;
rsp_pdu->data = NULL;
/*
* spdk_get_pdu() memset's the PDU for us, so only fill out the needed
* fields.
*/
rsp->opcode = ISCSI_OP_NOPIN;
rsp->flags = 0x80;
/*
* Technically the to_be32() is not needed here, since
* to_be32(0xFFFFFFFU) returns 0xFFFFFFFFU.
*/
to_be32(&rsp->itt, 0xFFFFFFFFU);
to_be32(&rsp->ttt, conn->id);
to_be32(&rsp->stat_sn, conn->StatSN);
to_be32(&rsp->exp_cmd_sn, conn->sess->ExpCmdSN);
to_be32(&rsp->max_cmd_sn, conn->sess->MaxCmdSN);
spdk_iscsi_conn_write_pdu(conn, rsp_pdu);
conn->last_nopin = spdk_get_ticks();
conn->nop_outstanding = true;
}
static void
init_login_reject_response(struct spdk_iscsi_pdu *pdu, struct spdk_iscsi_pdu *rsp_pdu)
{