DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] ring: fix namespace prefix of inline functions
@ 2020-01-23  8:30 Thomas Monjalon
  2020-01-23 15:56 ` Honnappa Nagarahalli
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Thomas Monjalon @ 2020-01-23  8:30 UTC (permalink / raw)
  To: dev
  Cc: honnappa.nagarahalli, David Marchand, Olivier Matz,
	Dharmik Thakkar, Gavin Hu, Ruifeng Wang

When adding custom element size feature, some internal inline functions
were added in a public header without rte_ prefix.
It is fixed by adding __rte_ring_.

Fixes: cc4b218790f6 ("ring: support configurable element size")

Reported-by: David Marchand <david.marchand@redhat.com>
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
 lib/librte_ring/rte_ring_elem.h | 42 +++++++++++++++++----------------
 1 file changed, 22 insertions(+), 20 deletions(-)

diff --git a/lib/librte_ring/rte_ring_elem.h b/lib/librte_ring/rte_ring_elem.h
index 15d79bf2ac..7fdfe01e0b 100644
--- a/lib/librte_ring/rte_ring_elem.h
+++ b/lib/librte_ring/rte_ring_elem.h
@@ -110,8 +110,8 @@ struct rte_ring *rte_ring_create_elem(const char *name, unsigned int esize,
 			unsigned int count, int socket_id, unsigned int flags);
 
 static __rte_always_inline void
-enqueue_elems_32(struct rte_ring *r, const uint32_t size, uint32_t idx,
-		const void *obj_table, uint32_t n)
+__rte_ring_enqueue_elems_32(struct rte_ring *r, const uint32_t size,
+		uint32_t idx, const void *obj_table, uint32_t n)
 {
 	unsigned int i;
 	uint32_t *ring = (uint32_t *)&r[1];
@@ -153,7 +153,7 @@ enqueue_elems_32(struct rte_ring *r, const uint32_t size, uint32_t idx,
 }
 
 static __rte_always_inline void
-enqueue_elems_64(struct rte_ring *r, uint32_t prod_head,
+__rte_ring_enqueue_elems_64(struct rte_ring *r, uint32_t prod_head,
 		const void *obj_table, uint32_t n)
 {
 	unsigned int i;
@@ -186,7 +186,7 @@ enqueue_elems_64(struct rte_ring *r, uint32_t prod_head,
 }
 
 static __rte_always_inline void
-enqueue_elems_128(struct rte_ring *r, uint32_t prod_head,
+__rte_ring_enqueue_elems_128(struct rte_ring *r, uint32_t prod_head,
 		const void *obj_table, uint32_t n)
 {
 	unsigned int i;
@@ -219,16 +219,16 @@ enqueue_elems_128(struct rte_ring *r, uint32_t prod_head,
  * single and multi producer enqueue functions.
  */
 static __rte_always_inline void
-enqueue_elems(struct rte_ring *r, uint32_t prod_head, const void *obj_table,
-		uint32_t esize, uint32_t num)
+__rte_ring_enqueue_elems(struct rte_ring *r, uint32_t prod_head,
+		const void *obj_table, uint32_t esize, uint32_t num)
 {
 	/* 8B and 16B copies implemented individually to retain
 	 * the current performance.
 	 */
 	if (esize == 8)
-		enqueue_elems_64(r, prod_head, obj_table, num);
+		__rte_ring_enqueue_elems_64(r, prod_head, obj_table, num);
 	else if (esize == 16)
-		enqueue_elems_128(r, prod_head, obj_table, num);
+		__rte_ring_enqueue_elems_128(r, prod_head, obj_table, num);
 	else {
 		uint32_t idx, scale, nr_idx, nr_num, nr_size;
 
@@ -238,13 +238,14 @@ enqueue_elems(struct rte_ring *r, uint32_t prod_head, const void *obj_table,
 		idx = prod_head & r->mask;
 		nr_idx = idx * scale;
 		nr_size = r->size * scale;
-		enqueue_elems_32(r, nr_size, nr_idx, obj_table, nr_num);
+		__rte_ring_enqueue_elems_32(r, nr_size, nr_idx,
+				obj_table, nr_num);
 	}
 }
 
 static __rte_always_inline void
-dequeue_elems_32(struct rte_ring *r, const uint32_t size, uint32_t idx,
-		void *obj_table, uint32_t n)
+__rte_ring_dequeue_elems_32(struct rte_ring *r, const uint32_t size,
+		uint32_t idx, void *obj_table, uint32_t n)
 {
 	unsigned int i;
 	uint32_t *ring = (uint32_t *)&r[1];
@@ -286,7 +287,7 @@ dequeue_elems_32(struct rte_ring *r, const uint32_t size, uint32_t idx,
 }
 
 static __rte_always_inline void
-dequeue_elems_64(struct rte_ring *r, uint32_t prod_head,
+__rte_ring_dequeue_elems_64(struct rte_ring *r, uint32_t prod_head,
 		void *obj_table, uint32_t n)
 {
 	unsigned int i;
@@ -319,7 +320,7 @@ dequeue_elems_64(struct rte_ring *r, uint32_t prod_head,
 }
 
 static __rte_always_inline void
-dequeue_elems_128(struct rte_ring *r, uint32_t prod_head,
+__rte_ring_dequeue_elems_128(struct rte_ring *r, uint32_t prod_head,
 		void *obj_table, uint32_t n)
 {
 	unsigned int i;
@@ -348,16 +349,16 @@ dequeue_elems_128(struct rte_ring *r, uint32_t prod_head,
  * single and multi producer enqueue functions.
  */
 static __rte_always_inline void
-dequeue_elems(struct rte_ring *r, uint32_t cons_head, void *obj_table,
-		uint32_t esize, uint32_t num)
+__rte_ring_dequeue_elems(struct rte_ring *r, uint32_t cons_head,
+		void *obj_table, uint32_t esize, uint32_t num)
 {
 	/* 8B and 16B copies implemented individually to retain
 	 * the current performance.
 	 */
 	if (esize == 8)
-		dequeue_elems_64(r, cons_head, obj_table, num);
+		__rte_ring_dequeue_elems_64(r, cons_head, obj_table, num);
 	else if (esize == 16)
-		dequeue_elems_128(r, cons_head, obj_table, num);
+		__rte_ring_dequeue_elems_128(r, cons_head, obj_table, num);
 	else {
 		uint32_t idx, scale, nr_idx, nr_num, nr_size;
 
@@ -367,7 +368,8 @@ dequeue_elems(struct rte_ring *r, uint32_t cons_head, void *obj_table,
 		idx = cons_head & r->mask;
 		nr_idx = idx * scale;
 		nr_size = r->size * scale;
-		dequeue_elems_32(r, nr_size, nr_idx, obj_table, nr_num);
+		__rte_ring_dequeue_elems_32(r, nr_size, nr_idx,
+				obj_table, nr_num);
 	}
 }
 
@@ -424,7 +426,7 @@ __rte_ring_do_enqueue_elem(struct rte_ring *r, const void *obj_table,
 	if (n == 0)
 		goto end;
 
-	enqueue_elems(r, prod_head, obj_table, esize, n);
+	__rte_ring_enqueue_elems(r, prod_head, obj_table, esize, n);
 
 	update_tail(&r->prod, prod_head, prod_next, is_sp, 1);
 end:
@@ -471,7 +473,7 @@ __rte_ring_do_dequeue_elem(struct rte_ring *r, void *obj_table,
 	if (n == 0)
 		goto end;
 
-	dequeue_elems(r, cons_head, obj_table, esize, n);
+	__rte_ring_dequeue_elems(r, cons_head, obj_table, esize, n);
 
 	update_tail(&r->cons, cons_head, cons_next, is_sc, 0);
 
-- 
2.24.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [dpdk-dev] [PATCH] ring: fix namespace prefix of inline functions
  2020-01-23  8:30 [dpdk-dev] [PATCH] ring: fix namespace prefix of inline functions Thomas Monjalon
@ 2020-01-23 15:56 ` Honnappa Nagarahalli
  2020-01-29 14:38 ` Olivier Matz
  2020-02-06 12:39 ` David Marchand
  2 siblings, 0 replies; 4+ messages in thread
From: Honnappa Nagarahalli @ 2020-01-23 15:56 UTC (permalink / raw)
  To: thomas, dev
  Cc: David Marchand, Olivier Matz, Dharmik Thakkar, Gavin Hu,
	Ruifeng Wang, nd, Honnappa Nagarahalli, nd

<snip>

> 
> When adding custom element size feature, some internal inline functions were
> added in a public header without rte_ prefix.
> It is fixed by adding __rte_ring_.
> 
> Fixes: cc4b218790f6 ("ring: support configurable element size")
> 
> Reported-by: David Marchand <david.marchand@redhat.com>
> Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Looks good.
Acked-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>

> ---
>  lib/librte_ring/rte_ring_elem.h | 42 +++++++++++++++++----------------
>  1 file changed, 22 insertions(+), 20 deletions(-)
> 
> diff --git a/lib/librte_ring/rte_ring_elem.h b/lib/librte_ring/rte_ring_elem.h
> index 15d79bf2ac..7fdfe01e0b 100644
> --- a/lib/librte_ring/rte_ring_elem.h
> +++ b/lib/librte_ring/rte_ring_elem.h
> @@ -110,8 +110,8 @@ struct rte_ring *rte_ring_create_elem(const char
> *name, unsigned int esize,
>  			unsigned int count, int socket_id, unsigned int flags);
> 
>  static __rte_always_inline void
> -enqueue_elems_32(struct rte_ring *r, const uint32_t size, uint32_t idx,
> -		const void *obj_table, uint32_t n)
> +__rte_ring_enqueue_elems_32(struct rte_ring *r, const uint32_t size,
> +		uint32_t idx, const void *obj_table, uint32_t n)
>  {
>  	unsigned int i;
>  	uint32_t *ring = (uint32_t *)&r[1];
> @@ -153,7 +153,7 @@ enqueue_elems_32(struct rte_ring *r, const uint32_t
> size, uint32_t idx,  }
> 
>  static __rte_always_inline void
> -enqueue_elems_64(struct rte_ring *r, uint32_t prod_head,
> +__rte_ring_enqueue_elems_64(struct rte_ring *r, uint32_t prod_head,
>  		const void *obj_table, uint32_t n)
>  {
>  	unsigned int i;
> @@ -186,7 +186,7 @@ enqueue_elems_64(struct rte_ring *r, uint32_t
> prod_head,  }
> 
>  static __rte_always_inline void
> -enqueue_elems_128(struct rte_ring *r, uint32_t prod_head,
> +__rte_ring_enqueue_elems_128(struct rte_ring *r, uint32_t prod_head,
>  		const void *obj_table, uint32_t n)
>  {
>  	unsigned int i;
> @@ -219,16 +219,16 @@ enqueue_elems_128(struct rte_ring *r, uint32_t
> prod_head,
>   * single and multi producer enqueue functions.
>   */
>  static __rte_always_inline void
> -enqueue_elems(struct rte_ring *r, uint32_t prod_head, const void *obj_table,
> -		uint32_t esize, uint32_t num)
> +__rte_ring_enqueue_elems(struct rte_ring *r, uint32_t prod_head,
> +		const void *obj_table, uint32_t esize, uint32_t num)
>  {
>  	/* 8B and 16B copies implemented individually to retain
>  	 * the current performance.
>  	 */
>  	if (esize == 8)
> -		enqueue_elems_64(r, prod_head, obj_table, num);
> +		__rte_ring_enqueue_elems_64(r, prod_head, obj_table, num);
>  	else if (esize == 16)
> -		enqueue_elems_128(r, prod_head, obj_table, num);
> +		__rte_ring_enqueue_elems_128(r, prod_head, obj_table,
> num);
>  	else {
>  		uint32_t idx, scale, nr_idx, nr_num, nr_size;
> 
> @@ -238,13 +238,14 @@ enqueue_elems(struct rte_ring *r, uint32_t
> prod_head, const void *obj_table,
>  		idx = prod_head & r->mask;
>  		nr_idx = idx * scale;
>  		nr_size = r->size * scale;
> -		enqueue_elems_32(r, nr_size, nr_idx, obj_table, nr_num);
> +		__rte_ring_enqueue_elems_32(r, nr_size, nr_idx,
> +				obj_table, nr_num);
>  	}
>  }
> 
>  static __rte_always_inline void
> -dequeue_elems_32(struct rte_ring *r, const uint32_t size, uint32_t idx,
> -		void *obj_table, uint32_t n)
> +__rte_ring_dequeue_elems_32(struct rte_ring *r, const uint32_t size,
> +		uint32_t idx, void *obj_table, uint32_t n)
>  {
>  	unsigned int i;
>  	uint32_t *ring = (uint32_t *)&r[1];
> @@ -286,7 +287,7 @@ dequeue_elems_32(struct rte_ring *r, const uint32_t
> size, uint32_t idx,  }
> 
>  static __rte_always_inline void
> -dequeue_elems_64(struct rte_ring *r, uint32_t prod_head,
> +__rte_ring_dequeue_elems_64(struct rte_ring *r, uint32_t prod_head,
>  		void *obj_table, uint32_t n)
>  {
>  	unsigned int i;
> @@ -319,7 +320,7 @@ dequeue_elems_64(struct rte_ring *r, uint32_t
> prod_head,  }
> 
>  static __rte_always_inline void
> -dequeue_elems_128(struct rte_ring *r, uint32_t prod_head,
> +__rte_ring_dequeue_elems_128(struct rte_ring *r, uint32_t prod_head,
>  		void *obj_table, uint32_t n)
>  {
>  	unsigned int i;
> @@ -348,16 +349,16 @@ dequeue_elems_128(struct rte_ring *r, uint32_t
> prod_head,
>   * single and multi producer enqueue functions.
>   */
>  static __rte_always_inline void
> -dequeue_elems(struct rte_ring *r, uint32_t cons_head, void *obj_table,
> -		uint32_t esize, uint32_t num)
> +__rte_ring_dequeue_elems(struct rte_ring *r, uint32_t cons_head,
> +		void *obj_table, uint32_t esize, uint32_t num)
>  {
>  	/* 8B and 16B copies implemented individually to retain
>  	 * the current performance.
>  	 */
>  	if (esize == 8)
> -		dequeue_elems_64(r, cons_head, obj_table, num);
> +		__rte_ring_dequeue_elems_64(r, cons_head, obj_table, num);
>  	else if (esize == 16)
> -		dequeue_elems_128(r, cons_head, obj_table, num);
> +		__rte_ring_dequeue_elems_128(r, cons_head, obj_table,
> num);
>  	else {
>  		uint32_t idx, scale, nr_idx, nr_num, nr_size;
> 
> @@ -367,7 +368,8 @@ dequeue_elems(struct rte_ring *r, uint32_t
> cons_head, void *obj_table,
>  		idx = cons_head & r->mask;
>  		nr_idx = idx * scale;
>  		nr_size = r->size * scale;
> -		dequeue_elems_32(r, nr_size, nr_idx, obj_table, nr_num);
> +		__rte_ring_dequeue_elems_32(r, nr_size, nr_idx,
> +				obj_table, nr_num);
>  	}
>  }
> 
> @@ -424,7 +426,7 @@ __rte_ring_do_enqueue_elem(struct rte_ring *r,
> const void *obj_table,
>  	if (n == 0)
>  		goto end;
> 
> -	enqueue_elems(r, prod_head, obj_table, esize, n);
> +	__rte_ring_enqueue_elems(r, prod_head, obj_table, esize, n);
> 
>  	update_tail(&r->prod, prod_head, prod_next, is_sp, 1);
>  end:
> @@ -471,7 +473,7 @@ __rte_ring_do_dequeue_elem(struct rte_ring *r, void
> *obj_table,
>  	if (n == 0)
>  		goto end;
> 
> -	dequeue_elems(r, cons_head, obj_table, esize, n);
> +	__rte_ring_dequeue_elems(r, cons_head, obj_table, esize, n);
> 
>  	update_tail(&r->cons, cons_head, cons_next, is_sc, 0);
> 
> --
> 2.24.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [dpdk-dev] [PATCH] ring: fix namespace prefix of inline functions
  2020-01-23  8:30 [dpdk-dev] [PATCH] ring: fix namespace prefix of inline functions Thomas Monjalon
  2020-01-23 15:56 ` Honnappa Nagarahalli
@ 2020-01-29 14:38 ` Olivier Matz
  2020-02-06 12:39 ` David Marchand
  2 siblings, 0 replies; 4+ messages in thread
From: Olivier Matz @ 2020-01-29 14:38 UTC (permalink / raw)
  To: Thomas Monjalon
  Cc: dev, honnappa.nagarahalli, David Marchand, Dharmik Thakkar,
	Gavin Hu, Ruifeng Wang

On Thu, Jan 23, 2020 at 09:30:22AM +0100, Thomas Monjalon wrote:
> When adding custom element size feature, some internal inline functions
> were added in a public header without rte_ prefix.
> It is fixed by adding __rte_ring_.
> 
> Fixes: cc4b218790f6 ("ring: support configurable element size")
> 
> Reported-by: David Marchand <david.marchand@redhat.com>
> Signed-off-by: Thomas Monjalon <thomas@monjalon.net>

Acked-by: Olivier Matz <olivier.matz@6wind.com>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [dpdk-dev] [PATCH] ring: fix namespace prefix of inline functions
  2020-01-23  8:30 [dpdk-dev] [PATCH] ring: fix namespace prefix of inline functions Thomas Monjalon
  2020-01-23 15:56 ` Honnappa Nagarahalli
  2020-01-29 14:38 ` Olivier Matz
@ 2020-02-06 12:39 ` David Marchand
  2 siblings, 0 replies; 4+ messages in thread
From: David Marchand @ 2020-02-06 12:39 UTC (permalink / raw)
  To: Thomas Monjalon
  Cc: dev, Honnappa Nagarahalli, Olivier Matz, Dharmik Thakkar,
	Gavin Hu, Ruifeng Wang

On Thu, Jan 23, 2020 at 9:31 AM Thomas Monjalon <thomas@monjalon.net> wrote:
>
> When adding custom element size feature, some internal inline functions
> were added in a public header without rte_ prefix.
> It is fixed by adding __rte_ring_.
>
> Fixes: cc4b218790f6 ("ring: support configurable element size")
>
> Reported-by: David Marchand <david.marchand@redhat.com>
> Signed-off-by: Thomas Monjalon <thomas@monjalon.net>

Acked-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>

Applied, thanks.


-- 
David Marchand


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-02-06 12:40 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-23  8:30 [dpdk-dev] [PATCH] ring: fix namespace prefix of inline functions Thomas Monjalon
2020-01-23 15:56 ` Honnappa Nagarahalli
2020-01-29 14:38 ` Olivier Matz
2020-02-06 12:39 ` David Marchand

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).