From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 523C1A2EEB for ; Mon, 7 Oct 2019 13:08:59 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 614631C299; Mon, 7 Oct 2019 13:08:35 +0200 (CEST) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id 18F411C22B for ; Mon, 7 Oct 2019 13:08:32 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 07 Oct 2019 04:08:32 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.67,268,1566889200"; d="scan'208";a="205041061" Received: from silpixa00399126.ir.intel.com (HELO silpixa00399126.ger.corp.intel.com) ([10.237.223.2]) by orsmga002.jf.intel.com with ESMTP; 07 Oct 2019 04:08:31 -0700 From: Bruce Richardson To: dev@dpdk.org Cc: Marcin Baran , Pawel Modrak , Bruce Richardson Date: Mon, 7 Oct 2019 12:08:07 +0100 Message-Id: <20191007110809.62801-5-bruce.richardson@intel.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20191007110809.62801-1-bruce.richardson@intel.com> References: <20190920073714.1314-1-marcinx.baran@intel.com> <20191007110809.62801-1-bruce.richardson@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v7 4/6] examples/ioat: add two threads configuration X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Pawel Modrak 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 --- examples/ioat/ioatfwd.c | 47 +++++++++++++++++++++++++++++++++++++---- 1 file changed, 43 insertions(+), 4 deletions(-) diff --git a/examples/ioat/ioatfwd.c b/examples/ioat/ioatfwd.c index a38b6700b..2fc0b1173 100644 --- a/examples/ioat/ioatfwd.c +++ b/examples/ioat/ioatfwd.c @@ -161,7 +161,6 @@ ioat_enqueue_packets(struct rte_mbuf **pkts, rte_mempool_put_bulk(ioat_pktmbuf_pool, (void *)&pkts_copy[i], nb_rx - i); - return ret; } @@ -264,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) @@ -288,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 */ -- 2.21.0