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

Function test_enqueue_fill

dpdk/app/test/test_dmadev.c:717–760  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

715}
716
717static int
718test_enqueue_fill(int16_t dev_id, uint16_t vchan)
719{
720 const unsigned int lengths[] = {8, 64, 1024, 50, 100, 89};
721 struct rte_mbuf *dst;
722 char *dst_data;
723 uint64_t pattern = 0xfedcba9876543210;
724 unsigned int i, j;
725
726 dst = rte_pktmbuf_alloc(pool);
727 if (dst == NULL)
728 ERR_RETURN("Failed to allocate mbuf\n");
729 dst_data = rte_pktmbuf_mtod(dst, char *);
730
731 for (i = 0; i < RTE_DIM(lengths); i++) {
732 /* reset dst_data */
733 memset(dst_data, 0, rte_pktmbuf_data_len(dst));
734
735 /* perform the fill operation */
736 int id = rte_dma_fill(dev_id, vchan, pattern,
737 rte_pktmbuf_iova(dst), lengths[i], RTE_DMA_OP_FLAG_SUBMIT);
738 if (id < 0)
739 ERR_RETURN("Error with rte_dma_fill\n");
740 await_hw(dev_id, vchan);
741
742 if (rte_dma_completed(dev_id, vchan, 1, NULL, NULL) != 1)
743 ERR_RETURN("Error: fill operation failed (length: %u)\n", lengths[i]);
744 /* check the data from the fill operation is correct */
745 for (j = 0; j < lengths[i]; j++) {
746 char pat_byte = ((char *)&pattern)[j % 8];
747 if (dst_data[j] != pat_byte)
748 ERR_RETURN("Error with fill operation (lengths = %u): got (%x), not (%x)\n",
749 lengths[i], dst_data[j], pat_byte);
750 }
751 /* check that the data after the fill operation was not written to */
752 for (; j < rte_pktmbuf_data_len(dst); j++)
753 if (dst_data[j] != 0)
754 ERR_RETURN("Error, fill operation wrote too far (lengths = %u): got (%x), not (%x)\n",
755 lengths[i], dst_data[j], 0);
756 }
757
758 rte_pktmbuf_free(dst);
759 return 0;
760}
761
762static int
763test_burst_capacity(int16_t dev_id, uint16_t vchan)

Callers

nothing calls this directly

Calls 6

rte_pktmbuf_allocFunction · 0.85
memsetFunction · 0.85
rte_dma_fillFunction · 0.85
await_hwFunction · 0.85
rte_dma_completedFunction · 0.85
rte_pktmbuf_freeFunction · 0.85

Tested by

no test coverage detected