From da7c1c4b0a4a857abd9f9ed066cad41e689de676 Mon Sep 17 00:00:00 2001 From: David Disseldorp Date: Tue, 17 Mar 2020 18:09:05 +0100 Subject: [PATCH] test: use spec defined XCOPY segment descriptor lengths The SPC4r37 specification defines XCOPY Segment Descriptor lengths for each SD type. The spec defined SD lengths don't account for the four SD header bytes. To make it easier to match the spec to the implementation, use the spec defined lengths in get_desc_len() with a four byte SD header addition. Signed-off-by: David Disseldorp --- test-tool/iscsi-support.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/test-tool/iscsi-support.c b/test-tool/iscsi-support.c index 32be830..0e224bb 100644 --- a/test-tool/iscsi-support.c +++ b/test-tool/iscsi-support.c @@ -2867,6 +2867,7 @@ int extendedcopy(struct scsi_device *sdev, struct iscsi_data *data, int status, return ret; } +/* return the length for a give descriptor type, including any SD header */ int get_desc_len(enum ec_descr_type_code desc_type) { int desc_len = 0; @@ -2874,16 +2875,16 @@ int get_desc_len(enum ec_descr_type_code desc_type) /* Segment Descriptors */ case BLK_TO_STRM_SEG_DESCR: case STRM_TO_BLK_SEG_DESCR: - desc_len = 0x18; + desc_len = 0x14 + SEG_DESC_SRC_INDEX_OFFSET; break; case BLK_TO_BLK_SEG_DESCR: - desc_len = 0x1C; + desc_len = 0x18 + SEG_DESC_SRC_INDEX_OFFSET; break; case STRM_TO_STRM_SEG_DESCR: - desc_len = 0x14; + desc_len = 0x10 + SEG_DESC_SRC_INDEX_OFFSET; break; - /* Target Descriptors */ + /* Target Descriptors */ case IPV6_TGT_DESCR: case IP_COPY_SVC_TGT_DESCR: desc_len = 64;