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 B026242DF8; Fri, 7 Jul 2023 15:27:05 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3BEBE406B5; Fri, 7 Jul 2023 15:27:05 +0200 (CEST) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by mails.dpdk.org (Postfix) with ESMTP id 4828F40685 for ; Fri, 7 Jul 2023 15:27:03 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1688736423; x=1720272423; h=message-id:date:subject:to:cc:references:from: in-reply-to:content-transfer-encoding:mime-version; bh=n0K2hB9RqOcszynfB6mtTxzh1bmUaaEHMl2Gk72NYF4=; b=kusnVcy2yfWL3F+GwQD0wvDd+TK5lTRMW/v1gAl7ZVrHml9TsOHiTvJM rCE9qKDOa8SUo4u+CYm9mP8oQ8VWj8AdYCKG4uvZNHL5Gk+NZcl25uAGh uLieASpOoQH7zAkJFt3B066gCm3tjcJs/RgCzOrVuEMqB8E3TRy+pMQLB 3367h71x6auFxEnJeQwobyqzMdcXcfVMHqVNr6gS0k4iuZdtFiAq9EV4i PG3Zek592hncvWaGerSUrxrwjS3+hqUw+obZ98kzWGo0VXXSAa3ccpkqB Z2/I1xqfQDx9gM1/C1z1nwAt2gW3XNolTtQPRK36NRvd68QYn/jv4BsVm w==; X-IronPort-AV: E=McAfee;i="6600,9927,10764"; a="367377479" X-IronPort-AV: E=Sophos;i="6.01,187,1684825200"; d="scan'208";a="367377479" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Jul 2023 06:27:02 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10764"; a="723229439" X-IronPort-AV: E=Sophos;i="6.01,187,1684825200"; d="scan'208";a="723229439" Received: from fmsmsx603.amr.corp.intel.com ([10.18.126.83]) by fmsmga007.fm.intel.com with ESMTP; 07 Jul 2023 06:27:01 -0700 Received: from fmsmsx612.amr.corp.intel.com (10.18.126.92) 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.2507.27; Fri, 7 Jul 2023 06:27:01 -0700 Received: from fmsmsx612.amr.corp.intel.com (10.18.126.92) 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.2507.27; Fri, 7 Jul 2023 06:27:01 -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.2507.27 via Frontend Transport; Fri, 7 Jul 2023 06:27:01 -0700 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (104.47.55.177) 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.2507.27; Fri, 7 Jul 2023 06:27:00 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hicn8v7jDerO6B6kOOr2u6YodfFxERyAr5kBp1nDpH+RvV7VUQRKNPwlTfLM0y71nKuHYLkdWkvhVVwUrTiPZycGS4U1xXIbfl6JGTuciIKHwNcDMx1Gd9ps4BhedbYKIs8HUMnK8uGTtljB3yJbU91sEV37Ro+HC1VDZ7v8IvCMgJs7K3xRwhBJd6JLb8rByb6Ji4+RDX87FDD4+L3AjvdKzFaHWQl296lspBl64JIjxZDhzwFCSUmJSA8/GFsrZdlI7wP8lBCLtHF1/zQCNnQJE0ukUUc70lXaURUb39dJmbFT7ZCp2QoIXFqj0vaXZMr0yaI29DYNrPRpdNhLAQ== 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=IHmUAvDVOKwhkEY51QzeH//cGzwRFRlpMPIJKC4VIho=; b=RI0u2C5o8Fa0Mavbr4qpz3qd8iErgX02CwehA6slf0HsEnXUeUMBOmG+Kc+RquvGOjliMufypIhtstfx7DXkfNAqdFrQHWLnsDUkX1QAhKJ7iwRfPDAQTBI6ENgTCcKcjbKG3XEBNDdKBgvlzlhVxrwDKvNo6LJgJAAiDi4cV/O17MBQfiIgTSjtMoPq81FynJBtaZ7rPg74M4Al8ZPRHYtQwA8t9m/2TNAQQ6Rcfj1K8AYddccm7KzaydqKBsQJVVdUn35yeQzhK7Hh/w8mcwqW5iN0ETFshC4A+7Tfl1fDtYoyjenqPtkbOZHPsHPQKsLy4/+Pt/gA2bHl1w9Gag== 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 LV3PR11MB8603.namprd11.prod.outlook.com (2603:10b6:408:1b6::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6565.25; Fri, 7 Jul 2023 13:26:58 +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.025; Fri, 7 Jul 2023 13:26:58 +0000 Message-ID: Date: Fri, 7 Jul 2023 14:26:53 +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: Xiao Liang CC: Konstantin Ananyev , Akhil Goyal , Konstantin Ananyev , 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: 7bit X-ClientProxiedBy: DB9PR05CA0008.eurprd05.prod.outlook.com (2603:10a6:10:1da::13) To DM8PR11MB5653.namprd11.prod.outlook.com (2603:10b6:8:25::8) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM8PR11MB5653:EE_|LV3PR11MB8603:EE_ X-MS-Office365-Filtering-Correlation-Id: 1090c134-d824-4e15-f25a-08db7eedd721 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: gAK2XmcgdB0WzjC5lOGKfbUjLq2dxwPXRs4KkJTROf1Vp9nEBls/O+lILndXTssjHdDzVZAoZKyHGtvJht4gkt5PdA+Zig3qrZmYbHF945SfIudm+NBPupwQO7IfpLliHCTJSt4wsao7VlmtJhIw9qg5Hf9Pn92TZbFNlLvRE3HHVjQXjzBzd0CdrVr3wFpzm0kbgVpI01NYxAwD8pXv7JgsTENxbS2Q8G2o0LzjyEmS7zZbeJjkxYlofwcoDrBvHWpkAldrYCDzQWUIwF8Ar7eFGoeudmBwUWZZ5xIfJbDx3+CwycobBMOBdh8W6lr3T9UOtCUlThlRae/kDbieyyDxQEpo+onh1vT9I7pSnxV6UjySa4TcoySiAPEQBjMLFzf3klmMI8Vp7DM9KfFZ5DOMIEdMLqHH73lYu7HMe080oPgPotyBgNKOfjal2B9KpZ8YC0YaAhIaUx4yroGpgS7PiMdMxk57zqWOQm8Agq95PMQGivqtW6Tx+UpK68sm6qA+XYydUXPpZiJTFiipdYzDJQtBXoKvsTEzNa3E+yxKpwzXsI7Qb5yuBVK1zClWxNIbbgz457+HsWHGiadQz/eyCw3yH0gaSbiBtm74UdV+77A7NepeMu4ivZjQKDHdwmEasEI+IMhKOEQA4sxrTQ== 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)(136003)(366004)(376002)(39860400002)(396003)(451199021)(83380400001)(2616005)(2906002)(66476007)(66556008)(6916009)(4326008)(6486002)(66946007)(6666004)(316002)(54906003)(478600001)(8676002)(5660300002)(26005)(6512007)(186003)(6506007)(44832011)(55236004)(53546011)(41300700001)(8936002)(38100700002)(82960400001)(36756003)(31696002)(86362001)(31686004)(45980500001)(43740500002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?bE9SczNoL0xUaml4RVd0YnoxYVJ1YW11S1lvUnkxb05QR3BuUzRIZ2dhaFkw?= =?utf-8?B?MkNGRXBNUUd4ZlFJaUs3RDFaK1dzVm1VMFQ0L1BzeFpROThOY011QytsYmt5?= =?utf-8?B?KzBkMk1wZjR5dzZiM0NLZjdkQ3dFZWZhODBqUS9uVDB3OTJSUTFLK0tJQzc2?= =?utf-8?B?OFBNRzNrenpKRFBOb1BPUWRIaUhZYmtzQjVZVXh0OUpQRndMSXNobUNjc2RK?= =?utf-8?B?Z3kyZTVIcyt5Y21lbmFoNGgyeGRnSktRb1ptR04rcS9GaUcrSFE2NEpSaTN3?= =?utf-8?B?N25aT2FzO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xY1NXa3lPZ0lXV3VBaVU0?= =?utf-8?B?aSthbi9kaERVVG1MMkMwRGVRVGJPeW1uMDFFVTg0UU02azUzcDdPZlFJTnp6?= =?utf-8?B?anc9PQ==?= X-MS-Exchange-CrossTenant-Network-Message-Id: 1090c134-d824-4e15-f25a-08db7eedd721 X-MS-Exchange-CrossTenant-AuthSource: DM8PR11MB5653.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jul 2023 13:26:58.7383 (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: +JOQK3OTDd5GAtQq7gT/WDFoT94VYOhDyBguOz8XscdKqUlJPQy07D38OWqOJRBqUT7KPQlLDvnLdEJrVFaQ6w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: LV3PR11MB8603 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 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.