From: Rasesh Mody <rasesh.mody@qlogic.com>
To: <thomas.monjalon@6wind.com>, <dev@dpdk.org>
Cc: sony.chacko@qlogic.com
Subject: [dpdk-dev] [PATCH v3 06/11] bnx2x: FreeBSD enablement
Date: Mon, 23 Nov 2015 23:44:31 -0800 [thread overview]
Message-ID: <1448351076-23161-7-git-send-email-rasesh.mody@qlogic.com> (raw)
In-Reply-To: <1448351076-23161-1-git-send-email-rasesh.mody@qlogic.com>
Compile tested.
Signed-off-by: Rasesh Mody <rasesh.mody@qlogic.com>
---
doc/guides/nics/bnx2x.rst | 8 ++++++++
drivers/net/bnx2x/bnx2x.c | 9 +++++++++
drivers/net/bnx2x/bnx2x.h | 23 +++++++++++++++++++++++
drivers/net/bnx2x/ecore_sp.h | 6 ++++++
4 files changed, 46 insertions(+)
diff --git a/doc/guides/nics/bnx2x.rst b/doc/guides/nics/bnx2x.rst
index 7a94080..5647a90 100644
--- a/doc/guides/nics/bnx2x.rst
+++ b/doc/guides/nics/bnx2x.rst
@@ -155,6 +155,14 @@ command::
cd <DPDK-source-directory>
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 <DPDK-source-directory>
+ 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 c149ac5..f125c79 100644
--- a/drivers/net/bnx2x/bnx2x.c
+++ b/drivers/net/bnx2x/bnx2x.c
@@ -9505,13 +9505,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 b049bd1..0362e4b 100644
--- a/drivers/net/bnx2x/bnx2x.h
+++ b/drivers/net/bnx2x/bnx2x.h
@@ -16,6 +16,12 @@
#ifndef __BNX2X_H__
#define __BNX2X_H__
+#ifdef __FreeBSD__
+#define __LITTLE_ENDIAN _LITTLE_ENDIAN
+#define __BIG_ENDIAN _BIG_ENDIAN
+#define __BYTE_ORDER _BYTE_ORDER
+#endif
+
#include "bnx2x_ethdev.h"
#if __BYTE_ORDER == __LITTLE_ENDIAN
@@ -47,6 +53,7 @@
#include "elink.h"
+#ifndef __FreeBSD__
#include <linux/pci_regs.h>
#define PCIY_PMG PCI_CAP_ID_PM
@@ -68,11 +75,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 <dev/pci/pcireg.h>
+#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 +92,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 +169,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 +177,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 8e65584..a0b7b75 100644
--- a/drivers/net/bnx2x/ecore_sp.h
+++ b/drivers/net/bnx2x/ecore_sp.h
@@ -16,6 +16,12 @@
#ifndef ECORE_SP_H
#define ECORE_SP_H
+#ifdef __FreeBSD__
+#define __LITTLE_ENDIAN _LITTLE_ENDIAN
+#define __BIG_ENDIAN _BIG_ENDIAN
+#define __BYTE_ORDER _BYTE_ORDER
+#endif
+
#if __BYTE_ORDER == __LITTLE_ENDIAN
#ifndef LITTLE_ENDIAN
#define LITTLE_ENDIAN
--
1.7.10.3
next prev parent reply other threads:[~2015-11-24 7:45 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-24 7:44 [dpdk-dev] [PATCH v3 00/11] bnx2x: Enhancement, fixes, licensing and doumentation Rasesh Mody
2015-11-24 7:44 ` [dpdk-dev] [PATCH v3 01/11] bnx2x: Update VF to support newer PF drivers Rasesh Mody
2015-11-24 7:44 ` [dpdk-dev] [PATCH v3 02/11] bnx2x: Fix x86_64-native-linuxapp-clang build error Rasesh Mody
2015-11-24 7:44 ` [dpdk-dev] [PATCH v3 03/11] bnx2x: Add periodic debug option Rasesh Mody
2015-11-24 7:44 ` [dpdk-dev] [PATCH v3 04/11] doc: Add BNX2X PMD documentationdoc: Add BNX2X PMD documentation Rasesh Mody
2015-11-24 14:16 ` Thomas Monjalon
2015-11-24 7:44 ` [dpdk-dev] [PATCH v3 05/11] bnx2x: Add LICENSE.bnx2x_pmd and update source files Rasesh Mody
2015-11-24 7:44 ` Rasesh Mody [this message]
2015-11-24 14:09 ` [dpdk-dev] [PATCH v3 06/11] bnx2x: FreeBSD enablement Thomas Monjalon
2015-11-24 7:44 ` [dpdk-dev] [PATCH v3 07/11] bnx2x: Linux 32bit enablement Rasesh Mody
2015-11-24 7:44 ` [dpdk-dev] [PATCH v3 08/11] bnx2x: Handle zlib compatibility error Rasesh Mody
2015-11-24 7:44 ` [dpdk-dev] [PATCH v3 09/11] maintainers: Add maintainers for BNX2X PMD Rasesh Mody
2015-11-24 14:19 ` Thomas Monjalon
2015-11-24 7:44 ` [dpdk-dev] [PATCH v3 10/11] config: Enable BNX2X driver build by default Rasesh Mody
2015-11-24 14:25 ` Thomas Monjalon
2015-12-03 0:54 ` Rasesh Mody
2015-12-03 1:30 ` Thomas Monjalon
2015-12-03 2:54 ` Rasesh Mody
2015-12-08 21:45 ` Rasesh Mody
2015-11-24 7:44 ` [dpdk-dev] [PATCH v3 11/11] bnx2x: Add BNX2X PMD versioning Rasesh Mody
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1448351076-23161-7-git-send-email-rasesh.mody@qlogic.com \
--to=rasesh.mody@qlogic.com \
--cc=dev@dpdk.org \
--cc=sony.chacko@qlogic.com \
--cc=thomas.monjalon@6wind.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).