Check rte_power_freq_up() */
| 320 | |
| 321 | /* Check rte_power_freq_up() */ |
| 322 | static int |
| 323 | check_power_freq_up(void) |
| 324 | { |
| 325 | int ret; |
| 326 | |
| 327 | /* test with an invalid lcore id */ |
| 328 | ret = rte_power_freq_up(TEST_POWER_LCORE_INVALID); |
| 329 | if (ret >= 0) { |
| 330 | printf("Unexpectedly scale up successfully the freq on %u\n", |
| 331 | TEST_POWER_LCORE_INVALID); |
| 332 | return -1; |
| 333 | } |
| 334 | |
| 335 | /* Scale down to min and then scale up one step */ |
| 336 | ret = rte_power_freq_min(TEST_POWER_LCORE_ID); |
| 337 | if (ret < 0) { |
| 338 | printf("Fail to scale down the freq to min on lcore %u\n", |
| 339 | TEST_POWER_LCORE_ID); |
| 340 | return -1; |
| 341 | } |
| 342 | ret = rte_power_freq_up(TEST_POWER_LCORE_ID); |
| 343 | if (ret < 0) { |
| 344 | printf("Fail to scale up the freq on lcore %u\n", |
| 345 | TEST_POWER_LCORE_ID); |
| 346 | return -1; |
| 347 | } |
| 348 | |
| 349 | /* Check the current frequency */ |
| 350 | ret = check_cur_freq(TEST_POWER_LCORE_ID, total_freq_num - 2, false); |
| 351 | if (ret < 0) |
| 352 | return -1; |
| 353 | |
| 354 | /* Scale up to max and then scale up one step */ |
| 355 | ret = rte_power_freq_max(TEST_POWER_LCORE_ID); |
| 356 | if (ret < 0) { |
| 357 | printf("Fail to scale up the freq to max on lcore %u\n", |
| 358 | TEST_POWER_LCORE_ID); |
| 359 | return -1; |
| 360 | } |
| 361 | ret = rte_power_freq_up(TEST_POWER_LCORE_ID); |
| 362 | if (ret < 0) { |
| 363 | printf("Fail to scale up the freq on lcore %u\n", |
| 364 | TEST_POWER_LCORE_ID); |
| 365 | return -1; |
| 366 | } |
| 367 | |
| 368 | /* Check the current frequency */ |
| 369 | ret = check_cur_freq(TEST_POWER_LCORE_ID, 0, true); |
| 370 | if (ret < 0) |
| 371 | return -1; |
| 372 | |
| 373 | return 0; |
| 374 | } |
| 375 | |
| 376 | /* Check rte_power_freq_max() */ |
| 377 | static int |
no test coverage detected