[dpdk-dev] [PATCH v5 2/8] test/ring: move common function to header file

Ananyev, Konstantin konstantin.ananyev at intel.com
Tue Oct 27 14:51:40 CET 2020



> -----Original Message-----
> From: Honnappa Nagarahalli <honnappa.nagarahalli at arm.com>
> Sent: Sunday, October 25, 2020 5:46 AM
> To: dev at dpdk.org; honnappa.nagarahalli at arm.com; Ananyev, Konstantin <konstantin.ananyev at intel.com>;
> stephen at networkplumber.org
> Cc: dharmik.thakkar at arm.com; ruifeng.wang at arm.com; olivier.matz at 6wind.com; david.marchand at redhat.com; nd at arm.com
> Subject: [PATCH v5 2/8] test/ring: move common function to header file
> 
> Move test_ring_inc_ptr to header file so that it can be used by
> functions in other files.
> 
> Signed-off-by: Honnappa Nagarahalli <honnappa.nagarahalli at arm.com>
> Reviewed-by: Dharmik Thakkar <dharmik.thakkar at arm.com>
> ---
>  app/test/test_ring.c | 11 -----------
>  app/test/test_ring.h | 13 +++++++++++++
>  2 files changed, 13 insertions(+), 11 deletions(-)
> 
> diff --git a/app/test/test_ring.c b/app/test/test_ring.c
> index a62cb263b..329d538a9 100644
> --- a/app/test/test_ring.c
> +++ b/app/test/test_ring.c
> @@ -243,17 +243,6 @@ test_ring_deq_impl(struct rte_ring *r, void **obj, int esize, unsigned int n,
>  			NULL);
>  }
> 
> -static void**
> -test_ring_inc_ptr(void **obj, int esize, unsigned int n)
> -{
> -	/* Legacy queue APIs? */
> -	if ((esize) == -1)
> -		return ((void **)obj) + n;
> -	else
> -		return (void **)(((uint32_t *)obj) +
> -					(n * esize / sizeof(uint32_t)));
> -}
> -
>  static void
>  test_ring_mem_init(void *obj, unsigned int count, int esize)
>  {
> diff --git a/app/test/test_ring.h b/app/test/test_ring.h
> index d4b15af7c..b44711398 100644
> --- a/app/test/test_ring.h
> +++ b/app/test/test_ring.h
> @@ -42,6 +42,19 @@ test_ring_create(const char *name, int esize, unsigned int count,
>  						(socket_id), (flags));
>  }
> 
> +static inline void*
> +test_ring_inc_ptr(void *obj, int esize, unsigned int n)
> +{
> +	size_t sz;
> +
> +	sz = sizeof(void *);
> +	/* Legacy queue APIs? */
> +	if (esize != -1)
> +		sz = esize;
> +
> +	return (void *)((uint32_t *)obj + (n * sz / sizeof(uint32_t)));
> +}
> +
>  static __rte_always_inline unsigned int
>  test_ring_enqueue(struct rte_ring *r, void **obj, int esize, unsigned int n,
>  			unsigned int api_type)
> --

Acked-by: Konstantin Ananyev <konstantin.ananyev at intel.com>

> 2.17.1



More information about the dev mailing list