| 454 | } |
| 455 | |
| 456 | static int |
| 457 | test_pmd_ringcreate_setup(void) |
| 458 | { |
| 459 | uint8_t nb_ports; |
| 460 | |
| 461 | nb_ports = rte_eth_dev_count_avail(); |
| 462 | printf("nb_ports=%d\n", (int)nb_ports); |
| 463 | |
| 464 | /* create the rings and eth_rings in the test code. |
| 465 | * This does not test the rte_pmd_ring_devinit function. |
| 466 | * |
| 467 | * Test with the command line option --vdev=net_ring0 to test rte_pmd_ring_devinit. |
| 468 | */ |
| 469 | rxtx[0] = rte_ring_create("R0", RING_SIZE, SOCKET0, RING_F_SP_ENQ|RING_F_SC_DEQ); |
| 470 | if (rxtx[0] == NULL) { |
| 471 | printf("rte_ring_create R0 failed"); |
| 472 | return -1; |
| 473 | } |
| 474 | |
| 475 | rxtx[1] = rte_ring_create("R1", RING_SIZE, SOCKET0, RING_F_SP_ENQ|RING_F_SC_DEQ); |
| 476 | if (rxtx[1] == NULL) { |
| 477 | printf("rte_ring_create R1 failed"); |
| 478 | return -1; |
| 479 | } |
| 480 | |
| 481 | tx_porta = rte_eth_from_rings("net_ringa", rxtx, NUM_RINGS, rxtx, NUM_RINGS, SOCKET0); |
| 482 | rx_portb = rte_eth_from_rings("net_ringb", rxtx, NUM_RINGS, rxtx, NUM_RINGS, SOCKET0); |
| 483 | rxtx_portc = rte_eth_from_rings("net_ringc", rxtx, NUM_RINGS, rxtx, NUM_RINGS, SOCKET0); |
| 484 | rxtx_portd = rte_eth_from_rings("net_ringd", rxtx, NUM_RINGS, rxtx, NUM_RINGS, SOCKET0); |
| 485 | rxtx_porte = rte_eth_from_rings("net_ringe", rxtx, NUM_RINGS, rxtx, NUM_RINGS, SOCKET0); |
| 486 | |
| 487 | printf("tx_porta=%d rx_portb=%d rxtx_portc=%d rxtx_portd=%d rxtx_porte=%d\n", |
| 488 | tx_porta, rx_portb, rxtx_portc, rxtx_portd, rxtx_porte); |
| 489 | |
| 490 | if ((tx_porta == -1) || (rx_portb == -1) || (rxtx_portc == -1) |
| 491 | || (rxtx_portd == -1) || (rxtx_porte == -1)) { |
| 492 | printf("rte_eth_from rings failed\n"); |
| 493 | return -1; |
| 494 | } |
| 495 | |
| 496 | mp = rte_pktmbuf_pool_create("mbuf_pool", NB_MBUF, 32, |
| 497 | 0, RTE_MBUF_DEFAULT_BUF_SIZE, rte_socket_id()); |
| 498 | if (mp == NULL) |
| 499 | return -1; |
| 500 | |
| 501 | if ((tx_porta >= RTE_MAX_ETHPORTS) || (rx_portb >= RTE_MAX_ETHPORTS) |
| 502 | || (rxtx_portc >= RTE_MAX_ETHPORTS) |
| 503 | || (rxtx_portd >= RTE_MAX_ETHPORTS) |
| 504 | || (rxtx_porte >= RTE_MAX_ETHPORTS)) { |
| 505 | printf(" port exceed max eth ports\n"); |
| 506 | return -1; |
| 507 | } |
| 508 | return 0; |
| 509 | } |
| 510 | |
| 511 | static int |
| 512 | test_command_line_ring_port(void) |
nothing calls this directly
no test coverage detected