[dpdk-dev,v3,2/7] crpyto/virtio: add crypto related session structure

Message ID 6d8b86abf79abf3bd72d02cadc0fc40fc8dd44c9.1521964379.git.jianjay.zhou@huawei.com (mailing list archive)
State Superseded, archived
Delegated to: Pablo de Lara Guarch
Headers

Checks

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

Commit Message

Zhoujian (jay) March 25, 2018, 8:33 a.m. UTC
  This structure will be used in the following patches, especially
at creating and destroying crypto sessions.

Signed-off-by: Jay Zhou <jianjay.zhou@huawei.com>
---
 drivers/crypto/virtio/virtio_crypto_algs.h | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)
 create mode 100644 drivers/crypto/virtio/virtio_crypto_algs.h
  

Comments

Fan Zhang March 26, 2018, 5:20 a.m. UTC | #1
> -----Original Message-----
> From: Jay Zhou [mailto:jianjay.zhou@huawei.com]
> Sent: Sunday, March 25, 2018 9:34 AM
> To: dev@dpdk.org
> Cc: De Lara Guarch, Pablo <pablo.de.lara.guarch@intel.com>; Zhang, Roy Fan
> <roy.fan.zhang@intel.com>; thomas@monjalon.net;
> arei.gonglei@huawei.com; Zeng, Xin <xin.zeng@intel.com>;
> weidong.huang@huawei.com; wangxinxin.wang@huawei.com;
> longpeng2@huawei.com; jianjay.zhou@huawei.com
> Subject: [PATCH v3 2/7] crpyto/virtio: add crypto related session structure
> 
> This structure will be used in the following patches, especially at creating and
> destroying crypto sessions.
> 
> Signed-off-by: Jay Zhou <jianjay.zhou@huawei.com>

Reviewed-by: Fan Zhang <roy.fan.zhang@intel.com>
Acked-by: Fan Zhang <roy.fan.zhang@intel.com>d
  
De Lara Guarch, Pablo March 29, 2018, 10:12 p.m. UTC | #2
> -----Original Message-----
> From: Jay Zhou [mailto:jianjay.zhou@huawei.com]
> Sent: Sunday, March 25, 2018 9:34 AM
> To: dev@dpdk.org
> Cc: De Lara Guarch, Pablo <pablo.de.lara.guarch@intel.com>; Zhang, Roy
> Fan <roy.fan.zhang@intel.com>; thomas@monjalon.net;
> arei.gonglei@huawei.com; Zeng, Xin <xin.zeng@intel.com>;
> weidong.huang@huawei.com; wangxinxin.wang@huawei.com;
> longpeng2@huawei.com; jianjay.zhou@huawei.com
> Subject: [PATCH v3 2/7] crpyto/virtio: add crypto related session structure

Typo in title.

> 
> This structure will be used in the following patches, especially at creating
> and destroying crypto sessions.
> 
> Signed-off-by: Jay Zhou <jianjay.zhou@huawei.com>
> ---
>  drivers/crypto/virtio/virtio_crypto_algs.h | 27
> +++++++++++++++++++++++++++
>  1 file changed, 27 insertions(+)
>  create mode 100644 drivers/crypto/virtio/virtio_crypto_algs.h
> 
> diff --git a/drivers/crypto/virtio/virtio_crypto_algs.h
> b/drivers/crypto/virtio/virtio_crypto_algs.h
> new file mode 100644
> index 0000000..5f1e9df
> --- /dev/null
> +++ b/drivers/crypto/virtio/virtio_crypto_algs.h
> @@ -0,0 +1,27 @@
> +/* SPDX-License-Identifier: BSD-3-Clause
> + * Copyright(c) 2018 HUAWEI TECHNOLOGIES CO., LTD.
> + */
> +
> +#ifndef _VIRTIO_CRYPTO_ALGS_H_
> +#define _VIRTIO_CRYPTO_ALGS_H_
> +
> +#include <rte_memory.h>
> +#include <linux/virtio_crypto.h>
> +
> +struct virtio_crypto_session {
> +	uint64_t session_id;

Probably a uint32_t here is enough.
  
Zhoujian (jay) March 30, 2018, 2:43 a.m. UTC | #3
> -----Original Message-----
> From: De Lara Guarch, Pablo [mailto:pablo.de.lara.guarch@intel.com]
> Sent: Friday, March 30, 2018 6:12 AM
> To: Zhoujian (jay) <jianjay.zhou@huawei.com>; dev@dpdk.org
> Cc: Zhang, Roy Fan <roy.fan.zhang@intel.com>; thomas@monjalon.net; Gonglei
> (Arei) <arei.gonglei@huawei.com>; Zeng, Xin <xin.zeng@intel.com>;
> Huangweidong (C) <weidong.huang@huawei.com>; wangxin (U)
> <wangxinxin.wang@huawei.com>; longpeng <longpeng2@huawei.com>
> Subject: RE: [PATCH v3 2/7] crpyto/virtio: add crypto related session
> structure
> 
> 
> 
> > -----Original Message-----
> > From: Jay Zhou [mailto:jianjay.zhou@huawei.com]
> > Sent: Sunday, March 25, 2018 9:34 AM
> > To: dev@dpdk.org
> > Cc: De Lara Guarch, Pablo <pablo.de.lara.guarch@intel.com>; Zhang, Roy
> > Fan <roy.fan.zhang@intel.com>; thomas@monjalon.net;
> > arei.gonglei@huawei.com; Zeng, Xin <xin.zeng@intel.com>;
> > weidong.huang@huawei.com; wangxinxin.wang@huawei.com;
> > longpeng2@huawei.com; jianjay.zhou@huawei.com
> > Subject: [PATCH v3 2/7] crpyto/virtio: add crypto related session
> > structure
> 
> Typo in title.

Will fix.

> 
> >
> > This structure will be used in the following patches, especially at
> > creating and destroying crypto sessions.
> >
> > Signed-off-by: Jay Zhou <jianjay.zhou@huawei.com>
> > ---
> >  drivers/crypto/virtio/virtio_crypto_algs.h | 27
> > +++++++++++++++++++++++++++
> >  1 file changed, 27 insertions(+)
> >  create mode 100644 drivers/crypto/virtio/virtio_crypto_algs.h
> >
> > diff --git a/drivers/crypto/virtio/virtio_crypto_algs.h
> > b/drivers/crypto/virtio/virtio_crypto_algs.h
> > new file mode 100644
> > index 0000000..5f1e9df
> > --- /dev/null
> > +++ b/drivers/crypto/virtio/virtio_crypto_algs.h
> > @@ -0,0 +1,27 @@
> > +/* SPDX-License-Identifier: BSD-3-Clause
> > + * Copyright(c) 2018 HUAWEI TECHNOLOGIES CO., LTD.
> > + */
> > +
> > +#ifndef _VIRTIO_CRYPTO_ALGS_H_
> > +#define _VIRTIO_CRYPTO_ALGS_H_
> > +
> > +#include <rte_memory.h>
> > +#include <linux/virtio_crypto.h>
> > +
> > +struct virtio_crypto_session {
> > +	uint64_t session_id;
> 
> Probably a uint32_t here is enough.

Consider the type of session_id in the struct virtio_crypto_op_header
of linux kernel and QEMU side is uint64_t, could we just keep it
as uint64_t for consistency?

Regards,
Jay
  
De Lara Guarch, Pablo March 30, 2018, 7:38 a.m. UTC | #4
> -----Original Message-----
> From: Zhoujian (jay) [mailto:jianjay.zhou@huawei.com]
> Sent: Friday, March 30, 2018 3:44 AM
> To: De Lara Guarch, Pablo <pablo.de.lara.guarch@intel.com>;
> dev@dpdk.org
> Cc: Zhang, Roy Fan <roy.fan.zhang@intel.com>; thomas@monjalon.net;
> Gonglei (Arei) <arei.gonglei@huawei.com>; Zeng, Xin
> <xin.zeng@intel.com>; Huangweidong (C) <weidong.huang@huawei.com>;
> wangxin (U) <wangxinxin.wang@huawei.com>; longpeng
> <longpeng2@huawei.com>
> Subject: RE: [PATCH v3 2/7] crpyto/virtio: add crypto related session
> structure
> 
> 
> 
> > -----Original Message-----
> > From: De Lara Guarch, Pablo [mailto:pablo.de.lara.guarch@intel.com]
> > Sent: Friday, March 30, 2018 6:12 AM
> > To: Zhoujian (jay) <jianjay.zhou@huawei.com>; dev@dpdk.org
> > Cc: Zhang, Roy Fan <roy.fan.zhang@intel.com>; thomas@monjalon.net;
> > Gonglei
> > (Arei) <arei.gonglei@huawei.com>; Zeng, Xin <xin.zeng@intel.com>;
> > Huangweidong (C) <weidong.huang@huawei.com>; wangxin (U)
> > <wangxinxin.wang@huawei.com>; longpeng <longpeng2@huawei.com>
> > Subject: RE: [PATCH v3 2/7] crpyto/virtio: add crypto related session
> > structure
> >
> >
> >
> > > -----Original Message-----
> > > From: Jay Zhou [mailto:jianjay.zhou@huawei.com]
> > > Sent: Sunday, March 25, 2018 9:34 AM
> > > To: dev@dpdk.org
> > > Cc: De Lara Guarch, Pablo <pablo.de.lara.guarch@intel.com>; Zhang,
> > > Roy Fan <roy.fan.zhang@intel.com>; thomas@monjalon.net;
> > > arei.gonglei@huawei.com; Zeng, Xin <xin.zeng@intel.com>;
> > > weidong.huang@huawei.com; wangxinxin.wang@huawei.com;
> > > longpeng2@huawei.com; jianjay.zhou@huawei.com
> > > Subject: [PATCH v3 2/7] crpyto/virtio: add crypto related session
> > > structure
> >
> > Typo in title.
> 
> Will fix.
> 
> >
> > >
> > > This structure will be used in the following patches, especially at
> > > creating and destroying crypto sessions.
> > >
> > > Signed-off-by: Jay Zhou <jianjay.zhou@huawei.com>
> > > ---
> > >  drivers/crypto/virtio/virtio_crypto_algs.h | 27
> > > +++++++++++++++++++++++++++
> > >  1 file changed, 27 insertions(+)
> > >  create mode 100644 drivers/crypto/virtio/virtio_crypto_algs.h
> > >
> > > diff --git a/drivers/crypto/virtio/virtio_crypto_algs.h
> > > b/drivers/crypto/virtio/virtio_crypto_algs.h
> > > new file mode 100644
> > > index 0000000..5f1e9df
> > > --- /dev/null
> > > +++ b/drivers/crypto/virtio/virtio_crypto_algs.h
> > > @@ -0,0 +1,27 @@
> > > +/* SPDX-License-Identifier: BSD-3-Clause
> > > + * Copyright(c) 2018 HUAWEI TECHNOLOGIES CO., LTD.
> > > + */
> > > +
> > > +#ifndef _VIRTIO_CRYPTO_ALGS_H_
> > > +#define _VIRTIO_CRYPTO_ALGS_H_
> > > +
> > > +#include <rte_memory.h>
> > > +#include <linux/virtio_crypto.h>
> > > +
> > > +struct virtio_crypto_session {
> > > +	uint64_t session_id;
> >
> > Probably a uint32_t here is enough.
> 
> Consider the type of session_id in the struct virtio_crypto_op_header of
> linux kernel and QEMU side is uint64_t, could we just keep it as uint64_t
> for consistency?

Fair enough.

Pablo

> 
> Regards,
> Jay
  

Patch

diff --git a/drivers/crypto/virtio/virtio_crypto_algs.h b/drivers/crypto/virtio/virtio_crypto_algs.h
new file mode 100644
index 0000000..5f1e9df
--- /dev/null
+++ b/drivers/crypto/virtio/virtio_crypto_algs.h
@@ -0,0 +1,27 @@ 
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2018 HUAWEI TECHNOLOGIES CO., LTD.
+ */
+
+#ifndef _VIRTIO_CRYPTO_ALGS_H_
+#define _VIRTIO_CRYPTO_ALGS_H_
+
+#include <rte_memory.h>
+#include <linux/virtio_crypto.h>
+
+struct virtio_crypto_session {
+	uint64_t session_id;
+
+	struct {
+		uint16_t offset;
+		uint16_t length;
+	} iv;
+
+	struct {
+		uint32_t length;
+		phys_addr_t phys_addr;
+	} aad;
+
+	struct virtio_crypto_op_ctrl_req ctrl;
+};
+
+#endif /* _VIRTIO_CRYPTO_ALGS_H_ */