eal/x86: don't export internal alignment macro

Message ID 20220621141325.1955755-1-david.marchand@redhat.com (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers
Series eal/x86: don't export internal alignment macro |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/iol-aarch64-compile-testing success Testing PASS
ci/iol-aarch64-unit-testing success Testing PASS
ci/iol-x86_64-unit-testing success Testing PASS
ci/github-robot: build success github build: passed
ci/iol-x86_64-compile-testing success Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/iol-abi-testing success Testing PASS

Commit Message

David Marchand June 21, 2022, 2:13 p.m. UTC
  ALIGNMENT_MASK is only used internally.
Besides it lacks a DPDK-related prefix.
Hide it from external eyes.

Reported-by: Morten Brørup <mb@smartsharesystems.com>
Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 lib/eal/x86/include/rte_memcpy.h | 2 ++
 1 file changed, 2 insertions(+)
  

Comments

Morten Brørup June 21, 2022, 2:28 p.m. UTC | #1
> From: David Marchand [mailto:david.marchand@redhat.com]
> Sent: Tuesday, 21 June 2022 16.13
> 
> ALIGNMENT_MASK is only used internally.
> Besides it lacks a DPDK-related prefix.
> Hide it from external eyes.
> 
> Reported-by: Morten Brørup <mb@smartsharesystems.com>
> Signed-off-by: David Marchand <david.marchand@redhat.com>
> ---
>  lib/eal/x86/include/rte_memcpy.h | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/lib/eal/x86/include/rte_memcpy.h
> b/lib/eal/x86/include/rte_memcpy.h
> index 18aa4e43a7..b678b5c942 100644
> --- a/lib/eal/x86/include/rte_memcpy.h
> +++ b/lib/eal/x86/include/rte_memcpy.h
> @@ -851,6 +851,8 @@ rte_memcpy(void *dst, const void *src, size_t n)
>  		return rte_memcpy_generic(dst, src, n);
>  }
> 
> +#undef ALIGNMENT_MASK
> +
>  #if defined(RTE_TOOLCHAIN_GCC) && (GCC_VERSION >= 100000)
>  #pragma GCC diagnostic pop
>  #endif
> --
> 2.36.1
> 

You could consider also giving another name with a lower risk of collision.
However, I think the risk is very low, since it can only collide with other headers being included before this header file, so this suffices.

Reviewed-by: Morten Brørup <mb@smartsharesystems.com>
  
Thomas Monjalon June 22, 2022, 9:32 a.m. UTC | #2
21/06/2022 16:28, Morten Brørup:
> > From: David Marchand [mailto:david.marchand@redhat.com]
> > Sent: Tuesday, 21 June 2022 16.13
> > 
> > ALIGNMENT_MASK is only used internally.
> > Besides it lacks a DPDK-related prefix.
> > Hide it from external eyes.
> > 
> > Reported-by: Morten Brørup <mb@smartsharesystems.com>
> > Signed-off-by: David Marchand <david.marchand@redhat.com>
> > ---
> > --- a/lib/eal/x86/include/rte_memcpy.h
> > +++ b/lib/eal/x86/include/rte_memcpy.h
> > +#undef ALIGNMENT_MASK
> 
> You could consider also giving another name with a lower risk of collision.
> However, I think the risk is very low, since it can only collide with other headers being included before this header file, so this suffices.
> 
> Reviewed-by: Morten Brørup <mb@smartsharesystems.com>

Fixes: f5472703c0bd ("eal: optimize aligned memcpy on x86")
Cc: stable@dpdk.org

Applied, thanks.
  

Patch

diff --git a/lib/eal/x86/include/rte_memcpy.h b/lib/eal/x86/include/rte_memcpy.h
index 18aa4e43a7..b678b5c942 100644
--- a/lib/eal/x86/include/rte_memcpy.h
+++ b/lib/eal/x86/include/rte_memcpy.h
@@ -851,6 +851,8 @@  rte_memcpy(void *dst, const void *src, size_t n)
 		return rte_memcpy_generic(dst, src, n);
 }
 
+#undef ALIGNMENT_MASK
+
 #if defined(RTE_TOOLCHAIN_GCC) && (GCC_VERSION >= 100000)
 #pragma GCC diagnostic pop
 #endif