| 331 | } |
| 332 | |
| 333 | static int |
| 334 | test_stop_start(int16_t dev_id, uint16_t vchan) |
| 335 | { |
| 336 | /* device is already started on input, should be (re)started on output */ |
| 337 | |
| 338 | uint16_t id = 0; |
| 339 | enum rte_dma_status_code status = RTE_DMA_STATUS_SUCCESSFUL; |
| 340 | |
| 341 | /* - test stopping a device works ok, |
| 342 | * - then do a start-stop without doing a copy |
| 343 | * - finally restart the device |
| 344 | * checking for errors at each stage, and validating we can still copy at the end. |
| 345 | */ |
| 346 | if (rte_dma_stop(dev_id) < 0) |
| 347 | ERR_RETURN("Error stopping device\n"); |
| 348 | |
| 349 | if (rte_dma_start(dev_id) < 0) |
| 350 | ERR_RETURN("Error restarting device\n"); |
| 351 | if (rte_dma_stop(dev_id) < 0) |
| 352 | ERR_RETURN("Error stopping device after restart (no jobs executed)\n"); |
| 353 | |
| 354 | if (rte_dma_start(dev_id) < 0) |
| 355 | ERR_RETURN("Error restarting device after multiple stop-starts\n"); |
| 356 | |
| 357 | /* before doing a copy, we need to know what the next id will be it should |
| 358 | * either be: |
| 359 | * - the last completed job before start if driver does not reset id on stop |
| 360 | * - or -1 i.e. next job is 0, if driver does reset the job ids on stop |
| 361 | */ |
| 362 | if (rte_dma_completed_status(dev_id, vchan, 1, &id, &status) != 0) |
| 363 | ERR_RETURN("Error with rte_dma_completed_status when no job done\n"); |
| 364 | id += 1; /* id_count is next job id */ |
| 365 | if (id != id_count && id != 0) |
| 366 | ERR_RETURN("Unexpected next id from device after stop-start. Got %u, expected %u or 0\n", |
| 367 | id, id_count); |
| 368 | |
| 369 | id_count = id; |
| 370 | if (test_single_copy(dev_id, vchan) < 0) |
| 371 | ERR_RETURN("Error performing copy after device restart\n"); |
| 372 | return 0; |
| 373 | } |
| 374 | |
| 375 | /* Failure handling test cases - global macros and variables for those tests*/ |
| 376 | #define COMP_BURST_SZ 16 |
nothing calls this directly
no test coverage detected