From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:48588) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UUJIv-0001K9-CC for qemu-devel@nongnu.org; Mon, 22 Apr 2013 12:09:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UUJIt-0001QP-6Z for qemu-devel@nongnu.org; Mon, 22 Apr 2013 12:09:21 -0400 Received: from mail-qc0-x229.google.com ([2607:f8b0:400d:c01::229]:60302) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UUJIt-0001Q6-3E for qemu-devel@nongnu.org; Mon, 22 Apr 2013 12:09:19 -0400 Received: by mail-qc0-f169.google.com with SMTP id t2so2253675qcq.14 for ; Mon, 22 Apr 2013 09:09:18 -0700 (PDT) Sender: Paolo Bonzini Message-ID: <5175609F.5030204@redhat.com> Date: Mon, 22 Apr 2013 18:09:03 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <1366284715-10107-1-git-send-email-s.fedorov@samsung.com> <20130422114711.GA21317@stefanha-thinkpad.redhat.com> <51752C68.6030408@samsung.com> <20130422145749.GA28049@stefanha-thinkpad.redhat.com> <517556D9.2080809@samsung.com> In-Reply-To: <517556D9.2080809@samsung.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] net/hub: remove can_receive handler List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Fedorov Sergey Cc: Stefan Hajnoczi , aliguori@us.ibm.com, a.basov@samsung.com, qemu-devel@nongnu.org, Stefan Hajnoczi Il 22/04/2013 17:27, Fedorov Sergey ha scritto: > > E.g. network hub has 3 ports. Suppose when iterating through port list > in net_hub_port_can_receive() a packet is successfully delivered to the > first port, and then is queued in the source port queue because the > second port cannot receive packets. Later net_hub_flush() will flush the > packet from the source port queue and it will be delivered in every > port. But it had been already delivered to one of them. So it will be > delivered twice to some ports. Moreover there is less chance to dequeue > the packet if several clients can't receive periodically. Perhaps it is indeed wrong to do this blocking in can_receive()... You're right that a hubport can always receive, but the hub itself should have a queue. If one port cannot receive, the packet should be appended to the hub's queue. And net_hub_flush will just go through the hub's queue. > Anyway, actually there is no need in net_hub_port_can_receive() as the > network hub can always receive packets and pass it to its port network > clients with qemu_send_packet(). I think it's more natural solution. I think the point was to keep dumps in sync with what actually happened on the other ports. Otherwise a "-net dump" port will show the packet immediately, even though it hasn't been delivered yet. Paolo