[EXT] [PATCH v3 4/4] crypto: modify return value for asym session create
Power, Ciara
ciara.power at intel.com
Mon Feb 7 15:50:47 CET 2022
Hi Akhil,
Some replies inline.
Thanks,
Ciara
>-----Original Message-----
>From: Akhil Goyal <gakhil at marvell.com>
>Sent: Monday 7 February 2022 09:05
>To: Power, Ciara <ciara.power at intel.com>; dev at dpdk.org;
>thomas at monjalon.net
>Cc: Zhang, Roy Fan <roy.fan.zhang at intel.com>; Anoob Joseph
><anoobj at marvell.com>; mdr at ashroe.eu; Doherty, Declan
><declan.doherty at intel.com>
>Subject: RE: [EXT] [PATCH v3 4/4] crypto: modify return value for asym session
>create
>
>> diff --git a/doc/guides/prog_guide/cryptodev_lib.rst
>> b/doc/guides/prog_guide/cryptodev_lib.rst
>> index 62bd3577f5..8e16461dc6 100644
>> --- a/doc/guides/prog_guide/cryptodev_lib.rst
>> +++ b/doc/guides/prog_guide/cryptodev_lib.rst
>> @@ -1236,10 +1236,10 @@ crypto operations is similar except change to
>> respective op and xform setup).
>> * Create asym crypto session and initialize it for the crypto device.
>> * The session structure is hidden from the app, so void * is used.
>> */
>> - void *asym_session;
>> - asym_session =
>> rte_cryptodev_asym_session_create(asym_session_pool,
>> + void *asym_session = NULL;
>> + ret = rte_cryptodev_asym_session_create(&asym_session,
>> asym_session_pool,
>> cdev_id, &modex_xform);
>> - if (asym_session == NULL)
>> + if (ret < 0)
>> rte_exit(EXIT_FAILURE, "Session could not be created\n");
>
>Sample Code in the rst files is no more added. @Thomas: Could you please
>confirm?
>Probably a separate patch is required to clean this up.
>
[CP] I see Thomas replied on this - thanks. Will try find a section of example/test code that does the same thing as being shown here.
>> diff --git a/lib/cryptodev/rte_cryptodev.c
>> b/lib/cryptodev/rte_cryptodev.c index 0d816ed4a9..005f0e7952 100644
>> --- a/lib/cryptodev/rte_cryptodev.c
>> +++ b/lib/cryptodev/rte_cryptodev.c
>> @@ -1912,9 +1912,9 @@ rte_cryptodev_sym_session_create(struct
>> rte_mempool *mp)
>> return sess;
>> }
>>
>> -void *
>> -rte_cryptodev_asym_session_create(struct rte_mempool *mp, uint8_t
>> dev_id,
>> - struct rte_crypto_asym_xform *xforms)
>> +int
>> +rte_cryptodev_asym_session_create(void **session, struct rte_mempool
>> *mp,
>> + uint8_t dev_id, struct rte_crypto_asym_xform *xforms)
>
>Do you really need a double pointer for the session handle?
>
[CP] Yes I believe so, the return value used to be session, but now that we have an int return value, the session needs to be passed in as a parameter somehow.
We need the double pointer because we need the call to rte_mempool_get() to set the original session pointer that can be accessed outside of this function,
rather than just the local copy if it were a singular session pointer passed in as a parameter.
<snip>
More information about the dev
mailing list