[RFC,v3,26/26] dev: hide device object

Message ID 20220728152640.547725-27-david.marchand@redhat.com (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers
Series Bus and device cleanup for 22.11 |

Checks

Context Check Description
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS

Commit Message

David Marchand July 28, 2022, 3:26 p.m. UTC
  Make rte_device opaque for non internal users.
This will make extending this object possible without breaking the ABI.

Some applications may have been dereferencing rte_device objects, mark
this object's accessors as stable.

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
Changes since RFC v2:
- updated release notes,
- marked accessors as stable,

---
 doc/guides/rel_notes/deprecation.rst   |  7 -----
 doc/guides/rel_notes/release_22_11.rst |  4 +--
 lib/eal/common/eal_private.h           |  2 +-
 lib/eal/include/dev_driver.h           | 13 +++++++++
 lib/eal/include/rte_dev.h              | 37 --------------------------
 lib/eal/version.map                    | 14 +++++-----
 lib/vhost/vdpa.c                       |  1 +
 7 files changed, 23 insertions(+), 55 deletions(-)
  

Comments

Bruce Richardson July 28, 2022, 5:04 p.m. UTC | #1
On Thu, Jul 28, 2022 at 05:26:40PM +0200, David Marchand wrote:
> Make rte_device opaque for non internal users.
> This will make extending this object possible without breaking the ABI.
> 
> Some applications may have been dereferencing rte_device objects, mark
> this object's accessors as stable.
> 
> Signed-off-by: David Marchand <david.marchand@redhat.com>
> ---
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
  

Patch

diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst
index 3512f01539..429ef298c5 100644
--- a/doc/guides/rel_notes/deprecation.rst
+++ b/doc/guides/rel_notes/deprecation.rst
@@ -43,13 +43,6 @@  Deprecation Notices
 * mempool: The mempool API macros ``MEMPOOL_PG_*`` are deprecated and
   will be removed in DPDK 22.11.
 
-* drivers: As a follow-up of the work on the ``rte_bus`` object,
-  the ``rte_driver`` and ``rte_device`` objects (and as a domino effect,
-  their bus-specific counterparts) will be made opaque in DPDK 22.11.
-  Registering a driver on a bus will be marked as an internal API:
-  external users may still register their drivers using the bus-specific
-  driver header (see ``enable_driver_sdk`` meson option).
-
 * bus: The ``dev->device.numa_node`` field is set by each bus driver for
   every device it manages to indicate on which NUMA node this device lies.
   When this information is unknown, the assigned value is not consistent
diff --git a/doc/guides/rel_notes/release_22_11.rst b/doc/guides/rel_notes/release_22_11.rst
index ff1a2d6543..cff2667f39 100644
--- a/doc/guides/rel_notes/release_22_11.rst
+++ b/doc/guides/rel_notes/release_22_11.rst
@@ -94,8 +94,8 @@  API Changes
   ``vdev``, ``vmbus`` buses has been marked as an internal API.
   External users may still register their driver using the associated driver
   headers (see ``enable_driver_sdk`` meson option).
-  The ``rte_driver`` object is now opaque and must be manipulated through added
-  accessors.
+  The ``rte_driver`` and ``rte_device`` objects are now opaque and must be
+  manipulated through added accessors.
 
 * raw/ifgpa: The function ``rte_pmd_ifpga_get_pci_bus`` has been removed.
 
diff --git a/lib/eal/common/eal_private.h b/lib/eal/common/eal_private.h
index 44d14241f0..3ca9ce2ffc 100644
--- a/lib/eal/common/eal_private.h
+++ b/lib/eal/common/eal_private.h
@@ -10,7 +10,7 @@ 
 #include <stdio.h>
 #include <sys/queue.h>
 
-#include <rte_dev.h>
+#include <dev_driver.h>
 #include <rte_lcore.h>
 #include <rte_memory.h>
 
diff --git a/lib/eal/include/dev_driver.h b/lib/eal/include/dev_driver.h
index 015188abd5..5efa8c437e 100644
--- a/lib/eal/include/dev_driver.h
+++ b/lib/eal/include/dev_driver.h
@@ -21,6 +21,19 @@  struct rte_driver {
 	const char *alias;              /**< Driver alias. */
 };
 
+/**
+ * A structure describing a generic device.
+ */
+struct rte_device {
+	RTE_TAILQ_ENTRY(rte_device) next; /**< Next device */
+	const char *name;             /**< Device name */
+	const char *bus_info;         /**< Device bus specific information */
+	const struct rte_driver *driver; /**< Driver assigned after probing */
+	const struct rte_bus *bus;    /**< Bus handle assigned on scan */
+	int numa_node;                /**< NUMA node connection */
+	struct rte_devargs *devargs;  /**< Arguments for latest probing */
+};
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/lib/eal/include/rte_dev.h b/lib/eal/include/rte_dev.h
index be8bbe79ee..b58cbd2236 100644
--- a/lib/eal/include/rte_dev.h
+++ b/lib/eal/include/rte_dev.h
@@ -72,90 +72,66 @@  rte_driver_name(const struct rte_driver *driver);
 /**
  * Retrieve a device bus.
  *
- * @warning
- * @b EXPERIMENTAL: this API may change without prior notice
- *
  * @param dev
  *   A pointer to a device structure.
  * @return
  *   A pointer to this device bus.
  */
-__rte_experimental
 const struct rte_bus *
 rte_dev_bus(const struct rte_device *dev);
 
 /**
  * Retrieve bus specific information for a device.
  *
- * @warning
- * @b EXPERIMENTAL: this API may change without prior notice
- *
  * @param dev
  *   A pointer to a device structure.
  * @return
  *   A string describing this device or NULL if none is available.
  */
-__rte_experimental
 const char *
 rte_dev_bus_info(const struct rte_device *dev);
 
 /**
  * Retrieve a device arguments.
  *
- * @warning
- * @b EXPERIMENTAL: this API may change without prior notice
- *
  * @param dev
  *   A pointer to a device structure.
  * @return
  *   A pointer to this device devargs.
  */
-__rte_experimental
 const struct rte_devargs *
 rte_dev_devargs(const struct rte_device *dev);
 
 /**
  * Retrieve a device driver.
  *
- * @warning
- * @b EXPERIMENTAL: this API may change without prior notice
- *
  * @param dev
  *   A pointer to a device structure.
  * @return
  *   A pointer to this device driver.
  */
-__rte_experimental
 const struct rte_driver *
 rte_dev_driver(const struct rte_device *dev);
 
 /**
  * Retrieve a device name.
  *
- * @warning
- * @b EXPERIMENTAL: this API may change without prior notice
- *
  * @param dev
  *   A pointer to a device structure.
  * @return
  *   A pointer to this device name.
  */
-__rte_experimental
 const char *
 rte_dev_name(const struct rte_device *dev);
 
 /**
  * Retrieve a device numa node.
  *
- * @warning
- * @b EXPERIMENTAL: this API may change without prior notice
- *
  * @param dev
  *   A pointer to a device structure.
  * @return
  *   A pointer to this device numa node.
  */
-__rte_experimental
 int
 rte_dev_numa_node(const struct rte_device *dev);
 
@@ -165,19 +141,6 @@  rte_dev_numa_node(const struct rte_device *dev);
  */
 #define RTE_DEV_NAME_MAX_LEN 64
 
-/**
- * A structure describing a generic device.
- */
-struct rte_device {
-	RTE_TAILQ_ENTRY(rte_device) next; /**< Next device */
-	const char *name;             /**< Device name */
-	const char *bus_info;         /**< Device bus specific information */
-	const struct rte_driver *driver; /**< Driver assigned after probing */
-	const struct rte_bus *bus;    /**< Bus handle assigned on scan */
-	int numa_node;                /**< NUMA node connection */
-	struct rte_devargs *devargs;  /**< Arguments for latest probing */
-};
-
 /**
  * Query status of a device.
  *
diff --git a/lib/eal/version.map b/lib/eal/version.map
index 0cf321605e..3c14cf2724 100644
--- a/lib/eal/version.map
+++ b/lib/eal/version.map
@@ -26,7 +26,13 @@  DPDK_23 {
 	rte_delay_us_block;
 	rte_delay_us_callback_register;
 	rte_delay_us_sleep;
+	rte_dev_bus;
+	rte_dev_bus_info;
+	rte_dev_devargs;
+	rte_dev_driver;
 	rte_dev_is_probed;
+	rte_dev_name;
+	rte_dev_numa_node;
 	rte_dev_probe;
 	rte_dev_remove;
 	rte_devargs_add;
@@ -424,14 +430,6 @@  EXPERIMENTAL {
 	rte_thread_self;
 	rte_thread_set_affinity_by_id;
 	rte_thread_set_priority;
-
-	# added in 22.11
-	rte_dev_bus;
-	rte_dev_bus_info;
-	rte_dev_devargs;
-	rte_dev_driver;
-	rte_dev_name;
-	rte_dev_numa_node;
 };
 
 INTERNAL {
diff --git a/lib/vhost/vdpa.c b/lib/vhost/vdpa.c
index bdebcbe565..aaf3f267e9 100644
--- a/lib/vhost/vdpa.c
+++ b/lib/vhost/vdpa.c
@@ -10,6 +10,7 @@ 
 
 #include <sys/queue.h>
 
+#include <dev_driver.h>
 #include <rte_common.h>
 #include <rte_class.h>
 #include <rte_malloc.h>