Loading drivers/virtio/virtio_ring.c +13 −3 Original line number Diff line number Diff line Loading @@ -145,6 +145,18 @@ struct vring_virtqueue { #define to_vvq(_vq) container_of(_vq, struct vring_virtqueue, vq) static inline bool virtqueue_use_indirect(struct virtqueue *_vq, unsigned int total_sg) { struct vring_virtqueue *vq = to_vvq(_vq); /* * If the host supports indirect descriptor tables, and we have multiple * buffers, then go indirect. FIXME: tune this threshold */ return (vq->indirect && total_sg > 1 && vq->vq.num_free); } /* * Modern virtio devices have feature bits to specify whether they need a * quirk and bypass the IOMMU. If not there, just use the DMA API. Loading Loading @@ -324,9 +336,7 @@ static inline int virtqueue_add_split(struct virtqueue *_vq, head = vq->free_head; /* 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 (virtqueue_use_indirect(_vq, total_sg)) desc = alloc_indirect_split(_vq, total_sg, gfp); else { desc = NULL; Loading Loading
drivers/virtio/virtio_ring.c +13 −3 Original line number Diff line number Diff line Loading @@ -145,6 +145,18 @@ struct vring_virtqueue { #define to_vvq(_vq) container_of(_vq, struct vring_virtqueue, vq) static inline bool virtqueue_use_indirect(struct virtqueue *_vq, unsigned int total_sg) { struct vring_virtqueue *vq = to_vvq(_vq); /* * If the host supports indirect descriptor tables, and we have multiple * buffers, then go indirect. FIXME: tune this threshold */ return (vq->indirect && total_sg > 1 && vq->vq.num_free); } /* * Modern virtio devices have feature bits to specify whether they need a * quirk and bypass the IOMMU. If not there, just use the DMA API. Loading Loading @@ -324,9 +336,7 @@ static inline int virtqueue_add_split(struct virtqueue *_vq, head = vq->free_head; /* 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 (virtqueue_use_indirect(_vq, total_sg)) desc = alloc_indirect_split(_vq, total_sg, gfp); else { desc = NULL; Loading