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 36D6AA0C4D for ; Wed, 21 Jul 2021 08:42:14 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 00F7F4014E; Wed, 21 Jul 2021 08:42:14 +0200 (CEST) Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2060.outbound.protection.outlook.com [40.107.92.60]) by mails.dpdk.org (Postfix) with ESMTP id 897C04014E for ; Wed, 21 Jul 2021 08:42:12 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=g6Bp1N12nCVJ+cS3Ky6hqJAxTFrNAatAgftV3eX0hiL+un5bGjN/gPyUyplp8HT2vrd0YMlujIjxdefwjjFbgE02oaqWKMEWNF7LjpByKC7u/urmhDX62XS86hYVsv2lXfCNVaBx+FIx7JiOqZrbMNSYJMmRDX/DQB9brDatrz3BXzFTjrr1TtEbf5O3Luy+ea75tD7TFahRkAiLuxVDmyFcEAXPEBVkyjWEn1xVT16clIoei27VJIKcICi9Pwrb3WG2tvt7oBcWjH1ktySbdqa4BefmKkyw82XkYy/EKfdYx955FWS63Ce1FHgC+3A9uwQX/aHCe4qPYqUff1J+fA== 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=ZNg+BroPsCeCSwoTDfutXWlhcCKpRpxRjU8TNGACjTo=; b=aM0p8Iaagi2NXHDsEzSwXmuSXXhP9ZXIjrSC+JeNj/HEBRq9aggKLwp2o+ATizTDzJbPLJ1cxBLHx2lf5Zn0kJbQLsyEdZVQe7kjuGQH4l0yuZXiP/zneUY4unYwXG41WHohPW1EHtyaaIj4knkveuoSPQPgOVToTnHi1GV0HAJosnoREIkjWkw4zKdq8m0h61mpPeqmODvq/brglNTdfZTVzhwQc3EV6rvERpUbumOXvOmVqvN4Ynvi/yFPnEQvdKUKywesprWubdOFgqb81Nl1Zty1xs6T+L3S7QPqdbITlYnhm/mfFWhikTy2dS2eGN5t4JIH4ccm6Lg6gm2+Mw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; 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=ZNg+BroPsCeCSwoTDfutXWlhcCKpRpxRjU8TNGACjTo=; b=MgmF9zGnW1cuKhhWUVGWolS3mgx0EXv8fYAS1djKkFMysT2CBoEj/l4sWvZA7sLRUSMeHn1xmKZ0D9LItB7l+t4WR2BziHPXfJ3w6LXm2PGf7FoJvZA2xCjhLpBuPmkZOvfIC5jTfYMxeFa21mv02r4KOauAWDe4+AZbtoSW/X72N/zsBIkL3nMgozpcy9b7m/kDULH5yg1dgVuiHv4sEDLZA1hfQY4TbSuEByUU85yEDCkUvJbar6c6PiC2gp6jHmKBfRJcRZ/eHYkylfQeZdXxhjd75+UmK4kvblPg8FJWolpJCq44B3EjC/lVJ7nffr3uQbX2gV+bmrEtplMLkQ== Received: from DM8PR12MB5400.namprd12.prod.outlook.com (2603:10b6:8:3b::12) by DM4PR12MB5261.namprd12.prod.outlook.com (2603:10b6:5:398::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4331.22; Wed, 21 Jul 2021 06:42:11 +0000 Received: from DM8PR12MB5400.namprd12.prod.outlook.com ([fe80::9cf5:169b:e9a5:5811]) by DM8PR12MB5400.namprd12.prod.outlook.com ([fe80::9cf5:169b:e9a5:5811%7]) with mapi id 15.20.4331.034; Wed, 21 Jul 2021 06:42:11 +0000 From: Ori Kam To: Gregory Etelson , "dev@dpdk.org" CC: Gregory Etelson , "stable@dpdk.org" , Dmitry Kozlyuk , Xiaoyun Li , Olivier Matz Thread-Topic: [dpdk-dev] [PATCH] app/testpmd: fix TX checksum calculation for tunnel Thread-Index: AQHXfHjDi2eTDMspUEKHG7RB0TSVEqtM/fXA Date: Wed, 21 Jul 2021 06:42:11 +0000 Message-ID: References: <20210719083309.15428-1-getelson@nvidia.com> In-Reply-To: <20210719083309.15428-1-getelson@nvidia.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: nvidia.com; dkim=none (message not signed) header.d=none;nvidia.com; dmarc=none action=none header.from=nvidia.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: f68711c7-0d1f-4f66-2d1c-08d94c12ab36 x-ms-traffictypediagnostic: DM4PR12MB5261: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:3513; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: hlTHrCYdmFvoVLDz02A5JxwZWiHaXV6a9d8uv2OtR//H3z1+G3JIuE5/iQ8dWcl/tJqkxSnme3E8Da+L+tlE2CxZbzgMb6dd5OoCHYoFl/6owHowYEfdt53EfQTKyzDCGTiD4SQ0zid/XBrH73or2LpX0cLwGwWb2zGJZV3W/Xu9gPKCWrq4yO/0COCHMCELp2uYtO2uQE0V+MmrNOekCxMhEoX2B60sflSUwjYi/oqSI7ckXhHBshoz9NiWQSn1KIRsmWcCATxCF5HaM3SKBrdqmU0ySY/KCheKt9IcfaN/RkSn+InUpKTBJaZ/HjPwNTjYBPKi+r6VtSGWVWeGapPkOWxD+u6X6GAKlIbT23s49njDfmFvYcdFozVcitiegX6J8hKSm5ZSiGorjScLF+RVgbhOegVnjVNQ3PW3wOfXxTwJJjnQ+3vkKAOAMD8Lgxtgaef14hLn1Wpk8Z3C4GQmzox0UOejA8HMdjkOoY2cb4pQbPCr+9q8fTNGs23XEfK0iwdttl6R2Vh8XFsL11ZZ/n5kkKkXn4XqfaF0LeH3yFZnbKYYY78vDWXOPhCgJzenEjv5WKMRhrxL1ORPmjNihYl0PuuAtM0UKv+nOE+v2qRrP92IiRe6MNofSFmpimnepT7/ZzTX+glLT2WM/tiklS/DoM9ly4GmZuWt9mjvHjIbZgbwufV035NGxH0olNa7Av1hoXemY+KgRckhLLACu2rUpULVvAyZNQBNwG8= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM8PR12MB5400.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(376002)(39860400002)(396003)(366004)(346002)(136003)(122000001)(83380400001)(38100700002)(8676002)(55016002)(110136005)(478600001)(86362001)(9686003)(6506007)(186003)(2906002)(4326008)(66476007)(66556008)(64756008)(66446008)(8936002)(7696005)(33656002)(66946007)(5660300002)(71200400001)(54906003)(316002)(76116006)(52536014)(21314003)(38070700004); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?lUrz0JPtQ5BQH8gc+m5H+fJeN7HbcQwNkJh5PC+eoEHA+JpiT7UrIX1cbuWb?= =?us-ascii?Q?juYEN+TZdrNZoOu9GenKu40PhVRBPtAv94pSHHvZHalGXKWmSf7np6wGOiof?= =?us-ascii?Q?Ojc1qNJZ2lpxim+siWPvyTdYkDK1YwTmjB6ZgwRK5kxGEfoajrl0Lub3ohJV?= =?us-ascii?Q?nwcRvztc34Y/uvizuoeIBHpYDZj7g+alzPyGfzkWq9esmVgCWan45f+XoVRU?= =?us-ascii?Q?Jdq3TGan9xkDVifF37Di3yn7zPiZBIk26TAymfZyToxpRt+wGJrsTBoxIQUD?= =?us-ascii?Q?qapYVRt4yJ6Tl/4FP0606q/sgQNP+2I84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ii?Q?9cEt8RqZrr/iv+ztWMyGYc80RIMJyxZFSKvxcLKWDcDfE6ziIFFIMhsR+sBd?= =?us-ascii?Q?Om8FSyts5G/FK6TzdXc6rCp9UM+EJZ5okG5VJwBpZPKt6zZg1RMXMgN2RBmB?= =?us-ascii?Q?ybGj6UYdYJF4LuEZ80i0O4+nl5iad0LJ4VL22Ex0LHpJA7u/CkxMF4TLp7Xc?= =?us-ascii?Q?qqyfRVn0CGx2w/eN6A4IPBLyPq5m?= MIME-Version: 1.0 X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: DM8PR12MB5400.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: f68711c7-0d1f-4f66-2d1c-08d94c12ab36 X-MS-Exchange-CrossTenant-originalarrivaltime: 21 Jul 2021 06:42:11.4555 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: /uMJ+moG9nfesSMl1z9gCd3GkN0UpIC0KgxshFMQqlzVl9xlikqGq9Dig53pUkUJnbW/4jU06kIPKh61CabjDg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB5261 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.29 Subject: Re: [dpdk-stable] [dpdk-dev] [PATCH] app/testpmd: fix TX checksum calculation for tunnel 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 Gregory, > -----Original Message----- > From: dev On Behalf Of Gregory Etelson > Sent: Monday, July 19, 2021 11:33 AM >=20 > TX checksum of a tunnelled packet can be calculated for outer headers onl= y > or for both outer and inner parts. The calculation method is determined b= y > application. > If TX checksum calculation can be offloaded, hardware ignores existing > checksum value and replaces it with an updated result. > If TX checksum is calculated by a software, existing value must be zeroed > first. > The testpmd checksum forwarding engine always zeroed inner checksums. > If inner checksum calculation was offloaded, that header was left with 0 > checksum value. > Following outer software checksum calculation produced wrong value. > The patch zeroes inner IPv4 checksum only before software calculation. >=20 > Fixes: 51f694dd40f5 ("app/testpmd: rework checksum forward engine") >=20 > Cc: stable@dpdk.org >=20 > Signed-off-by: Gregory Etelson > Reviewed-by: Dmitry Kozlyuk > --- > app/test-pmd/csumonly.c | 23 ++++++++++++----------- > 1 file changed, 12 insertions(+), 11 deletions(-) >=20 > diff --git a/app/test-pmd/csumonly.c b/app/test-pmd/csumonly.c index > 089936587b..a658cd5389 100644 > --- a/app/test-pmd/csumonly.c > +++ b/app/test-pmd/csumonly.c > @@ -480,17 +480,18 @@ process_inner_cksums(void *l3_hdr, const struct > testpmd_offload_info *info, >=20 > if (info->ethertype =3D=3D _htons(RTE_ETHER_TYPE_IPV4)) { > ipv4_hdr =3D l3_hdr; > - ipv4_hdr->hdr_checksum =3D 0; >=20 > ol_flags |=3D PKT_TX_IPV4; > if (info->l4_proto =3D=3D IPPROTO_TCP && tso_segsz) { > ol_flags |=3D PKT_TX_IP_CKSUM; > } else { > - if (tx_offloads & DEV_TX_OFFLOAD_IPV4_CKSUM) > + if (tx_offloads & DEV_TX_OFFLOAD_IPV4_CKSUM) { > ol_flags |=3D PKT_TX_IP_CKSUM; > - else > + } else if (ipv4_hdr->hdr_checksum) { > + ipv4_hdr->hdr_checksum =3D 0; > ipv4_hdr->hdr_checksum =3D > rte_ipv4_cksum(ipv4_hdr); > + } > } > } else if (info->ethertype =3D=3D _htons(RTE_ETHER_TYPE_IPV6)) > ol_flags |=3D PKT_TX_IPV6; > @@ -501,10 +502,10 @@ process_inner_cksums(void *l3_hdr, const struct > testpmd_offload_info *info, > udp_hdr =3D (struct rte_udp_hdr *)((char *)l3_hdr + info- > >l3_len); > /* do not recalculate udp cksum if it was 0 */ > if (udp_hdr->dgram_cksum !=3D 0) { > - udp_hdr->dgram_cksum =3D 0; > - if (tx_offloads & DEV_TX_OFFLOAD_UDP_CKSUM) > + if (tx_offloads & DEV_TX_OFFLOAD_UDP_CKSUM) { > ol_flags |=3D PKT_TX_UDP_CKSUM; > - else { > + } else if (udp_hdr->dgram_cksum) { > + udp_hdr->dgram_cksum =3D 0; > udp_hdr->dgram_cksum =3D > get_udptcp_checksum(l3_hdr, > udp_hdr, > info->ethertype); > @@ -514,12 +515,12 @@ process_inner_cksums(void *l3_hdr, const struct > testpmd_offload_info *info, > ol_flags |=3D PKT_TX_UDP_SEG; > } else if (info->l4_proto =3D=3D IPPROTO_TCP) { > tcp_hdr =3D (struct rte_tcp_hdr *)((char *)l3_hdr + info- > >l3_len); > - tcp_hdr->cksum =3D 0; > if (tso_segsz) > ol_flags |=3D PKT_TX_TCP_SEG; > - else if (tx_offloads & DEV_TX_OFFLOAD_TCP_CKSUM) > + else if (tx_offloads & DEV_TX_OFFLOAD_TCP_CKSUM) { > ol_flags |=3D PKT_TX_TCP_CKSUM; > - else { > + } else if (tcp_hdr->cksum) { > + tcp_hdr->cksum =3D 0; > tcp_hdr->cksum =3D > get_udptcp_checksum(l3_hdr, tcp_hdr, > info->ethertype); > @@ -529,13 +530,13 @@ process_inner_cksums(void *l3_hdr, const struct > testpmd_offload_info *info, > } else if (info->l4_proto =3D=3D IPPROTO_SCTP) { > sctp_hdr =3D (struct rte_sctp_hdr *) > ((char *)l3_hdr + info->l3_len); > - sctp_hdr->cksum =3D 0; > /* sctp payload must be a multiple of 4 to be > * offloaded */ > if ((tx_offloads & DEV_TX_OFFLOAD_SCTP_CKSUM) && > ((ipv4_hdr->total_length & 0x3) =3D=3D 0)) { > ol_flags |=3D PKT_TX_SCTP_CKSUM; > - } else { > + } else if (sctp_hdr->cksum) { > + sctp_hdr->cksum =3D 0; > /* XXX implement CRC32c, example available in > * RFC3309 */ > } > -- > 2.31.1 Acked-by: Ori Kam Thanks, Ori