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

Function exec_burst

dpdk/app/test/test_pmd_perf.c:616–670  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

614}
615
616static int
617exec_burst(uint32_t flags, int lcore)
618{
619 unsigned int portid, nb_tx = 0;
620 struct lcore_conf *conf;
621 uint32_t pkt_per_port;
622 int num, i, idx = 0;
623 int diff_tsc;
624
625 conf = &lcore_conf[lcore];
626
627 pkt_per_port = MAX_TRAFFIC_BURST;
628 num = pkt_per_port * conf->nb_ports;
629
630 /* only when polling first */
631 if (flags == SC_BURST_POLL_FIRST)
632 __atomic_store_n(&start, 1, __ATOMIC_RELAXED);
633 else
634 __atomic_store_n(&start, 0, __ATOMIC_RELAXED);
635
636 /* start polling thread
637 * if in POLL_FIRST mode, poll once launched;
638 * otherwise, not actually poll yet
639 */
640 rte_eal_remote_launch(poll_burst,
641 (void *)&pkt_per_port, lcore);
642
643 /* start xmit */
644 i = 0;
645 while (num) {
646 nb_tx = RTE_MIN(MAX_PKT_BURST, num);
647 portid = conf->portlist[i];
648 nb_tx = rte_eth_tx_burst(portid, 0, &tx_burst[idx], nb_tx);
649 idx += nb_tx;
650 num -= nb_tx;
651 i = (i >= conf->nb_ports - 1) ? 0 : (i + 1);
652 }
653
654 rte_delay_us(5 * US_PER_S);
655
656 /* only when polling second */
657 if (flags == SC_BURST_XMIT_FIRST)
658 __atomic_store_n(&start, 1, __ATOMIC_RELEASE);
659
660 /* wait for polling finished */
661 diff_tsc = rte_eal_wait_lcore(lcore);
662 if (diff_tsc < 0) {
663 printf("exec_burst: Failed to measure cycles per packet\n");
664 return -1;
665 }
666
667 printf("Result: %d cycles per packet\n", diff_tsc);
668
669 return 0;
670}
671
672static int
673test_pmd_perf(void)

Callers 1

test_pmd_perfFunction · 0.85

Calls 4

rte_eal_remote_launchFunction · 0.85
rte_eth_tx_burstFunction · 0.85
rte_eal_wait_lcoreFunction · 0.85
printfFunction · 0.50

Tested by

no test coverage detected