mbox series

[v3,00/12] Refactor cryptodev

Message ID 20230128035633.2548315-1-pizhenwei@bytedance.com
Headers show
Series Refactor cryptodev | expand

Message

zhenwei pi Jan. 28, 2023, 3:56 a.m. UTC
v3 -> v4:
- a small change in '0005-cryptodev-Introduce-query-cryptodev-QMP-command.patch':
  use 'uint32' instead of 'int' to describe CryptodevBackendClient:queue
- fix compling warning(gcc)/error(clang-11) on 32 bit platform in
  '0007-hmp-add-cryptodev-info-command.patch':
  use 'printf("%u", client->queue)' instead of 'printf("%ld", client->queue)'

v2 -> v3:
- rebase code against the lastest commist: fb7e7990342e59cf67d
- document the missing fields in qapi/cryptodev.json
- rework statistics part: use 'query-stats' command instead of
  'query-cryptodev'(cryptodev: Support query-stats QMP command)

v1 -> v2:
- fix coding style and use 'g_strjoin()' instead of 'char services[128]'
   (suggested by Dr. David Alan Gilbert)
- wrapper function 'cryptodev_backend_account' to record statistics, and
   allocate sym_stat/asym_stat in cryptodev base class. see patch:
   'cryptodev: Support statistics'.
- add more arguments into struct CryptoDevBackendOpInfo, then
   cryptodev_backend_crypto_operation() uses *op_info only.
- support cryptodev QoS settings(BPS&OPS), both QEMU command line and QMP
   command works fine.
- add myself as the maintainer for cryptodev.

v1:
- introduce cryptodev.json to describe the attributes of crypto device, then
   drop duplicated type declare, remove some virtio related dependence.
- add statistics: OPS and bandwidth.
- add QMP command: query-cryptodev
- add HMP info command: cryptodev
- misc fix: detect akcipher capability instead of exposing akcipher service
   unconditionally.

Zhenwei Pi (12):
  cryptodev: Introduce cryptodev.json
  cryptodev: Remove 'name' & 'model' fields
  cryptodev: Introduce cryptodev alg type in QAPI
  cryptodev: Introduce server type in QAPI
  cryptodev: Introduce 'query-cryptodev' QMP command
  cryptodev-builtin: Detect akcipher capability
  hmp: add cryptodev info command
  cryptodev: Use CryptoDevBackendOpInfo for operation
  cryptodev: Account statistics
  cryptodev: support QoS
  cryptodev: Support query-stats QMP command
  MAINTAINERS: add myself as the maintainer for cryptodev

 MAINTAINERS                     |   2 +
 backends/cryptodev-builtin.c    |  42 ++--
 backends/cryptodev-lkcf.c       |  19 +-
 backends/cryptodev-vhost-user.c |  13 +-
 backends/cryptodev-vhost.c      |   4 +-
 backends/cryptodev.c            | 419 ++++++++++++++++++++++++++++++--
 hmp-commands-info.hx            |  14 ++
 hw/virtio/virtio-crypto.c       |  48 +++-
 include/monitor/hmp.h           |   1 +
 include/sysemu/cryptodev.h      |  95 ++++----
 monitor/hmp-cmds.c              |  41 ++++
 monitor/qmp-cmds.c              |   2 +
 qapi/cryptodev.json             | 143 +++++++++++
 qapi/meson.build                |   1 +
 qapi/qapi-schema.json           |   1 +
 qapi/qom.json                   |   8 +-
 qapi/stats.json                 |  10 +-
 17 files changed, 743 insertions(+), 120 deletions(-)
 create mode 100644 qapi/cryptodev.json

Comments

Michael S. Tsirkin Jan. 28, 2023, 11:30 a.m. UTC | #1
On Sat, Jan 28, 2023 at 11:56:21AM +0800, zhenwei pi wrote:
> v3 -> v4:
> - a small change in '0005-cryptodev-Introduce-query-cryptodev-QMP-command.patch':
>   use 'uint32' instead of 'int' to describe CryptodevBackendClient:queue

what was the motivation for this change? we generally just use int
unless width is important.

> - fix compling warning(gcc)/error(clang-11) on 32 bit platform in
>   '0007-hmp-add-cryptodev-info-command.patch':
>   use 'printf("%u", client->queue)' instead of 'printf("%ld", client->queue)'
> 

Are you aware of PRIu64? And if you are going to print uint32 use PRIu32

> v2 -> v3:
> - rebase code against the lastest commist: fb7e7990342e59cf67d
> - document the missing fields in qapi/cryptodev.json
> - rework statistics part: use 'query-stats' command instead of
>   'query-cryptodev'(cryptodev: Support query-stats QMP command)
> 
> v1 -> v2:
> - fix coding style and use 'g_strjoin()' instead of 'char services[128]'
>    (suggested by Dr. David Alan Gilbert)
> - wrapper function 'cryptodev_backend_account' to record statistics, and
>    allocate sym_stat/asym_stat in cryptodev base class. see patch:
>    'cryptodev: Support statistics'.
> - add more arguments into struct CryptoDevBackendOpInfo, then
>    cryptodev_backend_crypto_operation() uses *op_info only.
> - support cryptodev QoS settings(BPS&OPS), both QEMU command line and QMP
>    command works fine.
> - add myself as the maintainer for cryptodev.
> 
> v1:
> - introduce cryptodev.json to describe the attributes of crypto device, then
>    drop duplicated type declare, remove some virtio related dependence.
> - add statistics: OPS and bandwidth.
> - add QMP command: query-cryptodev
> - add HMP info command: cryptodev
> - misc fix: detect akcipher capability instead of exposing akcipher service
>    unconditionally.
> 
> Zhenwei Pi (12):
>   cryptodev: Introduce cryptodev.json
>   cryptodev: Remove 'name' & 'model' fields
>   cryptodev: Introduce cryptodev alg type in QAPI
>   cryptodev: Introduce server type in QAPI
>   cryptodev: Introduce 'query-cryptodev' QMP command
>   cryptodev-builtin: Detect akcipher capability
>   hmp: add cryptodev info command
>   cryptodev: Use CryptoDevBackendOpInfo for operation
>   cryptodev: Account statistics
>   cryptodev: support QoS
>   cryptodev: Support query-stats QMP command
>   MAINTAINERS: add myself as the maintainer for cryptodev
> 
>  MAINTAINERS                     |   2 +
>  backends/cryptodev-builtin.c    |  42 ++--
>  backends/cryptodev-lkcf.c       |  19 +-
>  backends/cryptodev-vhost-user.c |  13 +-
>  backends/cryptodev-vhost.c      |   4 +-
>  backends/cryptodev.c            | 419 ++++++++++++++++++++++++++++++--
>  hmp-commands-info.hx            |  14 ++
>  hw/virtio/virtio-crypto.c       |  48 +++-
>  include/monitor/hmp.h           |   1 +
>  include/sysemu/cryptodev.h      |  95 ++++----
>  monitor/hmp-cmds.c              |  41 ++++
>  monitor/qmp-cmds.c              |   2 +
>  qapi/cryptodev.json             | 143 +++++++++++
>  qapi/meson.build                |   1 +
>  qapi/qapi-schema.json           |   1 +
>  qapi/qom.json                   |   8 +-
>  qapi/stats.json                 |  10 +-
>  17 files changed, 743 insertions(+), 120 deletions(-)
>  create mode 100644 qapi/cryptodev.json
> 
> -- 
> 2.34.1
zhenwei pi Jan. 28, 2023, 12:45 p.m. UTC | #2
On 1/28/23 19:30, Michael S. Tsirkin wrote:
> On Sat, Jan 28, 2023 at 11:56:21AM +0800, zhenwei pi wrote:
>> v3 -> v4:
>> - a small change in '0005-cryptodev-Introduce-query-cryptodev-QMP-command.patch':
>>    use 'uint32' instead of 'int' to describe CryptodevBackendClient:queue
> 
> what was the motivation for this change? we generally just use int
> unless width is important.
> 
Because we use uint32_t to describe the queues of a cryptodev:
struct CryptoDevBackendPeers {
     CryptoDevBackendClient *ccs[MAX_CRYPTO_QUEUE_NUM];
     uint32_t queues;
};

By the way, I also notice that 'int' and 'uint32_t' in several places, I 
think I need a followup patch to fix this(use 'uint32_t' only for queue 
index).

>> - fix compling warning(gcc)/error(clang-11) on 32 bit platform in
>>    '0007-hmp-add-cryptodev-info-command.patch':
>>    use 'printf("%u", client->queue)' instead of 'printf("%ld", client->queue)'
>>
> 
> Are you aware of PRIu64? And if you are going to print uint32 use PRIu32
> 
OK, I'll fix this in the next version.

>> v2 -> v3:
>> - rebase code against the lastest commist: fb7e7990342e59cf67d
>> - document the missing fields in qapi/cryptodev.json
>> - rework statistics part: use 'query-stats' command instead of
>>    'query-cryptodev'(cryptodev: Support query-stats QMP command)
>>
>> v1 -> v2:
>> - fix coding style and use 'g_strjoin()' instead of 'char services[128]'
>>     (suggested by Dr. David Alan Gilbert)
>> - wrapper function 'cryptodev_backend_account' to record statistics, and
>>     allocate sym_stat/asym_stat in cryptodev base class. see patch:
>>     'cryptodev: Support statistics'.
>> - add more arguments into struct CryptoDevBackendOpInfo, then
>>     cryptodev_backend_crypto_operation() uses *op_info only.
>> - support cryptodev QoS settings(BPS&OPS), both QEMU command line and QMP
>>     command works fine.
>> - add myself as the maintainer for cryptodev.
>>
>> v1:
>> - introduce cryptodev.json to describe the attributes of crypto device, then
>>     drop duplicated type declare, remove some virtio related dependence.
>> - add statistics: OPS and bandwidth.
>> - add QMP command: query-cryptodev
>> - add HMP info command: cryptodev
>> - misc fix: detect akcipher capability instead of exposing akcipher service
>>     unconditionally.
>>
>> Zhenwei Pi (12):
>>    cryptodev: Introduce cryptodev.json
>>    cryptodev: Remove 'name' & 'model' fields
>>    cryptodev: Introduce cryptodev alg type in QAPI
>>    cryptodev: Introduce server type in QAPI
>>    cryptodev: Introduce 'query-cryptodev' QMP command
>>    cryptodev-builtin: Detect akcipher capability
>>    hmp: add cryptodev info command
>>    cryptodev: Use CryptoDevBackendOpInfo for operation
>>    cryptodev: Account statistics
>>    cryptodev: support QoS
>>    cryptodev: Support query-stats QMP command
>>    MAINTAINERS: add myself as the maintainer for cryptodev
>>
>>   MAINTAINERS                     |   2 +
>>   backends/cryptodev-builtin.c    |  42 ++--
>>   backends/cryptodev-lkcf.c       |  19 +-
>>   backends/cryptodev-vhost-user.c |  13 +-
>>   backends/cryptodev-vhost.c      |   4 +-
>>   backends/cryptodev.c            | 419 ++++++++++++++++++++++++++++++--
>>   hmp-commands-info.hx            |  14 ++
>>   hw/virtio/virtio-crypto.c       |  48 +++-
>>   include/monitor/hmp.h           |   1 +
>>   include/sysemu/cryptodev.h      |  95 ++++----
>>   monitor/hmp-cmds.c              |  41 ++++
>>   monitor/qmp-cmds.c              |   2 +
>>   qapi/cryptodev.json             | 143 +++++++++++
>>   qapi/meson.build                |   1 +
>>   qapi/qapi-schema.json           |   1 +
>>   qapi/qom.json                   |   8 +-
>>   qapi/stats.json                 |  10 +-
>>   17 files changed, 743 insertions(+), 120 deletions(-)
>>   create mode 100644 qapi/cryptodev.json
>>
>> -- 
>> 2.34.1
>