From ceb696159d569db5b2a7659ce38752398c236742 Mon Sep 17 00:00:00 2001 From: "Michael S. Tsirkin" Date: Thu, 24 Dec 2009 14:46:29 +0200 Subject: 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 Signed-off-by: Anthony Liguori --- net/tap.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'net') diff --git a/net/tap.c b/net/tap.c index 0d8b424123..d3492de116 100644 --- a/net/tap.c +++ b/net/tap.c @@ -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, }; -- cgit v1.2.3