From 8f3fa385b75c556b6cdf9e692f15b25dab34bb9f Mon Sep 17 00:00:00 2001 From: Shuhei Matsumoto Date: Thu, 10 Oct 2019 14:13:49 +0900 Subject: [PATCH] lib/iscsi: Add a flag to struct spdk_iscsi_pdu to know if it is rejected The subsequent patches will separate PDU header handling and PDU payload handling. But for the PDUs which have data segment, if PDU header is correct, we have to read data segment even if any other error is found and the PDU is rejected. To do that, add a flag is_rejected to pass if the PDU is rejected or not from PDU header handling to PDU payload handling. If PDU payload handling sees the PDU is already relected, do nothing. Signed-off-by: Shuhei Matsumoto Change-Id: Ie3fe518fc0f452da9965a2fe3642568c86866480 Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/471005 Tested-by: SPDK CI Jenkins Reviewed-by: Ben Walker Reviewed-by: Changpeng Liu Reviewed-by: Jim Harris --- lib/iscsi/iscsi.c | 2 ++ lib/iscsi/iscsi.h | 1 + 2 files changed, 3 insertions(+) diff --git a/lib/iscsi/iscsi.c b/lib/iscsi/iscsi.c index 079f94b35..b434a4a3e 100644 --- a/lib/iscsi/iscsi.c +++ b/lib/iscsi/iscsi.c @@ -250,6 +250,8 @@ iscsi_reject(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu, int data_len; int alloc_len; + pdu->is_rejected = true; + total_ahs_len = pdu->bhs.total_ahs_len; data_len = 0; alloc_len = ISCSI_BHS_LEN + (4 * total_ahs_len); diff --git a/lib/iscsi/iscsi.h b/lib/iscsi/iscsi.h index 7de2ddb0a..863fa434e 100644 --- a/lib/iscsi/iscsi.h +++ b/lib/iscsi/iscsi.h @@ -164,6 +164,7 @@ struct spdk_mobj { struct spdk_iscsi_pdu { struct iscsi_bhs bhs; struct spdk_mobj *mobj; + bool is_rejected; uint8_t *data_buf; uint8_t *data; uint8_t header_digest[ISCSI_DIGEST_LEN];