4 * Copyright(c) Broadcom Limited.
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
11 * * Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * * Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in
15 * the documentation and/or other materials provided with the
17 * * Neither the name of Broadcom Corporation nor the names of its
18 * contributors may be used to endorse or promote products derived
19 * from this software without specific prior written permission.
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
38 #include <rte_ethdev.h>
39 #include <rte_malloc.h>
40 #include <rte_cycles.h>
42 #define DRV_MODULE_NAME "bnxt"
43 static const char bnxt_version[] =
44 "Broadcom Cumulus driver " DRV_MODULE_NAME "\n";
46 static struct rte_pci_id bnxt_pci_id_map[] = {
47 #define RTE_PCI_DEV_ID_DECL_BNXT(vend, dev) {RTE_PCI_DEVICE(vend, dev)},
48 #include "rte_pci_dev_ids.h"
57 bnxt_dev_init(struct rte_eth_dev *eth_dev)
59 static int version_printed;
62 if (version_printed++ == 0)
63 RTE_LOG(INFO, PMD, "%s", bnxt_version);
65 if (eth_dev->pci_dev->addr.function >= 2 &&
66 eth_dev->pci_dev->addr.function < 4) {
67 RTE_LOG(ERR, PMD, "Function not enabled %x:\n",
68 eth_dev->pci_dev->addr.function);
73 rte_eth_copy_pci_info(eth_dev, eth_dev->pci_dev);
81 bnxt_dev_uninit(struct rte_eth_dev *eth_dev __rte_unused) {
85 static struct eth_driver bnxt_rte_pmd = {
87 .name = "rte_" DRV_MODULE_NAME "_pmd",
88 .id_table = bnxt_pci_id_map,
89 .drv_flags = RTE_PCI_DRV_NEED_MAPPING,
91 .eth_dev_init = bnxt_dev_init,
92 .eth_dev_uninit = bnxt_dev_uninit,
93 .dev_private_size = 32 /* this must be non-zero apparently */,
96 static int bnxt_rte_pmd_init(const char *name, const char *params __rte_unused)
98 RTE_LOG(INFO, PMD, "bnxt_rte_pmd_init() called for %s\n", name);
99 rte_eth_driver_register(&bnxt_rte_pmd);
103 static struct rte_driver bnxt_pmd_drv = {
106 .init = bnxt_rte_pmd_init,
109 PMD_REGISTER_DRIVER(bnxt_pmd_drv);