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 65749A00C3; Fri, 25 Mar 2022 12:16:28 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 676C542850; Fri, 25 Mar 2022 12:16:26 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id 871D44284F for ; Fri, 25 Mar 2022 12:16:25 +0100 (CET) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.1.2/8.16.1.2) with ESMTP id 22P5sG2O022349; Fri, 25 Mar 2022 04:16:24 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=pfpt0220; bh=6d4YcqZtf2G68CsUbIUF7SzdvDipQhbGoVXXFARE+UU=; b=iwMzntjTNtGmHegXZFDWkqikkJrKo60L/jVppf7sUWtT6nenOquiE1od/xM1n7tQeUyK FqWm+O7LTae3nTK0Rc9LCki4D9V8ZTgbgof9QjLoM7SpzxMQCm4Q/pjdrKY61itM0bJz XaarQuKl65OiZQSWO4Hm1Jig0xq0yR3nWz2O2FAZzxcfwFY+NaXtRGLuqR0yzQJZ6bfL xBne3LRvL6YhANikCTc/Gp9GpYqVrUih5/1K7LED151pKfj6eS4Yb8RHrWajmjtifkcx 1ubiBfEPPd18zGJcyhbMWtfxFIAXKoLSWL9iSHQSHkiNxc8xvuRbfadFQ1Asxg5arTlf PA== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3f0mn6x5r1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Fri, 25 Mar 2022 04:16:24 -0700 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Fri, 25 Mar 2022 04:16:23 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Fri, 25 Mar 2022 04:16:23 -0700 Received: from localhost.localdomain (unknown [10.28.34.39]) by maili.marvell.com (Postfix) with ESMTP id 5971C3F704C; Fri, 25 Mar 2022 04:16:21 -0700 (PDT) From: Volodymyr Fialko To: , Abhinandan Gujjar , "Akhil Goyal" CC: , Volodymyr Fialko , Anoob Joseph Subject: [PATCH 1/2] security: introduce per session event metadata Date: Fri, 25 Mar 2022 12:16:14 +0100 Message-ID: <20220325111615.1118946-2-vfialko@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220325111615.1118946-1-vfialko@marvell.com> References: <20220325111615.1118946-1-vfialko@marvell.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-GUID: qCOjdCqtK82LuKM0tYO1YSo-1y3zTOS8 X-Proofpoint-ORIG-GUID: qCOjdCqtK82LuKM0tYO1YSo-1y3zTOS8 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.850,Hydra:6.0.425,FMLib:17.11.64.514 definitions=2022-03-25_02,2022-03-24_01,2022-02-23_01 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 Implement API to set/get event data per security session. Signed-off-by: Volodymyr Fialko Acked-by: Akhil Goyal Acked-by: Anoob Joseph --- .../prog_guide/event_crypto_adapter.rst | 4 +- lib/security/rte_security.h | 43 +++++++++++++++++++ 2 files changed, 45 insertions(+), 2 deletions(-) diff --git a/doc/guides/prog_guide/event_crypto_adapter.rst b/doc/guides/prog_guide/event_crypto_adapter.rst index 4fb5c688e0..227b36b4b7 100644 --- a/doc/guides/prog_guide/event_crypto_adapter.rst +++ b/doc/guides/prog_guide/event_crypto_adapter.rst @@ -246,9 +246,9 @@ by ``rte_cryptodev_sym_session_get_user_data()`` API. The RTE_EVENT_CRYPTO_ADAPTER_CAP_SESSION_PRIVATE_DATA capability indicates whether HW or SW supports this feature. -For security session, ``rte_security_session_set_private_data()`` API +For security session, ``rte_security_session_set_event_mdata()`` API will be used to set request/response data. The same data will be obtained -by ``rte_security_session_get_private_data()`` API. +by ``rte_security_session_get_event_mdata()`` API. For session-less it is mandatory to place the request/response data with the ``rte_crypto_op``. diff --git a/lib/security/rte_security.h b/lib/security/rte_security.h index b080d10c2c..29ec514504 100644 --- a/lib/security/rte_security.h +++ b/lib/security/rte_security.h @@ -526,6 +526,8 @@ struct rte_security_session { /**< Private session material */ uint64_t opaque_data; /**< Opaque user defined data */ + void *event_mdata; + /**< Event request/response information */ }; /** @@ -729,6 +731,47 @@ set_sec_session_private_data(struct rte_security_session *sess, sess->sess_private_data = private_data; } +/** + * Get event meta data attached to a security session. + * + * @param sess Session pointer allocated by + * *rte_security_session_create*. + * + * @return + * - On success return pointer to the event crypto meta data which is set + * using *rte_security_session_set_event_mdata* + * - On failure returns NULL. + */ +__rte_experimental +static inline void * +rte_security_session_get_event_mdata(const struct rte_security_session *sess) +{ + return sess->event_mdata; +} + +/** + * Attach event crypto meta data to a security session. + * + * Application can allocate memory for *rte_event_crypto_metadata* and set the + * reference pointer using this API which the PMD can retrieve using + * *rte_security_session_get_event_mdata* + * + * The API should be used only in case session is used for event crypto + * adapter. + * + * @param sess Session pointer allocated by + * *rte_security_session_create*. + * @param ev_mdata Pointer to the event crypto meta data + * (aka *union rte_event_crypto_metadata*) + */ +__rte_experimental +static inline void +rte_security_session_set_event_mdata(struct rte_security_session *sess, + void *ev_mdata) +{ + sess->event_mdata = ev_mdata; +} + /** * Attach a session to a crypto operation. * This API is needed only in case of RTE_SECURITY_SESS_CRYPTO_PROTO_OFFLOAD -- 2.25.1