From patchwork Mon Nov 16 19:54:57 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vadim Rozenfeld X-Patchwork-Id: 60475 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 nAGJtNNJ002297 for ; Mon, 16 Nov 2009 19:55:23 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753241AbZKPTyx (ORCPT ); Mon, 16 Nov 2009 14:54:53 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753703AbZKPTyx (ORCPT ); Mon, 16 Nov 2009 14:54:53 -0500 Received: from mx1.redhat.com ([209.132.183.28]:22573 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752877AbZKPTyw (ORCPT ); Mon, 16 Nov 2009 14:54:52 -0500 Received: from int-mx05.intmail.prod.int.phx2.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.18]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id nAGJsxcq012921 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 16 Nov 2009 14:54:59 -0500 Received: from localhost.localdomain (vpn-6-192.tlv.redhat.com [10.35.6.192]) by int-mx05.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id nAGJsvRx018999 for ; Mon, 16 Nov 2009 14:54:58 -0500 Message-ID: <4B01AE11.2000903@redhat.com> Date: Mon, 16 Nov 2009 21:54:57 +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 Subject: [PATCH] viostor driver. XP driver performance improvement. X-Scanned-By: MIMEDefang 2.67 on 10.5.11.18 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org 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