| 630 | } |
| 631 | |
| 632 | static int |
| 633 | lcore_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 | |
| 674 | static int |
| 675 | init_power_library(void) |
nothing calls this directly
no test coverage detected