All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vadim Rozenfeld <vrozenfe@redhat.com>
To: kvm@vger.kernel.org
Subject: [PATCH] viostor driver. switch to full-duplex mode.
Date: Sun, 25 Oct 2009 13:13:36 +0200	[thread overview]
Message-ID: <4AE432E0.3070006@redhat.com> (raw)

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

                 reply	other threads:[~2009-10-25 11:13 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=4AE432E0.3070006@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 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.