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

Function test_dmadev_instance

dpdk/app/test/test_dmadev.c:913–1026  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

911}
912
913static int
914test_dmadev_instance(int16_t dev_id)
915{
916#define CHECK_ERRS true
917 struct rte_dma_stats stats;
918 struct rte_dma_info info;
919 const struct rte_dma_conf conf = { .nb_vchans = 1};
920 const struct rte_dma_vchan_conf qconf = {
921 .direction = RTE_DMA_DIR_MEM_TO_MEM,
922 .nb_desc = TEST_RINGSIZE,
923 };
924 const int vchan = 0;
925 int ret;
926
927 ret = rte_dma_info_get(dev_id, &info);
928 if (ret != 0)
929 ERR_RETURN("Error with rte_dma_info_get()\n");
930
931 printf("\n### Test dmadev instance %u [%s]\n",
932 dev_id, info.dev_name);
933
934 if (info.max_vchans < 1)
935 ERR_RETURN("Error, no channels available on device id %u\n", dev_id);
936
937 if (rte_dma_configure(dev_id, &conf) != 0)
938 ERR_RETURN("Error with rte_dma_configure()\n");
939
940 if (rte_dma_vchan_setup(dev_id, vchan, &qconf) < 0)
941 ERR_RETURN("Error with queue configuration\n");
942
943 ret = rte_dma_info_get(dev_id, &info);
944 if (ret != 0 || info.nb_vchans != 1)
945 ERR_RETURN("Error, no configured queues reported on device id %u\n", dev_id);
946
947 if (rte_dma_start(dev_id) != 0)
948 ERR_RETURN("Error with rte_dma_start()\n");
949
950 if (rte_dma_stats_get(dev_id, vchan, &stats) != 0)
951 ERR_RETURN("Error with rte_dma_stats_get()\n");
952
953 if (rte_dma_burst_capacity(dev_id, vchan) < 32)
954 ERR_RETURN("Error: Device does not have sufficient burst capacity to run tests");
955
956 if (stats.completed != 0 || stats.submitted != 0 || stats.errors != 0)
957 ERR_RETURN("Error device stats are not all zero: completed = %"PRIu64", "
958 "submitted = %"PRIu64", errors = %"PRIu64"\n",
959 stats.completed, stats.submitted, stats.errors);
960 id_count = 0;
961
962 /* create a mempool for running tests */
963 pool = rte_pktmbuf_pool_create("TEST_DMADEV_POOL",
964 TEST_RINGSIZE * 2, /* n == num elements */
965 32, /* cache size */
966 0, /* priv size */
967 2048, /* data room size */
968 info.numa_node);
969 if (pool == NULL)
970 ERR_RETURN("Error with mempool creation\n");

Callers

nothing calls this directly

Calls 13

rte_dma_info_getFunction · 0.85
rte_dma_configureFunction · 0.85
rte_dma_vchan_setupFunction · 0.85
rte_dma_startFunction · 0.85
rte_dma_stats_getFunction · 0.85
rte_dma_burst_capacityFunction · 0.85
rte_pktmbuf_pool_createFunction · 0.85
rte_eal_iova_modeFunction · 0.85
prepare_m2d_auto_freeFunction · 0.85
rte_mempool_freeFunction · 0.85
rte_dma_stopFunction · 0.85
rte_dma_stats_resetFunction · 0.85

Tested by

no test coverage detected