summaryrefslogtreecommitdiffstats
path: root/tools/virtio/virtio_test.c
diff options
context:
space:
mode:
authorMichael S. Tsirkin <mst@redhat.com>2012-04-16 10:11:12 -0400
committerMichael S. Tsirkin <mst@redhat.com>2012-05-02 18:22:14 +0300
commit64d098886e0ec01f88349fe757161c2e2e89086b (patch)
tree88f3daa1187f1fa8e84c56859fc4e2adc81b0e95 /tools/virtio/virtio_test.c
parente4ae004b84b315dd4b762e474f97403eac70f76a (diff)
downloadop-kernel-dev-64d098886e0ec01f88349fe757161c2e2e89086b.zip
op-kernel-dev-64d098886e0ec01f88349fe757161c2e2e89086b.tar.gz
virtio/tools: add delayed interupt mode
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'tools/virtio/virtio_test.c')
-rw-r--r--tools/virtio/virtio_test.c26
1 files changed, 22 insertions, 4 deletions
diff --git a/tools/virtio/virtio_test.c b/tools/virtio/virtio_test.c
index 6bf95f9..e626fa5 100644
--- a/tools/virtio/virtio_test.c
+++ b/tools/virtio/virtio_test.c
@@ -144,7 +144,8 @@ static void wait_for_interrupt(struct vdev_info *dev)
}
}
-static void run_test(struct vdev_info *dev, struct vq_info *vq, int bufs)
+static void run_test(struct vdev_info *dev, struct vq_info *vq,
+ bool delayed, int bufs)
{
struct scatterlist sl;
long started = 0, completed = 0;
@@ -183,8 +184,12 @@ static void run_test(struct vdev_info *dev, struct vq_info *vq, int bufs)
assert(started <= bufs);
if (completed == bufs)
break;
- if (virtqueue_enable_cb(vq->vq)) {
- wait_for_interrupt(dev);
+ if (delayed) {
+ if (virtqueue_enable_cb_delayed(vq->vq))
+ wait_for_interrupt(dev);
+ } else {
+ if (virtqueue_enable_cb(vq->vq))
+ wait_for_interrupt(dev);
}
}
test = 0;
@@ -216,6 +221,14 @@ const struct option longopts[] = {
.val = 'i',
},
{
+ .name = "delayed-interrupt",
+ .val = 'D',
+ },
+ {
+ .name = "no-delayed-interrupt",
+ .val = 'd',
+ },
+ {
}
};
@@ -224,6 +237,7 @@ static void help()
fprintf(stderr, "Usage: virtio_test [--help]"
" [--no-indirect]"
" [--no-event-idx]"
+ " [--delayed-interrupt]"
"\n");
}
@@ -233,6 +247,7 @@ int main(int argc, char **argv)
unsigned long long features = (1ULL << VIRTIO_RING_F_INDIRECT_DESC) |
(1ULL << VIRTIO_RING_F_EVENT_IDX);
int o;
+ bool delayed = false;
for (;;) {
o = getopt_long(argc, argv, optstring, longopts, NULL);
@@ -251,6 +266,9 @@ int main(int argc, char **argv)
case 'i':
features &= ~(1ULL << VIRTIO_RING_F_INDIRECT_DESC);
break;
+ case 'D':
+ delayed = true;
+ break;
default:
assert(0);
break;
@@ -260,6 +278,6 @@ int main(int argc, char **argv)
done:
vdev_info_init(&dev, features);
vq_info_add(&dev, 256);
- run_test(&dev, &dev.vqs[0], 0x100000);
+ run_test(&dev, &dev.vqs[0], delayed, 0x100000);
return 0;
}
OpenPOWER on IntegriCloud