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 CC91CA0C41; Mon, 2 Aug 2021 20:13:36 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 73FD041147; Mon, 2 Aug 2021 20:13:36 +0200 (CEST) Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2086.outbound.protection.outlook.com [40.107.92.86]) by mails.dpdk.org (Postfix) with ESMTP id B7FDE40140 for ; Mon, 2 Aug 2021 20:13:34 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UoKHrykv0suMl6MQiu4xJdh81XByktjYOXvNeYVxDb63BV+3RrvGyGkPQH4dL34SORz0bAiBF/wIB2HzCY60FjIx2r+gb6gMnPv5iF32/OEydsuiQTDazBkD57TjcZnmnD+CPJF3fzJcBHDLm3p7atI7E37ECAMC0UE8MsTif5wt7cc4Z1fHDl+20fpVeKpBh53ljsv4WudDL1h52E+sZS/H074MeJ38SNaHh+FbGYfK+HvnpHh/9qO+NpzYPojTHkNYA03NC1Sy5NqJYRrnA1Y0GSM7Od5kIqsp8UUyMylUlFnYrMYzclaO7J7LRS4dNTJ0Yg+R54Wrv7CIrhV/Zg== 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=euc3hHrmVrvHAEv9BiX1llPt32R+nH3e72Dn5J0F7Qo=; b=T7uS7aM2pKEo3iJDFdwyM9ieNfTqgBWFn9RB8Z8zBNOuBCFhkpr2vN3HmVkLwG+1MXx1xmVmxfdAaRPjIGktag8cARAMxOS3PyASz6iyfX5m8yvloYzOVNFd0qE/KQUB06eY4h+1RkEorAdC9huut07Vub1i/lxhJoOWLLdvGJYqPcYSrvRGQwDOOVIWMLAXmtxs7eG/iCKoyHQ6+mkQd3xpu/K27jz2a6TE1Sv6f2op/16uHLubbMABG2Uvjge9h3QVq3VP4FnVO3SDrlpmDj/QZE8W+haPg/x+Oha+TntFMVeyjtM9qNY/i1MLC/h43tACdL5eVnKQgu1ft8CkFw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.32) 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=euc3hHrmVrvHAEv9BiX1llPt32R+nH3e72Dn5J0F7Qo=; b=SfiyGSdd3m5VEeitjhafmEeuET16yikqae8NPv6zSk9Wp9/KYbd+E9ku1J809La0ik+ySAUlwcInKtyLgba9YUMtBbI380Cre7LAuj1Zs4qZFLCR1jAEx0cpzGIbX2Rzm9XTziwCiDajbAswqLt8a9BoVKNejwC/4eghyHr2gDFoprpQdfysW3Qf8ca5iooh5wyHwFVdXEXQfjrcET3gjWEMhK1rYGU19l5pLwo/0d3pNb0IjNLU+bzyfhzUZoDcvAoSzSuyHX//cLS+KSoTVRgD4hmdA6gugibyBZEQp867kJ+rc4hrJaWgmkLJF9IgdL267g78OmORdOe1O+64Xw== Received: from DM5PR19CA0052.namprd19.prod.outlook.com (2603:10b6:3:116::14) by BL1PR12MB5286.namprd12.prod.outlook.com (2603:10b6:208:31d::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4373.17; Mon, 2 Aug 2021 18:13:33 +0000 Received: from DM6NAM11FT004.eop-nam11.prod.protection.outlook.com (2603:10b6:3:116:cafe::96) by DM5PR19CA0052.outlook.office365.com (2603:10b6:3:116::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4373.18 via Frontend Transport; Mon, 2 Aug 2021 18:13:33 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.32) 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.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 DM6NAM11FT004.mail.protection.outlook.com (10.13.172.217) 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:13:33 +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.2; Mon, 2 Aug 2021 11:13:32 -0700 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:13:29 +0000 From: Gregory Etelson To: , CC: , , , , Xiaoyun Li , Ori Kam , Ajit Khaparde , Olivier Matz Date: Mon, 2 Aug 2021 21:13:16 +0300 Message-ID: <20210802181316.7676-1-getelson@nvidia.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210802180011.7183-1-getelson@nvidia.com> References: <20210802180011.7183-1-getelson@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [172.20.187.5] X-ClientProxiedBy: HQMAIL105.nvidia.com (172.20.187.12) To DRHQMAIL107.nvidia.com (10.27.9.16) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: b6fdf5ab-5b0c-4767-e1a2-08d955e13d2f X-MS-TrafficTypeDiagnostic: BL1PR12MB5286: 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: sgCUTS2+/ooPgCaOKYxJLI3D9cGnyMQu7VIXTHwLzdgrSfNNMaPRZw/0JOSr/N/RAJ57N75byjssM3u7HfhEm+hXOmu93hHLPgNxeXAu0LgnHJiZyOWE3fyNM2oEuIeeGCWjVdMkcIPj5zwkyMJpUeLnYdrHswYrC+pkcY0N8SgsHry8p75AOtnUQqkT+ahJp5PgZL2JPkNi5RWlP7FRMQHLqZpR/Y4yWf/R6q67+3Dt+L3Se19Pl0VKsvxAdsEVO1TaPTMfqFQLeRx9xiEKu9A4jJmLP3PbqWWJq30lRPVQr3u4QPbLi/dg2VGqtP21m+4pDtE/QLOtkqWLJJvIKlbYeVLVCwxi8GUVE2vpVmOnaS572sb+UHEpHV/X8RxdfYOx2NGusjYf5V7FHeRr1nx63JiMrSm3UK7PwDjLTsS1n8geIn/hzvg/8drEYzpl84PkSHPrAtQkMs/muifWcczBuF3hPi4XLRoASJ7BfdbGWbtONGkVsnAjLvAMKJQHv7fq8ttaqlxXTUG5whI4yb16MLwyR4WJ454upn3l7NhmJkDJGw3aF/4m3sDoPREwQoZdexiihMMr40EoaBmlQ0cPHp0D7of+xS3YEOTWUUN6/HOtZKOjXgR74nSZzeUcgt7uJgVyyF0TdtydxWS8jVQnKzD7BZPvXEr1z+0FYHnJYYdlb2bbPM+Iy3Gwh48bbwz0jY/+gEQAKYh5RHRkiMIOXEfAWK6rj8AQ3OfQjZQ= 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)(136003)(396003)(346002)(376002)(39860400002)(36840700001)(46966006)(47076005)(2616005)(36860700001)(26005)(186003)(6666004)(16526019)(6286002)(1076003)(7636003)(356005)(86362001)(336012)(8676002)(5660300002)(83380400001)(8936002)(54906003)(36756003)(7696005)(70586007)(82310400003)(70206006)(110136005)(426003)(2906002)(4326008)(316002)(478600001)(55016002)(82740400003)(21314003); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Aug 2021 18:13:33.1087 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b6fdf5ab-5b0c-4767-e1a2-08d955e13d2f 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: DM6NAM11FT004.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL1PR12MB5286 Subject: [dpdk-dev] [PATCH v2] 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") Bugzilla ID: 768 Signed-off-by: Gregory Etelson --- v2: add Bugzilla ID --- 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