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 7D0C5A0C45; Fri, 3 Dec 2021 12:31:20 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0DF114014F; Fri, 3 Dec 2021 12:31:20 +0100 (CET) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by mails.dpdk.org (Postfix) with ESMTP id CC32440041; Fri, 3 Dec 2021 12:31:17 +0100 (CET) X-IronPort-AV: E=McAfee;i="6200,9189,10186"; a="323212899" X-IronPort-AV: E=Sophos;i="5.87,284,1631602800"; d="scan'208";a="323212899" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Dec 2021 03:31:16 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.87,284,1631602800"; d="scan'208";a="678065687" Received: from orsmsx601.amr.corp.intel.com ([10.22.229.14]) by orsmga005.jf.intel.com with ESMTP; 03 Dec 2021 03:31:16 -0800 Received: from orsmsx601.amr.corp.intel.com (10.22.229.14) by ORSMSX601.amr.corp.intel.com (10.22.229.14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.20; Fri, 3 Dec 2021 03:31:16 -0800 Received: from orsedg603.ED.cps.intel.com (10.7.248.4) by orsmsx601.amr.corp.intel.com (10.22.229.14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.20 via Frontend Transport; Fri, 3 Dec 2021 03:31:16 -0800 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (104.47.66.48) by edgegateway.intel.com (134.134.137.100) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2308.20; Fri, 3 Dec 2021 03:31:15 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JqNGFSsGhNJQTB8wUwPNK6ET3MWs1ghFU0w3zCSltO+Ld9Uprrz5HgzxBlB2AiPb/zlCEuVCyrwCuqeG7YB2ePkJrORwLX1wPkzoqIA6NcbNyubQ8ybuQ8TA8p6zXH14zdUy4Bb8MGv7AvmE8+lFJeM7XBcVMfqchSe35aGipe8eH5PiZrwNpngqS64ownUSkrKblc7IZJmQK0i6d7tXQFYkxdRMyAQBvmPnjU0Vnf68+d/SUdjUaAy3UHXMcQUeSf6Dq2ihd6AqcRznYdL1Xdn/VE7J5EL8a88Z2jT1go8rtppUuuCD+M+v9uTj9QJf+phh/1CsXLvY9nUcE49hIw== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=yezbpAzt1RwaW4MCg9dyZHAVsHTaaa/RA82eI0MrJNQ=; b=NK6gpO2Cpxu6ejCZKBeGw/0hflMfJMldYXgxt5TMXT2Qk5ROqkQjFnC2ibwE1c39xOXfIFGINK1VEJGOlhmuPrJXnirXFJZazVi/3Lk1dmOW8vfvTXFQnJ0lglOK/xzeDVCNOeXd0D9oF8wqUvM/5idXmLGuE0ZhSAih2u6cTzomSTPPEowXO1x6nE4Dj5N9qnqVqHgyCaA9iEWhy12Ia7bpn6xI0jxCv1snTH8nJ5cX3grbmU2rNZFRp6RfPE8Frluk02sajEqY3l0YkaWgduqdIAoHPzwBilVfFpbtcF2Kucq6tmIW14Z4qO5zsCcUThcontf4pGW6NfwsieH0ZA== 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=yezbpAzt1RwaW4MCg9dyZHAVsHTaaa/RA82eI0MrJNQ=; b=jzBzyiZp7EfqOIqkuiQzBIm1xGa69kdVPORTB82cRMPE7TIRKc2pBrMaSkQy3aQM56wHL1R1UeUrZCpUG44VNWB6DA18JtDZBSeNtAC6NMGh0AeJoBoUqWs3zYJxRl5++JB3VSsArMQ033oOCQVnFqWj1OvrDnZ6YcfiVZ/noqA= Received: from DM4PR11MB5534.namprd11.prod.outlook.com (2603:10b6:5:391::22) by DM6PR11MB3771.namprd11.prod.outlook.com (2603:10b6:5:13f::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4734.23; Fri, 3 Dec 2021 11:31:15 +0000 Received: from DM4PR11MB5534.namprd11.prod.outlook.com ([fe80::f590:d8c0:98ae:d616]) by DM4PR11MB5534.namprd11.prod.outlook.com ([fe80::f590:d8c0:98ae:d616%8]) with mapi id 15.20.4713.031; Fri, 3 Dec 2021 11:31:15 +0000 From: "Li, Xiaoyun" To: Olivier Matz , =?iso-8859-1?Q?Morten_Br=F8rup?= CC: "Yigit, Ferruh" , "Ananyev, Konstantin" , "stephen@networkplumber.org" , "dev@dpdk.org" , "stable@dpdk.org" , "Medvedkin, Vladimir" Subject: RE: [dpdk-dev] [PATCH v3] app/testpmd: fix l4 sw csum over multi segments Thread-Topic: [dpdk-dev] [PATCH v3] app/testpmd: fix l4 sw csum over multi segments Thread-Index: AQHXxZwZKzB52hrfJkmaoGWtM5GX76vmtSmAgAALiQCAAvImAIA3NCtg Date: Fri, 3 Dec 2021 11:31:14 +0000 Message-ID: References: <20211015051306.320328-1-xiaoyun.li@intel.com> <20211020101243.203063-1-xiaoyun.li@intel.com> <66ba870b-947f-29aa-45da-0e6f930b2398@intel.com> <98CBD80474FA8B44BF855DF32C47DC35D86C6A@smartserver.smartshare.dk> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-reaction: no-action dlp-version: 11.6.200.16 authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 0fd33acf-093c-44ea-15a4-08d9b6506a9d x-ms-traffictypediagnostic: DM6PR11MB3771: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:9508; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: TltPgsSXBlie+JlzXdRNXvvmpmEd+yhibNWHmWnB7lpDhOIOanG7dpbbautRVc0Lp+r/DQEQkrf4A5AXArTojo/0hSo41/3FF8GMJMn6QJlgL5KfbgoPib/sz7UBzsr8XRqxSlebHMsetjer1GqalefLSLVkh9wGU/y5jYetCy6j/2VwlYcYUx5txBgTeAhgtyKJaU5wsjUZl0vAVGpD9O2MlgTwvk6K4IX+QJYjfSKivg6kzcs9XbbKR+LDK7xoUfQ7xtvAed8bW0Pqchqi9n3V+KK1nXZjx10KJFwIWrA6gKuA1kUJmH/5nP2zil6Qid0J55I+OUP1E0mZyuypGFxG/Ll2TbcRcOZrj/csqCjzlXHuI4ZaAixdViv5HN9rLJlKUCqRiC+CnVewHeDSYyILxaG8AWAyAsBB/xHBg2lVR6WwjyBwbiHW07hWOBjw0OqLxWY7iQjWHKh9rDHl+4WSYhprdr1eOmwEJXJy++zXGvfP9iiLZFjM58iQ8EWiC4/fLOF0oJ/pZMEimnbDbylwxORkNDyogg0Wu6+zX+gjqsBn97D31bAK5etlVNQUs4KcMCgrNqPkhtw111TjGrh00g7WKTWmk/pHo4lwaJmKX6mEEsowN94+9TjvSWPI1tlHJX99Q9kWMhz0EfiZ4FSjmZKw3NFllaVn77lzUqupuuvuGZy5tB23nWAToANgSafem3RpE9REzo9xhC76D38LEhe8bjpREAZcTrqkJLTjKHbM8DoJgwUe3ulpD+Mh+DiDzfpRy/boM6qGaJjGJMLHN1J3WoWXDpcpGirmk84= 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:(366004)(966005)(66946007)(4326008)(8936002)(66476007)(66446008)(66556008)(8676002)(26005)(55016003)(110136005)(316002)(54906003)(64756008)(66574015)(76116006)(33656002)(186003)(53546011)(38100700002)(2906002)(6506007)(52536014)(7696005)(83380400001)(9686003)(38070700005)(122000001)(107886003)(508600001)(82960400001)(5660300002)(86362001)(71200400001); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?Q?Yk68CtZqQTH8XpMQe4WuwlIzz/FmtL36CpHkxRZPjj87ZyCWgGVVeaEoFy?= =?iso-8859-1?Q?dXy2ymxuz/EjE7EdWTJ3MqXEPX1x0tTwFTR0YBtlItyrmN+tBWy7DZLW7+?= =?iso-8859-1?Q?30oQZY95uS+geaJSfjff2OH81k54ArONiYxyJSQLaIy6h/rlON+IHovrWr?= =?iso-8859-1?Q?pYMI3IS9E1XYCScNykwFLDMPNfMwzic39INdgt1rZN/Xi8yinOOTTvY1sF?= =?iso-8859-1?Q?fqynXfKn00ClqTGvFORiCHUscaHktUvIyJ435RTdGPRIC1Bcs5cu3b3hFj?= =?iso-8859-1?Q?Jr1mSfke7fU4lLIdW5RM0TODWwCajyQ54+57TdgaCPe5B9h7BrLnrPa/Ih?= =?iso-8859-1?Q?K0tIZDVQ7gkVMBLd+zl6yrzLg/xiI0hrvoVgmPO0Xq8VWdBqalSFYlbJ4r?= =?iso-8859-1?Q?CP8iCD7tRWpgBRnAteM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q?t0dpZNU7/8wcoD0yjY4vlNBxmO7u9ew+WeioRw5xX4QG8ftRMtrRhbiOZF?= =?iso-8859-1?Q?WQhZ0lSqaOG+fncdX7F+99Z0OatxIFFVvc2vaf0rLrZ1t9tpeyiRYkABER?= =?iso-8859-1?Q?hEdxGgtN/yDtTkYvLCM++QjwsL0znkhbOvvRTF6KKzIus39zE0q4zd+fzT?= =?iso-8859-1?Q?zJHHNTP87AXbYnn73kcF1H5tDEQpMfDsWvfjQfmohoQWlfH0OqcP5L/DXr?= =?iso-8859-1?Q?3YyK+n/on9jcwlCTn/6NYgRu1NyNBX5BCbpOSZV73dgzJFxb5y/ryaTPaS?= =?iso-8859-1?Q?eSgOvg8B275BZO8dQ2g89tsoDBMFm0doXvgYaOSxegAEZWRI1vxybkEPdP?= =?iso-8859-1?Q?altugj2avyCi441KX0k=3D?= Content-Type: text/plain; charset="iso-8859-1" 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: 0fd33acf-093c-44ea-15a4-08d9b6506a9d X-MS-Exchange-CrossTenant-originalarrivaltime: 03 Dec 2021 11:31:15.0331 (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: fhFzU5NiX28zFifPYAf8UaF3iB0wy9t2Q5uRvIIfj7IAkV6ZAj8Qix41NQrIj+Z9A0RGzVYPTKwWpIc35fmx2Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR11MB3771 X-OriginatorOrg: intel.com Content-Transfer-Encoding: quoted-printable 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 Hi > -----Original Message----- > From: Olivier Matz > Sent: Friday, October 29, 2021 09:29 > To: Morten Br=F8rup > Cc: Yigit, Ferruh ; Li, Xiaoyun ; > Ananyev, Konstantin ; > stephen@networkplumber.org; dev@dpdk.org; stable@dpdk.org; > Medvedkin, Vladimir > Subject: Re: [dpdk-dev] [PATCH v3] app/testpmd: fix l4 sw csum over multi > segments > = > On Wed, Oct 27, 2021 at 01:29:52PM +0200, Morten Br=F8rup wrote: > > > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Ferruh Yigit > > > Sent: Wednesday, 27 October 2021 12.49 > > > > > > On 10/20/2021 11:12 AM, Xiaoyun Li wrote: > > > > In csum forwarding mode, software UDP/TCP csum calculation only > > > > takes the first segment into account while using the whole packet > > > > length so the calculation will read invalid memory region with > > > > multi-segments packets and will get wrong value. > > > > This patch fixes this issue. > > > > > > > > Fixes: af75078fece3 ("first public release") > > > > Cc: stable@dpdk.org > > > > > > > > Signed-off-by: Xiaoyun Li > > > > --- > > > > v3: > > > > * Use rte_raw_cksum() for multi-segs case instead of copying the > > > whole > > > > * packet. > > > > v2: > > > > * Use static stack memory instead of dynamic allocating in > > > > datapath > > > > --- > > > > app/test-pmd/csumonly.c | 68 > > > > ++++++++++++++++++++++++++++++++------ > > > --- > > > > 1 file changed, 53 insertions(+), 15 deletions(-) > > > > > > > > diff --git a/app/test-pmd/csumonly.c b/app/test-pmd/csumonly.c > > > > index 090797318a..f3e60eb3c3 100644 > > > > --- a/app/test-pmd/csumonly.c > > > > +++ b/app/test-pmd/csumonly.c > > > > @@ -91,12 +91,41 @@ struct simple_gre_hdr { > > > > } __rte_packed; > > > > > > > > static uint16_t > > > > -get_udptcp_checksum(void *l3_hdr, void *l4_hdr, uint16_t > > > > ethertype) > > > > +get_udptcp_checksum(void *l3_hdr, struct rte_mbuf *m, uint16_t > > > l4_off, > > > > + uint16_t ethertype) > > > > { > > > > + uint16_t off =3D l4_off; > > > > + uint32_t cksum =3D 0; > > > > + char *buf; > > > > + > > > > + while (m !=3D NULL) { > > > > + buf =3D rte_pktmbuf_mtod_offset(m, char *, off); > > > > + cksum +=3D rte_raw_cksum(buf, m->data_len - off); > > > > + off =3D 0; > > > > + m =3D m->next; > > > > + } > > > > if (ethertype =3D=3D _htons(RTE_ETHER_TYPE_IPV4)) > > > > - return rte_ipv4_udptcp_cksum(l3_hdr, l4_hdr); > > > > + cksum +=3D rte_ipv4_phdr_cksum(l3_hdr, 0); > > > > else /* assume ethertype =3D=3D RTE_ETHER_TYPE_IPV6 */ > > > > - return rte_ipv6_udptcp_cksum(l3_hdr, l4_hdr); > > > > + cksum +=3D rte_ipv6_phdr_cksum(l3_hdr, 0); > > > > + > > > > > > Hi Xiaoyun, > > > > > > I can see 'rte_ipv[46]_udptcp_cksum()' is not taking multi segment > > > mbuf into account, so this fix is required, but instead of > > > implementing this logic into testpmd, what do you think to have APIs > > > to support multi segment mbufs? > > > This way other applications also benefit from it and we don't need > > > to maintain ip4/6 checksum related code in testpmd. > > > > +1 > > > > Also, there is no need to implement the multi-segment raw checksum loop > in test-pmd. > > > > You can use the multi-segment raw checksum function in the net library > instead: > > http://code.dpdk.org/dpdk/latest/source/lib/net/rte_ip.h#L224 > = > +1 > = > We can have mbuf variants of udptcp checksum functions: > = > rte_ipv4_udptcp_cksum() > rte_ipv4_udptcp_cksum_verify() > rte_ipv6_udptcp_cksum() > rte_ipv6_udptcp_cksum_verify() > = > Adding a "_mbuf" suffix would be consistent with rte_raw_cksum_mbuf(). Thanks for the suggestion. Since it's API change, I'll send these in 22.03 = release with release note. V4 will come soon. > = > = > Olivier -------------------------------------------------------------- Intel Research and Development Ireland Limited Registered in Ireland Registered Office: Collinstown Industrial Park, Leixlip, County Kildare Registered Number: 308263 This e-mail and any attachments may contain confidential material for the s= ole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact = the sender and delete all copies.