Check rte_power_turbo() */
| 431 | |
| 432 | /* Check rte_power_turbo() */ |
| 433 | static int |
| 434 | check_power_turbo(void) |
| 435 | { |
| 436 | int ret; |
| 437 | |
| 438 | if (rte_power_turbo_status(TEST_POWER_LCORE_ID) == 0) { |
| 439 | printf("Turbo not available on lcore %u, skipping test\n", |
| 440 | TEST_POWER_LCORE_ID); |
| 441 | return 0; |
| 442 | } |
| 443 | |
| 444 | /* test with an invalid lcore id */ |
| 445 | ret = rte_power_freq_enable_turbo(TEST_POWER_LCORE_INVALID); |
| 446 | if (ret >= 0) { |
| 447 | printf("Unexpectedly enable turbo successfully on lcore %u\n", |
| 448 | TEST_POWER_LCORE_INVALID); |
| 449 | return -1; |
| 450 | } |
| 451 | ret = rte_power_freq_enable_turbo(TEST_POWER_LCORE_ID); |
| 452 | if (ret < 0) { |
| 453 | printf("Fail to enable turbo on lcore %u\n", |
| 454 | TEST_POWER_LCORE_ID); |
| 455 | return -1; |
| 456 | } |
| 457 | ret = rte_power_freq_max(TEST_POWER_LCORE_ID); |
| 458 | if (ret < 0) { |
| 459 | printf("Fail to scale up the freq to max on lcore %u\n", |
| 460 | TEST_POWER_LCORE_ID); |
| 461 | return -1; |
| 462 | } |
| 463 | |
| 464 | /* Check the current frequency */ |
| 465 | ret = check_cur_freq(TEST_POWER_LCORE_ID, 0, true); |
| 466 | if (ret < 0) |
| 467 | return -1; |
| 468 | |
| 469 | /* test with an invalid lcore id */ |
| 470 | ret = rte_power_freq_disable_turbo(TEST_POWER_LCORE_INVALID); |
| 471 | if (ret >= 0) { |
| 472 | printf("Unexpectedly disable turbo successfully on lcore %u\n", |
| 473 | TEST_POWER_LCORE_INVALID); |
| 474 | return -1; |
| 475 | } |
| 476 | ret = rte_power_freq_disable_turbo(TEST_POWER_LCORE_ID); |
| 477 | if (ret < 0) { |
| 478 | printf("Fail to disable turbo on lcore %u\n", |
| 479 | TEST_POWER_LCORE_ID); |
| 480 | return -1; |
| 481 | } |
| 482 | ret = rte_power_freq_max(TEST_POWER_LCORE_ID); |
| 483 | if (ret < 0) { |
| 484 | printf("Fail to scale up the freq to max on lcore %u\n", |
| 485 | TEST_POWER_LCORE_ID); |
| 486 | return -1; |
| 487 | } |
| 488 | |
| 489 | /* Check the current frequency */ |
| 490 | ret = check_cur_freq(TEST_POWER_LCORE_ID, 1, false); |
no test coverage detected