+ ret = check_cur_freq(TEST_POWER_LCORE_ID, total_freq_num - 1, false);
+ if (ret < 0)
+ return -1;
+
+ return 0;
+}
+
+/* Check rte_power_turbo() */
+static int
+check_power_turbo(void)
+{
+ int ret;
+
+ if (rte_power_turbo_status(TEST_POWER_LCORE_ID) == 0) {
+ printf("Turbo not available on lcore %u, skipping test\n",
+ TEST_POWER_LCORE_ID);
+ return 0;
+ }
+
+ /* test with an invalid lcore id */
+ ret = rte_power_freq_enable_turbo(TEST_POWER_LCORE_INVALID);
+ if (ret >= 0) {
+ printf("Unexpectedly enable turbo successfully on lcore %u\n",
+ TEST_POWER_LCORE_INVALID);
+ return -1;
+ }
+ ret = rte_power_freq_enable_turbo(TEST_POWER_LCORE_ID);
+ if (ret < 0) {
+ printf("Fail to enable turbo on lcore %u\n",
+ TEST_POWER_LCORE_ID);
+ return -1;
+ }
+ ret = rte_power_freq_max(TEST_POWER_LCORE_ID);
+ if (ret < 0) {
+ printf("Fail to scale up the freq to max on lcore %u\n",
+ TEST_POWER_LCORE_ID);
+ return -1;
+ }
+
+ /* Check the current frequency */
+ ret = check_cur_freq(TEST_POWER_LCORE_ID, 0, true);
+ if (ret < 0)
+ return -1;
+
+ /* test with an invalid lcore id */
+ ret = rte_power_freq_disable_turbo(TEST_POWER_LCORE_INVALID);
+ if (ret >= 0) {
+ printf("Unexpectedly disable turbo successfully on lcore %u\n",
+ TEST_POWER_LCORE_INVALID);
+ return -1;
+ }
+ ret = rte_power_freq_disable_turbo(TEST_POWER_LCORE_ID);
+ if (ret < 0) {
+ printf("Fail to disable turbo on lcore %u\n",
+ TEST_POWER_LCORE_ID);
+ return -1;
+ }
+ ret = rte_power_freq_max(TEST_POWER_LCORE_ID);
+ if (ret < 0) {
+ printf("Fail to scale up the freq to max on lcore %u\n",
+ TEST_POWER_LCORE_ID);
+ return -1;
+ }
+
+ /* Check the current frequency */
+ ret = check_cur_freq(TEST_POWER_LCORE_ID, 1, false);