1 /* SPDX-License-Identifier: BSD-3-Clause 2 * Copyright(c) 2020 Intel Corporation 3 */ 4 5 #ifndef _RTE_POWER_PMD_MGMT_H 6 #define _RTE_POWER_PMD_MGMT_H 7 8 /** 9 * @file 10 * RTE PMD Power Management 11 */ 12 13 #include <stdint.h> 14 #include <stdbool.h> 15 16 #include <rte_common.h> 17 #include <rte_byteorder.h> 18 #include <rte_log.h> 19 #include <rte_power.h> 20 #include <rte_atomic.h> 21 22 #ifdef __cplusplus 23 extern "C" { 24 #endif 25 26 /** 27 * PMD Power Management Type 28 */ 29 enum rte_power_pmd_mgmt_type { 30 /** Use power-optimized monitoring to wait for incoming traffic */ 31 RTE_POWER_MGMT_TYPE_MONITOR = 1, 32 /** Use power-optimized sleep to avoid busy polling */ 33 RTE_POWER_MGMT_TYPE_PAUSE, 34 /** Use frequency scaling when traffic is low */ 35 RTE_POWER_MGMT_TYPE_SCALE, 36 }; 37 38 /** 39 * @warning 40 * @b EXPERIMENTAL: this API may change, or be removed, without prior notice. 41 * 42 * Enable power management on a specified Ethernet device Rx queue and lcore. 43 * 44 * @note This function is not thread-safe. 45 * 46 * @param lcore_id 47 * The lcore the Rx queue will be polled from. 48 * @param port_id 49 * The port identifier of the Ethernet device. 50 * @param queue_id 51 * The queue identifier of the Ethernet device. 52 * @param mode 53 * The power management scheme to use for specified Rx queue. 54 * @return 55 * 0 on success 56 * <0 on error 57 */ 58 __rte_experimental 59 int 60 rte_power_ethdev_pmgmt_queue_enable(unsigned int lcore_id, 61 uint16_t port_id, uint16_t queue_id, 62 enum rte_power_pmd_mgmt_type mode); 63 64 /** 65 * @warning 66 * @b EXPERIMENTAL: this API may change, or be removed, without prior notice. 67 * 68 * Disable power management on a specified Ethernet device Rx queue and lcore. 69 * 70 * @note This function is not thread-safe. 71 * 72 * @param lcore_id 73 * The lcore the Rx queue is polled from. 74 * @param port_id 75 * The port identifier of the Ethernet device. 76 * @param queue_id 77 * The queue identifier of the Ethernet device. 78 * @return 79 * 0 on success 80 * <0 on error 81 */ 82 __rte_experimental 83 int 84 rte_power_ethdev_pmgmt_queue_disable(unsigned int lcore_id, 85 uint16_t port_id, uint16_t queue_id); 86 87 #ifdef __cplusplus 88 } 89 #endif 90 91 #endif 92