MCPcopy Create free account
hub / github.com/F-Stack/f-stack / quit_workers

Function quit_workers

dpdk/app/test/test_distributor.c:785–820  ·  view source on GitHub ↗

Useful function which ensures that all worker functions terminate */

Source from the content-addressed store, hash-verified

783
784/* Useful function which ensures that all worker functions terminate */
785static void
786quit_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
822static int
823test_distributor(void)

Callers 1

test_distributorFunction · 0.70

Calls 9

rte_lcore_countFunction · 0.85
rte_mempool_get_bulkFunction · 0.85
rte_distributor_processFunction · 0.85
rte_distributor_flushFunction · 0.85
rte_eal_mp_wait_lcoreFunction · 0.85
rte_mempool_put_bulkFunction · 0.85
printfFunction · 0.50

Tested by

no test coverage detected