| 591 | } |
| 592 | |
| 593 | static int |
| 594 | test_multi_failure(int16_t dev_id, uint16_t vchan, struct rte_mbuf **srcs, struct rte_mbuf **dsts, |
| 595 | const unsigned int *fail, size_t num_fail) |
| 596 | { |
| 597 | /* test having multiple errors in one go */ |
| 598 | enum rte_dma_status_code status[COMP_BURST_SZ]; |
| 599 | unsigned int i, j; |
| 600 | uint16_t count, err_count = 0; |
| 601 | bool error = false; |
| 602 | |
| 603 | /* enqueue and gather completions in one go */ |
| 604 | for (j = 0; j < COMP_BURST_SZ; j++) { |
| 605 | uintptr_t src = rte_mbuf_data_iova(srcs[j]); |
| 606 | /* set up for failure if the current index is anywhere is the fails array */ |
| 607 | for (i = 0; i < num_fail; i++) |
| 608 | if (j == fail[i]) |
| 609 | src = 0; |
| 610 | |
| 611 | int id = rte_dma_copy(dev_id, vchan, src, rte_mbuf_data_iova(dsts[j]), |
| 612 | COPY_LEN, 0); |
| 613 | if (id < 0) |
| 614 | ERR_RETURN("Error with rte_dma_copy for buffer %u\n", j); |
| 615 | } |
| 616 | rte_dma_submit(dev_id, vchan); |
| 617 | await_hw(dev_id, vchan); |
| 618 | |
| 619 | count = rte_dma_completed_status(dev_id, vchan, COMP_BURST_SZ, NULL, status); |
| 620 | while (count < COMP_BURST_SZ) { |
| 621 | await_hw(dev_id, vchan); |
| 622 | |
| 623 | uint16_t ret = rte_dma_completed_status(dev_id, vchan, COMP_BURST_SZ - count, |
| 624 | NULL, &status[count]); |
| 625 | if (ret == 0) |
| 626 | ERR_RETURN("Error getting all completions for jobs. Got %u of %u\n", |
| 627 | count, COMP_BURST_SZ); |
| 628 | count += ret; |
| 629 | } |
| 630 | for (i = 0; i < count; i++) |
| 631 | if (status[i] != RTE_DMA_STATUS_SUCCESSFUL) |
| 632 | err_count++; |
| 633 | |
| 634 | if (err_count != num_fail) |
| 635 | ERR_RETURN("Error: Invalid number of failed completions returned, %u; expected %zu\n", |
| 636 | err_count, num_fail); |
| 637 | |
| 638 | /* enqueue and gather completions in bursts, but getting errors one at a time */ |
| 639 | for (j = 0; j < COMP_BURST_SZ; j++) { |
| 640 | uintptr_t src = rte_mbuf_data_iova(srcs[j]); |
| 641 | /* set up for failure if the current index is anywhere is the fails array */ |
| 642 | for (i = 0; i < num_fail; i++) |
| 643 | if (j == fail[i]) |
| 644 | src = 0; |
| 645 | |
| 646 | int id = rte_dma_copy(dev_id, vchan, src, rte_mbuf_data_iova(dsts[j]), |
| 647 | COPY_LEN, 0); |
| 648 | if (id < 0) |
| 649 | ERR_RETURN("Error with rte_dma_copy for buffer %u\n", j); |
| 650 | } |
no test coverage detected