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 23E88A0C45; Wed, 28 Jul 2021 03:31:23 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 99B9740E64; Wed, 28 Jul 2021 03:31:22 +0200 (CEST) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by mails.dpdk.org (Postfix) with ESMTP id 996DA40142; Wed, 28 Jul 2021 03:31:21 +0200 (CEST) X-IronPort-AV: E=McAfee;i="6200,9189,10058"; a="192839152" X-IronPort-AV: E=Sophos;i="5.84,275,1620716400"; d="scan'208";a="192839152" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Jul 2021 18:31:19 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.84,275,1620716400"; d="scan'208";a="517200226" Received: from fmsmsx602.amr.corp.intel.com ([10.18.126.82]) by fmsmga002.fm.intel.com with ESMTP; 27 Jul 2021 18:31:19 -0700 Received: from fmsmsx608.amr.corp.intel.com (10.18.126.88) by fmsmsx602.amr.corp.intel.com (10.18.126.82) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.10; Tue, 27 Jul 2021 18:31:18 -0700 Received: from fmsmsx601.amr.corp.intel.com (10.18.126.81) by fmsmsx608.amr.corp.intel.com (10.18.126.88) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.10; Tue, 27 Jul 2021 18:31:18 -0700 Received: from FMSEDG603.ED.cps.intel.com (10.1.192.133) by fmsmsx601.amr.corp.intel.com (10.18.126.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.10 via Frontend Transport; Tue, 27 Jul 2021 18:31:18 -0700 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (104.47.57.168) by edgegateway.intel.com (192.55.55.68) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2242.10; Tue, 27 Jul 2021 18:31:17 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KmVQMx/tHAzCg1QqxsGvLSxh0mEh2xZBJ6fMjw1vx4MMHcLT03Zl56aUHepdITmLHjy1ZPr1YtRqqqBZjVUgVDSD8dknoPvIXwGc3jrh46+tVWVmgb4fzqrAgoP/hy/lRdpJ8cSwfUWM0JBYGqVEL3EMIRe48frmbreYk5ZF4NxtuQ0SEmiXCeLtIiQlw87qWCt1wvmLsJcB+SvYzEWxN5W0fyGdVv1iyJ/AMxDEt44nzj5P2hZg9FxmcuMefU0aydjT7P8Mm/vPAetlDvDB0vcLzicWrGX0iVDkrizF1GiA3pj5nbguFv9eyDmkNE9FT9NjEtWNK8jrHBdObtMzAQ== 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=oynHwnOU0FgPO8CDaTbJ7Yb/hF4b+lfxMzfzAoSpqcw=; b=Gew8yU/4seTD346vuO/FuQru66F9XejPjPtSauSLbGdTQBulfAPMOTI0xkE7IeDP3v+Xe8NA3lqJXsJwcGjsA6OV8XX0Qjiy8qV5S9K9MRtpOBCyzlDdzc13TkHpbLYRn5OMtrCo1rPj9Utx4GdBpXSl9tykQt1tJbSu2HGmyDXCxWBMqjR57CcxYH20wMy5BBitEzVVyl/s9XhBTPwNYwsVkuKyIazU86iWDbuAlWQKfN+Ngpds1y7TztotHtyCz8JpFr7VAcSw81+sVMQrMsAeZFtnHy63xUYnygVvXXU29aVcbmDXOkkzpfC+ka7vRnsZjTelbrjQKrGUNdNRgA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=oynHwnOU0FgPO8CDaTbJ7Yb/hF4b+lfxMzfzAoSpqcw=; b=k3LJQZZsJRhmwUmzqYb1mU3WBWsSnFSyv4FCHs4IG1gxOIZm00CXrbNgp3w7u8fiYpDffdh67/yUrVe3ZP6CGxvULvGjn6pwC3zoVNNxMQi8b64FxE05xUclhA6Ywl0PwQEGHJgEXLtsJLDYC9lxHOUFDRWNYKVS58iZqEB2wTg= Received: from DM4PR11MB5534.namprd11.prod.outlook.com (2603:10b6:5:391::22) by DM5PR11MB1452.namprd11.prod.outlook.com (2603:10b6:4:9::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4352.26; Wed, 28 Jul 2021 01:31:16 +0000 Received: from DM4PR11MB5534.namprd11.prod.outlook.com ([fe80::87d:1217:a7cc:dd72]) by DM4PR11MB5534.namprd11.prod.outlook.com ([fe80::87d:1217:a7cc:dd72%8]) with mapi id 15.20.4373.018; Wed, 28 Jul 2021 01:31:16 +0000 From: "Li, Xiaoyun" To: Gregory Etelson , "dev@dpdk.org" CC: Ajit Khaparde , Olivier Matz , Andrew Rybchenko , "Yigit, Ferruh" , Thomas Monjalon , "stable@dpdk.org" Thread-Topic: [PATCH v2] app/testpmd: fix TX checksum calculation for tunnel Thread-Index: AQHXguh//5ZWmqhrSkih6B6TwK7JwqtXmmSw Date: Wed, 28 Jul 2021 01:31:16 +0000 Message-ID: References: <20210719083309.15428-1-getelson@nvidia.com> <20210727130757.30724-1-getelson@nvidia.com> In-Reply-To: <20210727130757.30724-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=intel.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 572f0f52-4668-4a0b-20be-08d9516764e7 x-ms-traffictypediagnostic: DM5PR11MB1452: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:6108; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: mHG5TLHy85iXMEukCm7h9JJRfcm/bJYvlWnI2IllOa8msDVJhtVE5IcRQe9cmLKvxx0pZ9sp9IDKcl3xDCrxhwAkH79rX4WoTflW6V6UC1j0x6J963Y2Ko0c7fabhfdr/k5rX6f+G+mTNLTGGfGR601N0xoclzj4Ahfng9Ax4wzxy44lfqLQPW0wIkzpmnDGElHMkuXyp7Ew6kiwx2HgXuR/ahUJVhedu/MdUvj9lq0UxhPmC/z7zQ+A+gNh/95C+EMm0J1wo8GkEac4eILojRC4onHCA9kXUWuEAmS5ozLh1G6Iq9k9r4L8ZWt/k8D7+Ps4coumwHpJo610Y+t5NCZAOVdNB7NqqjrvOfF1GxvALasD34WehWYMbPXnU2Nte+dz8KhnaLzI7oby7Fe16mZ5WiXK1X0AlaXC05Mz2xWhNnu89k2pqfCiMMYA/3cVUIZahp1ZXHCyueG4B9Y2ZSz9Kg4LkIaM8ca9RHi2giBY8eEg6b+zfD6IV8pS9xi9acUbsclybgvfYGeK+rr/SANki8SfwnGsouf9EONGn14UTGDYy4HapAc6fjT+5bvoirASI5tEBIt+vukwR9tdwlj1hUzMTZBrGZoFJYnkxvn/IQtFpFlsjdLTIjC5y5aOT36/RrblIxqQWLKFuY2Sxqoyxwq2cpNF/WUmqFbeiqBOg0Z8J901a+VFKJLOprVtjBkMxSawftXOyCaikYai2Rx+Odx+55v3A5RVhtxmIAM= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM4PR11MB5534.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(39860400002)(346002)(136003)(396003)(376002)(38100700002)(4326008)(2906002)(8936002)(83380400001)(8676002)(66946007)(66446008)(76116006)(478600001)(66556008)(66476007)(64756008)(5660300002)(52536014)(86362001)(7696005)(186003)(33656002)(38070700005)(26005)(53546011)(6506007)(55016002)(71200400001)(9686003)(110136005)(54906003)(316002)(122000001)(21314003); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?4uyP+akT9FqRl8kAck3jjZJVqF8tmmcUWzBSi2dO7jysiDxnOxZ+jOa81gwt?= =?us-ascii?Q?V41uQOQXfPwDJ8pkNzV0IccS/52EUcJFZsmuO3kZSBnf7aHqMV+PiWF6sZe2?= =?us-ascii?Q?2sY2IEymQv1hpw8yCKUzY2dknJVQrhP/wTodxf+aB+bTFZaTf0zRiF2S1C85?= =?us-ascii?Q?ngKJmp+Ll/M5KDn+dsVWsOw1Mxo2Wd/tbToVKW2Dr16yVyNRDfRDBVZXj8dM?= =?us-ascii?Q?2qwhKoHZwPcVCQWOmOuTHH2XEeNTsvrgJHpsU77jyh7D5je/S6JfT4nn0OwF?= =?us-ascii?Q?EU7F6fQnVzmv5A0zdZiAxhIdJl3j+AJW7LUmF6UsnBqcT6alHZNBAIzCHNWX?= =?us-ascii?Q?vRumBXjIFfKhUn8EGyjXapI4BzmTk0nTK3IbPPcIxPWHMNNl1Le2wYQpoLWu?= =?us-ascii?Q?FcLFc6FYkZjoy4D6I00x/K+KEYxvhimN8YHz/+Musd47VoJdGYBzkliKnBMh?= =?us-ascii?Q?/8V1ybSpkTzH5sIwHGOYhWeKkkRXvjmaenl4jP5tDaDdmPPBrETr70jC+Tju?= =?us-ascii?Q?AuqAoBc7jmPs7EIMLdYHjiO8+IggpBWHOFM3MDDLKWVXisCxLxkBKry2v/2r?= =?us-ascii?Q?SRae6FcsfqUhljizN2GgHuwVwJR799ksDjGrMBC1GomoY/bBrDCxRZ4jA7Rr?= =?us-ascii?Q?Uw1IU0s4ECymEk9fsM6Ngm5E6Y1pDkacBaxd0D56Vfae30lIlGsmkkuL47MF?= =?us-ascii?Q?J6qCpiGrm0aqPE6SgMH5ZIq6Id3caDfea5YUZIK239mCCfRkGVxZYnFKlKdt?= =?us-ascii?Q?ayUOqqaAKayEoHpub9P0G4V3urtqcGtr7bhBCzefVchPi6YkRGpNOTtYZpqi?= =?us-ascii?Q?/Duz9Q6Qc9iUa0GbdX3W3bOFYiRIqIoR96whcw3rkCi/d8XuIZP3VEFroZAB?= =?us-ascii?Q?WawXAUxjyZeOBIK076x8feY9ufsbs8tQLn73YW9MPHqDsGzhzyH29t6RwhVl?= =?us-ascii?Q?55OaLCmMD18VEULI+cWIwqAoMTlgRBhOeqx39UaukMNpwVLq3iAOqSa6dMOd?= =?us-ascii?Q?2ttYJGI0C/ABI+MpCxJx/nlzOCKu/h922TVDdiUPqajGkWcJu8ZfA2w7KUQu?= =?us-ascii?Q?CBYMxo1z3tqre3bdYwFv+1Cj3cb7NuDQMZitb1Ed2NhFAOPzSOeZrs1ayVbu?= =?us-ascii?Q?pGQq7X8Cek5EH/URqwWLQS7k5dN1aray1dDbYa4VZsyooWK/wHxM53sy8k7p?= =?us-ascii?Q?tBlBYdYh0Uu38atqsKhnYhTwCi7GDvn8FVXM3/ZvPGfPKan23BgLk061jPC/?= =?us-ascii?Q?Hk9bQBJhPFwUdffUD1Kc1CAi3WCFzleirR1J66A8XjIrTfX2yCVUYNAc6Qzn?= =?us-ascii?Q?YgMEGGFib3UlIY2CYoe0PamL?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: DM4PR11MB5534.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 572f0f52-4668-4a0b-20be-08d9516764e7 X-MS-Exchange-CrossTenant-originalarrivaltime: 28 Jul 2021 01:31:16.4980 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: x4cQl4it+bQOE2RVDOAWtG1Q2UUH3Tf6cipBDlYye1QTj35TdBIx6JeZFk4FiRsf/kmHp/SEsdaqOBvOSwevEQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR11MB1452 X-OriginatorOrg: intel.com Subject: Re: [dpdk-dev] [PATCH v2] 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 > -----Original Message----- > From: Gregory Etelson > Sent: Tuesday, July 27, 2021 21:08 > To: dev@dpdk.org > Cc: getelson@nvidia.com; Ajit Khaparde ; > Olivier Matz ; Andrew Rybchenko > ; Yigit, Ferruh ; > Thomas Monjalon ; stable@dpdk.org; Li, Xiaoyun > > Subject: [PATCH v2] app/testpmd: fix TX checksum calculation for tunnel >=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 by > 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") > Cc: stable@dpdk.org >=20 > Signed-off-by: Gregory Etelson > --- > v2: > remove blank line between Fixes and Cc > explicitly compare with 0 value in `if ()` > --- > 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 > 0161f72175..bd5ad64a57 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 !=3D 0) { > + 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 { else if (udp_hdr->dgram_cksum !=3D 0) { ? > + 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 !=3D 0) { > + 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 !=3D 0) { > + sctp_hdr->cksum =3D 0; > /* XXX implement CRC32c, example available in > * RFC3309 */ > } > -- > 2.32.0