From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:42673) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UFj4A-0002w6-HB for qemu-devel@nongnu.org; Wed, 13 Mar 2013 06:37:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UFj47-0001Rc-Tm for qemu-devel@nongnu.org; Wed, 13 Mar 2013 06:37:50 -0400 Received: from mx1.redhat.com ([209.132.183.28]:52062) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UFj47-0001RS-MA for qemu-devel@nongnu.org; Wed, 13 Mar 2013 06:37:47 -0400 Message-ID: <514056E2.2030804@redhat.com> Date: Wed, 13 Mar 2013 11:37:22 +0100 From: Paolo Bonzini MIME-Version: 1.0 References: <1362624800-10682-1-git-send-email-qemulist@gmail.com> <1362624800-10682-2-git-send-email-qemulist@gmail.com> <513EEC52.2010504@redhat.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v2 1/5] net: spread hub on AioContexts List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: liu ping fan Cc: Stefan Hajnoczi , "Michael S. Tsirkin" , qemu-devel@nongnu.org, Anthony Liguori , mdroth Il 13/03/2013 03:26, liu ping fan ha scritto: >>> >> + qemu_net_queue_append(port->nc.peer->send_queue, &port->nc, >>> >> + QEMU_NET_PACKET_FLAG_NONE, buf, len, NULL); >>> >> + event_notifier_set(&port->e); >> > >> > Why are the context and the EventNotifier a property of the port, rather >> > than applicable to the NetClientState? >> > > Yes, embed context into NetClientState is more reasonable, but as for > EventNotifier, considering about if we port tap onto context, the tap > do not have EventNotifier. > There doesn't even need to be an EventNotifier, instead you can pass the NetClientState's AioContext to the queue and use a bottom half on the AioContext. Furthermore, the bottom half should be completely transparent. Callers can keep using qemu_net_queue_flush, qemu_net_queue_flush schedules the bottom half (perhaps, with an optimization, it only does that if the queue is not empty), the handler actually performs the flush. Paolo