qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 04/12] char: introduce backend tx queue


From: Stefan Hajnoczi
Subject: Re: [Qemu-devel] [PATCH 04/12] char: introduce backend tx queue
Date: Mon, 1 Aug 2011 16:33:34 +0100

On Mon, Aug 1, 2011 at 3:23 PM, Anthony Liguori <address@hidden> 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 <address@hidden>
> ---
>  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()?

Stefan



reply via email to

[Prev in Thread] Current Thread [Next in Thread]