From patchwork Sun Oct 25 11:13:36 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vadim Rozenfeld X-Patchwork-Id: 55743 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n9PBDwZ8004771 for ; Sun, 25 Oct 2009 11:13:58 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753356AbZJYLNw (ORCPT ); Sun, 25 Oct 2009 07:13:52 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753354AbZJYLNv (ORCPT ); Sun, 25 Oct 2009 07:13:51 -0400 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 Message-ID: <4AE432E0.3070006@redhat.com> Date: Sun, 25 Oct 2009 13:13:36 +0200 From: Vadim Rozenfeld User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.4pre) Gecko/20091014 Fedora/3.0-2.8.b4.fc11 Thunderbird/3.0b4 MIME-Version: 1.0 To: kvm@vger.kernel.org Subject: [PATCH] viostor driver. switch to full-duplex mode. X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org 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; }