From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:33685) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UUc21-0007R5-03 for qemu-devel@nongnu.org; Tue, 23 Apr 2013 08:09:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UUbtZ-0004eo-HY for qemu-devel@nongnu.org; Tue, 23 Apr 2013 08:01:24 -0400 Received: from mail-ea0-x236.google.com ([2a00:1450:4013:c01::236]:33585) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UUbtZ-0004e0-7O for qemu-devel@nongnu.org; Tue, 23 Apr 2013 08:00:25 -0400 Received: by mail-ea0-f182.google.com with SMTP id r16so221192ead.13 for ; Tue, 23 Apr 2013 05:00:24 -0700 (PDT) Date: Tue, 23 Apr 2013 14:00:21 +0200 From: Stefan Hajnoczi Message-ID: <20130423120021.GC2431@stefanha-thinkpad.redhat.com> 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> <20130423065841.GA6447@stefanha-thinkpad.redhat.com> <51763B36.1000701@samsung.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <51763B36.1000701@samsung.com> 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: aliguori@us.ibm.com, a.basov@samsung.com, qemu-devel@nongnu.org, Stefan Hajnoczi On Tue, Apr 23, 2013 at 11:41:42AM +0400, Fedorov Sergey wrote: > >Beyond that, we also want to avoid growing net queues indefinitely. If > >the hub does not implement .can_receive() then it relies on growing > >queues (keeping packets buffered in memory). > No, net_hub_receive() calls qemu_send_packet(). If the destination > queue cannot receive the packet qemu_net_queue_append() will take > care of queue->nq_maxlen. You are right, sorry. We do discard packets at nq_maxlen. The problem with ignoring .can_receive() on the hub is that it breaks flow control. For example, net/tap.c is designed to avoid reading more packets if its peer cannot receive (see tap_can_send()). If the hub claims it can always receive we waste cycles reading packets from the tap device only to discard them. Since qemu.git already has a fix which preserves flow control, I am not going to merge your patch. Stefan