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 E5A0642E3A; Mon, 10 Jul 2023 11:38:42 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 67A5540C35; Mon, 10 Jul 2023 11:38:42 +0200 (CEST) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by mails.dpdk.org (Postfix) with ESMTP id 5854440698 for ; Mon, 10 Jul 2023 11:38:40 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1688981920; x=1720517920; h=message-id:date:subject:to:cc:references:from: in-reply-to:content-transfer-encoding:mime-version; bh=B089CN+OZ6rfLgXjNvbI99irb4KiXdaU4y1yNkw/5nM=; b=ASb8noRicgvz+LYqfwRRlJl2tem2xhPCCTb4ep7obGw0h1Ob5RFqp5gu DimMaKG/F18CIhQcuckXdxO2RQ11CNnmhkINru8DYC1MNu4HzbUqIRQWR mkgz00VutVZ3eVNtXovS9kZWPDM+EsPlEzYOFT4JkBT8zFGb9FAFOshYo rsApYoaeeDqgLbP+9J3PoATnhWpOEcJWt1RWwzKKEozn0BoPYrLejRsQ7 uDYkABg06SXCsYKIshMyZ+GK2aR4/xOXYBnXVHlNC7ZseD5yekcIF3weO sublvtnpu5hRsuWSnmMR/bF5e+bkcnqImoBi6upi73PRYDA9lhQDYJfrd Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10766"; a="367794962" X-IronPort-AV: E=Sophos;i="6.01,194,1684825200"; d="scan'208";a="367794962" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Jul 2023 02:38:38 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10766"; a="786090965" X-IronPort-AV: E=Sophos;i="6.01,194,1684825200"; d="scan'208";a="786090965" Received: from orsmsx601.amr.corp.intel.com ([10.22.229.14]) by fmsmga008.fm.intel.com with ESMTP; 10 Jul 2023 02:38:38 -0700 Received: from orsmsx610.amr.corp.intel.com (10.22.229.23) 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.2507.27; Mon, 10 Jul 2023 02:38:37 -0700 Received: from orsedg603.ED.cps.intel.com (10.7.248.4) by orsmsx610.amr.corp.intel.com (10.22.229.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27 via Frontend Transport; Mon, 10 Jul 2023 02:38:37 -0700 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (104.47.55.174) 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.2507.27; Mon, 10 Jul 2023 02:38:37 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=X1k9qne7xGSoJgWMDu0Gz3u1orRozUiZL2inaVdpXS0/8Y2DAX0UImTC+JwXNWeyEHDPHUdddZCwHpyYOBXXJTy439DeJgiIkxL9s0DLTFupfuyljr9WMibBKWED65FYyz2XD4PXEe4byJ29MS0qflE92Lpr2w3352PuJy8YjG5FWvOOyzV2RRyTA/01c7Nf7CadK5zqar8nzILpPZa3bA/zGtNZ0Kp2iDfJnZwsaRtldK7jnsvxrwObCyjUZFNnuaHFsTVBVyhmxasNN5oPOGmy1XCkBYEw5CHi3hIBdifEreMqINomS/JeEa1fw+FbULeke7jlgEzbdK/iL80bow== 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=D5vOhFwRySHuCZmLiVyR9Lb+yzKDxpNRIt9PQgBRSGU=; b=WKVm5bNUEz+/PHPCIC/blydCvMdJA4rRxR0KbtEKWb99g4mWnfSMkosWSM17+YU4JVSmYedTydorbLEUXi56DC2wibbu5LB1G5dJRLouJ09uLrhUTLKgKOBJMQ11zSNgQQePStpCYPZcE7PY8kBdxf16z4lqPX9OcGJ6MAEaPJWtZQ1vIcjDDCVUvTlRVpVzqFuJslAX7WT2UzUtgWZyfks5VqCNP5oPCQ1PLnbi5fpinqTgLdIGHt6xavyUzCdZThfdwLpead6e9elXx88pAHzQ35bTFzjjSK0DnEXMuCfcEewM0vGHe/4Ee3gQn6tShrcPtQhjr9Qy/dlKT1VAZA== 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 Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; Received: from DM8PR11MB5653.namprd11.prod.outlook.com (2603:10b6:8:25::8) by SA3PR11MB7433.namprd11.prod.outlook.com (2603:10b6:806:31e::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6565.30; Mon, 10 Jul 2023 09:38:35 +0000 Received: from DM8PR11MB5653.namprd11.prod.outlook.com ([fe80::9d26:3f6:8afa:4543]) by DM8PR11MB5653.namprd11.prod.outlook.com ([fe80::9d26:3f6:8afa:4543%6]) with mapi id 15.20.6565.028; Mon, 10 Jul 2023 09:38:35 +0000 Message-ID: <9a65d0e8-a827-8329-4d49-2ef7c7984356@intel.com> Date: Mon, 10 Jul 2023 10:38:29 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.12.0 Subject: Re: [EXT] [PATCH] ipsec: fix NAT-T length calculation Content-Language: en-US To: Konstantin Ananyev , Xiao Liang CC: Konstantin Ananyev , Akhil Goyal , Vladimir Medvedkin , "dev@dpdk.org" References: <20230418084613.52740-1-shaw.leon@gmail.com> <05b87294-0b96-804c-f4e7-0fc3b3ccbbf4@intel.com> From: Radu Nicolau In-Reply-To: Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-ClientProxiedBy: DUZPR01CA0153.eurprd01.prod.exchangelabs.com (2603:10a6:10:4bd::6) To DM8PR11MB5653.namprd11.prod.outlook.com (2603:10b6:8:25::8) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM8PR11MB5653:EE_|SA3PR11MB7433:EE_ X-MS-Office365-Filtering-Correlation-Id: 576ab56a-de16-4fba-c077-08db81296eb3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 9QF1MBC76I93DlyZCkjGXYSsbuepcurLwHZuUijnwzqurzrNbSRCUYQV+LFUlEQ4V1HA0yBIxLth8OODI169dlCLZxhHdeT7oNDZZq1s4Ood2JV2HA6WqJm6o1xSnnESsX2fr1B38j4XgtLDxsqFrNjks4KxnJP5JR6JHbIJ0hHO4GQpLD8H7/cOQquxxe6cd4XI/MRtvEfE1Fp6Maa6C/nhrybRjhUEV5wTUhhlEUOefQwoORn6aWjNnB8In+ZE4xeptcZCP6ebeeUWewHb+IXSLd84s+ZTDITFE4QMZsjwWkthRbjXUG1OnP+Ge29AgzsK593Iq1Zs9wqS0kO0zWC2DPm8S43W04RmYiGyxYxsu9HDr6fTgVI+sW7wkoLWLN/vW3jQxJX2fDdHlR/Cc1DO7BPlB5GLyQuxu8uQ+NSd0mrO+Dft8MdyLEx1C+9rJeDQoBLtB5TL0liims54XWATf+j+92EuhK0a3pV8MVGh0PF4/3ANrXooOGOrkDwb9MVmFmdcQTK0T8xNVkgxnC6rS0IfyKMUISqr0PorSTevassNxd41oL2Vhp6GuG2gZfb7xHqHJHsBr8i8zBhJHMy+eI20/jPpQQnlTP6iwZlo3SXNWBFrDWZ8IrGvp5Wj1SrN9AvxFgqXryYhRWMYFg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM8PR11MB5653.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(346002)(396003)(39860400002)(366004)(376002)(136003)(451199021)(86362001)(31696002)(38100700002)(82960400001)(31686004)(36756003)(6666004)(6486002)(110136005)(54906003)(55236004)(6506007)(53546011)(26005)(186003)(6512007)(2616005)(44832011)(5660300002)(2906002)(66556008)(316002)(478600001)(66946007)(8936002)(66476007)(8676002)(83380400001)(4326008)(41300700001)(45980500001)(43740500002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?b2tITTJUaUpqSWg4QUNkdUxHdDNWc0YrWndGWDU2YUU5dnpxTUUrVnNIT0Ju?= =?utf-8?B?QnlSNGxSTks2U1dlNHVEaHpxdmxLbFhURjhoZnM0NUZDWFVWSlZ0ODM3SkZP?= =?utf-8?B?RWRGWG1rQW5oV0xQVWdWZEt1alc1UFVkYndSbHJYci9LTHZ5OWpCVzVXeGFy?= =?utf-8?B?cU8rSVNSVDR4UnhlTUhYNThQRUlCc2REbStRam5lbXhQWVFPa0d3aENZVStD?= =?utf-8?B?d205dzkvcFlPNXNaMU9vV2s2NUhFYUdlSmRwYXlzVUtVMG1leWdSY3ZNL3hB?= =?utf-8?B?c0l4amltaHZ0RXVYTW5OVS8vMVNNK2JvQmJ3ZDZVb0lFLyt4ZEY0Zi8zbzEv?= =?utf-8?B?ZkwrVGdCNDZyUjYxYisyVzhHN21EbllTNms5NFJreFJUcHlrb3JjV3pkUVBX?= =?utf-8?B?ZTBYRWZuc0J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4fba-c077-08db81296eb3 X-MS-Exchange-CrossTenant-AuthSource: DM8PR11MB5653.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Jul 2023 09:38:35.6232 (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: jZATNhYAg1utU6H/XZ0sagBsBAo5QhbAw7y6cqaqFf9CLUUXQ8Ss7DP/4gX4XQtseraBr9uqImXep6orZCBcCg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA3PR11MB7433 X-OriginatorOrg: intel.com 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 On 10-Jul-23 10:24 AM, Konstantin Ananyev wrote: > 07/07/2023 14:26, Radu Nicolau пишет: >> >> On 07-Jul-23 1:51 PM, Xiao Liang wrote: >>>> sa->hdr_len and prm->tun.hdr_len don't include L2 length so both >>>> should >>>> start in the diagram at the end of the ETH header. >>>> >>>> So the right way to compute datagram length is >>>> >>>> dgram_len = mb->pkt_len - sqh_len - sa->hdr_l3_off - sa->hdr_len + >>>> sizeof(struct rte_udp_hdr) >>>> >>> |<-           mb->pkt_len - sqh_len ->| >>> |<- sa->hdr_l3_off ->|<- sa->hdr_len ->| >>>                                    |<- udph->dgram_len ->| >>> >>> +--------------------+------------+-----+-----+---------+-----+ >>> |         ETH        |     IP     | UDP | ESP | payload | sqh | >>> +--------------------+------------+-----+-----+---------+-----+ >>> >>> |<- sa->hdr_l3_off ->|<- l3_len ->| >>>                       |<- sa->hdr_len  ->| >>> >>> If hdr_len doesn't include L2 length, I would agree that >>> >>>      dgram_len = mb->pkt_len - sqh_len - sa->hdr_l3_off - sa->hdr_len + >>> sizeof(struct rte_udp_hdr) >>> >>> But then what's the point of >>>      sa->hdr_len - sa->hdr_l3_off >>> in lib/ipsec/sa.c? >> >> I will defer to Konstantin for a definite answer, that is if >> sa->hdr_len is supposed to include l2 length / offset or not. If it >> does, then the change that triggered this discussion is correct and >> we don't need to account for hdr_l3_off there. >> > > > Ok, have to revive my memories here. > So, actually hdr_len stands for all tunell headers users want to add. > It consits of optional l2_len (could be zero) plus outer ip len, plus > in that case udp hdr len. > hdr_l3_off is an offset withih hdr_len where outer ip header starts. > So yep, initial patch looks ok to me, I just acked it. > Sorry for being a bit sloppy at reviewing it. This fix should also be CC'ed to stable@dpdk.org Acked-by: Radu Nicolau