Check rte_power_freq_down() */
| 263 | |
| 264 | /* Check rte_power_freq_down() */ |
| 265 | static int |
| 266 | check_power_freq_down(void) |
| 267 | { |
| 268 | int ret; |
| 269 | |
| 270 | rte_power_freq_enable_turbo(TEST_POWER_LCORE_ID); |
| 271 | |
| 272 | /* test with an invalid lcore id */ |
| 273 | ret = rte_power_freq_down(TEST_POWER_LCORE_INVALID); |
| 274 | if (ret >= 0) { |
| 275 | printf("Unexpectedly scale down successfully the freq on " |
| 276 | "lcore %u\n", TEST_POWER_LCORE_INVALID); |
| 277 | return -1; |
| 278 | } |
| 279 | |
| 280 | /* Scale down to min and then scale down one step */ |
| 281 | ret = rte_power_freq_min(TEST_POWER_LCORE_ID); |
| 282 | if (ret < 0) { |
| 283 | printf("Fail to scale down the freq to min on lcore %u\n", |
| 284 | TEST_POWER_LCORE_ID); |
| 285 | return -1; |
| 286 | } |
| 287 | ret = rte_power_freq_down(TEST_POWER_LCORE_ID); |
| 288 | if (ret < 0) { |
| 289 | printf("Fail to scale down the freq on lcore %u\n", |
| 290 | TEST_POWER_LCORE_ID); |
| 291 | return -1; |
| 292 | } |
| 293 | |
| 294 | /* Check the current frequency */ |
| 295 | ret = check_cur_freq(TEST_POWER_LCORE_ID, total_freq_num - 1, false); |
| 296 | if (ret < 0) |
| 297 | return -1; |
| 298 | |
| 299 | /* Scale up to max and then scale down one step */ |
| 300 | ret = rte_power_freq_max(TEST_POWER_LCORE_ID); |
| 301 | if (ret < 0) { |
| 302 | printf("Fail to scale up the freq to max on lcore %u\n", |
| 303 | TEST_POWER_LCORE_ID); |
| 304 | return -1; |
| 305 | } |
| 306 | ret = rte_power_freq_down(TEST_POWER_LCORE_ID); |
| 307 | if (ret < 0) { |
| 308 | printf("Fail to scale down the freq on lcore %u\n", |
| 309 | TEST_POWER_LCORE_ID); |
| 310 | return -1; |
| 311 | } |
| 312 | |
| 313 | /* Check the current frequency */ |
| 314 | ret = check_cur_freq(TEST_POWER_LCORE_ID, 1, false); |
| 315 | if (ret < 0) |
| 316 | return -1; |
| 317 | |
| 318 | return 0; |
| 319 | } |
| 320 | |
| 321 | /* Check rte_power_freq_up() */ |
| 322 | static int |
no test coverage detected