[dpdk-dev,v2,7/8] eal: add virtual device name helper function

Message ID 1487600262-14382-8-git-send-email-jblunck@infradead.org (mailing list archive)
State Superseded, archived
Headers

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Jan Blunck Feb. 20, 2017, 2:17 p.m. UTC
  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 <jblunck@infradead.org>
---
 lib/librte_eal/bsdapp/eal/rte_eal_version.map | 6 ++++++
 lib/librte_eal/common/eal_common_vdev.c       | 6 ++++++
 lib/librte_eal/common/include/rte_vdev.h      | 2 ++
 3 files changed, 14 insertions(+)
  

Comments

Ferruh Yigit Feb. 21, 2017, 12:25 p.m. UTC | #1
On 2/20/2017 2:17 PM, Jan Blunck wrote:
> 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 <jblunck@infradead.org>

<...>

> +const char *
> +rte_vdev_device_name(const struct rte_vdev_device *dev)
> +{
> +	return dev->device.devargs->virt.drv_name;
> +}

Can this function be static?
  

Patch

diff --git a/lib/librte_eal/bsdapp/eal/rte_eal_version.map b/lib/librte_eal/bsdapp/eal/rte_eal_version.map
index 0116085..4afa1c5 100644
--- a/lib/librte_eal/bsdapp/eal/rte_eal_version.map
+++ b/lib/librte_eal/bsdapp/eal/rte_eal_version.map
@@ -184,3 +184,9 @@  DPDK_17.02 {
 	rte_bus_unregister;
 
 } DPDK_16.11;
+
+DPDK_17.05 {
+	global:
+
+	rte_vdev_device_name;
+} DPDK_17.02;
diff --git a/lib/librte_eal/common/eal_common_vdev.c b/lib/librte_eal/common/eal_common_vdev.c
index 61677de..a9798d0 100644
--- a/lib/librte_eal/common/eal_common_vdev.c
+++ b/lib/librte_eal/common/eal_common_vdev.c
@@ -66,6 +66,12 @@  rte_eal_vdrv_unregister(struct rte_vdev_driver *driver)
 	TAILQ_REMOVE(&vdev_driver_list, driver, next);
 }
 
+const char *
+rte_vdev_device_name(const struct rte_vdev_device *dev)
+{
+	return dev->device.devargs->virt.drv_name;
+}
+
 static int
 vdev_probe_all_drivers(const char *name, const char *args)
 {
diff --git a/lib/librte_eal/common/include/rte_vdev.h b/lib/librte_eal/common/include/rte_vdev.h
index 8f98372..ffa48bd 100644
--- a/lib/librte_eal/common/include/rte_vdev.h
+++ b/lib/librte_eal/common/include/rte_vdev.h
@@ -45,6 +45,8 @@  struct rte_vdev_device {
 	struct rte_device device;               /**< Inherit core device */
 };
 
+const char *rte_vdev_device_name(const struct rte_vdev_device *dev);
+
 /** Double linked list of virtual device drivers. */
 TAILQ_HEAD(vdev_driver_list, rte_vdev_driver);