From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NTHoE-00068y-Qk for qemu-devel@nongnu.org; Fri, 08 Jan 2010 11:35:35 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NTHoA-00065y-1y for qemu-devel@nongnu.org; Fri, 08 Jan 2010 11:35:34 -0500 Received: from [199.232.76.173] (port=50129 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NTHo9-00065q-Fw for qemu-devel@nongnu.org; Fri, 08 Jan 2010 11:35:29 -0500 Received: from mail-yw0-f176.google.com ([209.85.211.176]:33883) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NTHo9-000837-0Y for qemu-devel@nongnu.org; Fri, 08 Jan 2010 11:35:29 -0500 Received: by ywh6 with SMTP id 6so19613331ywh.4 for ; Fri, 08 Jan 2010 08:35:27 -0800 (PST) Message-ID: <4B475ECD.3090409@codemonkey.ws> Date: Fri, 08 Jan 2010 10:35:25 -0600 From: Anthony Liguori MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH] net: add API to disable/enable polling References: <20091224124629.GA31567@redhat.com> In-Reply-To: <20091224124629.GA31567@redhat.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Michael S. Tsirkin" Cc: qemu-devel@nongnu.org On 12/24/2009 06:46 AM, Michael S. Tsirkin wrote: > 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 > Applied. Thanks. Regards, Anthony Liguori > --- > net.h | 3 +++ > net/tap.c | 8 ++++++++ > 2 files changed, 11 insertions(+), 0 deletions(-) > > diff --git a/net.h b/net.h > index 4971fcb..116bb80 100644 > --- a/net.h > +++ b/net.h > @@ -1,6 +1,7 @@ > #ifndef QEMU_NET_H > #define QEMU_NET_H > > +#include > #include "qemu-queue.h" > #include "qemu-common.h" > #include "qdict.h" > @@ -36,6 +37,7 @@ typedef enum { > NET_CLIENT_TYPE_DUMP > } net_client_type; > > +typedef void (NetPoll)(VLANClientState *, bool enable); > typedef int (NetCanReceive)(VLANClientState *); > typedef ssize_t (NetReceive)(VLANClientState *, const uint8_t *, size_t); > typedef ssize_t (NetReceiveIOV)(VLANClientState *, const struct iovec *, int); > @@ -51,6 +53,7 @@ typedef struct NetClientInfo { > NetCanReceive *can_receive; > NetCleanup *cleanup; > LinkStatusChanged *link_status_changed; > + NetPoll *poll; > } NetClientInfo; > > struct VLANClientState { > diff --git a/net/tap.c b/net/tap.c > index 0d8b424..d3492de 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, > }; > >