From mboxrd@z Thu Jan 1 00:00:00 1970 From: Vadim Rozenfeld Subject: [PATCH] viostor driver. switch to full-duplex mode. Date: Sun, 25 Oct 2009 13:13:36 +0200 Message-ID: <4AE432E0.3070006@redhat.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------000707020106070109080002" To: kvm@vger.kernel.org Return-path: Received: from mx1.redhat.com ([209.132.183.28]:56636 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753347AbZJYLNv (ORCPT ); Sun, 25 Oct 2009 07:13:51 -0400 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id n9PBDuaY016481 for ; Sun, 25 Oct 2009 07:13:56 -0400 Received: from localhost.localdomain (vpn-10-20.str.redhat.com [10.32.10.20]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id n9PBDcIC025264 for ; Sun, 25 Oct 2009 07:13:40 -0400 Sender: kvm-owner@vger.kernel.org List-ID: This is a multi-part message in MIME format. --------------000707020106070109080002 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit repository: /home/vadimr/shares/kvm-guest-drivers-windows branch: master commit ed4b9ade27b56e9ee37461c2cf72e46d75633e9c Author: Vadim Rozenfeld Date: Wed Sep 23 11:28:48 2009 +0300 [PATCH] viostor driver. switch to full-duplex mode. Signed-off-by: Vadim Rozenfeld 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; } --------------000707020106070109080002 Content-Type: text/plain; name="switch_to_full_duplex_mode.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="switch_to_full_duplex_mode.patch" 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; } --------------000707020106070109080002--