| 379 | } |
| 380 | |
| 381 | static int |
| 382 | test_setup(void) |
| 383 | { |
| 384 | int retval, nb_mbuf_per_pool; |
| 385 | char name[RTE_ETH_NAME_MAX_LEN]; |
| 386 | struct member_conf *port; |
| 387 | const uint8_t socket_id = rte_socket_id(); |
| 388 | uint16_t i; |
| 389 | |
| 390 | if (test_params.mbuf_pool == NULL) { |
| 391 | nb_mbuf_per_pool = TEST_RX_DESC_MAX + DEF_PKT_BURST + |
| 392 | TEST_TX_DESC_MAX + MAX_PKT_BURST; |
| 393 | test_params.mbuf_pool = rte_pktmbuf_pool_create("TEST_MODE4", |
| 394 | nb_mbuf_per_pool, MBUF_CACHE_SIZE, 0, |
| 395 | RTE_MBUF_DEFAULT_BUF_SIZE, socket_id); |
| 396 | |
| 397 | TEST_ASSERT(test_params.mbuf_pool != NULL, |
| 398 | "rte_mempool_create failed\n"); |
| 399 | } |
| 400 | |
| 401 | /* Create / initialize ring eth devs. */ |
| 402 | FOR_EACH_PORT(i, port) { |
| 403 | port = &test_params.member_ports[i]; |
| 404 | |
| 405 | if (port->rx_queue == NULL) { |
| 406 | retval = snprintf(name, RTE_DIM(name), MEMBER_RX_QUEUE_FMT, i); |
| 407 | TEST_ASSERT(retval <= (int)RTE_DIM(name) - 1, "Name too long"); |
| 408 | port->rx_queue = rte_ring_create(name, RX_RING_SIZE, socket_id, 0); |
| 409 | TEST_ASSERT(port->rx_queue != NULL, |
| 410 | "Failed to allocate rx ring '%s': %s", name, |
| 411 | rte_strerror(rte_errno)); |
| 412 | } |
| 413 | |
| 414 | if (port->tx_queue == NULL) { |
| 415 | retval = snprintf(name, RTE_DIM(name), MEMBER_TX_QUEUE_FMT, i); |
| 416 | TEST_ASSERT(retval <= (int)RTE_DIM(name) - 1, "Name too long"); |
| 417 | port->tx_queue = rte_ring_create(name, TX_RING_SIZE, socket_id, 0); |
| 418 | TEST_ASSERT_NOT_NULL(port->tx_queue, |
| 419 | "Failed to allocate tx ring '%s': %s", name, |
| 420 | rte_strerror(rte_errno)); |
| 421 | } |
| 422 | |
| 423 | if (port->port_id == INVALID_PORT_ID) { |
| 424 | retval = snprintf(name, RTE_DIM(name), MEMBER_DEV_NAME_FMT, i); |
| 425 | TEST_ASSERT(retval < (int)RTE_DIM(name) - 1, "Name too long"); |
| 426 | retval = rte_eth_from_rings(name, &port->rx_queue, 1, |
| 427 | &port->tx_queue, 1, socket_id); |
| 428 | TEST_ASSERT(retval >= 0, |
| 429 | "Failed to create ring ethdev '%s'\n", name); |
| 430 | |
| 431 | port->port_id = rte_eth_dev_count_avail() - 1; |
| 432 | } |
| 433 | |
| 434 | retval = configure_ethdev(port->port_id, 1); |
| 435 | TEST_ASSERT_SUCCESS(retval, "Failed to configure virtual ethdev %s\n", |
| 436 | name); |
| 437 | } |
| 438 |
nothing calls this directly
no test coverage detected