[PATCH v6 9/9] power: separate public and driver headers

David Marchand david.marchand at redhat.com
Tue Sep 30 08:57:39 CEST 2025


power_cpufreq.h, power_common.h and power_uncore_ops.h look like driver
only headers, but were included from public headers.
Move them to the driver_sdk_headers list.

There is one complication though for power_cpufreq.h as it was included
from a public header rte_power_cpufreq.h.
Move the rte_power_core_capabilities struct definition to the public
header, since a (stable) public symbol relies on it.

Signed-off-by: David Marchand <david.marchand at redhat.com>
Acked-by: Bruce Richardson <bruce.richardson at intel.com>
---
 lib/power/meson.build         |  7 +++++--
 lib/power/power_cpufreq.h     | 14 +-------------
 lib/power/power_uncore_ops.h  |  1 +
 lib/power/rte_power_cpufreq.c |  2 +-
 lib/power/rte_power_cpufreq.h | 15 +++++++++++++--
 lib/power/rte_power_uncore.c  |  2 +-
 lib/power/rte_power_uncore.h  |  3 ++-
 7 files changed, 24 insertions(+), 20 deletions(-)

diff --git a/lib/power/meson.build b/lib/power/meson.build
index 56b59071ea..d89fb55514 100644
--- a/lib/power/meson.build
+++ b/lib/power/meson.build
@@ -22,12 +22,15 @@ sources = files(
         'rte_power_uncore.c',
 )
 headers = files(
-        'power_cpufreq.h',
-        'power_uncore_ops.h',
         'rte_power_cpufreq.h',
         'rte_power_pmd_mgmt.h',
         'rte_power_qos.h',
         'rte_power_uncore.h',
 )
+driver_sdk_headers = files(
+        'power_common.h',
+        'power_cpufreq.h',
+        'power_uncore_ops.h',
+)
 
 deps += ['timer', 'ethdev']
diff --git a/lib/power/power_cpufreq.h b/lib/power/power_cpufreq.h
index 92f1ab8f37..fb0b7feb82 100644
--- a/lib/power/power_cpufreq.h
+++ b/lib/power/power_cpufreq.h
@@ -14,6 +14,7 @@
 #include <rte_common.h>
 #include <rte_log.h>
 #include <rte_compat.h>
+#include <rte_power_cpufreq.h>
 
 #define RTE_POWER_DRIVER_NAMESZ 24
 
@@ -131,19 +132,6 @@ typedef int (*rte_power_freq_change_t)(unsigned int lcore_id);
  *  - Negative on error.
  */
 
-/**
- * Power capabilities summary.
- */
-struct rte_power_core_capabilities {
-	union {
-		uint64_t capabilities;
-		struct {
-			uint64_t turbo:1;       /**< Turbo can be enabled. */
-			uint64_t priority:1;    /**< SST-BF high freq core */
-		};
-	};
-};
-
 typedef int (*rte_power_get_capabilities_t)(unsigned int lcore_id,
 			struct rte_power_core_capabilities *caps);
 
diff --git a/lib/power/power_uncore_ops.h b/lib/power/power_uncore_ops.h
index b92af28df9..783860ee5b 100644
--- a/lib/power/power_uncore_ops.h
+++ b/lib/power/power_uncore_ops.h
@@ -13,6 +13,7 @@
 
 #include <rte_compat.h>
 #include <rte_common.h>
+#include <rte_power_uncore.h>
 
 #define RTE_POWER_UNCORE_DRIVER_NAMESZ 24
 
diff --git a/lib/power/rte_power_cpufreq.c b/lib/power/rte_power_cpufreq.c
index d4db03a4e5..f63e976dc2 100644
--- a/lib/power/rte_power_cpufreq.c
+++ b/lib/power/rte_power_cpufreq.c
@@ -6,8 +6,8 @@
 #include <rte_spinlock.h>
 #include <rte_debug.h>
 
-#include "rte_power_cpufreq.h"
 #include "power_common.h"
+#include "power_cpufreq.h"
 
 static enum power_management_env global_default_env = PM_ENV_NOT_SET;
 static struct rte_power_cpufreq_ops *global_cpufreq_ops;
diff --git a/lib/power/rte_power_cpufreq.h b/lib/power/rte_power_cpufreq.h
index 82d274214b..1605ba866a 100644
--- a/lib/power/rte_power_cpufreq.h
+++ b/lib/power/rte_power_cpufreq.h
@@ -14,8 +14,6 @@
 #include <rte_common.h>
 #include <rte_log.h>
 
-#include "power_cpufreq.h"
-
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -248,6 +246,19 @@ int rte_power_freq_enable_turbo(unsigned int lcore_id);
  */
 int rte_power_freq_disable_turbo(unsigned int lcore_id);
 
+/**
+ * Power capabilities summary.
+ */
+struct rte_power_core_capabilities {
+	union {
+		uint64_t capabilities;
+		struct {
+			uint64_t turbo:1;       /**< Turbo can be enabled. */
+			uint64_t priority:1;    /**< SST-BF high freq core */
+		};
+	};
+};
+
 /**
  * Returns power capabilities for a specific lcore.
  * Function pointer definition. Review each environments
diff --git a/lib/power/rte_power_uncore.c b/lib/power/rte_power_uncore.c
index 30cd374127..25bdb113c5 100644
--- a/lib/power/rte_power_uncore.c
+++ b/lib/power/rte_power_uncore.c
@@ -7,8 +7,8 @@
 #include <rte_spinlock.h>
 #include <rte_debug.h>
 
-#include "rte_power_uncore.h"
 #include "power_common.h"
+#include "power_uncore_ops.h"
 
 static enum rte_uncore_power_mgmt_env global_uncore_env = RTE_UNCORE_PM_ENV_NOT_SET;
 static struct rte_power_uncore_ops *global_uncore_ops;
diff --git a/lib/power/rte_power_uncore.h b/lib/power/rte_power_uncore.h
index dfeade77e9..66aea1b37f 100644
--- a/lib/power/rte_power_uncore.h
+++ b/lib/power/rte_power_uncore.h
@@ -11,7 +11,8 @@
  * Uncore Frequency Management
  */
 
-#include "power_uncore_ops.h"
+#include <rte_compat.h>
+#include <rte_common.h>
 
 #ifdef __cplusplus
 extern "C" {
-- 
2.51.0



More information about the dev mailing list