per Intel policy to include file commit date using git cmd below. The policy does not apply to non-Intel (C) notices. git log --follow -C90% --format=%ad --date default <file> | tail -1 and then pull just the 4 digit year from the result. Intel copyrights were not added to files where Intel either had no contribution ot the contribution lacked substance (ie license header updates, formatting changes, etc). Contribution date used "--follow -C95%" to get the most accurate date. Note that several files in this patch didn't end the license/(c) block with a blank comment line so these were added as the vast majority of files do have this last blank line. Simply there for consistency. Signed-off-by: paul luse <paul.e.luse@intel.com> Change-Id: Id5b7ce4f658fe87132f14139ead58d6e285c04d4 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/15192 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Community-CI: Mellanox Build Bot
165 lines
3.9 KiB
C
165 lines
3.9 KiB
C
/* SPDX-License-Identifier: BSD-3-Clause
|
|
* Copyright (C) 2022 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);
|
|
}
|