-
-uint32_t
-rte_power_get_freq(unsigned lcore_id)
-{
- if (lcore_id >= RTE_MAX_LCORE) {
- RTE_LOG(ERR, POWER, "Invalid lcore ID\n");
- return RTE_POWER_INVALID_FREQ_INDEX;
- }
-
- return lcore_power_info[lcore_id].curr_idx;
-}
-
-int
-rte_power_set_freq(unsigned lcore_id, uint32_t index)
-{
- if (lcore_id >= RTE_MAX_LCORE) {
- RTE_LOG(ERR, POWER, "Invalid lcore ID\n");
- return -1;
- }
-
- return set_freq_internal(&(lcore_power_info[lcore_id]), index);
-}
-
-int
-rte_power_freq_down(unsigned lcore_id)
-{
- struct rte_power_info *pi;
-
- if (lcore_id >= RTE_MAX_LCORE) {
- RTE_LOG(ERR, POWER, "Invalid lcore ID\n");
- return -1;
- }
-
- pi = &lcore_power_info[lcore_id];
- if (pi->curr_idx + 1 == pi->nb_freqs)
- return 0;
-
- /* Frequencies in the array are from high to low. */
- return set_freq_internal(pi, pi->curr_idx + 1);
-}
-
-int
-rte_power_freq_up(unsigned lcore_id)
-{
- struct rte_power_info *pi;
-
- if (lcore_id >= RTE_MAX_LCORE) {
- RTE_LOG(ERR, POWER, "Invalid lcore ID\n");
- return -1;
- }
-
- pi = &lcore_power_info[lcore_id];
- if (pi->curr_idx == 0)
- return 0;
-
- /* Frequencies in the array are from high to low. */
- return set_freq_internal(pi, pi->curr_idx - 1);
-}
-
-int
-rte_power_freq_max(unsigned lcore_id)
-{
- if (lcore_id >= RTE_MAX_LCORE) {
- RTE_LOG(ERR, POWER, "Invalid lcore ID\n");
- return -1;
- }
-
- /* Frequencies in the array are from high to low. */
- return set_freq_internal(&lcore_power_info[lcore_id], 0);
-}
-
-int
-rte_power_freq_min(unsigned lcore_id)
-{
- struct rte_power_info *pi;
-
- if (lcore_id >= RTE_MAX_LCORE) {
- RTE_LOG(ERR, POWER, "Invalid lcore ID\n");
- return -1;
- }
-
- pi = &lcore_power_info[lcore_id];
-
- /* Frequencies in the array are from high to low. */
- return set_freq_internal(pi, pi->nb_freqs - 1);
-}
-