From mboxrd@z Thu Jan 1 00:00:00 1970 From: Qin Chuanyu Subject: [PATCH] virtio: make udp more efficient by avoiding indirect desc Date: Tue, 11 Feb 2014 22:58:52 +0800 Message-ID: <52FA3AAC.2050003@huawei.com> Mime-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1"; format=flowed Content-Transfer-Encoding: 7bit Cc: "Michael S. Tsirkin" , , KVM list To: Return-path: Received: from szxga03-in.huawei.com ([119.145.14.66]:26220 "EHLO szxga03-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750787AbaBKO7F (ORCPT ); Tue, 11 Feb 2014 09:59:05 -0500 Sender: kvm-owner@vger.kernel.org List-ID: udp packet use 2 buffers at least, one for vnet_hdr and one for skb->data. we could change the threshold from 2 to 3, so the udp packet which data buff only using single desc will gain from this. the guest would avoid from allocating memory dynamically. the host would avoid from translating indirect desc. Signed-off-by: Chuanyu Qin --- drivers/virtio/virtio_ring.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c index 28b5338..88d008f 100644 --- a/drivers/virtio/virtio_ring.c +++ b/drivers/virtio/virtio_ring.c @@ -220,7 +220,7 @@ static inline int virtqueue_add(struct virtqueue *_vq, /* If the host supports indirect descriptor tables, and we have multiple * buffers, then go indirect. FIXME: tune this threshold */ - if (vq->indirect && total_sg > 1 && vq->vq.num_free) { + if (vq->indirect && total_sg > 2 && vq->vq.num_free) { head = vring_add_indirect(vq, sgs, next, total_sg, total_out, total_in, out_sgs, in_sgs, gfp); -- 1.7.3.1.msysgit.0