The lcore ID verification in power QoS API used to use
rte_lcore_is_enabled(), which only accepts the lcore with
ROLE_RTE role. But service core thread (ROLE_SERVICE) can
also use power QoS API.

So use RTE_POWER_VALID_LCOREID_OR_ERR_RET to verify the
lcore ID. This change makes the power QoS API accept both
ROLE_RTE and ROLE_SERVICE lcores.

Signed-off-by: Huisong Li <[email protected]>
---
 doc/guides/rel_notes/release_26_07.rst |  5 ++++-
 lib/power/rte_power_qos.c              | 10 ++--------
 2 files changed, 6 insertions(+), 9 deletions(-)

diff --git a/doc/guides/rel_notes/release_26_07.rst 
b/doc/guides/rel_notes/release_26_07.rst
index aeabb908ec..5eb3974ddb 100644
--- a/doc/guides/rel_notes/release_26_07.rst
+++ b/doc/guides/rel_notes/release_26_07.rst
@@ -158,7 +158,10 @@ New Features
 * **Added a common macro to verify lcore ID in power core.**
 
   Added the ``RTE_POWER_VALID_LCOREID_OR_ERR_RET`` macro to verify lcore ID
-  in power core.
+  in power core. The power QoS library also updated its lcore validation to
+  use this macro, so service cores (``ROLE_SERVICE``) are now permitted.
+
+
 
 Removed Items
 -------------
diff --git a/lib/power/rte_power_qos.c b/lib/power/rte_power_qos.c
index f991230532..d8d8d36a76 100644
--- a/lib/power/rte_power_qos.c
+++ b/lib/power/rte_power_qos.c
@@ -27,10 +27,7 @@ rte_power_qos_set_cpu_resume_latency(uint16_t lcore_id, int 
latency)
        FILE *f;
        int ret;
 
-       if (!rte_lcore_is_enabled(lcore_id)) {
-               POWER_LOG(ERR, "lcore id %u is not enabled", lcore_id);
-               return -EINVAL;
-       }
+       RTE_POWER_VALID_LCOREID_OR_ERR_RET(lcore_id, -EINVAL);
        ret = power_get_lcore_mapped_cpu_id(lcore_id, &cpu_id);
        if (ret != 0)
                return ret;
@@ -82,10 +79,7 @@ rte_power_qos_get_cpu_resume_latency(uint16_t lcore_id)
        FILE *f;
        int ret;
 
-       if (!rte_lcore_is_enabled(lcore_id)) {
-               POWER_LOG(ERR, "lcore id %u is not enabled", lcore_id);
-               return -EINVAL;
-       }
+       RTE_POWER_VALID_LCOREID_OR_ERR_RET(lcore_id, -EINVAL);
        ret = power_get_lcore_mapped_cpu_id(lcore_id, &cpu_id);
        if (ret != 0)
                return ret;
-- 
2.33.0

Reply via email to