numam-dpdk/drivers/net/bnx2x/bnx2x_osal.h
Rasesh Mody a3d1111a77 net/bnx2x: fix meson build
Use kernel headers for __le* types to avoid potential conflicts
resulting in redefinition errors for some Linux build environments.
Add check for FreeBSD execution environments.

Without this fix, aarch64 builds can fail with error below:

In file included from ../drivers/net/bnx2x/bnx2x.h:22,
                 from ../drivers/net/bnx2x/bnx2x_ethdev.c:8:
../drivers/net/bnx2x/bnx2x_osal.h:27:17: error:
conflicting types for ‘uint64_t’
 #define __le64  uint64_t
               ^~~~~~~~
In file included from /usr/include/stdint.h:37,
                 from /usr/lib/gcc/aarch64-linux-gnu/8/include/stdint.h:9,
                 from ../lib/librte_eal/common/include/arch/arm/rte_byteorder.h:16,
                 from ../drivers/net/bnx2x/bnx2x.h:17,
                 from ../drivers/net/bnx2x/bnx2x_ethdev.c:8:
/usr/include/aarch64-linux-gnu/bits/stdint-uintn.h:27:20: note:
previous declaration of ‘uint64_t’ was here
 typedef __uint64_t uint64_t;
                    ^~~~~~~~

There is also one minor change mixed in this commit:
Some use of __FreeBSD__ are replaced by RTE_EXEC_ENV_FREEBSD.

Fixes: 38dff79ba7 ("net/bnx2x: update HSI")

Signed-off-by: Rasesh Mody <rmody@marvell.com>
Tested-by: Dharmik Thakkar <dharmik.thakkar@arm.com>
Tested-by: Gavin Hu <gavin.hu@arm.com>
2019-11-06 11:55:24 +01:00

36 lines
664 B
C

/* SPDX-License-Identifier: BSD-3-Clause
* Copyright (c) 2019 Cavium Inc.
*
* All rights reserved.
* www.cavium.com
*/
#ifndef BNX2X_OSAL_H
#define BNX2X_OSAL_H
#ifdef RTE_EXEC_ENV_FREEBSD
#include <sys/stat.h>
#else
#include <linux/types.h>
#endif
#if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN
#ifndef __LITTLE_ENDIAN
#define __LITTLE_ENDIAN RTE_LITTLE_ENDIAN
#endif
#undef __BIG_ENDIAN
#elif RTE_BYTE_ORDER == RTE_BIG_ENDIAN
#ifndef __BIG_ENDIAN
#define __BIG_ENDIAN RTE_BIG_ENDIAN
#endif
#undef __LITTLE_ENDIAN
#endif
#ifdef RTE_EXEC_ENV_FREEBSD
#define __le16 uint16_t
#define __le32 uint32_t
#define __le64 uint64_t
#endif
#endif /* BNX2X_OSAL_H */