Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
64d09888
Commit
64d09888
authored
Apr 16, 2012
by
Michael S. Tsirkin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
virtio/tools: add delayed interupt mode
Signed-off-by:
Michael S. Tsirkin
<
mst@redhat.com
>
parent
e4ae004b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
4 deletions
+23
-4
tools/virtio/linux/virtio.h
tools/virtio/linux/virtio.h
+1
-0
tools/virtio/virtio_test.c
tools/virtio/virtio_test.c
+22
-4
No files found.
tools/virtio/linux/virtio.h
View file @
64d09888
...
...
@@ -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
,
...
...
tools/virtio/virtio_test.c
View file @
64d09888
...
...
@@ -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
;
...
...
@@ -215,6 +220,14 @@ const struct option longopts[] = {
.
name
=
"no-indirect"
,
.
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
;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment