From b422cee886c17a38222a020256bc2477796e7102 Mon Sep 17 00:00:00 2001 From: Shuhei Matsumoto Date: Thu, 3 Oct 2019 09:29:10 +0900 Subject: [PATCH] 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 Change-Id: I8792f838ac482d93ae347a355c7964f587e78daf Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/470269 Tested-by: SPDK CI Jenkins Reviewed-by: Changpeng Liu Reviewed-by: Jim Harris --- lib/iscsi/iscsi.c | 86 +++++++++++++++++++++++------------------------ 1 file changed, 43 insertions(+), 43 deletions(-) diff --git a/lib/iscsi/iscsi.c b/lib/iscsi/iscsi.c index fc17a0310c..e72b16c658 100644 --- a/lib/iscsi/iscsi.c +++ b/lib/iscsi/iscsi.c @@ -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) {