| 623 | } |
| 624 | |
| 625 | static void |
| 626 | create_mp_ring_vdev(void) |
| 627 | { |
| 628 | int i; |
| 629 | uint16_t portid; |
| 630 | struct pdump_tuples *pt = NULL; |
| 631 | struct rte_mempool *mbuf_pool = NULL; |
| 632 | char vdev_name[SIZE]; |
| 633 | char vdev_args[SIZE]; |
| 634 | char ring_name[SIZE]; |
| 635 | char mempool_name[SIZE]; |
| 636 | |
| 637 | for (i = 0; i < num_tuples; i++) { |
| 638 | pt = &pdump_t[i]; |
| 639 | snprintf(mempool_name, SIZE, MP_NAME, i); |
| 640 | mbuf_pool = rte_mempool_lookup(mempool_name); |
| 641 | if (mbuf_pool == NULL) { |
| 642 | /* create mempool */ |
| 643 | mbuf_pool = rte_pktmbuf_pool_create_by_ops(mempool_name, |
| 644 | pt->total_num_mbufs, |
| 645 | MBUF_POOL_CACHE_SIZE, 0, |
| 646 | pt->mbuf_data_size, |
| 647 | rte_socket_id(), "ring_mp_mc"); |
| 648 | if (mbuf_pool == NULL) { |
| 649 | cleanup_rings(); |
| 650 | rte_exit(EXIT_FAILURE, |
| 651 | "Mempool creation failed: %s\n", |
| 652 | rte_strerror(rte_errno)); |
| 653 | } |
| 654 | } |
| 655 | pt->mp = mbuf_pool; |
| 656 | |
| 657 | if (pt->dir == RTE_PDUMP_FLAG_RXTX) { |
| 658 | /* if captured packets has to send to the same vdev */ |
| 659 | /* create rx_ring */ |
| 660 | snprintf(ring_name, SIZE, RX_RING, i); |
| 661 | pt->rx_ring = rte_ring_create(ring_name, pt->ring_size, |
| 662 | rte_socket_id(), 0); |
| 663 | if (pt->rx_ring == NULL) { |
| 664 | cleanup_rings(); |
| 665 | rte_exit(EXIT_FAILURE, "%s:%s:%d\n", |
| 666 | rte_strerror(rte_errno), |
| 667 | __func__, __LINE__); |
| 668 | } |
| 669 | |
| 670 | /* create tx_ring */ |
| 671 | snprintf(ring_name, SIZE, TX_RING, i); |
| 672 | pt->tx_ring = rte_ring_create(ring_name, pt->ring_size, |
| 673 | rte_socket_id(), 0); |
| 674 | if (pt->tx_ring == NULL) { |
| 675 | cleanup_rings(); |
| 676 | rte_exit(EXIT_FAILURE, "%s:%s:%d\n", |
| 677 | rte_strerror(rte_errno), |
| 678 | __func__, __LINE__); |
| 679 | } |
| 680 | |
| 681 | /* create vdevs */ |
| 682 | snprintf(vdev_name, sizeof(vdev_name), |
no test coverage detected