From: Pawel Modrak Date: Mon, 7 Oct 2019 11:08:07 +0000 (+0100) Subject: examples/ioat: add two threads configuration X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=59694dc5bddfc4a6c9bebd20c74eb5ac27c41edd;p=dpdk.git examples/ioat: add two threads configuration Added possibility to use two lcores: first for packet receiving and copying, second for packets sending. Signed-off-by: Pawel Modrak Signed-off-by: Marcin Baran Acked-by: Bruce Richardson --- diff --git a/examples/ioat/ioatfwd.c b/examples/ioat/ioatfwd.c index 1225dce373..2fc0b11738 100644 --- a/examples/ioat/ioatfwd.c +++ b/examples/ioat/ioatfwd.c @@ -263,6 +263,36 @@ ioat_tx_port(struct rxtx_port_config *tx_config) } } +/* Main rx processing loop for IOAT rawdev. */ +static void +rx_main_loop(void) +{ + uint16_t i; + uint16_t nb_ports = cfg.nb_ports; + + RTE_LOG(INFO, IOAT, "Entering main rx loop for copy on lcore %u\n", + rte_lcore_id()); + + while (!force_quit) + for (i = 0; i < nb_ports; i++) + ioat_rx_port(&cfg.ports[i]); +} + +/* Main tx processing loop for hardware copy. */ +static void +tx_main_loop(void) +{ + uint16_t i; + uint16_t nb_ports = cfg.nb_ports; + + RTE_LOG(INFO, IOAT, "Entering main tx loop for copy on lcore %u\n", + rte_lcore_id()); + + while (!force_quit) + for (i = 0; i < nb_ports; i++) + ioat_tx_port(&cfg.ports[i]); +} + /* Main rx and tx loop if only one slave lcore available */ static void rxtx_main_loop(void) @@ -287,9 +317,19 @@ static void start_forwarding_cores(void) RTE_LOG(INFO, IOAT, "Entering %s on lcore %u\n", __func__, rte_lcore_id()); - lcore_id = rte_get_next_lcore(lcore_id, true, true); - rte_eal_remote_launch((lcore_function_t *)rxtx_main_loop, - NULL, lcore_id); + if (cfg.nb_lcores == 1) { + lcore_id = rte_get_next_lcore(lcore_id, true, true); + rte_eal_remote_launch((lcore_function_t *)rxtx_main_loop, + NULL, lcore_id); + } else if (cfg.nb_lcores > 1) { + lcore_id = rte_get_next_lcore(lcore_id, true, true); + rte_eal_remote_launch((lcore_function_t *)rx_main_loop, + NULL, lcore_id); + + lcore_id = rte_get_next_lcore(lcore_id, true, true); + rte_eal_remote_launch((lcore_function_t *)tx_main_loop, NULL, + lcore_id); + } } /* Display usage */