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 1A128A0C4B; Wed, 27 Oct 2021 12:48:48 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D85B04068C; Wed, 27 Oct 2021 12:48:47 +0200 (CEST) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by mails.dpdk.org (Postfix) with ESMTP id 9F9954003F; Wed, 27 Oct 2021 12:48:45 +0200 (CEST) X-IronPort-AV: E=McAfee;i="6200,9189,10149"; a="210215147" X-IronPort-AV: E=Sophos;i="5.87,186,1631602800"; d="scan'208";a="210215147" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Oct 2021 03:48:44 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.87,186,1631602800"; d="scan'208";a="494752614" Received: from fmsmsx603.amr.corp.intel.com ([10.18.126.83]) by fmsmga007.fm.intel.com with ESMTP; 27 Oct 2021 03:48:44 -0700 Received: from fmsmsx609.amr.corp.intel.com (10.18.126.89) by fmsmsx603.amr.corp.intel.com (10.18.126.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12; Wed, 27 Oct 2021 03:48:44 -0700 Received: from fmsmsx612.amr.corp.intel.com (10.18.126.92) by fmsmsx609.amr.corp.intel.com (10.18.126.89) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12; Wed, 27 Oct 2021 03:48:43 -0700 Received: from fmsedg601.ED.cps.intel.com (10.1.192.135) by fmsmsx612.amr.corp.intel.com (10.18.126.92) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12 via Frontend Transport; Wed, 27 Oct 2021 03:48:43 -0700 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (104.47.70.101) by edgegateway.intel.com (192.55.55.70) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2242.12; Wed, 27 Oct 2021 03:48:43 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Hpu5Xtc+Z9bpohOIJq3DV1AycCfHE4xnGpwqSGazsAor0udqtYEQn+HPkfEqHzifCveWS7C2+TfOPYiXsjuFkmM88q54GByq29fm4vB2dDky1XdWzt2xteYeJ4z5MZVNoJ7wpV9/MzsP2HLPwRMGc8van0LsI4hN5LaomRhFUEt3jCJh3lTN75H3t4KzLYiH85/89Tptr2KFX03RwJ0ACi5X1TZfyKoO6+FEJb9tSGhD+8M1p8uv7jFRIun3HI8e3ekxETO6bszEFHrVhEDPPjxTvTJvtIvUix7A0jOEzkikugd8JFx3z0E68csZ0M1a7N1ooQri88BKb1y3NrqFNQ== 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=9UIKEcC6sqZNPGPPmYSWchdF5oOJgoYuUEB2IwyxN8Y=; b=WPN6hjSHQFRArKhiM4RB0ilH9ssT/TIrg2mYRtN850cRxG06b3YmJYJ2jGTVA7ex/+DJRb3WWhJAVqTfxT9IAA6A2Oz5HLCnw6wNYQUB/ddyDC/1EG7dnMtHuts33A9EPxQLR5wRoHcWDRJmrmtAvdm2TRxLdJi7B6R11w00tq13EneYGImA0UB9lLmekTVk/ulQjbJrSVnzMvYgf5ethANMXgUsVnEcLQjs64yUiLhWelyMBK69JIxJxfY6bSD9rVtwuc7EbnFTrDwbxEEcd78QlHl/StU0bIGV72YKsZXXR4vy94Wq6JM/icRSlinbV36igiS0c5PCwsuOqJFphA== 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=9UIKEcC6sqZNPGPPmYSWchdF5oOJgoYuUEB2IwyxN8Y=; b=gcQ6LH9invj0tKJBVsecdCExG8VH2mOe4dZzTXtUu7tCXZx3n3ZjggmCivsBt8zaHpajl/y3x/MIObUxb39p4i6hbBXFbvrOhUBzy71M9FzEh1HZudna2lXaEQahwU0G8Ew9xJnhby1ZiX7Md8hcXRv3zpi7v5kQ4ebtdl9Y/vI= Authentication-Results: intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=none action=none header.from=intel.com; Received: from PH0PR11MB5000.namprd11.prod.outlook.com (2603:10b6:510:41::19) by PH0PR11MB5080.namprd11.prod.outlook.com (2603:10b6:510:3f::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4649.15; Wed, 27 Oct 2021 10:48:42 +0000 Received: from PH0PR11MB5000.namprd11.prod.outlook.com ([fe80::bd7d:29be:3342:632c]) by PH0PR11MB5000.namprd11.prod.outlook.com ([fe80::bd7d:29be:3342:632c%6]) with mapi id 15.20.4628.020; Wed, 27 Oct 2021 10:48:42 +0000 Message-ID: <66ba870b-947f-29aa-45da-0e6f930b2398@intel.com> Date: Wed, 27 Oct 2021 11:48:35 +0100 Content-Language: en-US To: Xiaoyun Li , , , Olivier Matz CC: , , Vladimir Medvedkin , =?UTF-8?Q?Morten_Br=c3=b8rup?= References: <20211015051306.320328-1-xiaoyun.li@intel.com> <20211020101243.203063-1-xiaoyun.li@intel.com> From: Ferruh Yigit X-User: ferruhy In-Reply-To: <20211020101243.203063-1-xiaoyun.li@intel.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-ClientProxiedBy: DB6PR07CA0051.eurprd07.prod.outlook.com (2603:10a6:6:2a::13) To PH0PR11MB5000.namprd11.prod.outlook.com (2603:10b6:510:41::19) MIME-Version: 1.0 Received: from [192.168.0.206] (37.228.236.146) by DB6PR07CA0051.eurprd07.prod.outlook.com (2603:10a6:6:2a::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4649.11 via Frontend Transport; Wed, 27 Oct 2021 10:48:40 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ae53dab7-a557-4735-1dd7-08d999375776 X-MS-TrafficTypeDiagnostic: PH0PR11MB5080: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6790; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: hJ7ghUE0G1osYb+/dOxh1xr8GZANR+ByrPdeBzVJhnamAgnq5P3JziuQXZAQF5adfTnEu2ocQZ1yiYxGTNwnsW2uAiSKIC9SlA+LYTgG3KcxmjcsgN1QKsI0bNrAZ7XkPQXBJSqNMS4bv4q2SXLfFDxnoZnImleEFAcJs8honZi9ZCVjEldUfsoJEE5wXWgE8w8CXnXsGqNhx9C6eguOhRUU1C1NEVmffra2EdwoAT9Fn4Stbz6OrX2i8burRKJDV5fyOpWlpFg/LA1c9EzSHOESWULZn0w+o5JL407ZU2P9X+bGN4gFyUMH+5ThHBi//+A8ujum4FB2/lpV+nYOyekFgNCM1NLGjlXXY9deUK6BZuu/Aouirw2H/nqTcteZrl25e+TDxn9xu5JYCw5DcPRDzuuIjDqiakKnPTtBuVUypEDwynzOkePpdOPFHX0CuYL6m2Xi/tzpbMJaMtdL5p+lvoi0s2SEL4nCu9Alki4iZXBtEZglZiCEtQNGHTP/MrLFMcc8nUDbeSYkq/LtV2CEQ18bgUiUgAeFzt5XvKRHpJe7IrQMAYWSi/QInZ3SDxvBbN1cCBPT5cyr8D3XUJO3zgdNQIYUiI6vM0f+CrONpj4UJHMnW6ITAxBL0h5Eiy0JSjRuBZI7U1cJUbQ5bKeJUKkMNAslvdSuAAENpgYMbGSlvUwUBRn4sFjHU8mF2CsquX8uMSr8VOPLW+xFRw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PH0PR11MB5000.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(366004)(82960400001)(86362001)(31696002)(31686004)(956004)(508600001)(2616005)(26005)(53546011)(66476007)(66556008)(6486002)(16576012)(316002)(8676002)(2906002)(8936002)(44832011)(5660300002)(66946007)(4326008)(110136005)(6666004)(54906003)(36756003)(83380400001)(38100700002)(186003)(45980500001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?NGxGUFlnRENKUDZ0RjNEYWhLQnRsQlQzSkdMajFnb3pmaXVIRll3aUFEcTBp?= =?utf-8?B?LysxV2czc2g5TVg0RGd5a0E2YXJIQ0g5MU9iaGVpSDRSR0J5ODJzY0tsRkpz?= =?utf-8?B?c3VSWkx1M2kzYnE3dkFDQzk5SFZhSlhtanBDQ01LRDV1VG9YZk5nS3RaTllm?= =?utf-8?B?OFBIWHlVeXAvclNhR09hcEdZcVh3VUtib1AxY3ZqZ25hanVRR3NnU2ordEU2?= =?utf-8?B?MmR4MEl3NWdKUEJTMjdtS0dJZlpZYTNoZSs1dEVvSnZ1Z21FbWY2cVQyMmNR?= =?utf-8?B?VmU1ZVozKzZXUVBieFhMSU9qTGhmZUlPQ2M3RmlUR0hCZ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-8?B?OENUbVdBcHIydlVjU3ZMb1JySmhNWFZCWWxUMnVnMHYrQVZNUHZsUVpjOFor?= =?utf-8?Q?ASg4+OCh03LZZTKdtB+LJMg=3D?= X-MS-Exchange-CrossTenant-Network-Message-Id: ae53dab7-a557-4735-1dd7-08d999375776 X-MS-Exchange-CrossTenant-AuthSource: PH0PR11MB5000.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Oct 2021 10:48:42.1953 (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: AQZrGi1+11otqBcdsspW/vkM7O0w57OZVTmuVvBTHo1C/biSus45XRvwkzD70PiwJ8wkPPYDE+o/1Bh5N5INJg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR11MB5080 X-OriginatorOrg: intel.com Subject: Re: [dpdk-dev] [PATCH v3] app/testpmd: fix l4 sw csum over multi segments 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" 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 = l4_off; > + uint32_t cksum = 0; > + char *buf; > + > + while (m != NULL) { > + buf = rte_pktmbuf_mtod_offset(m, char *, off); > + cksum += rte_raw_cksum(buf, m->data_len - off); > + off = 0; > + m = m->next; > + } > if (ethertype == _htons(RTE_ETHER_TYPE_IPV4)) > - return rte_ipv4_udptcp_cksum(l3_hdr, l4_hdr); > + cksum += rte_ipv4_phdr_cksum(l3_hdr, 0); > else /* assume ethertype == RTE_ETHER_TYPE_IPV6 */ > - return rte_ipv6_udptcp_cksum(l3_hdr, l4_hdr); > + cksum += 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. btw, how are you testing this?