diff mbox

viostor driver. XP driver performance improvement.

Message ID 4B01AE11.2000903@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Vadim Rozenfeld Nov. 16, 2009, 7:54 p.m. UTC
None
diff mbox

Patch

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