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 196AFA034C; Thu, 28 Apr 2022 16:43:15 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id AF61C42819; Thu, 28 Apr 2022 16:43:14 +0200 (CEST) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by mails.dpdk.org (Postfix) with ESMTP id 2CBC540E50 for ; Thu, 28 Apr 2022 16:43:12 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1651156993; x=1682692993; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=l+PdHGFLYjoTKZoclyrwxKKbVgXuLtvquGaI7u/k/zc=; b=B+BOvwOnzyOat65J8RZeB23Lxss9THazrac97BBNv8488Oy7xqvv5E6z /Nci0vBf73lmsMoi/47h8q1B53NzEc3PPW4y8dRELdsu8GTvQa2apptlC aYhCIIX66TY2jUu9W/i/Ls0HM6qc1ooeXZ9y810P5oooJ6YTEd95QPS4I 1IQhTDYpM3MCGd7jna77KYePnELGz/sf9Pi+6sXcBbIP2lW4rGONR9Qc2 rsSPILaOveME0RI1ex5t9cNrp2jETmddl4/of8PtxOhsg0Pl05gTVRko3 bDwB664Uac/swpQ5hjwmSCSdYJhwEdvXkt0UDScGfugSoZwk2FCh1XHVx w==; X-IronPort-AV: E=McAfee;i="6400,9594,10330"; a="246225947" X-IronPort-AV: E=Sophos;i="5.91,295,1647327600"; d="scan'208";a="246225947" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Apr 2022 07:43:11 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.91,295,1647327600"; d="scan'208";a="682899782" Received: from fmsmsx606.amr.corp.intel.com ([10.18.126.86]) by orsmga004.jf.intel.com with ESMTP; 28 Apr 2022 07:43:10 -0700 Received: from fmsmsx601.amr.corp.intel.com (10.18.126.81) by fmsmsx606.amr.corp.intel.com (10.18.126.86) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.27; Thu, 28 Apr 2022 07:43:09 -0700 Received: from FMSEDG603.ED.cps.intel.com (10.1.192.133) by fmsmsx601.amr.corp.intel.com (10.18.126.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.27 via Frontend Transport; Thu, 28 Apr 2022 07:43:09 -0700 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (104.47.57.176) 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.2308.27; Thu, 28 Apr 2022 07:42:49 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fu3JN2VFWDWM0kIcbk+ubINsA07oZ/zZnhxeQAg4M0hXmKUOTd+VAqgtWNyUN+JuL4TieL7KE/WkZj1HQ8sYCawYrprqDN0cg8YYN9baTMS/HgYAkcFIIAfpYc+WLPSl1N5MQKfQgZnesBFjkt0M64J6O8zAzOF2fJnxMVSGZOSJoR2UhpPThPcya/qBkr7nQESj+Db80q4wTc1o1umcZz1H+hSYMLjeknua+bQbIWm/c/1eGkYC3Dx+ilZZ6wBDghFfYgxEZS8gws0OuYym6roo6EXx1nAa7LACeN9jnjHzKhe7jVzhrzOPsV+BlpHd68lp26Sk6c0xjLfywGqjTQ== 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=XmepLOWiCXLDrLdjZD8GRUspIM3F0R5H4jgdwu2owVA=; b=OTJBSx6+vIhJZULC3Qxm/wQtU7JIxK68xS0keFHELUjjN7z5VPX6nwtk0hLsXyq5TMYgksAAhTnzK7QlQj4/qe/WWgPsTKTuvuJKdGknTgYZUiwHWujkmeA4tIRbsisOzscotAyyKuDJ4qfuOJE6fivR41QLQ8zO+VUMV7flofhyGwpMRUftyduObgxb+l0XNFhAZ1rEFAQ1Z5qgE2bFF5wyamjW84x/ByVFFC09qwxWV0e98gXwkiSPZW2zHH71yGFzd47xCdHMTb1oTfqf4ioRhHQMBeVI0BQUXD1P8TD/QcWfbKwtT0T9p37vUBk8CTRMUkuGUOAdnbDN/PWZaA== 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 PH0PR11MB5832.namprd11.prod.outlook.com (2603:10b6:510:141::7) by BYAPR11MB3094.namprd11.prod.outlook.com (2603:10b6:a03:87::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5186.14; Thu, 28 Apr 2022 14:42:47 +0000 Received: from PH0PR11MB5832.namprd11.prod.outlook.com ([fe80::ad86:86fe:a02b:174f]) by PH0PR11MB5832.namprd11.prod.outlook.com ([fe80::ad86:86fe:a02b:174f%5]) with mapi id 15.20.5186.021; Thu, 28 Apr 2022 14:42:47 +0000 From: "Gujjar, Abhinandan S" To: Akhil Goyal , "dev@dpdk.org" CC: "anoobj@marvell.com" , "jerinj@marvell.com" , "Jayatheerthan, Jay" , "Vangati, Narender" , "vfialko@marvell.com" Subject: RE: [PATCH v3 1/7] cryptodev: add APIs to get/set event metadata Thread-Topic: [PATCH v3 1/7] cryptodev: add APIs to get/set event metadata Thread-Index: AQHYVY1fL2DaYp82eUyWUZKoPF6zsK0FbyAA Date: Thu, 28 Apr 2022 14:42:47 +0000 Message-ID: References: <20220418193325.368313-1-gakhil@marvell.com> <20220421143720.1583062-1-gakhil@marvell.com> <20220421143720.1583062-2-gakhil@marvell.com> In-Reply-To: <20220421143720.1583062-2-gakhil@marvell.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-reaction: no-action dlp-version: 11.6.500.15 authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: d914fe0f-a391-4d68-3d42-08da29255cfb x-ms-traffictypediagnostic: BYAPR11MB3094:EE_ x-microsoft-antispam-prvs: x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: F521HScdcf6vC+bBqkrDpGrshrIoGYKO5GUboXsECRY0We4VHQXZieViAV3BV3UL8syv8be7DQ87P7JtPAVsL+YFBBfJizAsHf9Butk6NXBgrD/SlOwOekC0c1hexnEl+DtvjwS27znGBx0cytaEeRuqh+PTCtwHZfUcnPggns02X30/RUqWkgsfdZtjVDKaOmx8IV3vyH3KPrQTyaUoEqSAPqLij2TDmN4v2p1UgUJUTA93f0wIW0t0IhN+VDvs2amSVQc0yAioSFfrxTWlVoZWexlbn826xz55J5LS7cf3qzMRcLbV8rmqJgZEYcj9COi9f0BR9H/Zl8VZH9d52sexcXbya4x6w7bcu6pTnf0FL7Rxj0HpoJ8mTrJ5rNt009WSiUEOE5EQtfPomTDDmTuynbLlbarFdc+LRbMet52JKcZomM+rfCVVpnWcuKV8tSmUKzpVIcc0qGbVMgK1JgPSP4pGkDC91ajtpTLSOJMLH1S3SxfvLJM53m/tZdcDJgxwS5iXB1U6uFeruuW4RN+TDt+fyUwCOQm76pjv6jVV4HGg/JpkhinLWEdp2qZY7AuSv2Lp2Tkfj9IavxeGn9TFCKnkfZuauKm4uLQ6vkJ7lI0tJ4Kmk7BU7B2vPBMMmWur2KTSNzZgtsY0zLoOEdPRdd5l4NGYjiUStQ8bM7AC0lUgdreVvGApTHR1DDqNgByYBuye57U761yN/3wz6w== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PH0PR11MB5832.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(366004)(53546011)(122000001)(71200400001)(2906002)(83380400001)(66556008)(66476007)(38070700005)(508600001)(9686003)(86362001)(38100700002)(26005)(186003)(64756008)(66446008)(66946007)(76116006)(4326008)(8676002)(82960400001)(55236004)(33656002)(6506007)(54906003)(7696005)(55016003)(52536014)(8936002)(316002)(5660300002)(110136005); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?awEatm9RigmbCXkIXhean3PYftiNeq3dMokFxljempK9m3kk47jvJzx3sXby?= =?us-ascii?Q?q2AypMKErqeO1wfopYTbATkIsZ1z3FwPWD6dgs1kihSfjnjxFXa1t6mCdUVJ?= =?us-ascii?Q?tXSJ0eF2CECsUhiVnXUY2nUGzRr/uQrziCz8bFWZL4gEjoYMXL3ojfp74pkI?= =?us-ascii?Q?M1JBGPH0RIYFdmMw+TcERyZmUx6SXPzYTKg1XrFqkex0vkdMJ89EzduoXh2A?= =?us-ascii?Q?c3yGWl0+gAORgGNScRcy68jVHBzTT1Y8H/5CODeB36BLRA9nfCscLK026acf?= =?us-ascii?Q?ZTa6kvXJZpqjKH5OqZ330B+quQorsIdpkdJSo1qEEQJ8ouKmFDfPSpic0NRn?= =?us-ascii?Q?S3/F/EJNSaVa6w/DIkQGbnuIcKdshaz7VCTL4LwjWVgBf+tErBkJaK8m+3DF?= =?us-ascii?Q?ZKG+y3hBLQ/b5gzworXoL76EUtyGSS1HWk+0e9EPnWGPhfET/nfkcOuoeJDX?= =?us-ascii?Q?Z/G5vOd4wYPxb3liVH2e7p5iGi9b7HlHDBHn/Qp2C0kFD4zGM1qLaDSQgjvK?= =?us-ascii?Q?2Nt6uX78GIDUeIxUmKf2ndotiuePjgKDjDOCWYbp7n+RZmRZYQ9iiLfKFFZW?= =?us-ascii?Q?EFBxG9oL39a1Se3v/e1r2C0T+7cUZVOzbb+rHRraqOhW04zsy59tGLRW1ZJw?= =?us-ascii?Q?lC1mmXrILFQE6DNPyF3d05wfOlTibH9G15MXsauN7QDsYwlPsigcOQwsn+7X?= =?us-ascii?Q?7whRqbQQLJDNiJmEizQ08/R/CjzS/wept/MScECjHz9L49KcwwS+9HHxl54i?= =?us-ascii?Q?C64r71feNqdJaKt5ymyfqWa3+s47LFsRr/vOUS6fJnYwKXwrWLcsZbdrGQTu?= =?us-ascii?Q?dsraiyfECHDsm68rkVRZ/iKWwpULMHgIjFsWFMYYHWMwqxYbpMGMKGHli3Cq?= =?us-ascii?Q?jKnPqBF0pTawKuBuregI/Rbh1GPpEFKJZjhx867X6HDqkAMdUkM/SzK73AzC?= =?us-ascii?Q?G8I1/MdTCzd8yZF9Xre5W4SUu+80+nrXbc6N6gYzmSwg08BUjxmEia6dhkLR?= =?us-ascii?Q?efbaSr9H8QqGwWdbyQ7REElXKfaNHD0xinT1HVyxGQ/AYZmuq72D3i71wbbt?= =?us-ascii?Q?Yr1wKgvsYxDo5iul1IeZL3OaZuwtMXpXzZS7VGlqQFWNzUO/c7wAYuW5O7Gg?= =?us-ascii?Q?HX5Ocrh7cekgDka5T6g1Q+I1oib0pv5vL8cAYdHD1TtJEs3ammTd5nbL1uQV?= =?us-ascii?Q?WB8Z/18knM3dm5fSNm9ZPFbYAykQAdFFzhzehSv5cVWAyRtdV2oz9SkZdHyX?= =?us-ascii?Q?nB8JbRlAVCNZNje2LvXebGGuDGhjsaSxirhx90OYMkFtfU/VbXLX3uRVtDhU?= =?us-ascii?Q?4hkWQDq1jTnutukhwrfARnahOMGWh5xfh7Ikjq/qnPA1GBnoWjkXvKwpzB4v?= =?us-ascii?Q?disKpQolJdQKomAwYUNBJD8RoPXMycg9giZgMwQItPgOPwQ0uKrR/Sz4GPpi?= =?us-ascii?Q?mfQFtb5Q2elYOH7ylG53Wm9HbZHv77/5OuPufWYWJ08ohuAxDWiaTR8C5O7a?= =?us-ascii?Q?UByYDWNCEv77/b1/hK/WQitbDfCk4TU9wvLIcLW/TB/y9nkAQgt6iXIb9gPJ?= =?us-ascii?Q?rVckavB25uDyQ4qmntcj5SXE3Gyvb47S+wKecQSLv0sCaUbuN2Z0Y1oZh+vk?= =?us-ascii?Q?MPSxNd9JpdKfwmjeJJ8zzv6RYonUX8CYcCDUEJ+lUuyzHydllkICP8eNX2Jm?= =?us-ascii?Q?dosm9KvvPVtRvwIn9vWNKn1+ok0fQ4K93VzBU5sF38p7ANsRAYJzlJmGpN2j?= =?us-ascii?Q?jWWdsLIZnHGux1/UVWf0afiaDQVD8qE=3D?= 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: PH0PR11MB5832.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: d914fe0f-a391-4d68-3d42-08da29255cfb X-MS-Exchange-CrossTenant-originalarrivaltime: 28 Apr 2022 14:42:47.6219 (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: CzWUkZHaet3sYnAZ/Z9D1PaD3UtMGnwWuXp3tTEzhK6DoG2B6dJArXzGQLauxVWnf0PnZYu5ERo5FA5bjUX/nPbRcM6IgSpeKVE62B8vSJQ= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR11MB3094 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 > -----Original Message----- > From: Akhil Goyal > Sent: Thursday, April 21, 2022 8:07 PM > To: dev@dpdk.org > Cc: anoobj@marvell.com; jerinj@marvell.com; Gujjar, Abhinandan S > ; Jayatheerthan, Jay > ; Vangati, Narender > ; vfialko@marvell.com; Akhil Goyal > > Subject: [PATCH v3 1/7] cryptodev: add APIs to get/set event metadata >=20 > From: Volodymyr Fialko >=20 > Currently, crypto session userdata is used to set event crypto metadata f= rom > the application and the driver is dereferencing it in driver which is not= correct. > User data is meant to be opaque to the driver. > To support this, new API is added to get and set event crypto metadata. T= he > new API, rte_cryptodev_set_session_event_mdata, > allows setting event metadata in session private data which is filled ins= ide PMD > using a new cryptodev op. This operation can be performed on any of the P= MD > supported sessions (sym/asym/security). > For SW abstraction of event crypto adapter to be used by eventdev library= , a > new field is added in asymmetric crypto session for now and for symmetric > case, current implementation of using userdata is used. Symmetric cases c= annot > be fixed now, as it will be ABI breakage which will be resolved in DPDK 2= 2.11. >=20 > Signed-off-by: Volodymyr Fialko > Signed-off-by: Akhil Goyal > --- > lib/cryptodev/cryptodev_pmd.c | 16 ++++++++++++++ > lib/cryptodev/cryptodev_pmd.h | 36 ++++++++++++++++++++++++++++++ > lib/cryptodev/rte_cryptodev.c | 41 +++++++++++++++++++++++++++++++++++ > lib/cryptodev/rte_cryptodev.h | 22 +++++++++++++++++++ > lib/cryptodev/version.map | 4 ++++ > 5 files changed, 119 insertions(+) >=20 > diff --git a/lib/cryptodev/cryptodev_pmd.c b/lib/cryptodev/cryptodev_pmd.= c > index 739a0b3f34..1903ade388 100644 > --- a/lib/cryptodev/cryptodev_pmd.c > +++ b/lib/cryptodev/cryptodev_pmd.c > @@ -227,3 +227,19 @@ cryptodev_fp_ops_set(struct rte_crypto_fp_ops > *fp_ops, > fp_ops->qp.enq_cb =3D dev->enq_cbs; > fp_ops->qp.deq_cb =3D dev->deq_cbs; > } > + > +void * > +rte_cryptodev_session_event_mdata_get(struct rte_crypto_op *op) { Null check for op? > + if (op->type =3D=3D RTE_CRYPTO_OP_TYPE_SYMMETRIC && > + op->sess_type =3D=3D RTE_CRYPTO_OP_WITH_SESSION) > + return rte_cryptodev_sym_session_get_user_data(op->sym- > >session); > + else if (op->type =3D=3D RTE_CRYPTO_OP_TYPE_ASYMMETRIC && > + op->sess_type =3D=3D RTE_CRYPTO_OP_WITH_SESSION) > + return op->asym->session->event_mdata; > + else if (op->sess_type =3D=3D RTE_CRYPTO_OP_SESSIONLESS && > + op->private_data_offset) > + return ((uint8_t *)op + op->private_data_offset); > + else > + return NULL; > +} > diff --git a/lib/cryptodev/cryptodev_pmd.h b/lib/cryptodev/cryptodev_pmd.= h > index 2b1ce2da2d..7969944b66 100644 > --- a/lib/cryptodev/cryptodev_pmd.h > +++ b/lib/cryptodev/cryptodev_pmd.h > @@ -398,6 +398,25 @@ typedef int > (*cryptodev_sym_configure_raw_dp_ctx_t)( > enum rte_crypto_op_sess_type sess_type, > union rte_cryptodev_session_ctx session_ctx, uint8_t is_update); >=20 > +/** > + * Typedef that the driver provided to set event crypto meta data. > + * > + * @param dev Crypto device pointer. > + * @param sess Crypto or security session. > + * @param op_type Operation type. > + * @param sess_type Session type. > + * @param ev_mdata Pointer to the event crypto meta data > + * (aka *union rte_event_crypto_metadata*) > + * @return > + * - On success return 0. > + * - On failure return negative integer. > + */ > +typedef int (*cryptodev_session_event_mdata_set_t)( > + struct rte_cryptodev *dev, void *sess, > + enum rte_crypto_op_type op_type, > + enum rte_crypto_op_sess_type sess_type, > + void *ev_mdata); > + > /** Crypto device operations function pointer table */ struct > rte_cryptodev_ops { > cryptodev_configure_t dev_configure; /**< Configure device. */ > @@ -442,6 +461,8 @@ struct rte_cryptodev_ops { > /**< Initialize raw data path context data. */ > }; > }; > + cryptodev_session_event_mdata_set_t session_ev_mdata_set; > + /**< Set a Crypto or Security session even meta data. */ > }; >=20 >=20 > @@ -603,6 +624,19 @@ void > cryptodev_fp_ops_set(struct rte_crypto_fp_ops *fp_ops, > const struct rte_cryptodev *dev); >=20 > +/** > + * Get session event meta data (aka *union rte_event_crypto_metadata*) > + * > + * @param op pointer to *rte_crypto_op* structure. > + * > + * @return > + * - On success, pointer to event crypto metadata > + * - On failure, a negative value. > + */ > +__rte_internal > +void * > +rte_cryptodev_session_event_mdata_get(struct rte_crypto_op *op); > + > static inline void * > get_sym_session_private_data(const struct rte_cryptodev_sym_session *ses= s, > uint8_t driver_id) { > @@ -636,6 +670,8 @@ RTE_STD_C11 struct rte_cryptodev_asym_session { > /**< Size of private data used when creating mempool */ > uint16_t user_data_sz; > /**< Session user data will be placed after sess_data */ > + void *event_mdata; > + /**< Event crypto adapter metadata */ Add reference to rte_event_crypto_metadata for clarity? > uint8_t padding[3]; > uint8_t sess_private_data[0]; > }; > diff --git a/lib/cryptodev/rte_cryptodev.c b/lib/cryptodev/rte_cryptodev.= c index > 3500a2d470..a070cb2a00 100644 > --- a/lib/cryptodev/rte_cryptodev.c > +++ b/lib/cryptodev/rte_cryptodev.c > @@ -2051,6 +2051,9 @@ rte_cryptodev_asym_session_free(uint8_t dev_id, > void *sess) >=20 > dev->dev_ops->asym_session_clear(dev, sess); >=20 > + if (((struct rte_cryptodev_asym_session *)sess)->event_mdata) > + rte_free(((struct rte_cryptodev_asym_session *)sess)- > >event_mdata); > + Who allocates memory for event_mdata? If this done by application before ca= lling rte_cryptodev_session_event_mdata_set(), please document it. > /* Return session to mempool */ > sess_mp =3D rte_mempool_from_obj(sess); > rte_mempool_put(sess_mp, sess); > @@ -2259,6 +2262,44 @@ rte_cryptodev_configure_raw_dp_ctx(uint8_t > dev_id, uint16_t qp_id, > sess_type, session_ctx, is_update); > } >=20 > +int > +rte_cryptodev_session_event_mdata_set(uint8_t dev_id, void *sess, > + enum rte_crypto_op_type op_type, > + enum rte_crypto_op_sess_type sess_type, > + void *ev_mdata, > + uint16_t size) > +{ > + struct rte_cryptodev *dev; > + > + if (!rte_cryptodev_is_valid_dev(dev_id)) > + goto skip_pmd_op; > + > + dev =3D rte_cryptodev_pmd_get_dev(dev_id); > + if (dev->dev_ops->session_ev_mdata_set =3D=3D NULL) > + goto skip_pmd_op; > + > + return (*dev->dev_ops->session_ev_mdata_set)(dev, sess, op_type, > + sess_type, ev_mdata); > + > +skip_pmd_op: > + if (op_type =3D=3D RTE_CRYPTO_OP_TYPE_SYMMETRIC) > + return rte_cryptodev_sym_session_set_user_data(sess, > ev_mdata, > + size); > + else if (op_type =3D=3D RTE_CRYPTO_OP_TYPE_ASYMMETRIC) { > + struct rte_cryptodev_asym_session *s =3D sess; Null check for sess? > + > + if (s->event_mdata =3D=3D NULL) { > + s->event_mdata =3D rte_malloc(NULL, size, 0); > + if (s->event_mdata =3D=3D NULL) > + return -ENOMEM; > + } > + rte_memcpy(s->event_mdata, ev_mdata, size); > + > + return 0; > + } else > + return -ENOTSUP; > +} > + > uint32_t > rte_cryptodev_raw_enqueue_burst(struct rte_crypto_raw_dp_ctx *ctx, > struct rte_crypto_sym_vec *vec, union rte_crypto_sym_ofs ofs, diff -- > git a/lib/cryptodev/rte_cryptodev.h b/lib/cryptodev/rte_cryptodev.h index > 45d33f4a50..2c2c2edeb7 100644 > --- a/lib/cryptodev/rte_cryptodev.h > +++ b/lib/cryptodev/rte_cryptodev.h > @@ -1269,6 +1269,28 @@ __rte_experimental int > rte_cryptodev_get_raw_dp_ctx_size(uint8_t dev_id); >=20 > +/** > + * Set session event meta data > + * > + * @param dev_id The device identifier. > + * @param sess Crypto or security session. > + * @param op_type Operation type. > + * @param sess_type Session type. > + * @param ev_mdata Pointer to the event crypto meta data > + * (aka *union rte_event_crypto_metadata*) > + * @param size Size of ev_mdata. > + * > + * @return > + * - On success, zero. > + * - On failure, a negative value. > + */ > +__rte_experimental > +int > +rte_cryptodev_session_event_mdata_set(uint8_t dev_id, void *sess, > + enum rte_crypto_op_type op_type, > + enum rte_crypto_op_sess_type sess_type, > + void *ev_mdata, uint16_t size); > + > /** > * Union of different crypto session types, including session-less xform > * pointer. > diff --git a/lib/cryptodev/version.map b/lib/cryptodev/version.map index > c7c5aefceb..f0abfaa47d 100644 > --- a/lib/cryptodev/version.map > +++ b/lib/cryptodev/version.map > @@ -105,6 +105,9 @@ EXPERIMENTAL { > rte_cryptodev_asym_session_pool_create; > rte_cryptodev_asym_session_set_user_data; > __rte_cryptodev_trace_asym_session_pool_create; > + > + #added in 22.07 > + rte_cryptodev_session_event_mdata_set; > }; >=20 > INTERNAL { > @@ -123,5 +126,6 @@ INTERNAL { > rte_cryptodev_pmd_parse_input_args; > rte_cryptodev_pmd_probing_finish; > rte_cryptodev_pmd_release_device; > + rte_cryptodev_session_event_mdata_get; > rte_cryptodevs; > }; > -- > 2.25.1