From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48498) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZYsNY-0005VZ-Sc for qemu-devel@nongnu.org; Mon, 07 Sep 2015 05:06:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZYsNV-0003L3-JM for qemu-devel@nongnu.org; Mon, 07 Sep 2015 05:06:20 -0400 Received: from mx1.redhat.com ([209.132.183.28]:35857) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZYsNV-0003Kw-Es for qemu-devel@nongnu.org; Mon, 07 Sep 2015 05:06:17 -0400 From: Markus Armbruster References: <1441098383-22585-1-git-send-email-yanghy@cn.fujitsu.com> <1441098383-22585-6-git-send-email-yanghy@cn.fujitsu.com> <20150901144308.GE2407@stefanha-thinkpad.redhat.com> <55E6559E.5060305@cn.fujitsu.com> <20150902130245.GI17873@stefanha-thinkpad.redhat.com> <55E7214A.20803@cn.fujitsu.com> <20150904103255.GB8683@stefanha-thinkpad.redhat.com> <55ED3EB0.1030902@cn.fujitsu.com> Date: Mon, 07 Sep 2015 11:06:14 +0200 In-Reply-To: <55ED3EB0.1030902@cn.fujitsu.com> (Yang Hongyang's message of "Mon, 7 Sep 2015 15:37:20 +0800") Message-ID: <87vbbmoayh.fsf@blackfin.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Qemu-devel] [PATCH v9 05/10] move out net queue structs define List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Yang Hongyang Cc: thuth@redhat.com, zhang.zhanghailiang@huawei.com, lizhijian@cn.fujitsu.com, jasowang@redhat.com, qemu-devel@nongnu.org, mrhines@linux.vnet.ibm.com, Stefan Hajnoczi , Andreas Faerber Yang Hongyang writes: > Hi Stefan, > > On 09/04/2015 06:32 PM, Stefan Hajnoczi wrote: > [...] >> >> net/queue.c has logic to send/queue/flush packets but a >> qemu_deliver_packet() call is hardcoded. >> >> Maybe you can extend qemu_new_net_queue() like this: >> >> /* Returns: >> * >0 - success >> * 0 - queue packet for future redelivery >> * <0 - failure (discard packet) >> */ >> typedef ssize_t NetQueueDeliverFunc(NetClientState *sender, >> unsigned flags, >> const struct iovec *iov, >> int iovcnt, >> void *opaque); >> >> NetQueue *qemu_new_net_queue(NetQueueDeliverFunc deliver, >> void *opaque); >> >> Now net/net.c:qemu_net_client_setup() needs to call: >> >> nc->incoming_queue = qemu_new_net_queue(qemu_deliver_packet_iov, nc); >> >> And the filter code can use qemu_net_queue_send_iov() and >> qemu_net_queue_flush(). The filter just needs to provide its own >> NetQueueDeliveryFunc. >> >> I haven't checked the details (e.g. non-iov delivery, etc) but the idea >> is to use the net/queue.c API instead of duplicating similar logic in >> the filter code. > > Thanks very much for the suggestion, I've already implemented it and tested, > the code looks cleaner now. > > The last issue is the QOM thing, do Markus and Andreas have more input > about that? This series is in my review queue. I'm struggling with clearing my queue, and apologize for the delay.