aboutsummaryrefslogtreecommitdiffstats
path: root/tools/virtio
diff options
context:
space:
mode:
authorRusty Russell <rusty@rustcorp.com.au>2013-03-20 01:07:09 -0400
committerRusty Russell <rusty@rustcorp.com.au>2013-03-20 01:13:29 -0400
commit13816c768d46586e925b22736992258d6105ad2c (patch)
treefffb6c71e49b040f532885e6311c5d4886c5d219 /tools/virtio
parentc8164d8931fdee9ac5314708c4071adf1d997425 (diff)
virtio_ring: virtqueue_add_sgs, to add multiple sgs.
virtio_scsi can really use this, to avoid the current hack of copying the whole sg array. Some other things get slightly neater, too. This causes a slowdown in virtqueue_add_buf(), which is implemented as a wrapper. This is addressed in the next patches. for i in `seq 50`; do /usr/bin/time -f 'Wall time:%e' ./vringh_test --indirect --eventidx --parallel --fast-vringh; done 2>&1 | stats --trim-outliers: Before: Using CPUS 0 and 3 Guest: notified 0, pinged 39009-39063(39062) Host: notified 39009-39063(39062), pinged 0 Wall time:1.700000-1.950000(1.723542) After: Using CPUS 0 and 3 Guest: notified 0, pinged 39062-39063(39063) Host: notified 39062-39063(39063), pinged 0 Wall time:1.760000-2.220000(1.789167) Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> Reviewed-by: Wanlong Gao <gaowanlong@cn.fujitsu.com> Reviewed-by: Asias He <asias@redhat.com>
Diffstat (limited to 'tools/virtio')
-rw-r--r--tools/virtio/linux/scatterlist.h16
-rw-r--r--tools/virtio/linux/virtio.h7
2 files changed, 23 insertions, 0 deletions
diff --git a/tools/virtio/linux/scatterlist.h b/tools/virtio/linux/scatterlist.h
index b2cf7d0f6133..68c9e2adc996 100644
--- a/tools/virtio/linux/scatterlist.h
+++ b/tools/virtio/linux/scatterlist.h
@@ -125,6 +125,22 @@ static inline void sg_mark_end(struct scatterlist *sg)
125 sg->page_link &= ~0x01; 125 sg->page_link &= ~0x01;
126} 126}
127 127
128/**
129 * sg_unmark_end - Undo setting the end of the scatterlist
130 * @sg: SG entryScatterlist
131 *
132 * Description:
133 * Removes the termination marker from the given entry of the scatterlist.
134 *
135 **/
136static inline void sg_unmark_end(struct scatterlist *sg)
137{
138#ifdef CONFIG_DEBUG_SG
139 BUG_ON(sg->sg_magic != SG_MAGIC);
140#endif
141 sg->page_link &= ~0x02;
142}
143
128static inline struct scatterlist *sg_next(struct scatterlist *sg) 144static inline struct scatterlist *sg_next(struct scatterlist *sg)
129{ 145{
130#ifdef CONFIG_DEBUG_SG 146#ifdef CONFIG_DEBUG_SG
diff --git a/tools/virtio/linux/virtio.h b/tools/virtio/linux/virtio.h
index e4af6591f5ff..5fa612ad932c 100644
--- a/tools/virtio/linux/virtio.h
+++ b/tools/virtio/linux/virtio.h
@@ -56,6 +56,13 @@ int virtqueue_add_buf(struct virtqueue *vq,
56 void *data, 56 void *data,
57 gfp_t gfp); 57 gfp_t gfp);
58 58
59int virtqueue_add_sgs(struct virtqueue *vq,
60 struct scatterlist *sgs[],
61 unsigned int out_sgs,
62 unsigned int in_sgs,
63 void *data,
64 gfp_t gfp);
65
59void virtqueue_kick(struct virtqueue *vq); 66void virtqueue_kick(struct virtqueue *vq);
60 67
61void *virtqueue_get_buf(struct virtqueue *vq, unsigned int *len); 68void *virtqueue_get_buf(struct virtqueue *vq, unsigned int *len);