Commit 18609b02 authored by Shuhei Matsumoto's avatar Shuhei Matsumoto Committed by Tomasz Zawadzki
Browse files

lib/iscsi: Move down iscsi_get_pdu_length() in a file



Move iscsi_get_pdu_length() down closer to the caller.

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


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: SPDK 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>
parent 3a58b2fb
Loading
Loading
Loading
Loading
+30 −30
Original line number Diff line number Diff line
@@ -1197,36 +1197,6 @@ spdk_iscsi_task_cpl(struct spdk_scsi_task *scsi_task)
	}
}

static int
iscsi_get_pdu_length(struct spdk_iscsi_pdu *pdu, int header_digest,
		     int data_digest)
{
	int data_len, enable_digest, total;

	enable_digest = 1;
	if (pdu->bhs.opcode == ISCSI_OP_LOGIN_RSP) {
		enable_digest = 0;
	}

	total = ISCSI_BHS_LEN;

	total += (4 * pdu->bhs.total_ahs_len);

	if (enable_digest && header_digest) {
		total += ISCSI_DIGEST_LEN;
	}

	data_len = DGET24(pdu->bhs.data_segment_len);
	if (data_len > 0) {
		total += ISCSI_ALIGN(data_len);
		if (enable_digest && data_digest) {
			total += ISCSI_DIGEST_LEN;
		}
	}

	return total;
}

static void
iscsi_conn_send_nopin(struct spdk_iscsi_conn *conn)
{
@@ -1296,6 +1266,36 @@ spdk_iscsi_conn_handle_nop(struct spdk_iscsi_conn *conn)
	}
}

static int
iscsi_get_pdu_length(struct spdk_iscsi_pdu *pdu, int header_digest,
		     int data_digest)
{
	int data_len, enable_digest, total;

	enable_digest = 1;
	if (pdu->bhs.opcode == ISCSI_OP_LOGIN_RSP) {
		enable_digest = 0;
	}

	total = ISCSI_BHS_LEN;

	total += (4 * pdu->bhs.total_ahs_len);

	if (enable_digest && header_digest) {
		total += ISCSI_DIGEST_LEN;
	}

	data_len = DGET24(pdu->bhs.data_segment_len);
	if (data_len > 0) {
		total += ISCSI_ALIGN(data_len);
		if (enable_digest && data_digest) {
			total += ISCSI_DIGEST_LEN;
		}
	}

	return total;
}

static bool
iscsi_is_free_pdu_deferred(struct spdk_iscsi_pdu *pdu)
{