From: Rasesh Mody Date: Wed, 6 Nov 2019 05:45:20 +0000 (-0800) Subject: net/bnx2x: fix meson build X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=a3d1111a778e9b3093093db253c43b0e520e58d5;p=dpdk.git 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: 38dff79ba736 ("net/bnx2x: update HSI") Signed-off-by: Rasesh Mody Tested-by: Dharmik Thakkar Tested-by: Gavin Hu --- diff --git a/drivers/net/bnx2x/bnx2x.c b/drivers/net/bnx2x/bnx2x.c index e1dfe602c8..ed31335ac5 100644 --- a/drivers/net/bnx2x/bnx2x.c +++ b/drivers/net/bnx2x/bnx2x.c @@ -9581,7 +9581,7 @@ static int bnx2x_pci_get_caps(struct bnx2x_softc *sc) return -ENOMEM; } -#ifndef __FreeBSD__ +#ifndef RTE_EXEC_ENV_FREEBSD pci_read(sc, PCI_STATUS, &status, 2); if (!(status & PCI_STATUS_CAP_LIST)) { #else @@ -9592,7 +9592,7 @@ static int bnx2x_pci_get_caps(struct bnx2x_softc *sc) return -1; } -#ifndef __FreeBSD__ +#ifndef RTE_EXEC_ENV_FREEBSD pci_read(sc, PCI_CAPABILITY_LIST, &pci_cap.next, 1); #else pci_read(sc, PCIR_CAP_PTR, &pci_cap.next, 1); diff --git a/drivers/net/bnx2x/bnx2x.h b/drivers/net/bnx2x/bnx2x.h index 43c60408a5..3383c76759 100644 --- a/drivers/net/bnx2x/bnx2x.h +++ b/drivers/net/bnx2x/bnx2x.h @@ -30,7 +30,7 @@ #include "elink.h" -#ifndef __FreeBSD__ +#ifndef RTE_EXEC_ENV_FREEBSD #include #define PCIY_PMG PCI_CAP_ID_PM @@ -60,7 +60,7 @@ #define IFM_10G_TWINAX 22 /* 10GBase Twinax copper */ #define IFM_10G_T 26 /* 10GBase-T - RJ45 */ -#ifndef __FreeBSD__ +#ifndef RTE_EXEC_ENV_FREEBSD #define PCIR_EXPRESS_DEVICE_STA PCI_EXP_TYPE_RC_EC #define PCIM_EXP_STA_TRANSACTION_PND PCI_EXP_DEVSTA_TRPND #define PCIR_EXPRESS_LINK_STA PCI_EXP_LNKSTA diff --git a/drivers/net/bnx2x/bnx2x_osal.h b/drivers/net/bnx2x/bnx2x_osal.h index 7cd2932592..c4818bb221 100644 --- a/drivers/net/bnx2x/bnx2x_osal.h +++ b/drivers/net/bnx2x/bnx2x_osal.h @@ -8,7 +8,11 @@ #ifndef BNX2X_OSAL_H #define BNX2X_OSAL_H +#ifdef RTE_EXEC_ENV_FREEBSD #include +#else +#include +#endif #if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN #ifndef __LITTLE_ENDIAN @@ -22,8 +26,10 @@ #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 */