Useful function which ensures that all worker functions terminate */
| 783 | |
| 784 | /* Useful function which ensures that all worker functions terminate */ |
| 785 | static void |
| 786 | quit_workers(struct worker_params *wp, struct rte_mempool *p) |
| 787 | { |
| 788 | struct rte_distributor *d = wp->dist; |
| 789 | const unsigned num_workers = rte_lcore_count() - 1; |
| 790 | unsigned i; |
| 791 | struct rte_mbuf *bufs[RTE_MAX_LCORE]; |
| 792 | struct rte_mbuf *returns[RTE_MAX_LCORE]; |
| 793 | if (rte_mempool_get_bulk(p, (void *)bufs, num_workers) != 0) { |
| 794 | printf("line %d: Error getting mbufs from pool\n", __LINE__); |
| 795 | return; |
| 796 | } |
| 797 | |
| 798 | zero_quit = 0; |
| 799 | quit = 1; |
| 800 | for (i = 0; i < num_workers; i++) { |
| 801 | bufs[i]->hash.usr = i << 1; |
| 802 | rte_distributor_process(d, &bufs[i], 1); |
| 803 | } |
| 804 | |
| 805 | rte_distributor_process(d, NULL, 0); |
| 806 | rte_distributor_flush(d); |
| 807 | rte_eal_mp_wait_lcore(); |
| 808 | |
| 809 | while (rte_distributor_returned_pkts(d, returns, RTE_MAX_LCORE)) |
| 810 | ; |
| 811 | |
| 812 | rte_distributor_clear_returns(d); |
| 813 | rte_mempool_put_bulk(p, (void *)bufs, num_workers); |
| 814 | |
| 815 | quit = 0; |
| 816 | worker_idx = 0; |
| 817 | zero_idx = RTE_MAX_LCORE; |
| 818 | zero_quit = 0; |
| 819 | zero_sleep = 0; |
| 820 | } |
| 821 | |
| 822 | static int |
| 823 | test_distributor(void) |
no test coverage detected