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 DAB8AA0C4D; 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 2AC5C40E64; 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 DD89C40689 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=GU7/uaLiuu+ri42JPfNNBQEZ36T7i9ZlOaOtlo+0tBy9/qgf01rq8jKXb5s5GwbleajgaxCgWX3EXEO6yZ6xRGjBnI5VH8DJHKVicJEjg0the4fHuq0vxswruwMt1KBYdv26DlkwJX/Nhqh+K+WCulh8tOEM1RkY7SQo73ST+WWK4M7ZkAX9ROgOuikjkjC5FSues+0UKs00qAXO36jQWLG0tkXO+IlGBFQ81ZacEY4iUAZWmNPtKJuz+3cc8fE3fdmPZ3wyKesOYOiCJXZYqz03/N32NIDC169lUQrXBTx9OT+m/YT06X9CRhA2uan0k5gExLEIxI7OL3ohid5kgw== 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=yPVv/DRwr8WZ5dQ5NapJgWfkJrVPyS1Uvq3JFq1oWq8=; b=ar5X5cTv7rTowtuYlDfGArn2LrmU0dIhP6CVv8gJijNPmnKdJzaRSfYoeGUtqRfTgMuZ3XvZcOiHsenqkFVoY+p41lHRtK0n2jSwnSWkX6yblO8YFmeSSwf+OH1qOCIt/horXINJp3AO5gNnHX6AtairzdWW55VgRB9mGmx84aSMoURkGI8/JY7/EgmhjC9DmzrISSysa4r7dqqGH/ghOG7kG/2EMzbWm3Wsxfh950S5Saz6NmhquSguL9UT8DOWRFk8BOpZpWE21CbX+F8zPWlsRrLI/YkjJs4xuKIjdJ67Y8RqefO/hLvjDhw+zagq0xnGMcLEgWuzIfo7hEBfcg== 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=yPVv/DRwr8WZ5dQ5NapJgWfkJrVPyS1Uvq3JFq1oWq8=; b=XSjNv7BYOGfhevI1pN1zr4d7VGVmZq8KyUfdLZuUUgNkDE4A4B/wF2ZORL05IM6a8Q0Rhif2/IqFZXnKJ8L96CrXOSyi3iMuVda6DYfPDvsvl6U9wFY2SZECZRc7Xwa+Wl8lbboa3Jj3ms8u3PxIMMr50ECX6b6e9FokUopF9PL2uvskQmN628L4hMhCSvPMB+wPNQQNNp6RBa5PI/UeiRjq/bXAa4El5JjBk9q7hn9O6yXXHsvBJ0g7tX3Cw+oK7Y8mTYUf1G0NKZoyHlH95mE2a6RCzHiD2PKsnrgxp3Oj4lPAT/iiAKry/oqmFK3oimZBT2mOGLpJWXF4Xpm1bQ== 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?qapYVRt4yJ6T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t/bg+X6PVS?= =?us-ascii?Q?9cEt8RqZrr/iv+ztWMyGYc80RIMJyxZFSKvxcLKWDcDfE6ziIFFIMhsR+sBd?= =?us-ascii?Q?Om8FSyts5G/FK6TzdXc6rCp9UM+EJZ5okG5VJwBpZPKt6zZg1RMXMgN2RBmB?= =?us-ascii?Q?ybGj6UYdYJF4LuEZ80i0O4+nl5iad0LJ4VL22Ex0LHpJA7u/CkxMF4TLp7Xc?= =?us-ascii?Q?qqyfRVn0CGx2w/eN6A4IPBLyPq5m?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable 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 Subject: Re: [dpdk-dev] [PATCH] app/testpmd: fix TX checksum calculation for tunnel 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" 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