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 <[email protected]>
---
 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

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to