PCI drivers could use this helper instead of directly accessing fields of
rte_eth_dev to map to rte_pci_device.

Signed-off-by: Jan Blunck <jblu...@infradead.org>
Acked-by: Shreyansh Jain <shreyansh.j...@nxp.com>
---
 lib/librte_ether/rte_ethdev.h | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
index 9678179..d6e367c 100644
--- a/lib/librte_ether/rte_ethdev.h
+++ b/lib/librte_ether/rte_ethdev.h
@@ -1644,6 +1644,16 @@ struct rte_eth_dev {
        uint8_t attached; /**< Flag indicating the port is attached */
 } __rte_cache_aligned;
 
+/**
+ * @internal
+ * Helper for drivers that need to convert from rte_eth_dev to rte_pci_device.
+ */
+static inline struct rte_pci_device *__attribute__((always_inline))
+rte_eth_dev_to_pci(struct rte_eth_dev *eth_dev)
+{
+       return eth_dev->pci_dev;
+}
+
 struct rte_eth_dev_sriov {
        uint8_t active;               /**< SRIOV is active with 16, 32 or 64 
pools */
        uint8_t nb_q_per_pool;        /**< rx queue number per pool */
-- 
2.7.4

Reply via email to