From patchwork Tue Nov 23 16:32:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Slava Ovsiienko X-Patchwork-Id: 104619 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 E249FA0C4C; Tue, 23 Nov 2021 17:33:18 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5AD9040E0F; Tue, 23 Nov 2021 17:33:18 +0100 (CET) Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2054.outbound.protection.outlook.com [40.107.244.54]) by mails.dpdk.org (Postfix) with ESMTP id 931354003C; Tue, 23 Nov 2021 17:33:16 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=iQ2evMOI3OPt7CU7Fb86uivvkPHuT0HFAWclJytRYs0V+RWWT+Lxo1XvDvaeOvLJQRU9GqTeYEYCup0DH3Y1aZikYT3BI5BJPXaADNkGfBiW7nR1n2eADkSF/OVnmFqkSiUJagU4zm8Czp6B8Ho8q+Am1g5jupxphyhPFH/hhDwgRrLaAdGUH7oTL01xSD6+Zbt8JG65fpWUE9o8O93w88hQ9iRFbIhhVby3gqMAVTjTJ6qKtYzU8UF3E3Rof+AXNq48xJidDBoBFhxNgun93tMbmowVyF4VYv5MUoBj/C0gBqInCe4PCrCyNW+dZLW3an/Be8K087VXVTWDkVYYfw== 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:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=qXpr926/dbie09APVDSTWQlNCXMXdXZM65GuHNCaFSc=; b=NJvhlZC9oXoe/Ms3lAP2LzwoPfLQDwwgz+L6BQ3I5oG0YpvtkgC1cMKS9xAA/MBIOZdheNb36qSraydPW4O0mcpRs6PGS6qHO1vjBfX4HJ06EFIRoYGX+vSSwXl4BNEJvWlbw8MR/wKYALoAG3enaeJooidFu2psV9GxQ1UK3YgJMhSfyCTcbHYlcERMIa3SLDc5x0kTTAxjMoeY9xUPrEobSrDKqjPcCIyFqV5Xkwtp7ZMlfM48rReDheZWrjtOIOvOSOPDUIfwVO96bohvRMqFapYXCzeEln7Qgm3/iDklTzBSdR0A9o4Yg8kuaE8kAnCOORU95sflF0NMv4nFIw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.34) smtp.rcpttodomain=dpdk.org smtp.mailfrom=nvidia.com; dmarc=pass (p=quarantine sp=quarantine 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=qXpr926/dbie09APVDSTWQlNCXMXdXZM65GuHNCaFSc=; b=MGSQa8wszyrWTmCdbAG1TD3KRymGdsKF7/SsPdNKAS9QSC1EUqKZs3j27XErqES+d6YNi7aogsI0r79MI8FTPqvOYIUIWpQ1BQmIa8iiM40PkIkl/VFFKzRfB8MpAnzckvS39IE5aU72S2xB/e+xQl4sMDHzZg/KzFjuo9KcA0MkW2rk1S/q81wohL7xtJjL09EMLhYHzQFekRXU1Lyk8/IZF+YbmF7IUiZxdOJ2062GjpICD91tpg+ZueWWiPB67FNcxVimu+t2NSKilXJF9enAGuNIyluEkGmgSMeB1TjUDt9vJzWeeh8Q9dZBoJmigImhpBbRv1OBr4Exi0CBzg== Received: from MW4PR04CA0157.namprd04.prod.outlook.com (2603:10b6:303:85::12) by DM6PR12MB3466.namprd12.prod.outlook.com (2603:10b6:5:3b::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4734.20; Tue, 23 Nov 2021 16:33:14 +0000 Received: from CO1NAM11FT064.eop-nam11.prod.protection.outlook.com (2603:10b6:303:85:cafe::86) by MW4PR04CA0157.outlook.office365.com (2603:10b6:303:85::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4713.22 via Frontend Transport; Tue, 23 Nov 2021 16:33:14 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.34) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.112.34 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.112.34; helo=mail.nvidia.com; Received: from mail.nvidia.com (216.228.112.34) by CO1NAM11FT064.mail.protection.outlook.com (10.13.175.77) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4713.20 via Frontend Transport; Tue, 23 Nov 2021 16:33:14 +0000 Received: from nvidia.com (172.20.187.6) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Tue, 23 Nov 2021 16:33:11 +0000 From: Viacheslav Ovsiienko To: CC: , , , Subject: [PATCH] app/testpmd: fix scheduling send burst interval Date: Tue, 23 Nov 2021 18:32:58 +0200 Message-ID: <20211123163258.14972-1-viacheslavo@nvidia.com> X-Mailer: git-send-email 2.18.1 MIME-Version: 1.0 X-Originating-IP: [172.20.187.6] X-ClientProxiedBy: HQMAIL107.nvidia.com (172.20.187.13) To HQMAIL107.nvidia.com (172.20.187.13) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 6089d0e5-be9d-4e56-9b72-08d9ae9ef25e X-MS-TrafficTypeDiagnostic: DM6PR12MB3466: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8273; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: jmSqixLw0Mr/JFBaRXwEOXzjQa2SnDQJYqqRqVWBdv8bBoex/+bdo2StWzXY8T83LhYEOOz2nbEnTfCWdXfWqJQ9/xlkPdILPTQXeQnSguVO26Chs+OEwX7pTeypfcQW+uZ3+9YH7ZWQs3XZ7Pa87kMdU+DBNtmmYuQjKzLk7iJ6j8nB2aMCV3zFvyVUSet48pUzN2HZpMBW3/SS7nlEWpGmzIizyBnz1wlxj3ibrYQOJvXtxbfz3dpUdcHCEFRb8GewgVUKRfp1/1kvVcEdt8khIkdZvNmMtWy+Zf3Mq7/f5HJoaowQxMce1UwLgCKZNRZgc/PQDz8Q1Kn2mUwWQf+2JUbZks/QjZabb6cgkttetrGNM6MRsfiF/ixatj06wYm2EleVd9CH629LwDlGQCZ7dmlSu/JPctYpfTdI+4pmI/Pq7urmYzTeQshsdYeajn04P910vOujmlby4CUihb40WWPajb0q1BOQcOpyakqwQrbziqFnnvhZ/N9XQr8f5qfsURDp98UhAJFp8QsS4N1dii62OtVCISPRH6gCY//7FPKqCzcFM1u33JNMuVIpl9zdQCRF88hZN+R5wl8ga3hN1VK202+l6Td1PuddzvH46YJ4w9Gftz+GRyKtVVVwvQmFrDT3xcyeTZZAiHK0muBpDeBwXxLJraToO+tJ5rk0hso9dtcgZs1SrXjJSmxA6WREaqNpJPDfNTWwc76lZg== X-Forefront-Antispam-Report: CIP:216.228.112.34; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:schybrid03.nvidia.com; CAT:NONE; SFS:(4636009)(46966006)(36840700001)(2616005)(316002)(2906002)(356005)(7636003)(8676002)(8936002)(7696005)(6916009)(55016003)(186003)(6666004)(16526019)(1076003)(26005)(47076005)(6286002)(54906003)(426003)(70586007)(336012)(508600001)(36756003)(82310400004)(86362001)(5660300002)(4326008)(70206006)(83380400001)(36860700001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Nov 2021 16:33:14.2958 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6089d0e5-be9d-4e56-9b72-08d9ae9ef25e 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.34]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT064.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB3466 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 The first "set txtimes" command parameter specifies the time interval between scheduled send bursts for single queue. This interval should be the same for all the forwarding ports. It requires to maintain the timing related variables on per queue basis instead of per core, as currently implemented. This resulted in wrong burst intervals if two or more cores were generating the scheduled traffic for two or more ports in txonly mode. This patch moves the timing variable to the fstream structure. Only txonly forwarding mode with enabled send scheduling is affected. Fixes: 4940344dab1d ("app/testpmd: add Tx scheduling command") Cc: stable@dpdk.org Signed-off-by: Viacheslav Ovsiienko Acked-by: Ferruh Yigit --- app/test-pmd/testpmd.h | 1 + app/test-pmd/txonly.c | 20 ++++++-------------- 2 files changed, 7 insertions(+), 14 deletions(-) diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h index 2149ecd93a..9967825044 100644 --- a/app/test-pmd/testpmd.h +++ b/app/test-pmd/testpmd.h @@ -147,6 +147,7 @@ struct fwd_stream { /**< received packets has bad outer l4 checksum */ uint64_t rx_bad_outer_ip_csum; /**< received packets having bad outer ip checksum */ + uint64_t ts_skew; /**< TX scheduling timestamp */ #ifdef RTE_LIB_GRO unsigned int gro_times; /**< GRO operation times */ #endif diff --git a/app/test-pmd/txonly.c b/app/test-pmd/txonly.c index b8497e733d..c53c4e7eae 100644 --- a/app/test-pmd/txonly.c +++ b/app/test-pmd/txonly.c @@ -59,14 +59,10 @@ uint32_t tx_ip_dst_addr = (198U << 24) | (18 << 16) | (0 << 8) | 2; static struct rte_ipv4_hdr pkt_ip_hdr; /**< IP header of transmitted packets. */ RTE_DEFINE_PER_LCORE(uint8_t, _ip_var); /**< IP address variation */ static struct rte_udp_hdr pkt_udp_hdr; /**< UDP header of tx packets. */ -RTE_DEFINE_PER_LCORE(uint64_t, timestamp_qskew); - /**< Timestamp offset per queue */ -RTE_DEFINE_PER_LCORE(uint32_t, timestamp_idone); /**< Timestamp init done. */ static uint64_t timestamp_mask; /**< Timestamp dynamic flag mask */ static int32_t timestamp_off; /**< Timestamp dynamic field offset */ static bool timestamp_enable; /**< Timestamp enable */ -static uint32_t timestamp_init_req; /**< Timestamp initialization request. */ static uint64_t timestamp_initial[RTE_MAX_ETHPORTS]; static void @@ -194,7 +190,7 @@ static inline bool pkt_burst_prepare(struct rte_mbuf *pkt, struct rte_mempool *mbp, struct rte_ether_hdr *eth_hdr, const uint16_t vlan_tci, const uint16_t vlan_tci_outer, const uint64_t ol_flags, - const uint16_t idx, const struct fwd_stream *fs) + const uint16_t idx, struct fwd_stream *fs) { struct rte_mbuf *pkt_segs[RTE_MAX_SEGS_PER_PKT]; struct rte_mbuf *pkt_seg; @@ -262,11 +258,10 @@ pkt_burst_prepare(struct rte_mbuf *pkt, struct rte_mempool *mbp, update_pkt_header(pkt, pkt_len); if (unlikely(timestamp_enable)) { - uint64_t skew = RTE_PER_LCORE(timestamp_qskew); + uint64_t skew = fs->ts_skew; struct tx_timestamp timestamp_mark; - if (unlikely(timestamp_init_req != - RTE_PER_LCORE(timestamp_idone))) { + if (unlikely(!skew)) { struct rte_eth_dev_info dev_info; unsigned int txqs_n; uint64_t phase; @@ -289,8 +284,7 @@ pkt_burst_prepare(struct rte_mbuf *pkt, struct rte_mempool *mbp, */ skew = timestamp_initial[fs->tx_port] + tx_pkt_times_inter + phase; - RTE_PER_LCORE(timestamp_qskew) = skew; - RTE_PER_LCORE(timestamp_idone) = timestamp_init_req; + fs->ts_skew = skew; } timestamp_mark.pkt_idx = rte_cpu_to_be_16(idx); timestamp_mark.queue_idx = rte_cpu_to_be_16(fs->tx_queue); @@ -300,14 +294,14 @@ pkt_burst_prepare(struct rte_mbuf *pkt, struct rte_mempool *mbp, pkt->ol_flags |= timestamp_mask; *RTE_MBUF_DYNFIELD (pkt, timestamp_off, uint64_t *) = skew; - RTE_PER_LCORE(timestamp_qskew) = skew; + fs->ts_skew = skew; timestamp_mark.ts = rte_cpu_to_be_64(skew); } else if (tx_pkt_times_intra) { skew += tx_pkt_times_intra; pkt->ol_flags |= timestamp_mask; *RTE_MBUF_DYNFIELD (pkt, timestamp_off, uint64_t *) = skew; - RTE_PER_LCORE(timestamp_qskew) = skew; + fs->ts_skew = skew; timestamp_mark.ts = rte_cpu_to_be_64(skew); } else { timestamp_mark.ts = RTE_BE64(0); @@ -461,7 +455,6 @@ tx_only_begin(portid_t pi) timestamp_enable = false; timestamp_mask = 0; timestamp_off = -1; - RTE_PER_LCORE(timestamp_qskew) = 0; dynf = rte_mbuf_dynflag_lookup (RTE_MBUF_DYNFLAG_TX_TIMESTAMP_NAME, NULL); if (dynf >= 0) @@ -504,7 +497,6 @@ tx_only_begin(portid_t pi) return -EINVAL; } } - timestamp_init_req++; } /* Make sure all settings are visible on forwarding cores.*/