From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jan Blunck Subject: [PATCH v3 07/10] eal: add virtual device name helper function Date: Sat, 25 Feb 2017 11:28:13 +0100 Message-ID: <1488018496-995-8-git-send-email-jblunck@infradead.org> References: <1488018496-995-1-git-send-email-jblunck@infradead.org> Cc: david.marchand@6wind.com, shreyansh.jain@nxp.com, ferruh.yigit@intel.com To: dev@dpdk.org Return-path: Received: from mail-wr0-f194.google.com (mail-wr0-f194.google.com [209.85.128.194]) by dpdk.org (Postfix) with ESMTP id 322FA5A3E for ; Sat, 25 Feb 2017 11:28:38 +0100 (CET) Received: by mail-wr0-f194.google.com with SMTP id 89so4905794wrr.1 for ; Sat, 25 Feb 2017 02:28:38 -0800 (PST) In-Reply-To: <1488018496-995-1-git-send-email-jblunck@infradead.org> In-Reply-To: <1487600262-14382-1-git-send-email-jblunck@infradead.org> References: <1487600262-14382-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" This adds the rte_vdev_device_name() helper function to retrieve the rte_vdev_device name which makes moving the name of the low-level device into struct rte_device easier in the future. Signed-off-by: Jan Blunck Acked-by: Shreyansh Jain --- lib/librte_eal/common/include/rte_vdev.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/librte_eal/common/include/rte_vdev.h b/lib/librte_eal/common/include/rte_vdev.h index 8f98372..abdefab 100644 --- a/lib/librte_eal/common/include/rte_vdev.h +++ b/lib/librte_eal/common/include/rte_vdev.h @@ -39,12 +39,21 @@ extern "C" { #include #include +#include struct rte_vdev_device { TAILQ_ENTRY(rte_vdev_device) next; /**< Next attached vdev */ struct rte_device device; /**< Inherit core device */ }; +static inline const char * +rte_vdev_device_name(const struct rte_vdev_device *dev) +{ + if (dev && dev->device.devargs) + return dev->device.devargs->virt.drv_name; + return NULL; +} + /** Double linked list of virtual device drivers. */ TAILQ_HEAD(vdev_driver_list, rte_vdev_driver); -- 2.7.4