From: Paolo Bonzini Subject: Re: [PATCH v1 01/12] net: Add a hub net client Date: Mon, 12 Mar 2012 10:12:59 +0100 Message-ID: <4F5DBE1B.9050803@redhat.com> References: <1331283625-26439-1-git-send-email-zwu.kernel@gmail.com> <1331283625-26439-2-git-send-email-zwu.kernel@gmail.com> <4F59DC8F.3020501@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: qemu-devel@nongnu.org, kvm@vger.kernel.org, aliguori@us.ibm.com, stefanha@linux.vnet.ibm.com, ryanh@us.ibm.com, linuxram@us.ibm.com, luowenj@cn.ibm.com, Zhi Yong Wu To: Zhi Yong Wu Return-path: Received: from mx1.redhat.com ([209.132.183.28]:60798 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753244Ab2CLJOH (ORCPT ); Mon, 12 Mar 2012 05:14:07 -0400 In-Reply-To: Sender: kvm-owner@vger.kernel.org List-ID: Il 12/03/2012 09:59, Zhi Yong Wu ha scritto: >> However, then I noticed that qemu_can_send_packet is not called very >> much, and I do not understand why qemu_net_queue_send and >> qemu_net_queue_send_iov do not call qemu_can_send_packet before calling >> deliver/deliver_iov. > >> If they did, hubs could then do their own flow control via can_receive. >> When qemu_send_packet returns zero you increment a count of in-flight >> packets, and a sent-packet callback would decrement the same count. > > sent-packet callback is sent_cb here? i noticed that sent_cb is currently NULL. Yes. >> When the count is non-zero, can_receive returns false (and vice versa). >> Can you elaborate this? since can_receive is called finally by qemu_send_packet, >> how can can_receive return false or true based on the count? Based on counts from the previous sends. Paolo