From: Rasesh Mody Date: Fri, 11 Dec 2015 06:36:39 +0000 (-0800) Subject: bnx2x: fix build on FreeBSD X-Git-Tag: spdx-start~7773 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=5a1d76f9c2263242145b3cbfe0220dbc84ab83d6;p=dpdk.git bnx2x: fix build on FreeBSD Compile tested. Signed-off-by: Rasesh Mody --- diff --git a/doc/guides/nics/bnx2x.rst b/doc/guides/nics/bnx2x.rst index 7a94080191..5647a9059d 100644 --- a/doc/guides/nics/bnx2x.rst +++ b/doc/guides/nics/bnx2x.rst @@ -155,6 +155,14 @@ command:: cd gmake config T=x86_64-native-bsdapp-gcc install -Wl,-rpath=/usr/local/lib/gcc48 CC=gcc48 +To compile BNX2X PMD for FreeBSD x86_64 gcc target, run the following "gmake" +command: + +.. code-block:: console + + cd + gmake config T=x86_64-native-bsdapp-gcc install -Wl,-rpath=/usr/local/lib/gcc48 CC=gcc48 + Linux ----- diff --git a/drivers/net/bnx2x/bnx2x.c b/drivers/net/bnx2x/bnx2x.c index 7f392ed53c..6782349c19 100644 --- a/drivers/net/bnx2x/bnx2x.c +++ b/drivers/net/bnx2x/bnx2x.c @@ -9519,13 +9519,22 @@ static int bnx2x_pci_get_caps(struct bnx2x_softc *sc) return -ENOMEM; } +#ifndef __FreeBSD__ pci_read(sc, PCI_STATUS, &status, 2); if (!(status & PCI_STATUS_CAP_LIST)) { +#else + pci_read(sc, PCIR_STATUS, &status, 2); + if (!(status & PCIM_STATUS_CAPPRESENT)) { +#endif PMD_DRV_LOG(NOTICE, "PCIe capability reading failed"); return -1; } +#ifndef __FreeBSD__ pci_read(sc, PCI_CAPABILITY_LIST, &pci_cap.next, 1); +#else + pci_read(sc, PCIR_CAP_PTR, &pci_cap.next, 1); +#endif while (pci_cap.next) { cap->addr = pci_cap.next & ~3; pci_read(sc, pci_cap.next & ~3, &pci_cap, 2); diff --git a/drivers/net/bnx2x/bnx2x.h b/drivers/net/bnx2x/bnx2x.h index b049bd108e..32fab219b6 100644 --- a/drivers/net/bnx2x/bnx2x.h +++ b/drivers/net/bnx2x/bnx2x.h @@ -16,28 +16,21 @@ #ifndef __BNX2X_H__ #define __BNX2X_H__ -#include "bnx2x_ethdev.h" +#include -#if __BYTE_ORDER == __LITTLE_ENDIAN -#ifndef LITTLE_ENDIAN -#define LITTLE_ENDIAN -#endif +#if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN #ifndef __LITTLE_ENDIAN -#define __LITTLE_ENDIAN +#define __LITTLE_ENDIAN RTE_LITTLE_ENDIAN #endif -#undef BIG_ENDIAN #undef __BIG_ENDIAN -#else /* _BIG_ENDIAN */ -#ifndef BIG_ENDIAN -#define BIG_ENDIAN -#endif +#elif RTE_BYTE_ORDER == RTE_BIG_ENDIAN #ifndef __BIG_ENDIAN -#define __BIG_ENDIAN +#define __BIG_ENDIAN RTE_BIG_ENDIAN #endif -#undef LITTLE_ENDIAN #undef __LITTLE_ENDIAN #endif +#include "bnx2x_ethdev.h" #include "ecore_mfw_req.h" #include "ecore_fw_defs.h" #include "ecore_hsi.h" @@ -47,6 +40,7 @@ #include "elink.h" +#ifndef __FreeBSD__ #include #define PCIY_PMG PCI_CAP_ID_PM @@ -68,11 +62,15 @@ #define PCIM_PSTAT_PMEENABLE PCI_PM_CTRL_PME_ENABLE #define PCIR_MSIX_CTRL PCI_MSIX_FLAGS #define PCIM_MSIXCTRL_TABLE_SIZE PCI_MSIX_FLAGS_QSIZE +#else +#include +#endif #define IFM_10G_CX4 20 /* 10GBase CX4 copper */ #define IFM_10G_TWINAX 22 /* 10GBase Twinax copper */ #define IFM_10G_T 26 /* 10GBase-T - RJ45 */ +#ifndef __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 @@ -81,6 +79,16 @@ #define PCIR_EXPRESS_DEVICE_CTL PCI_EXP_DEVCTL #define PCIM_EXP_CTL_MAX_PAYLOAD PCI_EXP_DEVCTL_PAYLOAD #define PCIM_EXP_CTL_MAX_READ_REQUEST PCI_EXP_DEVCTL_READRQ +#else +#define PCIR_EXPRESS_DEVICE_STA PCIER_DEVICE_STA +#define PCIM_EXP_STA_TRANSACTION_PND PCIEM_STA_TRANSACTION_PND +#define PCIR_EXPRESS_LINK_STA PCIER_LINK_STA +#define PCIM_LINK_STA_WIDTH PCIEM_LINK_STA_WIDTH +#define PCIM_LINK_STA_SPEED PCIEM_LINK_STA_SPEED +#define PCIR_EXPRESS_DEVICE_CTL PCIER_DEVICE_CTL +#define PCIM_EXP_CTL_MAX_PAYLOAD PCIEM_CTL_MAX_PAYLOAD +#define PCIM_EXP_CTL_MAX_READ_REQUEST PCIEM_CTL_MAX_READ_REQUEST +#endif #ifndef ARRAY_SIZE #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0])) @@ -148,6 +156,7 @@ struct bnx2x_device_type { #endif #define MCLBYTES (1 << MCLSHIFT) +#if !defined(MJUMPAGESIZE) #if BNX2X_PAGE_SIZE < 2048 #define MJUMPAGESIZE MCLBYTES #elif BNX2X_PAGE_SIZE <= 8192 @@ -155,6 +164,7 @@ struct bnx2x_device_type { #else #define MJUMPAGESIZE (8 * 1024) #endif +#endif #define MJUM9BYTES (9 * 1024) #define MJUM16BYTES (16 * 1024) diff --git a/drivers/net/bnx2x/ecore_sp.h b/drivers/net/bnx2x/ecore_sp.h index 8e65584e6b..9c1f55dfda 100644 --- a/drivers/net/bnx2x/ecore_sp.h +++ b/drivers/net/bnx2x/ecore_sp.h @@ -16,23 +16,17 @@ #ifndef ECORE_SP_H #define ECORE_SP_H -#if __BYTE_ORDER == __LITTLE_ENDIAN -#ifndef LITTLE_ENDIAN -#define LITTLE_ENDIAN -#endif +#include + +#if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN #ifndef __LITTLE_ENDIAN -#define __LITTLE_ENDIAN +#define __LITTLE_ENDIAN RTE_LITTLE_ENDIAN #endif -#undef BIG_ENDIAN #undef __BIG_ENDIAN -#else /* _BIG_ENDIAN */ -#ifndef BIG_ENDIAN -#define BIG_ENDIAN -#endif +#elif RTE_BYTE_ORDER == RTE_BIG_ENDIAN #ifndef __BIG_ENDIAN -#define __BIG_ENDIAN +#define __BIG_ENDIAN RTE_BIG_ENDIAN #endif -#undef LITTLE_ENDIAN #undef __LITTLE_ENDIAN #endif