public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Vadim Rozenfeld <vrozenfe@redhat.com>
To: kvm <kvm@vger.kernel.org>
Subject: [PATCH] viostor driver. XP driver performance improvement.
Date: Mon, 16 Nov 2009 21:54:57 +0200	[thread overview]
Message-ID: <4B01AE11.2000903@redhat.com> (raw)

[-- 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
 

                 reply	other threads:[~2009-11-16 19:54 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4B01AE11.2000903@redhat.com \
    --to=vrozenfe@redhat.com \
    --cc=kvm@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox