[PATCH 1/2] Add support to return TimeoutDescriptors for REPORT SUPPORTED OPCODES

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



When an initiator requests RCTD in a REPORT SUPPORTED OPCODES call
we have to return timeout descriptors.
Previously we just returned an error if an initiator requested this
but this patch returns an empty timeout descriptor.

Since we dont really have any descriptors to return, just return an
all zero descriptor, except for the length.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@xxxxxxxxx>
---
 usr/spc.c |   31 +++++++++++++++++++------------
 1 files changed, 19 insertions(+), 12 deletions(-)

diff --git a/usr/spc.c b/usr/spc.c
index 641366f..e5d3b51 100644
--- a/usr/spc.c
+++ b/usr/spc.c
@@ -708,14 +708,6 @@ static int report_opcodes_all(struct scsi_cmd *cmd, int rctd,
 	uint32_t avail_len, actual_len;
 	int cdb_length;
 
-	/* cant request RCTD for all descriptors */
-	if (rctd) {
-		scsi_set_in_resid_by_actual(cmd, 0);
-		sense_data_build(cmd, ILLEGAL_REQUEST,
-				 ASC_INVALID_FIELD_IN_CDB);
-		return SAM_STAT_CHECK_CONDITION;
-	}
-
 	memset(buf, 0, sizeof(buf));
 	data = &buf[4];
 
@@ -739,14 +731,21 @@ static int report_opcodes_all(struct scsi_cmd *cmd, int rctd,
 			/* reserved */
 			data++;
 
-			/* flags : no service action, no command descriptor */
-			data++;
+			/* flags : no service action, possibly timeout desc */
+			*data++ = rctd ? 0x02 : 0x00;
 
 			/* cdb length */
 			cdb_length = get_scsi_command_size(i);
 			*data++ = (cdb_length >> 8) & 0xff;
 			*data++ = cdb_length & 0xff;
 
+			/* timeout descriptor */
+			if (rctd) {
+				/* length == 0x0a */
+				data[1] = 0x0a;
+
+				data += 12;
+			}
 			continue;
 		}
 
@@ -766,13 +765,21 @@ static int report_opcodes_all(struct scsi_cmd *cmd, int rctd,
 			/* reserved */
 			data++;
 
-			/* flags : service action */
-			*data++ = 0x01;
+			/* flags : service action, possibly timeout desc */
+			*data++ = rctd ? 0x03 : 0x01;
 
 			/* cdb length */
 			cdb_length = get_scsi_command_size(i);
 			*data++ = (cdb_length >> 8) & 0xff;
 			*data++ = cdb_length & 0xff;
+
+			/* timeout descriptor */
+			if (rctd) {
+				/* length == 0x0a */
+				data[1] = 0x0a;
+
+				data += 12;
+			}
 		}
 	}
 
-- 
1.7.3.1

--
To unsubscribe from this list: send the line "unsubscribe stgt" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux SCSI]     [Linux RAID]     [Linux Clusters]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]

  Powered by Linux