diff options
author | Michael S. Tsirkin <mst@redhat.com> | 2009-12-24 14:46:29 +0200 |
---|---|---|
committer | Anthony Liguori <aliguori@us.ibm.com> | 2010-01-08 09:58:40 -0600 |
commit | ceb696159d569db5b2a7659ce38752398c236742 (patch) | |
tree | a3314395ea15958581352493bde96eb9b529291c /net | |
parent | c9f398e53fedb88df243e32eb9bc50fda4ec44d0 (diff) | |
download | hqemu-ceb696159d569db5b2a7659ce38752398c236742.zip hqemu-ceb696159d569db5b2a7659ce38752398c236742.tar.gz |
net: add API to disable/enable polling
When vhost is bound to a backend device, we need to stop polling it when
vhost is started, and restart polling when vhost is stopped.
Add an API for that for use by vhost, and implement in tap backend.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'net')
-rw-r--r-- | net/tap.c | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -262,6 +262,13 @@ static void tap_cleanup(VLANClientState *nc) close(s->fd); } +static void tap_poll(VLANClientState *nc, bool enable) +{ + TAPState *s = DO_UPCAST(TAPState, nc, nc); + tap_read_poll(s, enable); + tap_write_poll(s, enable); +} + /* fd support */ static NetClientInfo net_tap_info = { @@ -270,6 +277,7 @@ static NetClientInfo net_tap_info = { .receive = tap_receive, .receive_raw = tap_receive_raw, .receive_iov = tap_receive_iov, + .poll = tap_poll, .cleanup = tap_cleanup, }; |