| 361 | } |
| 362 | |
| 363 | static int |
| 364 | configure_dmadev(void) |
| 365 | { |
| 366 | const struct rte_dma_conf conf = { .nb_vchans = 1}; |
| 367 | const struct rte_dma_vchan_conf qconf = { |
| 368 | .direction = RTE_DMA_DIR_MEM_TO_MEM, |
| 369 | .nb_desc = TEST_RINGSIZE, |
| 370 | }; |
| 371 | struct rte_dma_info info; |
| 372 | unsigned int elt_size; |
| 373 | int ret; |
| 374 | |
| 375 | ret = rte_dma_count_avail(); |
| 376 | RTE_TEST_ASSERT_FAIL(ret, "No dma devices found!\n"); |
| 377 | |
| 378 | ret = rte_dma_info_get(TEST_DMA_DEV_ID, &info); |
| 379 | TEST_ASSERT_SUCCESS(ret, "Error with rte_dma_info_get()\n"); |
| 380 | |
| 381 | if (info.max_vchans < 1) |
| 382 | RTE_LOG(ERR, USER1, "Error, no channels available on device id %u\n", |
| 383 | TEST_DMA_DEV_ID); |
| 384 | |
| 385 | if (rte_dma_configure(TEST_DMA_DEV_ID, &conf) != 0) |
| 386 | RTE_LOG(ERR, USER1, "Error with rte_dma_configure()\n"); |
| 387 | |
| 388 | if (rte_dma_vchan_setup(TEST_DMA_DEV_ID, TEST_DMA_VCHAN_ID, &qconf) < 0) |
| 389 | RTE_LOG(ERR, USER1, "Error with vchan configuration\n"); |
| 390 | |
| 391 | ret = rte_dma_info_get(TEST_DMA_DEV_ID, &info); |
| 392 | if (ret != 0 || info.nb_vchans != 1) |
| 393 | RTE_LOG(ERR, USER1, "Error, no configured vhcan reported on device id %u\n", |
| 394 | TEST_DMA_DEV_ID); |
| 395 | |
| 396 | params.src_mbuf_pool = rte_pktmbuf_pool_create("DMA_ADAPTER_SRC_MBUFPOOL", NUM_MBUFS, |
| 397 | MBUF_CACHE_SIZE, 0, MBUF_SIZE, |
| 398 | rte_socket_id()); |
| 399 | RTE_TEST_ASSERT_NOT_NULL(params.src_mbuf_pool, "Can't create DMA_SRC_MBUFPOOL\n"); |
| 400 | |
| 401 | params.dst_mbuf_pool = rte_pktmbuf_pool_create("DMA_ADAPTER_DST_MBUFPOOL", NUM_MBUFS, |
| 402 | MBUF_CACHE_SIZE, 0, MBUF_SIZE, |
| 403 | rte_socket_id()); |
| 404 | RTE_TEST_ASSERT_NOT_NULL(params.dst_mbuf_pool, "Can't create DMA_DST_MBUFPOOL\n"); |
| 405 | |
| 406 | elt_size = sizeof(struct rte_event_dma_adapter_op) + sizeof(struct rte_event); |
| 407 | params.op_mpool = rte_mempool_create("EVENT_DMA_OP_POOL", DMA_OP_POOL_SIZE, elt_size, 0, |
| 408 | 0, NULL, NULL, NULL, NULL, rte_socket_id(), 0); |
| 409 | RTE_TEST_ASSERT_NOT_NULL(params.op_mpool, "Can't create DMA_OP_POOL\n"); |
| 410 | |
| 411 | return TEST_SUCCESS; |
| 412 | } |
| 413 | |
| 414 | static inline void |
| 415 | evdev_set_conf_values(struct rte_event_dev_config *dev_conf, struct rte_event_dev_info *info) |
no test coverage detected