From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx0a-0016ce01.pphosted.com (mx0a-0016ce01.pphosted.com [67.231.148.157]) by dpdk.org (Postfix) with ESMTP id DA5758E56 for ; Thu, 8 Oct 2015 18:54:47 +0200 (CEST) Received: from pps.filterd (m0045602.ppops.net [127.0.0.1]) by mx0a-0016ce01.pphosted.com (8.15.0.59/8.15.0.59) with SMTP id t98GqrL1003082 for ; Thu, 8 Oct 2015 09:54:46 -0700 Received: from avcashub1.qlogic.com (avcashub3.qlogic.com [198.70.193.117]) by mx0a-0016ce01.pphosted.com with ESMTP id 1xdu9yg3he-1 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NOT) for ; Thu, 08 Oct 2015 09:54:46 -0700 Received: from avluser05.qlc.com (10.1.113.115) by qlc.com (10.1.4.192) with Microsoft SMTP Server id 14.3.235.1; Thu, 8 Oct 2015 09:54:45 -0700 Received: (from rmody@localhost) by avluser05.qlc.com (8.14.4/8.14.4/Submit) id t98Gsj57002715; Thu, 8 Oct 2015 09:54:45 -0700 X-Authentication-Warning: avluser05.qlc.com: rmody set sender to rasesh.mody@qlogic.com using -f From: Rasesh Mody To: Date: Thu, 8 Oct 2015 09:54:00 -0700 Message-ID: <1444323245-2622-2-git-send-email-rasesh.mody@qlogic.com> X-Mailer: git-send-email 1.7.10.3 In-Reply-To: <1444323245-2622-1-git-send-email-rasesh.mody@qlogic.com> References: <1444323245-2622-1-git-send-email-rasesh.mody@qlogic.com> MIME-Version: 1.0 Content-Type: text/plain X-Proofpoint-Virus-Version: vendor=nai engine=5700 definitions=7947 signatures=670640 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 clxscore=1015 suspectscore=1 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1507310000 definitions=main-1510080183 Cc: sony.chacko@qlogic.com Subject: [dpdk-dev] [PATCH 1/6] bnx2x: FreeBSD enablement X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Oct 2015 16:54:48 -0000 Compile tested. Signed-off-by: Rasesh Mody --- config/common_bsdapp | 1 + drivers/net/bnx2x/bnx2x.c | 9 +++++++++ drivers/net/bnx2x/bnx2x.h | 23 +++++++++++++++++++++++ drivers/net/bnx2x/ecore_sp.h | 6 ++++++ 4 files changed, 39 insertions(+) diff --git a/config/common_bsdapp b/config/common_bsdapp index b37dcf4..d73725b 100644 --- a/config/common_bsdapp +++ b/config/common_bsdapp @@ -222,6 +222,7 @@ CONFIG_RTE_LIBRTE_BNX2X_DEBUG_INIT=n CONFIG_RTE_LIBRTE_BNX2X_DEBUG_RX=n CONFIG_RTE_LIBRTE_BNX2X_DEBUG_TX=n CONFIG_RTE_LIBRTE_BNX2X_MF_SUPPORT=n +CONFIG_RTE_LIBRTE_BNX2X_REG_ACCESS=n # # Compile burst-oriented Chelsio Terminator 10GbE/40GbE (CXGBE) PMD diff --git a/drivers/net/bnx2x/bnx2x.c b/drivers/net/bnx2x/bnx2x.c index 1fa2492..c005a7a 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 ca3a4d7..724ae64 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 #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 +#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