From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:33316) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QnuYO-00022i-SY for qemu-devel@nongnu.org; Mon, 01 Aug 2011 11:37:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QnuYN-0005q1-RU for qemu-devel@nongnu.org; Mon, 01 Aug 2011 11:37:16 -0400 Received: from mail-yi0-f45.google.com ([209.85.218.45]:47278) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QnuYN-0005pw-NZ for qemu-devel@nongnu.org; Mon, 01 Aug 2011 11:37:15 -0400 Received: by yia25 with SMTP id 25so4203192yia.4 for ; Mon, 01 Aug 2011 08:37:15 -0700 (PDT) Message-ID: <4E36C827.3060007@codemonkey.ws> Date: Mon, 01 Aug 2011 10:37:11 -0500 From: Anthony Liguori MIME-Version: 1.0 References: <1312208590-25502-1-git-send-email-aliguori@us.ibm.com> <1312208590-25502-5-git-send-email-aliguori@us.ibm.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 04/12] char: introduce backend tx queue List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi Cc: Amit Shah , Hans de Goede , qemu-devel@nongnu.org On 08/01/2011 10:33 AM, Stefan Hajnoczi wrote: > On Mon, Aug 1, 2011 at 3:23 PM, Anthony Liguori wrote: >> While the front tx queue has no flow control, the backend tx queue uses a >> polling function to determine when the front end can receive data. >> >> To convert this to the new queue model, we simply try to flush the backend tx >> queue whenever we poll. We then return the remaining space in the queue as >> the value of the polling function. >> >> Signed-off-by: Anthony Liguori >> --- >> qemu-char.c | 49 ++++++++++++++++++++++++++++++++++++++++--------- >> qemu-char.h | 3 ++- >> 2 files changed, 42 insertions(+), 10 deletions(-) >> >> diff --git a/qemu-char.c b/qemu-char.c >> index 3f9b32c..2746652 100644 >> --- a/qemu-char.c >> +++ b/qemu-char.c >> @@ -173,6 +173,11 @@ static size_t char_queue_read(CharQueue *q, void *data, size_t size) >> return i; >> } >> >> +static uint32_t char_queue_get_avail(CharQueue *q) >> +{ >> + return sizeof(q->ring) - (q->prod - q->cons); >> +} > > "avail" confuses me. How many bytes are available for the consumer? > How many bytes are available for the producer? > > How about char_queue_get_space() or char_queue_get_nfree()? Sure. Regards, Anthony Liguori > > Stefan >