From patchwork Fri Aug 13 08:05:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?546L5b+X5a6P?= X-Patchwork-Id: 96885 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id E8A17A0C4D; Fri, 13 Aug 2021 10:06:05 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id AB09D41241; Fri, 13 Aug 2021 10:06:01 +0200 (CEST) Received: from mail-pj1-f48.google.com (mail-pj1-f48.google.com [209.85.216.48]) by mails.dpdk.org (Postfix) with ESMTP id EEB2640140 for ; Fri, 13 Aug 2021 10:05:59 +0200 (CEST) Received: by mail-pj1-f48.google.com with SMTP id n13-20020a17090a4e0d00b0017946980d8dso589201pjh.5 for ; Fri, 13 Aug 2021 01:05:59 -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=r7RHV26C3r735V3oVI0qAiTkxvq1SKxK4MX+9GdzERc=; b=UcAi1nLIZE0EuVT6VL0Wgz8ImGlep7EWMZeLfzkuQhmsd1qcbUF1VM/teh5mSyEmxa oMsWFrGm/n3en4sWi14m8lBRwMHZT3AN641Yf/f8C3dFc912QyeQKxfpmYeb483xeg8e 5oNEssJNq0bPSMok4CYdRpQO5XAv4Cgt0ZcvwtQLClnuwbrID92YzvDO74o67FmrtAk1 zIa/Q0ppkDEv8BGY0yM3e4dv7Mea/FlIFupkS2MNcOGHVaWJyrmKRtB6qq6MMrvrkNJA T1e7m71RGrUrePbanUEWHMrR5PUfSKCNkMVrJawifVmXT52XV9dr0GW0nVycTs5qCG56 e2gA== 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=r7RHV26C3r735V3oVI0qAiTkxvq1SKxK4MX+9GdzERc=; b=uUQa2QSPOG5weykPxRo7THDD/HfZGZFMHJjGjfGTlPo0YqfZHgbvdgfWz0TvXSaJ+7 Yu0nRfVesMxDdiH9X32D5lCuow/jAXVOHEvcvFSfplBdEf0EqaWTfO2w6yxIuQeIOJAm 1i5CWvn6scAIP1y2qWyUO6ocRR3Ii9fHCCHprKgEjeYXBNan/V9Lk/8h/opqR477rr0i OUGSrZELi2+4oLz0uVHGRxzXmpkhRhEltqBahbqGTHcsdvCnL59bAP9vHzb6K4MYg/fb s0FOD+N9U6JdezXk79OG0Nwb1CyqZHaCQyiedPczB4sJgd8h9nZtvAPYs5yTdPm/0SKb 3NMQ== X-Gm-Message-State: AOAM531iGnAMdEigDo8Y/Cnt1CI17Cclbotpn8cfVk24OCrd8U3kwwGX nJxn7zgnJq9AvOTlpAYGeadcdSMYZQNu0Q== X-Google-Smtp-Source: ABdhPJzMIRR+4St19aqFnNbKfD6ElrX4l/Ktv4g4Sgcdpl4aN/URZlV7XcMDiKDbARXqqfHNMwDKwQ== X-Received: by 2002:a17:90a:de16:: with SMTP id m22mr1458107pjv.54.1628841958864; Fri, 13 Aug 2021 01:05:58 -0700 (PDT) Received: from C02D70YZMD6R.bytedance.net ([139.177.225.227]) by smtp.gmail.com with ESMTPSA id 17sm1118192pjd.3.2021.08.13.01.05.55 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 13 Aug 2021 01:05:58 -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 , stable@dpdk.org Date: Fri, 13 Aug 2021 16:05:45 +0800 Message-Id: <20210813080548.38637-2-wangzhihong.wzh@bytedance.com> X-Mailer: git-send-email 2.24.3 (Apple Git-128) In-Reply-To: <20210813080548.38637-1-wangzhihong.wzh@bytedance.com> References: <20210809062548.30187-1-wangzhihong.wzh@bytedance.com> <20210813080548.38637-1-wangzhihong.wzh@bytedance.com> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v5 1/4] app/testpmd: fix tx retry 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" Fix tx_pkt number in tx retry logic. Fixes: bf56fce1fb45 ("app/testpmd: add retry option") Cc: stable@dpdk.org Signed-off-by: Zhihong Wang Acked-by: Xiaoyun Li --- app/test-pmd/flowgen.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/test-pmd/flowgen.c b/app/test-pmd/flowgen.c index 3bf6e1ce97..f2e6255c36 100644 --- a/app/test-pmd/flowgen.c +++ b/app/test-pmd/flowgen.c @@ -192,12 +192,12 @@ pkt_burst_flow_gen(struct fwd_stream *fs) /* * Retry if necessary */ - if (unlikely(nb_tx < nb_rx) && fs->retry_enabled) { + if (unlikely(nb_tx < nb_pkt) && fs->retry_enabled) { retry = 0; - while (nb_tx < nb_rx && retry++ < burst_tx_retry_num) { + while (nb_tx < nb_pkt && retry++ < burst_tx_retry_num) { rte_delay_us(burst_tx_delay_time); nb_tx += rte_eth_tx_burst(fs->tx_port, fs->tx_queue, - &pkts_burst[nb_tx], nb_rx - nb_tx); + &pkts_burst[nb_tx], nb_pkt - nb_tx); } } fs->tx_packets += nb_tx; From patchwork Fri Aug 13 08:05:46 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?546L5b+X5a6P?= X-Patchwork-Id: 96886 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 518D5A0C4D; Fri, 13 Aug 2021 10:06:12 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 04AEA41249; Fri, 13 Aug 2021 10:06:04 +0200 (CEST) Received: from mail-pj1-f46.google.com (mail-pj1-f46.google.com [209.85.216.46]) by mails.dpdk.org (Postfix) with ESMTP id 8D16340140 for ; Fri, 13 Aug 2021 10:06:03 +0200 (CEST) Received: by mail-pj1-f46.google.com with SMTP id nt11so14207526pjb.2 for ; Fri, 13 Aug 2021 01:06:03 -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=4WkkGbrM9kTA3awyUAX53a5Faspeo7cNKAEaYZ117zk=; b=qL9pA4rxQqcj5LEO8BzTg+WGjPpcqmJEeAnO9CZgdfKsELEr7MhTIIxz3bYW/iwcDv F0EaM7yIWYdbOCX4yv/yY0i1WjDPQh3Ep1svjRXBJRXlV2EP6x26wo0IbJ6eCYksGV3u W27zyjs9vH4fWujXjNwnPs9flHI683q7g9PTX1qIl0bjiuettdI8EPE9QBGoSnruuhwm hK0wEO6idNLCO/sz50kTOuNaaUwtQ3c6uvnepIPs2EAoK9s/7QwcqP8hRbyoWvcGFusc TMuvkiOntbK+KSQNR5peC6SbxyGumsK2D7+yCx69pk8nvx5RBvx9OhhBbWoPieg/H2ZI HlLg== 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=4WkkGbrM9kTA3awyUAX53a5Faspeo7cNKAEaYZ117zk=; b=d7Y1LVMv/+DWZEKHZJzhDCMCLSEaK0HMMkYhLXhQev7rm1dII8Bn/ld9B+XM2LtCLU n69YzOgGQegf+jjxOSlkiAj6caONe9VJfT7QFwVQe6sgCknSu+o24rkTSEtL471pRpm1 L0ja93XjgPOtf1IXsny+JpeysDmqL1d0PkuHh2o6DjN8safkXUII2zW0r7cZzfa0KmyU tbAoQ6RQCPen4mQQj6e2f52aK4aG05h2NwPFSMLDtKOyUz9TRmWgQ3A+zZ8y8AjGHBdb eb6Y084o+0BNVc1xs/g5flB/msFG/aZzN9gJvxL5sgc963MQvWGvmTSmWVfViD1ziOK9 dGRA== X-Gm-Message-State: AOAM5327Y+ilYUuwYsCNKl3XbD7o58exuGBO84ba72VI0s2zp/82X/Hk omGbrp5jtfG8+H+tVIOKnVim5jZ0SIdtEQ== X-Google-Smtp-Source: ABdhPJxtytvHe1B1tfkmreck8jN0dmmdAN9wCiP4Wu00mL461OWDcuHiRWpLORFWYnLeyNtcZSwfrQ== X-Received: by 2002:a65:5186:: with SMTP id h6mr1293465pgq.62.1628841962481; Fri, 13 Aug 2021 01:06:02 -0700 (PDT) Received: from C02D70YZMD6R.bytedance.net ([139.177.225.227]) by smtp.gmail.com with ESMTPSA id 17sm1118192pjd.3.2021.08.13.01.05.59 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 13 Aug 2021 01:06:01 -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: Fri, 13 Aug 2021 16:05:46 +0800 Message-Id: <20210813080548.38637-3-wangzhihong.wzh@bytedance.com> X-Mailer: git-send-email 2.24.3 (Apple Git-128) In-Reply-To: <20210813080548.38637-1-wangzhihong.wzh@bytedance.com> References: <20210809062548.30187-1-wangzhihong.wzh@bytedance.com> <20210813080548.38637-1-wangzhihong.wzh@bytedance.com> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v5 2/4] app/testpmd: use rte_ipv4_cksum 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 the rte_ipv4_cksum API to replace local ip_sum implementation. Signed-off-by: Zhihong Wang Acked-by: Xiaoyun Li --- app/test-pmd/flowgen.c | 25 +------------------------ 1 file changed, 1 insertion(+), 24 deletions(-) diff --git a/app/test-pmd/flowgen.c b/app/test-pmd/flowgen.c index f2e6255c36..96d0cc79df 100644 --- a/app/test-pmd/flowgen.c +++ b/app/test-pmd/flowgen.c @@ -53,28 +53,6 @@ static struct rte_ether_addr cfg_ether_dst = #define IP_DEFTTL 64 /* from RFC 1340. */ -/* Use this type to inform GCC that ip_sum violates aliasing rules. */ -typedef unaligned_uint16_t alias_int16_t __attribute__((__may_alias__)); - -static inline uint16_t -ip_sum(const alias_int16_t *hdr, int hdr_len) -{ - uint32_t sum = 0; - - while (hdr_len > 1) - { - sum += *hdr++; - if (sum & 0x80000000) - sum = (sum & 0xFFFF) + (sum >> 16); - hdr_len -= 2; - } - - while (sum >> 16) - sum = (sum & 0xFFFF) + (sum >> 16); - - return ~sum; -} - /* * Multi-flow generation mode. * @@ -160,8 +138,7 @@ pkt_burst_flow_gen(struct fwd_stream *fs) next_flow); ip_hdr->total_length = RTE_CPU_TO_BE_16(pkt_size - sizeof(*eth_hdr)); - ip_hdr->hdr_checksum = ip_sum((const alias_int16_t *)ip_hdr, - sizeof(*ip_hdr)); + ip_hdr->hdr_checksum = rte_ipv4_cksum(ip_hdr); /* Initialize UDP header. */ udp_hdr = (struct rte_udp_hdr *)(ip_hdr + 1); From patchwork Fri Aug 13 08:05:47 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?546L5b+X5a6P?= X-Patchwork-Id: 96887 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 6CC20A0C4D; Fri, 13 Aug 2021 10:06:18 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4CB8B41252; Fri, 13 Aug 2021 10:06:08 +0200 (CEST) Received: from mail-pj1-f46.google.com (mail-pj1-f46.google.com [209.85.216.46]) by mails.dpdk.org (Postfix) with ESMTP id 693F14123B for ; Fri, 13 Aug 2021 10:06:07 +0200 (CEST) Received: by mail-pj1-f46.google.com with SMTP id w13-20020a17090aea0db029017897a5f7bcso14862280pjy.5 for ; Fri, 13 Aug 2021 01:06:07 -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=xi7LfBKYdu+SkjmKDAy1O6SSZv80HnjO+DCqWdDYMaA=; b=J4gOrbQIwg+VWxMZHT87zKmuMRd7wUK+C17/fBiUSSseG8s36J8gwnj1LUmwdkxf/k LB0l50JokcohOIID5bOkjmwnicPquWjozI4xH9m3whcgVUs9YO6A5ctvU7l2qj4zL0Ae 83ws4vqtxyhQGX95PUilD8D3pvxhjTtoSsmV6WPlTb5kF0Dbb3GJAOS5VlVvNyXgVCSN QDmqb3XDY4eHZa2QEXNVedRtAoE7I0QdMUwDDqS+IGI9QEhMlbAcj2fsliZ8vB7/b44T 8MWjgpZzaucjEcW8UXDuc2ElB/5zrXp7HNUNXocqO0kEJeNhDElzddrFvWbraEYuGpkC lDXw== 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=xi7LfBKYdu+SkjmKDAy1O6SSZv80HnjO+DCqWdDYMaA=; b=Hx/6CiZTuN0WmvUaKniVNSzajZqVOb/4ZDj/4jI8JZG1iYeD2INJVILRele7alu60e /qqafYWj/4ga4KXzMaQTAA0IYP0E9YdSO9CqgjvX0DajN4PlKv2HTsPM6gLQY+k3GYM8 Zyr5cgw1opooAHBSlaPu/SQQ5InIWGjQAWXeZ6+fgZQo6n5GW/HN3KO6ay8y+vKKaj4x 6drwrtgI+DQvGfDf0IfnigOAy7BpSx4ziU9yJJ3uJjJwmThWXdpJFR3POOxHM47s8DU/ cXh9YQ32RUBcid83caHwA/ZvTJEai/yk9XWXl0AUQ8KiIsZd+QBTjcEBjw+H/YcGGSdC 9pRg== X-Gm-Message-State: AOAM533jADtRtytIcRSrXMR+izF4AhGiIVytOY09hqK2xvF9ReW/BvR4 rZyKsaw/gKhulfbc2gJYkXSbB2KtEEENoA== X-Google-Smtp-Source: ABdhPJzlR79JyYgHA5I8OxFlQjEksQVYe7jJWiT6k55felnEagsEyejpY2tgi4v9Vs62B8JdU88gog== X-Received: by 2002:a63:e00b:: with SMTP id e11mr1311115pgh.190.1628841966422; Fri, 13 Aug 2021 01:06:06 -0700 (PDT) Received: from C02D70YZMD6R.bytedance.net ([139.177.225.227]) by smtp.gmail.com with ESMTPSA id 17sm1118192pjd.3.2021.08.13.01.06.02 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 13 Aug 2021 01:06:05 -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: Fri, 13 Aug 2021 16:05:47 +0800 Message-Id: <20210813080548.38637-4-wangzhihong.wzh@bytedance.com> X-Mailer: git-send-email 2.24.3 (Apple Git-128) In-Reply-To: <20210813080548.38637-1-wangzhihong.wzh@bytedance.com> References: <20210809062548.30187-1-wangzhihong.wzh@bytedance.com> <20210813080548.38637-1-wangzhihong.wzh@bytedance.com> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v5 3/4] app/testpmd: record rx_burst and fwd_dropped 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" Call inc_rx_burst_stats for rx operation, and record fwd_dropped. Signed-off-by: Zhihong Wang Acked-by: Xiaoyun Li --- app/test-pmd/flowgen.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/test-pmd/flowgen.c b/app/test-pmd/flowgen.c index 96d0cc79df..229794ee9c 100644 --- a/app/test-pmd/flowgen.c +++ b/app/test-pmd/flowgen.c @@ -87,6 +87,7 @@ pkt_burst_flow_gen(struct fwd_stream *fs) /* Receive a burst of packets and discard them. */ nb_rx = rte_eth_rx_burst(fs->rx_port, fs->rx_queue, pkts_burst, nb_pkt_per_burst); + inc_rx_burst_stats(fs, nb_rx); fs->rx_packets += nb_rx; for (i = 0; i < nb_rx; i++) @@ -186,6 +187,7 @@ pkt_burst_flow_gen(struct fwd_stream *fs) while (next_flow < 0) next_flow += cfg_n_flows; + fs->fwd_dropped += nb_pkt - nb_tx; do { rte_pktmbuf_free(pkts_burst[nb_tx]); } while (++nb_tx < nb_pkt); From patchwork Fri Aug 13 08:05:48 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?546L5b+X5a6P?= X-Patchwork-Id: 96888 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id CE2A8A0C4D; Fri, 13 Aug 2021 10:06:24 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C7E3E40DF4; Fri, 13 Aug 2021 10:06:12 +0200 (CEST) Received: from mail-pj1-f51.google.com (mail-pj1-f51.google.com [209.85.216.51]) by mails.dpdk.org (Postfix) with ESMTP id 3076740140 for ; Fri, 13 Aug 2021 10:06:11 +0200 (CEST) Received: by mail-pj1-f51.google.com with SMTP id n13-20020a17090a4e0d00b0017946980d8dso589690pjh.5 for ; Fri, 13 Aug 2021 01:06:11 -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=6GemkUaa0vlWs1s4rI5ZT/10n8WuoFezQYnYqnEzzJo=; b=azXEJ3F/4fhPC4e+Cw98q/LNnub3arNJA+rMcuFL1KQQ8LuzQPC61Svmhbxo4Bj4t5 w68WuoVavC45nC6+xN1KNH8VJ/DAZLQ1tGOURW9PgcovNHTi7kwGzIa4qUmN+4T0Gdj/ HmvBSdxlRiEihQPzZ6MllX+lii0MKKRvZi1uc8SIvZfR17yoERL2BuXopU9Kj3mUTwPe uWX2GKoOnWD9/iZ2pmtxCeaoOtsFDfhmEKNBQXGfOc14TIhV4mQqLXZD8hIaz/vrJGmJ 9Zln8ZJ6y65hrZyzots4f96EfRlHkS3+tEc6HcOLpBoaKrTT7/uxy7PrFIuVLAvTaJ3c uNaw== 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=6GemkUaa0vlWs1s4rI5ZT/10n8WuoFezQYnYqnEzzJo=; b=nbrY7g1WZ8Jz7Afy3W2IXcZs7YNhJTB2rhFXP/6ksqrrIX6HByoB2tx2WmqQpTOgdA trGoXw4qE/VfeUPJVKT34gwCheqoWxp6I4WsWQiKkPDNMV9AIBzF98FNDJsyl4QCi8lU M7cJUQgjOBfTU90y2EYUGRcCOvGYcP0OcxTUy9ym8OwtyF/7f/JwUx105r9Plf/laQ60 Xwm4W9L2T1cM1AvkmEfADLZzWJ0kdTdCQZyRDcGcK2Jlj0xa+SW5+X7lJF5426FAYT6t 0JvB1TGp9e8vGLMD073p13ou4k3GNrLEz+TDtArFlxEMV/jEHcWXUGd+6df8xxHqznuF q5MQ== X-Gm-Message-State: AOAM533UsAJCSnBEjiU5MfCSKzC8+ScvjXP7XN/LBE3lq61JsOeTWNKY qPFxKPdtcVR3G3OYgPq7vitZs4IwHO3+Vg== X-Google-Smtp-Source: ABdhPJzzxDMNhklRdR2DOEfFK1L5RLfh4DYygG38IixDKtY6awoQP4IlafHvsKLHaMPBb1KDHfSDrQ== X-Received: by 2002:a63:5901:: with SMTP id n1mr1254494pgb.378.1628841970140; Fri, 13 Aug 2021 01:06:10 -0700 (PDT) Received: from C02D70YZMD6R.bytedance.net ([139.177.225.227]) by smtp.gmail.com with ESMTPSA id 17sm1118192pjd.3.2021.08.13.01.06.06 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 13 Aug 2021 01:06:09 -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: Fri, 13 Aug 2021 16:05:48 +0800 Message-Id: <20210813080548.38637-5-wangzhihong.wzh@bytedance.com> X-Mailer: git-send-email 2.24.3 (Apple Git-128) In-Reply-To: <20210813080548.38637-1-wangzhihong.wzh@bytedance.com> References: <20210809062548.30187-1-wangzhihong.wzh@bytedance.com> <20210813080548.38637-1-wangzhihong.wzh@bytedance.com> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v5 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. Signed-off-by: Zhihong Wang Acked-by: Xiaoyun Li --- v5: replace modulo operation to improve performance v4: use loop local variable to improve performance app/test-pmd/flowgen.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/app/test-pmd/flowgen.c b/app/test-pmd/flowgen.c index 229794ee9c..9348618d0f 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); @@ -163,7 +165,8 @@ pkt_burst_flow_gen(struct fwd_stream *fs) } pkts_burst[nb_pkt] = pkt; - next_flow = (next_flow + 1) % cfg_n_flows; + if (++next_flow >= (int)cfg_n_flows) + next_flow = 0; } nb_tx = rte_eth_tx_burst(fs->tx_port, fs->tx_queue, pkts_burst, nb_pkt); @@ -193,6 +196,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); }