Commit cf994e0a authored by Rusty Russell's avatar Rusty Russell

tools/virtio: remove virtqueue_add_buf() from tests.

Make the rest of the paths use virtqueue_add_sgs or add_outbuf.
Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
parent 0b36f1ad
...@@ -49,13 +49,6 @@ struct virtqueue { ...@@ -49,13 +49,6 @@ struct virtqueue {
const char *__MODULE_LICENSE_name = __MODULE_LICENSE_value const char *__MODULE_LICENSE_name = __MODULE_LICENSE_value
/* Interfaces exported by virtio_ring. */ /* Interfaces exported by virtio_ring. */
int virtqueue_add_buf(struct virtqueue *vq,
struct scatterlist sg[],
unsigned int out_num,
unsigned int in_num,
void *data,
gfp_t gfp);
int virtqueue_add_sgs(struct virtqueue *vq, int virtqueue_add_sgs(struct virtqueue *vq,
struct scatterlist *sgs[], struct scatterlist *sgs[],
unsigned int out_sgs, unsigned int out_sgs,
......
...@@ -166,9 +166,9 @@ static void run_test(struct vdev_info *dev, struct vq_info *vq, ...@@ -166,9 +166,9 @@ static void run_test(struct vdev_info *dev, struct vq_info *vq,
do { do {
if (started < bufs) { if (started < bufs) {
sg_init_one(&sl, dev->buf, dev->buf_size); sg_init_one(&sl, dev->buf, dev->buf_size);
r = virtqueue_add_buf(vq->vq, &sl, 1, 0, r = virtqueue_add_outbuf(vq->vq, &sl, 1,
dev->buf + started, dev->buf + started,
GFP_ATOMIC); GFP_ATOMIC);
if (likely(r == 0)) { if (likely(r == 0)) {
++started; ++started;
virtqueue_kick(vq->vq); virtqueue_kick(vq->vq);
......
...@@ -388,7 +388,7 @@ static int parallel_test(unsigned long features, ...@@ -388,7 +388,7 @@ static int parallel_test(unsigned long features,
} }
if (err) if (err)
errx(1, "virtqueue_add_buf: %i", err); errx(1, "virtqueue_add_in/outbuf: %i", err);
xfers++; xfers++;
virtqueue_kick(vq); virtqueue_kick(vq);
...@@ -431,7 +431,7 @@ int main(int argc, char *argv[]) ...@@ -431,7 +431,7 @@ int main(int argc, char *argv[])
struct virtio_device vdev; struct virtio_device vdev;
struct virtqueue *vq; struct virtqueue *vq;
struct vringh vrh; struct vringh vrh;
struct scatterlist guest_sg[RINGSIZE]; struct scatterlist guest_sg[RINGSIZE], *sgs[2];
struct iovec host_riov[2], host_wiov[2]; struct iovec host_riov[2], host_wiov[2];
struct vringh_iov riov, wiov; struct vringh_iov riov, wiov;
struct vring_used_elem used[RINGSIZE]; struct vring_used_elem used[RINGSIZE];
...@@ -492,12 +492,14 @@ int main(int argc, char *argv[]) ...@@ -492,12 +492,14 @@ int main(int argc, char *argv[])
sg_set_buf(&guest_sg[0], __user_addr_max - 1, 1); sg_set_buf(&guest_sg[0], __user_addr_max - 1, 1);
sg_init_table(guest_sg+1, 1); sg_init_table(guest_sg+1, 1);
sg_set_buf(&guest_sg[1], __user_addr_max - 3, 2); sg_set_buf(&guest_sg[1], __user_addr_max - 3, 2);
sgs[0] = &guest_sg[0];
sgs[1] = &guest_sg[1];
/* May allocate an indirect, so force it to allocate user addr */ /* May allocate an indirect, so force it to allocate user addr */
__kmalloc_fake = __user_addr_min + vring_size(RINGSIZE, ALIGN); __kmalloc_fake = __user_addr_min + vring_size(RINGSIZE, ALIGN);
err = virtqueue_add_buf(vq, guest_sg, 1, 1, &err, GFP_KERNEL); err = virtqueue_add_sgs(vq, sgs, 1, 1, &err, GFP_KERNEL);
if (err) if (err)
errx(1, "virtqueue_add_buf: %i", err); errx(1, "virtqueue_add_sgs: %i", err);
__kmalloc_fake = NULL; __kmalloc_fake = NULL;
/* Host retreives it. */ /* Host retreives it. */
...@@ -564,9 +566,9 @@ int main(int argc, char *argv[]) ...@@ -564,9 +566,9 @@ int main(int argc, char *argv[])
/* This will allocate an indirect, so force it to allocate user addr */ /* This will allocate an indirect, so force it to allocate user addr */
__kmalloc_fake = __user_addr_min + vring_size(RINGSIZE, ALIGN); __kmalloc_fake = __user_addr_min + vring_size(RINGSIZE, ALIGN);
err = virtqueue_add_buf(vq, guest_sg, RINGSIZE, 0, &err, GFP_KERNEL); err = virtqueue_add_outbuf(vq, guest_sg, RINGSIZE, &err, GFP_KERNEL);
if (err) if (err)
errx(1, "virtqueue_add_buf (large): %i", err); errx(1, "virtqueue_add_outbuf (large): %i", err);
__kmalloc_fake = NULL; __kmalloc_fake = NULL;
/* Host picks it up (allocates new iov). */ /* Host picks it up (allocates new iov). */
...@@ -616,9 +618,9 @@ int main(int argc, char *argv[]) ...@@ -616,9 +618,9 @@ int main(int argc, char *argv[])
sg_init_table(guest_sg, 1); sg_init_table(guest_sg, 1);
sg_set_buf(&guest_sg[0], __user_addr_max - 1, 1); sg_set_buf(&guest_sg[0], __user_addr_max - 1, 1);
for (i = 0; i < RINGSIZE; i++) { for (i = 0; i < RINGSIZE; i++) {
err = virtqueue_add_buf(vq, guest_sg, 1, 0, &err, GFP_KERNEL); err = virtqueue_add_outbuf(vq, guest_sg, 1, &err, GFP_KERNEL);
if (err) if (err)
errx(1, "virtqueue_add_buf (multiple): %i", err); errx(1, "virtqueue_add_outbuf (multiple): %i", err);
} }
/* Now get many, and consume them all at once. */ /* Now get many, and consume them all at once. */
...@@ -664,9 +666,9 @@ int main(int argc, char *argv[]) ...@@ -664,9 +666,9 @@ int main(int argc, char *argv[])
sg_set_buf(&guest_sg[2], data + 6, 4); sg_set_buf(&guest_sg[2], data + 6, 4);
sg_set_buf(&guest_sg[3], d + 3, sizeof(*d)*3); sg_set_buf(&guest_sg[3], d + 3, sizeof(*d)*3);
err = virtqueue_add_buf(vq, guest_sg, 4, 0, &err, GFP_KERNEL); err = virtqueue_add_outbuf(vq, guest_sg, 4, &err, GFP_KERNEL);
if (err) if (err)
errx(1, "virtqueue_add_buf (indirect): %i", err); errx(1, "virtqueue_add_outbuf (indirect): %i", err);
vring_init(&vring, RINGSIZE, __user_addr_min, ALIGN); vring_init(&vring, RINGSIZE, __user_addr_min, ALIGN);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment