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 A79C0A0C41; Mon, 2 Aug 2021 20:00:32 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6B68541147; Mon, 2 Aug 2021 20:00:32 +0200 (CEST) Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2073.outbound.protection.outlook.com [40.107.92.73]) by mails.dpdk.org (Postfix) with ESMTP id 019D940140 for ; Mon, 2 Aug 2021 20:00:30 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=M5jyUG8r9JKt/k1TI2Jwp/tTZ8NPoEez4l9tkAHn95cUxULFH91d+jMXmlp88wpVj6ATG2yGSyIo/hCIMJLpKOZ/HO5GKnbIDcwf7PZC/h4DygNKK2A8gcgEU08XR6LymdyCXhM+y6DM0L5kNRDgRFOzWrTm7tB+3NjzKFuiCAOlVJi5gJoaLOgG84OkObAx453M3JueHj47we65gaZCkOJdNsmK6M2yNaMs0quI5G88ojc0qShuAbpRPIDWatlBEkhUJ9gZD5Rn217B6XQYllpfLEWgcOPlgXv0t9EP9fCJHkb99pr/R9k/kCIPuq2T4QnIHtAqYdVgnLOGJ7wPpg== 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-SenderADCheck; bh=HReoUnwSX/YSwaMVkO5DzwbmrbFHiiFdCFYBIxdIUIc=; b=a1YQRLLw27OnzANDGWxM7GtyN5zfhVPXWnt2ZAd0LZS521YQNq2rNkO8IElgsFlE/zCBDa4p+QgHfT7GOGChsgYgwriQEH76CqK6hafj1WOgTUa+JHXwWCiUyBcmabhkvsIRxT94UxUEfKrUu6su8b53IIlpLkLx46SXdYJ2Hj10d18PsYLQY2Bc3hEIBGTA7BSmGBId50xg02K/oBVaOUFDEIHOnefsHbyo2pYJHMNzqiyzbafgxnbbZsr+Z1hInhonKMOvc/0/6Uiv8Zb16RNRLoB+5HkQEt8XMaPIw3+uG+f9W/urcrzunwC+MC5GmGwA0HMzDXop6vUo2WAIzg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.35) smtp.rcpttodomain=intel.com 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=HReoUnwSX/YSwaMVkO5DzwbmrbFHiiFdCFYBIxdIUIc=; b=Ijxh6MCDMY4s5ivljbGDrWvUWtrU9MyIvD0O8X8g4bYTzL9fFehMs1sIoOK45YgZDqdHEKrQe1eqK6zxnAYdS0XgrxWf8jo/uALfSM7NifCactw0GL9OH+bU8vFqQpbliYK1G3JFNsX9FRv2U6I4Zwzu0ERh1OrYSHL5bCGmIy0AJjUQKXPP2KKQmkEOsCgdRjMJw9kpYM+KU7EBdmK+xZPyDLJ4cpzSW8D7319yRKVyWJQOEaJzlLsqC7ZUbTfmELZX6KWg0LC10HX1ygJ5Z32L2usiwz11kAN2kGiMSQpIcWkeY/4ec4fAjMATWFLkNZuwjjUgs08cSHRDIw3xFg== Received: from BN6PR13CA0012.namprd13.prod.outlook.com (2603:10b6:404:10a::22) by MN2PR12MB3967.namprd12.prod.outlook.com (2603:10b6:208:16c::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4373.24; Mon, 2 Aug 2021 18:00:29 +0000 Received: from BN8NAM11FT040.eop-nam11.prod.protection.outlook.com (2603:10b6:404:10a:cafe::db) by BN6PR13CA0012.outlook.office365.com (2603:10b6:404:10a::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4394.10 via Frontend Transport; Mon, 2 Aug 2021 18:00:29 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.35) 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.35 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.112.35; helo=mail.nvidia.com; Received: from mail.nvidia.com (216.228.112.35) by BN8NAM11FT040.mail.protection.outlook.com (10.13.177.166) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4373.18 via Frontend Transport; Mon, 2 Aug 2021 18:00:29 +0000 Received: from DRHQMAIL107.nvidia.com (10.27.9.16) by HQMAIL111.nvidia.com (172.20.187.18) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 2 Aug 2021 18:00:29 +0000 Received: from nvidia.com (172.20.187.5) by DRHQMAIL107.nvidia.com (10.27.9.16) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 2 Aug 2021 18:00:26 +0000 From: Gregory Etelson To: , CC: , , , , Xiaoyun Li , Ajit Khaparde , Ori Kam , Olivier Matz Date: Mon, 2 Aug 2021 21:00:11 +0300 Message-ID: <20210802180011.7183-1-getelson@nvidia.com> X-Mailer: git-send-email 2.32.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [172.20.187.5] X-ClientProxiedBy: HQMAIL107.nvidia.com (172.20.187.13) To DRHQMAIL107.nvidia.com (10.27.9.16) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 62722380-efc9-4063-f7ae-08d955df6a0e X-MS-TrafficTypeDiagnostic: MN2PR12MB3967: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:5797; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: DiF7gpFLW+uZ/wvZB793klrfQicH/MAXF8a7TCv4z28iRdO0BhF2QoxxabjF0editqXKglC67yy5aLrzrrSCpwLbdgELgAw+r4TZh0wbiEfig1mjJuvbYMZQvwZ++ozHNeqtMQ9v2AIapzQVr5yXox6IgIbpKj/fiNb69KAMc8C0D/tM1Krx83Dp6K1PBXKg/GKvPP9qQEcoVvACBgoiUGgjy+vQCz7cFsT7Elv9wJAD6ha7TjdrnIXS8g0nt6meQQ2jAhaii7j2swIRCluOTravCoikDDLVSmp1AumxRYvcd71uAspPxsv/EeFLKbyksrAxyFBJfl2Pmm9Vvx+CjoCSbXmr66jvWNrQBDBUzD3/PtlRzuun0PqzX6LNatPPvxb6k3bQufO2H9ph24HE/IqK15dJCHn65u+Oq50up4Ris9qHl7kwwp5Wl/jzMEwcWTyFP9ohpD9VoroQd3M6CwHtWCmMSPeVnLo5m1StUeWW7a8YIib3D6WVRaFqMhFukBmc2gmiIoUMQPmAGGVtotkr43OZpbWaWxwk0rmQlalxDSjKf45UwSyDiveNkYPCKzSJ8adpQEjIvQY2Dw9escwlsXy6tvhjPLIkyYRYpqdsQEKMdrvDAOBV+76JxWCc+mi0t0+8Elxx5Kq2DW1I9BkPx1LdElRBng74eQvSYwNXiEsRldFms+/w4gMZ9tENB1mZ9Fu5PTXm2p5lM/PyKQz0mWdUEpLqltigCEHJNF8= X-Forefront-Antispam-Report: CIP:216.228.112.35; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:schybrid02.nvidia.com; CAT:NONE; SFS:(4636009)(39860400002)(396003)(376002)(136003)(346002)(46966006)(36840700001)(4326008)(8936002)(6666004)(356005)(2906002)(26005)(1076003)(82310400003)(7696005)(47076005)(70586007)(478600001)(5660300002)(7636003)(426003)(36906005)(16526019)(8676002)(82740400003)(186003)(83380400001)(86362001)(55016002)(36756003)(70206006)(2616005)(336012)(316002)(36860700001)(6286002)(110136005)(54906003)(21314003); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Aug 2021 18:00:29.3400 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 62722380-efc9-4063-f7ae-08d955df6a0e 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.35]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT040.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB3967 Subject: [dpdk-dev] [PATCH] app/testpmd: fix IPv4 checksum 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" UDP protocol reserves 0 checksum value for special purposes. Other protocols, like IPv4, TCP and SCTP must calculate checksum value in software or offload checksum calculation to hardware. If IPv4 TX checksum offload was off and header checksum was set to 0, testpmd csum engine did not calculate checksum value for IPv4, TCP and SCTP. The patch always calculates IPv4, TCP and SCTP TX checksums if it is not offloaded. Fixes: b2a9e4a855d0 ("app/testpmd: fix Tx checksum calculation for tunnel") Signed-off-by: Gregory Etelson --- app/test-pmd/csumonly.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/test-pmd/csumonly.c b/app/test-pmd/csumonly.c index bd5ad64a57..607c889359 100644 --- a/app/test-pmd/csumonly.c +++ b/app/test-pmd/csumonly.c @@ -487,7 +487,7 @@ process_inner_cksums(void *l3_hdr, const struct testpmd_offload_info *info, } else { if (tx_offloads & DEV_TX_OFFLOAD_IPV4_CKSUM) { ol_flags |= PKT_TX_IP_CKSUM; - } else if (ipv4_hdr->hdr_checksum != 0) { + } else { ipv4_hdr->hdr_checksum = 0; ipv4_hdr->hdr_checksum = rte_ipv4_cksum(ipv4_hdr); @@ -519,7 +519,7 @@ process_inner_cksums(void *l3_hdr, const struct testpmd_offload_info *info, ol_flags |= PKT_TX_TCP_SEG; else if (tx_offloads & DEV_TX_OFFLOAD_TCP_CKSUM) { ol_flags |= PKT_TX_TCP_CKSUM; - } else if (tcp_hdr->cksum != 0) { + } else { tcp_hdr->cksum = 0; tcp_hdr->cksum = get_udptcp_checksum(l3_hdr, tcp_hdr, @@ -535,7 +535,7 @@ process_inner_cksums(void *l3_hdr, const struct testpmd_offload_info *info, if ((tx_offloads & DEV_TX_OFFLOAD_SCTP_CKSUM) && ((ipv4_hdr->total_length & 0x3) == 0)) { ol_flags |= PKT_TX_SCTP_CKSUM; - } else if (sctp_hdr->cksum != 0) { + } else { sctp_hdr->cksum = 0; /* XXX implement CRC32c, example available in * RFC3309 */ -- 2.32.0