From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59918) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XYtyH-0000W8-9q for qemu-devel@nongnu.org; Tue, 30 Sep 2014 05:43:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XYtyB-0002kv-4d for qemu-devel@nongnu.org; Tue, 30 Sep 2014 05:43:49 -0400 Received: from mx1.redhat.com ([209.132.183.28]:44263) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XYtyA-0002k4-To for qemu-devel@nongnu.org; Tue, 30 Sep 2014 05:43:43 -0400 Date: Tue, 30 Sep 2014 12:33:56 +0300 From: "Michael S. Tsirkin" Message-ID: <20140930093356.GA3673@redhat.com> References: <542A6B70.7090607@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <542A6B70.7090607@huawei.com> Subject: Re: [Qemu-devel] [QA-virtio]:Why vring size is limited to 1024? List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Zhangjie (HZ)" Cc: liuyongan@huawei.com, qinchuanyu@huawei.com, Jason Wang , akong@redhat.com, qemu-devel@nongnu.org On Tue, Sep 30, 2014 at 04:36:00PM +0800, Zhangjie (HZ) wrote: > Hi, > There exits packets loss when we do packet forwarding in VM, > especially when we use dpdk to do the forwarding. By enlarging vring > can alleviate the problem. I think this has to do with the fact that dpdk disables checksum offloading, this has the side effect of disabling segmentation offloading. Please fix dpdk to support checksum offloading, and I think the problem will go away. > But now vring size is limited to 1024 as follows: > VirtQueue *virtio_add_queue(VirtIODevice *vdev, int queue_size, > void (*handle_output)(VirtIODevice *, VirtQueue *)) > { > ... > if (i == VIRTIO_PCI_QUEUE_MAX || queue_size > VIRTQUEUE_MAX_SIZE) > abort(); > } > ps:#define VIRTQUEUE_MAX_SIZE 1024 > I delete the judgement code, and set vring size to 2048, > VM can be successfully started, and the network is ok too. > So, Why vring size is limited to 1024 and what is the influence? > > Thanks! There are several reason for this limit. First guest has to allocate descriptor buffer which is 16 * vring size. With 1K size that is already 16K which might be tricky to allocate contigiously if memory is fragmented when device is added by hotplug. The second issue is that we want to be able to implement the device on top of linux kernel, and a single descriptor might use all of the virtqueue. In this case we wont to be able to pass the descriptor directly to linux as a single iov, since that is limited to 1K entries. > -- > Best Wishes! > Zhang Jie