From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stephen Hurd Subject: [PATCH 01/40] bnxt: new driver for Broadcom NetXtreme-C devices Date: Fri, 6 May 2016 12:25:41 -0700 Message-ID: <1462562780-47991-1-git-send-email-stephen.hurd@broadcom.com> References: <20160421100005.GA976@bricha3-MOBL3> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable To: dev@dpdk.org Return-path: Received: from mail-gw2-out.broadcom.com (mail-gw2-out.broadcom.com [216.31.210.63]) by dpdk.org (Postfix) with ESMTP id 53C26559C for ; Fri, 6 May 2016 21:26:50 +0200 (CEST) Received: from mail-irva-12.broadcom.com (mail-irva-12.broadcom.com [10.11.16.101]) by mail-irv-18.broadcom.com (Postfix) with ESMTP id F01E682023 for ; Fri, 6 May 2016 12:26:48 -0700 (PDT) Received: from DPDK-C1.broadcom.com (dhcp-10-13-115-104.irv.broadcom.com [10.13.115.104]) by mail-irva-12.broadcom.com (Postfix) with ESMTP id 3176212762C for ; Fri, 6 May 2016 12:26:47 -0700 (PDT) In-Reply-To: <20160421100005.GA976@bricha3-MOBL3> List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Initial skeleton simply fails init. Add nic guide and tie into build system. Signed-off-by: Stephen Hurd --- MAINTAINERS | 5 ++ config/common_base | 5 ++ doc/guides/nics/bnxt.rst | 49 +++++++++++ drivers/net/Makefile | 1 + drivers/net/bnxt/Makefile | 63 ++++++++++++++ drivers/net/bnxt/bnxt_ethdev.c | 104 ++++++++++++++++++= ++++++ drivers/net/bnxt/rte_pmd_bnxt_version.map | 4 + lib/librte_eal/common/include/rte_pci_dev_ids.h | 40 +++++++-- mk/rte.app.mk | 1 + 9 files changed, 267 insertions(+), 5 deletions(-) create mode 100644 doc/guides/nics/bnxt.rst create mode 100644 drivers/net/bnxt/Makefile create mode 100644 drivers/net/bnxt/bnxt_ethdev.c create mode 100644 drivers/net/bnxt/rte_pmd_bnxt_version.map diff --git a/MAINTAINERS b/MAINTAINERS index 1953ea2..9a32cdf 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -396,6 +396,11 @@ M: Declan Doherty F: drivers/crypto/null/ F: doc/guides/cryptodevs/null.rst =20 +Broadcom BNXT PMD +M: Stephen Hurd +F: drivers/net/bnxt/ +F: doc/guides/nics/bnxt.rst + =20 Packet processing ----------------- diff --git a/config/common_base b/config/common_base index 1a54e4c..08e617a 100644 --- a/config/common_base +++ b/config/common_base @@ -245,6 +245,11 @@ CONFIG_RTE_LIBRTE_NFP_PMD=3Dn CONFIG_RTE_LIBRTE_NFP_DEBUG=3Dn =20 # +# Compile burst-oriented Broadcom BNXT PMD driver +# +CONFIG_RTE_LIBRTE_BNXT_PMD=3Dy + +# # Compile software PMD backed by SZEDATA2 device # CONFIG_RTE_LIBRTE_PMD_SZEDATA2=3Dn diff --git a/doc/guides/nics/bnxt.rst b/doc/guides/nics/bnxt.rst new file mode 100644 index 0000000..2669e98 --- /dev/null +++ b/doc/guides/nics/bnxt.rst @@ -0,0 +1,49 @@ +.. BSD LICENSE + Copyright 2016 Broadcom Limited + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + * Neither the name of Broadcom Limited nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FO= R + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL= , + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE= , + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON AN= Y + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE US= E + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +bnxt poll mode driver library +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D + +The bnxt poll mode library (**librte_pmd_bnxt**) implements support for +**Broadcom NetXtreme=C2=AE C-Series**. These adapters support Standards= - +compliant 10/25/50Gbps 30MPPS full-duplex throughput. + +Information about this family of adapters can be found in the +`NetXtreme=C2=AE Brand section `_ +of the `Broadcom web site `_. + +Limitations +----------- + +With the current driver, allocated mbufs must be large enough to hold +the entire received frame. If the mbufs are not large enough, the +packets will be dropped. This is most limiting when jumbo frames are +used. + +SR-IOV is not supported. diff --git a/drivers/net/Makefile b/drivers/net/Makefile index 3386a67..ba03bca 100644 --- a/drivers/net/Makefile +++ b/drivers/net/Makefile @@ -45,6 +45,7 @@ DIRS-$(CONFIG_RTE_LIBRTE_MLX4_PMD) +=3D mlx4 DIRS-$(CONFIG_RTE_LIBRTE_MLX5_PMD) +=3D mlx5 DIRS-$(CONFIG_RTE_LIBRTE_MPIPE_PMD) +=3D mpipe DIRS-$(CONFIG_RTE_LIBRTE_NFP_PMD) +=3D nfp +DIRS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) +=3D bnxt DIRS-$(CONFIG_RTE_LIBRTE_PMD_NULL) +=3D null DIRS-$(CONFIG_RTE_LIBRTE_PMD_PCAP) +=3D pcap DIRS-$(CONFIG_RTE_LIBRTE_PMD_RING) +=3D ring diff --git a/drivers/net/bnxt/Makefile b/drivers/net/bnxt/Makefile new file mode 100644 index 0000000..89b4a27 --- /dev/null +++ b/drivers/net/bnxt/Makefile @@ -0,0 +1,63 @@ +# BSD LICENSE +# +# Copyright(c) 2010-2014 Intel Corporation. All rights reserved. +# Copyright(c) 2014 6WIND S.A. +# Copyright(c) Broadcom Limited. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyrigh= t +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Intel Corporation nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FO= R +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL= , +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE= , +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON AN= Y +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE US= E +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +include $(RTE_SDK)/mk/rte.vars.mk + +# +# library name +# +LIB =3D librte_pmd_bnxt.a + +LIBABIVER :=3D 1 + +CFLAGS +=3D -O3 +CFLAGS +=3D $(WERROR_FLAGS) + +EXPORT_MAP :=3D rte_pmd_bnxt_version.map + +# +# all source are stored in SRCS-y +# +SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) +=3D bnxt_ethdev.c + +# +# Export include files +# +SYMLINK-y-include +=3D + +# this lib depends upon: +DEPDIRS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) +=3D lib/librte_mbuf +DEPDIRS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) +=3D lib/librte_ether +DEPDIRS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) +=3D lib/librte_malloc + +include $(RTE_SDK)/mk/rte.lib.mk diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethde= v.c new file mode 100644 index 0000000..d6c0d51 --- /dev/null +++ b/drivers/net/bnxt/bnxt_ethdev.c @@ -0,0 +1,104 @@ +/*- + * BSD LICENSE + * + * Copyright(c) Broadcom Limited. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyrig= ht + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Broadcom Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS F= OR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGH= T + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTA= L, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF US= E, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON A= NY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE U= SE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE= . + */ + +#include +#include + +#include +#include +#include +#include + +#define DRV_MODULE_NAME "bnxt" +static const char bnxt_version[] =3D + "Broadcom Cumulus driver " DRV_MODULE_NAME "\n"; + +static struct rte_pci_id bnxt_pci_id_map[] =3D { +#define RTE_PCI_DEV_ID_DECL_BNXT(vend, dev) {RTE_PCI_DEVICE(vend, dev)}, +#include "rte_pci_dev_ids.h" + {.device_id =3D 0}, +}; + +/* + * Initialization + */ + +static int +bnxt_dev_init(struct rte_eth_dev *eth_dev) +{ + static int version_printed; + + if (version_printed++ =3D=3D 0) + RTE_LOG(INFO, PMD, "%s", bnxt_version); + + if (eth_dev->pci_dev->addr.function >=3D 2 && + eth_dev->pci_dev->addr.function < 4) { + RTE_LOG(ERR, PMD, "Function not enabled %x:\n", + eth_dev->pci_dev->addr.function); + return -ENOMEM; + } + + rte_eth_copy_pci_info(eth_dev, eth_dev->pci_dev); + return -EPERM; +} + +static int +bnxt_dev_uninit(struct rte_eth_dev *eth_dev __rte_unused) { + return 0; +} + +static struct eth_driver bnxt_rte_pmd =3D { + .pci_drv =3D { + .name =3D "rte_" DRV_MODULE_NAME "_pmd", + .id_table =3D bnxt_pci_id_map, + .drv_flags =3D RTE_PCI_DRV_NEED_MAPPING, + }, + .eth_dev_init =3D bnxt_dev_init, + .eth_dev_uninit =3D bnxt_dev_uninit, + .dev_private_size =3D 32 /* this must be non-zero apparently */, +}; + +static int bnxt_rte_pmd_init(const char *name, const char *params __rte_= unused) +{ + RTE_LOG(INFO, PMD, "bnxt_rte_pmd_init() called for %s\n", name); + rte_eth_driver_register(&bnxt_rte_pmd); + return 0; +} + +static struct rte_driver bnxt_pmd_drv =3D { + .name =3D "eth_bnxt", + .type =3D PMD_PDEV, + .init =3D bnxt_rte_pmd_init, +}; + +PMD_REGISTER_DRIVER(bnxt_pmd_drv); diff --git a/drivers/net/bnxt/rte_pmd_bnxt_version.map b/drivers/net/bnxt= /rte_pmd_bnxt_version.map new file mode 100644 index 0000000..349c6e1 --- /dev/null +++ b/drivers/net/bnxt/rte_pmd_bnxt_version.map @@ -0,0 +1,4 @@ +DPDK_16.04 { + + local: *; +}; diff --git a/lib/librte_eal/common/include/rte_pci_dev_ids.h b/lib/librte= _eal/common/include/rte_pci_dev_ids.h index cf7b548..af26e11 100644 --- a/lib/librte_eal/common/include/rte_pci_dev_ids.h +++ b/lib/librte_eal/common/include/rte_pci_dev_ids.h @@ -63,11 +63,12 @@ * This file contains a list of the PCI device IDs recognised by DPDK, w= hich * can be used to fill out an array of structures describing the devices= . * - * Currently four families of devices are recognised: those supported by= the - * IGB driver, by EM driver, those supported by the IXGBE driver, and by= virtio - * driver which is a para virtualization driver running in guest virtual= machine. - * The inclusion of these in an array built using this file depends on t= he - * definition of + * Currently five families of devices are recognised: those supported by= the + * IGB driver, by EM driver, those supported by the IXGBE driver, those + * supported by the BNXT driver, and by virtio driver which is a para + * virtualization driver running in guest virtual machine. The inclusion= of + * these in an array built using this file depends on the definition of + * RTE_PCI_DEV_ID_DECL_BNXT * RTE_PCI_DEV_ID_DECL_EM * RTE_PCI_DEV_ID_DECL_IGB * RTE_PCI_DEV_ID_DECL_IGBVF @@ -152,6 +153,10 @@ #define RTE_PCI_DEV_ID_DECL_BNX2XVF(vend, dev) #endif =20 +#ifndef RTE_PCI_DEV_ID_DECL_BNXT +#define RTE_PCI_DEV_ID_DECL_BNXT(vend, dev) +#endif + #ifndef PCI_VENDOR_ID_INTEL /** Vendor ID used by Intel devices */ #define PCI_VENDOR_ID_INTEL 0x8086 @@ -686,6 +691,30 @@ RTE_PCI_DEV_ID_DECL_BNX2X(PCI_VENDOR_ID_BROADCOM, BN= X2X_DEV_ID_57811_MF) RTE_PCI_DEV_ID_DECL_BNX2X(PCI_VENDOR_ID_BROADCOM, BNX2X_DEV_ID_57840_MF) #endif =20 +/****************** Broadcom bnxt devices ******************/ + +#define BROADCOM_DEV_ID_57301 0x16c8 +#define BROADCOM_DEV_ID_57302 0x16c9 +#define BROADCOM_DEV_ID_57304_PF 0x16ca +#define BROADCOM_DEV_ID_57304_VF 0x16cb +#define BROADCOM_DEV_ID_57304_MF 0x16cc +#define BROADCOM_DEV_ID_57402 0x16d0 +#define BROADCOM_DEV_ID_57404 0x16d1 +#define BROADCOM_DEV_ID_57406_PF 0x16d2 +#define BROADCOM_DEV_ID_57406_VF 0x16d3 +#define BROADCOM_DEV_ID_57406_MF 0x16d4 + +RTE_PCI_DEV_ID_DECL_BNXT(PCI_VENDOR_ID_BROADCOM, BROADCOM_DEV_ID_57301) +RTE_PCI_DEV_ID_DECL_BNXT(PCI_VENDOR_ID_BROADCOM, BROADCOM_DEV_ID_57302) +RTE_PCI_DEV_ID_DECL_BNXT(PCI_VENDOR_ID_BROADCOM, BROADCOM_DEV_ID_57304_P= F) +RTE_PCI_DEV_ID_DECL_BNXT(PCI_VENDOR_ID_BROADCOM, BROADCOM_DEV_ID_57304_V= F) +RTE_PCI_DEV_ID_DECL_BNXT(PCI_VENDOR_ID_BROADCOM, BROADCOM_DEV_ID_57304_M= F) +RTE_PCI_DEV_ID_DECL_BNXT(PCI_VENDOR_ID_BROADCOM, BROADCOM_DEV_ID_57402) +RTE_PCI_DEV_ID_DECL_BNXT(PCI_VENDOR_ID_BROADCOM, BROADCOM_DEV_ID_57404) +RTE_PCI_DEV_ID_DECL_BNXT(PCI_VENDOR_ID_BROADCOM, BROADCOM_DEV_ID_57406_P= F) +RTE_PCI_DEV_ID_DECL_BNXT(PCI_VENDOR_ID_BROADCOM, BROADCOM_DEV_ID_57406_V= F) +RTE_PCI_DEV_ID_DECL_BNXT(PCI_VENDOR_ID_BROADCOM, BROADCOM_DEV_ID_57406_M= F) + /* * Undef all RTE_PCI_DEV_ID_DECL_* here. */ @@ -702,3 +731,4 @@ RTE_PCI_DEV_ID_DECL_BNX2X(PCI_VENDOR_ID_BROADCOM, BNX= 2X_DEV_ID_57840_MF) #undef RTE_PCI_DEV_ID_DECL_VMXNET3 #undef RTE_PCI_DEV_ID_DECL_FM10K #undef RTE_PCI_DEV_ID_DECL_FM10KVF +#undef RTE_PCI_DEV_ID_DECL_BNXT diff --git a/mk/rte.app.mk b/mk/rte.app.mk index c66e491..0c1e5cd 100644 --- a/mk/rte.app.mk +++ b/mk/rte.app.mk @@ -142,6 +142,7 @@ _LDLIBS-$(CONFIG_RTE_LIBRTE_ENA_PMD) +=3D -lrt= e_pmd_ena _LDLIBS-$(CONFIG_RTE_LIBRTE_MLX4_PMD) +=3D -lrte_pmd_mlx4 _LDLIBS-$(CONFIG_RTE_LIBRTE_MLX5_PMD) +=3D -lrte_pmd_mlx5 _LDLIBS-$(CONFIG_RTE_LIBRTE_NFP_PMD) +=3D -lrte_pmd_nfp +_LDLIBS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) +=3D -lrte_pmd_bnxt _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_SZEDATA2) +=3D -lrte_pmd_szedata2 _LDLIBS-$(CONFIG_RTE_LIBRTE_MPIPE_PMD) +=3D -lrte_pmd_mpipe _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_RING) +=3D -lrte_pmd_ring --=20 1.9.1