From patchwork Mon Mar 20 10:08:39 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Hunt, David" X-Patchwork-Id: 22020 Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id D985AD1B3; Mon, 20 Mar 2017 18:08:49 +0100 (CET) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id 260CC47CD for ; Mon, 20 Mar 2017 18:08:15 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=intel.com; i=@intel.com; q=dns/txt; s=intel; t=1490029696; x=1521565696; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=tExoL1arS6yLPmNq4+7ELz5OLY7Ni0mW1k7MdtCL2Dc=; b=m7nmgCb4kJf9joKQust8I0tvdDZB4Ef/qsfBd70G6x/fMUZA2Xst0uhf qlLj7HKV5SoXjMnzbcL3ytBNSaqPvA==; Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 20 Mar 2017 10:08:15 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.36,195,1486454400"; d="scan'208";a="69069021" Received: from silpixa00397515.ir.intel.com (HELO silpixa00397515.ger.corp.intel.com) ([10.237.223.14]) by orsmga004.jf.intel.com with ESMTP; 20 Mar 2017 10:08:14 -0700 From: David Hunt To: dev@dpdk.org Cc: bruce.richardson@intel.com, David Hunt Date: Mon, 20 Mar 2017 10:08:39 +0000 Message-Id: <1490004522-183515-16-git-send-email-david.hunt@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1490004522-183515-1-git-send-email-david.hunt@intel.com> References: <1489558767-56329-2-git-send-email-david.hunt@intel.com> <1490004522-183515-1-git-send-email-david.hunt@intel.com> Subject: [dpdk-dev] [PATCH v11 15/18] examples/distributor: give Rx thread a core 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" Now that we're printing out a page of stats every second to the console, we should give the stats it's own core so that we don't interfere with the performance of the Rx core. Signed-off-by: David Hunt Acked-by: Bruce Richardson --- examples/distributor/main.c | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/examples/distributor/main.c b/examples/distributor/main.c index 53c7b38..6aa8755 100644 --- a/examples/distributor/main.c +++ b/examples/distributor/main.c @@ -680,9 +680,10 @@ main(int argc, char *argv[]) if (ret < 0) rte_exit(EXIT_FAILURE, "Invalid distributor parameters\n"); - if (rte_lcore_count() < 4) + if (rte_lcore_count() < 5) rte_exit(EXIT_FAILURE, "Error, This application needs at " - "least 4 logical cores to run:\n" + "least 5 logical cores to run:\n" + "1 lcore for stats (can be core 0)\n" "1 lcore for packet RX\n" "1 lcore for distribution\n" "1 lcore for packet TX\n" @@ -724,7 +725,7 @@ main(int argc, char *argv[]) } d = rte_distributor_create("PKT_DIST", rte_socket_id(), - rte_lcore_count() - 3, + rte_lcore_count() - 4, RTE_DIST_ALG_BURST); if (d == NULL) rte_exit(EXIT_FAILURE, "Cannot create distributor\n"); @@ -763,6 +764,18 @@ main(int argc, char *argv[]) /* tx core */ rte_eal_remote_launch((lcore_function_t *)lcore_tx, dist_tx_ring, lcore_id); + } else if (worker_id == rte_lcore_count() - 2) { + printf("Starting rx on worker_id %d, lcore_id %d\n", + worker_id, lcore_id); + /* rx core */ + struct lcore_params *p = + rte_malloc(NULL, sizeof(*p), 0); + if (!p) + rte_panic("malloc failure\n"); + *p = (struct lcore_params){worker_id, d, rx_dist_ring, + dist_tx_ring, mbuf_pool}; + rte_eal_remote_launch((lcore_function_t *)lcore_rx, + p, lcore_id); } else { printf("Starting worker on worker_id %d, lcore_id %d\n", worker_id, lcore_id); @@ -778,11 +791,6 @@ main(int argc, char *argv[]) } worker_id++; } - /* call lcore_main on master core only */ - struct lcore_params p = { 0, d, rx_dist_ring, dist_tx_ring, mbuf_pool}; - - if (lcore_rx(&p) != 0) - return -1; freq = rte_get_timer_hz(); t = rte_rdtsc() + freq;