1 /* SPDX-License-Identifier: BSD-3-Clause 2 * Copyright(c) 2024 HiSilicon Limited 3 */ 4 5 #ifndef RTE_POWER_QOS_H 6 #define RTE_POWER_QOS_H 7 8 #include <stdint.h> 9 10 #include <rte_compat.h> 11 12 #ifdef __cplusplus 13 extern "C" { 14 #endif 15 16 /** 17 * @file rte_power_qos.h 18 * 19 * PM QoS API. 20 * 21 * The CPU-wide resume latency limit has a positive impact on this CPU's idle 22 * state selection in each cpuidle governor. 23 * Please see the PM QoS on CPU wide in the following link: 24 * https://www.kernel.org/doc/html/latest/admin-guide/abi-testing.html?highlight=pm_qos_resume_latency_us#abi-sys-devices-power-pm-qos-resume-latency-us 25 * 26 * The deeper the idle state, the lower the power consumption, but the 27 * longer the resume time. Some service are delay sensitive and very except the 28 * low resume time, like interrupt packet receiving mode. 29 * 30 * In these case, per-CPU PM QoS API can be used to control this CPU's idle 31 * state selection and limit just enter the shallowest idle state to low the 32 * delay after sleep by setting strict resume latency (zero value). 33 */ 34 35 #define RTE_POWER_QOS_STRICT_LATENCY_VALUE 0 36 #define RTE_POWER_QOS_RESUME_LATENCY_NO_CONSTRAINT INT32_MAX 37 38 /** 39 * @warning 40 * @b EXPERIMENTAL: this API may change without prior notice. 41 * 42 * @param lcore_id 43 * target logical core id 44 * 45 * @param latency 46 * The latency should be greater than and equal to zero in microseconds unit. 47 * 48 * @return 49 * 0 on success. Otherwise negative value is returned. 50 */ 51 __rte_experimental 52 int rte_power_qos_set_cpu_resume_latency(uint16_t lcore_id, int latency); 53 54 /** 55 * @warning 56 * @b EXPERIMENTAL: this API may change without prior notice. 57 * 58 * Get the current resume latency of this logical core. 59 * The default value in kernel is @see RTE_POWER_QOS_RESUME_LATENCY_NO_CONSTRAINT 60 * if don't set it. 61 * 62 * @return 63 * Negative value on failure. 64 * >= 0 means the actual resume latency limit on this core. 65 */ 66 __rte_experimental 67 int rte_power_qos_get_cpu_resume_latency(uint16_t lcore_id); 68 69 #ifdef __cplusplus 70 } 71 #endif 72 73 #endif /* RTE_POWER_QOS_H */ 74