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 DFA7EA0C46; Fri, 17 Sep 2021 10:03:14 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A52E1410EF; Fri, 17 Sep 2021 10:03:07 +0200 (CEST) Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2085.outbound.protection.outlook.com [40.107.237.85]) by mails.dpdk.org (Postfix) with ESMTP id 3C5ED410EA for ; Fri, 17 Sep 2021 10:03:06 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EH8J9zNi+h3ZJ8BtWfoU9VpAQiVJQh8XpCR/55Ov7cVffdO17nSl/0J5aVpnRHI/KMqIVKm1Atfaw7kNejZey7+yq2VIuL9yT756qvfh+po3iUJnMHFEWl8QMEWC67Arop9Ckp0nWIfq9r+k2s+53WyK1aZNtReWlc+ybHNrOljRjd/891do49JMxL4R45vZ3c+//AnBcCe6fn/MFXaUe2bcGiQbf3qODBJicaAod4k0pyYRN1pej0UIPKm8/mWPiE+vDppo5qtpW+1XWAeVEqB+e+WwNe9JQx453AikVGb4qU8OSCxSJTMGihe4ENrtXsL5vry/adUyj1vAqwkhEg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=2+NteC9+JFGyCgW2bzwjaQu4JMbiCksdu3nbfGWBrzI=; b=eVbKKRuKAr8UMtk4q/p1j1zZ7swTfayzYPX7yN5b4NR3xkQ0/KtxD+tU7NtIWk0HkcwOhEtzpQKLThzxz1MBlcGLXSCHT/lwtp5e19MjGAFfGiRUhRvAQNkrrv7kXGzp6XdFQq2E1akMjOLJI6A18Dd7W4AfgBFCE9joxdCbNGT76scMgEe/DNncDmiHBkr+QMcDpgFq5ET5n0q+eYjED+cxZEjFzCyawuwppXMRpzwWzL94lB4G9zeiduHJULRoZIm20eP4xY5g9DCPedXYQXcs3ezicRIBv0TnJiijUnE969npI7LDl9abZmVIcwW1oKtl6Cpwr3YHd9GU2CG9og== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.32) smtp.rcpttodomain=dpdk.org smtp.mailfrom=nvidia.com; dmarc=pass (p=quarantine sp=none pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=2+NteC9+JFGyCgW2bzwjaQu4JMbiCksdu3nbfGWBrzI=; b=VXoc1R5RX9d4zPxLfZ7dt6WXptGoVwbMWIFRBX3G5aAgpPsqn0NrIF4bJPYJKZ/d0T6i6J35gpSYsNEY5GuuBusuAjapqD+yRcapScxO4pdHs/82lzEmI4tXzphspIHdsR9gpLpjGap7jmxJqMvyk3/dyIESdJ7tMFFjJZ8SG1aKkQzMk1EXsr0G6kg5eLbtGETg/xYPBIVtC9D586ErRMJFlwsofeyMOD1d7woTUt0XFIu2k1LaU+QZmUqLCBVusxvnGrlxiek9Wew9pL+bdDCGR4Q5bx/x9/ioaXXgyRe6aTFaKmofT+BfEH6vrCv1cp48dELJvC7dnNo4gfXSEA== Received: from DM5PR07CA0106.namprd07.prod.outlook.com (2603:10b6:4:ae::35) by BN6PR12MB1828.namprd12.prod.outlook.com (2603:10b6:404:108::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4523.16; Fri, 17 Sep 2021 08:03:03 +0000 Received: from DM6NAM11FT030.eop-nam11.prod.protection.outlook.com (2603:10b6:4:ae:cafe::1b) by DM5PR07CA0106.outlook.office365.com (2603:10b6:4:ae::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4523.14 via Frontend Transport; Fri, 17 Sep 2021 08:03:02 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.32) smtp.mailfrom=nvidia.com; dpdk.org; dkim=none (message not signed) header.d=none;dpdk.org; dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.112.32 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.112.32; helo=mail.nvidia.com; Received: from mail.nvidia.com (216.228.112.32) by DM6NAM11FT030.mail.protection.outlook.com (10.13.172.146) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4523.14 via Frontend Transport; Fri, 17 Sep 2021 08:03:02 +0000 Received: from DRHQMAIL107.nvidia.com (10.27.9.16) by HQMAIL109.nvidia.com (172.20.187.15) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Fri, 17 Sep 2021 01:03:02 -0700 Received: from nvidia.com (172.20.187.6) by DRHQMAIL107.nvidia.com (10.27.9.16) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Fri, 17 Sep 2021 08:02:59 +0000 From: Xueming Li To: CC: , Jerin Jacob , Ferruh Yigit , Andrew Rybchenko , Viacheslav Ovsiienko , Thomas Monjalon , Lior Margalit , Xiaoyun Li Date: Fri, 17 Sep 2021 16:01:20 +0800 Message-ID: <20210917080121.329373-8-xuemingl@nvidia.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210917080121.329373-1-xuemingl@nvidia.com> References: <20210727034204.20649-1-xuemingl@nvidia.com> <20210917080121.329373-1-xuemingl@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [172.20.187.6] X-ClientProxiedBy: HQMAIL101.nvidia.com (172.20.187.10) To DRHQMAIL107.nvidia.com (10.27.9.16) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 764e512e-2695-442c-ce5b-08d979b192cd X-MS-TrafficTypeDiagnostic: BN6PR12MB1828: X-LD-Processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4502; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: QJtmtTuDThVZ69Au8j/9vDg6AHM3nUByA+E4QKkwkbn0klARwwiNqKDYzNJT9rFPsGdJ/jOS9OEqIY1026pT6ZP7GsEzLETxk4Yoo1BtDcq2S1DprOFmucoz1hvVg0Xr8p4ZieimiVwmXJNbNpTQ4RdcCUl5TRdS0ZoIVeZovC8hTd9M8lLhixaYS1adbH7MPdQ6UPgkimi/4AbhidbSVWikhMuPUM02LMG78noaIVbj/iB3POHpr/1fAp6u+xc9U5KRdOH8d6+gfUBzIvrpWtgT+XSGTUcmFM8jJquTi3gA1psXI5AaDRKvIhZglAgp0rwuS+dQCvMsxdZ53blIqcK64bcaoqfCfIdZuRUFEAMthBJlM+1+irhMQiuOmUTusxagx1ZgQnFZppWvWqsiE4iNhxr1NIl4Ik7u6pJa1A+EAiqRPIiQtE7e53XQXua8Nxbb3O2xUbgYcNBB6eqw4MriU0pdIw5bs1T7vOqUctwNTKs4wQMH0bhLdyZOQLZu1CMyxRjbdNHTPmsGBpRMJA/YYgBJj1w+k6f2RTKYoeEGlZJBR7k7mD/XRXsHFCDyYzq1iuWdTWEbIhtTKr08gXWZrOT4ssL6xjsvb4SP/MuiKz3uPUNe2faiTT+NUGir7PizJTBDcy24vyUdjSUAB+rbPqbpAc1Q28lCkK6P1NveDv43PfzY3B/vU1c63O2fkNUgYEm3l+rLAY490km+fCGMhZQ1WvWgKiRUMm6b21M= X-Forefront-Antispam-Report: CIP:216.228.112.32; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:schybrid01.nvidia.com; CAT:NONE; SFS:(4636009)(36840700001)(46966006)(6916009)(26005)(86362001)(16526019)(186003)(6666004)(70206006)(8676002)(336012)(36860700001)(36756003)(508600001)(5660300002)(1076003)(82310400003)(47076005)(54906003)(8936002)(7636003)(7696005)(83380400001)(4326008)(2906002)(356005)(55016002)(426003)(6286002)(2616005)(70586007)(316002)(309714004); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Sep 2021 08:03:02.7470 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 764e512e-2695-442c-ce5b-08d979b192cd X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.112.32]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT030.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR12MB1828 Subject: [dpdk-dev] [PATCH v3 7/8] app/testpmd: improve forwarding cache miss 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" To minimize cache miss, adds flags and burst size used in forwarding to stream, moves condition tests in forwarding to flags in stream. Signed-off-by: Xueming Li --- app/test-pmd/config.c | 18 ++++++++++++++---- app/test-pmd/flowgen.c | 6 +++--- app/test-pmd/noisy_vnf.c | 2 +- app/test-pmd/testpmd.h | 21 ++++++++++++--------- app/test-pmd/txonly.c | 8 ++++---- 5 files changed, 34 insertions(+), 21 deletions(-) diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index 035247c33f..5cdf8fa082 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -3050,6 +3050,16 @@ fwd_topology_tx_port_get(portid_t rxp) } } +static void +fwd_stream_set_common(struct fwd_stream *fs) +{ + fs->nb_pkt_per_burst = nb_pkt_per_burst; + fs->record_burst_stats = !!record_burst_stats; + fs->record_core_cycles = !!record_core_cycles; + fs->retry_enabled = !!retry_enabled; + fs->rxq_share = !!rxq_share; +} + static void simple_fwd_config_setup(void) { @@ -3079,7 +3089,7 @@ simple_fwd_config_setup(void) fwd_ports_ids[fwd_topology_tx_port_get(i)]; fwd_streams[i]->tx_queue = 0; fwd_streams[i]->peer_addr = fwd_streams[i]->tx_port; - fwd_streams[i]->retry_enabled = retry_enabled; + fwd_stream_set_common(fwd_streams[i]); } } @@ -3140,7 +3150,7 @@ rss_fwd_config_setup(void) fs->tx_port = fwd_ports_ids[txp]; fs->tx_queue = rxq; fs->peer_addr = fs->tx_port; - fs->retry_enabled = retry_enabled; + fwd_stream_set_common(fs); rxp++; if (rxp < nb_fwd_ports) continue; @@ -3255,7 +3265,7 @@ dcb_fwd_config_setup(void) fs->tx_port = fwd_ports_ids[txp]; fs->tx_queue = txq + j % nb_tx_queue; fs->peer_addr = fs->tx_port; - fs->retry_enabled = retry_enabled; + fwd_stream_set_common(fs); } fwd_lcores[lc_id]->stream_nb += rxp_dcb_info.tc_queue.tc_rxq[i][tc].nb_queue; @@ -3326,7 +3336,7 @@ icmp_echo_config_setup(void) fs->tx_port = fs->rx_port; fs->tx_queue = rxq; fs->peer_addr = fs->tx_port; - fs->retry_enabled = retry_enabled; + fwd_stream_set_common(fs); if (verbose_level > 0) printf(" stream=%d port=%d rxq=%d txq=%d\n", sm_id, fs->rx_port, fs->rx_queue, diff --git a/app/test-pmd/flowgen.c b/app/test-pmd/flowgen.c index aa45948b4c..c282f3bcb1 100644 --- a/app/test-pmd/flowgen.c +++ b/app/test-pmd/flowgen.c @@ -97,12 +97,12 @@ flow_gen_stream(struct fwd_stream *fs, uint16_t nb_rx, if (tx_offloads & DEV_TX_OFFLOAD_MACSEC_INSERT) ol_flags |= PKT_TX_MACSEC; - for (nb_pkt = 0; nb_pkt < nb_pkt_per_burst; nb_pkt++) { + for (nb_pkt = 0; nb_pkt < fs->nb_pkt_per_burst; nb_pkt++) { if (!nb_pkt || !nb_clones) { nb_clones = nb_pkt_flowgen_clones; /* Logic limitation */ - if (nb_clones > nb_pkt_per_burst) - nb_clones = nb_pkt_per_burst; + if (nb_clones > fs->nb_pkt_per_burst) + nb_clones = fs->nb_pkt_per_burst; pkt = rte_mbuf_raw_alloc(mbp); if (!pkt) diff --git a/app/test-pmd/noisy_vnf.c b/app/test-pmd/noisy_vnf.c index 382a4c2aae..56bf6a4e70 100644 --- a/app/test-pmd/noisy_vnf.c +++ b/app/test-pmd/noisy_vnf.c @@ -153,7 +153,7 @@ pkt_burst_noisy_vnf(struct fwd_stream *fs) uint64_t now; nb_rx = rte_eth_rx_burst(fs->rx_port, fs->rx_queue, - pkts_burst, nb_pkt_per_burst); + pkts_burst, fs->nb_pkt_per_burst); inc_rx_burst_stats(fs, nb_rx); if (unlikely(nb_rx == 0)) goto flush; diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h index 4792bef03b..3b8796a7a5 100644 --- a/app/test-pmd/testpmd.h +++ b/app/test-pmd/testpmd.h @@ -128,12 +128,17 @@ struct fwd_stream { queueid_t tx_queue; /**< TX queue to send forwarded packets */ streamid_t peer_addr; /**< index of peer ethernet address of packets */ - unsigned int retry_enabled; + uint16_t nb_pkt_per_burst; + unsigned int record_burst_stats:1; + unsigned int record_core_cycles:1; + unsigned int retry_enabled:1; + unsigned int rxq_share:1; /* "read-write" results */ uint64_t rx_packets; /**< received packets */ uint64_t tx_packets; /**< received packets transmitted */ uint64_t fwd_dropped; /**< received packets not forwarded */ + uint64_t core_cycles; /**< used for RX and TX processing */ uint64_t rx_bad_ip_csum ; /**< received packets has bad ip checksum */ uint64_t rx_bad_l4_csum ; /**< received packets has bad l4 checksum */ uint64_t rx_bad_outer_l4_csum; @@ -141,7 +146,6 @@ struct fwd_stream { uint64_t rx_bad_outer_ip_csum; /**< received packets having bad outer ip checksum */ unsigned int gro_times; /**< GRO operation times */ - uint64_t core_cycles; /**< used for RX and TX processing */ struct pkt_burst_stats rx_burst_stats; struct pkt_burst_stats tx_burst_stats; struct fwd_lcore *lcore; /**< Lcore being scheduled. */ @@ -750,28 +754,27 @@ port_pci_reg_write(struct rte_port *port, uint32_t reg_off, uint32_t reg_v) static inline void get_start_cycles(uint64_t *start_tsc) { - if (record_core_cycles) - *start_tsc = rte_rdtsc(); + *start_tsc = rte_rdtsc(); } static inline void get_end_cycles(struct fwd_stream *fs, uint64_t start_tsc) { - if (record_core_cycles) + if (unlikely(fs->record_core_cycles)) fs->core_cycles += rte_rdtsc() - start_tsc; } static inline void inc_rx_burst_stats(struct fwd_stream *fs, uint16_t nb_rx) { - if (record_burst_stats) + if (unlikely(fs->record_burst_stats)) fs->rx_burst_stats.pkt_burst_spread[nb_rx]++; } static inline void inc_tx_burst_stats(struct fwd_stream *fs, uint16_t nb_tx) { - if (record_burst_stats) + if (unlikely(fs->record_burst_stats)) fs->tx_burst_stats.pkt_burst_spread[nb_tx]++; } @@ -1032,13 +1035,13 @@ int update_jumbo_frame_offload(portid_t portid); static void \ pkt_burst_fwd(struct fwd_stream *fs) \ { \ - struct rte_mbuf *pkts_burst[nb_pkt_per_burst]; \ + struct rte_mbuf *pkts_burst[fs->nb_pkt_per_burst]; \ uint16_t nb_rx; \ uint64_t start_tsc = 0; \ \ get_start_cycles(&start_tsc); \ nb_rx = rte_eth_rx_burst(fs->rx_port, fs->rx_queue, \ - pkts_burst, nb_pkt_per_burst); \ + pkts_burst, fs->nb_pkt_per_burst); \ inc_rx_burst_stats(fs, nb_rx); \ if (unlikely(nb_rx == 0)) \ return; \ diff --git a/app/test-pmd/txonly.c b/app/test-pmd/txonly.c index aed820f5d3..db6130421c 100644 --- a/app/test-pmd/txonly.c +++ b/app/test-pmd/txonly.c @@ -367,8 +367,8 @@ pkt_burst_transmit(struct fwd_stream *fs) eth_hdr.ether_type = rte_cpu_to_be_16(RTE_ETHER_TYPE_IPV4); if (rte_mempool_get_bulk(mbp, (void **)pkts_burst, - nb_pkt_per_burst) == 0) { - for (nb_pkt = 0; nb_pkt < nb_pkt_per_burst; nb_pkt++) { + fs->nb_pkt_per_burst) == 0) { + for (nb_pkt = 0; nb_pkt < fs->nb_pkt_per_burst; nb_pkt++) { if (unlikely(!pkt_burst_prepare(pkts_burst[nb_pkt], mbp, ð_hdr, vlan_tci, vlan_tci_outer, @@ -376,12 +376,12 @@ pkt_burst_transmit(struct fwd_stream *fs) nb_pkt, fs))) { rte_mempool_put_bulk(mbp, (void **)&pkts_burst[nb_pkt], - nb_pkt_per_burst - nb_pkt); + fs->nb_pkt_per_burst - nb_pkt); break; } } } else { - for (nb_pkt = 0; nb_pkt < nb_pkt_per_burst; nb_pkt++) { + for (nb_pkt = 0; nb_pkt < fs->nb_pkt_per_burst; nb_pkt++) { pkt = rte_mbuf_raw_alloc(mbp); if (pkt == NULL) break; -- 2.33.0