public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] viostor driver. XP driver performance improvement.
@ 2009-11-16 19:54 Vadim Rozenfeld
  0 siblings, 0 replies; only message in thread
From: Vadim Rozenfeld @ 2009-11-16 19:54 UTC (permalink / raw)
  To: kvm

[-- Attachment #1: Type: text/plain, Size: 2585 bytes --]



repository: /home/vadimr/shares/kvm-guest-drivers-windows
branch: XP
commit e58183a0df0fd398e31e3f079b6c301520b2a5a2
Author: Vadim Rozenfeld<vrozenfe@redhat.com>
Date:   Sun Nov 15 22:50:55 2009 +0200

     [PATCH] viostor driver. XP driver performance improvement.

     Signed-off-by: Vadim Rozenfeld<vrozenfe@redhat.com>

diff --git a/viostor/virtio_ring.c b/viostor/virtio_ring.c
index 2911cef..de69557 100644
--- a/viostor/virtio_ring.c
+++ b/viostor/virtio_ring.c
@@ -39,7 +39,6 @@ initialize_virtqueue(
      IN VOID (*notify)(struct virtqueue *));


-//#define to_vvq(_vq) container_of(_vq, struct vring_virtqueue, vq)
  #define to_vvq(_vq) (struct vring_virtqueue *)_vq

  static
@@ -119,7 +118,7 @@ vring_add_buf(
      RhelDbgPrint(TRACE_LEVEL_VERBOSE, ("%s: Added buffer head %i to %p\n",
          __FUNCTION__, head, vq) );

-    return 0;
+    return vq->num_free;
  }

  static
diff --git a/viostor/virtio_stor_hw_helper.c b/viostor/virtio_stor_hw_helper.c
index 21d27cd..2e61b30 100644
--- a/viostor/virtio_stor_hw_helper.c
+++ b/viostor/virtio_stor_hw_helper.c
@@ -54,6 +54,8 @@ RhelDoReadWrite(PVOID DeviceExtension,
      PVOID                 DataBuffer;
      PADAPTER_EXTENSION    adaptExt;
      PRHEL_SRB_EXTENSION   srbExt;
+    int                   num_free;
+
      cdb      = (PCDB)&Srb->Cdb[0];
      srbExt   = (PRHEL_SRB_EXTENSION)Srb->SrbExtension;
      adaptExt = (PADAPTER_EXTENSION)DeviceExtension;
@@ -88,20 +90,21 @@ RhelDoReadWrite(PVOID DeviceExtension,

      srbExt->vbr.sg[sgElement].physAddr = ScsiPortGetPhysicalAddress(DeviceExtension, NULL,&srbExt->vbr.status,&fragLen);
      srbExt->vbr.sg[sgElement].ulSize = sizeof(srbExt->vbr.status);
-
-
-    if (adaptExt->pci_vq_info.vq->vq_ops->add_buf(adaptExt->pci_vq_info.vq,
+    num_free = adaptExt->pci_vq_info.vq->vq_ops->add_buf(adaptExt->pci_vq_info.vq,
                                        &srbExt->vbr.sg[0],
                                        srbExt->out, srbExt->in,
-&srbExt->vbr) == 0) {
+&srbExt->vbr);
+    if ( num_free>= 0) {
          InsertTailList(&adaptExt->list_head,&srbExt->vbr.list_entry);
          adaptExt->pci_vq_info.vq->vq_ops->kick(adaptExt->pci_vq_info.vq);
-        if(++adaptExt->requests<  adaptExt->queue_depth) {
+        srbExt->call_next = FALSE;
+        if(num_free<  VIRTIO_MAX_SG) {
+           srbExt->call_next = TRUE;
+        } else {
             ScsiPortNotification(NextLuRequest, DeviceExtension, Srb->PathId, Srb->TargetId, Srb->Lun);
          }
-        return TRUE;
      }
-    return FALSE;
+    return TRUE;
  }
  #endif



[-- Attachment #2: xp_performance.patch --]
[-- Type: text/plain, Size: 2320 bytes --]

diff --git a/viostor/virtio_ring.c b/viostor/virtio_ring.c
index 2911cef..de69557 100644
--- a/viostor/virtio_ring.c
+++ b/viostor/virtio_ring.c
@@ -39,7 +39,6 @@ initialize_virtqueue(
     IN VOID (*notify)(struct virtqueue *));
 
 
-//#define to_vvq(_vq) container_of(_vq, struct vring_virtqueue, vq)
 #define to_vvq(_vq) (struct vring_virtqueue *)_vq
 
 static
@@ -119,7 +118,7 @@ vring_add_buf(
     RhelDbgPrint(TRACE_LEVEL_VERBOSE, ("%s: Added buffer head %i to %p\n",
         __FUNCTION__, head, vq) );
 
-    return 0;
+    return vq->num_free;
 }
 
 static
diff --git a/viostor/virtio_stor_hw_helper.c b/viostor/virtio_stor_hw_helper.c
index 21d27cd..2e61b30 100644
--- a/viostor/virtio_stor_hw_helper.c
+++ b/viostor/virtio_stor_hw_helper.c
@@ -54,6 +54,8 @@ RhelDoReadWrite(PVOID DeviceExtension,
     PVOID                 DataBuffer;
     PADAPTER_EXTENSION    adaptExt;
     PRHEL_SRB_EXTENSION   srbExt;
+    int                   num_free;
+
     cdb      = (PCDB)&Srb->Cdb[0];
     srbExt   = (PRHEL_SRB_EXTENSION)Srb->SrbExtension;
     adaptExt = (PADAPTER_EXTENSION)DeviceExtension;
@@ -88,20 +90,21 @@ RhelDoReadWrite(PVOID DeviceExtension,
 
     srbExt->vbr.sg[sgElement].physAddr = ScsiPortGetPhysicalAddress(DeviceExtension, NULL, &srbExt->vbr.status, &fragLen);
     srbExt->vbr.sg[sgElement].ulSize = sizeof(srbExt->vbr.status);
-
-
-    if (adaptExt->pci_vq_info.vq->vq_ops->add_buf(adaptExt->pci_vq_info.vq,
+    num_free = adaptExt->pci_vq_info.vq->vq_ops->add_buf(adaptExt->pci_vq_info.vq,
                                       &srbExt->vbr.sg[0],
                                       srbExt->out, srbExt->in,
-                                      &srbExt->vbr) == 0) {
+                                      &srbExt->vbr);
+    if ( num_free >= 0) {
         InsertTailList(&adaptExt->list_head, &srbExt->vbr.list_entry);
         adaptExt->pci_vq_info.vq->vq_ops->kick(adaptExt->pci_vq_info.vq);
-        if(++adaptExt->requests < adaptExt->queue_depth) {
+        srbExt->call_next = FALSE;
+        if(num_free < VIRTIO_MAX_SG) {
+           srbExt->call_next = TRUE;
+        } else {
            ScsiPortNotification(NextLuRequest, DeviceExtension, Srb->PathId, Srb->TargetId, Srb->Lun);
         }
-        return TRUE;
     }
-    return FALSE;
+    return TRUE;
 }
 #endif
 

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2009-11-16 19:54 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-11-16 19:54 [PATCH] viostor driver. XP driver performance improvement Vadim Rozenfeld

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox