All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Daniel P. Berrangé" <berrange@redhat.com>
To: zhenwei pi <pizhenwei@bytedance.com>
Cc: arei.gonglei@huawei.com, mst@redhat.com, dgilbert@redhat.com,
	eblake@redhat.com, armbru@redhat.com, michael.roth@amd.com,
	pbonzini@redhat.com, qemu-devel@nongnu.org
Subject: Re: [for-8.0 v2 03/11] cryptodev: Introduce cryptodev alg type in QAPI
Date: Mon, 16 Jan 2023 11:08:22 +0000	[thread overview]
Message-ID: <Y8UwJuHbchQLDnOJ@redhat.com> (raw)
In-Reply-To: <20221122140756.686982-4-pizhenwei@bytedance.com>

On Tue, Nov 22, 2022 at 10:07:48PM +0800, zhenwei pi wrote:
> Introduce cryptodev alg type in cryptodev.json, then apply this to
> related codes, and drop 'enum CryptoDevBackendAlgType'.
> 
> There are two options:
> 1, { 'enum': 'QCryptodevBackendAlgType',
>   'prefix': 'CRYPTODEV_BACKEND_ALG',
>   'data': ['sym', 'asym']}
> Then we can keep 'CRYPTODEV_BACKEND_ALG_SYM' and avoid lots of
> changes.
> 2, changes in this patch(with prefix 'QCRYPTODEV_BACKEND_ALG').
> 
> To avoid breaking the rule of QAPI, use 2 here.
> 
> Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
> ---
>  backends/cryptodev-builtin.c |  6 +++---
>  backends/cryptodev-lkcf.c    |  4 ++--
>  backends/cryptodev.c         |  6 +++---
>  hw/virtio/virtio-crypto.c    | 14 +++++++-------
>  include/sysemu/cryptodev.h   |  8 +-------
>  qapi/cryptodev.json          | 14 ++++++++++++++
>  6 files changed, 30 insertions(+), 22 deletions(-)


> diff --git a/backends/cryptodev-builtin.c b/backends/cryptodev-builtin.c
> index 08895271eb..5fb7b8f43f 100644
> --- a/backends/cryptodev-builtin.c
> +++ b/backends/cryptodev-builtin.c
> @@ -537,7 +537,7 @@ static int cryptodev_builtin_operation(
>      CryptoDevBackendBuiltinSession *sess;
>      CryptoDevBackendSymOpInfo *sym_op_info;
>      CryptoDevBackendAsymOpInfo *asym_op_info;
> -    enum CryptoDevBackendAlgType algtype = op_info->algtype;
> +    enum QCryptodevBackendAlgType algtype = op_info->algtype;

QAPI generates a typedef for every enum with the same name as
the enum itself. IOW, this should change to merely

   QCryptodevBackendAlgType algtype = op_info->algtype;


> diff --git a/backends/cryptodev-lkcf.c b/backends/cryptodev-lkcf.c
> index de3d1867c5..919bf05b75 100644
> --- a/backends/cryptodev-lkcf.c
> +++ b/backends/cryptodev-lkcf.c
> @@ -477,7 +477,7 @@ static int cryptodev_lkcf_operation(
>      CryptoDevBackendLKCF *lkcf =
>          CRYPTODEV_BACKEND_LKCF(backend);
>      CryptoDevBackendLKCFSession *sess;
> -    enum CryptoDevBackendAlgType algtype = op_info->algtype;
> +    enum QCryptodevBackendAlgType algtype = op_info->algtype;

As above


> diff --git a/backends/cryptodev.c b/backends/cryptodev.c
> index 81941af816..d3caded920 100644
> --- a/backends/cryptodev.c
> +++ b/backends/cryptodev.c
> @@ -120,10 +120,10 @@ int cryptodev_backend_crypto_operation(
>  {
>      VirtIOCryptoReq *req = opaque1;
>      CryptoDevBackendOpInfo *op_info = &req->op_info;
> -    enum CryptoDevBackendAlgType algtype = req->flags;
> +    enum QCryptodevBackendAlgType algtype = req->flags;

As above.


> diff --git a/include/sysemu/cryptodev.h b/include/sysemu/cryptodev.h
> index af152d09db..f68a4baf13 100644
> --- a/include/sysemu/cryptodev.h
> +++ b/include/sysemu/cryptodev.h
> @@ -49,12 +49,6 @@ typedef struct CryptoDevBackendPeers CryptoDevBackendPeers;
>  typedef struct CryptoDevBackendClient
>                       CryptoDevBackendClient;
>  
> -enum CryptoDevBackendAlgType {
> -    CRYPTODEV_BACKEND_ALG_SYM,
> -    CRYPTODEV_BACKEND_ALG_ASYM,
> -    CRYPTODEV_BACKEND_ALG__MAX,
> -};
> -
>  /**
>   * CryptoDevBackendSymSessionInfo:
>   *
> @@ -181,7 +175,7 @@ typedef struct CryptoDevBackendAsymOpInfo {
>  } CryptoDevBackendAsymOpInfo;
>  
>  typedef struct CryptoDevBackendOpInfo {
> -    enum CryptoDevBackendAlgType algtype;
> +    enum QCryptodevBackendAlgType algtype;

As above, drop the 'enum' qualifier

>      uint32_t op_code;
>      uint64_t session_id;
>      union {

With the redundant 'enum' qualifiers dropped, then you may add

  Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>


With regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|



  reply	other threads:[~2023-01-16 11:08 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-22 14:07 [for-8.0 v2 00/11] Refactor cryptodev zhenwei pi
2022-11-22 14:07 ` [for-8.0 v2 01/11] cryptodev: Introduce cryptodev.json zhenwei pi
2023-01-16 10:58   ` Daniel P. Berrangé
2022-11-22 14:07 ` [for-8.0 v2 02/11] cryptodev: Remove 'name' & 'model' fields zhenwei pi
2023-01-16 11:05   ` Daniel P. Berrangé
2022-11-22 14:07 ` [for-8.0 v2 03/11] cryptodev: Introduce cryptodev alg type in QAPI zhenwei pi
2023-01-16 11:08   ` Daniel P. Berrangé [this message]
2022-11-22 14:07 ` [for-8.0 v2 04/11] cryptodev: Introduce server " zhenwei pi
2023-01-16 11:09   ` Daniel P. Berrangé
2022-11-22 14:07 ` [for-8.0 v2 05/11] cryptodev: Introduce 'query-cryptodev' QMP command zhenwei pi
2023-01-16 11:18   ` Daniel P. Berrangé
2023-01-18 10:25     ` Michael S. Tsirkin
2023-01-18 10:29       ` Daniel P. Berrangé
2023-01-18 10:58         ` Thomas Huth
2023-01-18 11:01           ` Daniel P. Berrangé
2022-11-22 14:07 ` [for-8.0 v2 06/11] cryptodev: Support statistics zhenwei pi
2022-12-20 15:35   ` Michael S. Tsirkin
2023-01-16 11:22   ` Daniel P. Berrangé
2022-11-22 14:07 ` [for-8.0 v2 07/11] cryptodev-builtin: Detect akcipher capability zhenwei pi
2023-01-16 11:23   ` Daniel P. Berrangé
2022-11-22 14:07 ` [for-8.0 v2 08/11] hmp: add cryptodev info command zhenwei pi
2022-11-22 14:07 ` [for-8.0 v2 09/11] cryptodev: Use CryptoDevBackendOpInfo for operation zhenwei pi
2022-11-22 14:07 ` [for-8.0 v2 10/11] cryptodev: support QoS zhenwei pi
2022-11-22 14:07 ` [for-8.0 v2 11/11] MAINTAINERS: add myself as the maintainer for cryptodev zhenwei pi
2022-12-16  3:24 ` PING: [for-8.0 v2 00/11] Refactor cryptodev zhenwei pi
2022-12-20 15:36 ` Michael S. Tsirkin
2022-12-22  2:04   ` zhenwei pi
2023-01-03  6:14     ` PING: " zhenwei pi
2023-01-16  9:53   ` zhenwei pi
2023-01-16 11:27     ` Daniel P. Berrangé
2023-01-17  1:52       ` zhenwei pi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Y8UwJuHbchQLDnOJ@redhat.com \
    --to=berrange@redhat.com \
    --cc=arei.gonglei@huawei.com \
    --cc=armbru@redhat.com \
    --cc=dgilbert@redhat.com \
    --cc=eblake@redhat.com \
    --cc=michael.roth@amd.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=pizhenwei@bytedance.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.