DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH 0/3] use rte macros instead of GCC __attribute
@ 2024-02-27 23:07 Tyler Retzlaff
  2024-02-27 23:07 ` [PATCH 1/3] eal: add rte pure attribute macro Tyler Retzlaff
                   ` (4 more replies)
  0 siblings, 5 replies; 22+ messages in thread
From: Tyler Retzlaff @ 2024-02-27 23:07 UTC (permalink / raw)
  To: dev
  Cc: Bruce Richardson, Honnappa Nagarahalli, Vladimir Medvedkin,
	Tyler Retzlaff

Clean up direct uses of GCC __attribute__ in libs outside of EAL. A
checkpatch check already warns for new additions.

Tyler Retzlaff (3):
  eal: add rte pure attribute macro
  lpm: use rte macro instead of GCC attribute
  rcu: use rte macro instead of GCC attribute

 lib/eal/include/rte_common.h | 9 +++++++++
 lib/lpm/rte_lpm.c            | 4 ++--
 lib/lpm/rte_lpm6.c           | 2 +-
 lib/rcu/rcu_qsbr_pvt.h       | 2 +-
 4 files changed, 13 insertions(+), 4 deletions(-)

-- 
1.8.3.1


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

* [PATCH 1/3] eal: add rte pure attribute macro
  2024-02-27 23:07 [PATCH 0/3] use rte macros instead of GCC __attribute Tyler Retzlaff
@ 2024-02-27 23:07 ` Tyler Retzlaff
  2024-02-27 23:07 ` [PATCH 2/3] lpm: use rte macro instead of GCC attribute Tyler Retzlaff
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 22+ messages in thread
From: Tyler Retzlaff @ 2024-02-27 23:07 UTC (permalink / raw)
  To: dev
  Cc: Bruce Richardson, Honnappa Nagarahalli, Vladimir Medvedkin,
	Tyler Retzlaff

Add __rte_pure for __attribute__((pure)) to permit elimination of
direct use of __attribute__((pure)) in other libs.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 lib/eal/include/rte_common.h | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/lib/eal/include/rte_common.h b/lib/eal/include/rte_common.h
index 1cc1222..354b149 100644
--- a/lib/eal/include/rte_common.h
+++ b/lib/eal/include/rte_common.h
@@ -125,6 +125,15 @@
 #define __rte_weak __attribute__((__weak__))
 
 /**
+ * Mark a function to be pure.
+ */
+#ifdef RTE_TOOLCHAIN_MSVC
+#define __rte_pure
+#else
+#define __rte_pure __attribute__((pure))
+#endif
+
+/**
  * Force symbol to be generated even if it appears to be unused.
  */
 #ifdef RTE_TOOLCHAIN_MSVC
-- 
1.8.3.1


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

* [PATCH 2/3] lpm: use rte macro instead of GCC attribute
  2024-02-27 23:07 [PATCH 0/3] use rte macros instead of GCC __attribute Tyler Retzlaff
  2024-02-27 23:07 ` [PATCH 1/3] eal: add rte pure attribute macro Tyler Retzlaff
@ 2024-02-27 23:07 ` Tyler Retzlaff
  2024-02-27 23:07 ` [PATCH 3/3] rcu: " Tyler Retzlaff
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 22+ messages in thread
From: Tyler Retzlaff @ 2024-02-27 23:07 UTC (permalink / raw)
  To: dev
  Cc: Bruce Richardson, Honnappa Nagarahalli, Vladimir Medvedkin,
	Tyler Retzlaff

Use newly added __rte_pure macro from rte_common.h instead of directly
using __attribute__((pure)).

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 lib/lpm/rte_lpm.c  | 4 ++--
 lib/lpm/rte_lpm6.c | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/lpm/rte_lpm.c b/lib/lpm/rte_lpm.c
index 9633d63..a5c9e7c 100644
--- a/lib/lpm/rte_lpm.c
+++ b/lib/lpm/rte_lpm.c
@@ -85,7 +85,7 @@ struct __rte_lpm {
  * depth  (IN)		: range = 1 - 32
  * mask   (OUT)		: 32bit mask
  */
-static uint32_t __attribute__((pure))
+static uint32_t __rte_pure
 depth_to_mask(uint8_t depth)
 {
 	VERIFY_DEPTH(depth);
@@ -99,7 +99,7 @@ static uint32_t __attribute__((pure))
 /*
  * Converts given depth value to its corresponding range value.
  */
-static uint32_t __attribute__((pure))
+static uint32_t __rte_pure
 depth_to_range(uint8_t depth)
 {
 	VERIFY_DEPTH(depth);
diff --git a/lib/lpm/rte_lpm6.c b/lib/lpm/rte_lpm6.c
index 271bc48..2bdd540 100644
--- a/lib/lpm/rte_lpm6.c
+++ b/lib/lpm/rte_lpm6.c
@@ -1127,7 +1127,7 @@ struct rte_lpm6 *
  * Convert a depth to a one byte long mask
  *   Example: 4 will be converted to 0xF0
  */
-static uint8_t __attribute__((pure))
+static uint8_t __rte_pure
 depth_to_mask_1b(uint8_t depth)
 {
 	/* To calculate a mask start with a 1 on the left hand side and right
-- 
1.8.3.1


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

* [PATCH 3/3] rcu: use rte macro instead of GCC attribute
  2024-02-27 23:07 [PATCH 0/3] use rte macros instead of GCC __attribute Tyler Retzlaff
  2024-02-27 23:07 ` [PATCH 1/3] eal: add rte pure attribute macro Tyler Retzlaff
  2024-02-27 23:07 ` [PATCH 2/3] lpm: use rte macro instead of GCC attribute Tyler Retzlaff
@ 2024-02-27 23:07 ` Tyler Retzlaff
  2024-02-28  9:29   ` Morten Brørup
  2024-02-28 18:47 ` [PATCH v2 0/3] use rte macros instead of GCC __attribute Tyler Retzlaff
  2024-03-06 22:14 ` [PATCH v3 0/5] " Tyler Retzlaff
  4 siblings, 1 reply; 22+ messages in thread
From: Tyler Retzlaff @ 2024-02-27 23:07 UTC (permalink / raw)
  To: dev
  Cc: Bruce Richardson, Honnappa Nagarahalli, Vladimir Medvedkin,
	Tyler Retzlaff

Use existing __rte_pure macro from rte_common.h instead of directly
using __attribute__((__may_alias__)).

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 lib/rcu/rcu_qsbr_pvt.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/rcu/rcu_qsbr_pvt.h b/lib/rcu/rcu_qsbr_pvt.h
index 5fd7ca2..39b0d50 100644
--- a/lib/rcu/rcu_qsbr_pvt.h
+++ b/lib/rcu/rcu_qsbr_pvt.h
@@ -53,6 +53,6 @@ struct rte_rcu_qsbr_dq {
 typedef struct {
 	uint64_t token;  /**< Token */
 	uint8_t elem[0]; /**< Pointer to user element */
-} __attribute__((__may_alias__)) __rte_rcu_qsbr_dq_elem_t;
+} __rte_may_alias __rte_rcu_qsbr_dq_elem_t;
 
 #endif /* _RTE_RCU_QSBR_PVT_H_ */
-- 
1.8.3.1


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

* RE: [PATCH 3/3] rcu: use rte macro instead of GCC attribute
  2024-02-27 23:07 ` [PATCH 3/3] rcu: " Tyler Retzlaff
@ 2024-02-28  9:29   ` Morten Brørup
  2024-02-28 17:29     ` Tyler Retzlaff
  0 siblings, 1 reply; 22+ messages in thread
From: Morten Brørup @ 2024-02-28  9:29 UTC (permalink / raw)
  To: Tyler Retzlaff, dev
  Cc: Bruce Richardson, Honnappa Nagarahalli, Vladimir Medvedkin

> From: Tyler Retzlaff [mailto:roretzla@linux.microsoft.com]
> Sent: Wednesday, 28 February 2024 00.08
> 
> Use existing __rte_pure macro from rte_common.h instead of directly

Typo: __rte_pure -> __rte_may_alias

The code is correct, only the description has the typo.

> using __attribute__((__may_alias__)).
> 
> Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
> ---

With the typo corrected,
For the series,
Reviewed-by: Morten Brørup <mb@smartsharesystems.com>


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

* Re: [PATCH 3/3] rcu: use rte macro instead of GCC attribute
  2024-02-28  9:29   ` Morten Brørup
@ 2024-02-28 17:29     ` Tyler Retzlaff
  0 siblings, 0 replies; 22+ messages in thread
From: Tyler Retzlaff @ 2024-02-28 17:29 UTC (permalink / raw)
  To: Morten Brørup
  Cc: dev, Bruce Richardson, Honnappa Nagarahalli, Vladimir Medvedkin

On Wed, Feb 28, 2024 at 10:29:11AM +0100, Morten Brørup wrote:
> > From: Tyler Retzlaff [mailto:roretzla@linux.microsoft.com]
> > Sent: Wednesday, 28 February 2024 00.08
> > 
> > Use existing __rte_pure macro from rte_common.h instead of directly
> 
> Typo: __rte_pure -> __rte_may_alias
> 
> The code is correct, only the description has the typo.
> 
> > using __attribute__((__may_alias__)).
> > 
> > Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
> > ---
> 
> With the typo corrected,

bah, i get tired :)

thanks.

> For the series,
> Reviewed-by: Morten Brørup <mb@smartsharesystems.com>

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

* [PATCH v2 0/3] use rte macros instead of GCC __attribute
  2024-02-27 23:07 [PATCH 0/3] use rte macros instead of GCC __attribute Tyler Retzlaff
                   ` (2 preceding siblings ...)
  2024-02-27 23:07 ` [PATCH 3/3] rcu: " Tyler Retzlaff
@ 2024-02-28 18:47 ` Tyler Retzlaff
  2024-02-28 18:47   ` [PATCH v2 1/3] eal: add rte pure attribute macro Tyler Retzlaff
                     ` (4 more replies)
  2024-03-06 22:14 ` [PATCH v3 0/5] " Tyler Retzlaff
  4 siblings, 5 replies; 22+ messages in thread
From: Tyler Retzlaff @ 2024-02-28 18:47 UTC (permalink / raw)
  To: dev
  Cc: Bruce Richardson, Honnappa Nagarahalli, Vladimir Medvedkin, mb,
	Tyler Retzlaff

Clean up direct uses of GCC __attribute__ in libs outside of EAL. A
checkpatch check already warns for new additions.

v2:
  * fix typo __rte_pure -> __rte_may_alias in rcu commit message

Tyler Retzlaff (3):
  eal: add rte pure attribute macro
  lpm: use rte macro instead of GCC attribute
  rcu: use rte macro instead of GCC attribute

 lib/eal/include/rte_common.h | 9 +++++++++
 lib/lpm/rte_lpm.c            | 4 ++--
 lib/lpm/rte_lpm6.c           | 2 +-
 lib/rcu/rcu_qsbr_pvt.h       | 2 +-
 4 files changed, 13 insertions(+), 4 deletions(-)

-- 
1.8.3.1


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

* [PATCH v2 1/3] eal: add rte pure attribute macro
  2024-02-28 18:47 ` [PATCH v2 0/3] use rte macros instead of GCC __attribute Tyler Retzlaff
@ 2024-02-28 18:47   ` Tyler Retzlaff
  2024-02-28 18:47   ` [PATCH v2 2/3] lpm: use rte macro instead of GCC attribute Tyler Retzlaff
                     ` (3 subsequent siblings)
  4 siblings, 0 replies; 22+ messages in thread
From: Tyler Retzlaff @ 2024-02-28 18:47 UTC (permalink / raw)
  To: dev
  Cc: Bruce Richardson, Honnappa Nagarahalli, Vladimir Medvedkin, mb,
	Tyler Retzlaff

Add __rte_pure for __attribute__((pure)) to permit elimination of
direct use of __attribute__((pure)) in other libs.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
Reviewed-by: Morten Brørup <mb@smartsharesystems.com>
---
 lib/eal/include/rte_common.h | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/lib/eal/include/rte_common.h b/lib/eal/include/rte_common.h
index 1cc1222..354b149 100644
--- a/lib/eal/include/rte_common.h
+++ b/lib/eal/include/rte_common.h
@@ -125,6 +125,15 @@
 #define __rte_weak __attribute__((__weak__))
 
 /**
+ * Mark a function to be pure.
+ */
+#ifdef RTE_TOOLCHAIN_MSVC
+#define __rte_pure
+#else
+#define __rte_pure __attribute__((pure))
+#endif
+
+/**
  * Force symbol to be generated even if it appears to be unused.
  */
 #ifdef RTE_TOOLCHAIN_MSVC
-- 
1.8.3.1


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

* [PATCH v2 2/3] lpm: use rte macro instead of GCC attribute
  2024-02-28 18:47 ` [PATCH v2 0/3] use rte macros instead of GCC __attribute Tyler Retzlaff
  2024-02-28 18:47   ` [PATCH v2 1/3] eal: add rte pure attribute macro Tyler Retzlaff
@ 2024-02-28 18:47   ` Tyler Retzlaff
  2024-03-06 20:51     ` Medvedkin, Vladimir
  2024-02-28 18:47   ` [PATCH v2 3/3] rcu: " Tyler Retzlaff
                     ` (2 subsequent siblings)
  4 siblings, 1 reply; 22+ messages in thread
From: Tyler Retzlaff @ 2024-02-28 18:47 UTC (permalink / raw)
  To: dev
  Cc: Bruce Richardson, Honnappa Nagarahalli, Vladimir Medvedkin, mb,
	Tyler Retzlaff

Use newly added __rte_pure macro from rte_common.h instead of directly
using __attribute__((pure)).

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
Reviewed-by: Morten Brørup <mb@smartsharesystems.com>
---
 lib/lpm/rte_lpm.c  | 4 ++--
 lib/lpm/rte_lpm6.c | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/lpm/rte_lpm.c b/lib/lpm/rte_lpm.c
index 9633d63..a5c9e7c 100644
--- a/lib/lpm/rte_lpm.c
+++ b/lib/lpm/rte_lpm.c
@@ -85,7 +85,7 @@ struct __rte_lpm {
  * depth  (IN)		: range = 1 - 32
  * mask   (OUT)		: 32bit mask
  */
-static uint32_t __attribute__((pure))
+static uint32_t __rte_pure
 depth_to_mask(uint8_t depth)
 {
 	VERIFY_DEPTH(depth);
@@ -99,7 +99,7 @@ static uint32_t __attribute__((pure))
 /*
  * Converts given depth value to its corresponding range value.
  */
-static uint32_t __attribute__((pure))
+static uint32_t __rte_pure
 depth_to_range(uint8_t depth)
 {
 	VERIFY_DEPTH(depth);
diff --git a/lib/lpm/rte_lpm6.c b/lib/lpm/rte_lpm6.c
index 271bc48..2bdd540 100644
--- a/lib/lpm/rte_lpm6.c
+++ b/lib/lpm/rte_lpm6.c
@@ -1127,7 +1127,7 @@ struct rte_lpm6 *
  * Convert a depth to a one byte long mask
  *   Example: 4 will be converted to 0xF0
  */
-static uint8_t __attribute__((pure))
+static uint8_t __rte_pure
 depth_to_mask_1b(uint8_t depth)
 {
 	/* To calculate a mask start with a 1 on the left hand side and right
-- 
1.8.3.1


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

* [PATCH v2 3/3] rcu: use rte macro instead of GCC attribute
  2024-02-28 18:47 ` [PATCH v2 0/3] use rte macros instead of GCC __attribute Tyler Retzlaff
  2024-02-28 18:47   ` [PATCH v2 1/3] eal: add rte pure attribute macro Tyler Retzlaff
  2024-02-28 18:47   ` [PATCH v2 2/3] lpm: use rte macro instead of GCC attribute Tyler Retzlaff
@ 2024-02-28 18:47   ` Tyler Retzlaff
  2024-03-06 19:36   ` [PATCH v2 0/3] use rte macros instead of GCC __attribute Tyler Retzlaff
  2024-03-06 20:49   ` David Marchand
  4 siblings, 0 replies; 22+ messages in thread
From: Tyler Retzlaff @ 2024-02-28 18:47 UTC (permalink / raw)
  To: dev
  Cc: Bruce Richardson, Honnappa Nagarahalli, Vladimir Medvedkin, mb,
	Tyler Retzlaff

Use existing __rte_may_alias macro from rte_common.h instead of
directly using __attribute__((__may_alias__)).

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
Reviewed-by: Morten Brørup <mb@smartsharesystems.com>
---
 lib/rcu/rcu_qsbr_pvt.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/rcu/rcu_qsbr_pvt.h b/lib/rcu/rcu_qsbr_pvt.h
index 5fd7ca2..39b0d50 100644
--- a/lib/rcu/rcu_qsbr_pvt.h
+++ b/lib/rcu/rcu_qsbr_pvt.h
@@ -53,6 +53,6 @@ struct rte_rcu_qsbr_dq {
 typedef struct {
 	uint64_t token;  /**< Token */
 	uint8_t elem[0]; /**< Pointer to user element */
-} __attribute__((__may_alias__)) __rte_rcu_qsbr_dq_elem_t;
+} __rte_may_alias __rte_rcu_qsbr_dq_elem_t;
 
 #endif /* _RTE_RCU_QSBR_PVT_H_ */
-- 
1.8.3.1


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

* Re: [PATCH v2 0/3] use rte macros instead of GCC __attribute
  2024-02-28 18:47 ` [PATCH v2 0/3] use rte macros instead of GCC __attribute Tyler Retzlaff
                     ` (2 preceding siblings ...)
  2024-02-28 18:47   ` [PATCH v2 3/3] rcu: " Tyler Retzlaff
@ 2024-03-06 19:36   ` Tyler Retzlaff
  2024-03-06 20:49   ` David Marchand
  4 siblings, 0 replies; 22+ messages in thread
From: Tyler Retzlaff @ 2024-03-06 19:36 UTC (permalink / raw)
  To: dev; +Cc: Bruce Richardson, Honnappa Nagarahalli, Vladimir Medvedkin, mb

ping.

Doesn't seem this series carries high risk, worth considering for
rc2/rc3?

On Wed, Feb 28, 2024 at 10:47:53AM -0800, Tyler Retzlaff wrote:
> Clean up direct uses of GCC __attribute__ in libs outside of EAL. A
> checkpatch check already warns for new additions.
> 
> v2:
>   * fix typo __rte_pure -> __rte_may_alias in rcu commit message
> 
> Tyler Retzlaff (3):
>   eal: add rte pure attribute macro
>   lpm: use rte macro instead of GCC attribute
>   rcu: use rte macro instead of GCC attribute
> 
>  lib/eal/include/rte_common.h | 9 +++++++++
>  lib/lpm/rte_lpm.c            | 4 ++--
>  lib/lpm/rte_lpm6.c           | 2 +-
>  lib/rcu/rcu_qsbr_pvt.h       | 2 +-
>  4 files changed, 13 insertions(+), 4 deletions(-)
> 
> -- 
> 1.8.3.1

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

* Re: [PATCH v2 0/3] use rte macros instead of GCC __attribute
  2024-02-28 18:47 ` [PATCH v2 0/3] use rte macros instead of GCC __attribute Tyler Retzlaff
                     ` (3 preceding siblings ...)
  2024-03-06 19:36   ` [PATCH v2 0/3] use rte macros instead of GCC __attribute Tyler Retzlaff
@ 2024-03-06 20:49   ` David Marchand
  2024-03-06 21:22     ` Tyler Retzlaff
  4 siblings, 1 reply; 22+ messages in thread
From: David Marchand @ 2024-03-06 20:49 UTC (permalink / raw)
  To: Tyler Retzlaff
  Cc: dev, Bruce Richardson, Honnappa Nagarahalli, Vladimir Medvedkin, mb

On Wed, Feb 28, 2024 at 7:48 PM Tyler Retzlaff
<roretzla@linux.microsoft.com> wrote:
>
> Clean up direct uses of GCC __attribute__ in libs outside of EAL. A
> checkpatch check already warns for new additions.
>
> v2:
>   * fix typo __rte_pure -> __rte_may_alias in rcu commit message
>
> Tyler Retzlaff (3):
>   eal: add rte pure attribute macro
>   lpm: use rte macro instead of GCC attribute
>   rcu: use rte macro instead of GCC attribute
>
>  lib/eal/include/rte_common.h | 9 +++++++++
>  lib/lpm/rte_lpm.c            | 4 ++--
>  lib/lpm/rte_lpm6.c           | 2 +-
>  lib/rcu/rcu_qsbr_pvt.h       | 2 +-
>  4 files changed, 13 insertions(+), 4 deletions(-)

Introducing __rte_pure and converting lib/lpm looks fine.
But please finish the job for the other occurence in the tree as it is
a mechanical change.

Thanks.

-- 
David Marchand


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

* Re: [PATCH v2 2/3] lpm: use rte macro instead of GCC attribute
  2024-02-28 18:47   ` [PATCH v2 2/3] lpm: use rte macro instead of GCC attribute Tyler Retzlaff
@ 2024-03-06 20:51     ` Medvedkin, Vladimir
  0 siblings, 0 replies; 22+ messages in thread
From: Medvedkin, Vladimir @ 2024-03-06 20:51 UTC (permalink / raw)
  To: Tyler Retzlaff, dev; +Cc: Bruce Richardson, Honnappa Nagarahalli, mb

Acked-by: Vladimir Medvedkin <vladimir.medvedkin@intel.com>

On 28/02/2024 18:47, Tyler Retzlaff wrote:
> Use newly added __rte_pure macro from rte_common.h instead of directly
> using __attribute__((pure)).
>
> Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
> Reviewed-by: Morten Brørup <mb@smartsharesystems.com>
> ---
>   lib/lpm/rte_lpm.c  | 4 ++--
>   lib/lpm/rte_lpm6.c | 2 +-
>   2 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/lib/lpm/rte_lpm.c b/lib/lpm/rte_lpm.c
> index 9633d63..a5c9e7c 100644
> --- a/lib/lpm/rte_lpm.c
> +++ b/lib/lpm/rte_lpm.c
> @@ -85,7 +85,7 @@ struct __rte_lpm {
>    * depth  (IN)		: range = 1 - 32
>    * mask   (OUT)		: 32bit mask
>    */
> -static uint32_t __attribute__((pure))
> +static uint32_t __rte_pure
>   depth_to_mask(uint8_t depth)
>   {
>   	VERIFY_DEPTH(depth);
> @@ -99,7 +99,7 @@ static uint32_t __attribute__((pure))
>   /*
>    * Converts given depth value to its corresponding range value.
>    */
> -static uint32_t __attribute__((pure))
> +static uint32_t __rte_pure
>   depth_to_range(uint8_t depth)
>   {
>   	VERIFY_DEPTH(depth);
> diff --git a/lib/lpm/rte_lpm6.c b/lib/lpm/rte_lpm6.c
> index 271bc48..2bdd540 100644
> --- a/lib/lpm/rte_lpm6.c
> +++ b/lib/lpm/rte_lpm6.c
> @@ -1127,7 +1127,7 @@ struct rte_lpm6 *
>    * Convert a depth to a one byte long mask
>    *   Example: 4 will be converted to 0xF0
>    */
> -static uint8_t __attribute__((pure))
> +static uint8_t __rte_pure
>   depth_to_mask_1b(uint8_t depth)
>   {
>   	/* To calculate a mask start with a 1 on the left hand side and right

-- 
Regards,
Vladimir


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

* Re: [PATCH v2 0/3] use rte macros instead of GCC __attribute
  2024-03-06 20:49   ` David Marchand
@ 2024-03-06 21:22     ` Tyler Retzlaff
  0 siblings, 0 replies; 22+ messages in thread
From: Tyler Retzlaff @ 2024-03-06 21:22 UTC (permalink / raw)
  To: David Marchand
  Cc: dev, Bruce Richardson, Honnappa Nagarahalli, Vladimir Medvedkin, mb

On Wed, Mar 06, 2024 at 09:49:31PM +0100, David Marchand wrote:
> On Wed, Feb 28, 2024 at 7:48 PM Tyler Retzlaff
> <roretzla@linux.microsoft.com> wrote:
> >
> > Clean up direct uses of GCC __attribute__ in libs outside of EAL. A
> > checkpatch check already warns for new additions.
> >
> > v2:
> >   * fix typo __rte_pure -> __rte_may_alias in rcu commit message
> >
> > Tyler Retzlaff (3):
> >   eal: add rte pure attribute macro
> >   lpm: use rte macro instead of GCC attribute
> >   rcu: use rte macro instead of GCC attribute
> >
> >  lib/eal/include/rte_common.h | 9 +++++++++
> >  lib/lpm/rte_lpm.c            | 4 ++--
> >  lib/lpm/rte_lpm6.c           | 2 +-
> >  lib/rcu/rcu_qsbr_pvt.h       | 2 +-
> >  4 files changed, 13 insertions(+), 4 deletions(-)
> 
> Introducing __rte_pure and converting lib/lpm looks fine.
> But please finish the job for the other occurence in the tree as it is
> a mechanical change.

Sure, it's trivial that I don't have to burn it in on lib first.

Will submit an updated rev.

> 
> Thanks.
> 
> -- 
> David Marchand

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

* [PATCH v3 0/5] use rte macros instead of GCC __attribute
  2024-02-27 23:07 [PATCH 0/3] use rte macros instead of GCC __attribute Tyler Retzlaff
                   ` (3 preceding siblings ...)
  2024-02-28 18:47 ` [PATCH v2 0/3] use rte macros instead of GCC __attribute Tyler Retzlaff
@ 2024-03-06 22:14 ` Tyler Retzlaff
  2024-03-06 22:14   ` [PATCH v3 1/5] eal: add rte pure attribute macro Tyler Retzlaff
                     ` (4 more replies)
  4 siblings, 5 replies; 22+ messages in thread
From: Tyler Retzlaff @ 2024-03-06 22:14 UTC (permalink / raw)
  To: dev
  Cc: Bruce Richardson, Honnappa Nagarahalli, Vladimir Medvedkin, mb,
	david.marchand, Tyler Retzlaff

Clean up direct uses of GCC __attribute__((__pure__)) and
__attribute__((__may_alias__)). A checkpatch check already warns for
new additions.

v3:
  * update series to clean app/drivers/lib

v2:
  * fix typo __rte_pure -> __rte_may_alias in rcu commit message

Tyler Retzlaff (5):
  eal: add rte pure attribute macro
  lpm: use rte macro instead of GCC attribute
  rcu: use rte macro instead of GCC attribute
  app/test: use rte macro instead of GCC attribute
  net/cxgbe: use rte macro instead of GCC attribute

 app/test-fib/main.c              | 4 ++--
 drivers/net/cxgbe/base/common.h  | 2 +-
 drivers/net/cxgbe/base/t4_hw.c   | 2 +-
 drivers/net/cxgbe/base/t4vf_hw.c | 2 +-
 lib/eal/include/rte_common.h     | 9 +++++++++
 lib/lpm/rte_lpm.c                | 4 ++--
 lib/lpm/rte_lpm6.c               | 2 +-
 lib/rcu/rcu_qsbr_pvt.h           | 2 +-
 8 files changed, 18 insertions(+), 9 deletions(-)

-- 
1.8.3.1


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

* [PATCH v3 1/5] eal: add rte pure attribute macro
  2024-03-06 22:14 ` [PATCH v3 0/5] " Tyler Retzlaff
@ 2024-03-06 22:14   ` Tyler Retzlaff
  2024-03-06 22:14   ` [PATCH v3 2/5] lpm: use rte macro instead of GCC attribute Tyler Retzlaff
                     ` (3 subsequent siblings)
  4 siblings, 0 replies; 22+ messages in thread
From: Tyler Retzlaff @ 2024-03-06 22:14 UTC (permalink / raw)
  To: dev
  Cc: Bruce Richardson, Honnappa Nagarahalli, Vladimir Medvedkin, mb,
	david.marchand, Tyler Retzlaff

Add __rte_pure for __attribute__((pure)) to permit elimination of
direct use of __attribute__((pure)) in other libs.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
Reviewed-by: Morten Brørup <mb@smartsharesystems.com>
---
 lib/eal/include/rte_common.h | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/lib/eal/include/rte_common.h b/lib/eal/include/rte_common.h
index 298a5c6..b15a5b2 100644
--- a/lib/eal/include/rte_common.h
+++ b/lib/eal/include/rte_common.h
@@ -137,6 +137,15 @@
 #define __rte_weak __attribute__((__weak__))
 
 /**
+ * Mark a function to be pure.
+ */
+#ifdef RTE_TOOLCHAIN_MSVC
+#define __rte_pure
+#else
+#define __rte_pure __attribute__((pure))
+#endif
+
+/**
  * Force symbol to be generated even if it appears to be unused.
  */
 #ifdef RTE_TOOLCHAIN_MSVC
-- 
1.8.3.1


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

* [PATCH v3 2/5] lpm: use rte macro instead of GCC attribute
  2024-03-06 22:14 ` [PATCH v3 0/5] " Tyler Retzlaff
  2024-03-06 22:14   ` [PATCH v3 1/5] eal: add rte pure attribute macro Tyler Retzlaff
@ 2024-03-06 22:14   ` Tyler Retzlaff
  2024-03-06 22:14   ` [PATCH v3 3/5] rcu: " Tyler Retzlaff
                     ` (2 subsequent siblings)
  4 siblings, 0 replies; 22+ messages in thread
From: Tyler Retzlaff @ 2024-03-06 22:14 UTC (permalink / raw)
  To: dev
  Cc: Bruce Richardson, Honnappa Nagarahalli, Vladimir Medvedkin, mb,
	david.marchand, Tyler Retzlaff

Use newly added __rte_pure macro from rte_common.h instead of directly
using __attribute__((pure)).

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
Reviewed-by: Morten Brørup <mb@smartsharesystems.com>
---
 lib/lpm/rte_lpm.c  | 4 ++--
 lib/lpm/rte_lpm6.c | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/lpm/rte_lpm.c b/lib/lpm/rte_lpm.c
index 9633d63..a5c9e7c 100644
--- a/lib/lpm/rte_lpm.c
+++ b/lib/lpm/rte_lpm.c
@@ -85,7 +85,7 @@ struct __rte_lpm {
  * depth  (IN)		: range = 1 - 32
  * mask   (OUT)		: 32bit mask
  */
-static uint32_t __attribute__((pure))
+static uint32_t __rte_pure
 depth_to_mask(uint8_t depth)
 {
 	VERIFY_DEPTH(depth);
@@ -99,7 +99,7 @@ static uint32_t __attribute__((pure))
 /*
  * Converts given depth value to its corresponding range value.
  */
-static uint32_t __attribute__((pure))
+static uint32_t __rte_pure
 depth_to_range(uint8_t depth)
 {
 	VERIFY_DEPTH(depth);
diff --git a/lib/lpm/rte_lpm6.c b/lib/lpm/rte_lpm6.c
index 46d8f71..42828a1 100644
--- a/lib/lpm/rte_lpm6.c
+++ b/lib/lpm/rte_lpm6.c
@@ -1128,7 +1128,7 @@ struct rte_lpm6 *
  * Convert a depth to a one byte long mask
  *   Example: 4 will be converted to 0xF0
  */
-static uint8_t __attribute__((pure))
+static uint8_t __rte_pure
 depth_to_mask_1b(uint8_t depth)
 {
 	/* To calculate a mask start with a 1 on the left hand side and right
-- 
1.8.3.1


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

* [PATCH v3 3/5] rcu: use rte macro instead of GCC attribute
  2024-03-06 22:14 ` [PATCH v3 0/5] " Tyler Retzlaff
  2024-03-06 22:14   ` [PATCH v3 1/5] eal: add rte pure attribute macro Tyler Retzlaff
  2024-03-06 22:14   ` [PATCH v3 2/5] lpm: use rte macro instead of GCC attribute Tyler Retzlaff
@ 2024-03-06 22:14   ` Tyler Retzlaff
  2024-03-06 22:14   ` [PATCH v3 4/5] app/test: " Tyler Retzlaff
  2024-03-06 22:14   ` [PATCH v3 5/5] net/cxgbe: " Tyler Retzlaff
  4 siblings, 0 replies; 22+ messages in thread
From: Tyler Retzlaff @ 2024-03-06 22:14 UTC (permalink / raw)
  To: dev
  Cc: Bruce Richardson, Honnappa Nagarahalli, Vladimir Medvedkin, mb,
	david.marchand, Tyler Retzlaff

Use existing __rte_may_alias macro from rte_common.h instead of
directly using __attribute__((__may_alias__)).

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
Reviewed-by: Morten Brørup <mb@smartsharesystems.com>
---
 lib/rcu/rcu_qsbr_pvt.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/rcu/rcu_qsbr_pvt.h b/lib/rcu/rcu_qsbr_pvt.h
index 5fd7ca2..39b0d50 100644
--- a/lib/rcu/rcu_qsbr_pvt.h
+++ b/lib/rcu/rcu_qsbr_pvt.h
@@ -53,6 +53,6 @@ struct rte_rcu_qsbr_dq {
 typedef struct {
 	uint64_t token;  /**< Token */
 	uint8_t elem[0]; /**< Pointer to user element */
-} __attribute__((__may_alias__)) __rte_rcu_qsbr_dq_elem_t;
+} __rte_may_alias __rte_rcu_qsbr_dq_elem_t;
 
 #endif /* _RTE_RCU_QSBR_PVT_H_ */
-- 
1.8.3.1


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

* [PATCH v3 4/5] app/test: use rte macro instead of GCC attribute
  2024-03-06 22:14 ` [PATCH v3 0/5] " Tyler Retzlaff
                     ` (2 preceding siblings ...)
  2024-03-06 22:14   ` [PATCH v3 3/5] rcu: " Tyler Retzlaff
@ 2024-03-06 22:14   ` Tyler Retzlaff
  2024-03-06 22:41     ` Morten Brørup
  2024-03-06 22:14   ` [PATCH v3 5/5] net/cxgbe: " Tyler Retzlaff
  4 siblings, 1 reply; 22+ messages in thread
From: Tyler Retzlaff @ 2024-03-06 22:14 UTC (permalink / raw)
  To: dev
  Cc: Bruce Richardson, Honnappa Nagarahalli, Vladimir Medvedkin, mb,
	david.marchand, Tyler Retzlaff

Use newly added __rte_pure macro from rte_common.h instead of
directly using __attribute__((pure)).

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 app/test-fib/main.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/app/test-fib/main.c b/app/test-fib/main.c
index 75a5613..c49bfe8 100644
--- a/app/test-fib/main.c
+++ b/app/test-fib/main.c
@@ -137,13 +137,13 @@ struct rt_rule_6 {
 		return (rte_rand() % (u - l) + l);
 }
 
-static __rte_always_inline __attribute__((pure)) uint8_t
+static __rte_always_inline __rte_pure uint8_t
 bits_in_nh(uint8_t nh_sz)
 {
 	return 8 * (1 << nh_sz);
 }
 
-static  __rte_always_inline __attribute__((pure)) uint64_t
+static  __rte_always_inline __rte_pure uint64_t
 get_max_nh(uint8_t nh_sz)
 {
 	/* min between fib and lpm6 which is 21 bits */
-- 
1.8.3.1


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

* [PATCH v3 5/5] net/cxgbe: use rte macro instead of GCC attribute
  2024-03-06 22:14 ` [PATCH v3 0/5] " Tyler Retzlaff
                     ` (3 preceding siblings ...)
  2024-03-06 22:14   ` [PATCH v3 4/5] app/test: " Tyler Retzlaff
@ 2024-03-06 22:14   ` Tyler Retzlaff
  2024-03-06 22:42     ` Morten Brørup
  4 siblings, 1 reply; 22+ messages in thread
From: Tyler Retzlaff @ 2024-03-06 22:14 UTC (permalink / raw)
  To: dev
  Cc: Bruce Richardson, Honnappa Nagarahalli, Vladimir Medvedkin, mb,
	david.marchand, Tyler Retzlaff

Use existing __rte_may_alias macro from rte_common.h instead of
directly using __attribute__((__may_alias__)).

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 drivers/net/cxgbe/base/common.h  | 2 +-
 drivers/net/cxgbe/base/t4_hw.c   | 2 +-
 drivers/net/cxgbe/base/t4vf_hw.c | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/cxgbe/base/common.h b/drivers/net/cxgbe/base/common.h
index 4482ddb..8dc7fab 100644
--- a/drivers/net/cxgbe/base/common.h
+++ b/drivers/net/cxgbe/base/common.h
@@ -428,7 +428,7 @@ static inline unsigned int core_ticks_to_us(const struct adapter *adapter,
 int t4_wr_mbox_meat_timeout(struct adapter *adap, int mbox, const void *cmd,
 			    int size, void *rpl, bool sleep_ok, int timeout);
 int t4_wr_mbox_meat(struct adapter *adap, int mbox,
-		    const void __attribute__((__may_alias__)) *cmd, int size,
+		    const void __rte_may_alias *cmd, int size,
 		    void *rpl, bool sleep_ok);
 
 static inline int t4_wr_mbox_timeout(struct adapter *adap, int mbox,
diff --git a/drivers/net/cxgbe/base/t4_hw.c b/drivers/net/cxgbe/base/t4_hw.c
index bed755f..d02da39 100644
--- a/drivers/net/cxgbe/base/t4_hw.c
+++ b/drivers/net/cxgbe/base/t4_hw.c
@@ -291,7 +291,7 @@ static void fw_asrt(struct adapter *adap, u32 mbox_addr)
  * the return value is the error code indicated by FW (negated).
  */
 int t4_wr_mbox_meat_timeout(struct adapter *adap, int mbox,
-			    const void __attribute__((__may_alias__)) *cmd,
+			    const void __rte_may_alias *cmd,
 			    int size, void *rpl, bool sleep_ok, int timeout)
 {
 	/*
diff --git a/drivers/net/cxgbe/base/t4vf_hw.c b/drivers/net/cxgbe/base/t4vf_hw.c
index 46d24a6..573ccb1 100644
--- a/drivers/net/cxgbe/base/t4vf_hw.c
+++ b/drivers/net/cxgbe/base/t4vf_hw.c
@@ -68,7 +68,7 @@ static void get_mbox_rpl(struct adapter *adap, __be64 *rpl, int nflit,
  * the return value is the error code indicated by FW (negated).
  */
 int t4vf_wr_mbox_core(struct adapter *adapter,
-		      const void __attribute__((__may_alias__)) *cmd,
+		      const void __rte_may_alias *cmd,
 		      int size, void *rpl, bool sleep_ok)
 {
 	/*
-- 
1.8.3.1


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

* RE: [PATCH v3 4/5] app/test: use rte macro instead of GCC attribute
  2024-03-06 22:14   ` [PATCH v3 4/5] app/test: " Tyler Retzlaff
@ 2024-03-06 22:41     ` Morten Brørup
  0 siblings, 0 replies; 22+ messages in thread
From: Morten Brørup @ 2024-03-06 22:41 UTC (permalink / raw)
  To: Tyler Retzlaff, dev
  Cc: Bruce Richardson, Honnappa Nagarahalli, Vladimir Medvedkin,
	david.marchand

> From: Tyler Retzlaff [mailto:roretzla@linux.microsoft.com]
> Sent: Wednesday, 6 March 2024 23.15
> 
> Use newly added __rte_pure macro from rte_common.h instead of
> directly using __attribute__((pure)).
> 
> Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
> ---

Reviewed-by: Morten Brørup <mb@smartsharesystems.com>


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

* RE: [PATCH v3 5/5] net/cxgbe: use rte macro instead of GCC attribute
  2024-03-06 22:14   ` [PATCH v3 5/5] net/cxgbe: " Tyler Retzlaff
@ 2024-03-06 22:42     ` Morten Brørup
  0 siblings, 0 replies; 22+ messages in thread
From: Morten Brørup @ 2024-03-06 22:42 UTC (permalink / raw)
  To: Tyler Retzlaff, dev
  Cc: Bruce Richardson, Honnappa Nagarahalli, Vladimir Medvedkin,
	david.marchand

> From: Tyler Retzlaff [mailto:roretzla@linux.microsoft.com]
> Sent: Wednesday, 6 March 2024 23.15
> 
> Use existing __rte_may_alias macro from rte_common.h instead of
> directly using __attribute__((__may_alias__)).
> 
> Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
> ---

Reviewed-by: Morten Brørup <mb@smartsharesystems.com>


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

end of thread, other threads:[~2024-03-06 22:42 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-27 23:07 [PATCH 0/3] use rte macros instead of GCC __attribute Tyler Retzlaff
2024-02-27 23:07 ` [PATCH 1/3] eal: add rte pure attribute macro Tyler Retzlaff
2024-02-27 23:07 ` [PATCH 2/3] lpm: use rte macro instead of GCC attribute Tyler Retzlaff
2024-02-27 23:07 ` [PATCH 3/3] rcu: " Tyler Retzlaff
2024-02-28  9:29   ` Morten Brørup
2024-02-28 17:29     ` Tyler Retzlaff
2024-02-28 18:47 ` [PATCH v2 0/3] use rte macros instead of GCC __attribute Tyler Retzlaff
2024-02-28 18:47   ` [PATCH v2 1/3] eal: add rte pure attribute macro Tyler Retzlaff
2024-02-28 18:47   ` [PATCH v2 2/3] lpm: use rte macro instead of GCC attribute Tyler Retzlaff
2024-03-06 20:51     ` Medvedkin, Vladimir
2024-02-28 18:47   ` [PATCH v2 3/3] rcu: " Tyler Retzlaff
2024-03-06 19:36   ` [PATCH v2 0/3] use rte macros instead of GCC __attribute Tyler Retzlaff
2024-03-06 20:49   ` David Marchand
2024-03-06 21:22     ` Tyler Retzlaff
2024-03-06 22:14 ` [PATCH v3 0/5] " Tyler Retzlaff
2024-03-06 22:14   ` [PATCH v3 1/5] eal: add rte pure attribute macro Tyler Retzlaff
2024-03-06 22:14   ` [PATCH v3 2/5] lpm: use rte macro instead of GCC attribute Tyler Retzlaff
2024-03-06 22:14   ` [PATCH v3 3/5] rcu: " Tyler Retzlaff
2024-03-06 22:14   ` [PATCH v3 4/5] app/test: " Tyler Retzlaff
2024-03-06 22:41     ` Morten Brørup
2024-03-06 22:14   ` [PATCH v3 5/5] net/cxgbe: " Tyler Retzlaff
2024-03-06 22:42     ` Morten Brørup

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).