DPDK has merged changes which hide remove some DPDK object such as rte_device and rte_driver from the public API. So we add copies of the necessary header files into our tree, along with a 22.11-specific pci_dpdk implementation. These files are copied over exactly, except for one #include which needs to change from <> to "" so that it picks up the header in our tree instead of looking for it in system headers. Longer-term we may want to look at ways to automated checking and updating of these header files. DPDK 22.11 isn't officially released yet, so the header files could change, but we want to get this in now since without it SPDK cannot build against DPDK tip at all. Signed-off-by: Jim Harris <james.r.harris@intel.com> Change-Id: I89ffd0abab52c404cfff911c1c9b0cd9e889241d Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/14570 Community-CI: Mellanox Build Bot Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Changpeng Liu <changpeng.liu@intel.com> Reviewed-by: Shuhei Matsumoto <smatsumoto@nvidia.com>
165 lines
3.9 KiB
C
165 lines
3.9 KiB
C
/* SPDX-License-Identifier: BSD-3-Clause
|
|
* Copyright (c) Intel Corporation.
|
|
* All rights reserved.
|
|
*/
|
|
|
|
#include <rte_config.h>
|
|
#include <rte_version.h>
|
|
#include "pci_dpdk.h"
|
|
#include "spdk/log.h"
|
|
|
|
extern struct dpdk_fn_table fn_table_2207;
|
|
extern struct dpdk_fn_table fn_table_2211;
|
|
|
|
static struct dpdk_fn_table *g_dpdk_fn_table;
|
|
|
|
int
|
|
dpdk_pci_init(void)
|
|
{
|
|
uint32_t year;
|
|
uint32_t month;
|
|
uint32_t minor;
|
|
int count;
|
|
|
|
count = sscanf(rte_version(), "DPDK %u.%u.%u", &year, &month, &minor);
|
|
if (count != 3) {
|
|
SPDK_ERRLOG("Unrecognized DPDK version format '%s'\n", rte_version());
|
|
return -EINVAL;
|
|
}
|
|
|
|
/* Anything 23.x or higher is not supported. */
|
|
if (year > 22) {
|
|
SPDK_ERRLOG("DPDK version %d.%02d.%d not supported.\n", year, month, minor);
|
|
return -EINVAL;
|
|
}
|
|
|
|
if (year == 22 && month == 11) {
|
|
if (minor != 0) {
|
|
/* It is possible that LTS minor release changed private ABI, so we
|
|
* cannot assume fn_table_2211 works for minor releases. As 22.11
|
|
* minor releases occur, this will need to be updated to either affirm
|
|
* no ABI changes for the minor release, or add new header files and
|
|
* pci_dpdk_xxx.c implementation for the new minor release.
|
|
*/
|
|
SPDK_ERRLOG("DPDK LTS version 22.11.%d not supported.\n", minor);
|
|
return -EINVAL;
|
|
}
|
|
g_dpdk_fn_table = &fn_table_2211;
|
|
} else {
|
|
/* Everything else we use the 22.07 implementation. */
|
|
g_dpdk_fn_table = &fn_table_2207;
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
struct rte_mem_resource *
|
|
dpdk_pci_device_get_mem_resource(struct rte_pci_device *dev, uint32_t bar)
|
|
{
|
|
return g_dpdk_fn_table->pci_device_get_mem_resource(dev, bar);
|
|
}
|
|
|
|
const char *
|
|
dpdk_pci_device_get_name(struct rte_pci_device *rte_dev)
|
|
{
|
|
return g_dpdk_fn_table->pci_device_get_name(rte_dev);
|
|
}
|
|
|
|
struct rte_devargs *
|
|
dpdk_pci_device_get_devargs(struct rte_pci_device *rte_dev)
|
|
{
|
|
return g_dpdk_fn_table->pci_device_get_devargs(rte_dev);
|
|
}
|
|
|
|
struct rte_pci_addr *
|
|
dpdk_pci_device_get_addr(struct rte_pci_device *rte_dev)
|
|
{
|
|
return g_dpdk_fn_table->pci_device_get_addr(rte_dev);
|
|
}
|
|
|
|
struct rte_pci_id *
|
|
dpdk_pci_device_get_id(struct rte_pci_device *rte_dev)
|
|
{
|
|
return g_dpdk_fn_table->pci_device_get_id(rte_dev);
|
|
}
|
|
|
|
int
|
|
dpdk_pci_device_get_numa_node(struct rte_pci_device *_dev)
|
|
{
|
|
return g_dpdk_fn_table->pci_device_get_numa_node(_dev);
|
|
}
|
|
|
|
int
|
|
dpdk_pci_device_read_config(struct rte_pci_device *dev, void *value, uint32_t len, uint32_t offset)
|
|
{
|
|
return g_dpdk_fn_table->pci_device_read_config(dev, value, len, offset);
|
|
}
|
|
|
|
int
|
|
dpdk_pci_device_write_config(struct rte_pci_device *dev, void *value, uint32_t len, uint32_t offset)
|
|
{
|
|
return g_dpdk_fn_table->pci_device_write_config(dev, value, len, offset);
|
|
}
|
|
|
|
int
|
|
dpdk_pci_driver_register(struct spdk_pci_driver *driver,
|
|
int (*probe_fn)(struct rte_pci_driver *driver, struct rte_pci_device *device),
|
|
int (*remove_fn)(struct rte_pci_device *device))
|
|
|
|
{
|
|
return g_dpdk_fn_table->pci_driver_register(driver, probe_fn, remove_fn);
|
|
}
|
|
|
|
int
|
|
dpdk_pci_device_enable_interrupt(struct rte_pci_device *rte_dev)
|
|
{
|
|
return g_dpdk_fn_table->pci_device_enable_interrupt(rte_dev);
|
|
}
|
|
|
|
int
|
|
dpdk_pci_device_disable_interrupt(struct rte_pci_device *rte_dev)
|
|
{
|
|
return g_dpdk_fn_table->pci_device_disable_interrupt(rte_dev);
|
|
}
|
|
|
|
int
|
|
dpdk_pci_device_get_interrupt_efd(struct rte_pci_device *rte_dev)
|
|
{
|
|
return g_dpdk_fn_table->pci_device_get_interrupt_efd(rte_dev);
|
|
}
|
|
|
|
int
|
|
dpdk_bus_probe(void)
|
|
{
|
|
return g_dpdk_fn_table->bus_probe();
|
|
}
|
|
|
|
void
|
|
dpdk_bus_scan(void)
|
|
{
|
|
g_dpdk_fn_table->bus_scan();
|
|
}
|
|
|
|
struct rte_devargs *
|
|
dpdk_device_get_devargs(struct rte_device *dev)
|
|
{
|
|
return g_dpdk_fn_table->device_get_devargs(dev);
|
|
}
|
|
|
|
void
|
|
dpdk_device_set_devargs(struct rte_device *dev, struct rte_devargs *devargs)
|
|
{
|
|
g_dpdk_fn_table->device_set_devargs(dev, devargs);
|
|
}
|
|
|
|
const char *
|
|
dpdk_device_get_name(struct rte_device *dev)
|
|
{
|
|
return g_dpdk_fn_table->device_get_name(dev);
|
|
}
|
|
|
|
bool
|
|
dpdk_device_scan_allowed(struct rte_device *dev)
|
|
{
|
|
return g_dpdk_fn_table->device_scan_allowed(dev);
|
|
}
|