pci: introduce library and driver

The PCI lib defines the types and methods allowing to use PCI elements.

The PCI bus implements a bus driver for PCI devices by constructing
rte_bus elements using the PCI lib.

Move the relevant code out of the EAL to its expected place.

Libraries, drivers, unit tests and applications are updated to use the
new rte_bus_pci.h header when necessary.

Signed-off-by: Gaetan Rivet <gaetan.rivet@6wind.com>
This commit is contained in:
Gaetan Rivet 2017-10-26 12:06:08 +02:00 committed by Thomas Monjalon
parent 3df742a917
commit c752998b5e
104 changed files with 1143 additions and 641 deletions

View File

@ -193,11 +193,12 @@ F: doc/guides/linux_gsg/
Linux UIO Linux UIO
M: Ferruh Yigit <ferruh.yigit@intel.com> M: Ferruh Yigit <ferruh.yigit@intel.com>
F: lib/librte_eal/linuxapp/igb_uio/ F: lib/librte_eal/linuxapp/igb_uio/
F: lib/librte_eal/linuxapp/eal/*uio* F: drivers/bus/pci/linux/*uio*
Linux VFIO Linux VFIO
M: Anatoly Burakov <anatoly.burakov@intel.com> M: Anatoly Burakov <anatoly.burakov@intel.com>
F: lib/librte_eal/linuxapp/eal/*vfio* F: lib/librte_eal/linuxapp/eal/*vfio*
F: drivers/bus/pci/linux/*vfio*
FreeBSD EAL (with overlaps) FreeBSD EAL (with overlaps)
M: Bruce Richardson <bruce.richardson@intel.com> M: Bruce Richardson <bruce.richardson@intel.com>
@ -286,6 +287,12 @@ T: git://dpdk.org/next/dpdk-next-eventdev
F: lib/librte_eventdev/*eth_rx_adapter* F: lib/librte_eventdev/*eth_rx_adapter*
F: test/test/test_event_eth_rx_adapter.c F: test/test/test_event_eth_rx_adapter.c
Bus Drivers
-----------
PCI bus driver
F: drivers/bus/pci/
Networking Drivers Networking Drivers
------------------ ------------------
@ -840,6 +847,9 @@ M: Olivier Matz <olivier.matz@6wind.com>
F: lib/librte_kvargs/ F: lib/librte_kvargs/
F: test/test/test_kvargs.c F: test/test/test_kvargs.c
PCI
F: lib/librte_pci/
Power management Power management
M: David Hunt <david.hunt@intel.com> M: David Hunt <david.hunt@intel.com>
F: lib/librte_power/ F: lib/librte_power/

View File

@ -35,6 +35,7 @@
#define _TESTPMD_H_ #define _TESTPMD_H_
#include <rte_pci.h> #include <rte_pci.h>
#include <rte_bus_pci.h>
#include <rte_gro.h> #include <rte_gro.h>
#include <rte_gso.h> #include <rte_gso.h>

View File

@ -122,6 +122,11 @@ CONFIG_RTE_EAL_PMD_PATH=""
# #
CONFIG_RTE_LIBRTE_EAL_VMWARE_TSC_MAP_SUPPORT=y CONFIG_RTE_LIBRTE_EAL_VMWARE_TSC_MAP_SUPPORT=y
#
# Compile the PCI library
#
CONFIG_RTE_LIBRTE_PCI=y
# #
# Compile the argument parser library # Compile the argument parser library
# #
@ -147,6 +152,11 @@ CONFIG_RTE_ETHDEV_PROFILE_ITT_WASTED_RX_ITERATIONS=n
# #
CONFIG_RTE_ETHDEV_TX_PREPARE_NOOP=n CONFIG_RTE_ETHDEV_TX_PREPARE_NOOP=n
#
# Compile PCI bus driver
#
CONFIG_RTE_LIBRTE_PCI_BUS=y
# #
# Compile burst-oriented Amazon ENA PMD driver # Compile burst-oriented Amazon ENA PMD driver
# #

View File

@ -64,6 +64,7 @@ INPUT = doc/api/doxy-api-index.md \
lib/librte_meter \ lib/librte_meter \
lib/librte_metrics \ lib/librte_metrics \
lib/librte_net \ lib/librte_net \
lib/librte_pci \
lib/librte_pdump \ lib/librte_pdump \
lib/librte_pipeline \ lib/librte_pipeline \
lib/librte_port \ lib/librte_port \

View File

@ -316,6 +316,35 @@ API Changes
* ``rte_mem_phy2mch`` was used in Xen dom0 to obtain the physical address; * ``rte_mem_phy2mch`` was used in Xen dom0 to obtain the physical address;
remove this API as Xen dom0 support was removed. remove this API as Xen dom0 support was removed.
* **PCI bus API moved outside of the EAL**
The PCI bus previously implemented within the EAL has been moved.
A first part has been added as an RTE library providing PCI helpers to
parse device locations or other such utilities.
A second part consisting in the actual bus driver has been moved to its
proper subdirectory, without changing its functionalities.
As such, several PCI-related functions are not proposed by the EAL anymore:
* rte_pci_detach
* rte_pci_dump
* rte_pci_ioport_map
* rte_pci_ioport_read
* rte_pci_ioport_unmap
* rte_pci_ioport_write
* rte_pci_map_device
* rte_pci_probe
* rte_pci_probe_one
* rte_pci_read_config
* rte_pci_register
* rte_pci_scan
* rte_pci_unmap_device
* rte_pci_unregister
* rte_pci_write_config
These functions are made available either as part of ``librte_pci`` or
``librte_bus_pci``.
* **Add return value to stats_get dev op API** * **Add return value to stats_get dev op API**
The ``stats_get`` dev op API return value has been changed to be int. The ``stats_get`` dev op API return value has been changed to be int.
@ -447,6 +476,7 @@ The libraries prepended with a plus sign were incremented in this version.
librte_meter.so.1 librte_meter.so.1
librte_metrics.so.1 librte_metrics.so.1
librte_net.so.1 librte_net.so.1
+ librte_pci.so.1
+ librte_pdump.so.2 + librte_pdump.so.2
librte_pipeline.so.3 librte_pipeline.so.3
+ librte_pmd_bnxt.so.2 + librte_pmd_bnxt.so.2

View File

@ -36,4 +36,6 @@ DIRS-$(CONFIG_RTE_LIBRTE_DPAA_BUS) += dpaa
DIRS-$(CONFIG_RTE_LIBRTE_FSLMC_BUS) += fslmc DIRS-$(CONFIG_RTE_LIBRTE_FSLMC_BUS) += fslmc
DIRS-$(CONFIG_RTE_LIBRTE_PCI_BUS) += pci
include $(RTE_SDK)/mk/rte.subdir.mk include $(RTE_SDK)/mk/rte.subdir.mk

62
drivers/bus/pci/Makefile Normal file
View File

@ -0,0 +1,62 @@
# BSD LICENSE
#
# Copyright(c) 2017 6WIND S.A.
# 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 6WIND 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
LIB = librte_bus_pci.a
LIBABIVER := 1
EXPORT_MAP := rte_bus_pci_version.map
CFLAGS := -I$(SRCDIR) $(CFLAGS)
CFLAGS += -O3 $(WERROR_FLAGS)
ifneq ($(CONFIG_RTE_EXEC_ENV_LINUXAPP),)
SYSTEM := linux
endif
ifneq ($(CONFIG_RTE_EXEC_ENV_BSDAPP),)
SYSTEM := bsd
endif
CFLAGS += -I$(RTE_SDK)/drivers/bus/pci/$(SYSTEM)
CFLAGS += -I$(RTE_SDK)/lib/librte_eal/common
CFLAGS += -I$(RTE_SDK)/lib/librte_eal/$(SYSTEM)app/eal
LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring
LDLIBS += -lrte_ethdev -lrte_pci
include $(RTE_SDK)/drivers/bus/pci/$(SYSTEM)/Makefile
SRCS-$(CONFIG_RTE_LIBRTE_PCI_BUS) := $(addprefix $(SYSTEM)/,$(SRCS))
SRCS-$(CONFIG_RTE_LIBRTE_PCI_BUS) += pci_common.c
SRCS-$(CONFIG_RTE_LIBRTE_PCI_BUS) += pci_common_uio.c
SYMLINK-$(CONFIG_RTE_LIBRTE_PCI_BUS)-include += rte_bus_pci.h
include $(RTE_SDK)/mk/rte.lib.mk

View File

@ -0,0 +1,32 @@
# BSD LICENSE
#
# Copyright(c) 2017 6WIND S.A.
# 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 6WIND 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.
SRCS += pci.c

View File

@ -57,6 +57,7 @@
#include <rte_interrupts.h> #include <rte_interrupts.h>
#include <rte_log.h> #include <rte_log.h>
#include <rte_pci.h> #include <rte_pci.h>
#include <rte_bus_pci.h>
#include <rte_common.h> #include <rte_common.h>
#include <rte_launch.h> #include <rte_launch.h>
#include <rte_memory.h> #include <rte_memory.h>
@ -71,7 +72,7 @@
#include <rte_devargs.h> #include <rte_devargs.h>
#include "eal_filesystem.h" #include "eal_filesystem.h"
#include "eal_private.h" #include "private.h"
/** /**
* @file * @file
@ -323,7 +324,7 @@ pci_scan_one(int dev_pci_fd, struct pci_conf *conf)
int ret; int ret;
TAILQ_FOREACH(dev2, &rte_pci_bus.device_list, next) { TAILQ_FOREACH(dev2, &rte_pci_bus.device_list, next) {
ret = rte_pci_addr_cmp(&dev->addr, &dev2->addr); ret = pci_addr_cmp(&dev->addr, &dev2->addr);
if (ret > 0) if (ret > 0)
continue; continue;
else if (ret < 0) { else if (ret < 0) {

View File

@ -0,0 +1,36 @@
# BSD LICENSE
#
# Copyright(c) 2017 6WIND S.A.
# 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 6WIND 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.
SRCS += pci.c
SRCS += pci_uio.c
SRCS += pci_vfio.c
CFLAGS += -D_GNU_SOURCE

View File

@ -37,15 +37,18 @@
#include <rte_log.h> #include <rte_log.h>
#include <rte_bus.h> #include <rte_bus.h>
#include <rte_pci.h> #include <rte_pci.h>
#include <rte_bus_pci.h>
#include <rte_eal_memconfig.h> #include <rte_eal_memconfig.h>
#include <rte_malloc.h> #include <rte_malloc.h>
#include <rte_devargs.h> #include <rte_devargs.h>
#include <rte_memcpy.h> #include <rte_memcpy.h>
#include <rte_vfio.h> #include <rte_vfio.h>
#include "eal_filesystem.h"
#include "eal_private.h" #include "eal_private.h"
#include "eal_pci_init.h" #include "eal_filesystem.h"
#include "private.h"
#include "pci_init.h"
/** /**
* @file * @file
@ -363,7 +366,7 @@ pci_scan_one(const char *dirname, const struct rte_pci_addr *addr)
int ret; int ret;
TAILQ_FOREACH(dev2, &rte_pci_bus.device_list, next) { TAILQ_FOREACH(dev2, &rte_pci_bus.device_list, next) {
ret = rte_pci_addr_cmp(&dev->addr, &dev2->addr); ret = pci_addr_cmp(&dev->addr, &dev2->addr);
if (ret > 0) if (ret > 0)
continue; continue;

View File

@ -47,12 +47,13 @@
#include <rte_log.h> #include <rte_log.h>
#include <rte_pci.h> #include <rte_pci.h>
#include <rte_bus_pci.h>
#include <rte_eal_memconfig.h> #include <rte_eal_memconfig.h>
#include <rte_common.h> #include <rte_common.h>
#include <rte_malloc.h> #include <rte_malloc.h>
#include "eal_filesystem.h" #include "eal_filesystem.h"
#include "eal_pci_init.h" #include "pci_init.h"
void *pci_map_addr = NULL; void *pci_map_addr = NULL;

View File

@ -42,13 +42,15 @@
#include <rte_log.h> #include <rte_log.h>
#include <rte_pci.h> #include <rte_pci.h>
#include <rte_bus_pci.h>
#include <rte_eal_memconfig.h> #include <rte_eal_memconfig.h>
#include <rte_malloc.h> #include <rte_malloc.h>
#include <rte_vfio.h> #include <rte_vfio.h>
#include "eal_filesystem.h" #include "eal_filesystem.h"
#include "eal_pci_init.h"
#include "eal_private.h" #include "pci_init.h"
#include "private.h"
/** /**
* @file * @file
@ -580,8 +582,8 @@ pci_vfio_map_resource_secondary(struct rte_pci_device *dev)
/* if we're in a secondary process, just find our tailq entry */ /* if we're in a secondary process, just find our tailq entry */
TAILQ_FOREACH(vfio_res, vfio_res_list, next) { TAILQ_FOREACH(vfio_res, vfio_res_list, next) {
if (rte_pci_addr_cmp(&vfio_res->pci_addr, if (pci_addr_cmp(&vfio_res->pci_addr,
&dev->addr)) &dev->addr))
continue; continue;
break; break;
} }

View File

@ -45,6 +45,7 @@
#include <rte_log.h> #include <rte_log.h>
#include <rte_bus.h> #include <rte_bus.h>
#include <rte_pci.h> #include <rte_pci.h>
#include <rte_bus_pci.h>
#include <rte_per_lcore.h> #include <rte_per_lcore.h>
#include <rte_memory.h> #include <rte_memory.h>
#include <rte_memzone.h> #include <rte_memzone.h>
@ -53,7 +54,7 @@
#include <rte_common.h> #include <rte_common.h>
#include <rte_devargs.h> #include <rte_devargs.h>
#include "eal_private.h" #include "private.h"
extern struct rte_pci_bus rte_pci_bus; extern struct rte_pci_bus rte_pci_bus;
@ -81,133 +82,12 @@ static struct rte_devargs *pci_devargs_lookup(struct rte_pci_device *dev)
if (devargs->bus != pbus) if (devargs->bus != pbus)
continue; continue;
devargs->bus->parse(devargs->name, &addr); devargs->bus->parse(devargs->name, &addr);
if (!rte_pci_addr_cmp(&dev->addr, &addr)) if (!pci_addr_cmp(&dev->addr, &addr))
return devargs; return devargs;
} }
return NULL; return NULL;
} }
static inline const char *
get_u8_pciaddr_field(const char *in, void *_u8, char dlm)
{
unsigned long val;
uint8_t *u8 = _u8;
char *end;
errno = 0;
val = strtoul(in, &end, 16);
if (errno != 0 || end[0] != dlm || val > UINT8_MAX) {
errno = errno ? errno : EINVAL;
return NULL;
}
*u8 = (uint8_t)val;
return end + 1;
}
static int
rte_pci_bdf_parse(const char *input, struct rte_pci_addr *dev_addr)
{
const char *in = input;
dev_addr->domain = 0;
in = get_u8_pciaddr_field(in, &dev_addr->bus, ':');
if (in == NULL)
return -EINVAL;
in = get_u8_pciaddr_field(in, &dev_addr->devid, '.');
if (in == NULL)
return -EINVAL;
in = get_u8_pciaddr_field(in, &dev_addr->function, '\0');
if (in == NULL)
return -EINVAL;
return 0;
}
int
eal_parse_pci_BDF(const char *input, struct rte_pci_addr *dev_addr)
{
return rte_pci_bdf_parse(input, dev_addr);
}
static int
rte_pci_dbdf_parse(const char *input, struct rte_pci_addr *dev_addr)
{
const char *in = input;
unsigned long val;
char *end;
errno = 0;
val = strtoul(in, &end, 16);
if (errno != 0 || end[0] != ':' || val > UINT16_MAX)
return -EINVAL;
dev_addr->domain = (uint16_t)val;
in = end + 1;
in = get_u8_pciaddr_field(in, &dev_addr->bus, ':');
if (in == NULL)
return -EINVAL;
in = get_u8_pciaddr_field(in, &dev_addr->devid, '.');
if (in == NULL)
return -EINVAL;
in = get_u8_pciaddr_field(in, &dev_addr->function, '\0');
if (in == NULL)
return -EINVAL;
return 0;
}
int
eal_parse_pci_DomBDF(const char *input, struct rte_pci_addr *dev_addr)
{
return rte_pci_dbdf_parse(input, dev_addr);
}
void
rte_pci_device_name(const struct rte_pci_addr *addr,
char *output, size_t size)
{
RTE_VERIFY(size >= PCI_PRI_STR_SIZE);
RTE_VERIFY(snprintf(output, size, PCI_PRI_FMT,
addr->domain, addr->bus,
addr->devid, addr->function) >= 0);
}
int
rte_pci_addr_cmp(const struct rte_pci_addr *addr,
const struct rte_pci_addr *addr2)
{
uint64_t dev_addr, dev_addr2;
if ((addr == NULL) || (addr2 == NULL))
return -1;
dev_addr = ((uint64_t)addr->domain << 24) |
(addr->bus << 16) | (addr->devid << 8) | addr->function;
dev_addr2 = ((uint64_t)addr2->domain << 24) |
(addr2->bus << 16) | (addr2->devid << 8) | addr2->function;
if (dev_addr > dev_addr2)
return 1;
else if (dev_addr < dev_addr2)
return -1;
else
return 0;
}
int
rte_eal_compare_pci_addr(const struct rte_pci_addr *addr,
const struct rte_pci_addr *addr2)
{
return rte_pci_addr_cmp(addr, addr2);
}
int
rte_pci_addr_parse(const char *str, struct rte_pci_addr *addr)
{
if (rte_pci_bdf_parse(str, addr) == 0 ||
rte_pci_dbdf_parse(str, addr) == 0)
return 0;
return -1;
}
void void
pci_name_set(struct rte_pci_device *dev) pci_name_set(struct rte_pci_device *dev)
{ {
@ -231,44 +111,6 @@ pci_name_set(struct rte_pci_device *dev)
dev->device.name = dev->name; dev->device.name = dev->name;
} }
/* map a particular resource from a file */
void *
pci_map_resource(void *requested_addr, int fd, off_t offset, size_t size,
int additional_flags)
{
void *mapaddr;
/* Map the PCI memory resource of device */
mapaddr = mmap(requested_addr, size, PROT_READ | PROT_WRITE,
MAP_SHARED | additional_flags, fd, offset);
if (mapaddr == MAP_FAILED) {
RTE_LOG(ERR, EAL, "%s(): cannot mmap(%d, %p, 0x%lx, 0x%lx): %s (%p)\n",
__func__, fd, requested_addr,
(unsigned long)size, (unsigned long)offset,
strerror(errno), mapaddr);
} else
RTE_LOG(DEBUG, EAL, " PCI memory mapped at %p\n", mapaddr);
return mapaddr;
}
/* unmap a particular resource */
void
pci_unmap_resource(void *requested_addr, size_t size)
{
if (requested_addr == NULL)
return;
/* Unmap the PCI memory resource of device */
if (munmap(requested_addr, size)) {
RTE_LOG(ERR, EAL, "%s(): cannot munmap(%p, 0x%lx): %s\n",
__func__, requested_addr, (unsigned long)size,
strerror(errno));
} else
RTE_LOG(DEBUG, EAL, " PCI memory unmapped at %p\n",
requested_addr);
}
/* /*
* Match the PCI Driver and Device using the ID Table * Match the PCI Driver and Device using the ID Table
*/ */
@ -467,7 +309,7 @@ rte_pci_probe_one(const struct rte_pci_addr *addr)
goto err_return; goto err_return;
FOREACH_DEVICE_ON_PCIBUS(dev) { FOREACH_DEVICE_ON_PCIBUS(dev) {
if (rte_pci_addr_cmp(&dev->addr, addr)) if (pci_addr_cmp(&dev->addr, addr))
continue; continue;
ret = pci_probe_all_drivers(dev); ret = pci_probe_all_drivers(dev);
@ -497,7 +339,7 @@ rte_pci_detach(const struct rte_pci_addr *addr)
return -1; return -1;
FOREACH_DEVICE_ON_PCIBUS(dev) { FOREACH_DEVICE_ON_PCIBUS(dev) {
if (rte_pci_addr_cmp(&dev->addr, addr)) if (pci_addr_cmp(&dev->addr, addr))
continue; continue;
ret = rte_pci_detach_dev(dev); ret = rte_pci_detach_dev(dev);
@ -599,7 +441,7 @@ pci_parse(const char *name, void *addr)
struct rte_pci_addr pci_addr; struct rte_pci_addr pci_addr;
bool parse; bool parse;
parse = (rte_pci_addr_parse(name, &pci_addr) == 0); parse = (pci_addr_parse(name, &pci_addr) == 0);
if (parse && addr != NULL) if (parse && addr != NULL)
*out = pci_addr; *out = pci_addr;
return parse == false; return parse == false;

View File

@ -39,11 +39,13 @@
#include <sys/mman.h> #include <sys/mman.h>
#include <rte_eal.h> #include <rte_eal.h>
#include <rte_pci.h>
#include <rte_bus_pci.h>
#include <rte_tailq.h> #include <rte_tailq.h>
#include <rte_log.h> #include <rte_log.h>
#include <rte_malloc.h> #include <rte_malloc.h>
#include "eal_private.h" #include "private.h"
static struct rte_tailq_elem rte_uio_tailq = { static struct rte_tailq_elem rte_uio_tailq = {
.name = "UIO_RESOURCE_LIST", .name = "UIO_RESOURCE_LIST",
@ -61,7 +63,7 @@ pci_uio_map_secondary(struct rte_pci_device *dev)
TAILQ_FOREACH(uio_res, uio_res_list, next) { TAILQ_FOREACH(uio_res, uio_res_list, next) {
/* skip this element if it doesn't match our PCI address */ /* skip this element if it doesn't match our PCI address */
if (rte_pci_addr_cmp(&uio_res->pci_addr, &dev->addr)) if (pci_addr_cmp(&uio_res->pci_addr, &dev->addr))
continue; continue;
for (i = 0; i != uio_res->nb_maps; i++) { for (i = 0; i != uio_res->nb_maps; i++) {
@ -187,7 +189,7 @@ pci_uio_find_resource(struct rte_pci_device *dev)
TAILQ_FOREACH(uio_res, uio_res_list, next) { TAILQ_FOREACH(uio_res, uio_res_list, next) {
/* skip this element if it doesn't match our PCI address */ /* skip this element if it doesn't match our PCI address */
if (!rte_pci_addr_cmp(&uio_res->pci_addr, &dev->addr)) if (!pci_addr_cmp(&uio_res->pci_addr, &dev->addr))
return uio_res; return uio_res;
} }
return NULL; return NULL;

248
drivers/bus/pci/private.h Normal file
View File

@ -0,0 +1,248 @@
/*-
* BSD LICENSE
*
* Copyright(c) 2017 6WIND. All rights reserved.
* 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 6WIND 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.
*/
#ifndef _PCI_PRIVATE_H_
#define _PCI_PRIVATE_H_
#include <stdbool.h>
#include <stdio.h>
#include <rte_pci.h>
#include <rte_bus_pci.h>
struct rte_pci_driver;
struct rte_pci_device;
/**
* Probe the PCI bus
*
* @return
* - 0 on success.
* - !0 on error.
*/
int
rte_pci_probe(void);
/**
* Scan the content of the PCI bus, and the devices in the devices
* list
*
* @return
* 0 on success, negative on error
*/
int rte_pci_scan(void);
/**
* Probe the single PCI device.
*
* Scan the content of the PCI bus, and find the pci device specified by pci
* address, then call the probe() function for registered driver that has a
* matching entry in its id_table for discovered device.
*
* @param addr
* The PCI Bus-Device-Function address to probe.
* @return
* - 0 on success.
* - Negative on error.
*/
int rte_pci_probe_one(const struct rte_pci_addr *addr);
/**
* Close the single PCI device.
*
* Scan the content of the PCI bus, and find the pci device specified by pci
* address, then call the remove() function for registered driver that has a
* matching entry in its id_table for discovered device.
*
* @param addr
* The PCI Bus-Device-Function address to close.
* @return
* - 0 on success.
* - Negative on error.
*/
int rte_pci_detach(const struct rte_pci_addr *addr);
/**
* Find the name of a PCI device.
*/
void
pci_name_set(struct rte_pci_device *dev);
/**
* Add a PCI device to the PCI Bus (append to PCI Device list). This function
* also updates the bus references of the PCI Device (and the generic device
* object embedded within.
*
* @param pci_dev
* PCI device to add
* @return void
*/
void rte_pci_add_device(struct rte_pci_device *pci_dev);
/**
* Insert a PCI device in the PCI Bus at a particular location in the device
* list. It also updates the PCI Bus reference of the new devices to be
* inserted.
*
* @param exist_pci_dev
* Existing PCI device in PCI Bus
* @param new_pci_dev
* PCI device to be added before exist_pci_dev
* @return void
*/
void rte_pci_insert_device(struct rte_pci_device *exist_pci_dev,
struct rte_pci_device *new_pci_dev);
/**
* Remove a PCI device from the PCI Bus. This sets to NULL the bus references
* in the PCI device object as well as the generic device object.
*
* @param pci_device
* PCI device to be removed from PCI Bus
* @return void
*/
void rte_pci_remove_device(struct rte_pci_device *pci_device);
/**
* Update a pci device object by asking the kernel for the latest information.
*
* This function is private to EAL.
*
* @param addr
* The PCI Bus-Device-Function address to look for
* @return
* - 0 on success.
* - negative on error.
*/
int pci_update_device(const struct rte_pci_addr *addr);
/**
* Unbind kernel driver for this device
*
* This function is private to EAL.
*
* @return
* 0 on success, negative on error
*/
int pci_unbind_kernel_driver(struct rte_pci_device *dev);
/**
* Map the PCI resource of a PCI device in virtual memory
*
* This function is private to EAL.
*
* @return
* 0 on success, negative on error
*/
int pci_uio_map_resource(struct rte_pci_device *dev);
/**
* Unmap the PCI resource of a PCI device
*
* This function is private to EAL.
*/
void pci_uio_unmap_resource(struct rte_pci_device *dev);
/**
* Allocate uio resource for PCI device
*
* This function is private to EAL.
*
* @param dev
* PCI device to allocate uio resource
* @param uio_res
* Pointer to uio resource.
* If the function returns 0, the pointer will be filled.
* @return
* 0 on success, negative on error
*/
int pci_uio_alloc_resource(struct rte_pci_device *dev,
struct mapped_pci_resource **uio_res);
/**
* Free uio resource for PCI device
*
* This function is private to EAL.
*
* @param dev
* PCI device to free uio resource
* @param uio_res
* Pointer to uio resource.
*/
void pci_uio_free_resource(struct rte_pci_device *dev,
struct mapped_pci_resource *uio_res);
/**
* Map device memory to uio resource
*
* This function is private to EAL.
*
* @param dev
* PCI device that has memory information.
* @param res_idx
* Memory resource index of the PCI device.
* @param uio_res
* uio resource that will keep mapping information.
* @param map_idx
* Mapping information index of the uio resource.
* @return
* 0 on success, negative on error
*/
int pci_uio_map_resource_by_index(struct rte_pci_device *dev, int res_idx,
struct mapped_pci_resource *uio_res, int map_idx);
/*
* Match the PCI Driver and Device using the ID Table
*
* @param pci_drv
* PCI driver from which ID table would be extracted
* @param pci_dev
* PCI device to match against the driver
* @return
* 1 for successful match
* 0 for unsuccessful match
*/
int
rte_pci_match(const struct rte_pci_driver *pci_drv,
const struct rte_pci_device *pci_dev);
/**
* Get iommu class of PCI devices on the bus.
* And return their preferred iova mapping mode.
*
* @return
* - enum rte_iova_mode.
*/
enum rte_iova_mode
rte_pci_get_iommu_class(void);
#endif /* _PCI_PRIVATE_H_ */

View File

@ -32,13 +32,13 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
#ifndef _RTE_PCI_H_ #ifndef _RTE_BUS_PCI_H_
#define _RTE_PCI_H_ #define _RTE_BUS_PCI_H_
/** /**
* @file * @file
* *
* RTE PCI Interface * RTE PCI Bus Interface
*/ */
#ifdef __cplusplus #ifdef __cplusplus
@ -57,26 +57,11 @@ extern "C" {
#include <rte_interrupts.h> #include <rte_interrupts.h>
#include <rte_dev.h> #include <rte_dev.h>
#include <rte_bus.h> #include <rte_bus.h>
#include <rte_pci.h>
/** Pathname of PCI devices directory. */ /** Pathname of PCI devices directory. */
const char *pci_get_sysfs_path(void); const char *pci_get_sysfs_path(void);
/** Formatting string for PCI device identifier: Ex: 0000:00:01.0 */
#define PCI_PRI_FMT "%.4" PRIx16 ":%.2" PRIx8 ":%.2" PRIx8 ".%" PRIx8
#define PCI_PRI_STR_SIZE sizeof("XXXXXXXX:XX:XX.X")
/** Short formatting string, without domain, for PCI device: Ex: 00:01.0 */
#define PCI_SHORT_PRI_FMT "%.2" PRIx8 ":%.2" PRIx8 ".%" PRIx8
/** Nb. of values in PCI device identifier format string. */
#define PCI_FMT_NVAL 4
/** Nb. of values in PCI resource format. */
#define PCI_RESOURCE_FMT_NVAL 3
/** Maximum number of PCI resources. */
#define PCI_MAX_RESOURCE 6
/* Forward declarations */ /* Forward declarations */
struct rte_pci_device; struct rte_pci_device;
struct rte_pci_driver; struct rte_pci_driver;
@ -93,45 +78,23 @@ TAILQ_HEAD(rte_pci_driver_list, rte_pci_driver);
#define FOREACH_DRIVER_ON_PCIBUS(p) \ #define FOREACH_DRIVER_ON_PCIBUS(p) \
TAILQ_FOREACH(p, &(rte_pci_bus.driver_list), next) TAILQ_FOREACH(p, &(rte_pci_bus.driver_list), next)
/**
* A structure describing an ID for a PCI driver. Each driver provides a
* table of these IDs for each device that it supports.
*/
struct rte_pci_id {
uint32_t class_id; /**< Class ID (class, subclass, pi) or RTE_CLASS_ANY_ID. */
uint16_t vendor_id; /**< Vendor ID or PCI_ANY_ID. */
uint16_t device_id; /**< Device ID or PCI_ANY_ID. */
uint16_t subsystem_vendor_id; /**< Subsystem vendor ID or PCI_ANY_ID. */
uint16_t subsystem_device_id; /**< Subsystem device ID or PCI_ANY_ID. */
};
/**
* A structure describing the location of a PCI device.
*/
struct rte_pci_addr {
uint32_t domain; /**< Device domain */
uint8_t bus; /**< Device bus */
uint8_t devid; /**< Device ID */
uint8_t function; /**< Device function. */
};
struct rte_devargs; struct rte_devargs;
/** /**
* A structure describing a PCI device. * A structure describing a PCI device.
*/ */
struct rte_pci_device { struct rte_pci_device {
TAILQ_ENTRY(rte_pci_device) next; /**< Next probed PCI device. */ TAILQ_ENTRY(rte_pci_device) next; /**< Next probed PCI device. */
struct rte_device device; /**< Inherit core device */ struct rte_device device; /**< Inherit core device */
struct rte_pci_addr addr; /**< PCI location. */ struct rte_pci_addr addr; /**< PCI location. */
struct rte_pci_id id; /**< PCI ID. */ struct rte_pci_id id; /**< PCI ID. */
struct rte_mem_resource mem_resource[PCI_MAX_RESOURCE]; struct rte_mem_resource mem_resource[PCI_MAX_RESOURCE];
/**< PCI Memory Resource */ /**< PCI Memory Resource */
struct rte_intr_handle intr_handle; /**< Interrupt handle */ struct rte_intr_handle intr_handle; /**< Interrupt handle */
struct rte_pci_driver *driver; /**< Associated driver */ struct rte_pci_driver *driver; /**< Associated driver */
uint16_t max_vfs; /**< sriov enable if not zero */ uint16_t max_vfs; /**< sriov enable if not zero */
enum rte_kernel_driver kdrv; /**< Kernel driver passthrough */ enum rte_kernel_driver kdrv; /**< Kernel driver passthrough */
char name[PCI_PRI_STR_SIZE+1]; /**< PCI location (ASCII) */ char name[PCI_PRI_STR_SIZE+1]; /**< PCI location (ASCII) */
}; };
/** /**
@ -140,6 +103,8 @@ struct rte_pci_device {
*/ */
#define RTE_DEV_TO_PCI(ptr) container_of(ptr, struct rte_pci_device, device) #define RTE_DEV_TO_PCI(ptr) container_of(ptr, struct rte_pci_device, device)
#define RTE_ETH_DEV_TO_PCI(eth_dev) RTE_DEV_TO_PCI((eth_dev)->device)
/** Any PCI device identifier (vendor, device, ...) */ /** Any PCI device identifier (vendor, device, ...) */
#define PCI_ANY_ID (0xffff) #define PCI_ANY_ID (0xffff)
#define RTE_CLASS_ANY_ID (0xffffff) #define RTE_CLASS_ANY_ID (0xffffff)
@ -176,13 +141,13 @@ typedef int (pci_remove_t)(struct rte_pci_device *);
* A structure describing a PCI driver. * A structure describing a PCI driver.
*/ */
struct rte_pci_driver { struct rte_pci_driver {
TAILQ_ENTRY(rte_pci_driver) next; /**< Next in list. */ TAILQ_ENTRY(rte_pci_driver) next; /**< Next in list. */
struct rte_driver driver; /**< Inherit core driver. */ struct rte_driver driver; /**< Inherit core driver. */
struct rte_pci_bus *bus; /**< PCI bus reference. */ struct rte_pci_bus *bus; /**< PCI bus reference. */
pci_probe_t *probe; /**< Device Probe function. */ pci_probe_t *probe; /**< Device Probe function. */
pci_remove_t *remove; /**< Device Remove function. */ pci_remove_t *remove; /**< Device Remove function. */
const struct rte_pci_id *id_table; /**< ID table, NULL terminated. */ const struct rte_pci_id *id_table; /**< ID table, NULL terminated. */
uint32_t drv_flags; /**< Flags contolling handling of device. */ uint32_t drv_flags; /**< Flags contolling handling of device. */
}; };
/** /**
@ -205,132 +170,6 @@ struct rte_pci_bus {
/** Device driver supports IOVA as VA */ /** Device driver supports IOVA as VA */
#define RTE_PCI_DRV_IOVA_AS_VA 0X0040 #define RTE_PCI_DRV_IOVA_AS_VA 0X0040
/**
* A structure describing a PCI mapping.
*/
struct pci_map {
void *addr;
char *path;
uint64_t offset;
uint64_t size;
uint64_t phaddr;
};
struct pci_msix_table {
int bar_index;
uint32_t offset;
uint32_t size;
};
/**
* A structure describing a mapped PCI resource.
* For multi-process we need to reproduce all PCI mappings in secondary
* processes, so save them in a tailq.
*/
struct mapped_pci_resource {
TAILQ_ENTRY(mapped_pci_resource) next;
struct rte_pci_addr pci_addr;
char path[PATH_MAX];
int nb_maps;
struct pci_map maps[PCI_MAX_RESOURCE];
struct pci_msix_table msix_table;
};
/** mapped pci device list */
TAILQ_HEAD(mapped_pci_res_list, mapped_pci_resource);
/**
* @deprecated
* Utility function to produce a PCI Bus-Device-Function value
* given a string representation. Assumes that the BDF is provided without
* a domain prefix (i.e. domain returned is always 0)
*
* @param input
* The input string to be parsed. Should have the format XX:XX.X
* @param dev_addr
* The PCI Bus-Device-Function address to be returned. Domain will always be
* returned as 0
* @return
* 0 on success, negative on error.
*/
int eal_parse_pci_BDF(const char *input, struct rte_pci_addr *dev_addr);
/**
* @deprecated
* Utility function to produce a PCI Bus-Device-Function value
* given a string representation. Assumes that the BDF is provided including
* a domain prefix.
*
* @param input
* The input string to be parsed. Should have the format XXXX:XX:XX.X
* @param dev_addr
* The PCI Bus-Device-Function address to be returned
* @return
* 0 on success, negative on error.
*/
int eal_parse_pci_DomBDF(const char *input, struct rte_pci_addr *dev_addr);
/**
* Utility function to write a pci device name, this device name can later be
* used to retrieve the corresponding rte_pci_addr using eal_parse_pci_*
* BDF helpers.
*
* @param addr
* The PCI Bus-Device-Function address
* @param output
* The output buffer string
* @param size
* The output buffer size
*/
void rte_pci_device_name(const struct rte_pci_addr *addr, char *output,
size_t size);
/**
* Utility function to compare two PCI device addresses.
*
* @param addr
* The PCI Bus-Device-Function address to compare
* @param addr2
* The PCI Bus-Device-Function address to compare
* @return
* 0 on equal PCI address.
* Positive on addr is greater than addr2.
* Negative on addr is less than addr2, or error.
*/
int rte_pci_addr_cmp(const struct rte_pci_addr *addr,
const struct rte_pci_addr *addr2);
/**
* @deprecated
* Utility function to compare two PCI device addresses.
*
* @param addr
* The PCI Bus-Device-Function address to compare
* @param addr2
* The PCI Bus-Device-Function address to compare
* @return
* 0 on equal PCI address.
* Positive on addr is greater than addr2.
* Negative on addr is less than addr2, or error.
*/
int rte_eal_compare_pci_addr(const struct rte_pci_addr *addr,
const struct rte_pci_addr *addr2);
/**
* Utility function to parse a string into a PCI location.
*
* @param str
* The string to parse
* @param addr
* The reference to the structure where the location
* is stored.
* @return
* 0 on success
* <0 otherwise
*/
int rte_pci_addr_parse(const char *str, struct rte_pci_addr *addr);
/** /**
* Map the PCI device resources in user space virtual memory address * Map the PCI device resources in user space virtual memory address
* *
@ -357,38 +196,6 @@ int rte_pci_map_device(struct rte_pci_device *dev);
*/ */
void rte_pci_unmap_device(struct rte_pci_device *dev); void rte_pci_unmap_device(struct rte_pci_device *dev);
/**
* @internal
* Map a particular resource from a file.
*
* @param requested_addr
* The starting address for the new mapping range.
* @param fd
* The file descriptor.
* @param offset
* The offset for the mapping range.
* @param size
* The size for the mapping range.
* @param additional_flags
* The additional flags for the mapping range.
* @return
* - On success, the function returns a pointer to the mapped area.
* - On error, the value MAP_FAILED is returned.
*/
void *pci_map_resource(void *requested_addr, int fd, off_t offset,
size_t size, int additional_flags);
/**
* @internal
* Unmap a particular resource.
*
* @param requested_addr
* The address for the unmapping range.
* @param size
* The size for the unmapping range.
*/
void pci_unmap_resource(void *requested_addr, size_t size);
/** /**
* Dump the content of the PCI bus. * Dump the content of the PCI bus.
* *
@ -530,4 +337,4 @@ void rte_pci_ioport_write(struct rte_pci_ioport *p,
} }
#endif #endif
#endif /* _RTE_PCI_H_ */ #endif /* _RTE_BUS_PCI_H_ */

View File

@ -0,0 +1,17 @@
DPDK_17.11 {
global:
rte_pci_dump;
rte_pci_ioport_map;
rte_pci_ioport_read;
rte_pci_ioport_unmap;
rte_pci_ioport_write;
rte_pci_map_device;
rte_pci_read_config;
rte_pci_register;
rte_pci_unmap_device;
rte_pci_unregister;
rte_pci_write_config;
local: *;
};

View File

@ -45,6 +45,7 @@ CFLAGS += -I$(SRCDIR)/qat_adf
LDLIBS += -lcrypto LDLIBS += -lcrypto
LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring
LDLIBS += -lrte_cryptodev LDLIBS += -lrte_cryptodev
LDLIBS += -lrte_pci -lrte_bus_pci
# library source files # library source files
SRCS-$(CONFIG_RTE_LIBRTE_PMD_QAT) += qat_crypto.c SRCS-$(CONFIG_RTE_LIBRTE_PMD_QAT) += qat_crypto.c

View File

@ -60,6 +60,7 @@
#include <rte_crypto_sym.h> #include <rte_crypto_sym.h>
#include <rte_byteorder.h> #include <rte_byteorder.h>
#include <rte_pci.h> #include <rte_pci.h>
#include <rte_bus_pci.h>
#include <openssl/evp.h> #include <openssl/evp.h>

View File

@ -37,6 +37,7 @@
#include <rte_memzone.h> #include <rte_memzone.h>
#include <rte_cryptodev_pmd.h> #include <rte_cryptodev_pmd.h>
#include <rte_pci.h> #include <rte_pci.h>
#include <rte_bus_pci.h>
#include <rte_atomic.h> #include <rte_atomic.h>
#include <rte_prefetch.h> #include <rte_prefetch.h>

View File

@ -31,6 +31,7 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
#include <rte_bus_pci.h>
#include <rte_common.h> #include <rte_common.h>
#include <rte_dev.h> #include <rte_dev.h>
#include <rte_malloc.h> #include <rte_malloc.h>

View File

@ -42,6 +42,7 @@ CFLAGS += -I$(RTE_SDK)/drivers/mempool/octeontx/
CFLAGS += -I$(RTE_SDK)/drivers/net/octeontx/ CFLAGS += -I$(RTE_SDK)/drivers/net/octeontx/
LDLIBS += -lrte_eal -lrte_eventdev -lrte_mempool_octeontx LDLIBS += -lrte_eal -lrte_eventdev -lrte_mempool_octeontx
LDLIBS += -lrte_bus_pci
EXPORT_MAP := rte_pmd_octeontx_ssovf_version.map EXPORT_MAP := rte_pmd_octeontx_ssovf_version.map

View File

@ -39,6 +39,7 @@ LIB = librte_pmd_skeleton_event.a
CFLAGS += $(WERROR_FLAGS) CFLAGS += $(WERROR_FLAGS)
LDLIBS += -lrte_eal -lrte_eventdev LDLIBS += -lrte_eal -lrte_eventdev
LDLIBS += -lrte_pci -lrte_bus_pci
EXPORT_MAP := rte_pmd_skeleton_event_version.map EXPORT_MAP := rte_pmd_skeleton_event_version.map

View File

@ -63,5 +63,6 @@ CFLAGS_rte_mempool_octeontx.o += -Ofast
endif endif
LDLIBS += -lrte_eal -lrte_mempool -lrte_ring -lrte_mbuf LDLIBS += -lrte_eal -lrte_mempool -lrte_ring -lrte_mbuf
LDLIBS += -lrte_bus_pci
include $(RTE_SDK)/mk/rte.lib.mk include $(RTE_SDK)/mk/rte.lib.mk

View File

@ -41,7 +41,7 @@
#include <rte_atomic.h> #include <rte_atomic.h>
#include <rte_eal.h> #include <rte_eal.h>
#include <rte_pci.h> #include <rte_bus_pci.h>
#include <rte_errno.h> #include <rte_errno.h>
#include <rte_memory.h> #include <rte_memory.h>
#include <rte_malloc.h> #include <rte_malloc.h>

View File

@ -35,6 +35,7 @@
#include <rte_eal.h> #include <rte_eal.h>
#include <rte_io.h> #include <rte_io.h>
#include <rte_pci.h> #include <rte_pci.h>
#include <rte_bus_pci.h>
#include "octeontx_mbox.h" #include "octeontx_mbox.h"
#include "octeontx_pool_logs.h" #include "octeontx_pool_logs.h"

View File

@ -64,5 +64,6 @@ LDLIBS += -ldl
endif endif
LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring
LDLIBS += -lrte_ethdev -lrte_net -lrte_kvargs LDLIBS += -lrte_ethdev -lrte_net -lrte_kvargs
LDLIBS += -lrte_bus_pci
include $(RTE_SDK)/mk/rte.lib.mk include $(RTE_SDK)/mk/rte.lib.mk

View File

@ -35,6 +35,7 @@
#include <sys/stat.h> #include <sys/stat.h>
#include <dlfcn.h> #include <dlfcn.h>
#include <rte_bus_pci.h>
#include <rte_ethdev_pci.h> #include <rte_ethdev_pci.h>
#include <rte_kvargs.h> #include <rte_kvargs.h>

View File

@ -41,6 +41,7 @@ CFLAGS += -O3
CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR)
LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring
LDLIBS += -lrte_ethdev -lrte_net -lrte_kvargs LDLIBS += -lrte_ethdev -lrte_net -lrte_kvargs
LDLIBS += -lrte_bus_pci
EXPORT_MAP := rte_pmd_avp_version.map EXPORT_MAP := rte_pmd_avp_version.map

View File

@ -45,6 +45,7 @@
#include <rte_atomic.h> #include <rte_atomic.h>
#include <rte_branch_prediction.h> #include <rte_branch_prediction.h>
#include <rte_pci.h> #include <rte_pci.h>
#include <rte_bus_pci.h>
#include <rte_ether.h> #include <rte_ether.h>
#include <rte_common.h> #include <rte_common.h>
#include <rte_cycles.h> #include <rte_cycles.h>

View File

@ -11,6 +11,7 @@ CFLAGS += -DZLIB_CONST
LDLIBS += -lz LDLIBS += -lz
LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring
LDLIBS += -lrte_ethdev -lrte_net -lrte_kvargs LDLIBS += -lrte_ethdev -lrte_net -lrte_kvargs
LDLIBS += -lrte_bus_pci
EXPORT_MAP := rte_pmd_bnx2x_version.map EXPORT_MAP := rte_pmd_bnx2x_version.map

View File

@ -18,6 +18,7 @@
#include <rte_byteorder.h> #include <rte_byteorder.h>
#include <rte_spinlock.h> #include <rte_spinlock.h>
#include <rte_bus_pci.h>
#include <rte_io.h> #include <rte_io.h>
#if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN #if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN

View File

@ -46,6 +46,7 @@ CFLAGS += -O3
CFLAGS += $(WERROR_FLAGS) CFLAGS += $(WERROR_FLAGS)
LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring
LDLIBS += -lrte_ethdev -lrte_net -lrte_kvargs LDLIBS += -lrte_ethdev -lrte_net -lrte_kvargs
LDLIBS += -lrte_bus_pci
EXPORT_MAP := rte_pmd_bnxt_version.map EXPORT_MAP := rte_pmd_bnxt_version.map

View File

@ -39,6 +39,7 @@
#include <sys/queue.h> #include <sys/queue.h>
#include <rte_pci.h> #include <rte_pci.h>
#include <rte_bus_pci.h>
#include <rte_ethdev.h> #include <rte_ethdev.h>
#include <rte_memory.h> #include <rte_memory.h>
#include <rte_lcore.h> #include <rte_lcore.h>

View File

@ -40,6 +40,7 @@ CFLAGS += -O3
CFLAGS += $(WERROR_FLAGS) CFLAGS += $(WERROR_FLAGS)
LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring
LDLIBS += -lrte_ethdev -lrte_net -lrte_kvargs -lrte_cmdline LDLIBS += -lrte_ethdev -lrte_net -lrte_kvargs -lrte_cmdline
LDLIBS += -lrte_pci -lrte_bus_pci
EXPORT_MAP := rte_pmd_bond_version.map EXPORT_MAP := rte_pmd_bond_version.map

View File

@ -33,6 +33,7 @@
#include <rte_devargs.h> #include <rte_devargs.h>
#include <rte_pci.h> #include <rte_pci.h>
#include <rte_bus_pci.h>
#include <rte_kvargs.h> #include <rte_kvargs.h>
#include <cmdline_parse.h> #include <cmdline_parse.h>

View File

@ -64,6 +64,7 @@ CFLAGS_BASE_DRIVER =
endif endif
LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring
LDLIBS += -lrte_ethdev -lrte_net -lrte_kvargs LDLIBS += -lrte_ethdev -lrte_net -lrte_kvargs
LDLIBS += -lrte_bus_pci
# #
# Add extra flags for base driver files (also known as shared code) # Add extra flags for base driver files (also known as shared code)

View File

@ -36,6 +36,7 @@
#ifndef __T4_ADAPTER_H__ #ifndef __T4_ADAPTER_H__
#define __T4_ADAPTER_H__ #define __T4_ADAPTER_H__
#include <rte_bus_pci.h>
#include <rte_mbuf.h> #include <rte_mbuf.h>
#include <rte_io.h> #include <rte_io.h>

View File

@ -48,6 +48,7 @@
#include <rte_log.h> #include <rte_log.h>
#include <rte_debug.h> #include <rte_debug.h>
#include <rte_pci.h> #include <rte_pci.h>
#include <rte_bus_pci.h>
#include <rte_atomic.h> #include <rte_atomic.h>
#include <rte_branch_prediction.h> #include <rte_branch_prediction.h>
#include <rte_memory.h> #include <rte_memory.h>

View File

@ -40,6 +40,7 @@ CFLAGS += -O3
CFLAGS += $(WERROR_FLAGS) CFLAGS += $(WERROR_FLAGS)
LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring
LDLIBS += -lrte_ethdev -lrte_net -lrte_kvargs LDLIBS += -lrte_ethdev -lrte_net -lrte_kvargs
LDLIBS += -lrte_bus_pci
EXPORT_MAP := rte_pmd_e1000_version.map EXPORT_MAP := rte_pmd_e1000_version.map

View File

@ -43,6 +43,7 @@
#include <rte_log.h> #include <rte_log.h>
#include <rte_debug.h> #include <rte_debug.h>
#include <rte_pci.h> #include <rte_pci.h>
#include <rte_bus_pci.h>
#include <rte_ether.h> #include <rte_ether.h>
#include <rte_ethdev.h> #include <rte_ethdev.h>
#include <rte_ethdev_pci.h> #include <rte_ethdev_pci.h>

View File

@ -43,6 +43,7 @@
#include <rte_log.h> #include <rte_log.h>
#include <rte_debug.h> #include <rte_debug.h>
#include <rte_pci.h> #include <rte_pci.h>
#include <rte_bus_pci.h>
#include <rte_ether.h> #include <rte_ether.h>
#include <rte_ethdev.h> #include <rte_ethdev.h>
#include <rte_ethdev_pci.h> #include <rte_ethdev_pci.h>

View File

@ -39,6 +39,7 @@
#include <stdarg.h> #include <stdarg.h>
#include <inttypes.h> #include <inttypes.h>
#include <rte_bus_pci.h>
#include <rte_interrupts.h> #include <rte_interrupts.h>
#include <rte_log.h> #include <rte_log.h>
#include <rte_debug.h> #include <rte_debug.h>

View File

@ -54,5 +54,6 @@ SRCS-$(CONFIG_RTE_LIBRTE_ENA_PMD) += ena_eth_com.c
CFLAGS += $(INCLUDES) CFLAGS += $(INCLUDES)
LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring
LDLIBS += -lrte_ethdev -lrte_net -lrte_kvargs LDLIBS += -lrte_ethdev -lrte_net -lrte_kvargs
LDLIBS += -lrte_bus_pci
include $(RTE_SDK)/mk/rte.lib.mk include $(RTE_SDK)/mk/rte.lib.mk

View File

@ -35,6 +35,7 @@
#define _ENA_ETHDEV_H_ #define _ENA_ETHDEV_H_
#include <rte_pci.h> #include <rte_pci.h>
#include <rte_bus_pci.h>
#include "ena_com.h" #include "ena_com.h"

View File

@ -47,6 +47,7 @@ CFLAGS += -O3
CFLAGS += $(WERROR_FLAGS) -Wno-strict-aliasing CFLAGS += $(WERROR_FLAGS) -Wno-strict-aliasing
LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring
LDLIBS += -lrte_ethdev -lrte_net -lrte_kvargs -lrte_hash LDLIBS += -lrte_ethdev -lrte_net -lrte_kvargs -lrte_hash
LDLIBS += -lrte_bus_pci
VPATH += $(SRCDIR)/src VPATH += $(SRCDIR)/src

View File

@ -35,8 +35,10 @@
#ifndef _VNIC_DEV_H_ #ifndef _VNIC_DEV_H_
#define _VNIC_DEV_H_ #define _VNIC_DEV_H_
#include <rte_pci.h>
#include <rte_bus_pci.h>
#include "enic_compat.h" #include "enic_compat.h"
#include "rte_pci.h"
#include "vnic_resource.h" #include "vnic_resource.h"
#include "vnic_devcmd.h" #include "vnic_devcmd.h"

View File

@ -37,6 +37,7 @@
#include <rte_dev.h> #include <rte_dev.h>
#include <rte_pci.h> #include <rte_pci.h>
#include <rte_bus_pci.h>
#include <rte_ethdev.h> #include <rte_ethdev.h>
#include <rte_ethdev_pci.h> #include <rte_ethdev_pci.h>
#include <rte_string_fns.h> #include <rte_string_fns.h>

View File

@ -40,6 +40,7 @@
#include <libgen.h> #include <libgen.h>
#include <rte_pci.h> #include <rte_pci.h>
#include <rte_bus_pci.h>
#include <rte_memzone.h> #include <rte_memzone.h>
#include <rte_malloc.h> #include <rte_malloc.h>
#include <rte_mbuf.h> #include <rte_mbuf.h>

View File

@ -78,6 +78,7 @@ endif
endif endif
LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring
LDLIBS += -lrte_ethdev -lrte_net -lrte_kvargs -lrte_hash LDLIBS += -lrte_ethdev -lrte_net -lrte_kvargs -lrte_hash
LDLIBS += -lrte_bus_pci
# #
# Add extra flags for base driver source files to disable warnings in them # Add extra flags for base driver source files to disable warnings in them

View File

@ -41,6 +41,7 @@ CFLAGS += $(WERROR_FLAGS) -DPF_DRIVER -DVF_DRIVER -DINTEGRATED_VF
CFLAGS += -DX722_A0_SUPPORT CFLAGS += -DX722_A0_SUPPORT
LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring
LDLIBS += -lrte_ethdev -lrte_net -lrte_kvargs -lrte_hash LDLIBS += -lrte_ethdev -lrte_net -lrte_kvargs -lrte_hash
LDLIBS += -lrte_bus_pci
EXPORT_MAP := rte_pmd_i40e_version.map EXPORT_MAP := rte_pmd_i40e_version.map

View File

@ -43,6 +43,7 @@
#include <rte_eal.h> #include <rte_eal.h>
#include <rte_string_fns.h> #include <rte_string_fns.h>
#include <rte_pci.h> #include <rte_pci.h>
#include <rte_bus_pci.h>
#include <rte_ether.h> #include <rte_ether.h>
#include <rte_ethdev.h> #include <rte_ethdev.h>
#include <rte_ethdev_pci.h> #include <rte_ethdev_pci.h>

View File

@ -47,6 +47,7 @@
#include <rte_log.h> #include <rte_log.h>
#include <rte_debug.h> #include <rte_debug.h>
#include <rte_pci.h> #include <rte_pci.h>
#include <rte_bus_pci.h>
#include <rte_atomic.h> #include <rte_atomic.h>
#include <rte_branch_prediction.h> #include <rte_branch_prediction.h>
#include <rte_memory.h> #include <rte_memory.h>

View File

@ -84,6 +84,7 @@ endif
endif endif
LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring
LDLIBS += -lrte_ethdev -lrte_net -lrte_kvargs -lrte_hash LDLIBS += -lrte_ethdev -lrte_net -lrte_kvargs -lrte_hash
LDLIBS += -lrte_bus_pci
# #
# Add extra flags for base driver files (also known as shared code) # Add extra flags for base driver files (also known as shared code)

View File

@ -48,6 +48,7 @@
#include <rte_log.h> #include <rte_log.h>
#include <rte_debug.h> #include <rte_debug.h>
#include <rte_pci.h> #include <rte_pci.h>
#include <rte_bus_pci.h>
#include <rte_atomic.h> #include <rte_atomic.h>
#include <rte_branch_prediction.h> #include <rte_branch_prediction.h>
#include <rte_memory.h> #include <rte_memory.h>

View File

@ -44,6 +44,7 @@
#include <rte_time.h> #include <rte_time.h>
#include <rte_hash.h> #include <rte_hash.h>
#include <rte_pci.h> #include <rte_pci.h>
#include <rte_bus_pci.h>
#include <rte_tm_driver.h> #include <rte_tm_driver.h>
/* need update link, bit flag */ /* need update link, bit flag */

View File

@ -42,6 +42,7 @@ CFLAGS += -O3
CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR)/base -I$(SRCDIR) CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR)/base -I$(SRCDIR)
LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring
LDLIBS += -lrte_ethdev -lrte_net -lrte_kvargs LDLIBS += -lrte_ethdev -lrte_net -lrte_kvargs
LDLIBS += -lrte_bus_pci
EXPORT_MAP := rte_pmd_lio_version.map EXPORT_MAP := rte_pmd_lio_version.map

View File

@ -57,6 +57,7 @@ CFLAGS += $(WERROR_FLAGS)
LDLIBS += -libverbs -lmlx4 LDLIBS += -libverbs -lmlx4
LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring
LDLIBS += -lrte_ethdev -lrte_net -lrte_kvargs LDLIBS += -lrte_ethdev -lrte_net -lrte_kvargs
LDLIBS += -lrte_bus_pci
# A few warnings cannot be avoided in external headers. # A few warnings cannot be avoided in external headers.
CFLAGS += -Wno-error=cast-qual CFLAGS += -Wno-error=cast-qual

View File

@ -61,6 +61,7 @@
#pragma GCC diagnostic error "-Wpedantic" #pragma GCC diagnostic error "-Wpedantic"
#endif #endif
#include <rte_bus_pci.h>
#include <rte_errno.h> #include <rte_errno.h>
#include <rte_ethdev.h> #include <rte_ethdev.h>
#include <rte_ether.h> #include <rte_ether.h>

View File

@ -67,6 +67,7 @@ CFLAGS += -Wno-strict-prototypes
LDLIBS += -libverbs -lmlx5 LDLIBS += -libverbs -lmlx5
LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring
LDLIBS += -lrte_ethdev -lrte_net -lrte_kvargs LDLIBS += -lrte_ethdev -lrte_net -lrte_kvargs
LDLIBS += -lrte_bus_pci
# A few warnings cannot be avoided in external headers. # A few warnings cannot be avoided in external headers.
CFLAGS += -Wno-error=cast-qual CFLAGS += -Wno-error=cast-qual

View File

@ -54,6 +54,7 @@
#include <rte_ethdev.h> #include <rte_ethdev.h>
#include <rte_ethdev_pci.h> #include <rte_ethdev_pci.h>
#include <rte_pci.h> #include <rte_pci.h>
#include <rte_bus_pci.h>
#include <rte_common.h> #include <rte_common.h>
#include <rte_kvargs.h> #include <rte_kvargs.h>

View File

@ -56,6 +56,7 @@
#include <rte_atomic.h> #include <rte_atomic.h>
#include <rte_ethdev.h> #include <rte_ethdev.h>
#include <rte_bus_pci.h>
#include <rte_mbuf.h> #include <rte_mbuf.h>
#include <rte_common.h> #include <rte_common.h>
#include <rte_interrupts.h> #include <rte_interrupts.h>

View File

@ -42,6 +42,7 @@ CFLAGS += $(WERROR_FLAGS)
LDLIBS += -lm LDLIBS += -lm
LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring
LDLIBS += -lrte_ethdev -lrte_net -lrte_kvargs LDLIBS += -lrte_ethdev -lrte_net -lrte_kvargs
LDLIBS += -lrte_bus_pci
EXPORT_MAP := rte_pmd_nfp_version.map EXPORT_MAP := rte_pmd_nfp_version.map

View File

@ -8,7 +8,7 @@
#include <fcntl.h> #include <fcntl.h>
#include <sys/types.h> #include <sys/types.h>
#include <rte_pci.h> #include <rte_bus_pci.h>
#include <rte_malloc.h> #include <rte_malloc.h>
#include "nfp_nfpu.h" #include "nfp_nfpu.h"

View File

@ -42,7 +42,7 @@
*/ */
#include <rte_pci.h> #include <rte_bus_pci.h>
#include "nfp_nspu.h" #include "nfp_nspu.h"
typedef struct { typedef struct {

View File

@ -73,5 +73,6 @@ LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring
LDLIBS += -lrte_ethdev -lrte_net -lrte_kvargs LDLIBS += -lrte_ethdev -lrte_net -lrte_kvargs
LDLIBS += -lrte_mempool_octeontx LDLIBS += -lrte_mempool_octeontx
LDLIBS += -lrte_eventdev LDLIBS += -lrte_eventdev
LDLIBS += -lrte_bus_pci
include $(RTE_SDK)/mk/rte.lib.mk include $(RTE_SDK)/mk/rte.lib.mk

View File

@ -32,7 +32,7 @@
#include <string.h> #include <string.h>
#include <rte_eal.h> #include <rte_eal.h>
#include <rte_pci.h> #include <rte_bus_pci.h>
#include "octeontx_pkivf.h" #include "octeontx_pkivf.h"

View File

@ -37,7 +37,7 @@
#include <rte_cycles.h> #include <rte_cycles.h>
#include <rte_malloc.h> #include <rte_malloc.h>
#include <rte_memory.h> #include <rte_memory.h>
#include <rte_pci.h> #include <rte_bus_pci.h>
#include <rte_spinlock.h> #include <rte_spinlock.h>
#include "../octeontx_logs.h" #include "../octeontx_logs.h"

View File

@ -15,6 +15,7 @@ CFLAGS += -O3
CFLAGS += $(WERROR_FLAGS) CFLAGS += $(WERROR_FLAGS)
LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring
LDLIBS += -lrte_ethdev -lrte_net -lrte_kvargs LDLIBS += -lrte_ethdev -lrte_net -lrte_kvargs
LDLIBS += -lrte_bus_pci
EXPORT_MAP := rte_pmd_qede_version.map EXPORT_MAP := rte_pmd_qede_version.map

View File

@ -71,6 +71,7 @@ CFLAGS_sfc_ef10_tx.o += -wd3656
endif endif
LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring
LDLIBS += -lrte_ethdev -lrte_net -lrte_kvargs LDLIBS += -lrte_ethdev -lrte_net -lrte_kvargs
LDLIBS += -lrte_bus_pci
# #
# List of base driver object files for which # List of base driver object files for which

View File

@ -35,6 +35,7 @@
#include <stdbool.h> #include <stdbool.h>
#include <rte_pci.h> #include <rte_pci.h>
#include <rte_bus_pci.h>
#include <rte_ethdev.h> #include <rte_ethdev.h>
#include <rte_kvargs.h> #include <rte_kvargs.h>
#include <rte_spinlock.h> #include <rte_spinlock.h>

View File

@ -33,6 +33,7 @@
#include <rte_ethdev.h> #include <rte_ethdev.h>
#include <rte_ethdev_pci.h> #include <rte_ethdev_pci.h>
#include <rte_pci.h> #include <rte_pci.h>
#include <rte_bus_pci.h>
#include <rte_errno.h> #include <rte_errno.h>
#include "efx.h" #include "efx.h"

View File

@ -41,6 +41,7 @@ CFLAGS += $(WERROR_FLAGS)
LDLIBS += -lsze2 LDLIBS += -lsze2
LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring
LDLIBS += -lrte_ethdev -lrte_net -lrte_kvargs LDLIBS += -lrte_ethdev -lrte_net -lrte_kvargs
LDLIBS += -lrte_bus_pci
EXPORT_MAP := rte_pmd_szedata2_version.map EXPORT_MAP := rte_pmd_szedata2_version.map

View File

@ -42,6 +42,7 @@ CFLAGS += $(WERROR_FLAGS)
LDLIBS += -lm LDLIBS += -lm
LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring
LDLIBS += -lrte_ethdev -lrte_net -lrte_kvargs LDLIBS += -lrte_ethdev -lrte_net -lrte_kvargs
LDLIBS += -lrte_bus_pci
EXPORT_MAP := rte_pmd_thunderx_nicvf_version.map EXPORT_MAP := rte_pmd_thunderx_nicvf_version.map

View File

@ -61,6 +61,7 @@
#include <rte_malloc.h> #include <rte_malloc.h>
#include <rte_random.h> #include <rte_random.h>
#include <rte_pci.h> #include <rte_pci.h>
#include <rte_bus_pci.h>
#include <rte_tailq.h> #include <rte_tailq.h>
#include "base/nicvf_plat.h" #include "base/nicvf_plat.h"

View File

@ -40,6 +40,7 @@ CFLAGS += -O3
CFLAGS += $(WERROR_FLAGS) CFLAGS += $(WERROR_FLAGS)
LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring
LDLIBS += -lrte_ethdev -lrte_net -lrte_kvargs LDLIBS += -lrte_ethdev -lrte_net -lrte_kvargs
LDLIBS += -lrte_bus_pci
EXPORT_MAP := rte_pmd_virtio_version.map EXPORT_MAP := rte_pmd_virtio_version.map

View File

@ -46,6 +46,7 @@
#include <rte_atomic.h> #include <rte_atomic.h>
#include <rte_branch_prediction.h> #include <rte_branch_prediction.h>
#include <rte_pci.h> #include <rte_pci.h>
#include <rte_bus_pci.h>
#include <rte_ether.h> #include <rte_ether.h>
#include <rte_common.h> #include <rte_common.h>
#include <rte_errno.h> #include <rte_errno.h>

View File

@ -37,6 +37,7 @@
#include <stdint.h> #include <stdint.h>
#include <rte_pci.h> #include <rte_pci.h>
#include <rte_bus_pci.h>
#include <rte_ethdev.h> #include <rte_ethdev.h>
struct virtqueue; struct virtqueue;

View File

@ -65,6 +65,7 @@ CFLAGS_BASE_DRIVER += -Wno-strict-aliasing -Wno-format-extra-args
endif endif
LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring
LDLIBS += -lrte_ethdev -lrte_net -lrte_kvargs LDLIBS += -lrte_ethdev -lrte_net -lrte_kvargs
LDLIBS += -lrte_bus_pci
VPATH += $(SRCDIR)/base VPATH += $(SRCDIR)/base

View File

@ -48,6 +48,7 @@
#include <rte_log.h> #include <rte_log.h>
#include <rte_debug.h> #include <rte_debug.h>
#include <rte_pci.h> #include <rte_pci.h>
#include <rte_bus_pci.h>
#include <rte_atomic.h> #include <rte_atomic.h>
#include <rte_branch_prediction.h> #include <rte_branch_prediction.h>
#include <rte_memory.h> #include <rte_memory.h>

View File

@ -37,6 +37,7 @@
#include <rte_ethdev.h> #include <rte_ethdev.h>
#include <rte_ether.h> #include <rte_ether.h>
#include <rte_pci.h> #include <rte_pci.h>
#include <rte_bus_pci.h>
#ifdef RTE_LIBRTE_IXGBE_PMD #ifdef RTE_LIBRTE_IXGBE_PMD
#include <rte_pmd_ixgbe.h> #include <rte_pmd_ixgbe.h>
#endif #endif

View File

@ -49,6 +49,7 @@
#include <rte_ip.h> #include <rte_ip.h>
#include <rte_eal.h> #include <rte_eal.h>
#include <rte_malloc.h> #include <rte_malloc.h>
#include <rte_bus_pci.h>
#include "app.h" #include "app.h"
#include "pipeline.h" #include "pipeline.h"

View File

@ -62,6 +62,7 @@
#include <rte_branch_prediction.h> #include <rte_branch_prediction.h>
#include <rte_interrupts.h> #include <rte_interrupts.h>
#include <rte_pci.h> #include <rte_pci.h>
#include <rte_bus_pci.h>
#include <rte_debug.h> #include <rte_debug.h>
#include <rte_ether.h> #include <rte_ether.h>
#include <rte_ethdev.h> #include <rte_ethdev.h>

View File

@ -33,6 +33,8 @@ include $(RTE_SDK)/mk/rte.vars.mk
DIRS-y += librte_compat DIRS-y += librte_compat
DIRS-$(CONFIG_RTE_LIBRTE_EAL) += librte_eal DIRS-$(CONFIG_RTE_LIBRTE_EAL) += librte_eal
DIRS-$(CONFIG_RTE_LIBRTE_PCI) += librte_pci
DEPDIRS-librte_pci := librte_eal
DIRS-$(CONFIG_RTE_LIBRTE_RING) += librte_ring DIRS-$(CONFIG_RTE_LIBRTE_RING) += librte_ring
DEPDIRS-librte_ring := librte_eal DEPDIRS-librte_ring := librte_eal
DIRS-$(CONFIG_RTE_LIBRTE_MEMPOOL) += librte_mempool DIRS-$(CONFIG_RTE_LIBRTE_MEMPOOL) += librte_mempool

View File

@ -55,7 +55,6 @@ SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) := eal.c
SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += eal_memory.c SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += eal_memory.c
SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += eal_hugepage_info.c SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += eal_hugepage_info.c
SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += eal_thread.c SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += eal_thread.c
SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += eal_pci.c
SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += eal_debug.c SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += eal_debug.c
SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += eal_lcore.c SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += eal_lcore.c
SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += eal_timer.c SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += eal_timer.c
@ -69,8 +68,6 @@ SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += eal_common_memzone.c
SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += eal_common_log.c SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += eal_common_log.c
SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += eal_common_launch.c SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += eal_common_launch.c
SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += eal_common_vdev.c SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += eal_common_vdev.c
SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += eal_common_pci.c
SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += eal_common_pci_uio.c
SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += eal_common_memory.c SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += eal_common_memory.c
SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += eal_common_tailqs.c SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += eal_common_tailqs.c
SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += eal_common_errno.c SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += eal_common_errno.c

View File

@ -66,7 +66,6 @@
#include <rte_cpuflags.h> #include <rte_cpuflags.h>
#include <rte_interrupts.h> #include <rte_interrupts.h>
#include <rte_bus.h> #include <rte_bus.h>
#include <rte_pci.h>
#include <rte_dev.h> #include <rte_dev.h>
#include <rte_devargs.h> #include <rte_devargs.h>
#include <rte_version.h> #include <rte_version.h>

View File

@ -34,7 +34,7 @@ include $(RTE_SDK)/mk/rte.vars.mk
INC := rte_branch_prediction.h rte_common.h INC := rte_branch_prediction.h rte_common.h
INC += rte_debug.h rte_eal.h rte_eal_interrupts.h INC += rte_debug.h rte_eal.h rte_eal_interrupts.h
INC += rte_errno.h rte_launch.h rte_lcore.h INC += rte_errno.h rte_launch.h rte_lcore.h
INC += rte_log.h rte_memory.h rte_memzone.h rte_pci.h INC += rte_log.h rte_memory.h rte_memzone.h
INC += rte_per_lcore.h rte_random.h INC += rte_per_lcore.h rte_random.h
INC += rte_tailq.h rte_interrupts.h rte_alarm.h INC += rte_tailq.h rte_interrupts.h rte_alarm.h
INC += rte_string_fns.h rte_version.h INC += rte_string_fns.h rte_version.h

View File

@ -37,7 +37,6 @@
#include <stdbool.h> #include <stdbool.h>
#include <stdint.h> #include <stdint.h>
#include <stdio.h> #include <stdio.h>
#include <rte_pci.h>
/** /**
* Initialize the memzone subsystem (private to eal). * Initialize the memzone subsystem (private to eal).
@ -110,211 +109,6 @@ int rte_eal_timer_init(void);
*/ */
int rte_eal_log_init(const char *id, int facility); int rte_eal_log_init(const char *id, int facility);
struct rte_pci_driver;
struct rte_pci_device;
/**
* Probe the PCI bus
*
* @return
* - 0 on success.
* - !0 on error.
*/
int
rte_pci_probe(void);
/**
* Scan the content of the PCI bus, and the devices in the devices
* list
*
* @return
* 0 on success, negative on error
*/
int rte_pci_scan(void);
/**
* Probe the single PCI device.
*
* Scan the content of the PCI bus, and find the pci device specified by pci
* address, then call the probe() function for registered driver that has a
* matching entry in its id_table for discovered device.
*
* @param addr
* The PCI Bus-Device-Function address to probe.
* @return
* - 0 on success.
* - Negative on error.
*/
int rte_pci_probe_one(const struct rte_pci_addr *addr);
/**
* Close the single PCI device.
*
* Scan the content of the PCI bus, and find the pci device specified by pci
* address, then call the remove() function for registered driver that has a
* matching entry in its id_table for discovered device.
*
* @param addr
* The PCI Bus-Device-Function address to close.
* @return
* - 0 on success.
* - Negative on error.
*/
int rte_pci_detach(const struct rte_pci_addr *addr);
/**
* Find the name of a PCI device.
*/
void pci_name_set(struct rte_pci_device *dev);
/**
* Add a PCI device to the PCI Bus (append to PCI Device list). This function
* also updates the bus references of the PCI Device (and the generic device
* object embedded within.
*
* @param pci_dev
* PCI device to add
* @return void
*/
void rte_pci_add_device(struct rte_pci_device *pci_dev);
/**
* Insert a PCI device in the PCI Bus at a particular location in the device
* list. It also updates the PCI Bus reference of the new devices to be
* inserted.
*
* @param exist_pci_dev
* Existing PCI device in PCI Bus
* @param new_pci_dev
* PCI device to be added before exist_pci_dev
* @return void
*/
void rte_pci_insert_device(struct rte_pci_device *exist_pci_dev,
struct rte_pci_device *new_pci_dev);
/**
* Remove a PCI device from the PCI Bus. This sets to NULL the bus references
* in the PCI device object as well as the generic device object.
*
* @param pci_device
* PCI device to be removed from PCI Bus
* @return void
*/
void rte_pci_remove_device(struct rte_pci_device *pci_device);
/**
* Update a pci device object by asking the kernel for the latest information.
*
* This function is private to EAL.
*
* @param addr
* The PCI Bus-Device-Function address to look for
* @return
* - 0 on success.
* - negative on error.
*/
int pci_update_device(const struct rte_pci_addr *addr);
/**
* Unbind kernel driver for this device
*
* This function is private to EAL.
*
* @return
* 0 on success, negative on error
*/
int pci_unbind_kernel_driver(struct rte_pci_device *dev);
/**
* Map the PCI resource of a PCI device in virtual memory
*
* This function is private to EAL.
*
* @return
* 0 on success, negative on error
*/
int pci_uio_map_resource(struct rte_pci_device *dev);
/**
* Unmap the PCI resource of a PCI device
*
* This function is private to EAL.
*/
void pci_uio_unmap_resource(struct rte_pci_device *dev);
/**
* Allocate uio resource for PCI device
*
* This function is private to EAL.
*
* @param dev
* PCI device to allocate uio resource
* @param uio_res
* Pointer to uio resource.
* If the function returns 0, the pointer will be filled.
* @return
* 0 on success, negative on error
*/
int pci_uio_alloc_resource(struct rte_pci_device *dev,
struct mapped_pci_resource **uio_res);
/**
* Free uio resource for PCI device
*
* This function is private to EAL.
*
* @param dev
* PCI device to free uio resource
* @param uio_res
* Pointer to uio resource.
*/
void pci_uio_free_resource(struct rte_pci_device *dev,
struct mapped_pci_resource *uio_res);
/**
* Map device memory to uio resource
*
* This function is private to EAL.
*
* @param dev
* PCI device that has memory information.
* @param res_idx
* Memory resource index of the PCI device.
* @param uio_res
* uio resource that will keep mapping information.
* @param map_idx
* Mapping information index of the uio resource.
* @return
* 0 on success, negative on error
*/
int pci_uio_map_resource_by_index(struct rte_pci_device *dev, int res_idx,
struct mapped_pci_resource *uio_res, int map_idx);
/*
* Match the PCI Driver and Device using the ID Table
*
* @param pci_drv
* PCI driver from which ID table would be extracted
* @param pci_dev
* PCI device to match against the driver
* @return
* 1 for successful match
* 0 for unsuccessful match
*/
int
rte_pci_match(const struct rte_pci_driver *pci_drv,
const struct rte_pci_device *pci_dev);
/**
* Get iommu class of PCI devices on the bus.
* And return their preferred iova mapping mode.
*
* @return
* - enum rte_iova_mode.
*/
enum rte_iova_mode
rte_pci_get_iommu_class(void);
/** /**
* Init tail queues for non-EAL library structures. This is to allow * Init tail queues for non-EAL library structures. This is to allow
* the rings, mempools, etc. lists to be shared among multiple processes * the rings, mempools, etc. lists to be shared among multiple processes

View File

@ -62,9 +62,6 @@ SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_thread.c
SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_log.c SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_log.c
SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_vfio.c SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_vfio.c
SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_vfio_mp_sync.c SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_vfio_mp_sync.c
SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_pci.c
SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_pci_uio.c
SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_pci_vfio.c
SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_debug.c SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_debug.c
SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_lcore.c SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_lcore.c
SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_timer.c SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_timer.c
@ -78,8 +75,6 @@ SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_common_memzone.c
SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_common_log.c SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_common_log.c
SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_common_launch.c SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_common_launch.c
SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_common_vdev.c SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_common_vdev.c
SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_common_pci.c
SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_common_pci_uio.c
SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_common_memory.c SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_common_memory.c
SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_common_tailqs.c SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_common_tailqs.c
SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_common_errno.c SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_common_errno.c
@ -132,9 +127,6 @@ CFLAGS_eal_thread.o := -D_GNU_SOURCE
CFLAGS_eal_log.o := -D_GNU_SOURCE CFLAGS_eal_log.o := -D_GNU_SOURCE
CFLAGS_eal_common_log.o := -D_GNU_SOURCE CFLAGS_eal_common_log.o := -D_GNU_SOURCE
CFLAGS_eal_hugepage_info.o := -D_GNU_SOURCE CFLAGS_eal_hugepage_info.o := -D_GNU_SOURCE
CFLAGS_eal_pci.o := -D_GNU_SOURCE
CFLAGS_eal_pci_uio.o := -D_GNU_SOURCE
CFLAGS_eal_pci_vfio.o := -D_GNU_SOURCE
CFLAGS_eal_common_whitelist.o := -D_GNU_SOURCE CFLAGS_eal_common_whitelist.o := -D_GNU_SOURCE
CFLAGS_eal_common_options.o := -D_GNU_SOURCE CFLAGS_eal_common_options.o := -D_GNU_SOURCE
CFLAGS_eal_common_thread.o := -D_GNU_SOURCE CFLAGS_eal_common_thread.o := -D_GNU_SOURCE

View File

@ -71,7 +71,6 @@
#include <rte_cpuflags.h> #include <rte_cpuflags.h>
#include <rte_interrupts.h> #include <rte_interrupts.h>
#include <rte_bus.h> #include <rte_bus.h>
#include <rte_pci.h>
#include <rte_dev.h> #include <rte_dev.h>
#include <rte_devargs.h> #include <rte_devargs.h>
#include <rte_version.h> #include <rte_version.h>

View File

@ -60,7 +60,6 @@
#include <rte_branch_prediction.h> #include <rte_branch_prediction.h>
#include <rte_debug.h> #include <rte_debug.h>
#include <rte_log.h> #include <rte_log.h>
#include <rte_pci.h>
#include <rte_malloc.h> #include <rte_malloc.h>
#include <rte_errno.h> #include <rte_errno.h>
#include <rte_spinlock.h> #include <rte_spinlock.h>

View File

@ -166,17 +166,6 @@ DPDK_17.05 {
rte_log_set_global_level; rte_log_set_global_level;
rte_log_set_level; rte_log_set_level;
rte_log_set_level_regexp; rte_log_set_level_regexp;
rte_pci_dump;
rte_pci_ioport_map;
rte_pci_ioport_read;
rte_pci_ioport_unmap;
rte_pci_ioport_write;
rte_pci_map_device;
rte_pci_read_config;
rte_pci_register;
rte_pci_unmap_device;
rte_pci_unregister;
rte_pci_write_config;
rte_vdev_init; rte_vdev_init;
rte_vdev_register; rte_vdev_register;
rte_vdev_uninit; rte_vdev_uninit;
@ -237,11 +226,8 @@ EXPERIMENTAL {
DPDK_17.11 { DPDK_17.11 {
global: global:
eal_parse_pci_BDF;
eal_parse_pci_DomBDF;
rte_eal_create_uio_dev; rte_eal_create_uio_dev;
rte_bus_get_iommu_class; rte_bus_get_iommu_class;
rte_eal_compare_pci_addr;
rte_eal_has_pci; rte_eal_has_pci;
rte_eal_iova_mode; rte_eal_iova_mode;
rte_eal_mbuf_default_mempool_ops; rte_eal_mbuf_default_mempool_ops;
@ -249,9 +235,6 @@ DPDK_17.11 {
rte_eal_vfio_intr_mode; rte_eal_vfio_intr_mode;
rte_lcore_has_role; rte_lcore_has_role;
rte_memcpy_ptr; rte_memcpy_ptr;
rte_pci_addr_cmp;
rte_pci_addr_parse;
rte_pci_device_name;
vfio_enable; vfio_enable;
vfio_is_enabled; vfio_is_enabled;
vfio_noiommu_is_enabled; vfio_noiommu_is_enabled;

View File

@ -1156,8 +1156,6 @@ TAILQ_HEAD(rte_eth_dev_cb_list, rte_eth_dev_callback);
} \ } \
} while (0) } while (0)
#define RTE_ETH_DEV_TO_PCI(eth_dev) RTE_DEV_TO_PCI((eth_dev)->device)
/** /**
* l2 tunnel configuration. * l2 tunnel configuration.
*/ */

View File

@ -36,6 +36,7 @@
#include <rte_malloc.h> #include <rte_malloc.h>
#include <rte_pci.h> #include <rte_pci.h>
#include <rte_bus_pci.h>
#include <rte_ethdev.h> #include <rte_ethdev.h>
/** /**

View File

@ -50,6 +50,7 @@ extern "C" {
#include <rte_eal.h> #include <rte_eal.h>
#include <rte_lcore.h> #include <rte_lcore.h>
#include <rte_pci.h> #include <rte_pci.h>
#include <rte_bus_pci.h>
#include "rte_eventdev_pmd.h" #include "rte_eventdev_pmd.h"

49
lib/librte_pci/Makefile Normal file
View File

@ -0,0 +1,49 @@
# BSD LICENSE
#
# Copyright(c) 2017 6WIND S.A.
# 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 6WIND 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_pci.a
CFLAGS := -I$(SRCDIR) $(CFLAGS)
CFLAGS += $(WERROR_FLAGS) -O3
LDLIBS += -lrte_eal
EXPORT_MAP := rte_pci_version.map
LIBABIVER := 1
SRCS-$(CONFIG_RTE_LIBRTE_PCI) += rte_pci.c
SYMLINK-$(CONFIG_RTE_LIBRTE_PCI)-include += rte_pci.h
include $(RTE_SDK)/mk/rte.lib.mk

220
lib/librte_pci/rte_pci.c Normal file
View File

@ -0,0 +1,220 @@
/*-
* BSD LICENSE
*
* Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
* Copyright 2013-2014 6WIND S.A.
* 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 <string.h>
#include <inttypes.h>
#include <stdint.h>
#include <stdlib.h>
#include <stdio.h>
#include <sys/queue.h>
#include <sys/mman.h>
#include <rte_errno.h>
#include <rte_interrupts.h>
#include <rte_log.h>
#include <rte_bus.h>
#include <rte_per_lcore.h>
#include <rte_memory.h>
#include <rte_memzone.h>
#include <rte_eal.h>
#include <rte_string_fns.h>
#include <rte_common.h>
#include "rte_pci.h"
static inline const char *
get_u8_pciaddr_field(const char *in, void *_u8, char dlm)
{
unsigned long val;
uint8_t *u8 = _u8;
char *end;
errno = 0;
val = strtoul(in, &end, 16);
if (errno != 0 || end[0] != dlm || val > UINT8_MAX) {
errno = errno ? errno : EINVAL;
return NULL;
}
*u8 = (uint8_t)val;
return end + 1;
}
static int
pci_bdf_parse(const char *input, struct rte_pci_addr *dev_addr)
{
const char *in = input;
dev_addr->domain = 0;
in = get_u8_pciaddr_field(in, &dev_addr->bus, ':');
if (in == NULL)
return -EINVAL;
in = get_u8_pciaddr_field(in, &dev_addr->devid, '.');
if (in == NULL)
return -EINVAL;
in = get_u8_pciaddr_field(in, &dev_addr->function, '\0');
if (in == NULL)
return -EINVAL;
return 0;
}
static int
pci_dbdf_parse(const char *input, struct rte_pci_addr *dev_addr)
{
const char *in = input;
unsigned long val;
char *end;
errno = 0;
val = strtoul(in, &end, 16);
if (errno != 0 || end[0] != ':' || val > UINT16_MAX)
return -EINVAL;
dev_addr->domain = (uint16_t)val;
in = end + 1;
in = get_u8_pciaddr_field(in, &dev_addr->bus, ':');
if (in == NULL)
return -EINVAL;
in = get_u8_pciaddr_field(in, &dev_addr->devid, '.');
if (in == NULL)
return -EINVAL;
in = get_u8_pciaddr_field(in, &dev_addr->function, '\0');
if (in == NULL)
return -EINVAL;
return 0;
}
int
eal_parse_pci_BDF(const char *input, struct rte_pci_addr *dev_addr)
{
return pci_bdf_parse(input, dev_addr);
}
int
eal_parse_pci_DomBDF(const char *input, struct rte_pci_addr *dev_addr)
{
return pci_dbdf_parse(input, dev_addr);
}
void
rte_pci_device_name(const struct rte_pci_addr *addr,
char *output, size_t size)
{
pci_device_name(addr, output, size);
}
void
pci_device_name(const struct rte_pci_addr *addr,
char *output, size_t size)
{
RTE_VERIFY(size >= PCI_PRI_STR_SIZE);
RTE_VERIFY(snprintf(output, size, PCI_PRI_FMT,
addr->domain, addr->bus,
addr->devid, addr->function) >= 0);
}
int
rte_eal_compare_pci_addr(const struct rte_pci_addr *addr,
const struct rte_pci_addr *addr2)
{
return pci_addr_cmp(addr, addr2);
}
int
pci_addr_cmp(const struct rte_pci_addr *addr,
const struct rte_pci_addr *addr2)
{
uint64_t dev_addr, dev_addr2;
if ((addr == NULL) || (addr2 == NULL))
return -1;
dev_addr = ((uint64_t)addr->domain << 24) |
(addr->bus << 16) | (addr->devid << 8) | addr->function;
dev_addr2 = ((uint64_t)addr2->domain << 24) |
(addr2->bus << 16) | (addr2->devid << 8) | addr2->function;
if (dev_addr > dev_addr2)
return 1;
else if (dev_addr < dev_addr2)
return -1;
else
return 0;
}
int
pci_addr_parse(const char *str, struct rte_pci_addr *addr)
{
if (pci_bdf_parse(str, addr) == 0 ||
pci_dbdf_parse(str, addr) == 0)
return 0;
return -1;
}
/* map a particular resource from a file */
void *
pci_map_resource(void *requested_addr, int fd, off_t offset, size_t size,
int additional_flags)
{
void *mapaddr;
/* Map the PCI memory resource of device */
mapaddr = mmap(requested_addr, size, PROT_READ | PROT_WRITE,
MAP_SHARED | additional_flags, fd, offset);
if (mapaddr == MAP_FAILED) {
RTE_LOG(ERR, EAL, "%s(): cannot mmap(%d, %p, 0x%lx, 0x%lx): %s (%p)\n",
__func__, fd, requested_addr,
(unsigned long)size, (unsigned long)offset,
strerror(errno), mapaddr);
} else
RTE_LOG(DEBUG, EAL, " PCI memory mapped at %p\n", mapaddr);
return mapaddr;
}
/* unmap a particular resource */
void
pci_unmap_resource(void *requested_addr, size_t size)
{
if (requested_addr == NULL)
return;
/* Unmap the PCI memory resource of device */
if (munmap(requested_addr, size)) {
RTE_LOG(ERR, EAL, "%s(): cannot munmap(%p, 0x%lx): %s\n",
__func__, requested_addr, (unsigned long)size,
strerror(errno));
} else
RTE_LOG(DEBUG, EAL, " PCI memory unmapped at %p\n",
requested_addr);
}

279
lib/librte_pci/rte_pci.h Normal file
View File

@ -0,0 +1,279 @@
/*-
* BSD LICENSE
*
* Copyright(c) 2010-2015 Intel Corporation. All rights reserved.
* Copyright 2013-2014 6WIND S.A.
* 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.
*/
#ifndef _RTE_PCI_H_
#define _RTE_PCI_H_
/**
* @file
*
* RTE PCI Library
*/
#ifdef __cplusplus
extern "C" {
#endif
#include <stdio.h>
#include <stdlib.h>
#include <limits.h>
#include <errno.h>
#include <sys/queue.h>
#include <stdint.h>
#include <inttypes.h>
#include <rte_debug.h>
#include <rte_interrupts.h>
/** Formatting string for PCI device identifier: Ex: 0000:00:01.0 */
#define PCI_PRI_FMT "%.4" PRIx16 ":%.2" PRIx8 ":%.2" PRIx8 ".%" PRIx8
#define PCI_PRI_STR_SIZE sizeof("XXXXXXXX:XX:XX.X")
/** Short formatting string, without domain, for PCI device: Ex: 00:01.0 */
#define PCI_SHORT_PRI_FMT "%.2" PRIx8 ":%.2" PRIx8 ".%" PRIx8
/** Nb. of values in PCI device identifier format string. */
#define PCI_FMT_NVAL 4
/** Nb. of values in PCI resource format. */
#define PCI_RESOURCE_FMT_NVAL 3
/** Maximum number of PCI resources. */
#define PCI_MAX_RESOURCE 6
/**
* A structure describing an ID for a PCI driver. Each driver provides a
* table of these IDs for each device that it supports.
*/
struct rte_pci_id {
uint32_t class_id; /**< Class ID or RTE_CLASS_ANY_ID. */
uint16_t vendor_id; /**< Vendor ID or PCI_ANY_ID. */
uint16_t device_id; /**< Device ID or PCI_ANY_ID. */
uint16_t subsystem_vendor_id; /**< Subsystem vendor ID or PCI_ANY_ID. */
uint16_t subsystem_device_id; /**< Subsystem device ID or PCI_ANY_ID. */
};
/**
* A structure describing the location of a PCI device.
*/
struct rte_pci_addr {
uint32_t domain; /**< Device domain */
uint8_t bus; /**< Device bus */
uint8_t devid; /**< Device ID */
uint8_t function; /**< Device function. */
};
/** Any PCI device identifier (vendor, device, ...) */
#define PCI_ANY_ID (0xffff)
#define RTE_CLASS_ANY_ID (0xffffff)
/**
* A structure describing a PCI mapping.
*/
struct pci_map {
void *addr;
char *path;
uint64_t offset;
uint64_t size;
uint64_t phaddr;
};
struct pci_msix_table {
int bar_index;
uint32_t offset;
uint32_t size;
};
/**
* A structure describing a mapped PCI resource.
* For multi-process we need to reproduce all PCI mappings in secondary
* processes, so save them in a tailq.
*/
struct mapped_pci_resource {
TAILQ_ENTRY(mapped_pci_resource) next;
struct rte_pci_addr pci_addr;
char path[PATH_MAX];
int nb_maps;
struct pci_map maps[PCI_MAX_RESOURCE];
struct pci_msix_table msix_table;
};
/** mapped pci device list */
TAILQ_HEAD(mapped_pci_res_list, mapped_pci_resource);
/**
* @deprecated
* Utility function to produce a PCI Bus-Device-Function value
* given a string representation. Assumes that the BDF is provided without
* a domain prefix (i.e. domain returned is always 0)
*
* @param input
* The input string to be parsed. Should have the format XX:XX.X
* @param dev_addr
* The PCI Bus-Device-Function address to be returned.
* Domain will always be returned as 0
* @return
* 0 on success, negative on error.
*/
int eal_parse_pci_BDF(const char *input, struct rte_pci_addr *dev_addr);
/**
* @deprecated
* Utility function to produce a PCI Bus-Device-Function value
* given a string representation. Assumes that the BDF is provided including
* a domain prefix.
*
* @param input
* The input string to be parsed. Should have the format XXXX:XX:XX.X
* @param dev_addr
* The PCI Bus-Device-Function address to be returned
* @return
* 0 on success, negative on error.
*/
int eal_parse_pci_DomBDF(const char *input, struct rte_pci_addr *dev_addr);
/**
* @deprecated
* Utility function to write a pci device name, this device name can later be
* used to retrieve the corresponding rte_pci_addr using eal_parse_pci_*
* BDF helpers.
*
* @param addr
* The PCI Bus-Device-Function address
* @param output
* The output buffer string
* @param size
* The output buffer size
*/
void rte_pci_device_name(const struct rte_pci_addr *addr,
char *output, size_t size);
/**
* Utility function to write a pci device name, this device name can later be
* used to retrieve the corresponding rte_pci_addr using eal_parse_pci_*
* BDF helpers.
*
* @param addr
* The PCI Bus-Device-Function address
* @param output
* The output buffer string
* @param size
* The output buffer size
*/
void pci_device_name(const struct rte_pci_addr *addr,
char *output, size_t size);
/**
* @deprecated
* Utility function to compare two PCI device addresses.
*
* @param addr
* The PCI Bus-Device-Function address to compare
* @param addr2
* The PCI Bus-Device-Function address to compare
* @return
* 0 on equal PCI address.
* Positive on addr is greater than addr2.
* Negative on addr is less than addr2, or error.
*/
int rte_eal_compare_pci_addr(const struct rte_pci_addr *addr,
const struct rte_pci_addr *addr2);
/**
* Utility function to compare two PCI device addresses.
*
* @param addr
* The PCI Bus-Device-Function address to compare
* @param addr2
* The PCI Bus-Device-Function address to compare
* @return
* 0 on equal PCI address.
* Positive on addr is greater than addr2.
* Negative on addr is less than addr2, or error.
*/
int pci_addr_cmp(const struct rte_pci_addr *addr,
const struct rte_pci_addr *addr2);
/**
* Utility function to parse a string into a PCI location.
*
* @param str
* The string to parse
* @param addr
* The reference to the structure where the location
* is stored.
* @return
* 0 on success
* <0 otherwise
*/
int pci_addr_parse(const char *str, struct rte_pci_addr *addr);
/**
* Map a particular resource from a file.
*
* @param requested_addr
* The starting address for the new mapping range.
* @param fd
* The file descriptor.
* @param offset
* The offset for the mapping range.
* @param size
* The size for the mapping range.
* @param additional_flags
* The additional flags for the mapping range.
* @return
* - On success, the function returns a pointer to the mapped area.
* - On error, the value MAP_FAILED is returned.
*/
void *pci_map_resource(void *requested_addr, int fd, off_t offset,
size_t size, int additional_flags);
/**
* Unmap a particular resource.
*
* @param requested_addr
* The address for the unmapping range.
* @param size
* The size for the unmapping range.
*/
void pci_unmap_resource(void *requested_addr, size_t size);
#ifdef __cplusplus
}
#endif
#endif /* _RTE_PCI_H_ */

Some files were not shown because too many files have changed in this diff Show More