From 83a48901580ef8f774f23cf663948fc090935c42 Mon Sep 17 00:00:00 2001 From: Shuhei Matsumoto Date: Tue, 8 Oct 2019 16:44:43 +0900 Subject: [PATCH] lib/iscsi: Remove iscsi_check_data_segment_length() iscsi_check_data_segment_length() is NOP now and can be removed. Signed-off-by: Shuhei Matsumoto Change-Id: I3ba473c2989d1adf7f0fcbaef026f0b60bc1beb7 Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/470726 Tested-by: SPDK CI Jenkins Reviewed-by: Jim Harris Reviewed-by: Ben Walker Reviewed-by: Paul Luse Reviewed-by: Changpeng Liu --- lib/iscsi/iscsi.c | 33 +++------------------------------ 1 file changed, 3 insertions(+), 30 deletions(-) diff --git a/lib/iscsi/iscsi.c b/lib/iscsi/iscsi.c index fc95d308ec..d19f901327 100644 --- a/lib/iscsi/iscsi.c +++ b/lib/iscsi/iscsi.c @@ -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);