瀏覽代碼

Added support for InitialR2T = False

Tal Aloni 8 年之前
父節點
當前提交
d8a5566d2c
共有 2 個文件被更改,包括 7 次插入1 次删除
  1. 1 1
      ISCSI/ISCSI.Server/ISCSIServer.Parameters.cs
  2. 6 0
      ISCSI/ISCSI.Server/TargetResponseHelper.cs

+ 1 - 1
ISCSI/ISCSI.Server/ISCSIServer.Parameters.cs

@@ -21,7 +21,7 @@ namespace ISCSI.Server
         public class DesiredParameters
         {
             // Session parameters that will be offered to the initiator:
-            public static bool InitialR2T = true; // implementation limit
+            public static bool InitialR2T = false;
             public static bool ImmediateData = true;
             public static int MaxBurstLength = DefaultParameters.Session.MaxBurstLength;
             public static int FirstBurstLength = DefaultParameters.Session.FirstBurstLength;

+ 6 - 0
ISCSI/ISCSI.Server/TargetResponseHelper.cs

@@ -35,6 +35,12 @@ namespace ISCSI.Server
                 // Send R2Ts:
                 uint bytesLeft = command.ExpectedDataTransferLength - command.DataSegmentLength;
                 uint nextOffset = command.DataSegmentLength;
+                if (!session.InitialR2T)
+                {
+                    uint firstDataPDULength = Math.Min((uint)session.FirstBurstLength, command.ExpectedDataTransferLength) - command.DataSegmentLength;
+                    bytesLeft -= firstDataPDULength;
+                    nextOffset += firstDataPDULength;
+                }
                 int totalR2Ts = (int)Math.Ceiling((double)bytesLeft / connection.TargetMaxRecvDataSegmentLength);
                 int outgoingR2Ts = Math.Min(session.MaxOutstandingR2T, totalR2Ts);