ODP_{BIG,LITTLE}_ENDIAN_BITFIELD were always defined, regardless the
value of system's __BIG_ENDIAN_BITFIELD and __LITTLE_ENDIAN_BITFIELD.

As a result, 'odph_tcphdr_t' bitfields in odph_tcp.h were always
arranged as big-endian.

This lead to incorrect parsing in linux-generic's 'parse_tcp' for
little endian systems, which resulted in packet's 'tcp_err' being set.

Fixed by defining ODP_BIG_ENDIAN_BITFIELD or ODP_LITTLE_ENDIAN_BITFIELD
conditionally per system's bitfield endianess.

Signed-off-by: Shmulik Ladkani <shmulik.ladk...@gmail.com>
---
 platform/linux-generic/include/api/odp_byteorder.h | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/platform/linux-generic/include/api/odp_byteorder.h 
b/platform/linux-generic/include/api/odp_byteorder.h
index 5d7cceb4a8..5890011028 100644
--- a/platform/linux-generic/include/api/odp_byteorder.h
+++ b/platform/linux-generic/include/api/odp_byteorder.h
@@ -47,10 +47,14 @@ extern "C" {
 #define ODP_LITTLE_ENDIAN __LITTLE_ENDIAN
 
 /** Big endian bit field */
-#define ODP_BIG_ENDIAN_BITFIELD __BIG_ENDIAN_BITFIELD
+#ifdef __BIG_ENDIAN_BITFIELD
+#define ODP_BIG_ENDIAN_BITFIELD
+#endif
 
 /** Little endian bit field */
-#define ODP_LITTLE_ENDIAN_BITFIELD __LITTLE_ENDIAN_BITFIELD
+#ifdef __LITTLE_ENDIAN_BITFIELD
+#define ODP_LITTLE_ENDIAN_BITFIELD
+#endif
 
 /** Selected byte order */
 #if __BYTE_ORDER == __LITTLE_ENDIAN
-- 
1.9.1


_______________________________________________
lng-odp mailing list
lng-odp@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/lng-odp

Reply via email to