[2/4] eal: set byteorder in Windows to little endian
diff mbox series

Message ID 20200601093818.5420-3-talshn@mellanox.com
State Superseded
Delegated to: Thomas Monjalon
Headers show
Series
  • Support librte_mbuf on Windows
Related show

Checks

Context Check Description
ci/Intel-compilation fail apply issues
ci/checkpatch success coding style OK

Commit Message

Tal Shnaiderman June 1, 2020, 9:38 a.m. UTC
From: Tal Shnaiderman <talshn@mellanox.com>

Set the endianness in Windows to RTE_LITTLE_ENDIAN as support
for Windows is limited to x86 architecture for now.

Signed-off-by: Tal Shnaiderman <talshn@mellanox.com>
---
 lib/librte_eal/include/generic/rte_byteorder.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Thomas Monjalon June 16, 2020, 7:50 a.m. UTC | #1
01/06/2020 11:38, talshn@mellanox.com:
> From: Tal Shnaiderman <talshn@mellanox.com>
> 
> Set the endianness in Windows to RTE_LITTLE_ENDIAN as support
> for Windows is limited to x86 architecture for now.
> 
> Signed-off-by: Tal Shnaiderman <talshn@mellanox.com>
> ---
> --- a/lib/librte_eal/include/generic/rte_byteorder.h
> +++ b/lib/librte_eal/include/generic/rte_byteorder.h
>  #ifdef RTE_EXEC_ENV_FREEBSD
>  #include <sys/endian.h>
> -#else
> +#elif defined RTE_EXEC_ENV_LINUX
>  #include <endian.h>
> +#elif defined RTE_EXEC_ENV_WINDOWS && !defined RTE_BYTE_ORDER

Why "&& !defined RTE_BYTE_ORDER" ?
How can it be defined earlier?

> +#define RTE_BYTE_ORDER RTE_LITTLE_ENDIAN
>  #endif
Tal Shnaiderman June 25, 2020, 1:24 p.m. UTC | #2
> Subject: Re: [dpdk-dev] [PATCH 2/4] eal: set byteorder in Windows to little
> endian
> 
> 01/06/2020 11:38, talshn@mellanox.com:
> > From: Tal Shnaiderman <talshn@mellanox.com>
> >
> > Set the endianness in Windows to RTE_LITTLE_ENDIAN as support for
> > Windows is limited to x86 architecture for now.
> >
> > Signed-off-by: Tal Shnaiderman <talshn@mellanox.com>
> > ---
> > --- a/lib/librte_eal/include/generic/rte_byteorder.h
> > +++ b/lib/librte_eal/include/generic/rte_byteorder.h
> >  #ifdef RTE_EXEC_ENV_FREEBSD
> >  #include <sys/endian.h>
> > -#else
> > +#elif defined RTE_EXEC_ENV_LINUX
> >  #include <endian.h>
> > +#elif defined RTE_EXEC_ENV_WINDOWS && !defined RTE_BYTE_ORDER
> 
> Why "&& !defined RTE_BYTE_ORDER" ?
> How can it be defined earlier?
> 

You're right, it's unneeded since it is defined later on.

The entire "#elif defined RTE_EXEC_ENV_WINDOWS" section could be removed actually, 
looks like both clang and MinGW contain the predefined __BYTE_ORDER__ macro and detect the right endianness on compile time.

> > +#define RTE_BYTE_ORDER RTE_LITTLE_ENDIAN
> >  #endif
> 
> 
>

Patch
diff mbox series

diff --git a/lib/librte_eal/include/generic/rte_byteorder.h b/lib/librte_eal/include/generic/rte_byteorder.h
index 9ca960932f..6cfdf68731 100644
--- a/lib/librte_eal/include/generic/rte_byteorder.h
+++ b/lib/librte_eal/include/generic/rte_byteorder.h
@@ -17,8 +17,10 @@ 
 #include <stdint.h>
 #ifdef RTE_EXEC_ENV_FREEBSD
 #include <sys/endian.h>
-#else
+#elif defined RTE_EXEC_ENV_LINUX
 #include <endian.h>
+#elif defined RTE_EXEC_ENV_WINDOWS && !defined RTE_BYTE_ORDER
+#define RTE_BYTE_ORDER RTE_LITTLE_ENDIAN
 #endif
 
 #include <rte_common.h>