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

Function lcore_worker

dpdk/examples/distributor/main.c:632–672  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

630}
631
632static int
633lcore_worker(struct lcore_params *p)
634{
635 struct rte_distributor *d = p->d;
636 const unsigned id = p->worker_id;
637 unsigned int num = 0;
638 unsigned int i;
639
640 /*
641 * for single port, xor_val will be zero so we won't modify the output
642 * port, otherwise we send traffic from 0 to 1, 2 to 3, and vice versa
643 */
644 const unsigned xor_val = (rte_eth_dev_count_avail() > 1);
645 struct rte_mbuf *buf[8] __rte_cache_aligned;
646
647 for (i = 0; i < 8; i++)
648 buf[i] = NULL;
649
650 app_stats.worker_pkts[p->worker_id] = 1;
651
652 printf("\nCore %u acting as worker core.\n", rte_lcore_id());
653 while (!quit_signal_work) {
654 num = rte_distributor_get_pkt(d, id, buf, buf, num);
655 /* Do a little bit of work for each packet */
656 for (i = 0; i < num; i++) {
657 uint64_t t = rte_rdtsc()+100;
658
659 while (rte_rdtsc() < t)
660 rte_pause();
661 buf[i]->port ^= xor_val;
662 }
663
664 app_stats.worker_pkts[p->worker_id] += num;
665 if (num > 0)
666 app_stats.worker_bursts[p->worker_id][num-1]++;
667 }
668 if (power_lib_initialised)
669 rte_power_exit(rte_lcore_id());
670 rte_free(p);
671 return 0;
672}
673
674static int
675init_power_library(void)

Callers

nothing calls this directly

Calls 8

rte_eth_dev_count_availFunction · 0.85
rte_lcore_idFunction · 0.85
rte_distributor_get_pktFunction · 0.85
rte_power_exitFunction · 0.85
rte_freeFunction · 0.85
printfFunction · 0.50
rte_rdtscFunction · 0.50
rte_pauseFunction · 0.50

Tested by

no test coverage detected