From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from wes1-so1.wedos.net (wes1-so1.wedos.net [46.28.106.15]) by dpdk.org (Postfix) with ESMTP id 9B18A8D96 for ; Mon, 18 Jan 2016 17:05:13 +0100 (CET) Received: from pcviktorin.fit.vutbr.cz (pcviktorin.fit.vutbr.cz [147.229.13.147]) by wes1-so1.wedos.net (Postfix) with ESMTPSA id 3pkdHY1HJYz5Gg; Mon, 18 Jan 2016 17:05:13 +0100 (CET) From: Jan Viktorin To: dev@dpdk.org Date: Mon, 18 Jan 2016 17:03:02 +0100 Message-Id: <1453132987-20564-2-git-send-email-viktorin@rehivetech.com> X-Mailer: git-send-email 2.7.0 In-Reply-To: <1453132987-20564-1-git-send-email-viktorin@rehivetech.com> References: <1453132987-20564-1-git-send-email-viktorin@rehivetech.com> Cc: Jan Viktorin Subject: [dpdk-dev] [RFC 1/6] eal: introduce rte_bus_device and rte_bus_driver X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Jan 2016 16:05:13 -0000 Define a general represenation of a device and driver in DPDK. The goal is to get rid of the deep dependency on the PCI. Higher level code should not reference the bus-specific structures as it does not need to. PCI infrastructure embeds those structures. Other infrastructures will do the same. Suggested-by: David Marchand Signed-off-by: Jan Viktorin --- lib/librte_eal/common/include/rte_dev.h | 9 +++++++++ lib/librte_eal/common/include/rte_pci.h | 3 +++ 2 files changed, 12 insertions(+) diff --git a/lib/librte_eal/common/include/rte_dev.h b/lib/librte_eal/common/include/rte_dev.h index f1b5507..b779705 100644 --- a/lib/librte_eal/common/include/rte_dev.h +++ b/lib/librte_eal/common/include/rte_dev.h @@ -50,6 +50,7 @@ extern "C" { #include #include +#include __attribute__((format(printf, 2, 0))) static inline void @@ -151,6 +152,14 @@ void rte_eal_driver_register(struct rte_driver *driver); */ void rte_eal_driver_unregister(struct rte_driver *driver); +struct rte_bus_driver { + const char *name; +}; + +struct rte_bus_device { + const char *name; +}; + /** * Initalize all the registered drivers in this process */ diff --git a/lib/librte_eal/common/include/rte_pci.h b/lib/librte_eal/common/include/rte_pci.h index 334c12e..10a2306 100644 --- a/lib/librte_eal/common/include/rte_pci.h +++ b/lib/librte_eal/common/include/rte_pci.h @@ -83,6 +83,7 @@ extern "C" { #include #include +#include TAILQ_HEAD(pci_device_list, rte_pci_device); /**< PCI devices in D-linked Q. */ TAILQ_HEAD(pci_driver_list, rte_pci_driver); /**< PCI drivers in D-linked Q. */ @@ -166,6 +167,7 @@ struct rte_pci_device { int numa_node; /**< NUMA node connection */ struct rte_devargs *devargs; /**< Device user arguments */ enum rte_kernel_driver kdrv; /**< Kernel driver passthrough */ + struct rte_bus_device dev; /**< Generic device */ }; /** Any PCI device identifier (vendor, device, ...) */ @@ -209,6 +211,7 @@ struct rte_pci_driver { pci_devuninit_t *devuninit; /**< Device uninit function. */ const struct rte_pci_id *id_table; /**< ID table, NULL terminated. */ uint32_t drv_flags; /**< Flags contolling handling of device. */ + struct rte_bus_driver drv; /**< Generic driver */ }; /** Device needs PCI BAR mapping (done with either IGB_UIO or VFIO) */ -- 2.7.0