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

lib/iscsi: Separate PDU header and payload handling for Login Request



Separate PDU header and payload handling for Login Request PDU.
This will clarify the header handling and payload handling.

Especially store the allocated and initialized response PDU to
the current connection and refer it later. This idea is as same as
iSCSI task and will work because login processing is synchronous
and only once per connection.

Signed-off-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I7e0eb413ee5f759724a685b83a742515a3546780
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/471472


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarChangpeng Liu <changpeng.liu@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
parent 19687a55
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -103,6 +103,7 @@ struct spdk_iscsi_conn {
	enum iscsi_connection_state	state;
	int				login_phase;
	bool				is_logged_out;
	struct spdk_iscsi_pdu		*login_rsp_pdu;

	uint64_t	last_flush;
	uint64_t	last_fill;
+24 −4
Original line number Diff line number Diff line
@@ -2157,13 +2157,11 @@ iscsi_op_login_rsp_handle(struct spdk_iscsi_conn *conn,
}

static int
iscsi_op_login(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu)
iscsi_pdu_hdr_op_login(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu)
{
	int rc;
	struct iscsi_bhs_login_req *reqh;
	struct spdk_iscsi_pdu *rsp_pdu;
	struct iscsi_param *params = NULL;
	int cid;

	if (conn->full_feature && conn->sess != NULL &&
	    conn->sess->session_type == SESSION_TYPE_DISCOVERY) {
@@ -2172,7 +2170,6 @@ 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.
@@ -2191,6 +2188,29 @@ iscsi_op_login(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu)
		return rc;
	}

	conn->login_rsp_pdu = rsp_pdu;
	return 0;
}

static int
iscsi_op_login(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu)
{
	int rc;
	struct iscsi_bhs_login_req *reqh;
	struct spdk_iscsi_pdu *rsp_pdu;
	struct iscsi_param *params = NULL;
	int cid;

	rc = iscsi_pdu_hdr_op_login(conn, pdu);
	if (rc != 0 || pdu->is_rejected || conn->login_rsp_pdu == NULL) {
		return rc;
	}

	rsp_pdu = conn->login_rsp_pdu;

	reqh = (struct iscsi_bhs_login_req *)&pdu->bhs;
	cid = from_be16(&reqh->cid);

	rc = iscsi_op_login_store_incoming_params(conn, pdu, rsp_pdu, &params);
	if (rc < 0) {
		iscsi_op_login_response(conn, rsp_pdu, NULL);