From patchwork Mon Sep 21 19:33:49 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vadim Rozenfeld X-Patchwork-Id: 49107 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 n8LJXrTg009716 for ; Mon, 21 Sep 2009 19:33:53 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753318AbZIUTds (ORCPT ); Mon, 21 Sep 2009 15:33:48 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753303AbZIUTds (ORCPT ); Mon, 21 Sep 2009 15:33:48 -0400 Received: from mx1.redhat.com ([209.132.183.28]:41500 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753124AbZIUTdr (ORCPT ); Mon, 21 Sep 2009 15:33:47 -0400 Received: from int-mx03.intmail.prod.int.phx2.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id n8LJXpA9006339 for ; Mon, 21 Sep 2009 15:33:51 -0400 Received: from localhost.localdomain (vpn-10-112.str.redhat.com [10.32.10.112]) by int-mx03.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id n8LJXn3l024652 for ; Mon, 21 Sep 2009 15:33:50 -0400 Date: Mon, 21 Sep 2009 15:33:49 -0400 Message-Id: <200909211933.n8LJXn3l024652@int-mx03.intmail.prod.int.phx2.redhat.com> From: Vadim Rozenfeld Subject: [PATCH] viostor driver. Code cleanup. Getting rid of the Registry stuff. To: kvm@vger.kernel.org X-Producer: Git X-Scanned-By: MIMEDefang 2.67 on 10.5.11.16 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org repository: /home/vadimr/shares/kvm-guest-drivers-windows branch: master commit c3c87da57dae49911b0634022f8c8eb71cdd2df2 Author: Vadim Rozenfeld Date: Mon Sep 21 22:05:51 2009 +0300 [PATCH] viostor driver. Code cleanup. Getting rid of the Registry stuff. Signed-off-by: Vadim Rozenfeld --- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/viostor/virtio_stor.c b/viostor/virtio_stor.c index d528ca9..e4acaa0 100644 --- a/viostor/virtio_stor.c +++ b/viostor/virtio_stor.c @@ -19,13 +19,6 @@ ULONG RhelDbgLevel = TRACE_LEVEL_NONE; BOOLEAN IsCrashDumpMode; -UNICODE_STRING ViostorServicePathUnicode = - RTL_CONSTANT_STRING(VIOSTOR_SERVICE_NAME); - -UNICODE_STRING MaxTransferSizeUnicode = - RTL_CONSTANT_STRING(MAX_TRANSFER_SIZE); - - BOOLEAN VirtIoHwInitialize( IN PVOID DeviceExtension @@ -98,12 +91,6 @@ CompleteSRB( IN PSCSI_REQUEST_BLOCK Srb ); -BOOLEAN -GetMaxTransferSize( - IN PVOID DeviceExtension - ); - - ULONG DriverEntry( IN PVOID DriverObject, @@ -292,32 +279,16 @@ VirtIoFindAdapter( vq_sz = (sizeof(struct vring_virtqueue) + sizeof(PVOID) * pageNum); if(adaptExt->dump_mode) { - adaptExt->breaks_number = 8; - adaptExt->queue_depth = 4; + ConfigInfo->NumberOfPhysicalBreaks = 8; } else { - if(GetMaxTransferSize(DeviceExtension)) { - adaptExt->breaks_number = (adaptExt->transfer_size / 4); - if(pageNum <= (adaptExt->breaks_number * 4)) { - adaptExt->breaks_number = (pageNum / 4); - } - adaptExt->breaks_number = min(adaptExt->breaks_number, 64); - adaptExt->breaks_number = max(adaptExt->breaks_number, 1); - adaptExt->queue_depth = (pageNum / adaptExt->breaks_number) - 1; - adaptExt->queue_depth = max(adaptExt->queue_depth, 1); - } else { - adaptExt->breaks_number = (pageNum / 2); - adaptExt->breaks_number = min(adaptExt->breaks_number, 8); - adaptExt->breaks_number = max(adaptExt->breaks_number, 1); - adaptExt->queue_depth = 4; - } + ConfigInfo->NumberOfPhysicalBreaks = 16; } - ConfigInfo->NumberOfPhysicalBreaks = adaptExt->breaks_number; - ConfigInfo->MaximumTransferLength - = ConfigInfo->NumberOfPhysicalBreaks * PAGE_SIZE; + ConfigInfo->MaximumTransferLength = ConfigInfo->NumberOfPhysicalBreaks * PAGE_SIZE; + adaptExt->queue_depth = pageNum / ConfigInfo->NumberOfPhysicalBreaks - 1; RhelDbgPrint(TRACE_LEVEL_INFORMATION, ("breaks_number = %x queue_depth = %x\n", - adaptExt->breaks_number, + ConfigInfo->NumberOfPhysicalBreaks, adaptExt->queue_depth)); ptr = (ULONG_PTR)ScsiPortGetUncachedExtension(DeviceExtension, ConfigInfo, (PAGE_SIZE + vr_sz + vq_sz)); @@ -1000,67 +971,3 @@ CompleteSRB( Srb->Lun); #endif } - -BOOLEAN -GetMaxTransferSize( - IN PVOID DeviceExtension - ) -{ - - NTSTATUS status; - OBJECT_ATTRIBUTES oa; - HANDLE keyHandle; - RHEL_ULONG_VALUE_PARTIAL_INFO ulongValueInfo; - ULONG ulongValueLength; - PADAPTER_EXTENSION adaptExt; - - adaptExt = (PADAPTER_EXTENSION)DeviceExtension; - - InitializeObjectAttributes(&oa, - &ViostorServicePathUnicode, - OBJ_CASE_INSENSITIVE, - NULL, - NULL); - - status = ZwOpenKey(&keyHandle, - KEY_READ, - &oa); - - if (!NT_SUCCESS(status)) { - RhelDbgPrint(TRACE_LEVEL_ERROR, - ("ReadRegistryValues: Failed to open services key! 0x%x\n", - status)); - return FALSE; - } - - status = ZwQueryValueKey(keyHandle, - &MaxTransferSizeUnicode, - KeyValuePartialInformation, - &ulongValueInfo, - sizeof(ulongValueInfo), - &ulongValueLength); - - if (!NT_SUCCESS(status)) { - RhelDbgPrint(TRACE_LEVEL_ERROR, - ("ReadRegistryValues: Failed to query %wZ value! 0x%x\n", - &MaxTransferSizeUnicode, status)); - ZwClose(keyHandle); - return FALSE; - } - - ASSERT(ulongValueInfo.PartialInfo.Type == REG_SZ); - - switch(*ulongValueInfo.PartialInfo.Data) { - case '0' : adaptExt->transfer_size = 64; break; - case '1' : adaptExt->transfer_size = 128; break; - case '2' : adaptExt->transfer_size = 256; break; - default : adaptExt->transfer_size = 64; break; - } - - RhelDbgPrint(TRACE_LEVEL_INFORMATION, - ("%wZ set to %d\n", &MaxTransferSizeUnicode, - adaptExt->transfer_size)); - - ZwClose(keyHandle); - return TRUE; -} diff --git a/viostor/virtio_stor.h b/viostor/virtio_stor.h index 999405b..1c0dbb6 100644 --- a/viostor/virtio_stor.h +++ b/viostor/virtio_stor.h @@ -50,10 +50,6 @@ typedef struct VirtIOBufferDescriptor VIO_SG, *PVIO_SG; #define VIRTIO_MAX_SG (3+MAX_PHYS_SEGMENTS) #define IO_PORT_LENGTH 0x40 -#define VIOSTOR_SERVICE_NAME L"\\Registry\\Machine\\System\\CurrentControlSet\\Services\\Viostor\\Parameters\\MaxTransferSize" -#define MAX_TRANSFER_SIZE L"default" - - #pragma pack(1) typedef struct virtio_blk_config { /* The capacity (in 512-byte sectors). */ @@ -94,19 +90,12 @@ typedef struct virtio_blk_req { VIO_SG sg[VIRTIO_MAX_SG]; }blk_req, *pblk_req; -typedef struct _RHEL_ULONG_VALUE_PARTIAL_INFO { - KEY_VALUE_PARTIAL_INFORMATION PartialInfo; - UCHAR Buffer[8]; -}RHEL_ULONG_VALUE_PARTIAL_INFO, *PRHEL_ULONG_VALUE_PARTIAL_INFO; - typedef struct _ADAPTER_EXTENSION { ULONG_PTR device_base; virtio_pci_vq_info pci_vq_info; vring_virtqueue* virtqueue; INQUIRYDATA inquiry_data; blk_config info; - ULONG breaks_number; - ULONG transfer_size; ULONG queue_depth; BOOLEAN dump_mode; }ADAPTER_EXTENSION, *PADAPTER_EXTENSION; diff --git a/viostor/wlh.inf b/viostor/wlh.inf index 8c64191..aae425a 100644 --- a/viostor/wlh.inf +++ b/viostor/wlh.inf @@ -85,14 +85,6 @@ HKR,,TypesSupported,%REG_DWORD%,7 [pnpsafe_pci_addreg] HKR, "Parameters\PnpInterface", "5", %REG_DWORD%, 0x00000001 HKR, "Parameters", "BusType", %REG_DWORD%, 0x00000001 -;HKR, "Parameters", "MaxTransferSize", %REG_DWORD%, 0x0000040 - -HKR, "Parameters\MaxTransferSize", ParamDesc, 0, "Maximum Transfer Size" -HKR, "Parameters\MaxTransferSize", type, 0, "enum" -HKR, "Parameters\MaxTransferSize", default, 0, "0" -HKR, "Parameters\MaxTransferSize\enum", "0", 0, "64 KB" -HKR, "Parameters\MaxTransferSize\enum", "1", 0, "128 KB" -HKR, "Parameters\MaxTransferSize\enum", "2", 0, "256 KB" [Strings] ; diff --git a/viostor/wnet.inf b/viostor/wnet.inf index 8c64191..aae425a 100644 --- a/viostor/wnet.inf +++ b/viostor/wnet.inf @@ -85,14 +85,6 @@ HKR,,TypesSupported,%REG_DWORD%,7 [pnpsafe_pci_addreg] HKR, "Parameters\PnpInterface", "5", %REG_DWORD%, 0x00000001 HKR, "Parameters", "BusType", %REG_DWORD%, 0x00000001 -;HKR, "Parameters", "MaxTransferSize", %REG_DWORD%, 0x0000040 - -HKR, "Parameters\MaxTransferSize", ParamDesc, 0, "Maximum Transfer Size" -HKR, "Parameters\MaxTransferSize", type, 0, "enum" -HKR, "Parameters\MaxTransferSize", default, 0, "0" -HKR, "Parameters\MaxTransferSize\enum", "0", 0, "64 KB" -HKR, "Parameters\MaxTransferSize\enum", "1", 0, "128 KB" -HKR, "Parameters\MaxTransferSize\enum", "2", 0, "256 KB" [Strings] ;