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 E99C843C05 for ; Tue, 27 Feb 2024 11:10:44 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E400F4027D; Tue, 27 Feb 2024 11:10:44 +0100 (CET) Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.16]) by mails.dpdk.org (Postfix) with ESMTP id 4EB6040150; Tue, 27 Feb 2024 11:10:43 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1709028644; x=1740564644; h=message-id:date:subject:to:cc:references:from: in-reply-to:content-transfer-encoding:mime-version; bh=AEnTWYgbZVL4OJ8eCSt5J+Fz+Pj7h3370Dwh4pj2zFI=; b=cLHfyzRhOLsvY1jkeMFYu3a2EGDlr/DE19Iekz6aXUyaK7Bmzi4sgZQP QYRKPMUIc6ESPaAbK4WhJq0GHDvOuv+eQZDBvTGErdHC76fx4nnmAaR+9 pF1nhPUF1ujxDAZOKEgKfa8EuDgdiRWGm8l+eVorZnseAodeGrXhCrO3Y ZDLpClEbH0un3uh9uiY7NpJi43P+T+jLRmAebcBOomH0GViyAJl35ZS5H c7eWUp9M7E/AcMX3b0Jlcggo6jQU53t8Rh6/s4B0itY7I5qOpYfy+Ti13 hTe+qqY6wqVFg1lhWRBgO66hQsWvlbCLa7nHPvcjDBQmxLPHNYYAXXrXp g==; X-IronPort-AV: E=McAfee;i="6600,9927,10996"; a="3487508" X-IronPort-AV: E=Sophos;i="6.06,187,1705392000"; d="scan'208";a="3487508" Received: from fmviesa008.fm.intel.com ([10.60.135.148]) by orvoesa108.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Feb 2024 02:10:41 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.06,187,1705392000"; d="scan'208";a="7136835" Received: from fmsmsx602.amr.corp.intel.com ([10.18.126.82]) by fmviesa008.fm.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 27 Feb 2024 02:10:41 -0800 Received: from fmsmsx610.amr.corp.intel.com (10.18.126.90) 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.2507.35; Tue, 27 Feb 2024 02:10:40 -0800 Received: from FMSEDG603.ED.cps.intel.com (10.1.192.133) by fmsmsx610.amr.corp.intel.com (10.18.126.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35 via Frontend Transport; Tue, 27 Feb 2024 02:10:40 -0800 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (104.47.57.169) 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.2507.35; Tue, 27 Feb 2024 02:10:40 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TEPu7OzoIGHnru4bdKD5U2zW8aNf7K2bQVtun3OqBuxiz98yvRNOi6noANj60gGzA+b9PGb4NDZD8BxIHM0P3n5diIieSUeh9vLsJg2fn83/o1En2AjWIG7mFT9UtPCbANoMBdjYjvl5rReX7TFCI/TaIbNuAlOo4gPqz/sY2C8frfRsRj6T+g+iKZt2HnEHp2KmEqSjPBKPKOP4zRJ6ZMQjL3BI7X746pUJLhWk2mYwl4Z1sY305x09HzFO5Zgu/f8q/KAk8CxARS9TsG6HM7/61kZztC6+4+gob7H6Wln5FBRRP+UPmGd7RzCY84Q9jz3RWZ8iH9Xoi+VFBKQgHg== 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=e5c6KnjwD3tW8WY2GADErevCLCnvqhu4O8DqKBTH7pA=; b=lVFh4y5dws+DKn4LABmYAinQhd9mL8ErO9IhpXJ2OrIL+n5yqdN5pD5Z8mE5/u8fDhEOGo7Cyf8LoD0G1dNs6BdkO/QBSKyAQoCU0/fMOUkTL7OUfLvAC8F5A0bMPRXiTTS6Uwz1+hakdbtJ9yXiRt7ae8MXEtqIFPMCEQcNOcS7beRb1RK8amYBjAC5dxcYHr2yExINPd8oCz3tN98a5MZ5iMTFMKk0lbPloEiKZGnD0p36XuIuhJcT2T0QCTwq/IeBafo7Itp5cR9Wmij1QKHzRobwM4aw+H64fxrqWObiS4A1NlDCPt19sAEk663UjT1X8r7hvLwWX8BKbagoUw== 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 LV8PR11MB8605.namprd11.prod.outlook.com (2603:10b6:408:1e5::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7339.22; Tue, 27 Feb 2024 10:10:38 +0000 Received: from DM8PR11MB5653.namprd11.prod.outlook.com ([fe80::950a:155f:7cb1:b9a3]) by DM8PR11MB5653.namprd11.prod.outlook.com ([fe80::950a:155f:7cb1:b9a3%6]) with mapi id 15.20.7339.024; Tue, 27 Feb 2024 10:10:38 +0000 Message-ID: Date: Tue, 27 Feb 2024 10:10:34 +0000 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.15.1 Subject: Re: [EXT] [PATCH v3] examples/ipsec-secgw: fix cryptodev to SA mapping To: Anoob Joseph CC: "stable@dpdk.org" , Volodymyr Fialko , Ting-Kai Ku , Ciara Power , Kai Ji , Akhil Goyal , "dev@dpdk.org" References: <20231211095349.9895-1-radu.nicolau@intel.com> <20240226102545.18667-1-radu.nicolau@intel.com> Content-Language: en-US From: Radu Nicolau In-Reply-To: Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-ClientProxiedBy: DU6P191CA0010.EURP191.PROD.OUTLOOK.COM (2603:10a6:10:540::7) To DM8PR11MB5653.namprd11.prod.outlook.com (2603:10b6:8:25::8) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM8PR11MB5653:EE_|LV8PR11MB8605:EE_ X-MS-Office365-Filtering-Correlation-Id: 50ebd35f-9586-46aa-eeb5-08dc377c5880 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: BWlBETkNA8JIH5goE4HFQcvGkIokWo45f+ZHlLTdfu9j4CKwtcZF5HTk9rZ3uB76P+6umo1EarVFiVVX/B75KQYf5x5QLZyc1mJ9u3GZ7UU2USn1HGTegCIK04vX1MV31e8ffJaRaPj8rv/k2fBzEyh0zKLOQhobkQGQL3R3QqJfRo1qKA/fYnZOk6IjfS6uwxngzUVEaFkQrYbfqQMWs2vpsvx5YeKwbKsU7Rc7ihFNfystRn17U1xBkwNAikkBOePDkKmvUdjGKvuS4/HxpAvXJU/fm5MrAgL02/VxUteyVMtXTDstzwNJiqmXmT6S3g5NoYzbkbFXNS0u186cRD/k4x1boCQ1ulbxiQZUQjmfZhetCx+gOJwL4bN8U3gjbTC9EmQNkKqbJbuIx2LHiyg7ayugVI+m6kS1BFxRdLaQMBWXZC5WunY1hlEePEVCS5Op40b10Gj4lRrue9B3uQGcaXkyi4u5OSSdJpXXIm+PXVWn4GJhQXaj7imsR2w1hllU0T9SqmrF8mRAd2kg8feGp6pYY4URi/GMFnL3WO87GOP71O1a3eTD9IXp4UgJCIa3IvRn6UJT1o3sjn6vZzHCambwThV6RhJ2NCbB6ma4OErDaByrLrwDZwpW5CgNrLdL0dyl+68QDAGTs5TEkLbW60bPbwaLblR3ZqMA/80= 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:(13230031)(230273577357003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?OFFmSEFid2kvQ21kQlZneU1mUDhXNHBZZ29UVHdEQUlvV0FmMXB1Mnl1eDNm?= =?utf-8?B?dTlDYzFwOURoRGxEb2J6dDZmZmVjWjJkbDVzbm80OVU3ZjMyTHlYRTNyMDdU?= =?utf-8?B?THZaNHE3K1dqQ3l3b1hmYXQyOGZna1c4bXkzQ2E3Z3VBc2Nqb3pab0dsRTNm?= =?utf-8?B?UVZTOFJNSTl1Zlp5YkNUUXQ1TjhCVDk2TGZrVUpuUGZFODdaaUU2UStmd2o0?= =?utf-8?B?UFdLTnFjdVdBWEZ5U0Y4Z1l1bG9QTnZRdG5oV3RmcFFDZVd6cFZ4eDFBL0pF?= =?utf-8?B?anEycVRiUHdmU0pDVk9kWmNzb29RNG1ybHR6bFJlZVRMU2E5bVNlZDFZM2xk?= =?utf-8?B?djUxaFZqMW9vMkk3SzdLMitTQTEyeC9CdGdLUTd3bnNsSzJxcXRxZERmYWwv?= =?utf-8?B?YXhkSlVRK3p4L2ZUcEcwUFR3aTFoeENITVIxczNrL25FdG1UMFB2MmI1SEpa?= =?utf-8?B?ZGRvQTZkYzlic2s2dldFdm5mVVAwVEhVVkF0b09qTVJqYVF4WHE5NVNNZ1c0?= =?utf-8?B?UUovdzk5bVJWUHFqMEROTUNJRkV4M0VzdjFUN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am1MREQ3Z0s0UFdkZmxyWTRENnV2RjFoTUYwc2JEb2ZY?= =?utf-8?B?Y243ZHcyZWZJNktuMTZlMFRNbnZXQmQyeVgyVmJEVTFrTUxrQmw1VUk3TXVa?= =?utf-8?B?Y0o2STg5ZFdlZ0tLNlg1WHZabDZRL3VYZEUwSTBld01VeHFOVlBGcHZWdG12?= =?utf-8?B?VElIVWJ5ZEpsakRyVEJPL0hsZzNRUm1qbnROcjhsbk1KTmtNM0xYekt1ME1K?= =?utf-8?B?R1BYNFJQeitIcWNoeEQ1a09YaHc0L09YRDBuOGZWYThDa29kbCtkRlY2Ykd5?= =?utf-8?B?RUdjd1ZKalZxZG9lSHRrcjZscDVQRG1PNE04VU5BM1BXMDNidUdrcHBjMjRj?= =?utf-8?B?WFhxYkUwa2k1Uk9NT2JNWjQzVEpHM1c3UTUyaFJBb1RhanRwRithS1RscTlG?= =?utf-8?B?VDQ1T0NKR2ljMmoxVDFuczJhTVBRQzJZSFByOExFRDZVVlExdGNVcEpBVG1q?= =?utf-8?B?NU16VUpUc2MrZWx6QzMvZE1UbUw3SnVVdjNPbGIvRmpaNXM0TG1MN0pXQXlL?= =?utf-8?B?TXltZVd2bjdtRkxFM1pueTVEMG1BajN2WGo3OTlUTDc1dSs5M0x2K296cUJx?= =?utf-8?B?MERDY2JkL0g4cDdiOEU1U1RUTU56dE5ZSWt1a3FpMUl3UWdSVkdtTTB3YjR4?= =?utf-8?B?bU8rSGVsd2JNbnlkU2VUWUo0aFBXSEtKNHZGa2oyT3liKy9BK296MXQ2WTRk?= =?utf-8?B?TVE9PQ==?= X-MS-Exchange-CrossTenant-Network-Message-Id: 50ebd35f-9586-46aa-eeb5-08dc377c5880 X-MS-Exchange-CrossTenant-AuthSource: DM8PR11MB5653.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Feb 2024 10:10:38.1966 (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: bbGvMffAc2m1vyCQiqUUlRXZFJpOZiPLl35rA0GPOimOegcBlx86/dK5B0jr6+U1EkZ07kMxKne+cP3OVcStuw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: LV8PR11MB8605 X-OriginatorOrg: intel.com X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Hi Anoob, reply inline. Regards, Radu On 27-Feb-24 5:19 AM, Anoob Joseph wrote: > Hi Radu, > > Thanks for making the changes. I've one more question. Please see inline. > > Thanks, > Anoob > >> -----Original Message----- >> From: Radu Nicolau >> Sent: Monday, February 26, 2024 3:56 PM >> To: dev@dpdk.org >> Cc: Anoob Joseph ; Radu Nicolau >> ; stable@dpdk.org; Volodymyr Fialko >> ; Ting-Kai Ku ; Ciara Power >> ; Kai Ji ; Akhil Goyal >> >> Subject: [EXT] [PATCH v3] examples/ipsec-secgw: fix cryptodev to SA mapping >> >> External Email >> >> ---------------------------------------------------------------------- >> There are use cases where a SA should be able to use different cryptodevs on >> different lcores, for example there can be cryptodevs with just 1 qp per VF. >> For this purpose this patch relaxes the check in create lookaside session function. >> Also add a check to verify that a CQP is available for the current lcore. >> >> Fixes: a8ade12123c3 ("examples/ipsec-secgw: create lookaside sessions at init") >> Cc: stable@dpdk.org >> Cc: vfialko@marvell.com >> >> Signed-off-by: Radu Nicolau >> Tested-by: Ting-Kai Ku >> Acked-by: Ciara Power >> Acked-by: Kai Ji >> --- >> v3: check if the cryptodev are not of the same type >> >> examples/ipsec-secgw/ipsec.c | 25 ++++++++++++++++++++----- >> 1 file changed, 20 insertions(+), 5 deletions(-) >> >> diff --git a/examples/ipsec-secgw/ipsec.c b/examples/ipsec-secgw/ipsec.c index >> f5cec4a928..b59576c049 100644 >> --- a/examples/ipsec-secgw/ipsec.c >> +++ b/examples/ipsec-secgw/ipsec.c >> @@ -288,10 +288,21 @@ create_lookaside_session(struct ipsec_ctx >> *ipsec_ctx_lcore[], >> if (cdev_id == RTE_CRYPTO_MAX_DEVS) >> cdev_id = ipsec_ctx->tbl[cdev_id_qp].id; >> else if (cdev_id != ipsec_ctx->tbl[cdev_id_qp].id) { >> - RTE_LOG(ERR, IPSEC, >> - "SA mapping to multiple cryptodevs is " >> - "not supported!"); >> - return -EINVAL; >> + struct rte_cryptodev_info dev_info_1, dev_info_2; >> + rte_cryptodev_info_get(cdev_id, &dev_info_1); >> + rte_cryptodev_info_get(ipsec_ctx->tbl[cdev_id_qp].id, >> + &dev_info_2); >> + if (dev_info_1.driver_id == dev_info_2.driver_id) { >> + RTE_LOG(WARNING, IPSEC, >> + "SA mapped to multiple cryptodevs for >> SPI %d\n", >> + sa->spi); >> + >> + } else { >> + RTE_LOG(WARNING, IPSEC, >> + "SA mapped to multiple cryptodevs of >> different types for SPI %d\n", >> + sa->spi); >> + >> + } >> } >> >> /* Store per core queue pair information */ @@ -908,7 +919,11 >> @@ ipsec_enqueue(ipsec_xform_fn xform_func, struct ipsec_ctx *ipsec_ctx, >> continue; >> } >> >> - enqueue_cop(sa->cqp[ipsec_ctx->lcore_id], &priv->cop); >> + if (likely(sa->cqp[ipsec_ctx->lcore_id])) >> + enqueue_cop(sa->cqp[ipsec_ctx->lcore_id], &priv->cop); >> + else >> + RTE_LOG(ERR, IPSEC, "No CQP available for lcore %d\n", >> + ipsec_ctx->lcore_id); > [Anoob] Throwing an error won't be good enough, right? Won't this lead to packet leaks? Since it is datapath, can't we assume that the configuration would be done correctly in control path? > > I would suggest drop this specific change and we can enable multiple cryptodevs with lookaside SAs with the changes proposed. With the change that removed the lazy initialization of SAs ("examples/ipsec-secgw: create lookaside sessions at init") we can't assume anymore that a worker core has the proper CQP assigned, that is the reason I added the check here, the control path had no errors but there was no CQP assigned to a lcore. Indeed there will be dropped packets but at least there will be no segfault and the user will have an indication on what needs to be done - assign more cryptodevs. >> } >> } >> >> -- >> 2.34.1