On 19-Apr-22 12:25 PM, Kevin Laatz wrote:
Add new get/set API to allow the user or application to set the minimum
and maximum frequencies to use when scaling.
Previously, the frequency range was determined by the HW capabilities of
the CPU. With this new API, the user or application can constrain this
if required.

Signed-off-by: Kevin Laatz <kevin.la...@intel.com>
---

<snip>

+int
+rte_power_pmd_mgmt_set_scaling_freq_min(unsigned int lcore, unsigned int min)
+{
+       if (lcore >= RTE_MAX_LCORE) {
+               RTE_LOG(ERR, POWER, "Invalid lcore ID: %u\n", lcore);
+               rte_errno = EINVAL;
+               return -1;
+       }
+       scale_freq_min[lcore] = min;

Are there any constraints on the value ranges, or are we just going to accept any and all values? If the idea was to allow valid values plus some special "default" value, you can still restrict the range, but allow 0 as a special case?

+
+       return 0;
+}
+
+int
+rte_power_pmd_mgmt_set_scaling_freq_max(unsigned int lcore, unsigned int max)
+{
+       if (lcore >= RTE_MAX_LCORE) {
+               RTE_LOG(ERR, POWER, "Invalid lcore ID: %u\n", lcore);
+               rte_errno = EINVAL;
+               return -1;
+       }
+       scale_freq_max[lcore] = max;

Same as above. Also, do we want UINT32_MAX be the "special" value for the "max" case? What do you think of having "0" as "not set", but maybe set it internally to UINT32_MAX if you still want to keep using the RTE_MIN/MAX macros?

+
+       return 0;
+}
+
+int
+rte_power_pmd_mgmt_get_scaling_freq_min(unsigned int lcore)
+{

<snip>

diff --git a/lib/power/rte_power_pmd_mgmt.h b/lib/power/rte_power_pmd_mgmt.h
index 18a9c3abb5..74e3fa710b 100644
--- a/lib/power/rte_power_pmd_mgmt.h
+++ b/lib/power/rte_power_pmd_mgmt.h
@@ -148,6 +148,86 @@ __rte_experimental
  unsigned int
  rte_power_pmd_mgmt_get_pause_duration(void);
+/**
+ * @warning
+ * @b EXPERIMENTAL: this API may change, or be removed, without prior notice.
+ *
+ * Set the min frequency to be used for frequency scaling.
+ *
+ * @note Supported by: Pstate mode.
+ *
+ * @param lcore
+ *   The ID of the lcore to set the min frequency for.
+ * @param min
+ *   The value, in Hertz, to set the minimum frequency to.

Is it really in Hertz? As far as I can tell, it's in steps of 100MHz (BUS_FREQ).

--
Thanks,
Anatoly

Reply via email to