[dpdk-dev] [PATCH v6 01/38] bnxt: new driver for Broadcom NetXtreme-C devices

Stephen Hurd stephen.hurd at broadcom.com
Wed Jun 15 23:23:01 CEST 2016


From: Ajit Khaparde <ajit.khaparde at broadcom.com>

This patch adds the initial skeleton for bnxt driver along with the
nic guide to tie into the build system.
At this point, the driver simply fails init.

Signed-off-by: Ajit Khaparde <ajit.khaparde at broadcom.com>
Signed-off-by: Stephen Hurd <stephen.hurd at broadcom.com>
Reviewed-by: David Christensen <david.christensen at broadcom.com>

--
v4:
Fix a warning that the document isn't included in any toctree
Also remove a PCI ID added erroneously.

v5:
Re-format footer

v6:
Add a column for the bnxt driver in doc/guides/nics/overview.rst
---
 MAINTAINERS                                     |   5 +
 config/common_base                              |   5 +
 doc/guides/nics/bnxt.rst                        |  49 +++++++++
 doc/guides/nics/index.rst                       |   1 +
 doc/guides/nics/overview.rst                    | 138 ++++++++++++------------
 drivers/net/Makefile                            |   1 +
 drivers/net/bnxt/Makefile                       |  63 +++++++++++
 drivers/net/bnxt/bnxt_ethdev.c                  | 109 +++++++++++++++++++
 drivers/net/bnxt/rte_pmd_bnxt_version.map       |   4 +
 lib/librte_eal/common/include/rte_pci_dev_ids.h |  38 ++++++-
 mk/rte.app.mk                                   |   1 +
 11 files changed, 340 insertions(+), 74 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 3e6b70c..78d8530 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -401,6 +401,11 @@ M: Declan Doherty <declan.doherty at intel.com>
 F: drivers/crypto/null/
 F: doc/guides/cryptodevs/null.rst
 
+Broadcom BNXT PMD
+M: Stephen Hurd <stephen.hurd at broadcom.com>
+F: drivers/net/bnxt/
+F: doc/guides/nics/bnxt.rst
+
 
 Packet processing
 -----------------
diff --git a/config/common_base b/config/common_base
index b9ba405..71be7cd 100644
--- a/config/common_base
+++ b/config/common_base
@@ -245,6 +245,11 @@ CONFIG_RTE_LIBRTE_NFP_PMD=n
 CONFIG_RTE_LIBRTE_NFP_DEBUG=n
 
 #
+# Compile burst-oriented Broadcom BNXT PMD driver
+#
+CONFIG_RTE_LIBRTE_BNXT_PMD=y
+
+#
 # Compile software PMD backed by SZEDATA2 device
 #
 CONFIG_RTE_LIBRTE_PMD_SZEDATA2=n
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 FOR
+    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 ANY
+    THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+    (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+    OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+bnxt poll mode driver library
+=============================
+
+The bnxt poll mode library (**librte_pmd_bnxt**) implements support for
+**Broadcom NetXtreme® 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® Brand section <https://www.broadcom.com/products/ethernet-communication-and-switching?technology%5B%5D=88>`_
+of the `Broadcom web site <http://www.broadcom.com/>`_.
+
+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/doc/guides/nics/index.rst b/doc/guides/nics/index.rst
index 0b13698..ffe011e 100644
--- a/doc/guides/nics/index.rst
+++ b/doc/guides/nics/index.rst
@@ -36,6 +36,7 @@ Network Interface Controller Drivers
     :numbered:
 
     overview
+    bnxt
     bnx2x
     cxgbe
     e1000em
diff --git a/doc/guides/nics/overview.rst b/doc/guides/nics/overview.rst
index 0bd8fae..01d043a 100644
--- a/doc/guides/nics/overview.rst
+++ b/doc/guides/nics/overview.rst
@@ -74,79 +74,79 @@ Most of these differences are summarized below.
 
 .. table:: Features availability in networking drivers
 
-   ==================== = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
-   Feature              a b b b c e e e i i i i i i i i i i f f f f m m m n n p q q r s v v v v x
-                        f n n o x 1 n n 4 4 4 4 g g x x x x m m m m l l p f u c e e i z h i i m e
-                        p x x n g 0 a i 0 0 0 0 b b g g g g 1 1 1 1 x x i p l a d d n e o r r x n
-                        a 2 2 d b 0   c e e e e   v b b b b 0 0 0 0 4 5 p   l p e e g d s t t n v
-                        c x x i e 0       . v v   f e e e e k k k k     e         v   a t i i e i
-                        k   v n           . f f       . v v   . v v               f   t   o o t r
-                        e   f g           .   .       . f f   . f f                   a     . 3 t
-                        t                 v   v       v   v   v   v                   2     v
-                                          e   e       e   e   e   e                         e
-                                          c   c       c   c   c   c                         c
-   ==================== = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
+   ==================== = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
+   Feature              a b b b b c e e e i i i i i i i i i i f f f f m m m n n p q q r s v v v v x
+                        f n n n o x 1 n n 4 4 4 4 g g x x x x m m m m l l p f u c e e i z h i i m e
+                        p x x x n g 0 a i 0 0 0 0 b b g g g g 1 1 1 1 x x i p l a d d n e o r r x n
+                        a 2 2 t d b 0   c e e e e   v b b b b 0 0 0 0 4 5 p   l p e e g d s t t n v
+                        c x x   i e 0       . v v   f e e e e k k k k     e         v   a t i i e i
+                        k   v   n           . f f       . v v   . v v               f   t   o o t r
+                        e   f   g           .   .       . f f   . f f                   a     . 3 t
+                        t                   v   v       v   v   v   v                   2     v
+                                            e   e       e   e   e   e                         e
+                                            c   c       c   c   c   c                         c
+   ==================== = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
    Speed capabilities
-   Link status            Y Y   Y Y   Y Y Y     Y   Y Y Y Y         Y Y         Y Y   Y Y Y Y
-   Link status event      Y Y     Y     Y Y     Y   Y Y             Y Y         Y Y     Y
+   Link status            Y Y Y   Y Y   Y Y Y     Y   Y Y Y Y         Y Y         Y Y   Y Y Y Y
+   Link status event      Y Y       Y     Y Y     Y   Y Y             Y Y         Y Y     Y
    Queue status event                                                                   Y
-   Rx interrupt                   Y     Y Y Y Y Y Y Y Y Y Y Y Y Y Y
-   Queue start/stop             Y   Y Y Y Y Y Y     Y Y     Y Y Y Y Y Y               Y   Y Y
-   MTU update                   Y Y Y           Y   Y Y Y Y         Y Y
-   Jumbo frame                  Y Y Y Y Y Y Y Y Y   Y Y Y Y Y Y Y Y Y Y       Y Y Y
-   Scattered Rx                 Y Y Y   Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y               Y   Y
-   LRO                                              Y Y Y Y
-   TSO                          Y   Y   Y Y Y Y Y Y Y Y Y Y Y Y Y Y
-   Promiscuous mode       Y Y   Y Y   Y Y Y Y Y Y Y Y Y     Y Y     Y Y         Y Y   Y   Y Y
-   Allmulticast mode            Y Y     Y Y Y Y Y Y Y Y Y Y Y Y     Y Y         Y Y   Y   Y Y
-   Unicast MAC filter     Y Y     Y   Y Y Y Y Y Y Y Y Y Y Y Y Y     Y Y         Y Y       Y Y
-   Multicast MAC filter   Y Y         Y Y Y Y Y             Y Y     Y Y         Y Y       Y Y
-   RSS hash                     Y   Y Y Y Y Y Y Y   Y Y Y Y Y Y Y Y Y Y         Y Y
-   RSS key update                   Y   Y Y Y Y Y   Y Y Y Y Y Y Y Y   Y
-   RSS reta update                  Y   Y Y Y Y Y   Y Y Y Y Y Y Y Y   Y
-   VMDq                                 Y Y     Y   Y Y     Y Y
-   SR-IOV                   Y       Y   Y Y     Y   Y Y             Y Y           Y
-   DCB                                  Y Y     Y   Y Y
-   VLAN filter                    Y   Y Y Y Y Y Y Y Y Y Y Y Y Y     Y Y         Y Y       Y Y
-   Ethertype filter                     Y Y     Y   Y Y
-   N-tuple filter                               Y   Y Y
-   SYN filter                                   Y   Y Y
-   Tunnel filter                        Y Y         Y Y
-   Flexible filter                              Y
-   Hash filter                          Y Y Y Y
-   Flow director                        Y Y         Y Y               Y
-   Flow control                 Y Y     Y Y     Y   Y Y                         Y Y
-   Rate limitation                                  Y Y
-   Traffic mirroring                    Y Y         Y Y
-   CRC offload                  Y Y Y Y Y   Y   Y Y Y   Y   Y Y Y Y   Y         Y Y
-   VLAN offload                 Y Y Y Y Y   Y   Y Y Y   Y   Y Y Y Y   Y         Y Y
-   QinQ offload                   Y     Y   Y   Y Y Y   Y
-   L3 checksum offload          Y Y Y Y Y   Y   Y Y Y   Y   Y Y Y Y Y Y
-   L4 checksum offload          Y Y Y Y Y   Y   Y Y Y   Y   Y Y Y Y Y Y
-   Inner L3 checksum                Y   Y   Y       Y   Y           Y
-   Inner L4 checksum                Y   Y   Y       Y   Y           Y
-   Packet type parsing          Y     Y Y   Y   Y Y Y   Y   Y Y Y Y Y Y         Y Y
-   Timesync                             Y Y     Y   Y Y
-   Basic stats            Y Y   Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y       Y Y Y   Y Y Y Y
-   Extended stats                   Y   Y Y Y Y Y Y Y Y Y Y Y Y Y Y                   Y Y
-   Stats per queue              Y                   Y Y     Y Y Y Y Y Y         Y Y   Y   Y Y
-   EEPROM dump                                  Y   Y Y
-   Registers dump                               Y Y Y Y Y Y
-   Multiprocess aware                   Y Y Y Y     Y Y Y Y Y Y Y Y Y Y       Y Y Y
-   BSD nic_uio                  Y Y   Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y                       Y Y
-   Linux UIO              Y Y   Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y             Y Y       Y Y
-   Linux VFIO                   Y Y   Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y                       Y Y
-   Other kdrv                                                       Y Y               Y
-   ARMv7                                                                      Y           Y Y
-   ARMv8                                                                      Y           Y Y
-   Power8                                                           Y Y       Y
-   TILE-Gx                                                                    Y
-   x86-32                       Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y       Y         Y Y Y
-   x86-64                 Y Y   Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y       Y Y Y   Y Y Y Y
-   Usage doc              Y Y   Y     Y                             Y Y       Y Y Y   Y   Y
+   Rx interrupt                     Y     Y Y Y Y Y Y Y Y Y Y Y Y Y Y
+   Queue start/stop           Y   Y   Y Y Y Y Y Y     Y Y     Y Y Y Y Y Y               Y   Y Y
+   MTU update                     Y Y Y           Y   Y Y Y Y         Y Y
+   Jumbo frame                    Y Y Y Y Y Y Y Y Y   Y Y Y Y Y Y Y Y Y Y       Y Y Y
+   Scattered Rx                   Y Y Y   Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y               Y   Y
+   LRO                                                Y Y Y Y
+   TSO                            Y   Y   Y Y Y Y Y Y Y Y Y Y Y Y Y Y
+   Promiscuous mode       Y Y Y   Y Y   Y Y Y Y Y Y Y Y Y     Y Y     Y Y         Y Y   Y   Y Y
+   Allmulticast mode              Y Y     Y Y Y Y Y Y Y Y Y Y Y Y     Y Y         Y Y   Y   Y Y
+   Unicast MAC filter     Y Y Y     Y   Y Y Y Y Y Y Y Y Y Y Y Y Y     Y Y         Y Y       Y Y
+   Multicast MAC filter   Y Y Y         Y Y Y Y Y             Y Y     Y Y         Y Y       Y Y
+   RSS hash                       Y   Y Y Y Y Y Y Y   Y Y Y Y Y Y Y Y Y Y         Y Y
+   RSS key update                     Y   Y Y Y Y Y   Y Y Y Y Y Y Y Y   Y
+   RSS reta update            Y       Y   Y Y Y Y Y   Y Y Y Y Y Y Y Y   Y
+   VMDq                                   Y Y     Y   Y Y     Y Y
+   SR-IOV                   Y         Y   Y Y     Y   Y Y             Y Y           Y
+   DCB                                    Y Y     Y   Y Y
+   VLAN filter                      Y   Y Y Y Y Y Y Y Y Y Y Y Y Y     Y Y         Y Y       Y Y
+   Ethertype filter                       Y Y     Y   Y Y
+   N-tuple filter                                 Y   Y Y
+   SYN filter                                     Y   Y Y
+   Tunnel filter                          Y Y         Y Y
+   Flexible filter                                Y
+   Hash filter                            Y Y Y Y
+   Flow director                          Y Y         Y Y               Y
+   Flow control                   Y Y     Y Y     Y   Y Y                         Y Y
+   Rate limitation                                    Y Y
+   Traffic mirroring                      Y Y         Y Y
+   CRC offload                    Y Y Y Y Y   Y   Y Y Y   Y   Y Y Y Y   Y         Y Y
+   VLAN offload                   Y Y Y Y Y   Y   Y Y Y   Y   Y Y Y Y   Y         Y Y
+   QinQ offload                     Y     Y   Y   Y Y Y   Y
+   L3 checksum offload            Y Y Y Y Y   Y   Y Y Y   Y   Y Y Y Y Y Y
+   L4 checksum offload            Y Y Y Y Y   Y   Y Y Y   Y   Y Y Y Y Y Y
+   Inner L3 checksum                  Y   Y   Y       Y   Y           Y
+   Inner L4 checksum                  Y   Y   Y       Y   Y           Y
+   Packet type parsing            Y     Y Y   Y   Y Y Y   Y   Y Y Y Y Y Y         Y Y
+   Timesync                               Y Y     Y   Y Y
+   Basic stats            Y Y Y   Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y       Y Y Y   Y Y Y Y
+   Extended stats             Y       Y   Y Y Y Y Y Y Y Y Y Y Y Y Y Y                   Y Y
+   Stats per queue                Y                   Y Y     Y Y Y Y Y Y         Y Y   Y   Y Y
+   EEPROM dump                                    Y   Y Y
+   Registers dump                                 Y Y Y Y Y Y
+   Multiprocess aware                     Y Y Y Y     Y Y Y Y Y Y Y Y Y Y       Y Y Y
+   BSD nic_uio                    Y Y   Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y                       Y Y
+   Linux UIO              Y Y Y   Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y             Y Y       Y Y
+   Linux VFIO                     Y Y   Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y                       Y Y
+   Other kdrv                                                         Y Y               Y
+   ARMv7                                                                        Y           Y Y
+   ARMv8                                                                        Y           Y Y
+   Power8                                                             Y Y       Y
+   TILE-Gx                                                                      Y
+   x86-32                         Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y       Y         Y Y Y
+   x86-64                 Y Y Y   Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y       Y Y Y   Y Y Y Y
+   Usage doc              Y Y     Y     Y                             Y Y       Y Y Y   Y   Y
    Design doc
    Perf doc
-   ==================== = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
+   ==================== = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
 
 .. Note::
 
diff --git a/drivers/net/Makefile b/drivers/net/Makefile
index 6ba7658..3832706 100644
--- a/drivers/net/Makefile
+++ b/drivers/net/Makefile
@@ -45,6 +45,7 @@ DIRS-$(CONFIG_RTE_LIBRTE_MLX4_PMD) += mlx4
 DIRS-$(CONFIG_RTE_LIBRTE_MLX5_PMD) += mlx5
 DIRS-$(CONFIG_RTE_LIBRTE_MPIPE_PMD) += mpipe
 DIRS-$(CONFIG_RTE_LIBRTE_NFP_PMD) += nfp
+DIRS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += bnxt
 DIRS-$(CONFIG_RTE_LIBRTE_PMD_NULL) += null
 DIRS-$(CONFIG_RTE_LIBRTE_PMD_PCAP) += pcap
 DIRS-$(CONFIG_RTE_LIBRTE_QEDE_PMD) += qede
diff --git a/drivers/net/bnxt/Makefile b/drivers/net/bnxt/Makefile
new file mode 100644
index 0000000..f6333fd
--- /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 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 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 FOR
+#   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 ANY
+#   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+#   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+#   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+include $(RTE_SDK)/mk/rte.vars.mk
+
+#
+# library name
+#
+LIB = librte_pmd_bnxt.a
+
+LIBABIVER := 1
+
+CFLAGS += -O3
+CFLAGS += $(WERROR_FLAGS)
+
+EXPORT_MAP := rte_pmd_bnxt_version.map
+
+#
+# all source are stored in SRCS-y
+#
+SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += bnxt_ethdev.c
+
+#
+# Export include files
+#
+SYMLINK-y-include +=
+
+# this lib depends upon:
+DEPDIRS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += lib/librte_mbuf
+DEPDIRS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += lib/librte_ether
+DEPDIRS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += lib/librte_eal
+
+include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
new file mode 100644
index 0000000..af8a65f
--- /dev/null
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -0,0 +1,109 @@
+/*-
+ *   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 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 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 FOR
+ *   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 ANY
+ *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <inttypes.h>
+#include <stdbool.h>
+
+#include <rte_dev.h>
+#include <rte_ethdev.h>
+#include <rte_malloc.h>
+#include <rte_cycles.h>
+
+#define DRV_MODULE_NAME		"bnxt"
+static const char bnxt_version[] =
+	"Broadcom Cumulus driver " DRV_MODULE_NAME "\n";
+
+static struct rte_pci_id bnxt_pci_id_map[] = {
+#define RTE_PCI_DEV_ID_DECL_BNXT(vend, dev) {RTE_PCI_DEVICE(vend, dev)},
+#include "rte_pci_dev_ids.h"
+	{.device_id = 0},
+};
+
+/*
+ * Initialization
+ */
+
+static int
+bnxt_dev_init(struct rte_eth_dev *eth_dev)
+{
+	static int version_printed;
+	int rc;
+
+	if (version_printed++ == 0)
+		RTE_LOG(INFO, PMD, "%s", bnxt_version);
+
+	if (eth_dev->pci_dev->addr.function >= 2 &&
+			eth_dev->pci_dev->addr.function < 4) {
+		RTE_LOG(ERR, PMD, "Function not enabled %x:\n",
+			eth_dev->pci_dev->addr.function);
+		rc = -ENOMEM;
+		goto error;
+	}
+
+	rte_eth_copy_pci_info(eth_dev, eth_dev->pci_dev);
+	rc = -EPERM;
+
+error:
+	return rc;
+}
+
+static int
+bnxt_dev_uninit(struct rte_eth_dev *eth_dev __rte_unused) {
+	return 0;
+}
+
+static struct eth_driver bnxt_rte_pmd = {
+	.pci_drv = {
+		    .name = "rte_" DRV_MODULE_NAME "_pmd",
+		    .id_table = bnxt_pci_id_map,
+		    .drv_flags = RTE_PCI_DRV_NEED_MAPPING,
+		    },
+	.eth_dev_init = bnxt_dev_init,
+	.eth_dev_uninit = bnxt_dev_uninit,
+	.dev_private_size = 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 = {
+	.name = "eth_bnxt",
+	.type = PMD_PDEV,
+	.init = 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..f63cdc0 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, which
  * 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 the
- * 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
 
+#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,28 @@ RTE_PCI_DEV_ID_DECL_BNX2X(PCI_VENDOR_ID_BROADCOM, BNX2X_DEV_ID_57811_MF)
 RTE_PCI_DEV_ID_DECL_BNX2X(PCI_VENDOR_ID_BROADCOM, BNX2X_DEV_ID_57840_MF)
 #endif
 
+/****************** 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_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_PF)
+RTE_PCI_DEV_ID_DECL_BNXT(PCI_VENDOR_ID_BROADCOM, BROADCOM_DEV_ID_57304_VF)
+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_PF)
+RTE_PCI_DEV_ID_DECL_BNXT(PCI_VENDOR_ID_BROADCOM, BROADCOM_DEV_ID_57406_VF)
+RTE_PCI_DEV_ID_DECL_BNXT(PCI_VENDOR_ID_BROADCOM, BROADCOM_DEV_ID_57406_MF)
+
 /*
  * Undef all RTE_PCI_DEV_ID_DECL_* here.
  */
@@ -702,3 +729,4 @@ RTE_PCI_DEV_ID_DECL_BNX2X(PCI_VENDOR_ID_BROADCOM, BNX2X_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 e9969fc..c62ba64 100644
--- a/mk/rte.app.mk
+++ b/mk/rte.app.mk
@@ -103,6 +103,7 @@ ifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),n)
 
 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_AF_PACKET)  += -lrte_pmd_af_packet
 _LDLIBS-$(CONFIG_RTE_LIBRTE_BNX2X_PMD)      += -lrte_pmd_bnx2x -lz
+_LDLIBS-$(CONFIG_RTE_LIBRTE_BNXT_PMD)       += -lrte_pmd_bnxt
 _LDLIBS-$(CONFIG_RTE_LIBRTE_CXGBE_PMD)      += -lrte_pmd_cxgbe
 _LDLIBS-$(CONFIG_RTE_LIBRTE_E1000_PMD)      += -lrte_pmd_e1000
 _LDLIBS-$(CONFIG_RTE_LIBRTE_ENA_PMD)        += -lrte_pmd_ena
-- 
1.9.1



More information about the dev mailing list