|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [UNIKRAFT PATCH v3 4/5] lib/ukring: Re-prefix methods and structs from buf_ to uk_
Reviewed-by: Costin Lupu <costin.lupu@xxxxxxxxx>
On 7/23/20 3:49 PM, Alexander Jung wrote:
> Signed-off-by: Alexander Jung <alexander.jung@xxxxxxxxx>
> ---
> lib/ukring/include/uk/ring.h | 36 ++++++++++++++++++------------------
> lib/ukring/ring.c | 10 +++++-----
> 2 files changed, 23 insertions(+), 23 deletions(-)
>
> diff --git a/lib/ukring/include/uk/ring.h b/lib/ukring/include/uk/ring.h
> index 6bc789d..a787807 100644
> --- a/lib/ukring/include/uk/ring.h
> +++ b/lib/ukring/include/uk/ring.h
> @@ -29,8 +29,8 @@
> *
> */
>
> -#ifndef _SYS_BUF_RING_H_
> -#define _SYS_BUF_RING_H_
> +#ifndef __UK_RING_H__
> +#define __UK_RING_H__
>
> #include <errno.h>
> #include <uk/mutex.h>
> @@ -44,7 +44,7 @@
>
>
>
> -struct buf_ring {
> +struct uk_ring {
> volatile uint32_t br_prod_head;
> volatile uint32_t br_prod_tail;
> int br_prod_size;
> @@ -66,7 +66,7 @@ struct buf_ring {
> *
> */
> static __inline int
> -buf_ring_enqueue(struct buf_ring *br, void *buf)
> +uk_ring_enqueue(struct uk_ring *br, void *buf)
> {
> uint32_t prod_head, prod_next, cons_tail;
>
> @@ -130,7 +130,7 @@ buf_ring_enqueue(struct buf_ring *br, void *buf)
> *
> */
> static __inline void *
> -buf_ring_dequeue_mc(struct buf_ring *br)
> +uk_ring_dequeue_mc(struct uk_ring *br)
> {
> uint32_t cons_head, cons_next;
> void *buf;
> @@ -174,7 +174,7 @@ buf_ring_dequeue_mc(struct buf_ring *br)
> * e.g. a network driver's tx queue lock
> */
> static __inline void *
> -buf_ring_dequeue_sc(struct buf_ring *br)
> +uk_ring_dequeue_sc(struct uk_ring *br)
> {
> uint32_t cons_head, cons_next;
> #ifdef PREFETCH_DEFINED
> @@ -184,15 +184,15 @@ buf_ring_dequeue_sc(struct buf_ring *br)
> void *buf;
>
> /*
> - * This is a workaround to allow using buf_ring on ARM and ARM64.
> - * ARM64TODO: Fix buf_ring in a generic way.
> + * This is a workaround to allow using uk_ring on ARM and ARM64.
> + * ARM64TODO: Fix uk_ring in a generic way.
> * REMARKS: It is suspected that br_cons_head does not require
> * load_acq operation, but this change was extensively tested
> * and confirmed it's working. To be reviewed once again in
> * FreeBSD-12.
> *
> * Preventing following situation:
> - * Core(0) - buf_ring_enqueue()
> Core(1) - buf_ring_dequeue_sc()
> + * Core(0) - uk_ring_enqueue()
> Core(1) - uk_ring_dequeue_sc()
> * -----------------------------------------
> ----------------------------------------------
> *
> *
> cons_head = br->br_cons_head;
> @@ -254,7 +254,7 @@ buf_ring_dequeue_sc(struct buf_ring *br)
> * e.g. a network driver's tx queue lock
> */
> static __inline void
> -buf_ring_advance_sc(struct buf_ring *br)
> +uk_ring_advance_sc(struct uk_ring *br)
> {
> uint32_t cons_head, cons_next;
> uint32_t prod_tail;
> @@ -292,7 +292,7 @@ buf_ring_advance_sc(struct buf_ring *br)
> * the compare and an atomic.
> */
> static __inline void
> -buf_ring_putback_sc(struct buf_ring *br, void *new)
> +uk_ring_putback_sc(struct uk_ring *br, void *new)
> {
> /* Buffer ring has none in putback */
> UK_ASSERT(br->br_cons_head != br->br_prod_tail);
> @@ -305,7 +305,7 @@ buf_ring_putback_sc(struct buf_ring *br, void *new)
> * race-prone if not protected by a lock
> */
> static __inline void *
> -buf_ring_peek(struct buf_ring *br)
> +uk_ring_peek(struct uk_ring *br)
> {
> #ifdef CONFIG_LIBUKRING_DEBUG_BUFRING
> if (!uk_mutex_is_locked(br->br_lock))
> @@ -325,7 +325,7 @@ buf_ring_peek(struct buf_ring *br)
> }
>
> static __inline void *
> -buf_ring_peek_clear_sc(struct buf_ring *br)
> +uk_ring_peek_clear_sc(struct uk_ring *br)
> {
> #ifdef CONFIG_LIBUKRING_DEBUG_BUFRING
> void *ret;
> @@ -367,26 +367,26 @@ buf_ring_peek_clear_sc(struct buf_ring *br)
> }
>
> static __inline int
> -buf_ring_full(struct buf_ring *br)
> +uk_ring_full(struct uk_ring *br)
> {
> return ((br->br_prod_head + 1) & br->br_prod_mask) == br->br_cons_tail;
> }
>
> static __inline int
> -buf_ring_empty(struct buf_ring *br)
> +uk_ring_empty(struct uk_ring *br)
> {
> return br->br_cons_head == br->br_prod_tail;
> }
>
> static __inline int
> -buf_ring_count(struct buf_ring *br)
> +uk_ring_count(struct uk_ring *br)
> {
> return (br->br_prod_size + br->br_prod_tail - br->br_cons_tail)
> & br->br_prod_mask;
> }
>
> -struct buf_ring *buf_ring_alloc(int count, struct uk_alloc *a, int flags,
> +struct uk_ring *uk_ring_alloc(int count, struct uk_alloc *a, int flags,
> struct uk_mutex *lock);
> -void buf_ring_free(struct buf_ring *br, struct uk_alloc *a);
> +void uk_ring_free(struct uk_ring *br, struct uk_alloc *a);
>
> #endif
> diff --git a/lib/ukring/ring.c b/lib/ukring/ring.c
> index 2badb79..ea46107 100644
> --- a/lib/ukring/ring.c
> +++ b/lib/ukring/ring.c
> @@ -34,15 +34,15 @@
> #include <uk/print.h>
> #include <uk/essentials.h>
>
> -struct buf_ring *
> -buf_ring_alloc(int count, struct uk_alloc *a, int flags, struct uk_mutex
> *lock)
> +struct uk_ring *
> +uk_ring_alloc(int count, struct uk_alloc *a, int flags, struct uk_mutex
> *lock)
> {
> - struct buf_ring *br;
> + struct uk_ring *br;
>
> /* buf ring must be size power of 2 */
> UK_ASSERT(POWER_OF_2(count));
>
> - br = uk_malloc(a, sizeof(struct buf_ring) + count * sizeof(caddr_t));
> + br = uk_malloc(a, sizeof(struct uk_ring) + count * sizeof(caddr_t));
> if (br == NULL) {
> uk_pr_err("could not allocate ring\n");
> return NULL;
> @@ -61,7 +61,7 @@ buf_ring_alloc(int count, struct uk_alloc *a, int flags,
> struct uk_mutex *lock)
> }
>
> void
> -buf_ring_free(struct buf_ring *br, struct uk_alloc *a)
> +uk_ring_free(struct uk_ring *br, struct uk_alloc *a)
> {
> uk_free(a, br);
> }
>
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |