From mboxrd@z Thu Jan 1 00:00:00 1970 From: Akhil Goyal Subject: Re: [PATCH 1/2] lib/cryptodev: add support to set session private data Date: Tue, 16 Jan 2018 12:56:21 +0530 Message-ID: References: <1516017078-166766-1-git-send-email-abhinandan.gujjar@intel.com> <5612CB344B05EE4F95FC5B729939F780705FED56@PGSMSX102.gar.corp.intel.com> <5612CB344B05EE4F95FC5B729939F780705FEDDD@PGSMSX102.gar.corp.intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit Cc: "dev@dpdk.org" , "Vangati, Narender" , "Rao, Nikhil" To: "Gujjar, Abhinandan S" , "Doherty, Declan" , "Jacob, Jerin" Return-path: Received: from NAM02-CY1-obe.outbound.protection.outlook.com (mail-cys01nam02on0060.outbound.protection.outlook.com [104.47.37.60]) by dpdk.org (Postfix) with ESMTP id 9CD1A2C2E for ; Tue, 16 Jan 2018 08:26:27 +0100 (CET) In-Reply-To: <5612CB344B05EE4F95FC5B729939F780705FEDDD@PGSMSX102.gar.corp.intel.com> Content-Language: en-US List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Hi Abhinandan, On 1/16/2018 12:35 PM, Gujjar, Abhinandan S wrote: > Hi Akhil, > >> -----Original Message----- >> From: Akhil Goyal [mailto:akhil.goyal@nxp.com] >> Sent: Tuesday, January 16, 2018 11:55 AM >> To: Gujjar, Abhinandan S ; Doherty, Declan >> >> Cc: dev@dpdk.org; Vangati, Narender ; Rao, >> Nikhil >> Subject: Re: [PATCH 1/2] lib/cryptodev: add support to set session private data >> >> Hi Abhinandan, >> On 1/16/2018 11:39 AM, Gujjar, Abhinandan S wrote: >>>>> diff --git a/lib/librte_cryptodev/rte_crypto.h >>>>> b/lib/librte_cryptodev/rte_crypto.h >>>>> index bbc510d..3a98cbf 100644 >>>>> --- a/lib/librte_cryptodev/rte_crypto.h >>>>> +++ b/lib/librte_cryptodev/rte_crypto.h >>>>> @@ -62,6 +62,18 @@ enum rte_crypto_op_sess_type { >>>>> RTE_CRYPTO_OP_SECURITY_SESSION /**< Security session crypto >>>> operation */ >>>>> }; >>>>> >>>>> +/** Private data types for cryptographic operation >>>>> + * @see rte_crypto_op::private_data_type */ enum >>>>> +rte_crypto_op_private_data_type { >>>>> + RTE_CRYPTO_OP_PRIVATE_DATA_NONE, >>>>> + /**< No private data */ >>>>> + RTE_CRYPTO_OP_PRIVATE_DATA_OP, >>>>> + /**< Private data is part of rte_crypto_op and indicated by >>>>> + * private_data_offset */ >>>>> + RTE_CRYPTO_OP_PRIVATE_DATA_SESSION >>>>> + /**< Private data is available at session */ }; >>>>> + >>>> We may get away with this enum. If private_data_offset is "0", then >>>> we can check with the session if it has priv data or not. >>> Right now, Application uses 'rte_crypto_op_private_data_type' to >>> indicate rte_cryptodev_sym_session_set_private_data() >>> was called to set the private data. Otherwise, how do you indicate there is a >> private data associated with the session? >>> Any suggestions? >> For session based flows, the first choice to store the private data should be in >> the session. So RTE_CRYPTO_OP_WITH_SESSION or >> RTE_CRYPTO_OP_SECURITY_SESSION can be used to call >> rte_cryptodev_sym_session_set_private_data or >> rte_security_session_set_private_data. > Case 1: private_data_offset is "0" and sess_type = RTE_CRYPTO_OP_WITH_SESSION -> usual case > Case 2: private_data_offset is "0" and sess_type = RTE_CRYPTO_OP_WITH_SESSION + event case (access private data) > Differentiating between case 1 & 2 will be done by checking > rte_crypto_op_private_data_type == RTE_CRYPTO_OP_PRIVATE_DATA_SESSION. Consider this: if (sess_type == RTE_CRYPTO_OP_WITH_SESSION && rte_cryptodev_sym_session_get_private_data == NULL) usual case. else if (sess_type = RTE_CRYPTO_OP_WITH_SESSION && rte_cryptodev_sym_session_get_private_data != NULL) event case. else if (sess_type == RTE_CRYPTO_OP_SESSIONLESS && private_data_offset != 0) event case for sessionless op. I hope all cases can be handled in this way. -Akhil