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 this patch replaces rte_lcore_is_enabled() with the new
helper rte_lcore_is_eal_managed() by using the common macro
RTE_POWER_VALID_LCOREID_OR_ERR_RET. 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 |  6 ++++++
 lib/power/rte_power_qos.c              | 10 ++--------
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/doc/guides/rel_notes/release_26_07.rst 
b/doc/guides/rel_notes/release_26_07.rst
index 98a7cf0203..0eca0261b3 100644
--- a/doc/guides/rel_notes/release_26_07.rst
+++ b/doc/guides/rel_notes/release_26_07.rst
@@ -76,6 +76,12 @@ New Features
   that the lcore ID is EAL-managed (``ROLE_RTE`` or ``ROLE_SERVICE``)
   before proceeding, replacing per-driver range checks.
 
+  The power QoS library also updated its lcore validation to use the
+  new helper, so service cores (``ROLE_SERVICE``) are now permitted
+  to configure power QoS parameters via 
``rte_power_qos_set_cpu_resume_latency()``
+  and ``rte_power_qos_get_cpu_resume_latency()``, in addition to
+  regular DPDK lcores (``ROLE_RTE``).
+
 
 Removed Items
 -------------
diff --git a/lib/power/rte_power_qos.c b/lib/power/rte_power_qos.c
index be230d1c50..f6630b08f7 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