| 670 | } |
| 671 | |
| 672 | static int |
| 673 | test_pmd_perf(void) |
| 674 | { |
| 675 | uint16_t nb_ports, num, nb_lcores, worker_id = (uint16_t)-1; |
| 676 | uint16_t nb_rxd = MAX_TRAFFIC_BURST; |
| 677 | uint16_t nb_txd = MAX_TRAFFIC_BURST; |
| 678 | uint16_t portid; |
| 679 | uint16_t nb_rx_queue = 1, nb_tx_queue = 1; |
| 680 | int socketid = -1; |
| 681 | int ret; |
| 682 | |
| 683 | printf("Start PMD RXTX cycles cost test.\n"); |
| 684 | |
| 685 | #ifndef RTE_EXEC_ENV_WINDOWS |
| 686 | signal(SIGUSR1, signal_handler); |
| 687 | signal(SIGUSR2, signal_handler); |
| 688 | #endif |
| 689 | |
| 690 | nb_ports = rte_eth_dev_count_avail(); |
| 691 | if (nb_ports < NB_ETHPORTS_USED) { |
| 692 | printf("At least %u port(s) used for perf. test\n", |
| 693 | NB_ETHPORTS_USED); |
| 694 | return -1; |
| 695 | } |
| 696 | |
| 697 | nb_lcores = rte_lcore_count(); |
| 698 | |
| 699 | memset(lcore_conf, 0, sizeof(lcore_conf)); |
| 700 | init_lcores(); |
| 701 | |
| 702 | init_mbufpool(NB_MBUF); |
| 703 | |
| 704 | if (sc_flag == SC_CONTINUOUS) { |
| 705 | nb_rxd = RX_DESC_DEFAULT; |
| 706 | nb_txd = TX_DESC_DEFAULT; |
| 707 | } |
| 708 | printf("CONFIG RXD=%d TXD=%d\n", nb_rxd, nb_txd); |
| 709 | |
| 710 | reset_count(); |
| 711 | num = 0; |
| 712 | RTE_ETH_FOREACH_DEV(portid) { |
| 713 | if (socketid == -1) { |
| 714 | worker_id = alloc_lcore(rte_eth_dev_socket_id(portid)); |
| 715 | if (worker_id == (uint16_t)-1) { |
| 716 | printf("No avail lcore to run test\n"); |
| 717 | return -1; |
| 718 | } |
| 719 | socketid = rte_lcore_to_socket_id(worker_id); |
| 720 | printf("Performance test runs on lcore %u socket %u\n", |
| 721 | worker_id, socketid); |
| 722 | } |
| 723 | |
| 724 | if (socketid != rte_eth_dev_socket_id(portid) && |
| 725 | rte_eth_dev_socket_id(portid) != SOCKET_ID_ANY) { |
| 726 | printf("Skip port %d\n", portid); |
| 727 | continue; |
| 728 | } |
| 729 |
nothing calls this directly
no test coverage detected