From mboxrd@z Thu Jan 1 00:00:00 1970 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 From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:53614) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S71Ko-0006Cv-0k for qemu-devel@nongnu.org; Mon, 12 Mar 2012 05:14:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1S71KP-0002vE-H2 for qemu-devel@nongnu.org; Mon, 12 Mar 2012 05:14:29 -0400 Received: from mx1.redhat.com ([209.132.183.28]:52438) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S71KP-0002oB-8y for qemu-devel@nongnu.org; Mon, 12 Mar 2012 05:14:05 -0400 Message-ID: <4F5DBE1B.9050803@redhat.com> Date: Mon, 12 Mar 2012 10:12:59 +0100 From: Paolo Bonzini MIME-Version: 1.0 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> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v1 01/12] net: Add a hub net client List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Zhi Yong Wu Cc: aliguori@us.ibm.com, stefanha@linux.vnet.ibm.com, kvm@vger.kernel.org, linuxram@us.ibm.com, qemu-devel@nongnu.org, ryanh@us.ibm.com, luowenj@cn.ibm.com, Zhi Yong Wu 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