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 5F77F42609; Tue, 19 Sep 2023 16:17:22 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 48B78409FA; Tue, 19 Sep 2023 16:17:22 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.65]) by mails.dpdk.org (Postfix) with ESMTP id 2F27F402C5 for ; Tue, 19 Sep 2023 16:17:20 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1695133040; x=1726669040; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=0Rb2hhxuWcFQ6uGIpQ9Tn3XAp+9hns7NHoLIfKeJ62E=; b=bInylTydSsSS4IeXodqCtWdJ5rJMmXwlNzUgX5sIEL7YJ4421y85/Rjx O8jdVMsuKlr0+4KDISY88/CKJrm/B6IylwMJVxLZasrc3ZSHHnzlsSSvT xjopxJ0bXb5Wdxy0HRCXD0kuTOYM0sqqpi5VKY4xtWMQlXRuuZ9bvHVA8 fu7kh/7XiZ4kciazzgdBJsGxlFZ0JzSb95/Ei3cvtaxq6RkxIvz8Byx+y r072mts36xMp6cAUnLAYITgPDYO5GjLocCVw0oGMynRwKM/ZCUdSeycgO iYFgNSvUhlJ+i+pvLcbbAWUlGmFi7OFeuQUezFE4bMupaZJ7M2FiUBPmy Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10838"; a="383783423" X-IronPort-AV: E=Sophos;i="6.02,159,1688454000"; d="scan'208";a="383783423" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Sep 2023 07:17:02 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10838"; a="746257569" X-IronPort-AV: E=Sophos;i="6.02,159,1688454000"; d="scan'208";a="746257569" Received: from fmsmsx602.amr.corp.intel.com ([10.18.126.82]) by orsmga002.jf.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 19 Sep 2023 07:17:02 -0700 Received: from fmsmsx612.amr.corp.intel.com (10.18.126.92) 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.32; Tue, 19 Sep 2023 07:17:01 -0700 Received: from fmsmsx611.amr.corp.intel.com (10.18.126.91) 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.32; Tue, 19 Sep 2023 07:17:01 -0700 Received: from fmsedg602.ED.cps.intel.com (10.1.192.136) by fmsmsx611.amr.corp.intel.com (10.18.126.91) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.32 via Frontend Transport; Tue, 19 Sep 2023 07:17:01 -0700 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (104.47.55.107) by edgegateway.intel.com (192.55.55.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.32; Tue, 19 Sep 2023 07:17:00 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dBmZWuWx9aqmbcZajwlWPDJbaRpGlOaq5R5P/+Ue5m+LFWv79Ys13QbobRh0eNsOlKbNNnzMTXlUT6cmx35EXnj38+wCImyC+OtB2n4F9HgLrDkAijkPQ9aiBMOp4vh9YVVyIhwrCXbYTnQO0wnmXAM2HBjK6nCR0YX7m6v6BADfwNA+guWqzdrIxUHmpUomzb7BJDuf63llYjh+1Sv63YEfq+1G5tZa65FaEet2ctrnf6vVZsAq+3+zCIBYqbPptNdWggTVSKkuog56OyV57f2R8Z3YAsqXUF7s4gbqvbtktgvyO7DjlDZ4ozlsqOVqWVKj4NV/0JEt/EN4NehE8w== 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=Ja8RX0IqNeI2Z/Yj6DHzFZWrZbl0tMPeB3n9t6LkYHM=; b=JkV2ptyTFdzLe6DUbqdrx1VlqDbiajOEUowlZlE3YgMVIc3Y3BatTC2V5nRCV3mrJaKBer1rM4TEqH8w+j5k6wywzbzuHsZEUbEnYNHo101qkMqHeVXty4rFKR93w4P96dGpkKgsUxjKU2Rj9ybDuSXK2ZX+ZT2vXVHI7EjRIRnCdQHR6FxegeXnsMUCmCA++V/H+wmvsKcNk9uoBjSeaijMzdXRm/fUlNC2/Auw90RzFDdQEdDjDzW4JbHU2WPQ7/pVfTjtwnKdebmvAH2pJ+V5DeoBxixlp0uTujc+qtMhweS1AS7WJELkG3C705x+vCImXxNc2RX6qBnLr+QKfA== 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 Received: from CH3PR11MB7252.namprd11.prod.outlook.com (2603:10b6:610:144::22) by SJ2PR11MB7648.namprd11.prod.outlook.com (2603:10b6:a03:4c3::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6792.27; Tue, 19 Sep 2023 14:16:18 +0000 Received: from CH3PR11MB7252.namprd11.prod.outlook.com ([fe80::e606:d4cf:6c54:4a9a]) by CH3PR11MB7252.namprd11.prod.outlook.com ([fe80::e606:d4cf:6c54:4a9a%7]) with mapi id 15.20.6792.026; Tue, 19 Sep 2023 14:16:18 +0000 From: "Coyle, David" To: Anoob Joseph CC: "Ji, Kai" , "O'Sullivan, Kevin" , "dev@dpdk.org" , "Jerin Jacob Kollanukkaran" , "Power, Ciara" Subject: RE: [EXT] [PATCH v3 1/2] crypto/scheduler: support DOCSIS security protocol Thread-Topic: [EXT] [PATCH v3 1/2] crypto/scheduler: support DOCSIS security protocol Thread-Index: AQHZ5x9Ov4P0hDG9Ckih5q1c9xFS3LAgcRaAgAG9YUA= Date: Tue, 19 Sep 2023 14:16:18 +0000 Message-ID: References: <20230811102401.12552-1-david.coyle@intel.com> <20230914152207.19794-1-david.coyle@intel.com> <20230914152207.19794-2-david.coyle@intel.com> In-Reply-To: Accept-Language: en-IE, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: CH3PR11MB7252:EE_|SJ2PR11MB7648:EE_ x-ms-office365-filtering-correlation-id: b883afe8-84ed-410a-b3d3-08dbb91afdd8 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: ef+js1UWuhfinoiSjirD4DGPbdrgAIb85OxNAl44Bz7lvVRe/CMUsWEHtueECwh82ET3mUHfeJk9EQ7rrq/vFOAH0/io65H89fuIUmYvR3MXJhjYHuWKRIiTphRN+z8SCpLzT2JUa/4E8+7cAEAyQ6UjbODtQu0HyMSeDi0QcGjsR4KGyCOXyk+/bq43oGfjgtFigOQEFabn0gL9uiZlFMaXVTvW2d7tHJmtopHffjgpXxqRtx+NeE6IXzcSM580ADpecwBkoVrepaZI+Rx5TZ7g4Lbd/vUNJIwXqGRJ/yEIN6sy3DbKmuFftmlDpojsLMDovlPYNZHV5LB5BCHfSAyqZKSf/f8CDMstSGKGc+FOcMxganCdvmyqifgcShs74W9u2LbBAd3fQZYHPxQs7RAoYGOKomYEbyuZBFcr4u1fy87096II0BMqBt1mwA8eYcl+Z3pVl64b8IpekphGmgcVUhwpu8L9hkhcx9yljoA+2nuenpUJbcU4r4lU4BcRGDUylhHveq2TqncnXN7+Shp+76UMSXPL4fJuuvj3sEhrgO8OoBczI82hPg2MyVH0GYmLW/xzqOt0i56faLgPQ3E5Pvy57JSZUM+lFyuc7ZXfyE6/Nf/ErPd0NwqO+VCa x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CH3PR11MB7252.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(366004)(376002)(346002)(396003)(39860400002)(136003)(451199024)(186009)(1800799009)(9686003)(54906003)(76116006)(66476007)(66946007)(66556008)(316002)(66446008)(6916009)(6506007)(7696005)(41300700001)(64756008)(33656002)(8936002)(107886003)(4326008)(8676002)(5660300002)(53546011)(86362001)(71200400001)(478600001)(26005)(52536014)(83380400001)(15650500001)(82960400001)(55016003)(38070700005)(30864003)(38100700002)(2906002)(122000001)(579004)(559001); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?w3X30SOEEGFbcZdcjWV9+DETRfLMfLr/rM7budqYwpADyqdVIdA2PJsM0ZlO?= =?us-ascii?Q?z1mfEh0WzIvPqbR+pixN9R5Yi/ue7DnBMi0znfsrmhI4J0pU6Hbq2z4Tc0pa?= =?us-ascii?Q?oH74cfKM7iVHTgddGHn3pbSrTnX1PkQXt19BkRWo7zFw35IQHjK+WX3g5zP5?= =?us-ascii?Q?5MnpSf5OFfa9kfum7rgVHhfANF59eeLAlNCUMVLYvKuXMiXF6ouyfsFDoxRa?= =?us-ascii?Q?jXTOrByBh5ufmB0LDiyega9hRD+TqG8TmAjpsPafvLY3dYQaW80rmY0AcZz0?= =?us-ascii?Q?f0QJv6XbkNaf5OLzNTMo3+nM02TFCheSGkh6VMGkMsleXcCg7taDj6Xyj7TM?= =?us-ascii?Q?i0+uZeZ/p7D3Pl6atdfQ5MxLj/iFpIzKOLK/Be+hz30XQCYrQwEoJ7sbg8SD?= =?us-ascii?Q?OYc5i7jWPBFdz/vxcqvoTOXJ0MgodmCYIrYc7R1AfGqFF3zlJzHooEckuW9v?= =?us-ascii?Q?EzIhKFTf/GFF/tQgK3Ujk3qX3gjEMh5bm88Kl6BYzOuPnC6zt7chL3QB+SZy?= =?us-ascii?Q?B0XPurH3ypmEpa4tnvCvRHQdSmz1qpS13B6bnIea2ZfeNtSAWVmd+2UmJt8b?= =?us-ascii?Q?PwO5xVmwzJxTsr7JOxWrQGLMoNT1oJyan/nMsJa7WSrnM8pTSTIOcW1yGoR9?= =?us-ascii?Q?FpH8USCSMv8ZnvCLhsNZyxaSiOrE2eUPb1W2IgioxYbZk3794T7q2ooPSWNP?= =?us-ascii?Q?PZjUSqlWoeCflx4nzcTlv4YwkrKgvOtja28nK7OzO3nDObWiuzdggJDiZmLj?= =?us-ascii?Q?ocz495zW9mdwtC4kfWosdsK8nStT2dqGOJKsxxpNeg6GLMqaF03FX0OFA86o?= =?us-ascii?Q?gjoRFF8MfR7bq42FyARMJ9VEbOSmX+0rjh3Ee5BXmb+ANbgWk8kAM8mPgOBd?= =?us-ascii?Q?z90/ElC9Me6S4xfP0JkTK8u8BgSx8AvHTjUspANkKnXjPLA2xOSWPwfTipN6?= =?us-ascii?Q?460IOSlXthAYclZrfgjp7d8DfUpDpkpMXQn/wgAz8bueKlHnKLTahSttdqYa?= =?us-ascii?Q?B48SSVChOTPOXi2ll5qspwALSt9mXE+SDK/2agRw/KqCkMSh/ccYxyvnXklL?= =?us-ascii?Q?RcXDZ3noO29NfRgUevIJYkCb4/dtE/xqFJ3b690o9k4AZeT7S/0t0/QAX/6Q?= =?us-ascii?Q?6hFd7AvdChMd1P63hpIz03f7gRoQJ5agGdRj6wWHiR1Ueax7ZSxWyTppTjap?= =?us-ascii?Q?Ji0TPuoIwsAsFHXF7PirrtOPGEsefP+WQDc3oNkLLEEFco3yjuK/e+xjoSx0?= =?us-ascii?Q?MAI3WLiG0+hGAV8azKJrcselJM86n9rePgClgrVoyutiToJ3mPgE0tqlzUiH?= =?us-ascii?Q?XcxIQ8Wfy3euWrnVEtMnan/5mcTV7swDkw5o2hIhdt2PdQeLHWD0FEhX3CI5?= =?us-ascii?Q?T0FRGiENrL8eZPtAFq1NXr2ruMqZAxJISsB8ThWuU0PV8JtPaN9muFM9FIwi?= =?us-ascii?Q?JcgrHsnXx9jM7sZhEHnno4RsdhGdTB19iwR5b6lmNF90FD2bbBFFzr6COzQ/?= =?us-ascii?Q?eFhbd+EsLsmL4HFH0bmgdD6pPaSyQQGCMVxJLUqrsbvJ1wWJTx/cXsDhC/ob?= =?us-ascii?Q?gv/h/Pa4BHEWKWKtxirwB7+1z6h70Z3eyN7Sc9M1?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: CH3PR11MB7252.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: b883afe8-84ed-410a-b3d3-08dbb91afdd8 X-MS-Exchange-CrossTenant-originalarrivaltime: 19 Sep 2023 14:16:18.1705 (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: 65x5T5XgNxHInUxCU9zSLQNN2OliTgr5FLGvJzNegf1uzEVeV+Kl/OOOPLXTGCy1CoqR1jAwJQ7TqwryDUX08Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ2PR11MB7648 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 Hi Anoob, Thank you for the comments. See inline below for replies. Regards, David > -----Original Message----- > From: Anoob Joseph > Sent: Monday, September 18, 2023 12:03 PM > To: Coyle, David > Cc: Ji, Kai ; O'Sullivan, Kevin ; > dev@dpdk.org; Jerin Jacob Kollanukkaran > Subject: RE: [EXT] [PATCH v3 1/2] crypto/scheduler: support DOCSIS securi= ty > protocol >=20 > Hi David, >=20 > Thanks for updating the patches based on the comments provided on > previous version. Please see inline for some comments on code. >=20 > Thanks, > Anoob >=20 > > -----Original Message----- > > From: David Coyle > > Sent: Thursday, September 14, 2023 8:52 PM > > To: dev@dpdk.org > > Cc: kai.ji@intel.com; Anoob Joseph ; > > kevin.osullivan@intel.com; David Coyle > > Subject: [EXT] [PATCH v3 1/2] crypto/scheduler: support DOCSIS > > security protocol > > > > External Email > > > > ---------------------------------------------------------------------- > > Add support to the cryptodev scheduler PMD for the DOCSIS security > > protocol. This includes adding the following to the scheduler: > > - synchronization of worker's security capabilities > > - retrieval of the scheduler's synchronized security capabilities > > - retrieval of the security session size i.e. maximum session size > > across all workers > > - creation of security sessions on each worker > > - deletion of security sessions on each worker > > > > Signed-off-by: David Coyle > > Signed-off-by: Kevin O'Sullivan > > --- > > doc/guides/rel_notes/release_23_11.rst | 4 + > > drivers/crypto/scheduler/meson.build | 2 +- > > .../scheduler/rte_cryptodev_scheduler.c | 221 +++++++++- > > drivers/crypto/scheduler/scheduler_failover.c | 12 +- > > .../crypto/scheduler/scheduler_multicore.c | 10 +- > > .../scheduler/scheduler_pkt_size_distr.c | 54 +-- > > drivers/crypto/scheduler/scheduler_pmd.c | 33 ++ > > drivers/crypto/scheduler/scheduler_pmd_ops.c | 381 > > +++++++++++++----- .../crypto/scheduler/scheduler_pmd_private.h | 159 > +++++--- > > .../crypto/scheduler/scheduler_roundrobin.c | 6 +- > > 10 files changed, 653 insertions(+), 229 deletions(-) > > >=20 > >=20 > > diff --git a/drivers/crypto/scheduler/rte_cryptodev_scheduler.c > > b/drivers/crypto/scheduler/rte_cryptodev_scheduler.c > > index 258d6f8c43..e8b905af2f 100644 > > --- a/drivers/crypto/scheduler/rte_cryptodev_scheduler.c > > +++ b/drivers/crypto/scheduler/rte_cryptodev_scheduler.c > > @@ -5,11 +5,14 @@ > > #include > > #include > > #include > > +#include > > #include > > > > #include "rte_cryptodev_scheduler.h" > > #include "scheduler_pmd_private.h" > > > > +#define MAX_CAPS 256 > > + > > /** update the scheduler pmd's capability with attaching device's > > * capability. > > * For each device to be attached, the scheduler's capability should > > be @@ - > > 59,7 +62,6 @@ sync_caps(struct rte_cryptodev_capabilities *caps, > > cap->sym.auth.digest_size.max ? > > s_cap->sym.auth.digest_size.max : > > cap->sym.auth.digest_size.max; > > - > > } > > > > if (s_cap->sym.xform_type =3D=3D > > @@ -81,25 +83,176 @@ sync_caps(struct rte_cryptodev_capabilities > > *caps, > > > > memset(&caps[sync_nb_caps - 1], 0, sizeof(*cap)); > > sync_nb_caps--; > > + i--; > > } > > > > return sync_nb_caps; > > } > > > > static int > > -update_scheduler_capability(struct scheduler_ctx *sched_ctx) > > +check_sec_cap_equal(const struct rte_security_capability *sec_cap1, > > + struct rte_security_capability *sec_cap2) { > > + if (sec_cap1->action !=3D sec_cap2->action || > > + sec_cap1->protocol !=3D sec_cap2->protocol || > > + sec_cap1->ol_flags !=3D sec_cap2->ol_flags) > > + return 0; > > + > > + if (sec_cap1->protocol =3D=3D RTE_SECURITY_PROTOCOL_DOCSIS) > > + return !memcmp(&sec_cap1->docsis, &sec_cap2->docsis, > > + sizeof(sec_cap1->docsis)); > > + else > > + return 0; > > +} > > + > > +static void > > +copy_sec_cap(struct rte_security_capability *dst_sec_cap, > > + struct rte_security_capability *src_sec_cap) { > > + dst_sec_cap->action =3D src_sec_cap->action; > > + dst_sec_cap->protocol =3D src_sec_cap->protocol; > > + if (src_sec_cap->protocol =3D=3D RTE_SECURITY_PROTOCOL_DOCSIS) > > + dst_sec_cap->docsis =3D src_sec_cap->docsis; > > + dst_sec_cap->ol_flags =3D src_sec_cap->ol_flags; } > > + > > +static uint32_t > > +sync_sec_crypto_caps(struct rte_cryptodev_capabilities > > *tmp_sec_crypto_caps, > > + const struct rte_cryptodev_capabilities *sec_crypto_caps, > > + const struct rte_cryptodev_capabilities > > *worker_sec_crypto_caps) { > > + uint8_t nb_caps =3D 0; > > + > > + nb_caps =3D sync_caps(tmp_sec_crypto_caps, nb_caps, > > sec_crypto_caps); > > + sync_caps(tmp_sec_crypto_caps, nb_caps, > > worker_sec_crypto_caps); > > + > > + return nb_caps; > > +} > > + > > +/** update the scheduler pmd's security capability with attaching > > +device's > > + * security capability. > > + * For each device to be attached, the scheduler's security > > +capability should > > + * be the common capability set of all workers **/ static uint32_t > > +sync_sec_caps(uint32_t worker_idx, > > + struct rte_security_capability *sec_caps, > > + struct rte_cryptodev_capabilities > > sec_crypto_caps[][MAX_CAPS], > > + uint32_t nb_sec_caps, > > + const struct rte_security_capability *worker_sec_caps) > > { > > - struct rte_cryptodev_capabilities tmp_caps[256] =3D { {0} }; > > - uint32_t nb_caps =3D 0, i; > > + uint32_t nb_worker_sec_caps =3D 0, i; > > + > > + if (worker_sec_caps =3D=3D NULL) > > + return 0; > > + > > + while (worker_sec_caps[nb_worker_sec_caps].action !=3D > > + > > RTE_SECURITY_ACTION_TYPE_NONE) > > + nb_worker_sec_caps++; > > + > > + /* Handle first worker */ > > + if (worker_idx =3D=3D 0) { > > + uint32_t nb_worker_sec_crypto_caps =3D 0; > > + uint32_t nb_worker_supp_sec_caps =3D 0; > > + > > + for (i =3D 0; i < nb_worker_sec_caps; i++) { > > + /* Check for supported security protocols */ > > + if > > (!scheduler_check_sec_proto_supp(worker_sec_caps[i].action, > > + worker_sec_caps[i].protocol)) > > + continue; > > > > - if (sched_ctx->capabilities) { > > - rte_free(sched_ctx->capabilities); > > - sched_ctx->capabilities =3D NULL; > > + sec_caps[nb_worker_supp_sec_caps] =3D > > worker_sec_caps[i]; > > + > > + while (worker_sec_caps[i].crypto_capabilities[ > > + nb_worker_sec_crypto_caps].op !=3D > > + > > RTE_CRYPTO_OP_TYPE_UNDEFINED) > > + nb_worker_sec_crypto_caps++; > > + > > + > > rte_memcpy(&sec_crypto_caps[nb_worker_supp_sec_caps][0], > > + &worker_sec_caps[i].crypto_capabilities[0], >=20 > [Anoob] Isn't it possible to have 2 different security devices which may = differ in > crypto capabilities? My understanding is, the code assumes that crypto > capability of both devices would match. It's okay to document it as a kno= wn > limitation if it is too difficult to solve. [DC] Yes, it is possible, and this is handled. The block of code here is handling the security capabilities and the associ= ated crypto capabilities for the very first worker. At this point, the schedulers capabilities become that of the worker exactl= y. The next block of code, starting at the next for loop, synchs the security = capabilities for the second and subsequent workers with the scheduler's cur= rent running capabilities. For each common security capability between the workers, the associated cry= pto capabilities are also synched to ultimately leave only the common crypt= o capabilities for each security capability - see the call to sync_sec_crypto_caps() >=20 > > + > > sizeof(sec_crypto_caps[nb_worker_supp_sec_caps][0]) * > > + nb_worker_sec_crypto_caps); > > + > > + nb_worker_supp_sec_caps++; > > + } > > + return nb_worker_supp_sec_caps; > > } > > >=20 > >=20 > > diff --git a/drivers/crypto/scheduler/scheduler_pmd.c > > b/drivers/crypto/scheduler/scheduler_pmd.c > > index 4e8bbf0e09..6dad9bc3dd 100644 > > --- a/drivers/crypto/scheduler/scheduler_pmd.c > > +++ b/drivers/crypto/scheduler/scheduler_pmd.c > > @@ -8,6 +8,7 @@ > > #include > > #include > > #include > > +#include > > #include > > #include > > #include > > @@ -233,6 +234,35 @@ cryptodev_scheduler_create(const char *name, > > return -ENOMEM; > > } > > > > + struct rte_security_ctx *security_instance; > > + security_instance =3D rte_zmalloc_socket(NULL, > > + sizeof(struct rte_security_ctx), > > + RTE_CACHE_LINE_SIZE, > > SOCKET_ID_ANY); > > + if (security_instance =3D=3D NULL) { > > + CR_SCHED_LOG(ERR, "rte_security_ctx memory alloc > > failed"); > > + return -ENOMEM; >=20 > [Anoob] The lines above this adds regular cryptodev capabilities. Don't w= e > need to free that as well? [DC] Yes, good spot. I have added a free_mem() function to free any previou= sly allocated memory from this function in v4 patch This includes any capability info, security context and init worker names. >=20 > > + } > > + > > + security_instance->device =3D (void *)dev; > > + security_instance->ops =3D rte_crypto_scheduler_pmd_sec_ops; > > + security_instance->sess_cnt =3D 0; > > + dev->security_ctx =3D security_instance; > > + > > + /* > > + * Initialize security capabilities structure as an empty structure, > > + * in case device information is requested when no workers are > > attached > > + */ > > + sched_ctx->sec_capabilities =3D rte_zmalloc_socket(NULL, > > + sizeof(struct rte_security_capability), > > + 0, SOCKET_ID_ANY); > > + > > + if (!sched_ctx->sec_capabilities) { > > + rte_free(security_instance); > > + CR_SCHED_LOG(ERR, "Not enough memory for security > > capability " > > + "information"); > > + return -ENOMEM; > > + } > > + > > rte_cryptodev_pmd_probing_finish(dev); > > > > return 0; > > @@ -263,6 +293,9 @@ cryptodev_scheduler_remove(struct > rte_vdev_device > > *vdev) > > sched_ctx->workers[i].dev_id); > > } > > > > + rte_free(dev->security_ctx); > > + dev->security_ctx =3D NULL; > > + > > return rte_cryptodev_pmd_destroy(dev); } > > > > diff --git a/drivers/crypto/scheduler/scheduler_pmd_ops.c > > b/drivers/crypto/scheduler/scheduler_pmd_ops.c > > index 294aab4452..34d20ee2de 100644 > > --- a/drivers/crypto/scheduler/scheduler_pmd_ops.c > > +++ b/drivers/crypto/scheduler/scheduler_pmd_ops.c > > @@ -8,11 +8,212 @@ > > #include > > #include > > #include > > +#include > > #include > > #include > > > > #include "scheduler_pmd_private.h" > > > > +struct scheduler_configured_sess_info { > > + uint8_t dev_id; > > + uint8_t driver_id; > > + union { > > + struct rte_cryptodev_sym_session *sess; > > + struct { > > + struct rte_security_session *sec_sess; > > + struct rte_security_ctx *sec_ctx; > > + }; > > + }; > > +}; > > + > > +static int > > +scheduler_session_create(void *sess, void *sess_params, > > + struct scheduler_ctx *sched_ctx, > > + enum rte_crypto_op_sess_type session_type) { > > + struct rte_mempool *mp =3D rte_mempool_from_obj(sess); > > + struct scheduler_session_ctx *sess_ctx; > > + struct scheduler_configured_sess_info configured_sess[ > > + RTE_CRYPTODEV_SCHEDULER_MAX_NB_WORKERS] > > =3D {{0}}; > > + uint32_t i, j, n_configured_sess =3D 0; > > + int ret =3D 0; > > + > > + if (session_type =3D=3D RTE_CRYPTO_OP_WITH_SESSION) > > + sess_ctx =3D CRYPTODEV_GET_SYM_SESS_PRIV( > > + (struct rte_cryptodev_sym_session *)sess); > > + else > > + sess_ctx =3D SECURITY_GET_SESS_PRIV( > > + (struct rte_security_session *)sess); > > + > > + if (mp =3D=3D NULL) > > + return -EINVAL; > > + > > + for (i =3D 0; i < sched_ctx->nb_workers; i++) { > > + struct scheduler_worker *worker =3D &sched_ctx->workers[i]; > > + struct rte_cryptodev *dev =3D &rte_cryptodevs[worker- > > >dev_id]; > > + uint8_t next_worker =3D 0; > > + > > + for (j =3D 0; j < n_configured_sess; j++) { > > + if (configured_sess[j].driver_id =3D=3D worker- > > >driver_id) { > > + if (session_type =3D=3D > > RTE_CRYPTO_OP_WITH_SESSION) > > + sess_ctx->worker_sess[i] =3D > > + configured_sess[j].sess; > > + else > > + sess_ctx->worker_sec_sess[i] =3D > > + configured_sess[j].sec_sess; > > + > > + next_worker =3D 1; > > + break; > > + } > > + } > > + if (next_worker) > > + continue; > > + > > + if (rte_mempool_avail_count(mp) =3D=3D 0) { > > + ret =3D -ENOMEM; > > + goto error_exit; > > + } > > + > > + if (session_type =3D=3D RTE_CRYPTO_OP_WITH_SESSION) { > > + struct rte_cryptodev_sym_session *worker_sess =3D > > + rte_cryptodev_sym_session_create(worker- > > >dev_id, > > + (struct > > rte_crypto_sym_xform *) >=20 > [Anoob] Is this cast required? [DC] It wasn't required. I have removed this and all other unnecessary cast= s in v4 >=20 > > + sess_params, mp); > > + > > + if (worker_sess =3D=3D NULL) { > > + ret =3D -rte_errno; > > + goto error_exit; > > + } > > + > > + worker_sess->opaque_data =3D (uint64_t)sess; > > + sess_ctx->worker_sess[i] =3D worker_sess; > > + configured_sess[n_configured_sess].sess =3D > > worker_sess; > > + } else { > > + struct rte_security_session *worker_sess =3D > > + rte_security_session_create(dev- > > >security_ctx, > > + (struct rte_security_session_conf *) > > + sess_params, mp); > > + > > + if (worker_sess =3D=3D NULL) { > > + ret =3D -rte_errno; > > + goto error_exit; > > + } > > + > > + worker_sess->opaque_data =3D (uint64_t)sess; > > + sess_ctx->worker_sec_sess[i] =3D worker_sess; > > + configured_sess[n_configured_sess].sec_sess =3D > > + worker_sess; > > + configured_sess[n_configured_sess].sec_ctx =3D > > + dev->security_ctx; > > + } > > + > > + configured_sess[n_configured_sess].driver_id =3D > > + worker->driver_id; > > + configured_sess[n_configured_sess].dev_id =3D worker- > > >dev_id; > > + n_configured_sess++; > > + } > > + > > + return 0; > > + > > +error_exit: > > + sess_ctx->ref_cnt =3D sched_ctx->ref_cnt; > > + for (i =3D 0; i < n_configured_sess; i++) { > > + if (session_type =3D=3D RTE_CRYPTO_OP_WITH_SESSION) > > + rte_cryptodev_sym_session_free( > > + configured_sess[i].dev_id, > > + configured_sess[i].sess); > > + else > > + rte_security_session_destroy( > > + configured_sess[i].sec_ctx, > > + configured_sess[i].sec_sess); > > + } > > + > > + return ret; > > +} > > + > > +static void > > +scheduler_session_destroy(void *sess, struct scheduler_ctx *sched_ctx, > > + uint8_t session_type) > > +{ > > + struct scheduler_session_ctx *sess_ctx; > > + struct scheduler_configured_sess_info deleted_sess[ > > + RTE_CRYPTODEV_SCHEDULER_MAX_NB_WORKERS] > > =3D {{0}}; > > + uint32_t i, j, n_deleted_sess =3D 0; > > + > > + if (session_type =3D=3D RTE_CRYPTO_OP_WITH_SESSION) > > + sess_ctx =3D CRYPTODEV_GET_SYM_SESS_PRIV( > > + (struct rte_cryptodev_sym_session *)sess); > > + else > > + sess_ctx =3D SECURITY_GET_SESS_PRIV( > > + (struct rte_security_session *)sess); > > + > > + if (sched_ctx->ref_cnt !=3D sess_ctx->ref_cnt) { > > + CR_SCHED_LOG(WARNING, > > + "Worker updated between session > > creation/deletion. " > > + "The session may not be freed fully."); > > + } > > + > > + for (i =3D 0; i < sched_ctx->nb_workers; i++) { > > + struct scheduler_worker *worker =3D &sched_ctx->workers[i]; > > + struct rte_cryptodev *dev =3D &rte_cryptodevs[worker- > > >dev_id]; > > + uint8_t next_worker =3D 0; > > + > > + for (j =3D 0; j < n_deleted_sess; j++) { > > + if (deleted_sess[j].driver_id =3D=3D worker->driver_id) { > > + if (session_type =3D=3D > > RTE_CRYPTO_OP_WITH_SESSION) > > + sess_ctx->worker_sess[i] =3D NULL; > > + else > > + sess_ctx->worker_sec_sess[i] =3D > > NULL; > > + > > + next_worker =3D 1; > > + break; > > + } > > + } > > + if (next_worker) > > + continue; > > + > > + if (session_type =3D=3D RTE_CRYPTO_OP_WITH_SESSION) { > > + rte_cryptodev_sym_session_free(worker->dev_id, > > + sess_ctx->worker_sess[i]); > > + sess_ctx->worker_sess[i] =3D NULL; > > + } else { > > + rte_security_session_destroy(dev->security_ctx, > > + sess_ctx- > > >worker_sec_sess[i]); > > + sess_ctx->worker_sec_sess[i] =3D NULL; > > + } > > + > > + deleted_sess[n_deleted_sess++].driver_id =3D worker- > > >driver_id; > > + } > > +} > > + > > +static unsigned int > > +scheduler_session_size_get(struct scheduler_ctx *sched_ctx, > > + uint8_t session_type) > > +{ > > + uint8_t i =3D 0; > > + uint32_t max_priv_sess_size =3D 0; > > + > > + /* Check what is the maximum private session size for all workers */ > > + for (i =3D 0; i < sched_ctx->nb_workers; i++) { > > + uint8_t worker_dev_id =3D sched_ctx->workers[i].dev_id; > > + struct rte_cryptodev *dev =3D > > &rte_cryptodevs[worker_dev_id]; > > + struct rte_security_ctx *sec_ctx =3D dev->security_ctx; > > + uint32_t priv_sess_size =3D 0; > > + > > + if (session_type =3D=3D RTE_CRYPTO_OP_WITH_SESSION) { > > + priv_sess_size =3D > > + (*dev->dev_ops- > > >sym_session_get_size)(dev); > > + } else { > > + priv_sess_size =3D (*sec_ctx->ops- > > >session_get_size)(dev); > > + } > > + > > + if (max_priv_sess_size < priv_sess_size) > > + max_priv_sess_size =3D priv_sess_size; >=20 > [Anoob] Should we use RTE_MAX? [DC] Yep RTE_MAX is used in v4 >=20 > > + } > > + > > + return max_priv_sess_size; > > +} > > + > > /** attaching the workers predefined by scheduler's EAL options */ > > static int scheduler_attach_init_worker(struct rte_cryptodev *dev) @@ > > -265,10 > > +466,7 @@ scheduler_pmd_close(struct rte_cryptodev *dev) > > sched_ctx->private_ctx =3D NULL; > > } > > > > - if (sched_ctx->capabilities) { > > - rte_free(sched_ctx->capabilities); > > - sched_ctx->capabilities =3D NULL; > > - } > > + scheduler_free_capabilities(sched_ctx); > > > > return 0; > > } > > @@ -451,92 +649,22 @@ scheduler_pmd_qp_setup(struct rte_cryptodev > > *dev, uint16_t qp_id, } > > > > static uint32_t > > -scheduler_pmd_sym_session_get_size(struct rte_cryptodev *dev > > __rte_unused) > > +scheduler_pmd_sym_session_get_size(struct rte_cryptodev *dev) > > { > > struct scheduler_ctx *sched_ctx =3D dev->data->dev_private; > > - uint8_t i =3D 0; > > - uint32_t max_priv_sess_size =3D 0; > > - > > - /* Check what is the maximum private session size for all workers */ > > - for (i =3D 0; i < sched_ctx->nb_workers; i++) { > > - uint8_t worker_dev_id =3D sched_ctx->workers[i].dev_id; > > - struct rte_cryptodev *dev =3D > > &rte_cryptodevs[worker_dev_id]; > > - uint32_t priv_sess_size =3D (*dev->dev_ops- > > >sym_session_get_size)(dev); > > > > - if (max_priv_sess_size < priv_sess_size) > > - max_priv_sess_size =3D priv_sess_size; > > - } > > - > > - return max_priv_sess_size; > > + return scheduler_session_size_get(sched_ctx, > > +RTE_CRYPTO_OP_WITH_SESSION); > > } > > > > -struct scheduler_configured_sess_info { > > - uint8_t dev_id; > > - uint8_t driver_id; > > - struct rte_cryptodev_sym_session *sess; > > -}; > > - > > static int > > scheduler_pmd_sym_session_configure(struct rte_cryptodev *dev, > > struct rte_crypto_sym_xform *xform, > > struct rte_cryptodev_sym_session *sess) { > > struct scheduler_ctx *sched_ctx =3D dev->data->dev_private; > > - struct rte_mempool *mp =3D rte_mempool_from_obj(sess); > > - struct scheduler_session_ctx *sess_ctx =3D > > CRYPTODEV_GET_SYM_SESS_PRIV(sess); > > - struct scheduler_configured_sess_info configured_sess[ > > - RTE_CRYPTODEV_SCHEDULER_MAX_NB_WORKERS] > > =3D {{0}}; > > - uint32_t i, j, n_configured_sess =3D 0; > > - int ret =3D 0; > > - > > - if (mp =3D=3D NULL) > > - return -EINVAL; > > > > - for (i =3D 0; i < sched_ctx->nb_workers; i++) { > > - struct scheduler_worker *worker =3D &sched_ctx->workers[i]; > > - struct rte_cryptodev_sym_session *worker_sess; > > - uint8_t next_worker =3D 0; > > - > > - for (j =3D 0; j < n_configured_sess; j++) { > > - if (configured_sess[j].driver_id =3D=3D > > - worker->driver_id) { > > - sess_ctx->worker_sess[i] =3D > > - configured_sess[j].sess; > > - next_worker =3D 1; > > - break; > > - } > > - } > > - if (next_worker) > > - continue; > > - > > - if (rte_mempool_avail_count(mp) =3D=3D 0) { > > - ret =3D -ENOMEM; > > - goto error_exit; > > - } > > - > > - worker_sess =3D rte_cryptodev_sym_session_create(worker- > > >dev_id, > > - xform, mp); > > - if (worker_sess =3D=3D NULL) { > > - ret =3D -rte_errno; > > - goto error_exit; > > - } > > - > > - worker_sess->opaque_data =3D (uint64_t)sess; > > - sess_ctx->worker_sess[i] =3D worker_sess; > > - configured_sess[n_configured_sess].driver_id =3D > > - worker->driver_id; > > - configured_sess[n_configured_sess].dev_id =3D worker- > > >dev_id; > > - configured_sess[n_configured_sess].sess =3D worker_sess; > > - n_configured_sess++; > > - } > > - > > - return 0; > > -error_exit: > > - sess_ctx->ref_cnt =3D sched_ctx->ref_cnt; > > - for (i =3D 0; i < n_configured_sess; i++) > > - > > rte_cryptodev_sym_session_free(configured_sess[i].dev_id, > > - configured_sess[i].sess); > > - return ret; > > + return scheduler_session_create((void *)sess, (void *)xform, > > sched_ctx, > > + RTE_CRYPTO_OP_WITH_SESSION); > > } > > > > /** Clear the memory of session so it doesn't leave key material > > behind */ @@ -545,37 +673,9 @@ > scheduler_pmd_sym_session_clear(struct > > rte_cryptodev *dev, > > struct rte_cryptodev_sym_session *sess) { > > struct scheduler_ctx *sched_ctx =3D dev->data->dev_private; > > - struct scheduler_session_ctx *sess_ctx =3D > > CRYPTODEV_GET_SYM_SESS_PRIV(sess); > > - struct scheduler_configured_sess_info deleted_sess[ > > - RTE_CRYPTODEV_SCHEDULER_MAX_NB_WORKERS] > > =3D {{0}}; > > - uint32_t i, j, n_deleted_sess =3D 0; > > - > > - if (sched_ctx->ref_cnt !=3D sess_ctx->ref_cnt) { > > - CR_SCHED_LOG(WARNING, > > - "Worker updated between session > > creation/deletion. " > > - "The session may not be freed fully."); > > - } > > - > > - for (i =3D 0; i < sched_ctx->nb_workers; i++) { > > - struct scheduler_worker *worker =3D &sched_ctx->workers[i]; > > - uint8_t next_worker =3D 0; > > > > - for (j =3D 0; j < n_deleted_sess; j++) { > > - if (deleted_sess[j].driver_id =3D=3D worker->driver_id) { > > - sess_ctx->worker_sess[i] =3D NULL; > > - next_worker =3D 1; > > - break; > > - } > > - } > > - if (next_worker) > > - continue; > > - > > - rte_cryptodev_sym_session_free(worker->dev_id, > > - sess_ctx->worker_sess[i]); > > - > > - deleted_sess[n_deleted_sess++].driver_id =3D worker- > > >driver_id; > > - sess_ctx->worker_sess[i] =3D NULL; > > - } > > + scheduler_session_destroy((void *)sess, sched_ctx, > > + RTE_CRYPTO_OP_WITH_SESSION); > > } > > > > static struct rte_cryptodev_ops scheduler_pmd_ops =3D { @@ -598,3 > > +698,68 @@ static struct rte_cryptodev_ops scheduler_pmd_ops =3D { }; > > > > struct rte_cryptodev_ops *rte_crypto_scheduler_pmd_ops =3D > > &scheduler_pmd_ops; > > + > > +/** Configure a scheduler session from a security session > > +configuration */ static int scheduler_pmd_sec_sess_create(void *dev, > > +struct rte_security_session_conf *conf, > > + struct rte_security_session *sess) { > > + struct rte_cryptodev *cdev =3D (struct rte_cryptodev *)dev; >=20 > [Anoob] Is this cast required? [DC] It wasn't required. I have removed this and all other unnecessary cast= s in v4 >=20 > > + struct scheduler_ctx *sched_ctx =3D cdev->data->dev_private; > > + > > + /* Check for supported security protocols */ > > + if (!scheduler_check_sec_proto_supp(conf->action_type, conf- > > >protocol)) { > > + CR_SCHED_LOG(ERR, "Unsupported security protocol"); > > + return -ENOTSUP; > > + } > > + > > + return scheduler_session_create((void *)sess, (void *)conf, > > sched_ctx, > > + RTE_CRYPTO_OP_SECURITY_SESSION); > > +} > > + > > +/** Clear the memory of session so it doesn't leave key material > > +behind */ static int scheduler_pmd_sec_sess_destroy(void *dev, > > + struct rte_security_session *sess) { > > + struct rte_cryptodev *cdev =3D (struct rte_cryptodev *)dev; >=20 > [Anoob] Is this cast required? [DC] It wasn't required. I have removed this and all other unnecessary cast= s in v4 >=20 > > + struct scheduler_ctx *sched_ctx =3D cdev->data->dev_private; > > + > > + scheduler_session_destroy((void *)sess, sched_ctx, > > + RTE_CRYPTO_OP_SECURITY_SESSION); > > + > > + return 0; > > +} > > + > > +/** Get sync security capabilities for scheduler pmds */ static const > > +struct rte_security_capability * scheduler_pmd_sec_capa_get(void > > +*dev) { > > + struct rte_cryptodev *cdev =3D (struct rte_cryptodev *)dev; >=20 > [Anoob] Is this cast required? [DC] It wasn't required. I have removed this and all other unnecessary cast= s in v4 >=20 > > + struct scheduler_ctx *sched_ctx =3D cdev->data->dev_private; > > + > > + return sched_ctx->sec_capabilities; > > +} > > + > > +static unsigned int > > +scheduler_pmd_sec_sess_size_get(void *dev) { > > + struct rte_cryptodev *cdev =3D (struct rte_cryptodev *)dev; >=20 > [Anoob] Is this cast required? [DC] It wasn't required. I have removed this and all other unnecessary cast= s in v4 >=20 > > + struct scheduler_ctx *sched_ctx =3D cdev->data->dev_private; > > + > > + return scheduler_session_size_get(sched_ctx, > > + RTE_CRYPTO_OP_SECURITY_SESSION); > > +} > > + > > +static struct rte_security_ops scheduler_pmd_sec_ops =3D { > > + .session_create =3D scheduler_pmd_sec_sess_create, > > + .session_update =3D NULL, > > + .session_get_size =3D scheduler_pmd_sec_sess_size_get, > > + .session_stats_get =3D NULL, > > + .session_destroy =3D scheduler_pmd_sec_sess_destroy, > > + .set_pkt_metadata =3D NULL, > > + .capabilities_get =3D scheduler_pmd_sec_capa_get }; > > + > > +struct rte_security_ops *rte_crypto_scheduler_pmd_sec_ops =3D > > + > > &scheduler_pmd_sec_ops; > > diff --git a/drivers/crypto/scheduler/scheduler_pmd_private.h > > b/drivers/crypto/scheduler/scheduler_pmd_private.h > > index 36d0bb6307..ff1e7a83e8 100644 > > --- a/drivers/crypto/scheduler/scheduler_pmd_private.h > > +++ b/drivers/crypto/scheduler/scheduler_pmd_private.h > > @@ -5,6 +5,8 @@ > > #ifndef _SCHEDULER_PMD_PRIVATE_H > > #define _SCHEDULER_PMD_PRIVATE_H > > > > +#include > > + > > #include "rte_cryptodev_scheduler.h" > > > > #define CRYPTODEV_NAME_SCHEDULER_PMD crypto_scheduler > > @@ -30,7 +32,8 @@ struct scheduler_ctx { > > /**< private scheduler context pointer */ > > > > struct rte_cryptodev_capabilities *capabilities; > > - uint32_t nb_capabilities; > > + struct rte_security_capability *sec_capabilities; > > + struct rte_cryptodev_capabilities **sec_crypto_capabilities; > > > > uint32_t max_nb_queue_pairs; > > > > @@ -64,8 +67,12 @@ struct scheduler_qp_ctx { > > > > struct scheduler_session_ctx { > > uint32_t ref_cnt; > > - struct rte_cryptodev_sym_session *worker_sess[ > > - RTE_CRYPTODEV_SCHEDULER_MAX_NB_WORKERS]; > > + union { > > + struct rte_cryptodev_sym_session *worker_sess[ > > + RTE_CRYPTODEV_SCHEDULER_MAX_NB_WORKERS]; > > + struct rte_security_session *worker_sec_sess[ > > + RTE_CRYPTODEV_SCHEDULER_MAX_NB_WORKERS]; > > + }; > > }; > > > > extern uint8_t cryptodev_scheduler_driver_id; @@ -108,7 +115,22 @@ > > scheduler_order_drain(struct rte_ring *order_ring, } > > > > static __rte_always_inline void > > -scheduler_set_worker_session(struct rte_crypto_op **ops, uint16_t > > nb_ops, > > +scheduler_set_single_worker_session(struct rte_crypto_op *op, > > + uint8_t worker_idx) > > +{ > > + if (op->sess_type =3D=3D RTE_CRYPTO_OP_WITH_SESSION) { > > + struct scheduler_session_ctx *sess_ctx =3D > > + CRYPTODEV_GET_SYM_SESS_PRIV(op->sym- > > >session); > > + op->sym->session =3D sess_ctx->worker_sess[worker_idx]; > > + } else if (op->sess_type =3D=3D RTE_CRYPTO_OP_SECURITY_SESSION) { > > + struct scheduler_session_ctx *sess_ctx =3D > > + SECURITY_GET_SESS_PRIV(op->sym- > > >session); > > + op->sym->session =3D sess_ctx- > > >worker_sec_sess[worker_idx]; > > + } > > +} > > + > > +static __rte_always_inline void > > +scheduler_set_worker_sessions(struct rte_crypto_op **ops, uint16_t > > +nb_ops, > > uint8_t worker_index) > > { > > struct rte_crypto_op **op =3D ops; > > @@ -129,52 +151,34 @@ scheduler_set_worker_session(struct > > rte_crypto_op **ops, uint16_t nb_ops, > > rte_prefetch0(op[7]->sym->session); > > } > > > > - if (op[0]->sess_type =3D=3D RTE_CRYPTO_OP_WITH_SESSION) { > > - struct scheduler_session_ctx *sess_ctx =3D > > - CRYPTODEV_GET_SYM_SESS_PRIV(op[0]- > > >sym->session); > > - op[0]->sym->session =3D > > - sess_ctx->worker_sess[worker_index]; > > - } > > - > > - if (op[1]->sess_type =3D=3D RTE_CRYPTO_OP_WITH_SESSION) { > > - struct scheduler_session_ctx *sess_ctx =3D > > - CRYPTODEV_GET_SYM_SESS_PRIV(op[1]- > > >sym->session); > > - op[1]->sym->session =3D > > - sess_ctx->worker_sess[worker_index]; > > - } > > - > > - if (op[2]->sess_type =3D=3D RTE_CRYPTO_OP_WITH_SESSION) { > > - struct scheduler_session_ctx *sess_ctx =3D > > - CRYPTODEV_GET_SYM_SESS_PRIV(op[2]- > > >sym->session); > > - op[2]->sym->session =3D > > - sess_ctx->worker_sess[worker_index]; > > - } > > - > > - if (op[3]->sess_type =3D=3D RTE_CRYPTO_OP_WITH_SESSION) { > > - struct scheduler_session_ctx *sess_ctx =3D > > - CRYPTODEV_GET_SYM_SESS_PRIV(op[3]- > > >sym->session); > > - op[3]->sym->session =3D > > - sess_ctx->worker_sess[worker_index]; > > - } > > + scheduler_set_single_worker_session(op[0], > > worker_index); > > + scheduler_set_single_worker_session(op[1], > > worker_index); > > + scheduler_set_single_worker_session(op[2], > > worker_index); > > + scheduler_set_single_worker_session(op[3], > > worker_index); > > > > op +=3D 4; > > n -=3D 4; > > } > > > > while (n--) { > > - if (op[0]->sess_type =3D=3D RTE_CRYPTO_OP_WITH_SESSION) { > > - struct scheduler_session_ctx *sess_ctx =3D > > - CRYPTODEV_GET_SYM_SESS_PRIV(op[0]- > > >sym->session); > > - > > - op[0]->sym->session =3D > > - sess_ctx->worker_sess[worker_index]; > > - op++; > > - } > > + scheduler_set_single_worker_session(op[0], > > worker_index); > > + op++; > > } > > } > > > > static __rte_always_inline void > > -scheduler_retrieve_session(struct rte_crypto_op **ops, uint16_t > > nb_ops) > > +scheduler_retrieve_single_session(struct rte_crypto_op *op) { > > + if (op->sess_type =3D=3D RTE_CRYPTO_OP_WITH_SESSION) > > + op->sym->session =3D (void *)(uintptr_t) > > + rte_cryptodev_sym_session_opaque_data_get(op- > > >sym->session); > > + else if (op->sess_type =3D=3D RTE_CRYPTO_OP_SECURITY_SESSION) > > + op->sym->session =3D (void *)(uintptr_t) > > + rte_security_session_opaque_data_get(op->sym- > > >session); > > +} > > + > > +static __rte_always_inline void > > +scheduler_retrieve_sessions(struct rte_crypto_op **ops, uint16_t > > +nb_ops) > > { > > uint16_t n =3D nb_ops; > > struct rte_crypto_op **op =3D ops; > > @@ -194,32 +198,77 @@ scheduler_retrieve_session(struct rte_crypto_op > > **ops, uint16_t nb_ops) > > rte_prefetch0(op[7]->sym->session); > > } > > > > - if (op[0]->sess_type =3D=3D RTE_CRYPTO_OP_WITH_SESSION) > > - op[0]->sym->session =3D (void *)(uintptr_t) > > - > > rte_cryptodev_sym_session_opaque_data_get(op[0]->sym- > > >session); > > - if (op[1]->sess_type =3D=3D RTE_CRYPTO_OP_WITH_SESSION) > > - op[1]->sym->session =3D (void *)(uintptr_t) > > - > > rte_cryptodev_sym_session_opaque_data_get(op[1]->sym- > > >session); > > - if (op[2]->sess_type =3D=3D RTE_CRYPTO_OP_WITH_SESSION) > > - op[2]->sym->session =3D (void *)(uintptr_t) > > - > > rte_cryptodev_sym_session_opaque_data_get(op[2]->sym- > > >session); > > - if (op[3]->sess_type =3D=3D RTE_CRYPTO_OP_WITH_SESSION) > > - op[3]->sym->session =3D (void *)(uintptr_t) > > - > > rte_cryptodev_sym_session_opaque_data_get(op[3]->sym- > > >session); > > + scheduler_retrieve_single_session(op[0]); > > + scheduler_retrieve_single_session(op[1]); > > + scheduler_retrieve_single_session(op[2]); > > + scheduler_retrieve_single_session(op[3]); > > > > op +=3D 4; > > n -=3D 4; > > } > > > > while (n--) { > > - if (op[0]->sess_type =3D=3D RTE_CRYPTO_OP_WITH_SESSION) > > - op[0]->sym->session =3D (void *)(uintptr_t) > > - > > rte_cryptodev_sym_session_opaque_data_get(op[0]->sym- > > >session); > > + scheduler_retrieve_single_session(op[0]); > > op++; > > } > > } > > > > +static __rte_always_inline uint32_t > > +scheduler_get_job_len(struct rte_crypto_op *op) { > > + uint32_t job_len; > > + > > + /* op_len is initialized as cipher data length, if > > + * it is 0, then it is set to auth data length > > + */ > > + job_len =3D op->sym->cipher.data.length; > > + job_len +=3D (op->sym->cipher.data.length =3D=3D 0) * > > + op->sym->auth.data.length; > > + > > + return job_len; > > +} > > + > > +static __rte_always_inline void > > +scheduler_free_capabilities(struct scheduler_ctx *sched_ctx) { > > + uint32_t i; > > + > > + if (sched_ctx->capabilities) { > > + rte_free(sched_ctx->capabilities); > > + sched_ctx->capabilities =3D NULL; > > + } > > + > > + if (sched_ctx->sec_crypto_capabilities) { > > + i =3D 0; > > + while (sched_ctx->sec_crypto_capabilities[i] !=3D NULL) { > > + rte_free(sched_ctx->sec_crypto_capabilities[i]); > > + sched_ctx->sec_crypto_capabilities[i] =3D NULL; > > + i++; > > + } > > + > > + rte_free(sched_ctx->sec_crypto_capabilities); > > + sched_ctx->sec_crypto_capabilities =3D NULL; > > + } > > + > > + if (sched_ctx->sec_capabilities) { > > + rte_free(sched_ctx->sec_capabilities); > > + sched_ctx->sec_capabilities =3D NULL; > > + } > > +} > > + > > +static __rte_always_inline int > > +scheduler_check_sec_proto_supp(enum > > rte_security_session_action_type action, > > + enum rte_security_session_protocol protocol) { > > + if (action =3D=3D RTE_SECURITY_ACTION_TYPE_LOOKASIDE_PROTOCOL > > && > > + protocol =3D=3D RTE_SECURITY_PROTOCOL_DOCSIS) > > + return 1; > > + > > + return 0; > > +} > > + > > /** device specific operations function pointer structure */ extern > > struct rte_cryptodev_ops *rte_crypto_scheduler_pmd_ops; > > +extern struct rte_security_ops *rte_crypto_scheduler_pmd_sec_ops; > > > > #endif /* _SCHEDULER_PMD_PRIVATE_H */ diff --git > > a/drivers/crypto/scheduler/scheduler_roundrobin.c > > b/drivers/crypto/scheduler/scheduler_roundrobin.c > > index ad3f8b842a..08041887a8 100644 > > --- a/drivers/crypto/scheduler/scheduler_roundrobin.c > > +++ b/drivers/crypto/scheduler/scheduler_roundrobin.c > > @@ -28,11 +28,11 @@ schedule_enqueue(void *qp, struct rte_crypto_op > > **ops, uint16_t nb_ops) > > if (unlikely(nb_ops =3D=3D 0)) > > return 0; > > > > - scheduler_set_worker_session(ops, nb_ops, worker_idx); > > + scheduler_set_worker_sessions(ops, nb_ops, worker_idx); > > processed_ops =3D rte_cryptodev_enqueue_burst(worker->dev_id, > > worker->qp_id, ops, nb_ops); > > if (processed_ops < nb_ops) > > - scheduler_retrieve_session(ops + processed_ops, > > + scheduler_retrieve_sessions(ops + processed_ops, > > nb_ops - processed_ops); > > > > worker->nb_inflight_cops +=3D processed_ops; @@ -87,7 +87,7 @@ > > schedule_dequeue(void *qp, struct rte_crypto_op **ops, uint16_t > > nb_ops) > > > > nb_deq_ops =3D rte_cryptodev_dequeue_burst(worker->dev_id, > > worker->qp_id, ops, nb_ops); > > - scheduler_retrieve_session(ops, nb_deq_ops); > > + scheduler_retrieve_sessions(ops, nb_deq_ops); > > last_worker_idx +=3D 1; > > last_worker_idx %=3D rr_qp_ctx->nb_workers; > > > > -- > > 2.25.1