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

Re: [UNIKRAFT PATCH, v2, 07/15] lib/ukring: Rename single and multiple consumer functions



Hi Alexander,

Let's just keep the original suffixes because they are more suggestive.
Besides, single and multiple variants are used for different purposes,
so I don't think we should encourage a variant over the other. For
example, the shared IO rings used on Xen between drivers backends and
frontends are all single consumer. It's common case when communicating
via shared memory on kernel level.

So we can simply drop this patch altogether.

Cheers,
Costin

On 7/21/20 6:39 PM, Alexander Jung wrote:
> This commit renames the _sc suffix to _single on functions which
> are intended for use by a single bufffer ring consumer.
> Additionally, removing the _mc suffix from uk_ring_enqueue to
> encourage it as the default operation for removing items from
> a ring buffer.
> 
> Signed-off-by: Alexander Jung <alexander.jung@xxxxxxxxx>
> ---
>  lib/ukring/include/uk/ring.h | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/lib/ukring/include/uk/ring.h b/lib/ukring/include/uk/ring.h
> index f19b13e..1cc8982 100644
> --- a/lib/ukring/include/uk/ring.h
> +++ b/lib/ukring/include/uk/ring.h
> @@ -128,7 +128,7 @@ uk_ring_enqueue(struct uk_ring *r, void *buf)
>   *
>   */
>  static __inline void *
> -uk_ring_dequeue_mc(struct uk_ring *r)
> +uk_ring_dequeue(struct uk_ring *r)
>  {
>    uint32_t cons_head, cons_next;
>    void *buf;
> @@ -174,7 +174,7 @@ uk_ring_dequeue_mc(struct uk_ring *r)
>   * e.g. a network driver's tx queue lock
>   */
>  static __inline void *
> -uk_ring_dequeue_sc(struct uk_ring *r)
> +uk_ring_dequeue_single(struct uk_ring *r)
>  {
>    uint32_t cons_head, cons_next;
>  #ifdef PREFETCH_DEFINED
> @@ -192,7 +192,7 @@ uk_ring_dequeue_sc(struct uk_ring *r)
>     *   FreeBSD-12.
>     *
>     * Preventing following situation:
> -   * Core(0) - uk_ring_enqueue()                                       
> Core(1) - uk_ring_dequeue_sc()
> +   * Core(0) - uk_ring_enqueue()                                       
> Core(1) - uk_ring_dequeue_single()
>     * -----------------------------------------                               
>         ----------------------------------------------
>     *
>     *                                                                         
>        cons_head = r->cons_head;
> @@ -258,7 +258,7 @@ uk_ring_dequeue_sc(struct uk_ring *r)
>   * e.g. a network driver's tx queue lock
>   */
>  static __inline void
> -uk_ring_advance_sc(struct uk_ring *r)
> +uk_ring_advance_single(struct uk_ring *r)
>  {
>    uint32_t cons_head, cons_next;
>    uint32_t prod_tail;
> @@ -296,7 +296,7 @@ uk_ring_advance_sc(struct uk_ring *r)
>   * the compare and an atomic.
>   */
>  static __inline void
> -uk_ring_putback_sc(struct uk_ring *r, void *new)
> +uk_ring_putback_single(struct uk_ring *r, void *new)
>  {
>    /* Buffer ring has none in putback */
>    UK_ASSERT(r->cons_head != r->prod_tail);
> @@ -329,7 +329,7 @@ uk_ring_peek(struct uk_ring *r)
>  }
>  
>  static __inline void *
> -uk_ring_peek_clear_sc(struct uk_ring *r)
> +uk_ring_peek_clear_single(struct uk_ring *r)
>  {
>  #ifdef DEBUG_BUFRING
>    void *ret;
> 



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.