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 57CCFA034F for ; Wed, 10 Nov 2021 07:47:19 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4C3A040142; Wed, 10 Nov 2021 07:47:19 +0100 (CET) Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2073.outbound.protection.outlook.com [40.107.93.73]) by mails.dpdk.org (Postfix) with ESMTP id 0388440142 for ; Wed, 10 Nov 2021 07:47:18 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=j9xhESsTbJL4eePjv/Pp7GDFRgxlXccpqAJqK4YHO6JhaJhYG4sLioYF85wwlE70dwq8DR8bWjp0sJh+jB4CQRWFgzwpVOzKdDUW1SM/FLZE4jW3HvlEICVYIzvwwS3VWjWgSE7IdiY9TxSaSg7llvExIJy3c6x5la5nuCsX6RfTlt4pzSGxPQCQFzLKkaTysNZqzVGNhKYi83hgMHx54pOshyU5MyPuCXTzk2v8nX2YCZR4NWxpgRMiAg1q7pHFwvLEdCsb4TpACAnf2/+NZjZ605La1TO3ZbVlvD8rSkCwcrYwd1nXXUG2VaLQveqCVImDJkTaCL4+xTj8CszjUA== 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=G0Um/KqaazHHv0PLjtAnd2v/A3i+5fMuUrczxY8NdpI=; b=Ir7JAKq8OT4WALKQVi2/ZDj3HXvGE36nYWWiVBBAp67zWQTR0HXDO4QoBxfJBRbwz2Ro8Dx4N/ZPFqrLO6hzKBuLBsQWQfquBWvRZfAGTFOugcAFA+ywEJjHcHW1Pgd36huNcvnJWIcJfgCjouucPMzX23hj9pFt4OdQHCdukKf62QDXBinSAgJqBXJ1epLl0quL65e+rRhob7AeofoEp1KJmhb+8f7XIRM0NunLaAyv8KlKTTIx8A8H5mlv2Xw5vaRY9FCcMh0HU4GjFnWX9vskMLqAe9QoFsVkRVt2pW0ILT6cjyvl4Cv0nAhsjW1zunOIBxYdIA0y0Q6gbHTK9A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.34) smtp.rcpttodomain=intel.com 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=G0Um/KqaazHHv0PLjtAnd2v/A3i+5fMuUrczxY8NdpI=; b=tBv0AK2Z//ufEduBBLca9zfrxbBx6F1B+mc34tQHYlWpMRNQi6RZIzZuUjeTA9hkA+VpWHAWYRVLJ+QhsJM+HSKic+cvd3ZwC/VetDbzCN9O2pmr0xtreUPrtVJBCEVDJMR8lbmBO9droegc4EiJjf0NjXnZouDzSEzkVSISsZ8BnKjIo3FW2EjvKk2JGEkB2uyS9KMcr3Ol6KB4xtsItxaSIwQzOatwOO/wrwtZrvVN/aCHmW3oPdhUIKouwoRL7R05agvE89fFowlbjf200zoy9NaHCNEoZ43l09vAtt6eqhSXylFmmm1eNdnWcVwRpkxY6V6AAt0x4NWh0VOHfw== Received: from BN8PR07CA0032.namprd07.prod.outlook.com (2603:10b6:408:ac::45) by CH2PR12MB3671.namprd12.prod.outlook.com (2603:10b6:610:23::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4669.13; Wed, 10 Nov 2021 06:47:16 +0000 Received: from BN8NAM11FT025.eop-nam11.prod.protection.outlook.com (2603:10b6:408:ac:cafe::94) by BN8PR07CA0032.outlook.office365.com (2603:10b6:408:ac::45) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4669.13 via Frontend Transport; Wed, 10 Nov 2021 06:47:13 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.34) smtp.mailfrom=nvidia.com; intel.com; dkim=none (message not signed) header.d=none;intel.com; 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 BN8NAM11FT025.mail.protection.outlook.com (10.13.177.136) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4669.10 via Frontend Transport; Wed, 10 Nov 2021 06:47:13 +0000 Received: from nvidia.com (172.20.187.5) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Wed, 10 Nov 2021 06:47:10 +0000 From: Xueming Li To: Alvin Zhang CC: Luca Boccassi , Xiaoyun Li , dpdk stable Date: Wed, 10 Nov 2021 14:30:18 +0800 Message-ID: <20211110063216.2744012-135-xuemingl@nvidia.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211110063216.2744012-1-xuemingl@nvidia.com> References: <20211110063216.2744012-1-xuemingl@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [172.20.187.5] X-ClientProxiedBy: HQMAIL101.nvidia.com (172.20.187.10) To HQMAIL107.nvidia.com (172.20.187.13) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: bae8eb15-4bf4-4e5b-a099-08d9a415ed4b X-MS-TrafficTypeDiagnostic: CH2PR12MB3671: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:9508; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ie6rKuPlNuYmEvJVtYCveA0BFUE40zg8GEi5p7nn0gniyWVVsgLDrpVyq0+QO8aRLrog16ZaHYU7jnkAVDNusJ4Bh+JFf/aqD7eBC8+EWem2Osck8ErcUSEgbQ4puIRkumGEEF8AbN4qwUYWQIRKKoJEKq+/WohrhNhrfOza/n73IkD08d173jLIJmLO9/Sk+J3SpFxaNOQg1GZ+QCO4n+NtaQS3z9dIYHCPw1r6uxQy5AuwdaqjfwVG57BJM7VpC/zpFzfP/4NnUE4hUtRQ23hTKbTe6HDFf2/N62q+iCBPgAEBWEfcbUC0ZN23v0Vf1U0IxAbLdClMHn5+vKuUmN5VueN3bXkyhpNy3jJ8jYU/Hn+01VMJCuzpO8fMuglMXlgVT8cXIKimCCRWzn0sXW8zt0gZRq1MWzYVs42BhBZrREHo9cRZ2WU9PL6dgS3Uf8m7SNiw3vulrxn4vBO8K8TdUI0LUDYeqSgov+C8rVFGyLxr4uP4yx6JkH86OiveZ5EYo4PgxHhHJLCWUutp1fwdCaoSb30dzxA/zDliM1Jkw06KA8OkyHPHvjmGVUOfhyjSJCNolwSLhIw3HHP89EWrh9DPeC4xroFCNQYy/qbHXX1SJz7PmhCvR+LscfpQ6MviCwDsqvpEsNjxdGujcLO7c8kMoOiiIGSSd1LZyqZ82bK0VRkXTzHpj2/5mH2TiwRjg74TrQ5h59EtMDYmp9LbYLFp5nmnoLeF/KHXA1DoWPbINeSHmyMajhuIitWkiI04bfD9RZE5MpKN4q3kyZszuylI9vHKueAtkj3IIGxFO3kDTCGFpqc8C92acnqDGyQRV4uMKlZGIsmiIZD4mw== 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)(36840700001)(46966006)(4001150100001)(6916009)(47076005)(70206006)(36906005)(316002)(8936002)(7696005)(1076003)(55016002)(8676002)(70586007)(83380400001)(356005)(2906002)(36860700001)(7636003)(426003)(2616005)(508600001)(36756003)(4326008)(86362001)(16526019)(26005)(186003)(5660300002)(6286002)(53546011)(966005)(54906003)(82310400003)(336012); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Nov 2021 06:47:13.0291 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: bae8eb15-4bf4-4e5b-a099-08d9a415ed4b 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: BN8NAM11FT025.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR12MB3671 Subject: [dpdk-stable] patch 'app/testpmd: fix txonly forwarding' has been queued to stable release 20.11.4 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" Hi, FYI, your patch has been queued to stable release 20.11.4 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 11/12/21. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://github.com/steevenlee/dpdk This queued commit can be viewed at: https://github.com/steevenlee/dpdk/commit/4942dcf261c3e6cc21aadfe22a0689e5240e6ffd Thanks. Xueming Li --- >From 4942dcf261c3e6cc21aadfe22a0689e5240e6ffd Mon Sep 17 00:00:00 2001 From: Alvin Zhang Date: Thu, 23 Sep 2021 16:01:29 +0800 Subject: [PATCH] app/testpmd: fix txonly forwarding Cc: Xueming Li [ upstream commit 02220e5305d72b70585f8798043409eb49d9f30c ] When random number of Tx segments is enabled, because the actual number of segments may be only one, the first segment of the Tx packets must accommodate a complete being sending Eth/IP/UDP packet. Besides, if multiple flow is enabled, the forwarding will update the IP and UDP header, these headers shouldn't cross segments. This also requires the first Tx segment can accommodate a complete Eth/IP/UDP packet. In addition, if time stamp is enabled, the forwarding needs more Tx segment space for time stamp information. This patch adds checks in beginning of forward engine to make sure all above conditions are met. Bugzilla ID: 797 Fixes: 79bec05b32b7 ("app/testpmd: add ability to split outgoing packets") Signed-off-by: Alvin Zhang Acked-by: Xiaoyun Li --- app/test-pmd/txonly.c | 67 +++++++++++++++++++++++++++++++++++-------- 1 file changed, 55 insertions(+), 12 deletions(-) diff --git a/app/test-pmd/txonly.c b/app/test-pmd/txonly.c index 93d121fd57..671ace3008 100644 --- a/app/test-pmd/txonly.c +++ b/app/test-pmd/txonly.c @@ -40,6 +40,13 @@ #include "testpmd.h" +struct tx_timestamp { + rte_be32_t signature; + rte_be16_t pkt_idx; + rte_be16_t queue_idx; + rte_be64_t ts; +}; + /* use RFC863 Discard Protocol */ uint16_t tx_udp_src_port = 9; uint16_t tx_udp_dst_port = 9; @@ -257,12 +264,7 @@ pkt_burst_prepare(struct rte_mbuf *pkt, struct rte_mempool *mbp, if (unlikely(timestamp_enable)) { uint64_t skew = RTE_PER_LCORE(timestamp_qskew); - struct { - rte_be32_t signature; - rte_be16_t pkt_idx; - rte_be16_t queue_idx; - rte_be64_t ts; - } timestamp_mark; + struct tx_timestamp timestamp_mark; if (unlikely(timestamp_init_req != RTE_PER_LCORE(timestamp_idone))) { @@ -426,13 +428,23 @@ pkt_burst_transmit(struct fwd_stream *fs) static int tx_only_begin(portid_t pi) { - uint16_t pkt_data_len; + uint16_t pkt_hdr_len, pkt_data_len; int dynf; - pkt_data_len = (uint16_t) (tx_pkt_length - ( - sizeof(struct rte_ether_hdr) + - sizeof(struct rte_ipv4_hdr) + - sizeof(struct rte_udp_hdr))); + pkt_hdr_len = (uint16_t)(sizeof(struct rte_ether_hdr) + + sizeof(struct rte_ipv4_hdr) + + sizeof(struct rte_udp_hdr)); + pkt_data_len = tx_pkt_length - pkt_hdr_len; + + if ((tx_pkt_split == TX_PKT_SPLIT_RND || txonly_multi_flow) && + tx_pkt_seg_lengths[0] < pkt_hdr_len) { + TESTPMD_LOG(ERR, + "Random segment number or multiple flow is enabled, " + "but tx_pkt_seg_lengths[0] %u < %u (needed)\n", + tx_pkt_seg_lengths[0], pkt_hdr_len); + return -EINVAL; + } + setup_pkt_udp_ip_headers(&pkt_ip_hdr, &pkt_udp_hdr, pkt_data_len); timestamp_enable = false; @@ -451,8 +463,39 @@ tx_only_begin(portid_t pi) timestamp_mask && timestamp_off >= 0 && !rte_eth_read_clock(pi, ×tamp_initial[pi]); - if (timestamp_enable) + + if (timestamp_enable) { + pkt_hdr_len += sizeof(struct tx_timestamp); + + if (tx_pkt_split == TX_PKT_SPLIT_RND) { + if (tx_pkt_seg_lengths[0] < pkt_hdr_len) { + TESTPMD_LOG(ERR, + "Time stamp and random segment number are enabled, " + "but tx_pkt_seg_lengths[0] %u < %u (needed)\n", + tx_pkt_seg_lengths[0], pkt_hdr_len); + return -EINVAL; + } + } else { + uint16_t total = 0; + uint8_t i; + + for (i = 0; i < tx_pkt_nb_segs; i++) { + total += tx_pkt_seg_lengths[i]; + if (total >= pkt_hdr_len) + break; + } + + if (total < pkt_hdr_len) { + TESTPMD_LOG(ERR, + "Not enough Tx segment space for time stamp info, " + "total %u < %u (needed)\n", + total, pkt_hdr_len); + return -EINVAL; + } + } timestamp_init_req++; + } + /* Make sure all settings are visible on forwarding cores.*/ rte_wmb(); return 0; -- 2.33.0 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2021-11-10 14:17:07.898359572 +0800 +++ 0134-app-testpmd-fix-txonly-forwarding.patch 2021-11-10 14:17:01.897412539 +0800 @@ -1 +1 @@ -From 02220e5305d72b70585f8798043409eb49d9f30c Mon Sep 17 00:00:00 2001 +From 4942dcf261c3e6cc21aadfe22a0689e5240e6ffd Mon Sep 17 00:00:00 2001 @@ -4,0 +5,3 @@ +Cc: Xueming Li + +[ upstream commit 02220e5305d72b70585f8798043409eb49d9f30c ] @@ -23 +25,0 @@ -Cc: stable@dpdk.org @@ -32 +34 @@ -index 6b3651f855..e45f8840c9 100644 +index 93d121fd57..671ace3008 100644 @@ -63 +65 @@ -@@ -438,13 +440,23 @@ pkt_burst_transmit(struct fwd_stream *fs) +@@ -426,13 +428,23 @@ pkt_burst_transmit(struct fwd_stream *fs) @@ -92 +94 @@ -@@ -463,8 +475,39 @@ tx_only_begin(portid_t pi) +@@ -451,8 +463,39 @@ tx_only_begin(portid_t pi)