All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] viostor driver. switch to full-duplex mode.
@ 2009-10-25 11:13 Vadim Rozenfeld
  0 siblings, 0 replies; only message in thread
From: Vadim Rozenfeld @ 2009-10-25 11:13 UTC (permalink / raw)
  To: kvm

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



repository: /home/vadimr/shares/kvm-guest-drivers-windows
branch: master
commit ed4b9ade27b56e9ee37461c2cf72e46d75633e9c
Author: Vadim Rozenfeld<vrozenfe@redhat.com>
Date:   Wed Sep 23 11:28:48 2009 +0300

     [PATCH] viostor driver. switch to full-duplex mode.

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

diff --git a/viostor/virtio_stor.c b/viostor/virtio_stor.c
index e4acaa0..297949a 100644
--- a/viostor/virtio_stor.c
+++ b/viostor/virtio_stor.c
@@ -194,6 +194,7 @@ VirtIoFindAdapter(
      ConfigInfo->WmiDataProvider        = FALSE;
  #ifdef USE_STORPORT
      ConfigInfo->MapBuffers             = STOR_MAP_NON_READ_WRITE_BUFFERS;
+    ConfigInfo->SynchronizationModel   = StorSynchronizeFullDuplex;
  #else
      ConfigInfo->MapBuffers             = TRUE;
  #endif
@@ -323,6 +324,8 @@ VirtIoFindAdapter(
          return SP_RETURN_ERROR;
      }

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

@@ -488,7 +491,7 @@ VirtIoStartIo(
          case SCSIOP_WRITE: {
              Srb->SrbStatus = SRB_STATUS_PENDING;
              if(!RhelDoReadWrite(DeviceExtension, Srb)) {
-                Srb->SrbStatus = SRB_STATUS_ABORTED;
+                Srb->SrbStatus = SRB_STATUS_BUSY;
                  CompleteSRB(DeviceExtension, Srb);
              }
              return TRUE;
@@ -561,7 +564,7 @@ VirtIoInterrupt(
                  Srb->SrbStatus = SRB_STATUS_ERROR;
                  break;
             }
-
+           RemoveEntryList(&vbr->list_entry);
             CompleteSRB(DeviceExtension, Srb);
          }
      }
diff --git a/viostor/virtio_stor.h b/viostor/virtio_stor.h
index 1c0dbb6..2d98738 100644
--- a/viostor/virtio_stor.h
+++ b/viostor/virtio_stor.h
@@ -78,12 +78,8 @@ typedef struct virtio_blk_outhdr {
      u64 sector;
  }blk_outhdr, *pblk_outhdr;

-struct list_head {
-    struct list_head *next, *prev;
-};
-
  typedef struct virtio_blk_req {
-    struct list_head list;
+    LIST_ENTRY list_entry;
      struct request *req;
      blk_outhdr out_hdr;
      u8     status;
@@ -98,6 +94,7 @@ typedef struct _ADAPTER_EXTENSION {
      blk_config            info;
      ULONG                 queue_depth;
      BOOLEAN               dump_mode;
+    LIST_ENTRY            list_head;
  }ADAPTER_EXTENSION, *PADAPTER_EXTENSION;

  typedef struct _RHEL_SRB_EXTENSION {
diff --git a/viostor/virtio_stor_hw_helper.c b/viostor/virtio_stor_hw_helper.c
index 43bde5a..3c09259 100644
--- a/viostor/virtio_stor_hw_helper.c
+++ b/viostor/virtio_stor_hw_helper.c
@@ -15,22 +15,33 @@
  #include "virtio_stor_hw_helper.h"

  #ifdef USE_STORPORT
-BOOLEAN
-RhelDoReadWrite(PVOID DeviceExtension,
-                PSCSI_REQUEST_BLOCK Srb)
+BOOLEAN
+SynchronizedAccessRoutine(
+    IN PVOID DeviceExtension,
+    IN PVOID Context
+    )
  {
      PADAPTER_EXTENSION  adaptExt = (PADAPTER_EXTENSION)DeviceExtension;
+    PSCSI_REQUEST_BLOCK Srb      = (PSCSI_REQUEST_BLOCK) Context;
      PRHEL_SRB_EXTENSION srbExt   = (PRHEL_SRB_EXTENSION)Srb->SrbExtension;
-
      if (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.sg[0],
+                     srbExt->out, srbExt->in,
+&srbExt->vbr) == 0){
+        InsertTailList(&adaptExt->list_head,&srbExt->vbr.list_entry);
          adaptExt->pci_vq_info.vq->vq_ops->kick(adaptExt->pci_vq_info.vq);
          return TRUE;
      }
+    StorPortBusy(DeviceExtension, 10);
      return FALSE;
  }
+
+BOOLEAN
+RhelDoReadWrite(PVOID DeviceExtension,
+                PSCSI_REQUEST_BLOCK Srb)
+{
+    return StorPortSynchronizeAccess(DeviceExtension,SynchronizedAccessRoutine, (PVOID)Srb);
+}
  #else
  BOOLEAN
  RhelDoReadWrite(PVOID DeviceExtension,
@@ -83,6 +94,8 @@ RhelDoReadWrite(PVOID DeviceExtension,
                                        &srbExt->vbr.sg[0],
                                        srbExt->out, srbExt->in,
                                        &srbExt->vbr) == 0) {
+//FIXME
+        InsertTailList(&adaptExt->list_head,&srbExt->vbr.list_entry);
          adaptExt->pci_vq_info.vq->vq_ops->kick(adaptExt->pci_vq_info.vq);
          return TRUE;
      }


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

diff --git a/viostor/virtio_stor.c b/viostor/virtio_stor.c
index e4acaa0..297949a 100644
--- a/viostor/virtio_stor.c
+++ b/viostor/virtio_stor.c
@@ -194,6 +194,7 @@ VirtIoFindAdapter(
     ConfigInfo->WmiDataProvider        = FALSE;
 #ifdef USE_STORPORT
     ConfigInfo->MapBuffers             = STOR_MAP_NON_READ_WRITE_BUFFERS;
+    ConfigInfo->SynchronizationModel   = StorSynchronizeFullDuplex;
 #else
     ConfigInfo->MapBuffers             = TRUE;
 #endif
@@ -323,6 +324,8 @@ VirtIoFindAdapter(
         return SP_RETURN_ERROR;
     }
 
+    InitializeListHead(&adaptExt->list_head);
+
     return SP_RETURN_FOUND;
 }
 
@@ -488,7 +491,7 @@ VirtIoStartIo(
         case SCSIOP_WRITE: {
             Srb->SrbStatus = SRB_STATUS_PENDING;
             if(!RhelDoReadWrite(DeviceExtension, Srb)) {
-                Srb->SrbStatus = SRB_STATUS_ABORTED;
+                Srb->SrbStatus = SRB_STATUS_BUSY;
                 CompleteSRB(DeviceExtension, Srb);
             }
             return TRUE;
@@ -561,7 +564,7 @@ VirtIoInterrupt(
                 Srb->SrbStatus = SRB_STATUS_ERROR;
                 break;
            }
-
+           RemoveEntryList(&vbr->list_entry);
            CompleteSRB(DeviceExtension, Srb);
         }
     }
diff --git a/viostor/virtio_stor.h b/viostor/virtio_stor.h
index 1c0dbb6..2d98738 100644
--- a/viostor/virtio_stor.h
+++ b/viostor/virtio_stor.h
@@ -78,12 +78,8 @@ typedef struct virtio_blk_outhdr {
     u64 sector;
 }blk_outhdr, *pblk_outhdr;
 
-struct list_head {
-    struct list_head *next, *prev;
-};
-
 typedef struct virtio_blk_req {
-    struct list_head list;
+    LIST_ENTRY list_entry;
     struct request *req;
     blk_outhdr out_hdr;
     u8     status;
@@ -98,6 +94,7 @@ typedef struct _ADAPTER_EXTENSION {
     blk_config            info;
     ULONG                 queue_depth;
     BOOLEAN               dump_mode;
+    LIST_ENTRY            list_head;
 }ADAPTER_EXTENSION, *PADAPTER_EXTENSION;
 
 typedef struct _RHEL_SRB_EXTENSION {
diff --git a/viostor/virtio_stor_hw_helper.c b/viostor/virtio_stor_hw_helper.c
index 43bde5a..3c09259 100644
--- a/viostor/virtio_stor_hw_helper.c
+++ b/viostor/virtio_stor_hw_helper.c
@@ -15,22 +15,33 @@
 #include "virtio_stor_hw_helper.h"
 
 #ifdef USE_STORPORT
-BOOLEAN 
-RhelDoReadWrite(PVOID DeviceExtension,
-                PSCSI_REQUEST_BLOCK Srb)
+BOOLEAN
+SynchronizedAccessRoutine(
+    IN PVOID DeviceExtension,
+    IN PVOID Context
+    )
 {
     PADAPTER_EXTENSION  adaptExt = (PADAPTER_EXTENSION)DeviceExtension;
+    PSCSI_REQUEST_BLOCK Srb      = (PSCSI_REQUEST_BLOCK) Context;
     PRHEL_SRB_EXTENSION srbExt   = (PRHEL_SRB_EXTENSION)Srb->SrbExtension;
-
     if (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.sg[0],
+                     srbExt->out, srbExt->in, 
+                     &srbExt->vbr) == 0){ 
+        InsertTailList(&adaptExt->list_head, &srbExt->vbr.list_entry);
         adaptExt->pci_vq_info.vq->vq_ops->kick(adaptExt->pci_vq_info.vq);
         return TRUE;
     }
+    StorPortBusy(DeviceExtension, 10);  
     return FALSE;
 }
+
+BOOLEAN 
+RhelDoReadWrite(PVOID DeviceExtension,
+                PSCSI_REQUEST_BLOCK Srb)
+{
+    return StorPortSynchronizeAccess(DeviceExtension,SynchronizedAccessRoutine, (PVOID)Srb);
+}
 #else
 BOOLEAN 
 RhelDoReadWrite(PVOID DeviceExtension,
@@ -83,6 +94,8 @@ RhelDoReadWrite(PVOID DeviceExtension,
                                       &srbExt->vbr.sg[0],
                                       srbExt->out, srbExt->in, 
                                       &srbExt->vbr) == 0) {
+//FIXME
+        InsertTailList(&adaptExt->list_head, &srbExt->vbr.list_entry);
         adaptExt->pci_vq_info.vq->vq_ops->kick(adaptExt->pci_vq_info.vq);
         return TRUE;
     }

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

only message in thread, other threads:[~2009-10-25 11:13 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-10-25 11:13 [PATCH] viostor driver. switch to full-duplex mode Vadim Rozenfeld

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.