Commit 19687a55 authored by Shuhei Matsumoto's avatar Shuhei Matsumoto Committed by Jim Harris
Browse files

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: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Ief7b865784aa72f7872b6e4a98809dbab49807de
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/471471


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarChangpeng Liu <changpeng.liu@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-by: default avatarZiye Yang <ziye.yang@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
parent 7015e6b5
Loading
Loading
Loading
Loading
+3 −4
Original line number Diff line number Diff line
@@ -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;