Commit 83a48901 authored by Shuhei Matsumoto's avatar Shuhei Matsumoto Committed by Changpeng Liu
Browse files

lib/iscsi: Remove iscsi_check_data_segment_length()



iscsi_check_data_segment_length() is NOP now and can be removed.

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


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-by: default avatarPaul Luse <paul.e.luse@intel.com>
Reviewed-by: default avatarChangpeng Liu <changpeng.liu@intel.com>
parent 4427cac6
Loading
Loading
Loading
Loading
+3 −30
Original line number Diff line number Diff line
@@ -372,13 +372,6 @@ spdk_iscsi_pdu_calc_data_digest(struct spdk_iscsi_pdu *pdu)
	return crc32c;
}

static bool
iscsi_check_data_segment_length(struct spdk_iscsi_conn *conn,
				struct spdk_iscsi_pdu *pdu, int data_len)
{
	return true;
}

static int
iscsi_conn_read_data_segment(struct spdk_iscsi_conn *conn,
			     struct spdk_iscsi_pdu *pdu,
@@ -4698,6 +4691,9 @@ spdk_iscsi_read_pdu(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu **_pdu)
			return 0;
		}
		pdu->data_buf = pdu->mobj->buf;
		pdu->data = pdu->mobj->buf;
		pdu->data_from_mempool = true;
		pdu->data_segment_len = data_len;

		if (spdk_unlikely(spdk_iscsi_get_dif_ctx(conn, pdu, &pdu->dif_ctx))) {
			pdu->dif_insert_or_strip = true;
@@ -4739,29 +4735,6 @@ spdk_iscsi_read_pdu(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu **_pdu)
	spdk_trace_record(TRACE_ISCSI_READ_PDU, conn->id, pdu->data_valid_bytes,
			  (uintptr_t)pdu, pdu->bhs.opcode);

	/* Data Segment */
	if (data_len != 0) {
		if (!iscsi_check_data_segment_length(conn, pdu, data_len)) {
			rc = iscsi_reject(conn, pdu, ISCSI_REASON_PROTOCOL_ERROR);
			/*
			 * If spdk_iscsi_reject() was not able to reject the PDU,
			 * treat it as a fatal connection error.  Otherwise,
			 * return SUCCESS here so that the caller will continue
			 * to attempt to read PDUs.
			 */
			if (rc == 0) {
				spdk_put_pdu(pdu);
				return 0;
			} else {
				goto error;
			}
		}

		pdu->data = pdu->data_buf;
		pdu->data_from_mempool = true;
		pdu->data_segment_len = data_len;
	}

	/* check digest */
	if (conn->header_digest) {
		crc32c = spdk_iscsi_pdu_calc_header_digest(pdu);