From ac9895f768361188426d367b388bd5d20716a08f Mon Sep 17 00:00:00 2001 From: Darek Stojaczyk Date: Sat, 1 Dec 2018 17:49:52 +0100 Subject: [PATCH] env: move struct spdk_pci_device to public headers In order to populate our PCI device list with devices located behind the VMD, we'll need to fill out those device structures from within a special VMD driver. That driver will base on PCI configuration and BAR accesses, but definitely not on DPDK. We want to put the VMD driver outside of the env lib, so we provide it with a direct access to the device struct. Change-Id: Iabddf361a805e69d7e857c2d07ceaed36aca261d Signed-off-by: Darek Stojaczyk Reviewed-on: https://review.gerrithub.io/435800 Tested-by: SPDK CI Jenkins Chandler-Test-Pool: SPDK Automated Test System Reviewed-by: Jim Harris Reviewed-by: Shuhei Matsumoto --- include/spdk/env.h | 16 ++++++++++++++-- lib/env_dpdk/env_internal.h | 13 ------------- 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/include/spdk/env.h b/include/spdk/env.h index 4aff78d8a..0ca449fe9 100644 --- a/include/spdk/env.h +++ b/include/spdk/env.h @@ -40,6 +40,7 @@ #define SPDK_ENV_H #include "spdk/stdinc.h" +#include "spdk/queue.h" #ifdef __cplusplus extern "C" { @@ -66,8 +67,6 @@ extern "C" { */ #define SPDK_MEMZONE_NO_IOVA_CONTIG 0x00100000 /**< no iova contiguity */ -struct spdk_pci_device; - /** * \brief Environment initialization options */ @@ -595,6 +594,19 @@ struct spdk_pci_id { uint16_t subdevice_id; }; +struct spdk_pci_device { + void *dev_handle; + struct spdk_pci_addr addr; + struct spdk_pci_id id; + int socket_id; + + struct _spdk_pci_device_internal { + struct spdk_pci_driver *driver; + bool attached; + TAILQ_ENTRY(spdk_pci_device) tailq; + } internal; +}; + typedef int (*spdk_pci_enum_cb)(void *enum_ctx, struct spdk_pci_device *pci_dev); /** diff --git a/lib/env_dpdk/env_internal.h b/lib/env_dpdk/env_internal.h index 2febefaaf..484ddbd0d 100644 --- a/lib/env_dpdk/env_internal.h +++ b/lib/env_dpdk/env_internal.h @@ -78,19 +78,6 @@ __attribute__((constructor)) static void pci_drv ## _register(void) \ spdk_pci_driver_register(&pci_drv); \ } -struct spdk_pci_device { - void *dev_handle; - struct spdk_pci_addr addr; - struct spdk_pci_id id; - int socket_id; - - struct _spdk_pci_device_internal { - struct spdk_pci_driver *driver; - bool attached; - TAILQ_ENTRY(spdk_pci_device) tailq; - } internal; -}; - struct spdk_pci_driver { struct rte_pci_driver driver; spdk_pci_enum_cb cb_fn;