bnx2x: new poll mode driver
v4 cover bnx2x: new poll mode driver
Update to previous sumbission.
- Split main source of driver from one monster patch into two large patches
- Add map files for shared library support
Stephen Hemminger (4):
pci: allow access to PCI config space
bnx2x: new poll mode driver (part1)
bnx2x: new poll mode driver (part2)
bnx2x: enable BNX2X poll mode driver
MAINTAINERS | 3 + config/common_linuxapp | 10 + lib/Makefile | 1 + lib/librte_eal/common/include/rte_pci.h | 28 + lib/librte_eal/common/include/rte_pci_dev_ids.h | 30 + lib/librte_eal/linuxapp/eal/eal_pci.c | 48 + lib/librte_eal/linuxapp/eal/eal_pci_init.h | 11 + lib/librte_eal/linuxapp/eal/eal_pci_uio.c | 14 + lib/librte_eal/linuxapp/eal/eal_pci_vfio.c | 16 + lib/librte_eal/linuxapp/eal/rte_eal_version.map | 2 + lib/librte_pmd_bnx2x/Makefile | 28 + lib/librte_pmd_bnx2x/bnx2x.c | 11816 +++++++++++++++++++ lib/librte_pmd_bnx2x/bnx2x.h | 1998 ++++ lib/librte_pmd_bnx2x/bnx2x_ethdev.c | 542 + lib/librte_pmd_bnx2x/bnx2x_ethdev.h | 79 + lib/librte_pmd_bnx2x/bnx2x_logs.h | 51 + lib/librte_pmd_bnx2x/bnx2x_rxtx.c | 487 + lib/librte_pmd_bnx2x/bnx2x_rxtx.h | 85 + lib/librte_pmd_bnx2x/bnx2x_stats.c | 1619 +++ lib/librte_pmd_bnx2x/bnx2x_stats.h | 632 + lib/librte_pmd_bnx2x/bnx2x_vfpf.c | 597 + lib/librte_pmd_bnx2x/bnx2x_vfpf.h | 315 + lib/librte_pmd_bnx2x/debug.c | 113 + lib/librte_pmd_bnx2x/ecore_fw_defs.h | 422 + lib/librte_pmd_bnx2x/ecore_hsi.h | 6348 ++++++++++ lib/librte_pmd_bnx2x/ecore_init.h | 841 ++ lib/librte_pmd_bnx2x/ecore_init_ops.h | 886 ++ lib/librte_pmd_bnx2x/ecore_mfw_req.h | 206 + lib/librte_pmd_bnx2x/ecore_reg.h | 3663 ++++++ lib/librte_pmd_bnx2x/ecore_sp.c | 5455 +++++++++ lib/librte_pmd_bnx2x/ecore_sp.h | 1795 +++ lib/librte_pmd_bnx2x/elink.c | 13378 ++++++++++++++++++++++ lib/librte_pmd_bnx2x/elink.h | 609 + lib/librte_pmd_bnx2x/rte_pmd_bnx2x_version.map | 4 + mk/rte.app.mk | 8 + 35 files changed, 52140 insertions(+) create mode 100644 lib/librte_pmd_bnx2x/Makefile create mode 100644 lib/librte_pmd_bnx2x/bnx2x.c create mode 100644 lib/librte_pmd_bnx2x/bnx2x.h create mode 100644 lib/librte_pmd_bnx2x/bnx2x_ethdev.c create mode 100644 lib/librte_pmd_bnx2x/bnx2x_ethdev.h create mode 100644 lib/librte_pmd_bnx2x/bnx2x_logs.h create mode 100644 lib/librte_pmd_bnx2x/bnx2x_rxtx.c create mode 100644 lib/librte_pmd_bnx2x/bnx2x_rxtx.h create mode 100644 lib/librte_pmd_bnx2x/bnx2x_stats.c create mode 100644 lib/librte_pmd_bnx2x/bnx2x_stats.h create mode 100644 lib/librte_pmd_bnx2x/bnx2x_vfpf.c create mode 100644 lib/librte_pmd_bnx2x/bnx2x_vfpf.h create mode 100644 lib/librte_pmd_bnx2x/debug.c create mode 100644 lib/librte_pmd_bnx2x/ecore_fw_defs.h create mode 100644 lib/librte_pmd_bnx2x/ecore_hsi.h create mode 100644 lib/librte_pmd_bnx2x/ecore_init.h create mode 100644 lib/librte_pmd_bnx2x/ecore_init_ops.h create mode 100644 lib/librte_pmd_bnx2x/ecore_mfw_req.h create mode 100644 lib/librte_pmd_bnx2x/ecore_reg.h create mode 100644 lib/librte_pmd_bnx2x/ecore_sp.c create mode 100644 lib/librte_pmd_bnx2x/ecore_sp.h create mode 100644 lib/librte_pmd_bnx2x/elink.c create mode 100644 lib/librte_pmd_bnx2x/elink.h create mode 100644 lib/librte_pmd_bnx2x/rte_pmd_bnx2x_version.map
Signature · 1 line
2.1.4
PATCH v4 1/4 pci: allow access to PCI config space
In reply to a message not in the archiveFrom: Stephen Hemminger <[email protected]>
Some drivers need ability to access PCI config (for example for power management). This adds an abstraction to do this; only implemented on Linux, but should be possible on BSD.
--- lib/librte_eal/common/include/rte_pci.h | 28 +++++++++++++++ lib/librte_eal/linuxapp/eal/eal_pci.c | 48 +++++++++++++++++++++++++ lib/librte_eal/linuxapp/eal/eal_pci_init.h | 11 ++++++ lib/librte_eal/linuxapp/eal/eal_pci_uio.c | 14 ++++++++ lib/librte_eal/linuxapp/eal/eal_pci_vfio.c | 16 +++++++++ lib/librte_eal/linuxapp/eal/rte_eal_version.map | 2 ++ 6 files changed, 119 insertions(+)
lib/librte_eal/common/include/rte_pci.h +28 -0
@@ -393,6 +393,34 @@ void rte_eal_pci_register(struct rte_pci_driver *driver);*/ void rte_eal_pci_unregister (struct rte_pci_driver *driver); +/** +* Read PCI config space. +* +* @param device +* A pointer to a rte_pci_device structure describing the device +* to use +* @param buf +* A data buffer where the bytes should be read into +* @param size +* The length of the data buffer. +*/ +int rte_eal_pci_read_config (const struct rte_pci_device *device, +void *buf,size_t len,off_t offset); + +/** +* Write PCI config space. +* +* @param device +* A pointer to a rte_pci_device structure describing the device +* to use +* @param buf +* A data buffer containing the bytes should be written +* @param size +* The length of the data buffer. +*/ +int rte_eal_pci_write_config (const struct rte_pci_device *device, +const void *buf,size_t len,off_t offset); + #ifdef __cplusplus }#endif
lib/librte_eal/linuxapp/eal/eal_pci.c +48 -0
54 lines not on this page · raw message
lib/librte_eal/linuxapp/eal/eal_pci_init.h +11 -0
@@ -68,6 +68,11 @@ void *pci_find_max_end_va(void);void *pci_map_resource (void *requested_addr,int fd,off_t offset,size_t size,int additional_flags); +int pci_uio_read_config (const struct rte_intr_handle *intr_handle, +void *buf,size_t len,off_t offs); +int pci_uio_write_config (const struct rte_intr_handle *intr_handle, +const void *buf,size_t len,off_t offs); +/* map IGB_UIO resource prototype */ int pci_uio_map_resource (struct rte_pci_device *dev);
@@ -86,6 +91,12 @@ int pci_vfio_enable(void);int pci_vfio_is_enabled (void );int pci_vfio_mp_sync_setup (void ); +/* access config space */ +int pci_vfio_read_config (const struct rte_intr_handle *intr_handle, +void *buf,size_t len,off_t offs); +int pci_vfio_write_config (const struct rte_intr_handle *intr_handle, +const void *buf,size_t len,off_t offs); +/* map VFIO resource prototype */ int pci_vfio_map_resource (struct rte_pci_device *dev);int pci_vfio_get_group_fd (int iommu_group_fd);
lib/librte_eal/linuxapp/eal/eal_pci_uio.c +14 -0
@@ -58,6 +58,20 @@ EAL_REGISTER_TAILQ(rte_uio_tailq)#define OFF_MAX ((uint64_t)(off_t)-1) +int +pci_uio_read_config (const struct rte_intr_handle *intr_handle, +void *buf,size_t len,off_t offset) +{ +return pread (intr_handle->uio_cfg_fd, buf, len, offset); +} + +int +pci_uio_write_config (const struct rte_intr_handle *intr_handle, +const void *buf,size_t len,off_t offset) +{ +return pwrite (intr_handle->uio_cfg_fd, buf, len, offset); +} +static int pci_uio_set_bus_master (int dev_fd) {
lib/librte_eal/linuxapp/eal/eal_pci_vfio.c +16 -0
@@ -77,6 +77,22 @@ EAL_REGISTER_TAILQ(rte_vfio_tailq)/* per-process VFIO config */ static struct vfio_config vfio_cfg; +int +pci_vfio_read_config (const struct rte_intr_handle *intr_handle, +void *buf,size_t len,off_t offs) +{ +return pread64 (intr_handle->vfio_dev_fd, buf, len, +VFIO_GET_REGION_ADDR (VFIO_PCI_CONFIG_REGION_INDEX ) + offs); +} + +int +pci_vfio_write_config (const struct rte_intr_handle *intr_handle, +const void *buf,size_t len,off_t offs) +{ +return pwrite64 (intr_handle->vfio_dev_fd, buf, len, +VFIO_GET_REGION_ADDR (VFIO_PCI_CONFIG_REGION_INDEX ) + offs); +} +/* get PCI BAR number where MSI-X interrupts are */ static int pci_vfio_get_msix_bar(int fd, int *msix_bar, uint32_t *msix_table_offset,
lib/librte_eal/linuxapp/eal/rte_eal_version.map +2 -0
@@ -42,9 +42,11 @@ DPDK_2.0 { rte_eal_pci_dump; rte_eal_pci_probe; rte_eal_pci_probe_one; + rte_eal_pci_read_config; rte_eal_pci_register; rte_eal_pci_scan; rte_eal_pci_unregister; + rte_eal_pci_write_config; rte_eal_process_type; rte_eal_remote_launch; rte_eal_tailq_lookup;
Signature · 1 line
2.1.4
PATCH v4 2/4 bnx2x: new poll mode driver (part1)
In reply to a message not in the archiveFrom: Sergey Kreys <skreys-nYU0QVwCCFFWk0Htik3J/[email protected]>
Add driver for the Broadcom NetXtremeII 10 gigabit devices.
---
v3 - this is same as previous bcm driver just renamed v4 - split into two pieces for review.
--- lib/librte_pmd_bnx2x/Makefile | 28 + lib/librte_pmd_bnx2x/bnx2x.c | 11816 ++++++++++++++++++++++++++++++++++ lib/librte_pmd_bnx2x/bnx2x.h | 1998 ++++++ lib/librte_pmd_bnx2x/bnx2x_ethdev.c | 542 ++ lib/librte_pmd_bnx2x/bnx2x_ethdev.h | 79 + lib/librte_pmd_bnx2x/bnx2x_logs.h | 51 + lib/librte_pmd_bnx2x/bnx2x_rxtx.c | 487 ++ lib/librte_pmd_bnx2x/bnx2x_rxtx.h | 85 + lib/librte_pmd_bnx2x/bnx2x_stats.c | 1619 +++++ lib/librte_pmd_bnx2x/bnx2x_stats.h | 632 ++ lib/librte_pmd_bnx2x/bnx2x_vfpf.c | 597 ++ lib/librte_pmd_bnx2x/bnx2x_vfpf.h | 315 + 12 files changed, 18249 insertions(+) create mode 100644 lib/librte_pmd_bnx2x/Makefile create mode 100644 lib/librte_pmd_bnx2x/bnx2x.c create mode 100644 lib/librte_pmd_bnx2x/bnx2x.h create mode 100644 lib/librte_pmd_bnx2x/bnx2x_ethdev.c create mode 100644 lib/librte_pmd_bnx2x/bnx2x_ethdev.h create mode 100644 lib/librte_pmd_bnx2x/bnx2x_logs.h create mode 100644 lib/librte_pmd_bnx2x/bnx2x_rxtx.c create mode 100644 lib/librte_pmd_bnx2x/bnx2x_rxtx.h create mode 100644 lib/librte_pmd_bnx2x/bnx2x_stats.c create mode 100644 lib/librte_pmd_bnx2x/bnx2x_stats.h create mode 100644 lib/librte_pmd_bnx2x/bnx2x_vfpf.c create mode 100644 lib/librte_pmd_bnx2x/bnx2x_vfpf.h
lib/librte_pmd_bnx2x/Makefile new file +28 -0
@@ -0,0 +1,28 @@ +include $(RTE_SDK)/mk/rte.vars.mk + +# +# library name +# +LIB = librte_pmd_bnx2x.a + +CFLAGS += -O3 -g +CFLAGS += $(WERROR_FLAGS) +CFLAGS += -DZLIB_CONST + +# +# all source are stored in SRCS-y +# +SRCS-$(CONFIG_RTE_LIBRTE_BNX2X_PMD) += bnx2x.c +SRCS-$(CONFIG_RTE_LIBRTE_BNX2X_PMD) += bnx2x_rxtx.c +SRCS-$(CONFIG_RTE_LIBRTE_BNX2X_PMD) += bnx2x_stats.c +SRCS-$(CONFIG_RTE_LIBRTE_BNX2X_PMD) += bnx2x_ethdev.c +SRCS-$(CONFIG_RTE_LIBRTE_BNX2X_PMD) += ecore_sp.c +SRCS-$(CONFIG_RTE_LIBRTE_BNX2X_PMD) += elink.c +SRCS-$(CONFIG_RTE_LIBRTE_BNX2X_PMD) += bnx2x_vfpf.c +SRCS-$(CONFIG_RTE_LIBRTE_BNX2X_DEBUG) += debug.c + +# this lib depends upon: +DEPDIRS-$(CONFIG_RTE_LIBRTE_BNX2X_PMD) += lib/librte_eal lib/librte_ether lib/librte_hash +DEPDIRS-$(CONFIG_RTE_LIBRTE_BNX2X_PMD) += lib/librte_mempool lib/librte_mbuf + +include $(RTE_SDK)/mk/rte.lib.mk
lib/librte_pmd_bnx2x/bnx2x.c new file +11816 -0
2,972 lines not on this page · raw message
lib/librte_pmd_bnx2x/bnx2x.h new file +1998 -0
1,998 lines not on this page · raw message
lib/librte_pmd_bnx2x/bnx2x_ethdev.c new file +542 -0
542 lines not on this page · raw message
lib/librte_pmd_bnx2x/bnx2x_ethdev.h new file +79 -0
79 lines not on this page · raw message
lib/librte_pmd_bnx2x/bnx2x_logs.h new file +51 -0
51 lines not on this page · raw message
lib/librte_pmd_bnx2x/bnx2x_rxtx.c new file +487 -0
487 lines not on this page · raw message
lib/librte_pmd_bnx2x/bnx2x_rxtx.h new file +85 -0
85 lines not on this page · raw message
lib/librte_pmd_bnx2x/bnx2x_stats.c new file +1619 -0
1,619 lines not on this page · raw message
lib/librte_pmd_bnx2x/bnx2x_stats.h new file +632 -0
632 lines not on this page · raw message
lib/librte_pmd_bnx2x/bnx2x_vfpf.c new file +597 -0
597 lines not on this page · raw message
lib/librte_pmd_bnx2x/bnx2x_vfpf.h new file +315 -0
315 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.1.4
Part of the diff is not shown here. View the raw message.
PATCH v4 3/4 bnx2x: new poll mode driver (part2)
In reply to a message not in the archiveFrom: Sergey Kreys <skreys-nYU0QVwCCFFWk0Htik3J/[email protected]>
Add driver for the Broadcom NetXtremeII 10 gigabit devices.
---
v3 - this is same as previous bcm driver just renamed v4 - split into two pieces for review.
--- lib/librte_pmd_bnx2x/debug.c | 113 + lib/librte_pmd_bnx2x/ecore_fw_defs.h | 422 + lib/librte_pmd_bnx2x/ecore_hsi.h | 6348 +++++++++++++++ lib/librte_pmd_bnx2x/ecore_init.h | 841 ++ lib/librte_pmd_bnx2x/ecore_init_ops.h | 886 +++ lib/librte_pmd_bnx2x/ecore_mfw_req.h | 206 + lib/librte_pmd_bnx2x/ecore_reg.h | 3663 +++++++++ lib/librte_pmd_bnx2x/ecore_sp.c | 5455 +++++++++++++ lib/librte_pmd_bnx2x/ecore_sp.h | 1795 +++++ lib/librte_pmd_bnx2x/elink.c | 13378 ++++++++++++++++++++++++++++++++ lib/librte_pmd_bnx2x/elink.h | 609 ++ 11 files changed, 33716 insertions(+) create mode 100644 lib/librte_pmd_bnx2x/debug.c create mode 100644 lib/librte_pmd_bnx2x/ecore_fw_defs.h create mode 100644 lib/librte_pmd_bnx2x/ecore_hsi.h create mode 100644 lib/librte_pmd_bnx2x/ecore_init.h create mode 100644 lib/librte_pmd_bnx2x/ecore_init_ops.h create mode 100644 lib/librte_pmd_bnx2x/ecore_mfw_req.h create mode 100644 lib/librte_pmd_bnx2x/ecore_reg.h create mode 100644 lib/librte_pmd_bnx2x/ecore_sp.c create mode 100644 lib/librte_pmd_bnx2x/ecore_sp.h create mode 100644 lib/librte_pmd_bnx2x/elink.c create mode 100644 lib/librte_pmd_bnx2x/elink.h
lib/librte_pmd_bnx2x/debug.c new file +113 -0
@@ -0,0 +1,113 @@ +/*- +* Copyright (c) 2007-2013 Broadcom Corporation. All rights reserved. +* +* Eric Davis <edavis-dY08KVG/lbpWk0Htik3J/[email protected]> +* David Christensen <davidch-dY08KVG/lbpWk0Htik3J/[email protected]> +* Gary Zambrano <zambrano-dY08KVG/lbpWk0Htik3J/[email protected]> +* +* Copyright (c) 2013-2015 Brocade Communications Systems, Inc. +* All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* 1. Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* 2. 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. +* 3. Neither the name of Broadcom Corporation nor the name of its contributors +* may be used to endorse or promote products derived from this software +* without specific prior written consent. +* +* 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 "bnx2x.h" + + +/* +* Debug versions of the 8/16/32 bit OS register read/write functions to +* capture/display values read/written from/to the controller. +*/ +void +bnx2x_reg_write8 (struct bnx2x_softc *sc,size_t offset,uint8_t val) +{ +PMD_DRV_LOG (DEBUG ,"offset=0x%08lx val=0x%02x" , offset, val); + *((volatile uint8_t *)((uint64_t )sc->bar[BAR0 ].base_addr + offset)) = val; +} + +void +bnx2x_reg_write16 (struct bnx2x_softc *sc,size_t offset,uint16_t val) +{ +if ((offset %2 ) !=0 ) { +PMD_DRV_LOG (DEBUG ,"Unaligned 16-bit write to 0x%08lx" , offset); + } + +PMD_DRV_LOG (DEBUG ,"offset=0x%08lx val=0x%04x" , offset, val); + *((volatile uint16_t *)((uint64_t )sc->bar[BAR0 ].base_addr + offset)) = val; +} + +void +bnx2x_reg_write32 (struct bnx2x_softc *sc,size_t offset,uint32_t val) +{ +if ((offset %4 ) !=0 ) { +PMD_DRV_LOG (DEBUG ,"Unaligned 32-bit write to 0x%08lx" , offset); + } + +PMD_DRV_LOG (DEBUG ,"offset=0x%08lx val=0x%08x" , offset, val); + *((volatile uint32_t *)((uint64_t )sc->bar[BAR0 ].base_addr + offset)) = val; +} + +uint8_t +bnx2x_reg_read8 (struct bnx2x_softc *sc,size_t offset) +{ +uint8_t val; + + val = (uint8_t )(*((volatile uint8_t *)((uint64_t )sc->bar[BAR0 ].base_addr + offset))); +PMD_DRV_LOG (DEBUG ,"offset=0x%08lx val=0x%02x" , offset, val); + +return (val); +} + +uint16_t +bnx2x_reg_read16 (struct bnx2x_softc *sc,size_t offset) +{ +uint16_t val; + +if ((offset %2 ) !=0 ) { +PMD_DRV_LOG (DEBUG ,"Unaligned 16-bit read from 0x%08lx" , offset); + } + + val = (uint16_t )(*((volatile uint16_t *)((uint64_t )sc->bar[BAR0 ].base_addr + offset))); +PMD_DRV_LOG (DEBUG ,"offset=0x%08lx val=0x%08x" , offset, val); + +return (val); +} + +uint32_t +bnx2x_reg_read32 (struct bnx2x_softc *sc,size_t offset) +{ +uint32_t val; + +if ((offset %4 ) !=0 ) { +PMD_DRV_LOG (DEBUG ,"Unaligned 32-bit read from 0x%08lx" , offset); +return 0 ; + } + + val = (uint32_t )(*((volatile uint32_t *)((uint64_t )sc->bar[BAR0 ].base_addr + offset))); +PMD_DRV_LOG (DEBUG ,"offset=0x%08lx val=0x%08x" , offset, val); + +return (val); +}
lib/librte_pmd_bnx2x/ecore_fw_defs.h new file +422 -0
422 lines not on this page · raw message
lib/librte_pmd_bnx2x/ecore_hsi.h new file +6348 -0
2,465 lines not on this page · raw message
lib/librte_pmd_bnx2x/ecore_init.h new file +841 -0
841 lines not on this page · raw message
lib/librte_pmd_bnx2x/ecore_init_ops.h new file +886 -0
886 lines not on this page · raw message
lib/librte_pmd_bnx2x/ecore_mfw_req.h new file +206 -0
206 lines not on this page · raw message
lib/librte_pmd_bnx2x/ecore_reg.h new file +3663 -0
3,663 lines not on this page · raw message
lib/librte_pmd_bnx2x/ecore_sp.c new file +5455 -0
5,455 lines not on this page · raw message
lib/librte_pmd_bnx2x/ecore_sp.h new file +1795 -0
1,795 lines not on this page · raw message
lib/librte_pmd_bnx2x/elink.c new file +13378 -0
13,378 lines not on this page · raw message
lib/librte_pmd_bnx2x/elink.h new file +609 -0
609 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.1.4
Part of the diff is not shown here. View the raw message.
PATCH v4 4/4 bnx2x: enable BNX2X poll mode driver
In reply to a message not in the archiveThis is build infrastructure changes for bnx2x driver.
- enable BNX2X poll mode driver in default config.
- add it to mk
- put entry in MAINTAINERS
Note: I intentionally did not list myself as maintainer of this driver. There is no official support for this driver.
--- MAINTAINERS | 3 +++ config/common_linuxapp | 10 +++++++++ lib/Makefile | 1 + lib/librte_eal/common/include/rte_pci_dev_ids.h | 30 +++++++++++++++++++++++++ lib/librte_pmd_bnx2x/rte_pmd_bnx2x_version.map | 4 ++++ mk/rte.app.mk | 8 +++++++ 6 files changed, 56 insertions(+) create mode 100644 lib/librte_pmd_bnx2x/rte_pmd_bnx2x_version.map
MAINTAINERS +3 -0
@@ -258,6 +258,9 @@ M: John McNamara <[email protected]> F: lib/librte_pmd_pcap/ F: doc/guides/nics/pcap_ring.rst +Qlogic/Broadcom bnx2x +F: lib/librte_pmd_bnx2x/ + Ring PMD M: Bruce Richardson <[email protected]> F: lib/librte_pmd_ring/
config/common_linuxapp +10 -0
@@ -214,6 +214,16 @@ CONFIG_RTE_LIBRTE_ENIC_PMD=y CONFIG_RTE_LIBRTE_ENIC_DEBUG=n # +# Compile burst-oriented Broadcom PMD driver +# +CONFIG_RTE_LIBRTE_BNX2X_PMD=y +CONFIG_RTE_LIBRTE_BNX2X_DEBUG_INIT=n +CONFIG_RTE_LIBRTE_BNX2X_DEBUG=n +CONFIG_RTE_LIBRTE_BNX2X_MF_SUPPORT=n +CONFIG_RTE_LIBRTE_BNX2X_DEBUG_TX=n +CONFIG_RTE_LIBRTE_BNX2X_DEBUG_RX=n + +# # Compile burst-oriented VIRTIO PMD driver # CONFIG_RTE_LIBRTE_VIRTIO_PMD=y
lib/Makefile +1 -0
@@ -47,6 +47,7 @@ DIRS-$(CONFIG_RTE_LIBRTE_I40E_PMD) += librte_pmd_i40e DIRS-$(CONFIG_RTE_LIBRTE_FM10K_PMD) += librte_pmd_fm10k DIRS-$(CONFIG_RTE_LIBRTE_MLX4_PMD) += librte_pmd_mlx4 DIRS-$(CONFIG_RTE_LIBRTE_ENIC_PMD) += librte_pmd_enic +DIRS-$(CONFIG_RTE_LIBRTE_BNX2X_PMD) += librte_pmd_bnx2x DIRS-$(CONFIG_RTE_LIBRTE_PMD_BOND) += librte_pmd_bond DIRS-$(CONFIG_RTE_LIBRTE_PMD_RING) += librte_pmd_ring DIRS-$(CONFIG_RTE_LIBRTE_PMD_PCAP) += librte_pmd_pcap
lib/librte_eal/common/include/rte_pci_dev_ids.h +30 -0
@@ -140,6 +140,14 @@#define RTE_PCI_DEV_ID_DECL_FM10KVF (vend, dev)#endif +#ifndef RTE_PCI_DEV_ID_DECL_BNX2X +#define RTE_PCI_DEV_ID_DECL_BNX2X (vend, dev) +#endif + +#ifndef RTE_PCI_DEV_ID_DECL_BNX2XVF +#define RTE_PCI_DEV_ID_DECL_BNX2XVF (vend, dev) +#endif +#ifndef PCI_VENDOR_ID_INTEL /** Vendor ID used by Intel devices */ #define PCI_VENDOR_ID_INTEL 0x8086
@@ -155,6 +163,11 @@#define PCI_VENDOR_ID_VMWARE 0x15AD#endif +#ifndef PCI_VENDOR_ID_BROADCOM +/** Vendor ID used by Broadcom devices */ +#define PCI_VENDOR_ID_BROADCOM 0x14E4 +#endif +/******************** Physical EM devices from e1000_hw.h ********************/ #define E1000_DEV_ID_82542 0x1000
@@ -548,6 +561,21 @@ RTE_PCI_DEV_ID_DECL_VMXNET3(PCI_VENDOR_ID_VMWARE, VMWARE_DEV_ID_VMXNET3)RTE_PCI_DEV_ID_DECL_FM10KVF (PCI_VENDOR_ID_INTEL ,FM10K_DEV_ID_VF ) +/****************** Qualcom devices ******************/ + +/* Broadcom/Qualcom BNX2X */ +#define BNX2X_DEV_ID_57711 0x164F +#define BNX2X_DEV_ID_57810 0x168E +#define BNX2X_DEV_ID_57810_MF 0x16AE +#define BNX2X_DEV_ID_57810_VF 0x16AF + +RTE_PCI_DEV_ID_DECL_BNX2X(PCI_VENDOR_ID_BROADCOM, BNX2X_DEV_ID_57711) +RTE_PCI_DEV_ID_DECL_BNX2X(PCI_VENDOR_ID_BROADCOM, BNX2X_DEV_ID_57810) +#ifdef RTE_LIBRTE_BNX2X_MF_SUPPORT +RTE_PCI_DEV_ID_DECL_BNX2X(PCI_VENDOR_ID_BROADCOM, BNX2X_DEV_ID_57810_MF) +#endif +RTE_PCI_DEV_ID_DECL_BNX2XVF (PCI_VENDOR_ID_BROADCOM ,BNX2X_DEV_ID_57810_VF ) +/* * Undef all RTE_PCI_DEV_ID_DECL_* here. */
@@ -560,5 +588,7 @@ RTE_PCI_DEV_ID_DECL_FM10KVF(PCI_VENDOR_ID_INTEL, FM10K_DEV_ID_VF)#undef RTE_PCI_DEV_ID_DECL_I40EVF#undef RTE_PCI_DEV_ID_DECL_VIRTIO#undef RTE_PCI_DEV_ID_DECL_VMXNET3 +#undef RTE_PCI_DEV_ID_DECL_BNX2X +#undef RTE_PCI_DEV_ID_DECL_BNX2XVF#undef RTE_PCI_DEV_ID_DECL_FM10K#undef RTE_PCI_DEV_ID_DECL_FM10KVF
lib/librte_pmd_bnx2x/rte_pmd_bnx2x_version.map new file +4 -0
@@ -0,0 +1,4 @@ +DPDK_2.0 { + + local: *; +};
mk/rte.app.mk +8 -0
@@ -151,6 +151,10 @@ ifeq ($(CONFIG_RTE_LIBRTE_MLX4_PMD),y) LDLIBS += -libverbs endif +ifeq ($(CONFIG_RTE_LIBRTE_BNX2X_PMD),y) +LDLIBS += -lz +endif + LDLIBS += --start-group ifeq ($(CONFIG_RTE_BUILD_COMBINE_LIBS),n)
@@ -219,6 +223,10 @@ ifeq ($(CONFIG_RTE_LIBRTE_ENIC_PMD),y) LDLIBS += -lrte_pmd_enic endif +ifeq ($(CONFIG_RTE_LIBRTE_BNX2X_PMD),y) +LDLIBS += -lrte_pmd_bnx2x +endif + ifeq ($(CONFIG_RTE_LIBRTE_I40E_PMD),y) LDLIBS += -lrte_pmd_i40e endif
Signature · 1 line
2.1.4
Re: [PATCH 1/4] pci: allow access to PCI config space
In reply to Stephen HemmingerQuoted 42 lines · Stephen Hemminger
From: Stephen Hemminger <[email protected]>
Some drivers need ability to access PCI config (for example for power management). This adds an abstraction to do this; only implemented on Linux, but should be possible on BSD.
Signed-off-by Stephen Hemminger <[email protected]>--- lib/librte_eal/common/include/rte_pci.h | 28 +++++++++++++++ lib/librte_eal/linuxapp/eal/eal_pci.c | 48 +++++++++++++++++++++++++ lib/librte_eal/linuxapp/eal/eal_pci_init.h | 11 ++++++ lib/librte_eal/linuxapp/eal/eal_pci_uio.c | 14 ++++++++ lib/librte_eal/linuxapp/eal/eal_pci_vfio.c | 16 +++++++++ lib/librte_eal/linuxapp/eal/rte_eal_version.map | 2 ++ 6 files changed, 119 insertions(+)lib/librte_eal/common/include/rte_pci.h +18
-0@@ -393,6 +393,34 @@ void rte_eal_pci_register(struct rte_pci_driver *driver);*/ void rte_eal_pci_unregister (struct rte_pci_driver *driver); +/** +* Read PCI config space. +* +* @param device +* A pointer to a rte_pci_device structure describing the device +* to use +* @param buf +* A data buffer where the bytes should be read into +* @param size +* The length of the data buffer. +*/ +int rte_eal_pci_read_config (const struct rte_pci_device *device, +void *buf,size_t len,off_t offset); + +/** +* Write PCI config space. +* +* @param device
lib/librte_eal/common/include/rte_pci.h void rte_eal_pci_register(struct rte_pci_driver *driver); · line 423
Quoted 10 lines
lib/librte_eal/common/include/rte_pci.h +10
-0+* A pointer to a rte_pci_device structure describing the device +* to use +* @param buf +* A data buffer containing the bytes should be written +* @param size +* The length of the data buffer. +*/ +int rte_eal_pci_write_config (const struct rte_pci_device *device, +const void *buf,size_t len,off_t offset); +
I still think this needs a BSD implementation before we pull the whole thing in. Only partially implementing infrastructure like this is bad practice, and will lead to complicated build procedures (i.e. developers will require institutional knoweldge to know that bnx2x can't build on BSD because someone still needs to implement these functions on bsd. Even having them just return -ENOTSUPP would be preferable, so that you got a proper run time error, rather than a build break, though I don't think thats even necessecary, as pci passthrough is possible in project like bhyve (implying user space pci access)
Neil
Quoted 163 lines
lib/librte_eal/common/include/rte_pci.h +0
-0#ifdef __cplusplus }#endif lib/librte_eal/linuxapp/eal/eal_pci.c +48
-0@@ -756,6 +756,54 @@ rte_eal_pci_close_one_driver(struct rte_pci_driver *dr __rte_unused, }#endif /* RTE_LIBRTE_EAL_HOTPLUG */ +/* Read PCI config space. */ +int rte_eal_pci_read_config (const struct rte_pci_device *device, +void *buf,size_t len,off_t offset) +{ +const struct rte_intr_handle *intr_handle = &device->intr_handle; + +switch (intr_handle->type) { +case RTE_INTR_HANDLE_UIO : +return pci_uio_read_config (intr_handle, buf, len, offset); + +#ifdef VFIO_PRESENT +case RTE_INTR_HANDLE_VFIO_MSIX : +case RTE_INTR_HANDLE_VFIO_MSI : +case RTE_INTR_HANDLE_VFIO_LEGACY : +return pci_vfio_read_config (intr_handle, buf, len, offset); +#endif +default : +RTE_LOG (ERR ,EAL , +"Unknown handle type of fd %d\n" , + intr_handle->fd); +return -1 ; + } +} + +/* Write PCI config space. */ +int rte_eal_pci_write_config (const struct rte_pci_device *device, +const void *buf,size_t len,off_t offset) +{ +const struct rte_intr_handle *intr_handle = &device->intr_handle; + +switch (intr_handle->type) { +case RTE_INTR_HANDLE_UIO : +return pci_uio_write_config (intr_handle, buf, len, offset); + +#ifdef VFIO_PRESENT +case RTE_INTR_HANDLE_VFIO_MSIX : +case RTE_INTR_HANDLE_VFIO_MSI : +case RTE_INTR_HANDLE_VFIO_LEGACY : +return pci_vfio_write_config (intr_handle, buf, len, offset); +#endif +default : +RTE_LOG (ERR ,EAL , +"Unknown handle type of fd %d\n" , + intr_handle->fd); +return -1 ; + } +} +/* Init the PCI EAL subsystem */ int rte_eal_pci_init (void )lib/librte_eal/linuxapp/eal/eal_pci_init.h +11
-0@@ -68,6 +68,11 @@ void *pci_find_max_end_va(void);void *pci_map_resource (void *requested_addr,int fd,off_t offset,size_t size,int additional_flags); +int pci_uio_read_config (const struct rte_intr_handle *intr_handle, +void *buf,size_t len,off_t offs); +int pci_uio_write_config (const struct rte_intr_handle *intr_handle, +const void *buf,size_t len,off_t offs); +/* map IGB_UIO resource prototype */ int pci_uio_map_resource (struct rte_pci_device *dev);@@ -86,6 +91,12 @@ int pci_vfio_enable(void);int pci_vfio_is_enabled (void );int pci_vfio_mp_sync_setup (void ); +/* access config space */ +int pci_vfio_read_config (const struct rte_intr_handle *intr_handle, +void *buf,size_t len,off_t offs); +int pci_vfio_write_config (const struct rte_intr_handle *intr_handle, +const void *buf,size_t len,off_t offs); +/* map VFIO resource prototype */ int pci_vfio_map_resource (struct rte_pci_device *dev);int pci_vfio_get_group_fd (int iommu_group_fd);lib/librte_eal/linuxapp/eal/eal_pci_uio.c +14
-0@@ -58,6 +58,20 @@ EAL_REGISTER_TAILQ(rte_uio_tailq)#define OFF_MAX ((uint64_t)(off_t)-1) +int +pci_uio_read_config (const struct rte_intr_handle *intr_handle, +void *buf,size_t len,off_t offset) +{ +return pread (intr_handle->uio_cfg_fd, buf, len, offset); +} + +int +pci_uio_write_config (const struct rte_intr_handle *intr_handle, +const void *buf,size_t len,off_t offset) +{ +return pwrite (intr_handle->uio_cfg_fd, buf, len, offset); +} +static int pci_uio_set_bus_master (int dev_fd) {lib/librte_eal/linuxapp/eal/eal_pci_vfio.c +16
-0@@ -77,6 +77,22 @@ EAL_REGISTER_TAILQ(rte_vfio_tailq)/* per-process VFIO config */ static struct vfio_config vfio_cfg; +int +pci_vfio_read_config (const struct rte_intr_handle *intr_handle, +void *buf,size_t len,off_t offs) +{ +return pread64 (intr_handle->vfio_dev_fd, buf, len, +VFIO_GET_REGION_ADDR (VFIO_PCI_CONFIG_REGION_INDEX ) + offs); +} + +int +pci_vfio_write_config (const struct rte_intr_handle *intr_handle, +const void *buf,size_t len,off_t offs) +{ +return pwrite64 (intr_handle->vfio_dev_fd, buf, len, +VFIO_GET_REGION_ADDR (VFIO_PCI_CONFIG_REGION_INDEX ) + offs); +} +/* get PCI BAR number where MSI-X interrupts are */ static int pci_vfio_get_msix_bar(int fd, int *msix_bar, uint32_t *msix_table_offset,lib/librte_eal/linuxapp/eal/rte_eal_version.map +2
-0@@ -42,9 +42,11 @@ DPDK_2.0 { rte_eal_pci_dump; rte_eal_pci_probe; rte_eal_pci_probe_one; + rte_eal_pci_read_config; rte_eal_pci_register; rte_eal_pci_scan; rte_eal_pci_unregister; + rte_eal_pci_write_config; rte_eal_process_type; rte_eal_remote_launch; rte_eal_tailq_lookup;Signature · 1 line
2.1.4
Re: [PATCH 1/4] pci: allow access to PCI config space
In reply to a message not in the archiveOk will stub out the pci_config stuff for BSD. But I don't have time or resources to do real BSD support.
Also, the whole bnx2x driver loads firmware and that probably has dependencies that are different on BSD
Re: [PATCH 1/4] pci: allow access to PCI config space
Quoted 6 lines · Stephen Hemminger
Ok will stub out the
pci_configstuff for BSD. But I don't have time or resources to do real BSD support.Also, the whole bnx2x driver loads firmware and that probably has dependencies that are different on BSD
Thats a fair point. Is the implication here that, even with the stub functions for pci config space, bnx2x won't build on BSD?
Neil
Re: [PATCH 1/4] pci: allow access to PCI config space
Quoted 4 lines · On Mon, 11 May 2015 11:37:08 -0400 Neil Horman <[email protected]> wrote:
Quoted 3 lines · Stephen Hemminger
Ok will stub out the
pci_configstuff for BSD. But I don't have time or resources to do real BSD support.
Quoted 8 lines
Quoted 3 lines
Also, the whole bnx2x driver loads firmware and that probably has dependencies that are different on BSD
Thats a fair point. Is the implication here that, even with the stub functions for pci config space, bnx2x won't build on BSD?
Neil
It will build but not run since it looks for firmware in /lib/firmware
Re: [PATCH 1/4] pci: allow access to PCI config space
In reply to a message not in the archiveQuoted 7 lines · On Mon, 11 May 2015 12:54:54 +0000 Neil Horman <[email protected]> wrote:
Quoted 6 lines · Stephen Hemminger
From: Stephen Hemminger <[email protected]>
Some drivers need ability to access PCI config (for example for power management). This adds an abstraction to do this; only implemented on Linux, but should be possible on BSD.
Could someone who has BSD infrastructure try this, not sure if it will even build.
lib/librte_eal/bsdapp/eal/eal_pci.c +70 -0
@@ -490,6 +490,76 @@ rte_eal_pci_probe_one_driver(struct rte_pci_driver *dr, struct rte_pci_device *dreturn 1 ; } +/* Read PCI config space. */ +int rte_eal_pci_read_config (const struct rte_pci_device *dev, +void *buf,size_t len,off_t offset) +{ +int fd =-1 ; + + fd =open ("/dev/pci" ,O_RDONLY ); +if (fd <0 ) { +RTE_LOG (ERR ,EAL ,"%s(): error opening /dev/pci\n" , __func__); + goto error; + } + +struct pci_io pi = { + .pi_sel = { + .pc_domain = dev->addr.domain, + .bus = dev->addr.bus, + .pc_dev = dev->addr.devid, + .pc_func = dev->addr.function, + }, + .pi_reg = offset, + .pi_data = buf, + .pi_width = len, + }; + +if (ioctl (fd,PCIIOCREAD , &pi) <0 ) + goto error; +close (fd); +return 0 ; + +error: +if (fd >=0 ) +close (fd); +return -1 ; +} + +/* Write PCI config space. */ +int rte_eal_pci_write_config (const struct rte_pci_device *device, +const void *buf,size_t len,off_t offset) +{ +int fd =-1 ; + + fd =open ("/dev/pci" ,O_RDONLY ); +if (fd <0 ) { +RTE_LOG (ERR ,EAL ,"%s(): error opening /dev/pci\n" , __func__); + goto error; + } + +struct pci_io pi = { + .pi_sel = { + .pc_domain = dev->addr.domain, + .bus = dev->addr.bus, + .pc_dev = dev->addr.devid, + .pc_func = dev->addr.function, + }, + .pi_reg = offset, + .pi_data = buf, + .pi_width = len, + }; + +if (ioctl (fd,PCIIOCWRITE , &pi) <0 ) + goto error; +close (fd); +return 0 ; + +error: +if (fd >=0 ) +close (fd); +return -1 ; +} +/* Init the PCI EAL subsystem */ int rte_eal_pci_init (void )
Re: [PATCH 1/4] pci: allow access to PCI config space
Quoted 6 lines · Stephen Hemminger
Quoted 3 lines · On Mon, 11 May 2015 12:54:54 +0000 Neil Horman <[email protected]> wrote:
Quoted 2 lines · Stephen Hemminger
From: Stephen Hemminger <[email protected]>
Quoted 7 lines
Quoted 4 lines
Quoted 4 lines
Some drivers need ability to access PCI config (for example for power management). This adds an abstraction to do this; only implemented on Linux, but should be possible on BSD.
Could someone who has BSD infrastructure try this, not sure if it will even build.
No, it doesn't. :-)
Version that compiles is below. However, I haven't tried testing it yet or anything. Is there any easy way for me to do so?
/Bruce
lib/librte_eal/bsdapp/eal/eal_pci.c +81 -0
@@ -490,6 +490,87 @@ rte_eal_pci_probe_one_driver(struct rte_pci_driver *dr, struct rte_pci_device *dreturn 1 ; } +/* Read PCI config space. */ +int rte_eal_pci_read_config (const struct rte_pci_device *dev, +void *buf,size_t len,off_t offset) +{ +int fd =-1 ; + +struct pci_io pi = { + .pi_sel = { + .pc_domain = dev->addr.domain, + .pc_bus = dev->addr.bus, + .pc_dev = dev->addr.devid, + .pc_func = dev->addr.function, + }, + .pi_reg = offset, + .pi_width = len, + }; + +if (len ==3 || len >sizeof (pi.pi_data)) { +RTE_LOG (ERR ,EAL ,"%s(): invalid pci read length\n" , __func__); + goto error; + } + + fd =open ("/dev/pci" ,O_RDONLY ); +if (fd <0 ) { +RTE_LOG (ERR ,EAL ,"%s(): error opening /dev/pci\n" , __func__); + goto error; + } + +if (ioctl (fd,PCIOCREAD , &pi) <0 ) + goto error; +close (fd); + +memcpy (buf, &pi.pi_data, len); +return 0 ; + +error: +if (fd >=0 ) +close (fd); +return -1 ; +} + +/* Write PCI config space. */ +int rte_eal_pci_write_config (const struct rte_pci_device *dev, +const void *buf,size_t len,off_t offset) +{ +int fd =-1 ; + +struct pci_io pi = { + .pi_sel = { + .pc_domain = dev->addr.domain, + .pc_bus = dev->addr.bus, + .pc_dev = dev->addr.devid, + .pc_func = dev->addr.function, + }, + .pi_reg = offset, + .pi_data = *(u_int32_t *)buf, + .pi_width = len, + }; + +if (len ==3 || len >sizeof (pi.pi_data)) { +RTE_LOG (ERR ,EAL ,"%s(): invalid pci read length\n" , __func__); + goto error; + } + + fd =open ("/dev/pci" ,O_RDONLY ); +if (fd <0 ) { +RTE_LOG (ERR ,EAL ,"%s(): error opening /dev/pci\n" , __func__); + goto error; + } + +if (ioctl (fd,PCIOCWRITE , &pi) <0 ) + goto error; +close (fd); +return 0 ; + +error: +if (fd >=0 ) +close (fd); +return -1 ; +} +/* Init the PCI EAL subsystem */ int rte_eal_pci_init (void )