[v2,2/3] lpm: use rte macro instead of GCC attribute

Message ID 1709146076-22254-3-git-send-email-roretzla@linux.microsoft.com (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers
Series use rte macros instead of GCC __attribute |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Tyler Retzlaff Feb. 28, 2024, 6:47 p.m. UTC
  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(-)
  

Comments

Vladimir Medvedkin March 6, 2024, 8:51 p.m. UTC | #1
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
  

Patch

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