[v3,16/16] cryptodev: check if symmetric sessions are supported
diff mbox series

Message ID 20180628005304.26544-17-pablo.de.lara.guarch@intel.com
State Superseded, archived
Delegated to: Pablo de Lara Guarch
Headers show
Series
  • Cryptodev API changes for 18.08
Related show

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Pablo de Lara June 28, 2018, 12:53 a.m. UTC
Since asymmetric functionality will be implemented soon,
not all PMDs must support symmetric sessions.
Therefore, a check is added if a device does not implement
the symmetric functions, meaning that the device does not
support symmetric operations.

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
---
 lib/librte_cryptodev/rte_cryptodev.c | 4 ++++
 lib/librte_cryptodev/rte_cryptodev.h | 4 +++-
 2 files changed, 7 insertions(+), 1 deletion(-)

Comments

Verma, Shally June 28, 2018, 1:40 p.m. UTC | #1
>-----Original Message-----
>From: Pablo de Lara [mailto:pablo.de.lara.guarch@intel.com]
>Sent: 28 June 2018 06:23
>To: declan.doherty@intel.com; akhil.goyal@nxp.com; Verma, Shally <Shally.Verma@cavium.com>; ravi1.kumar@amd.com; Jacob,
>Jerin <Jerin.JacobKollanukkaran@cavium.com>; roy.fan.zhang@intel.com; fiona.trahe@intel.com; tdu@semihalf.com;
>jianjay.zhou@huawei.com
>Cc: dev@dpdk.org; Pablo de Lara <pablo.de.lara.guarch@intel.com>
>Subject: [PATCH v3 16/16] cryptodev: check if symmetric sessions are supported
>
>External Email
>
>Since asymmetric functionality will be implemented soon,
>not all PMDs must support symmetric sessions.
>Therefore, a check is added if a device does not implement
>the symmetric functions, meaning that the device does not
>support symmetric operations.
>
>Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
>---
> lib/librte_cryptodev/rte_cryptodev.c | 4 ++++
> lib/librte_cryptodev/rte_cryptodev.h | 4 +++-
> 2 files changed, 7 insertions(+), 1 deletion(-)
>
>diff --git a/lib/librte_cryptodev/rte_cryptodev.c b/lib/librte_cryptodev/rte_cryptodev.c
>index 7af527075..58fb21056 100644
>--- a/lib/librte_cryptodev/rte_cryptodev.c
>+++ b/lib/librte_cryptodev/rte_cryptodev.c
>@@ -1063,6 +1063,8 @@ rte_cryptodev_sym_session_init(uint8_t dev_id,
>
>        index = dev->driver_id;
>
>+       RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->sym_session_configure, -ENOTSUP);
>+
>        if (sess->sess_private_data[index] == NULL) {
>                ret = dev->dev_ops->sym_session_configure(dev, xforms,
>                                                        sess, mp);
>@@ -1107,6 +1109,8 @@ rte_cryptodev_sym_session_clear(uint8_t dev_id,
>        if (dev == NULL || sess == NULL)
>                return -EINVAL;
>
>+       RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->sym_session_clear, -ENOTSUP);
>+
>        dev->dev_ops->sym_session_clear(dev, sess);
>
>        return 0;
>diff --git a/lib/librte_cryptodev/rte_cryptodev.h b/lib/librte_cryptodev/rte_cryptodev.h
>index 32a210b00..c1066d01e 100644
>--- a/lib/librte_cryptodev/rte_cryptodev.h
>+++ b/lib/librte_cryptodev/rte_cryptodev.h
>@@ -896,7 +896,8 @@ rte_cryptodev_sym_session_free(struct rte_cryptodev_sym_session *sess);
>  * @return
>  *  - On success, zero.
>  *  - -EINVAL if input parameters are invalid.
>- *  - -ENOTSUP if crypto device does not support the crypto transform.
>+ *  - -ENOTSUP if crypto device does not support the crypto transform or
>+ *    does not support symmetric operations.

Acked with just one comment here Isn't it sufficient to say if device does not support symmetric?


>  *  - -ENOMEM if the private session could not be allocated.
>  */
> int
>@@ -917,6 +918,7 @@ rte_cryptodev_sym_session_init(uint8_t dev_id,
>  * @return
>  *  - 0 if successful.
>  *  - -EINVAL if device is invalid or session is NULL.
>+ *  - -ENOTSUP if crypto device does not support symmetric operations.
>  */
> int
> rte_cryptodev_sym_session_clear(uint8_t dev_id,
>--
>2.14.4
Pablo de Lara June 28, 2018, 2:15 p.m. UTC | #2
Hi Shally,

> -----Original Message-----
> From: Verma, Shally [mailto:Shally.Verma@cavium.com]
> Sent: Thursday, June 28, 2018 2:40 PM
> To: De Lara Guarch, Pablo <pablo.de.lara.guarch@intel.com>; Doherty, Declan
> <declan.doherty@intel.com>; akhil.goyal@nxp.com; ravi1.kumar@amd.com;
> Jacob, Jerin <Jerin.JacobKollanukkaran@cavium.com>; Zhang, Roy Fan
> <roy.fan.zhang@intel.com>; Trahe, Fiona <fiona.trahe@intel.com>;
> tdu@semihalf.com; jianjay.zhou@huawei.com
> Cc: dev@dpdk.org
> Subject: RE: [PATCH v3 16/16] cryptodev: check if symmetric sessions are
> supported
> 
> 
> 
> >-----Original Message-----
> >From: Pablo de Lara [mailto:pablo.de.lara.guarch@intel.com]
> >Sent: 28 June 2018 06:23
> >To: declan.doherty@intel.com; akhil.goyal@nxp.com; Verma, Shally
> ><Shally.Verma@cavium.com>; ravi1.kumar@amd.com; Jacob, Jerin
> ><Jerin.JacobKollanukkaran@cavium.com>; roy.fan.zhang@intel.com;
> >fiona.trahe@intel.com; tdu@semihalf.com; jianjay.zhou@huawei.com
> >Cc: dev@dpdk.org; Pablo de Lara <pablo.de.lara.guarch@intel.com>
> >Subject: [PATCH v3 16/16] cryptodev: check if symmetric sessions are
> >supported
> >
> >External Email
> >
> >Since asymmetric functionality will be implemented soon, not all PMDs
> >must support symmetric sessions.
> >Therefore, a check is added if a device does not implement the
> >symmetric functions, meaning that the device does not support symmetric
> >operations.
> >
> >Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
> >---
> > lib/librte_cryptodev/rte_cryptodev.c | 4 ++++
> >lib/librte_cryptodev/rte_cryptodev.h | 4 +++-
> > 2 files changed, 7 insertions(+), 1 deletion(-)
> >
> >diff --git a/lib/librte_cryptodev/rte_cryptodev.c
> >b/lib/librte_cryptodev/rte_cryptodev.c
> >index 7af527075..58fb21056 100644
> >--- a/lib/librte_cryptodev/rte_cryptodev.c
> >+++ b/lib/librte_cryptodev/rte_cryptodev.c
> >@@ -1063,6 +1063,8 @@ rte_cryptodev_sym_session_init(uint8_t dev_id,
> >
> >        index = dev->driver_id;
> >
> >+       RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->sym_session_configure,
> >+ -ENOTSUP);
> >+
> >        if (sess->sess_private_data[index] == NULL) {
> >                ret = dev->dev_ops->sym_session_configure(dev, xforms,
> >                                                        sess, mp); @@
> >-1107,6 +1109,8 @@ rte_cryptodev_sym_session_clear(uint8_t dev_id,
> >        if (dev == NULL || sess == NULL)
> >                return -EINVAL;
> >
> >+       RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->sym_session_clear,
> >+ -ENOTSUP);
> >+
> >        dev->dev_ops->sym_session_clear(dev, sess);
> >
> >        return 0;
> >diff --git a/lib/librte_cryptodev/rte_cryptodev.h
> >b/lib/librte_cryptodev/rte_cryptodev.h
> >index 32a210b00..c1066d01e 100644
> >--- a/lib/librte_cryptodev/rte_cryptodev.h
> >+++ b/lib/librte_cryptodev/rte_cryptodev.h
> >@@ -896,7 +896,8 @@ rte_cryptodev_sym_session_free(struct
> >rte_cryptodev_sym_session *sess);
> >  * @return
> >  *  - On success, zero.
> >  *  - -EINVAL if input parameters are invalid.
> >- *  - -ENOTSUP if crypto device does not support the crypto transform.
> >+ *  - -ENOTSUP if crypto device does not support the crypto transform or
> >+ *    does not support symmetric operations.
> 
> Acked with just one comment here Isn't it sufficient to say if device does not
> support symmetric?

No, because the device could not support a specific algorithm or other parameters,
such as key size, IV size, etc.
Akhil Goyal July 4, 2018, 12:27 p.m. UTC | #3
On 6/28/2018 6:23 AM, Pablo de Lara wrote:
> Since asymmetric functionality will be implemented soon,
> not all PMDs must support symmetric sessions.
> Therefore, a check is added if a device does not implement
> the symmetric functions, meaning that the device does not
> support symmetric operations.
>
> Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
> ---
>
Acked-by: Akhil Goyal <akhil.goyal@nxp.com>

Patch
diff mbox series

diff --git a/lib/librte_cryptodev/rte_cryptodev.c b/lib/librte_cryptodev/rte_cryptodev.c
index 7af527075..58fb21056 100644
--- a/lib/librte_cryptodev/rte_cryptodev.c
+++ b/lib/librte_cryptodev/rte_cryptodev.c
@@ -1063,6 +1063,8 @@  rte_cryptodev_sym_session_init(uint8_t dev_id,
 
 	index = dev->driver_id;
 
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->sym_session_configure, -ENOTSUP);
+
 	if (sess->sess_private_data[index] == NULL) {
 		ret = dev->dev_ops->sym_session_configure(dev, xforms,
 							sess, mp);
@@ -1107,6 +1109,8 @@  rte_cryptodev_sym_session_clear(uint8_t dev_id,
 	if (dev == NULL || sess == NULL)
 		return -EINVAL;
 
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->sym_session_clear, -ENOTSUP);
+
 	dev->dev_ops->sym_session_clear(dev, sess);
 
 	return 0;
diff --git a/lib/librte_cryptodev/rte_cryptodev.h b/lib/librte_cryptodev/rte_cryptodev.h
index 32a210b00..c1066d01e 100644
--- a/lib/librte_cryptodev/rte_cryptodev.h
+++ b/lib/librte_cryptodev/rte_cryptodev.h
@@ -896,7 +896,8 @@  rte_cryptodev_sym_session_free(struct rte_cryptodev_sym_session *sess);
  * @return
  *  - On success, zero.
  *  - -EINVAL if input parameters are invalid.
- *  - -ENOTSUP if crypto device does not support the crypto transform.
+ *  - -ENOTSUP if crypto device does not support the crypto transform or
+ *    does not support symmetric operations.
  *  - -ENOMEM if the private session could not be allocated.
  */
 int
@@ -917,6 +918,7 @@  rte_cryptodev_sym_session_init(uint8_t dev_id,
  * @return
  *  - 0 if successful.
  *  - -EINVAL if device is invalid or session is NULL.
+ *  - -ENOTSUP if crypto device does not support symmetric operations.
  */
 int
 rte_cryptodev_sym_session_clear(uint8_t dev_id,