Received: from eggs.gnu.org ([2001:4830:134:3::10]:59580) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VlIvy-0005BI-6t for qemu-devel@nongnu.org; Tue, 26 Nov 2013 08:44:16 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VlIvs-00026g-7X for qemu-devel@nongnu.org; Tue, 26 Nov 2013 08:44:10 -0500 Received: from mx1.redhat.com ([209.132.183.28]:54226) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VlIvr-00026c-Vx for qemu-devel@nongnu.org; Tue, 26 Nov 2013 08:44:04 -0500 From: Amos Kong Date: Tue, 26 Nov 2013 21:43:53 +0800 Message-Id: <1385473433-15844-1-git-send-email-akong@redhat.com> Subject: [Qemu-devel] [PATCH] virtio-rng: correct the default limit rate List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: amit.shah@redhat.com, pbonzini@redhat.com, anthony@codemonkey.ws We have the following comment about the default limit rate: /* Set a default rate limit of 2^47 bytes per minute or roughly 2TB/s. If * you have an entropy source capable of generating more entropy than this * and you can pass it through via virtio-rng, then hats off to you. Until * then, this is unlimited for all practical purposes. */ But the current rate is (INT64_MAX) bytes per (1 << 16) ms, it's 128,000 TB/s 2TB/s is a reasonable rate, so this patch fixes the code, not update the document. * change the default period to 60,000 ms --> 1 mins * change the default max-bytes to 2^47 bytes --> INT64_MAX >> 16 INT64_MAX = 0x 8000 0000 0000 0000 - 1 = 2 ^ 63 - 1 INT64_MAX >> 16 = 0x 8000 0000 0000 - 1 = 2 ^ 47 Signed-off-by: Amos Kong --- include/hw/virtio/virtio-rng.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/hw/virtio/virtio-rng.h b/include/hw/virtio/virtio-rng.h index debaa15..d64e804 100644 --- a/include/hw/virtio/virtio-rng.h +++ b/include/hw/virtio/virtio-rng.h @@ -53,7 +53,7 @@ typedef struct VirtIORNG { */ #define DEFINE_VIRTIO_RNG_PROPERTIES(_state, _conf_field) \ DEFINE_PROP_UINT64("max-bytes", _state, _conf_field.max_bytes, \ - INT64_MAX), \ - DEFINE_PROP_UINT32("period", _state, _conf_field.period_ms, 1 << 16) + INT64_MAX >> 16), \ + DEFINE_PROP_UINT32("period", _state, _conf_field.period_ms, 60000) #endif -- 1.8.3.1