Return-Path: <owner-ips-outgoing@ece.cmu.edu>
Received: from newbox.ece.cmu.edu (localhost [127.0.0.1])
	by newbox.ece.cmu.edu (Cyrus v2.1.12) with LMTP; Tue, 22 Jul 2003 22:17:25 -0400
X-Sieve: CMU Sieve 2.2
Received: from osgood.ece.cmu.edu (OSGOOD.ECE.CMU.EDU [128.2.129.25])
	by newbox.ece.cmu.edu (Postfix) with ESMTP id 4457E3241
	for <ipsml@ece.cmu.edu>; Tue, 22 Jul 2003 22:17:25 -0400 (EDT)
Received: by osgood.ece.cmu.edu (Postfix, from userid 953)
	id DD48BAB; Tue, 22 Jul 2003 22:17:24 -0400 (EDT)
Received: from sos.ece.cmu.edu (SOS.ECE.CMU.EDU [128.2.129.27])
	by osgood.ece.cmu.edu (Postfix) with ESMTP
	id 27A9E86; Tue, 22 Jul 2003 22:17:19 -0400 (EDT)
Received: by sos.ece.cmu.edu (Postfix)
	id 2F1F789DC; Tue, 22 Jul 2003 22:17:01 -0400 (EDT)
Delivered-To: ips-outgoing@sos.ece.cmu.edu
Received: from bache.ece.cmu.edu (BACHE.ECE.CMU.EDU [128.2.129.23])
	by sos.ece.cmu.edu (Postfix) with ESMTP id 1ED7D89D8
	for <ips-outgoing@sos.ece.cmu.edu>; Tue, 22 Jul 2003 22:17:01 -0400 (EDT)
Received: by bache.ece.cmu.edu (Postfix)
	id E906C88; Tue, 22 Jul 2003 22:17:01 -0400 (EDT)
Delivered-To: ips-outgoing@ece.cmu.edu
Received: by bache.ece.cmu.edu (Postfix, from userid 953)
	id C632B8B; Tue, 22 Jul 2003 22:17:00 -0400 (EDT)
Received: from sos.ece.cmu.edu (SOS.ECE.CMU.EDU [128.2.129.27])
	by bache.ece.cmu.edu (Postfix) with ESMTP id 2F9829C
	for <ips-outgoing@ece.cmu.edu>; Tue, 22 Jul 2003 22:16:54 -0400 (EDT)
Received: by sos.ece.cmu.edu (Postfix, from userid 363)
	id E071B89DE; Tue, 22 Jul 2003 22:16:53 -0400 (EDT)
X-Original-To: ips@sos.ece.cmu.edu
Delivered-To: ips@sos.ece.cmu.edu
Received: from hazard.ece.cmu.edu (HAZARD.ECE.CMU.EDU [128.2.129.24])
	by sos.ece.cmu.edu (Postfix) with ESMTP id 8ED1589D8
	for <ips@sos.ece.cmu.edu>; Tue, 22 Jul 2003 22:16:52 -0400 (EDT)
Received: by hazard.ece.cmu.edu (Postfix)
	id 0C888F9; Tue, 22 Jul 2003 22:16:52 -0400 (EDT)
Delivered-To: ips@ece.cmu.edu
Received: by hazard.ece.cmu.edu (Postfix, from userid 953)
	id DD6C2118; Tue, 22 Jul 2003 22:16:51 -0400 (EDT)
Received: from d06lmsgate-4.uk.ibm.com (d06lmsgate-4.uk.ibm.com [195.212.29.4])
	by hazard.ece.cmu.edu (Postfix) with ESMTP id 4219CF9
	for <ips@ece.cmu.edu>; Tue, 22 Jul 2003 22:16:45 -0400 (EDT)
Received: from d12relay02.megacenter.de.ibm.com (d12relay02.megacenter.de.ibm.com [9.149.165.196])
	by d06lmsgate-4.uk.ibm.com (8.12.9/8.12.8) with ESMTP id h6N2GhXl070002
	for <ips@ece.cmu.edu>; Wed, 23 Jul 2003 03:16:43 +0100
Received: from d10ml001.telaviv.ibm.com (d12av02.megacenter.de.ibm.com [9.149.165.228])
	by d12relay02.megacenter.de.ibm.com (8.12.9/NCO/VER6.5) with ESMTP id h6N2BfTH190018
	for <ips@ece.cmu.edu>; Wed, 23 Jul 2003 04:11:42 +0200
To: ips@ece.cmu.edu
Subject: 
MIME-Version: 1.0
X-Mailer: Lotus Notes Release 6.0.1 February 07, 2003
From: "Julian Satran" <Julian_Satran@il.ibm.com>
Message-ID: <OFCC6873C4.379E70E1-ONC2256D6C.000A3A19-C2256D6C.000C0CBB@telaviv.ibm.com>
Date: Wed, 23 Jul 2003 05:11:35 +0300
X-MIMETrack: Serialize by Router on D10ML001/10/M/IBM(Release 5.0.9a |January 7, 2002) at
 23/07/2003 05:11:42,
	Serialize complete at 23/07/2003 05:11:42
Content-Type: text/plain; charset="US-ASCII"
Sender: owner-ips@ece.cmu.edu
Precedence: bulk
X-Spam-Status: No, hits=-5.8 required=5.0
	tests=BAYES_10
	version=2.50
X-Spam-Level: 
X-Spam-Checker-Version: SpamAssassin 2.50 (1.173-2003-02-20-exp)

Dean (& Eddy),

The residual should be set based in on the Expected Length given in the 
PDU which in turn relects the SCSI expected length but it is influenced 
also by the CDB content.
For some devices (e.g., block devices like disk) SCSI specifies also the 
length by some other means like the number of block and the result of the 
operation is device specific (e.g., a disk write of 517 bytes indicating 2 
blocks will result in two blocks written with the second filled with 
something and an underflow of 507 bytes; alternatively a 517 bytes write 
with 1 block would have resulted in a overflow of 5 bytes).

For other devices (e.g., tapes when reaching end-of-tape or during read of 
tapes) the result depend only on the Expected Length and the device 
specification (how it reads or writes).

Regards,
Julo
----- Forwarded by Julian Satran/Haifa/IBM on 23-07-03 04:51 -----

Eddy Quicksall <eddy_quicksall@ivivity.com> 
22-07-03 21:22

To
Alex Iannicelli <alex.iannicelli@trebia.com>, Eddy Quicksall 
<eddy_quicksall@ivivity.com>, Dean Scoville <dean.scoville@qlogic.com>, 
Julian Satran/Haifa/IBM@IBMIL
cc
ips@ece.cmu.edu
Subject
RE: CDB/PDU inconsistencies and residual counts






When I said "determined", I did not mean "implemented". I meant that the 
SCSI layer is what interprets the CDB. I didn't mean to answer to an 
implementation.
 
Eddy
 
-----Original Message-----
From: Alex Iannicelli [mailto:alex.iannicelli@trebia.com] 
Sent: Tuesday, July 22, 2003 1:37 PM
To: Eddy Quicksall; Dean Scoville; Julian Satran
Cc: ips@ece.cmu.edu
Subject: RE: CDB/PDU inconsistencies and residual counts
 
My take:
 
The overflow/underflow is determined by the iSCSI layer. The SCSI layer 
simply tries to satisfy the CDB. If the SCSI layer hands the iSCSI layer 
too much data (more than ExpectedDataTransferLength) the iSCSI layer will 
mark it as overflow. If the SCSI layer does not hand the iSCSI layer 
enough data (very common when sending INQUIRY) then the iSCSI layer must 
mark it as an underflow.
 
Also, the target must NEVER send too much data even if the SCSI layer 
tries to issue more than ExpectedDataTransferLength. This data should be 
truncated by the iSCSI layer and marked as overflow. Overflow does NOT 
indicate that the target just sent more data then was requested in the 
ExpectedDataTransferLength.
 
Alex
-----Original Message-----
From: Eddy Quicksall [mailto:eddy_quicksall@ivivity.com]
Sent: Tuesday, July 22, 2003 1:26 PM
To: Dean Scoville; Julian Satran
Cc: ips@ece.cmu.edu
Subject: RE: CDB/PDU inconsistencies and residual counts
My take is this:
 
The overflow/underflow is determined by the SCSI layer. This is because 
the "expected data transfer length" gives the size of the initiators 
buffer and the CDB gives the size of the "attempted transfer". If the 
target is attempting to transfer too much, that would be an overflow.
 
In some transports (like parallel SCSI) this is not determined by the 
target but is determined by the initiator driver or host adapter. In this 
case the target will try to stay in data-in phase to transfer all of the 
data. The initiator sees this as an overflow.
 
Eddy
 
-----Original Message-----
From: Dean Scoville [mailto:dean.scoville@qlogic.com] 
Sent: Tuesday, July 22, 2003 12:43 PM
To: Julian Satran
Cc: ips@ece.cmu.edu
Subject: CDB/PDU inconsistencies and residual counts
 
Julian, 
The overflow/underflow and residual count values in Data-in and 
SCSI Response PDUs are set by the target based on the expected 
transfer length for the command, but should these values be set based 
on the CDB (SCSI layer) or based on the PDU "expected data transfer 
length" 
field (iSCSI layer)? 
For example, suppose an initiator sends a 4 block SCSI Read command 
but for some reason thinks the block size is 1024 bytes when in actuality 
the disk has 512 byte blocks. The SCSI Command PDU would have an 
"expected data transfer length" of value of 4096 bytes, but the target 
would 
actually return 2048 bytes (based on the true block size). Should the 
target 
set the underflow bit and return a residual count (based on the iSCSI 
PDU), 
or should it return no underflow and no residual count (based on the SCSI 
CDB)? 
The question comes up because I was running some iSCSI protocol test 
scripts where the PDU "expected transfer length" and the transfer length 
in the CDB were inconsistent in one of the scripts. 
Another example would be if the "allocation length" field in the CDB for 
an Inquiry command doesn't match the "expected data transfer length" field 

in the SCSI Command PDU. 
The script was in error and should be fixed, is there a desired target 
behavior in such situations, given that the CDB fields are not typically 
parsed 
by the iSCSI layer, the SCSI device may know nothing about iSCSI PDUs, 
and some middle-layer may or may not know about both. 
If the initiator detects that an underflow has occurred, based solely on 
the 
amount of data received and the "expected data transfer field" in the 
iSCSI PDU, 
but the target did not report an underflow or residual count in the SCSI 
response, 
is the initiator allowed/expected to report an underflow to the upper 
layers? 
Thanks, 
Dean Scoville 
----- Forwarded by Julian Satran/Haifa/IBM on 23-07-03 04:51 -----

Eddy Quicksall <eddy_quicksall@ivivity.com> 
22-07-03 20:25

To
Dean Scoville <dean.scoville@qlogic.com>, Julian Satran/Haifa/IBM@IBMIL
cc
ips@ece.cmu.edu
Subject
RE: CDB/PDU inconsistencies and residual counts






My take is this:
 
The overflow/underflow is determined by the SCSI layer. This is because 
the "expected data transfer length" gives the size of the initiators 
buffer and the CDB gives the size of the "attempted transfer". If the 
target is attempting to transfer too much, that would be an overflow.
 
In some transports (like parallel SCSI) this is not determined by the 
target but is determined by the initiator driver or host adapter. In this 
case the target will try to stay in data-in phase to transfer all of the 
data. The initiator sees this as an overflow.
 
Eddy
 
-----Original Message-----
From: Dean Scoville [mailto:dean.scoville@qlogic.com] 
Sent: Tuesday, July 22, 2003 12:43 PM
To: Julian Satran
Cc: ips@ece.cmu.edu
Subject: CDB/PDU inconsistencies and residual counts
 
Julian, 
The overflow/underflow and residual count values in Data-in and 
SCSI Response PDUs are set by the target based on the expected 
transfer length for the command, but should these values be set based 
on the CDB (SCSI layer) or based on the PDU "expected data transfer 
length" 
field (iSCSI layer)? 
For example, suppose an initiator sends a 4 block SCSI Read command 
but for some reason thinks the block size is 1024 bytes when in actuality 
the disk has 512 byte blocks. The SCSI Command PDU would have an 
"expected data transfer length" of value of 4096 bytes, but the target 
would 
actually return 2048 bytes (based on the true block size). Should the 
target 
set the underflow bit and return a residual count (based on the iSCSI 
PDU), 
or should it return no underflow and no residual count (based on the SCSI 
CDB)? 
The question comes up because I was running some iSCSI protocol test 
scripts where the PDU "expected transfer length" and the transfer length 
in the CDB were inconsistent in one of the scripts. 
Another example would be if the "allocation length" field in the CDB for 
an Inquiry command doesn't match the "expected data transfer length" field 

in the SCSI Command PDU. 
The script was in error and should be fixed, is there a desired target 
behavior in such situations, given that the CDB fields are not typically 
parsed 
by the iSCSI layer, the SCSI device may know nothing about iSCSI PDUs, 
and some middle-layer may or may not know about both. 
If the initiator detects that an underflow has occurred, based solely on 
the 
amount of data received and the "expected data transfer field" in the 
iSCSI PDU, 
but the target did not report an underflow or residual count in the SCSI 
response, 
is the initiator allowed/expected to report an underflow to the upper 
layers? 
Thanks, 
Dean Scoville 
----- Forwarded by Julian Satran/Haifa/IBM on 23-07-03 04:51 -----

"Dean Scoville" <dean.scoville@qlogic.com> 
22-07-03 19:43

To
Julian Satran/Haifa/IBM@IBMIL
cc
<ips@ece.cmu.edu>
Subject
CDB/PDU inconsistencies and residual counts






Julian, 
The overflow/underflow and residual count values in Data-in and 
SCSI Response PDUs are set by the target based on the expected 
transfer length for the command, but should these values be set based 
on the CDB (SCSI layer) or based on the PDU "expected data transfer 
length" 
field (iSCSI layer)? 
For example, suppose an initiator sends a 4 block SCSI Read command 
but for some reason thinks the block size is 1024 bytes when in actuality 
the disk has 512 byte blocks. The SCSI Command PDU would have an 
"expected data transfer length" of value of 4096 bytes, but the target 
would 
actually return 2048 bytes (based on the true block size). Should the 
target 
set the underflow bit and return a residual count (based on the iSCSI 
PDU), 
or should it return no underflow and no residual count (based on the SCSI 
CDB)? 
The question comes up because I was running some iSCSI protocol test 
scripts where the PDU "expected transfer length" and the transfer length 
in the CDB were inconsistent in one of the scripts. 
Another example would be if the "allocation length" field in the CDB for 
an Inquiry command doesn't match the "expected data transfer length" field 

in the SCSI Command PDU. 
The script was in error and should be fixed, is there a desired target 
behavior in such situations, given that the CDB fields are not typically 
parsed 
by the iSCSI layer, the SCSI device may know nothing about iSCSI PDUs, 
and some middle-layer may or may not know about both. 
If the initiator detects that an underflow has occurred, based solely on 
the 
amount of data received and the "expected data transfer field" in the 
iSCSI PDU, 
but the target did not report an underflow or residual count in the SCSI 
response, 
is the initiator allowed/expected to report an underflow to the upper 
layers? 
Thanks, 
Dean Scoville 
