From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 18B46A0C4E; Thu, 12 Aug 2021 15:19:44 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 826A84122D; Thu, 12 Aug 2021 15:19:24 +0200 (CEST) Received: from mail-pl1-f182.google.com (mail-pl1-f182.google.com [209.85.214.182]) by mails.dpdk.org (Postfix) with ESMTP id 048B94122B for ; Thu, 12 Aug 2021 15:19:23 +0200 (CEST) Received: by mail-pl1-f182.google.com with SMTP id w6so240710plg.9 for ; Thu, 12 Aug 2021 06:19:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=I13tSpMYy83dLyDCQBdqOqpPidN3cVq4Uw0Z3XP8dbI=; b=OOPY20J6bvRmbspzJmEqd46lqFB459qaAdNvrhO+gmo9JDd7wxTPDddiowsVbhmfHh TfH09tXT01VDQxyimVEB9q3ZIJ7bwLnQ7wkA4/d9dqR4lD8TkMi3LkElt0IG8QYZSREW NgGjrQWt0zIQM8Y5rBi3O9k3KW7XAxo8L8Jkm48NRyTFixPPEI1MapiwZg3NCNJU0i+t kG5+Lreofj9UXVzdsBjuWTruCSrnTWj2sqAOsMGbtF24YSwyPIDHwZyoUJzA+sFEH8hG pRttMa5aFlki9UNW6Umuhrzzvrm2i/mmQaSyVWDId3OMUZjq1gs8lJCphdCijaC9hjAb 2guw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=I13tSpMYy83dLyDCQBdqOqpPidN3cVq4Uw0Z3XP8dbI=; b=scInZomJo1H5o7JXVuHWHOD0yF6ugb6+p8L9hpZ0/vgZrXGs5uUDvriaAW1UqXFXS2 P2vCELObGHZz8Xy0ea/AePlGe66qA+lyvy+wBswj9+4yIOaFyHjKjSyVreu2tDNDEqWy d64eu0/DxE3JkHVuBiZM/RqX81vuLrDJy4GTqGc6Q5ncKmKWaI5TLgBRlI5QfZBPObx1 FtbxP+0T55CLoXu5uPJMzO8e01CMuaSEYIF1AGXHUMTuW5L0o+U5J1+pCMEGjoSuWWtv 7rU9cj8lfUmEPgFEYDHNpsgB2M+/9QMQgVJ5aS5Ew/Q8SIlYu8myynZhp1bLI0lmlIco ToSg== X-Gm-Message-State: AOAM532uj9MiwN80eCv+XFCLd5u/E01S699/PTnkAeutibwP9fOk7htd 9D+dCBrol5HJIIF7pcy8Kd+Yd7MgbKLcEg== X-Google-Smtp-Source: ABdhPJyEL+5U8+2BWloIMZ1hVFGptGjd5hB5/FRwjCPht7fz7b6aiLbHDLwgZBpkr7rgTKmy/f8G0Q== X-Received: by 2002:a63:d910:: with SMTP id r16mr3838787pgg.318.1628774361942; Thu, 12 Aug 2021 06:19:21 -0700 (PDT) Received: from C02D70YZMD6R.bytedance.net ([139.177.225.227]) by smtp.gmail.com with ESMTPSA id x24sm10273416pjk.43.2021.08.12.06.19.18 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 12 Aug 2021 06:19:21 -0700 (PDT) From: Zhihong Wang To: dev@dpdk.org, ferruh.yigit@intel.com, xiaoyun.li@intel.com, aman.deep.singh@intel.com, irusskikh@marvell.com, cchemparathy@tilera.com Cc: Zhihong Wang Date: Thu, 12 Aug 2021 21:19:01 +0800 Message-Id: <20210812131901.25665-5-wangzhihong.wzh@bytedance.com> X-Mailer: git-send-email 2.24.3 (Apple Git-128) In-Reply-To: <20210812131901.25665-1-wangzhihong.wzh@bytedance.com> References: <20210809062548.30187-1-wangzhihong.wzh@bytedance.com> <20210812131901.25665-1-wangzhihong.wzh@bytedance.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v4 4/4] app/testpmd: use per-core variable in flowgen X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 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" Use per-core variable for flow indexing to solve cache contention in multi-core scenarios. v4: use loop local variable to improve performance Signed-off-by: Zhihong Wang --- app/test-pmd/flowgen.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/test-pmd/flowgen.c b/app/test-pmd/flowgen.c index 229794ee9c..b541485304 100644 --- a/app/test-pmd/flowgen.c +++ b/app/test-pmd/flowgen.c @@ -53,6 +53,8 @@ static struct rte_ether_addr cfg_ether_dst = #define IP_DEFTTL 64 /* from RFC 1340. */ +RTE_DEFINE_PER_LCORE(int, _next_flow); + /* * Multi-flow generation mode. * @@ -80,7 +82,7 @@ pkt_burst_flow_gen(struct fwd_stream *fs) uint32_t retry; uint64_t tx_offloads; uint64_t start_tsc = 0; - static int next_flow = 0; + int next_flow = RTE_PER_LCORE(_next_flow); get_start_cycles(&start_tsc); @@ -193,6 +195,8 @@ pkt_burst_flow_gen(struct fwd_stream *fs) } while (++nb_tx < nb_pkt); } + RTE_PER_LCORE(_next_flow) = next_flow; + get_end_cycles(fs, start_tsc); } -- 2.11.0