MCPcopy Create free account
hub / github.com/F-Stack/f-stack / test_multi_failure

Function test_multi_failure

dpdk/app/test/test_dmadev.c:593–672  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

591}
592
593static int
594test_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 }

Callers 1

test_completion_statusFunction · 0.85

Calls 6

rte_mbuf_data_iovaFunction · 0.85
rte_dma_copyFunction · 0.85
rte_dma_submitFunction · 0.85
await_hwFunction · 0.85
rte_dma_completed_statusFunction · 0.85
rte_dma_completedFunction · 0.85

Tested by

no test coverage detected