From 19687a55251034b55db3078e992ed824ed7e9f29 Mon Sep 17 00:00:00 2001 From: Shuhei Matsumoto Date: Wed, 16 Oct 2019 17:25:12 +0900 Subject: [PATCH] lib/iscsi: Get connection ID closer to location to use for login cid had been got in iscsi_op_login_rsp_init() but it was not intuitive. Get cid in iscsi_op_login() and pass it simply to iscsi_op_login_phase_none(). Signed-off-by: Shuhei Matsumoto Change-Id: Ief7b865784aa72f7872b6e4a98809dbab49807de Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/471471 Tested-by: SPDK CI Jenkins Reviewed-by: Changpeng Liu Reviewed-by: Ben Walker Reviewed-by: Ziye Yang Reviewed-by: Jim Harris --- lib/iscsi/iscsi.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/iscsi/iscsi.c b/lib/iscsi/iscsi.c index 950ed74af..44bb5e0ff 100644 --- a/lib/iscsi/iscsi.c +++ b/lib/iscsi/iscsi.c @@ -1786,8 +1786,7 @@ iscsi_op_login_phase_none(struct spdk_iscsi_conn *conn, */ static int iscsi_op_login_rsp_init(struct spdk_iscsi_conn *conn, - struct spdk_iscsi_pdu *pdu, struct spdk_iscsi_pdu *rsp_pdu, - int *cid) + struct spdk_iscsi_pdu *pdu, struct spdk_iscsi_pdu *rsp_pdu) { struct iscsi_bhs_login_req *reqh; struct iscsi_bhs_login_rsp *rsph; @@ -1828,7 +1827,6 @@ iscsi_op_login_rsp_init(struct spdk_iscsi_conn *conn, rsph->tsih = reqh->tsih; rsph->itt = reqh->itt; rsp_pdu->cmd_sn = from_be32(&reqh->cmd_sn); - *cid = from_be16(&reqh->cid); if (rsph->tsih) { rsph->stat_sn = reqh->exp_stat_sn; @@ -2174,6 +2172,7 @@ iscsi_op_login(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu) reqh = (struct iscsi_bhs_login_req *)&pdu->bhs; pdu->cmd_sn = from_be32(&reqh->cmd_sn); + cid = from_be16(&reqh->cid); /* During login processing, use the 8KB default FirstBurstLength as * our maximum data segment length value. @@ -2186,7 +2185,7 @@ iscsi_op_login(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu) if (rsp_pdu == NULL) { return SPDK_ISCSI_CONNECTION_FATAL; } - rc = iscsi_op_login_rsp_init(conn, pdu, rsp_pdu, &cid); + rc = iscsi_op_login_rsp_init(conn, pdu, rsp_pdu); if (rc < 0) { iscsi_op_login_response(conn, rsp_pdu, NULL); return rc;