aboutsummaryrefslogtreecommitdiffstats
path: root/tools/virtio/vringh_test.c
diff options
context:
space:
mode:
authorRusty Russell <rusty@rustcorp.com.au>2013-03-20 01:14:30 -0400
committerRusty Russell <rusty@rustcorp.com.au>2013-03-20 01:15:07 -0400
commitcf994e0afae97382c0aa3cbc395805605d07a6e9 (patch)
tree00f90eefa7fbc34c5fb4d06b107af16ce84a74ac /tools/virtio/vringh_test.c
parent0b36f1adcb5adace6d45ca4d9a0f00860e60d012 (diff)
tools/virtio: remove virtqueue_add_buf() from tests.
Make the rest of the paths use virtqueue_add_sgs or add_outbuf. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'tools/virtio/vringh_test.c')
-rw-r--r--tools/virtio/vringh_test.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/tools/virtio/vringh_test.c b/tools/virtio/vringh_test.c
index bb0bd9403e9e..d053ea40c001 100644
--- a/tools/virtio/vringh_test.c
+++ b/tools/virtio/vringh_test.c
@@ -388,7 +388,7 @@ static int parallel_test(unsigned long features,
388 } 388 }
389 389
390 if (err) 390 if (err)
391 errx(1, "virtqueue_add_buf: %i", err); 391 errx(1, "virtqueue_add_in/outbuf: %i", err);
392 392
393 xfers++; 393 xfers++;
394 virtqueue_kick(vq); 394 virtqueue_kick(vq);
@@ -431,7 +431,7 @@ int main(int argc, char *argv[])
431 struct virtio_device vdev; 431 struct virtio_device vdev;
432 struct virtqueue *vq; 432 struct virtqueue *vq;
433 struct vringh vrh; 433 struct vringh vrh;
434 struct scatterlist guest_sg[RINGSIZE]; 434 struct scatterlist guest_sg[RINGSIZE], *sgs[2];
435 struct iovec host_riov[2], host_wiov[2]; 435 struct iovec host_riov[2], host_wiov[2];
436 struct vringh_iov riov, wiov; 436 struct vringh_iov riov, wiov;
437 struct vring_used_elem used[RINGSIZE]; 437 struct vring_used_elem used[RINGSIZE];
@@ -492,12 +492,14 @@ int main(int argc, char *argv[])
492 sg_set_buf(&guest_sg[0], __user_addr_max - 1, 1); 492 sg_set_buf(&guest_sg[0], __user_addr_max - 1, 1);
493 sg_init_table(guest_sg+1, 1); 493 sg_init_table(guest_sg+1, 1);
494 sg_set_buf(&guest_sg[1], __user_addr_max - 3, 2); 494 sg_set_buf(&guest_sg[1], __user_addr_max - 3, 2);
495 sgs[0] = &guest_sg[0];
496 sgs[1] = &guest_sg[1];
495 497
496 /* May allocate an indirect, so force it to allocate user addr */ 498 /* May allocate an indirect, so force it to allocate user addr */
497 __kmalloc_fake = __user_addr_min + vring_size(RINGSIZE, ALIGN); 499 __kmalloc_fake = __user_addr_min + vring_size(RINGSIZE, ALIGN);
498 err = virtqueue_add_buf(vq, guest_sg, 1, 1, &err, GFP_KERNEL); 500 err = virtqueue_add_sgs(vq, sgs, 1, 1, &err, GFP_KERNEL);
499 if (err) 501 if (err)
500 errx(1, "virtqueue_add_buf: %i", err); 502 errx(1, "virtqueue_add_sgs: %i", err);
501 __kmalloc_fake = NULL; 503 __kmalloc_fake = NULL;
502 504
503 /* Host retreives it. */ 505 /* Host retreives it. */
@@ -564,9 +566,9 @@ int main(int argc, char *argv[])
564 566
565 /* This will allocate an indirect, so force it to allocate user addr */ 567 /* This will allocate an indirect, so force it to allocate user addr */
566 __kmalloc_fake = __user_addr_min + vring_size(RINGSIZE, ALIGN); 568 __kmalloc_fake = __user_addr_min + vring_size(RINGSIZE, ALIGN);
567 err = virtqueue_add_buf(vq, guest_sg, RINGSIZE, 0, &err, GFP_KERNEL); 569 err = virtqueue_add_outbuf(vq, guest_sg, RINGSIZE, &err, GFP_KERNEL);
568 if (err) 570 if (err)
569 errx(1, "virtqueue_add_buf (large): %i", err); 571 errx(1, "virtqueue_add_outbuf (large): %i", err);
570 __kmalloc_fake = NULL; 572 __kmalloc_fake = NULL;
571 573
572 /* Host picks it up (allocates new iov). */ 574 /* Host picks it up (allocates new iov). */
@@ -616,9 +618,9 @@ int main(int argc, char *argv[])
616 sg_init_table(guest_sg, 1); 618 sg_init_table(guest_sg, 1);
617 sg_set_buf(&guest_sg[0], __user_addr_max - 1, 1); 619 sg_set_buf(&guest_sg[0], __user_addr_max - 1, 1);
618 for (i = 0; i < RINGSIZE; i++) { 620 for (i = 0; i < RINGSIZE; i++) {
619 err = virtqueue_add_buf(vq, guest_sg, 1, 0, &err, GFP_KERNEL); 621 err = virtqueue_add_outbuf(vq, guest_sg, 1, &err, GFP_KERNEL);
620 if (err) 622 if (err)
621 errx(1, "virtqueue_add_buf (multiple): %i", err); 623 errx(1, "virtqueue_add_outbuf (multiple): %i", err);
622 } 624 }
623 625
624 /* Now get many, and consume them all at once. */ 626 /* Now get many, and consume them all at once. */
@@ -664,9 +666,9 @@ int main(int argc, char *argv[])
664 sg_set_buf(&guest_sg[2], data + 6, 4); 666 sg_set_buf(&guest_sg[2], data + 6, 4);
665 sg_set_buf(&guest_sg[3], d + 3, sizeof(*d)*3); 667 sg_set_buf(&guest_sg[3], d + 3, sizeof(*d)*3);
666 668
667 err = virtqueue_add_buf(vq, guest_sg, 4, 0, &err, GFP_KERNEL); 669 err = virtqueue_add_outbuf(vq, guest_sg, 4, &err, GFP_KERNEL);
668 if (err) 670 if (err)
669 errx(1, "virtqueue_add_buf (indirect): %i", err); 671 errx(1, "virtqueue_add_outbuf (indirect): %i", err);
670 672
671 vring_init(&vring, RINGSIZE, __user_addr_min, ALIGN); 673 vring_init(&vring, RINGSIZE, __user_addr_min, ALIGN);
672 674