aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
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 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)
144 } 144 }
145} 145}
146 146
147static void run_test(struct vdev_info *dev, struct vq_info *vq, int bufs) 147static void run_test(struct vdev_info *dev, struct vq_info *vq,
148 bool delayed, int bufs)
148{ 149{
149 struct scatterlist sl; 150 struct scatterlist sl;
150 long started = 0, completed = 0; 151 long started = 0, completed = 0;
@@ -183,8 +184,12 @@ static void run_test(struct vdev_info *dev, struct vq_info *vq, int bufs)
183 assert(started <= bufs); 184 assert(started <= bufs);
184 if (completed == bufs) 185 if (completed == bufs)
185 break; 186 break;
186 if (virtqueue_enable_cb(vq->vq)) { 187 if (delayed) {
187 wait_for_interrupt(dev); 188 if (virtqueue_enable_cb_delayed(vq->vq))
189 wait_for_interrupt(dev);
190 } else {
191 if (virtqueue_enable_cb(vq->vq))
192 wait_for_interrupt(dev);
188 } 193 }
189 } 194 }
190 test = 0; 195 test = 0;
@@ -216,6 +221,14 @@ const struct option longopts[] = {
216 .val = 'i', 221 .val = 'i',
217 }, 222 },
218 { 223 {
224 .name = "delayed-interrupt",
225 .val = 'D',
226 },
227 {
228 .name = "no-delayed-interrupt",
229 .val = 'd',
230 },
231 {
219 } 232 }
220}; 233};
221 234
@@ -224,6 +237,7 @@ static void help()
224 fprintf(stderr, "Usage: virtio_test [--help]" 237 fprintf(stderr, "Usage: virtio_test [--help]"
225 " [--no-indirect]" 238 " [--no-indirect]"
226 " [--no-event-idx]" 239 " [--no-event-idx]"
240 " [--delayed-interrupt]"
227 "\n"); 241 "\n");
228} 242}
229 243
@@ -233,6 +247,7 @@ int main(int argc, char **argv)
233 unsigned long long features = (1ULL << VIRTIO_RING_F_INDIRECT_DESC) | 247 unsigned long long features = (1ULL << VIRTIO_RING_F_INDIRECT_DESC) |
234 (1ULL << VIRTIO_RING_F_EVENT_IDX); 248 (1ULL << VIRTIO_RING_F_EVENT_IDX);
235 int o; 249 int o;
250 bool delayed = false;
236 251
237 for (;;) { 252 for (;;) {
238 o = getopt_long(argc, argv, optstring, longopts, NULL); 253 o = getopt_long(argc, argv, optstring, longopts, NULL);
@@ -251,6 +266,9 @@ int main(int argc, char **argv)
251 case 'i': 266 case 'i':
252 features &= ~(1ULL << VIRTIO_RING_F_INDIRECT_DESC); 267 features &= ~(1ULL << VIRTIO_RING_F_INDIRECT_DESC);
253 break; 268 break;
269 case 'D':
270 delayed = true;
271 break;
254 default: 272 default:
255 assert(0); 273 assert(0);
256 break; 274 break;
@@ -260,6 +278,6 @@ int main(int argc, char **argv)
260done: 278done:
261 vdev_info_init(&dev, features); 279 vdev_info_init(&dev, features);
262 vq_info_add(&dev, 256); 280 vq_info_add(&dev, 256);
263 run_test(&dev, &dev.vqs[0], 0x100000); 281 run_test(&dev, &dev.vqs[0], delayed, 0x100000);
264 return 0; 282 return 0;
265} 283}