From 36644ef32f4ba6b80769f4d66a857f09a410757d Mon Sep 17 00:00:00 2001 From: Jim Harris Date: Thu, 15 Sep 2022 13:22:08 +0000 Subject: [PATCH] env_dpdk: move spdk_pci_driver definition to pci.c Also remove all pci-related DPDK includes from env_internal.h, and add rte_bus_pci.h to pci.c only. Now pci.c has all references to DPDK pci-related header files and data structures. Signed-off-by: Jim Harris Change-Id: I5f1727d465eaa73cf71d2f3589cecd3ebb83eb85 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/14531 Tested-by: SPDK CI Jenkins Reviewed-by: Changpeng Liu Reviewed-by: Aleksey Marchuk Reviewed-by: Ben Walker --- lib/env_dpdk/env_internal.h | 21 ++------------------- lib/env_dpdk/pci.c | 16 ++++++++++++++++ 2 files changed, 18 insertions(+), 19 deletions(-) diff --git a/lib/env_dpdk/env_internal.h b/lib/env_dpdk/env_internal.h index a9e653136..d38133d2c 100644 --- a/lib/env_dpdk/env_internal.h +++ b/lib/env_dpdk/env_internal.h @@ -13,10 +13,6 @@ #include #include #include -#include -#include -#include -#include #if RTE_VERSION < RTE_VERSION_NUM(19, 11, 0, 0) #error RTE_VERSION is too old! Minimum 19.11 is required. @@ -31,27 +27,14 @@ #define SHIFT_1GB 30 /* (1 << 30) == 1 GB */ #define MASK_1GB ((1ULL << SHIFT_1GB) - 1) -struct spdk_pci_driver { - struct rte_pci_driver driver; - - const char *name; - const struct spdk_pci_id *id_table; - uint32_t drv_flags; - - spdk_pci_enum_cb cb_fn; - void *cb_arg; - TAILQ_ENTRY(spdk_pci_driver) tailq; -}; - -int pci_device_init(struct rte_pci_driver *driver, struct rte_pci_device *device); -int pci_device_fini(struct rte_pci_device *device); - void pci_env_init(void); void pci_env_reinit(void); void pci_env_fini(void); int mem_map_init(bool legacy_mem); int vtophys_init(void); +struct rte_pci_device; + uint64_t dpdk_pci_device_vtophys(struct rte_pci_device *dev, uint64_t vaddr); /** diff --git a/lib/env_dpdk/pci.c b/lib/env_dpdk/pci.c index 3c571df2a..383d57b66 100644 --- a/lib/env_dpdk/pci.c +++ b/lib/env_dpdk/pci.c @@ -6,6 +6,7 @@ #include "env_internal.h" #include +#include #include #include "spdk/env.h" #include "spdk/log.h" @@ -38,6 +39,21 @@ static TAILQ_HEAD(, spdk_pci_driver) g_pci_drivers = TAILQ_HEAD_INITIALIZER(g_pc static TAILQ_HEAD(, spdk_pci_device_provider) g_pci_device_providers = TAILQ_HEAD_INITIALIZER(g_pci_device_providers); +struct spdk_pci_driver { + struct rte_pci_driver driver; + + const char *name; + const struct spdk_pci_id *id_table; + uint32_t drv_flags; + + spdk_pci_enum_cb cb_fn; + void *cb_arg; + TAILQ_ENTRY(spdk_pci_driver) tailq; +}; + +int pci_device_init(struct rte_pci_driver *driver, struct rte_pci_device *device); +int pci_device_fini(struct rte_pci_device *device); + struct env_devargs { struct rte_bus *bus; char name[128];