From cd774921624c5fa3073de8fb2e4710d35869a51e Mon Sep 17 00:00:00 2001
From: pbonzini <pbonzini@0c8fb4dd-22a2-4bb5-bc14-6c75a5f43652>
Date: Mon, 9 Jun 2014 13:14:36 +0000
Subject: virtio-scsi: fixes to protection information

pi_bytesin is in the device-readable section.  Document lack of residual
field.  Use le32 instead of u32.

This matches the new patch series that Nicholas sent for vhost-scsi.

Cc: <nab@daterainc.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

git-svn-id: https://tools.oasis-open.org/version-control/svn/virtio@378 0c8fb4dd-22a2-4bb5-bc14-6c75a5f43652
---
 content.tex | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

(limited to 'content.tex')

diff --git a/content.tex b/content.tex
index 7c46e75..85f1315 100644
--- a/content.tex
+++ b/content.tex
@@ -4562,7 +4562,8 @@ struct virtio_scsi_req_cmd {
         u8 cdb[cdb_size];
         // The next two fields are only present if VIRTIO_SCSI_F_T10_PI
         // is negotiated.
-        u32 pi_bytesout;
+        le32 pi_bytesout;
+        le32 pi_bytesin;
         u8 pi_out[pi_bytesout];
         u8 dataout[];
 
@@ -4575,7 +4576,6 @@ struct virtio_scsi_req_cmd {
         u8 sense[sense_size];
         // The next two fields are only present if VIRTIO_SCSI_F_T10_PI
         // is negotiated
-        u32 pi_bytesin;
         u8 pi_in[pi_bytesin];
         u8 datain[];
 };
@@ -4630,8 +4630,9 @@ always device-readable.
 
 \field{pi_bytesout} determines the size of the \field{pi_out} field
 in bytes.  If it is nonzero, the \field{pi_out} field contains outgoing
-protection information for write operations.  Both fields are only
-present if VIRTIO_SCSI_F_T10_PI has been negotiated.
+protection information for write operations.  \field{pi_bytesin} determines
+the size of the \field{pi_in} field in the device-writable section, in bytes.
+All three fields are only present if VIRTIO_SCSI_F_T10_PI has been negotiated.
 
 The remainder of the device-readable part is the data output buffer,
 \field{dataout}.
@@ -4650,10 +4651,13 @@ exceeds the size of \field{datain} means that \field{dataout} was
 processed partially and \field{datain} was not processed at
 all.
 
-\field{pi_bytesin} determines the size of the \field{pi_in} field
-in bytes.  If it is nonzero, the \field{pi_in} field contains incoming
-protection information for read operations.  Both fields are only present
-if VIRTIO_SCSI_F_T10_PI has been negotiated.
+If the \field{pi_bytesin} is nonzero, the \field{pi_in} field contains
+incoming protection information for read operations.  \field{pi_in} is
+only present if VIRTIO_SCSI_F_T10_PI has been negotiated\footnote{There
+  is no separate residual size for \field{pi_bytesout} and
+  \field{pi_bytesin}.  It can be computed from the \field{residual} field,
+  the size of the data integrity information per sector, and the sizes
+  of \field{pi_out}, \field{pi_in}, \field{dataout} and \field{datain}.}.
 
 The remainder of the device-writable part is the data input buffer,
 \field{datain}.
-- 
cgit v1.2.3

