1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2020 Intel Corporation
5 #ifndef _RTE_POWER_PMD_MGMT_H
6 #define _RTE_POWER_PMD_MGMT_H
10 * RTE PMD Power Management
16 #include <rte_power.h>
23 * PMD Power Management Type
25 enum rte_power_pmd_mgmt_type {
26 /** Use power-optimized monitoring to wait for incoming traffic */
27 RTE_POWER_MGMT_TYPE_MONITOR = 1,
28 /** Use power-optimized sleep to avoid busy polling */
29 RTE_POWER_MGMT_TYPE_PAUSE,
30 /** Use frequency scaling when traffic is low */
31 RTE_POWER_MGMT_TYPE_SCALE,
36 * @b EXPERIMENTAL: this API may change, or be removed, without prior notice.
38 * Enable power management on a specified Ethernet device Rx queue and lcore.
40 * @note This function is not thread-safe.
42 * @warning This function must be called when all affected Ethernet queues are
43 * stopped and no Rx/Tx is in progress!
46 * The lcore the Rx queue will be polled from.
48 * The port identifier of the Ethernet device.
50 * The queue identifier of the Ethernet device.
52 * The power management scheme to use for specified Rx queue.
59 rte_power_ethdev_pmgmt_queue_enable(unsigned int lcore_id,
60 uint16_t port_id, uint16_t queue_id,
61 enum rte_power_pmd_mgmt_type mode);
65 * @b EXPERIMENTAL: this API may change, or be removed, without prior notice.
67 * Disable power management on a specified Ethernet device Rx queue and lcore.
69 * @note This function is not thread-safe.
71 * @warning This function must be called when all affected Ethernet queues are
72 * stopped and no Rx/Tx is in progress!
75 * The lcore the Rx queue is polled from.
77 * The port identifier of the Ethernet device.
79 * The queue identifier of the Ethernet device.
86 rte_power_ethdev_pmgmt_queue_disable(unsigned int lcore_id,
87 uint16_t port_id, uint16_t queue_id);
91 * @b EXPERIMENTAL: this API may change, or be removed, without prior notice.
93 * Set a emptypoll_max to specified value. Used to specify the number of empty
94 * polls to wait before entering sleep state.
97 * The value to set emptypoll_max to.
101 rte_power_pmd_mgmt_set_emptypoll_max(unsigned int max);
105 * @b EXPERIMENTAL: this API may change, or be removed, without prior notice.
107 * Get the current value of emptypoll_max.
110 * The current emptypoll_max value
114 rte_power_pmd_mgmt_get_emptypoll_max(void);
118 * @b EXPERIMENTAL: this API may change, or be removed, without prior notice.
120 * Set the pause_duration. Used to adjust the pause mode callback duration.
122 * @note Duration must be greater than zero.
125 * The value to set pause_duration to.
132 rte_power_pmd_mgmt_set_pause_duration(unsigned int duration);
136 * @b EXPERIMENTAL: this API may change, or be removed, without prior notice.
138 * Get the current value of pause_duration.
141 * The current pause_duration value.
145 rte_power_pmd_mgmt_get_pause_duration(void);
149 * @b EXPERIMENTAL: this API may change, or be removed, without prior notice.
151 * Set the min frequency to be used for frequency scaling or zero to use defaults.
153 * @note Supported by: Pstate mode.
156 * The ID of the lcore to set the min frequency for.
158 * The value, in KiloHertz, to set the minimum frequency to.
165 rte_power_pmd_mgmt_set_scaling_freq_min(unsigned int lcore, unsigned int min);
169 * @b EXPERIMENTAL: this API may change, or be removed, without prior notice.
171 * Set the max frequency to be used for frequency scaling or zero to use defaults.
173 * @note Supported by: Pstate mode.
176 * The ID of the lcore to set the max frequency for.
178 * The value, in KiloHertz, to set the maximum frequency to.
179 * If 'max' is 0, it is considered 'not set'.
186 rte_power_pmd_mgmt_set_scaling_freq_max(unsigned int lcore, unsigned int max);
190 * @b EXPERIMENTAL: this API may change, or be removed, without prior notice.
192 * Get the current configured min frequency used for frequency scaling.
194 * @note Supported by: Pstate mode.
197 * The ID of the lcore to get the min frequency for.
199 * 0 if no value has been configured via the 'set' API.
200 * >0 if a minimum frequency has been configured. Value is the minimum frequency
201 * , in KiloHertz, used for frequency scaling.
206 rte_power_pmd_mgmt_get_scaling_freq_min(unsigned int lcore);
210 * @b EXPERIMENTAL: this API may change, or be removed, without prior notice.
212 * Get the current configured max frequency used for frequency scaling.
214 * @note Supported by: Pstate mode.
217 * The ID of the lcore to get the max frequency for.
219 * 0 if no value has been configured via the 'set' API.
220 * >0 if a maximum frequency has been configured. Value is the maximum frequency
221 * , in KiloHertz, used for frequency scaling.
226 rte_power_pmd_mgmt_get_scaling_freq_max(unsigned int lcore);