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 14:29:30 -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 88E663257
	for <ipsml@ece.cmu.edu>; Tue, 22 Jul 2003 14:29:30 -0400 (EDT)
Received: by osgood.ece.cmu.edu (Postfix, from userid 953)
	id 2FA6DA4; Tue, 22 Jul 2003 14:29:30 -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 039EC8C; Tue, 22 Jul 2003 14:29:21 -0400 (EDT)
Received: by sos.ece.cmu.edu (Postfix)
	id 8955A89E7; Tue, 22 Jul 2003 14:29:04 -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 7BC3B89E2
	for <ips-outgoing@sos.ece.cmu.edu>; Tue, 22 Jul 2003 14:29:04 -0400 (EDT)
Received: by bache.ece.cmu.edu (Postfix)
	id 4C8BE9C; Tue, 22 Jul 2003 14:29:04 -0400 (EDT)
Delivered-To: ips-outgoing@ece.cmu.edu
Received: by bache.ece.cmu.edu (Postfix, from userid 953)
	id 0ACFE9E; Tue, 22 Jul 2003 14:29:03 -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 4B3FFA5
	for <ips-outgoing@ece.cmu.edu>; Tue, 22 Jul 2003 14:28:07 -0400 (EDT)
Received: by sos.ece.cmu.edu (Postfix, from userid 363)
	id 98B2289EA; Tue, 22 Jul 2003 14:27:57 -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 31C7A89E7
	for <ips@sos.ece.cmu.edu>; Tue, 22 Jul 2003 14:27:56 -0400 (EDT)
Received: by hazard.ece.cmu.edu (Postfix)
	id 12FED156; Tue, 22 Jul 2003 14:27:56 -0400 (EDT)
Delivered-To: ips@ece.cmu.edu
Received: by hazard.ece.cmu.edu (Postfix, from userid 953)
	id A195B163; Tue, 22 Jul 2003 14:27:55 -0400 (EDT)
Received: from mail.ivivity.com (unknown [64.238.111.99])
	by hazard.ece.cmu.edu (Postfix) with ESMTP id 5241F156
	for <ips@ece.cmu.edu>; Tue, 22 Jul 2003 14:27:41 -0400 (EDT)
Received: by atlops.ivivity.com with Internet Mail Service (5.5.2653.19)
	id <PN7469QL>; Tue, 22 Jul 2003 14:27:41 -0400
Message-ID: <AEC4671C8179D61194DE0002B328BDD27C34F7@atlops.ivivity.com>
From: Eddy Quicksall <eddy_quicksall@ivivity.com>
To: dcuddihy@attotech.com, Dean Scoville <dean.scoville@qlogic.com>
Cc: ips@ece.cmu.edu
Subject: RE: CDB/PDU inconsistencies and residual counts
Date: Tue, 22 Jul 2003 14:27:40 -0400
MIME-Version: 1.0
X-Mailer: Internet Mail Service (5.5.2653.19)
Content-Type: text/plain
Sender: owner-ips@ece.cmu.edu
Precedence: bulk
X-Spam-Status: No, hits=-16.1 required=5.0
	tests=BAYES_01,ORIGINAL_MESSAGE,QUOTED_EMAIL_TEXT
	version=2.50
X-Spam-Level: 
X-Spam-Checker-Version: SpamAssassin 2.50 (1.173-2003-02-20-exp)

Another example of this is when you want to read 1 byte from a disk. The CDB
is in blocks but the buffer (specified by the ExpectedDataTransferLength) is
in bytes.

FYI, SCO Unix used to do this during its install process.

Eddy

-----Original Message-----
From: dcuddihy@attotech.com [mailto:dcuddihy@attotech.com] 
Sent: Tuesday, July 22, 2003 1:51 PM
To: Dean Scoville
Cc: ips@ece.cmu.edu
Subject: Re: CDB/PDU inconsistencies and residual counts


Dean,

I'm taking my queues from our FCP experience, but it seems to me that the
residual should be the difference between the iSCSI and SCSI layers.

> 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)?

In this case it is a 2048 byte underflow.


> 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.


That's a pretty cool test case...


In most cases where there is an allocation length, the overflow is
reflectedin the SCSI response, so there's no residual.  (IE if there's more
data in the inquiry response than the allocation length will allow, just
report the length in the SCSI response but don't indicate an overflow.)  In
the case where allocation length would allow for a transfer larger  than
the "expected data transfer length" at the ISCSI layer this should report
an overflow  and residual, since everything in the SCSI response could not
be transferred by the ISCSI layer.


btw: Report Luns works similarly, where underflow is reported, but overflow
is handled by the length field in the SCSI response -- as long as the
allocation length and the "expected data transfer length" match.


regards,


David






David J Cuddihy
Principal Engineer
ATTO Technology, Inc.
http://www.attotech.com/fcbridge.html
dcuddihy@attotech.com




 

                    "Dean Scoville"

                    <dean.scoville@q       To:     "Julian Satran"
<Julian_Satran@il.ibm.com>

                    logic.com>             cc:     <ips@ece.cmu.edu>

                    Sent by:               Subject:     CDB/PDU
inconsistencies and residual counts

                    owner-ips@ece.cm

                    u.edu

 

 

                    07/22/03 12:43

                    PM

 

 





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






