[v6,27/27] dev: hide device object

Message ID 20220914075841.51555-28-david.marchand@redhat.com (mailing list archive)
State Accepted, archived
Delegated to: David Marchand
Headers
Series Bus and device cleanup for 22.11 |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation fail Compilation issues
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-aarch64-unit-testing success Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/intel-Testing success Testing PASS
ci/iol-x86_64-unit-testing success Testing PASS
ci/iol-x86_64-compile-testing success Testing PASS
ci/github-robot: build success github build: passed
ci/iol-aarch64-compile-testing success Testing PASS

Commit Message

David Marchand Sept. 14, 2022, 7:58 a.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>
Acked-by: Bruce Richardson <bruce.richardson@intel.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(-)
  

Patch

diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst
index 98a00da385..64668500c7 100644
--- a/doc/guides/rel_notes/deprecation.rst
+++ b/doc/guides/rel_notes/deprecation.rst
@@ -47,13 +47,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 4e20345b7a..43502349bd 100644
--- a/doc/guides/rel_notes/release_22_11.rst
+++ b/doc/guides/rel_notes/release_22_11.rst
@@ -98,8 +98,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 f010dd6441..dc1acc8953 100644
--- a/lib/eal/include/rte_dev.h
+++ b/lib/eal/include/rte_dev.h
@@ -86,90 +86,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);
 
@@ -179,19 +155,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 a6ca785b29..bb828577cb 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_class.h>
 #include <rte_malloc.h>
 #include <rte_spinlock.h>