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 3B4B1A0093; Mon, 2 May 2022 13:07:09 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D52E340F35; Mon, 2 May 2022 13:07:08 +0200 (CEST) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by mails.dpdk.org (Postfix) with ESMTP id EE8BC40E28 for ; Mon, 2 May 2022 13:07:06 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1651489627; x=1683025627; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=EBllHb65hEOVpBEMWORUa+Sh3Ts8M8e9cDzPjFQ6KXc=; b=nQPStWOPwj7MbRubUOMxZ37GJAYvpMkbFXAlIfEZ4sTrXZL7LK/tBImv jJJoyGSEYiRuyzSts8uw4UiNWMIHlPJiWNANXaxA865mM9Ln5QDfnsDPc ZI6/YoW0A5n5jrV97g/QGicHmUR3sWI+rIX+wJmi6M/Zsd7ERlTcX2/c5 F2U+yAmvfG3ryBTbXdjMIkspiW4k/qCDv8ZROFkiu0u6jB8H75JRDjpt2 jFz3ewhCATs9ci8rk09V0a8FAOgwN+xWhDZy/oflrzrgd3bl8KezLuZvf nxPMNDIVDgn+aLrg36nDQkheYuRx186J2gfEdZggg/WuwPum+r6+vS9vP A==; X-IronPort-AV: E=McAfee;i="6400,9594,10334"; a="254631852" X-IronPort-AV: E=Sophos;i="5.91,190,1647327600"; d="scan'208";a="254631852" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 May 2022 04:07:00 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.91,190,1647327600"; d="scan'208";a="810178204" Received: from orsmsx605.amr.corp.intel.com ([10.22.229.18]) by fmsmga006.fm.intel.com with ESMTP; 02 May 2022 04:06:59 -0700 Received: from orsmsx612.amr.corp.intel.com (10.22.229.25) by ORSMSX605.amr.corp.intel.com (10.22.229.18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.27; Mon, 2 May 2022 04:06:59 -0700 Received: from orsmsx611.amr.corp.intel.com (10.22.229.24) by ORSMSX612.amr.corp.intel.com (10.22.229.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.27; Mon, 2 May 2022 04:06:59 -0700 Received: from ORSEDG601.ED.cps.intel.com (10.7.248.6) by orsmsx611.amr.corp.intel.com (10.22.229.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.27 via Frontend Transport; Mon, 2 May 2022 04:06:59 -0700 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (104.47.55.101) by edgegateway.intel.com (134.134.137.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2308.27; Mon, 2 May 2022 04:06:58 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Jabj9Fx0TNS7QN0Syc545NjMgSHzw9Wn2jDZ0DMNfelMHGU2kISUT0tDfsOMbktlk8L69SQ9SsmIyrYCA4vzxEgdXCqxmX/0E1B57PA6XQONdxPBqccNLWhLOdXWCX3U8E/YpdEj63ISVT206VpCh6ezeoqpgf6Q/1Nhv+4z54bD5o9/cpobQC8vaKh5R0X/sPqYKMXivKi+lLxOU5lLru87Y+kMbqrkfRp6MjQjerbMizdEE0Y2BW8iJfuJKtaJnZB9oBI4R/dfwMfZQi3CYJjZ3ZQE/D4v7Mfas3SgP0qigBBLplvlaVTgKqmxXjpGYmtwBPKwx1QE7j84nuWrTg== 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=YEEItkZWlKaEAnK2/1pnBBu8zt4x6jjftbcZfByBYG0=; b=PoIp8LQrblz0qFBK8scuAGR0HSGFJy8SavEkiT1qghV2NA3YMjX6b+odL8BJzqnDqChSd5hkoBt7qJBj/UHag92olPBX1glR/DbEEnfoLAnFDUU5aYMJjWXH3pHfnr/6or4B7jonBvIwyE/RgCvM5NLJOq4KNz/N9KEFw94WpvuuSJ+c4mDP2WFUv5GflkL8pISXkjcQvWQFtu90rhhVHwS5HYGVj9URzBk6iVhxm0TQhlHd41gz8+T8qjiBetDEm12NGyRNDm6RQFeS70TkeQOGG+1hgH2iyWTcqcnhJxPTXkYbKYOsHXiZqFQzf1R72N9HZ0AR9abujIhGSy6u6g== 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 MN2PR11MB3694.namprd11.prod.outlook.com (2603:10b6:208:f7::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5186.14; Mon, 2 May 2022 11:06:57 +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.028; Mon, 2 May 2022 11:06:57 +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" , "Zhang, Roy Fan" Subject: RE: [PATCH v4 1/7] cryptodev: add APIs to get/set event metadata Thread-Topic: [PATCH v4 1/7] cryptodev: add APIs to get/set event metadata Thread-Index: AQHYXZFdJL6M7Ahhr0a3ED0FGMDb6K0Lbk+A Date: Mon, 2 May 2022 11:06:56 +0000 Message-ID: References: <20220421143720.1583062-1-gakhil@marvell.com> <20220501192457.3670278-1-gakhil@marvell.com> <20220501192457.3670278-2-gakhil@marvell.com> In-Reply-To: <20220501192457.3670278-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: ed3a7d71-0edd-4688-13d9-08da2c2bdf6e x-ms-traffictypediagnostic: MN2PR11MB3694: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: s7e8ziMsfSg3c+WCncOeKLvlgbfm09lVSrZxQZ66SZDLQdeiQuMGmGrN7caiRDElu98ysjDMuTc8MYw94nMhjmwZ1AfkcHKXHFU4B1HG1dGi/POlGEeWvU8CWjUEHVULeGhRQWLgFfY0HkrbHbamGB3dSNB2+Mjni8sgl+pKzGXf03zDP685e20/T31eUj5mVi0uLnk/2c8W6RGXACegyMb6lXvFkTEsRQHi3RbPcY+FKbtOJQSOh1YAG6entWp7sLwcXvv7kY4f+gsBgZX4DOCWM4ZmHLQWf4QAiH9Yh5TFvwnYWA24T3fWU9l3snAMveDI+fz5JKFuW9dM3bjmLr+ZpvpTCjJ/5MODlvrjXMgsvmE5R2EikUfPYBGfPl1OoTiqgWLZ4MXowfLxX59Ygd2D5v9oJ9MzsTslAdevcDUHQYsqrwhzxyRvfDGzNvW6xO6346u2If7y9CzsQZy0g36dtkUAtF18d1HOXaIKcBACDcU9CC1QKbYt6wg9IgDNjnXe8k3Hjs8B/wAI1U4EtB0DWagDacS9Djb/rJ4d+Nx/xXVKXg0a47hwsylvwFXnyyJMyYYBWL2sTvMP8oTrottT+EDgg8/5RiIin4Nw+q8bmZiEGGYDDA2kXdrMs7Byp/sjd0uaaAn+T3tXtSXYN1KQBRmNAX+hRi8T7zXAty1RQ+ujieVZxLtcIheB5oASeRGlj/9r5ItQ18Xwv0c27g== 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)(110136005)(86362001)(33656002)(8676002)(66556008)(4326008)(66476007)(66946007)(76116006)(64756008)(508600001)(66446008)(55016003)(71200400001)(54906003)(316002)(38100700002)(38070700005)(2906002)(83380400001)(186003)(8936002)(107886003)(5660300002)(9686003)(6506007)(7696005)(122000001)(26005)(53546011)(82960400001)(52536014); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?afPTTRucryU2LAPEaWurAlbqlPwRUzwNac3sC5qSxRhnUmFHrVbkgeooT9WM?= =?us-ascii?Q?NTowO7lYt2eUkfJQzCPrs29pdZuCOT9T13p0VWg9bSX5o49AiifwVlOORVSf?= =?us-ascii?Q?kqy+RNLwr/knlcSQD7x3vLbKcC/rtNLWI+FWQYgpNxOo3FtmeLAxkDPI5QaT?= =?us-ascii?Q?as8+zP+dJt9gollseOsUa0rT1RvPKMs5TEGy/o9dcJL+llp0sGYBGKpMl66/?= =?us-ascii?Q?93dPgswX/mEFNOW65h9MNKPf6lWOCxR+087mR18hKqqgHqOhj05+yEQuLJeQ?= =?us-ascii?Q?z+MYHZrjaZlMxCdNjL8tOg+sdr39PaWHxiQaesCToDyZzcS++dbMHT0HuQrQ?= =?us-ascii?Q?Ca+S59y5anAsfn9U8FwI2fl8TiEnwOrB//hXMIGFW+6DDsirdMaqmSHuPrgJ?= =?us-ascii?Q?i7bKBpErLtBKCn1iaFvKDptVGkOryUEi5iSR5Lsan8kiMMx1nue68tfrhxXk?= =?us-ascii?Q?aWVomYTHFWRGkoR8AAreErVzTJGgwkD428hH2VuoOJDaJlDx4YooGIvjsd0U?= =?us-ascii?Q?4ykKlSV2wZu050WB8wHr6OyR2bw7zW43lyDSCy0JFWqazMbQFY/73L6ZJtx5?= =?us-ascii?Q?Nv7FpTqc+0vDAT5/wtNBs+yy/nXWFblLTmijTr/si86hnssN0R+0cEO3t8TV?= =?us-ascii?Q?qBHLLFym7YZWFWn/uplgHqVmyXMbNxLWu+hMGd7mPEsEjlcRwkSf8q/f+9RT?= =?us-ascii?Q?rkh9bUGAUYCgFnZQlUc2GAe/8uGAD1Gu/PPwsvDl0/NffAOkcA6LuofcqPUd?= =?us-ascii?Q?MPbTAh+P6k/Jt1wo3Q52L/6DpwPkzZZevvt9u0JSVa5zi4VsNkln2iXoEQkv?= =?us-ascii?Q?4oBQ8Jv9HkYySpDDAghp0Wx60YZky4rKdPVpDhoeGKD82mdrvWnKurddBNHl?= =?us-ascii?Q?hElZNAIwHUkCJQR6l7m4YkPN1LbT9w12TngtVeuSdcdcP16Fh+FmfdtUYtpJ?= =?us-ascii?Q?x56fHZunhT9PnjPlMpxMG775TgcxCKU5MK0mR4FQyx+WEbGPd8aAMn1/yJ06?= =?us-ascii?Q?1z0kaf9AkZdNukBsK3CzxX0dWZ4CErk2uR8IwWnyVukUt/Y77RsVHJg74/Mk?= =?us-ascii?Q?XNQuIwCi9zrbi4QyiDgKIz5oTCJhMkm6TNW61IespWsdY3UEkU3bgUGd4j3B?= =?us-ascii?Q?nehqex1cLEC0eoNhw4e2lnVKGbg7rmggKjYfA2Vw1k4x7o2Jq33K1PfV8PUh?= =?us-ascii?Q?PYRMevnBGYym4YavNFyGZbJX1RJWmFM7AiMhn6l2Gag6CaM5ScsxF0ZvG9XS?= =?us-ascii?Q?mBHO+0Ug/5Q8E6kZ27UuifzDkFiEkup+zafueqOK+BZ83g8uUkdDOKlYyboH?= =?us-ascii?Q?2tVDkaBGBNjp3htnNYYKuHOUOEPIdDUVEn5FNKjSTCImKcn/DYMfV69wWvT9?= =?us-ascii?Q?MkHhK6si88wY6TDnf8TRNwPhUuJA7Q+bUefVj05pRR0NA9xcyDoN6fAS3z37?= =?us-ascii?Q?rhhlINLV0aJQ6ACG1ocdllHjJfrLkSJs3nRe72Iu8G5QfvuFcsNMsC8Nl1Zp?= =?us-ascii?Q?sisvKc+0K1TE5FNywi5E70wN1g/aJtO8/S4MKrSmpxlvjL0gMLvQlOEpanZW?= =?us-ascii?Q?2BJAQO+5qGHX2Mv7L0MiCqtcUlJUnp/W8uWJT3SelfeX7DfCkue0ifd0cByZ?= =?us-ascii?Q?3G3yz5PZkXjg+bD+o5W13VgTl5el7CwWRBDFuG0re0SWOJL1HYAs5qnLmnUa?= =?us-ascii?Q?9dErMBmkwRoygUleZWyLFaCCjy6jrlb3+iurq3Tlsho6WkbAa7lMSz3qaty8?= =?us-ascii?Q?Ns3+RVIFx7kviwl0mXHTpaGQLIbpzLI=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: ed3a7d71-0edd-4688-13d9-08da2c2bdf6e X-MS-Exchange-CrossTenant-originalarrivaltime: 02 May 2022 11:06:56.9471 (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: 0n2ZYkxhDrROUqPt2j/fogOrlPhsPIhOnBQk+nPZg7PB3UfTiBauEWbV1Sxb5EWXPnvGNNyy5Y52QP3fV9HjUPKHl9QV/DsDT/EDtBpRa2s= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR11MB3694 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 Acked-by: Abhinandan Gujjar > -----Original Message----- > From: Akhil Goyal > Sent: Monday, May 2, 2022 12:55 AM > To: dev@dpdk.org > Cc: anoobj@marvell.com; jerinj@marvell.com; Gujjar, Abhinandan S > ; Jayatheerthan, Jay > ; Vangati, Narender > ; vfialko@marvell.com; Akhil Goyal > ; Zhang, Roy Fan > Subject: [PATCH v4 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 > Acked-by: Fan Zhang > --- > lib/cryptodev/cryptodev_pmd.c | 16 +++++++++++++ > lib/cryptodev/cryptodev_pmd.h | 36 ++++++++++++++++++++++++++++ > lib/cryptodev/rte_cryptodev.c | 44 +++++++++++++++++++++++++++++++++++ > lib/cryptodev/rte_cryptodev.h | 22 ++++++++++++++++++ > lib/cryptodev/version.map | 4 ++++ > 5 files changed, 122 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) { > + 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..7a7d3ee3f1 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, NULL. > + */ > +__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) { > @@ -637,6 +671,8 @@ RTE_STD_C11 struct rte_cryptodev_asym_session { > uint16_t user_data_sz; > /**< Session user data will be placed after sess_data */ > uint8_t padding[3]; > + void *event_mdata; > + /**< Event metadata (aka *union rte_event_crypto_metadata*) */ > uint8_t sess_private_data[0]; > }; >=20 > diff --git a/lib/cryptodev/rte_cryptodev.c b/lib/cryptodev/rte_cryptodev.= c index > 3500a2d470..5ebc423afa 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 !=3D NULL) > + rte_free(((struct rte_cryptodev_asym_session *)sess)- > >event_mdata); > + > /* Return session to mempool */ > sess_mp =3D rte_mempool_from_obj(sess); > rte_mempool_put(sess_mp, sess); > @@ -2259,6 +2262,47 @@ 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 (sess =3D=3D NULL || ev_mdata =3D=3D NULL) > + return -EINVAL; > + > + 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; > + > + 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