From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jan Blunck Subject: [PATCH v4 18/23] ethdev: Helper to map to struct rte_pci_device Date: Wed, 21 Dec 2016 16:09:41 +0100 Message-ID: <1482332986-7599-19-git-send-email-jblunck@infradead.org> References: <1482332986-7599-1-git-send-email-jblunck@infradead.org> Cc: shreyansh.jain@nxp.com, david.marchand@6wind.com, stephen@networkplumber.org To: dev@dpdk.org Return-path: Received: from mail-wj0-f196.google.com (mail-wj0-f196.google.com [209.85.210.196]) by dpdk.org (Postfix) with ESMTP id 7796F10CB5 for ; Wed, 21 Dec 2016 16:10:27 +0100 (CET) Received: by mail-wj0-f196.google.com with SMTP id xy5so32460887wjc.1 for ; Wed, 21 Dec 2016 07:10:27 -0800 (PST) In-Reply-To: <1482332986-7599-1-git-send-email-jblunck@infradead.org> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 Acked-by: Shreyansh Jain --- 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