summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2012-05-08 07:05:13 +0400
committerDavid S. Miller <davem@davemloft.net>2012-05-08 07:05:26 +0400
commit6e06c0e2347ec79d0bd5702b2438fe883f784545 (patch)
tree3f55976275c94822cd406e7edc549f668901affa /tools
parent3a084ddb4bf299a6e898a9a07c89f3917f0713f7 (diff)
parentc70aa540c7a9f67add11ad3161096fb95233aa2e (diff)
downloadlinux-6e06c0e2347ec79d0bd5702b2438fe883f784545.tar.xz
Merge branch 'vhost-net-next' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost
Michael S. Tsirkin says: -------------------- There are mostly bugfixes here. I hope to merge some more patches by 3.5, in particular vlan support fixes are waiting for Eric's ack, and a version of tracepoint patch might be ready in time, but let's merge what's ready so it's testable. This includes a ton of zerocopy fixes by Jason - good stuff but too intrusive for 3.4 and zerocopy is experimental anyway. virtio supported delayed interrupt for a while now so adding support to the virtio tool made sense -------------------- Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'tools')
-rw-r--r--tools/virtio/linux/virtio.h1
-rw-r--r--tools/virtio/virtio_test.c26
2 files changed, 23 insertions, 4 deletions
diff --git a/tools/virtio/linux/virtio.h b/tools/virtio/linux/virtio.h
index 7579f19e61e0..81847dd08bd0 100644
--- a/tools/virtio/linux/virtio.h
+++ b/tools/virtio/linux/virtio.h
@@ -203,6 +203,7 @@ void *virtqueue_get_buf(struct virtqueue *vq, unsigned int *len);
void virtqueue_disable_cb(struct virtqueue *vq);
bool virtqueue_enable_cb(struct virtqueue *vq);
+bool virtqueue_enable_cb_delayed(struct virtqueue *vq);
void *virtqueue_detach_unused_buf(struct virtqueue *vq);
struct virtqueue *vring_new_virtqueue(unsigned int num,
diff --git a/tools/virtio/virtio_test.c b/tools/virtio/virtio_test.c
index 6bf95f995364..e626fa553c5a 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;
}