[PATCH] viostor driver. Xp driver performance.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





repository: /home/vadimr/shares/kvm-guest-drivers-windows
branch: XP
commit 3b2926a281a769499944a23cc3c9b905593e6838
Author: Vadim Rozenfeld<vrozenfe@xxxxxxxxxx>
Date:   Thu Nov 19 09:14:38 2009 +0200

    [PATCH] viostor driver. Xp driver performance.

    Signed-off-by: Vadim Rozenfeld<vrozenfe@xxxxxxxxxx>

diff --git a/viostor/virtio_stor.c b/viostor/virtio_stor.c
index c36b85b..e674dff 100644
--- a/viostor/virtio_stor.c
+++ b/viostor/virtio_stor.c
@@ -215,6 +215,7 @@ VirtIoFindAdapter(
     ConfigInfo->Dma32BitAddresses      = TRUE;
     ConfigInfo->Dma64BitAddresses      = TRUE;
     ConfigInfo->WmiDataProvider        = FALSE;
+
 #ifdef USE_STORPORT
     ConfigInfo->MapBuffers             = STOR_MAP_NON_READ_WRITE_BUFFERS;
     ConfigInfo->SynchronizationModel   = StorSynchronizeFullDuplex;
@@ -286,7 +287,7 @@ VirtIoFindAdapter(
     if(adaptExt->dump_mode) {
         ConfigInfo->NumberOfPhysicalBreaks = 8;
     } else {
-        ConfigInfo->NumberOfPhysicalBreaks = 16;
+        ConfigInfo->NumberOfPhysicalBreaks = MAX_PHYS_SEGMENTS-1;
     }

     ConfigInfo->MaximumTransferLength = ConfigInfo->NumberOfPhysicalBreaks * PAGE_SIZE;
@@ -316,7 +317,6 @@ VirtIoFindAdapter(

     InitializeListHead(&adaptExt->list_head);
     InitializeListHead(&adaptExt->complete_list);
-
     return SP_RETURN_FOUND;
 }

@@ -470,9 +470,7 @@ VirtIoStartIo(
 {
     PCDB cdb = (PCDB)&Srb->Cdb[0];

-    PADAPTER_EXTENSION adaptExt;
-
-    adaptExt = (PADAPTER_EXTENSION)DeviceExtension;
+    PADAPTER_EXTENSION adaptExt = (PADAPTER_EXTENSION)DeviceExtension;

     switch (Srb->Function) {
         case SRB_FUNCTION_EXECUTE_SCSI:
@@ -591,7 +589,6 @@ VirtIoStartIo(
     return TRUE;
 }

-
 BOOLEAN
 VirtIoInterrupt(
     IN PVOID DeviceExtension
@@ -600,12 +597,10 @@ VirtIoInterrupt(
     pblk_req            vbr;
     unsigned int        len;
     unsigned long       flags;
-    PADAPTER_EXTENSION  adaptExt;
+    PADAPTER_EXTENSION  adaptExt = (PADAPTER_EXTENSION)DeviceExtension;
     BOOLEAN             isInterruptServiced = FALSE;
     PSCSI_REQUEST_BLOCK Srb;

-    adaptExt = (PADAPTER_EXTENSION)DeviceExtension;
-
     RhelDbgPrint(TRACE_LEVEL_VERBOSE, ("%s (%d)\n", __FUNCTION__, KeGetCurrentIrql()));

     if (VirtIODeviceISR(DeviceExtension)>  0) {
@@ -1019,7 +1014,6 @@ RhelGetLba(
     PCDB Cdb
     )
 {
-
     EIGHT_BYTE lba;

     switch (Cdb->CDB6GENERIC.OperationCode) {
@@ -1094,7 +1088,7 @@ CompleteDPC(
 {
     PSCSI_REQUEST_BLOCK Srb = (PSCSI_REQUEST_BLOCK)vbr->req;
     PADAPTER_EXTENSION adaptExt = (PADAPTER_EXTENSION)DeviceExtension;
-
+    PRHEL_SRB_EXTENSION srbExt   = (PRHEL_SRB_EXTENSION)Srb->SrbExtension;
     RemoveEntryList(&vbr->list_entry);

 #ifdef USE_STORPORT
@@ -1106,13 +1100,22 @@ CompleteDPC(
                          NULL);
         return;
     }
-#endif
     CompleteSRB(DeviceExtension, Srb);
-#ifndef USE_STORPORT
-    --adaptExt->requests;
+#else
+    ScsiPortNotification(RequestComplete,
+                         DeviceExtension,
+                         Srb);
+    if(srbExt->call_next) {
+        ScsiPortNotification(NextLuRequest,
+                         DeviceExtension,
+                         Srb->PathId,
+                         Srb->TargetId,
+                         Srb->Lun);
+    }
 #endif
 }

+
 #ifdef USE_STORPORT
 VOID
 CompleteDpcRoutine(
diff --git a/viostor/virtio_stor.h b/viostor/virtio_stor.h
index c00600c..ac143ea 100644
--- a/viostor/virtio_stor.h
+++ b/viostor/virtio_stor.h
@@ -52,7 +52,7 @@ typedef struct VirtIOBufferDescriptor VIO_SG, *PVIO_SG;
 #define VIRTIO_BLK_S_UNSUPP	2

 #define SECTOR_SIZE             512
-#define MAX_PHYS_SEGMENTS       128
+#define MAX_PHYS_SEGMENTS       17 //128
 #define VIRTIO_MAX_SG	        (3+MAX_PHYS_SEGMENTS)
 #define IO_PORT_LENGTH          0x40

@@ -105,8 +105,6 @@ typedef struct _ADAPTER_EXTENSION {
     LIST_ENTRY            complete_list;
 #ifdef USE_STORPORT
     STOR_DPC              completion_dpc;
-#else
-    ULONG                 requests;
 #endif
     BOOLEAN               has_sn;
     ULONG                 msix_vectors;
@@ -116,6 +114,10 @@ typedef struct _RHEL_SRB_EXTENSION {
     blk_req               vbr;
     ULONG                 out;
     ULONG                 in;
+    PSCSI_REQUEST_BLOCK   srb;
+#ifndef USE_STORPORT
+    BOOLEAN               call_next;
+#endif
 }RHEL_SRB_EXTENSION, *PRHEL_SRB_EXTENSION;

 ULONGLONG

diff --git a/viostor/virtio_stor.c b/viostor/virtio_stor.c
index c36b85b..e674dff 100644
--- a/viostor/virtio_stor.c
+++ b/viostor/virtio_stor.c
@@ -215,6 +215,7 @@ VirtIoFindAdapter(
     ConfigInfo->Dma32BitAddresses      = TRUE;
     ConfigInfo->Dma64BitAddresses      = TRUE;
     ConfigInfo->WmiDataProvider        = FALSE;
+
 #ifdef USE_STORPORT
     ConfigInfo->MapBuffers             = STOR_MAP_NON_READ_WRITE_BUFFERS;
     ConfigInfo->SynchronizationModel   = StorSynchronizeFullDuplex;
@@ -286,7 +287,7 @@ VirtIoFindAdapter(
     if(adaptExt->dump_mode) {
         ConfigInfo->NumberOfPhysicalBreaks = 8;
     } else {
-        ConfigInfo->NumberOfPhysicalBreaks = 16;
+        ConfigInfo->NumberOfPhysicalBreaks = MAX_PHYS_SEGMENTS-1;
     }
 
     ConfigInfo->MaximumTransferLength = ConfigInfo->NumberOfPhysicalBreaks * PAGE_SIZE;
@@ -316,7 +317,6 @@ VirtIoFindAdapter(
 
     InitializeListHead(&adaptExt->list_head);
     InitializeListHead(&adaptExt->complete_list);
-
     return SP_RETURN_FOUND;
 }
 
@@ -470,9 +470,7 @@ VirtIoStartIo(
 {
     PCDB cdb = (PCDB)&Srb->Cdb[0];
 
-    PADAPTER_EXTENSION adaptExt;
-
-    adaptExt = (PADAPTER_EXTENSION)DeviceExtension;
+    PADAPTER_EXTENSION adaptExt = (PADAPTER_EXTENSION)DeviceExtension;
 
     switch (Srb->Function) {
         case SRB_FUNCTION_EXECUTE_SCSI:
@@ -591,7 +589,6 @@ VirtIoStartIo(
     return TRUE;
 }
 
-
 BOOLEAN
 VirtIoInterrupt(
     IN PVOID DeviceExtension
@@ -600,12 +597,10 @@ VirtIoInterrupt(
     pblk_req            vbr;
     unsigned int        len;
     unsigned long       flags;
-    PADAPTER_EXTENSION  adaptExt;
+    PADAPTER_EXTENSION  adaptExt = (PADAPTER_EXTENSION)DeviceExtension;
     BOOLEAN             isInterruptServiced = FALSE;
     PSCSI_REQUEST_BLOCK Srb;
 
-    adaptExt = (PADAPTER_EXTENSION)DeviceExtension;
-
     RhelDbgPrint(TRACE_LEVEL_VERBOSE, ("%s (%d)\n", __FUNCTION__, KeGetCurrentIrql()));
 
     if (VirtIODeviceISR(DeviceExtension) > 0) {
@@ -1019,7 +1014,6 @@ RhelGetLba(
     PCDB Cdb
     )
 {
-
     EIGHT_BYTE lba;
 
     switch (Cdb->CDB6GENERIC.OperationCode) {
@@ -1094,7 +1088,7 @@ CompleteDPC(
 {
     PSCSI_REQUEST_BLOCK Srb = (PSCSI_REQUEST_BLOCK)vbr->req;
     PADAPTER_EXTENSION adaptExt = (PADAPTER_EXTENSION)DeviceExtension;
-
+    PRHEL_SRB_EXTENSION srbExt   = (PRHEL_SRB_EXTENSION)Srb->SrbExtension;
     RemoveEntryList(&vbr->list_entry);
 
 #ifdef USE_STORPORT
@@ -1106,13 +1100,22 @@ CompleteDPC(
                          NULL);
         return;
     }
-#endif
     CompleteSRB(DeviceExtension, Srb);
-#ifndef USE_STORPORT
-    --adaptExt->requests;
+#else
+    ScsiPortNotification(RequestComplete,
+                         DeviceExtension,
+                         Srb);
+    if(srbExt->call_next) {
+        ScsiPortNotification(NextLuRequest,
+                         DeviceExtension,
+                         Srb->PathId,
+                         Srb->TargetId,
+                         Srb->Lun);
+    }
 #endif
 }
 
+
 #ifdef USE_STORPORT
 VOID
 CompleteDpcRoutine(
diff --git a/viostor/virtio_stor.h b/viostor/virtio_stor.h
index c00600c..ac143ea 100644
--- a/viostor/virtio_stor.h
+++ b/viostor/virtio_stor.h
@@ -52,7 +52,7 @@ typedef struct VirtIOBufferDescriptor VIO_SG, *PVIO_SG;
 #define VIRTIO_BLK_S_UNSUPP	2
 
 #define SECTOR_SIZE             512
-#define MAX_PHYS_SEGMENTS       128
+#define MAX_PHYS_SEGMENTS       17 //128
 #define VIRTIO_MAX_SG	        (3+MAX_PHYS_SEGMENTS)
 #define IO_PORT_LENGTH          0x40
 
@@ -105,8 +105,6 @@ typedef struct _ADAPTER_EXTENSION {
     LIST_ENTRY            complete_list;
 #ifdef USE_STORPORT
     STOR_DPC              completion_dpc;
-#else
-    ULONG                 requests;
 #endif
     BOOLEAN               has_sn;
     ULONG                 msix_vectors;
@@ -116,6 +114,10 @@ typedef struct _RHEL_SRB_EXTENSION {
     blk_req               vbr;
     ULONG                 out;
     ULONG                 in;
+    PSCSI_REQUEST_BLOCK   srb;
+#ifndef USE_STORPORT
+    BOOLEAN               call_next;
+#endif
 }RHEL_SRB_EXTENSION, *PRHEL_SRB_EXTENSION;
 
 ULONGLONG

[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux