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 13:26:46 -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 2CD363008
	for <ipsml@ece.cmu.edu>; Tue, 22 Jul 2003 13:26:46 -0400 (EDT)
Received: by osgood.ece.cmu.edu (Postfix, from userid 953)
	id 8832CB9; Tue, 22 Jul 2003 13:26:45 -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 354A6A5; Tue, 22 Jul 2003 13:26:23 -0400 (EDT)
Received: by sos.ece.cmu.edu (Postfix)
	id 213F089D9; Tue, 22 Jul 2003 13:26:06 -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 0EF9989D8
	for <ips-outgoing@sos.ece.cmu.edu>; Tue, 22 Jul 2003 13:26:06 -0400 (EDT)
Received: by bache.ece.cmu.edu (Postfix)
	id D234C7F; Tue, 22 Jul 2003 13:26:05 -0400 (EDT)
Delivered-To: ips-outgoing@ece.cmu.edu
Received: by bache.ece.cmu.edu (Postfix, from userid 953)
	id ADF607C; Tue, 22 Jul 2003 13:26:05 -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 E542E9F
	for <ips-outgoing@ece.cmu.edu>; Tue, 22 Jul 2003 13:25:57 -0400 (EDT)
Received: by sos.ece.cmu.edu (Postfix, from userid 363)
	id 9CDA689DC; Tue, 22 Jul 2003 13:25:57 -0400 (EDT)
X-Original-To: ips@sos.ece.cmu.edu
Delivered-To: ips@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 87B3889D8
	for <ips@sos.ece.cmu.edu>; Tue, 22 Jul 2003 13:25:55 -0400 (EDT)
Received: by bache.ece.cmu.edu (Postfix)
	id 0BC147B; Tue, 22 Jul 2003 13:25:55 -0400 (EDT)
Delivered-To: ips@ece.cmu.edu
Received: by bache.ece.cmu.edu (Postfix, from userid 953)
	id D3A719C; Tue, 22 Jul 2003 13:25:54 -0400 (EDT)
Received: from mail.ivivity.com (unknown [64.238.111.99])
	by bache.ece.cmu.edu (Postfix) with ESMTP id A10237C
	for <ips@ece.cmu.edu>; Tue, 22 Jul 2003 13:25:49 -0400 (EDT)
Received: by atlops.ivivity.com with Internet Mail Service (5.5.2653.19)
	id <3460WZA7>; Tue, 22 Jul 2003 13:25:49 -0400
Message-ID: <AEC4671C8179D61194DE0002B328BDD27C34E3@atlops.ivivity.com>
From: Eddy Quicksall <eddy_quicksall@ivivity.com>
To: Dean Scoville <dean.scoville@qlogic.com>,
	Julian Satran <Julian_Satran@il.ibm.com>
Cc: ips@ece.cmu.edu
Subject: RE: CDB/PDU inconsistencies and residual counts
Date: Tue, 22 Jul 2003 13:25:48 -0400
MIME-Version: 1.0
X-Mailer: Internet Mail Service (5.5.2653.19)
Content-Type: multipart/alternative;
	boundary="----_=_NextPart_001_01C35076.4ACDF340"
Sender: owner-ips@ece.cmu.edu
Precedence: bulk
X-Spam-Status: No, hits=-11.9 required=5.0
	tests=BAYES_10,HTML_50_60,HTML_FONT_COLOR_BLUE,ORIGINAL_MESSAGE
	version=2.50
X-Spam-Level: 
X-Spam-Checker-Version: SpamAssassin 2.50 (1.173-2003-02-20-exp)

This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.

------_=_NextPart_001_01C35076.4ACDF340
Content-Type: text/plain

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 

------_=_NextPart_001_01C35076.4ACDF340
Content-Type: text/html
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<html xmlns:o=3D"urn:schemas-microsoft-com:office:office" =
xmlns:w=3D"urn:schemas-microsoft-com:office:word" =
xmlns=3D"http://www.w3.org/TR/REC-html40">

<head>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3DUS-ASCII">


<meta name=3DProgId content=3DWord.Document>
<meta name=3DGenerator content=3D"Microsoft Word 10">
<meta name=3DOriginator content=3D"Microsoft Word 10">
<link rel=3DFile-List href=3D"cid:filelist.xml@01C35054.C1F28FC0">
<title>CDB/PDU inconsistencies and residual counts</title>
<!--[if gte mso 9]><xml>
 <o:OfficeDocumentSettings>
  <o:DoNotRelyOnCSS/>
 </o:OfficeDocumentSettings>
</xml><![endif]--><!--[if gte mso 9]><xml>
 <w:WordDocument>
  <w:SpellingState>Clean</w:SpellingState>
  <w:GrammarState>Clean</w:GrammarState>
  <w:DocumentKind>DocumentEmail</w:DocumentKind>
  <w:EnvelopeVis/>
 </w:WordDocument>
</xml><![endif]-->
<style>
<!--
 /* Font Definitions */
 @font-face
	{font-family:Tahoma;
	panose-1:2 11 6 4 3 5 4 4 2 4;
	mso-font-charset:0;
	mso-generic-font-family:swiss;
	mso-font-pitch:variable;
	mso-font-signature:1627421319 -2147483648 8 0 66047 0;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
	{mso-style-parent:"";
	margin:0in;
	margin-bottom:.0001pt;
	mso-pagination:widow-orphan;
	font-size:12.0pt;
	font-family:"Times New Roman";
	mso-fareast-font-family:"Times New Roman";}
a:link, span.MsoHyperlink
	{color:blue;
	text-decoration:underline;
	text-underline:single;}
a:visited, span.MsoHyperlinkFollowed
	{color:purple;
	text-decoration:underline;
	text-underline:single;}
p
	{mso-margin-top-alt:auto;
	margin-right:0in;
	mso-margin-bottom-alt:auto;
	margin-left:0in;
	mso-pagination:widow-orphan;
	font-size:12.0pt;
	font-family:"Times New Roman";
	mso-fareast-font-family:"Times New Roman";}
span.EmailStyle18
	{mso-style-type:personal-reply;
	mso-style-noshow:yes;
	mso-ansi-font-size:10.0pt;
	mso-bidi-font-size:10.0pt;
	font-family:Arial;
	mso-ascii-font-family:Arial;
	mso-hansi-font-family:Arial;
	mso-bidi-font-family:Arial;
	color:navy;}
@page Section1
	{size:8.5in 11.0in;
	margin:1.0in 1.25in 1.0in 1.25in;
	mso-header-margin:.5in;
	mso-footer-margin:.5in;
	mso-paper-source:0;}
div.Section1
	{page:Section1;}
-->
</style>
<!--[if gte mso 10]>
<style>
 /* Style Definitions */=20
 table.MsoNormalTable
	{mso-style-name:"Table Normal";
	mso-tstyle-rowband-size:0;
	mso-tstyle-colband-size:0;
	mso-style-noshow:yes;
	mso-style-parent:"";
	mso-padding-alt:0in 5.4pt 0in 5.4pt;
	mso-para-margin:0in;
	mso-para-margin-bottom:.0001pt;
	mso-pagination:widow-orphan;
	font-size:10.0pt;
	font-family:"Times New Roman";}
</style>
<![endif]-->
</head>

<body lang=3DEN-US link=3Dblue vlink=3Dpurple =
style=3D'tab-interval:.5in'>

<div class=3DSection1>

<p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span =
style=3D'font-size:
10.0pt;font-family:Arial;color:navy'><!-- Converted from text/rtf =
format -->My
take is this:<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span =
style=3D'font-size:
10.0pt;font-family:Arial;color:navy'><o:p>&nbsp;</o:p></span></font></p>=


<p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span =
style=3D'font-size:
10.0pt;font-family:Arial;color:navy'>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.<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span =
style=3D'font-size:
10.0pt;font-family:Arial;color:navy'><o:p>&nbsp;</o:p></span></font></p>=


<p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span =
style=3D'font-size:
10.0pt;font-family:Arial;color:navy'>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.<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span =
style=3D'font-size:
10.0pt;font-family:Arial;color:navy'><o:p>&nbsp;</o:p></span></font></p>=


<p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span =
style=3D'font-size:
10.0pt;font-family:Arial;color:navy'>Eddy<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span =
style=3D'font-size:
10.0pt;font-family:Arial;color:navy'><o:p>&nbsp;</o:p></span></font></p>=


<p class=3DMsoNormal style=3D'margin-left:.5in'><font size=3D2 =
face=3DTahoma><span
style=3D'font-size:10.0pt;font-family:Tahoma'>-----Original =
Message-----<br>
<b><span style=3D'font-weight:bold'>From:</span></b> Dean Scoville
[mailto:dean.scoville@qlogic.com] <br>
<b><span style=3D'font-weight:bold'>Sent:</span></b> Tuesday, July 22, =
2003 12:43
PM<br>
<b><span style=3D'font-weight:bold'>To:</span></b> Julian Satran<br>
<b><span style=3D'font-weight:bold'>Cc:</span></b> ips@ece.cmu.edu<br>
<b><span style=3D'font-weight:bold'>Subject:</span></b> CDB/PDU =
inconsistencies
and residual counts</span></font></p>

<p class=3DMsoNormal style=3D'margin-left:.5in'><font size=3D3 =
face=3D"Times New Roman"><span
style=3D'font-size:12.0pt'><o:p>&nbsp;</o:p></span></font></p>

<p style=3D'margin-left:.5in'><font size=3D2 face=3DArial><span =
style=3D'font-size:
10.0pt;font-family:Arial'>Julian,</span></font> <br>
<font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;font-family:Arial'>The
overflow/underflow and residual count values in Data-in and =
</span></font><br>
<font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;font-family:Arial'>SCSI
Response PDUs are set by the target based on the expected</span></font> =
<br>
<font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;font-family:Arial'>transfer
length for the command, but should these values be set =
based</span></font> <br>
<font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;font-family:Arial'>on the
CDB (SCSI layer) or based on the PDU &quot;expected data transfer =
length&quot;</span></font>
<br>
<font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;font-family:Arial'>field
(iSCSI layer)?</span></font> <o:p></o:p></p>

<p style=3D'margin-left:.5in'><font size=3D2 face=3DArial><span =
style=3D'font-size:
10.0pt;font-family:Arial'>For example, suppose an initiator sends a 4 =
block
SCSI Read command</span></font> <br>
<font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;font-family:Arial'>but
for some reason thinks the block size is 1024 bytes when in =
actuality</span></font>
<br>
<font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;font-family:Arial'>the
disk has 512 byte blocks. The SCSI Command PDU would have an =
</span></font><br>
<font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;font-family:Arial'>&quot;expected
data transfer length&quot; of value of 4096 bytes, but the target =
would</span></font>
<br>
<font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;font-family:Arial'>actually
return 2048 bytes (based on the true block size). Should the =
target</span></font>
<br>
<font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;font-family:Arial'>set
the underflow bit and return a residual count (based on the iSCSI =
PDU),</span></font>
<br>
<font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;font-family:Arial'>or
should it return no underflow and no residual count (based on the SCSI =
CDB)?</span></font>
<o:p></o:p></p>

<p style=3D'margin-left:.5in'><font size=3D2 face=3DArial><span =
style=3D'font-size:
10.0pt;font-family:Arial'>The question comes up because I was running =
some
iSCSI protocol test</span></font> <br>
<font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;font-family:Arial'>scripts
where the PDU &quot;expected transfer length&quot; and the transfer =
length </span></font><br>
<font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;font-family:Arial'>in the
CDB were inconsistent in one of the scripts.</span></font> =
<o:p></o:p></p>

<p style=3D'margin-left:.5in'><font size=3D2 face=3DArial><span =
style=3D'font-size:
10.0pt;font-family:Arial'>Another example would be if the =
&quot;allocation
length&quot; field in the CDB for</span></font> <br>
<font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;font-family:Arial'>an
Inquiry command doesn't match the &quot;expected data transfer =
length&quot;
field</span></font> <br>
<font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;font-family:Arial'>in the
SCSI Command PDU.</span></font> <o:p></o:p></p>

<p style=3D'margin-left:.5in'><font size=3D2 face=3DArial><span =
style=3D'font-size:
10.0pt;font-family:Arial'>The script was in error and should be fixed, =
is there
a desired target </span></font><br>
<font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;font-family:Arial'>behavior
in such situations, given that the CDB fields are not typically =
parsed</span></font>
<br>
<font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;font-family:Arial'>by the
iSCSI layer, the SCSI device may know nothing about iSCSI =
PDUs,</span></font> <br>
<font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;font-family:Arial'>and some
middle-layer may or may not know about both.</span></font> =
<o:p></o:p></p>

<p style=3D'margin-left:.5in'><font size=3D2 face=3DArial><span =
style=3D'font-size:
10.0pt;font-family:Arial'>If the initiator detects that an underflow =
has
occurred, based solely on the</span></font> <br>
<font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;font-family:Arial'>amount
of data received and the &quot;expected data transfer field&quot; in =
the iSCSI
PDU,</span></font> <br>
<font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;font-family:Arial'>but
the target did not report an underflow or residual count in the SCSI =
response,</span></font>
<br>
<font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;font-family:Arial'>is the
initiator allowed/expected to report an underflow to the upper =
layers?</span></font>
<o:p></o:p></p>

<p style=3D'margin-left:.5in'><font size=3D2 face=3DArial><span =
style=3D'font-size:
10.0pt;font-family:Arial'>Thanks,</span></font> <o:p></o:p></p>

<p style=3D'margin-left:.5in'><font size=3D2 face=3DArial><span =
style=3D'font-size:
10.0pt;font-family:Arial'>Dean Scoville</span></font> <o:p></o:p></p>

</div>

</body>

</html>

------_=_NextPart_001_01C35076.4ACDF340--
