From: "Michael S. Tsirkin" <mst@redhat.com>
To: "Zhoujian (jay)" <jianjay.zhou@huawei.com>
Cc: "qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
"pbonzini@redhat.com" <pbonzini@redhat.com>,
"Huangweidong (C)" <weidong.huang@huawei.com>,
"stefanha@redhat.com" <stefanha@redhat.com>,
"pasic@linux.vnet.ibm.com" <pasic@linux.vnet.ibm.com>,
longpeng <longpeng2@huawei.com>,
"xin.zeng@intel.com" <xin.zeng@intel.com>,
"roy.fan.zhang@intel.com" <roy.fan.zhang@intel.com>,
"Gonglei (Arei)" <arei.gonglei@huawei.com>
Subject: Re: [Qemu-devel] [PATCH v3 0/4] cryptodev: add vhost support
Date: Tue, 16 Jan 2018 18:38:27 +0200 [thread overview]
Message-ID: <20180116183754-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <B2D15215269B544CADD246097EACE7473AB46F25@DGGEMM505-MBS.china.huawei.com>
On Tue, Jan 16, 2018 at 02:21:32PM +0000, Zhoujian (jay) wrote:
> VHOST_USER_CREATE_CRYPTO_SESSION and VHOST_USER_CLOSE_CRYPTO_SESSION are new
> added messages, they should be sent only when
> VHOST_USER_PROTOCOL_F_CRYPTO_SESSION feature has been successfully negotiated.
>
> The differs between v2 and v3 are listed below, pls review, thanks!
>
> ---
> diff --git a/docs/interop/vhost-user.txt b/docs/interop/vhost-user.txt
> index f43c63d..3aec685 100644
> --- a/docs/interop/vhost-user.txt
> +++ b/docs/interop/vhost-user.txt
> @@ -327,6 +327,7 @@ Protocol features
> #define VHOST_USER_PROTOCOL_F_MTU 4
> #define VHOST_USER_PROTOCOL_F_SLAVE_REQ 5
> #define VHOST_USER_PROTOCOL_F_CROSS_ENDIAN 6
> +#define VHOST_USER_PROTOCOL_F_CRYPTO_SESSION 7
>
> Master message types
> --------------------
> @@ -605,6 +606,9 @@ Master message types
>
> Create a session for crypto operation. The server side must return the
> session id, 0 or positive for success, negative for failure.
> + This request should be sent only when VHOST_USER_PROTOCOL_F_CRYPTO_SESSION
> + feature has been successfully negotiated.
> + It's a required feature for crypto devices.
>
> * VHOST_USER_CLOSE_CRYPTO_SESSION
>
> @@ -614,6 +618,9 @@ Master message types
>
> Close a session for crypto operation which was previously
> created by VHOST_USER_CREATE_CRYPTO_SESSION.
> + This request should be sent only when VHOST_USER_PROTOCOL_F_CRYPTO_SESSION
> + feature has been successfully negotiated.
> + It's a required feature for crypto devices.
>
> Slave message types
> -------------------
> diff --git a/hw/virtio/vhost-user.c b/hw/virtio/vhost-user.c
> index 7865c6d..f779512 100644
> --- a/hw/virtio/vhost-user.c
> +++ b/hw/virtio/vhost-user.c
> @@ -35,6 +35,7 @@ enum VhostUserProtocolFeature {
> VHOST_USER_PROTOCOL_F_NET_MTU = 4,
> VHOST_USER_PROTOCOL_F_SLAVE_REQ = 5,
> VHOST_USER_PROTOCOL_F_CROSS_ENDIAN = 6,
> + VHOST_USER_PROTOCOL_F_CRYPTO_SESSION = 7,
>
> VHOST_USER_PROTOCOL_F_MAX
> };
> @@ -941,6 +942,8 @@ static int vhost_user_crypto_create_session(struct vhost_dev *dev,
> void *session_info,
> uint64_t *session_id)
> {
> + bool crypto_session = virtio_has_feature(dev->protocol_features,
> + VHOST_USER_PROTOCOL_F_CRYPTO_SESSION);
> CryptoDevBackendSymSessionInfo *sess_info = session_info;
> VhostUserMsg msg = {
> .request = VHOST_USER_CREATE_CRYPTO_SESSION,
> @@ -950,6 +953,11 @@ static int vhost_user_crypto_create_session(struct vhost_dev *dev,
>
> assert(dev->vhost_ops->backend_type == VHOST_BACKEND_TYPE_USER);
>
> + if (!crypto_session) {
> + error_report("vhost-user trying to send unhandled ioctl");
> + return -1;
> + }
> +
> memcpy(&msg.payload.session.session_setup_data, sess_info,
> sizeof(CryptoDevBackendSymSessionInfo));
> if (sess_info->key_len) {
> @@ -994,6 +1002,8 @@ static int vhost_user_crypto_create_session(struct vhost_dev *dev,
> static int
> vhost_user_crypto_close_session(struct vhost_dev *dev, uint64_t session_id)
> {
> + bool crypto_session = virtio_has_feature(dev->protocol_features,
> + VHOST_USER_PROTOCOL_F_CRYPTO_SESSION);
> VhostUserMsg msg = {
> .request = VHOST_USER_CLOSE_CRYPTO_SESSION,
> .flags = VHOST_USER_VERSION,
> @@ -1001,6 +1011,11 @@ vhost_user_crypto_close_session(struct vhost_dev *dev, uint64_t session_id)
> };
> msg.payload.u64 = session_id;
>
> + if (!crypto_session) {
> + error_report("vhost-user trying to send unhandled ioctl");
> + return -1;
> + }
> +
> if (vhost_user_write(dev, &msg, NULL, 0) < 0) {
> error_report("vhost_user_write() return -1, close session failed");
> return -1;
>
Documentation and error messages could be improved, but I think this
is reasonable enough to put upstream and improve on top.
> > -----Original Message-----
> > From: Zhoujian (jay)
> > Sent: Tuesday, January 16, 2018 10:07 PM
> > To: qemu-devel@nongnu.org
> > Cc: mst@redhat.com; pbonzini@redhat.com; Huangweidong (C)
> > <weidong.huang@huawei.com>; stefanha@redhat.com; Zhoujian (jay)
> > <jianjay.zhou@huawei.com>; pasic@linux.vnet.ibm.com; longpeng
> > <longpeng2@huawei.com>; xin.zeng@intel.com; roy.fan.zhang@intel.com; Gonglei
> > (Arei) <arei.gonglei@huawei.com>
> > Subject: [PATCH v3 0/4] cryptodev: add vhost support
> >
> > From: Gonglei <arei.gonglei@huawei.com>
> >
> > I posted the RFC verion a few months ago for DPDK vhost-crypto implmention,
> > and now it's time to send the formal version. Because we need an user space
> > scheme for better performance.
> >
> > The vhost user crypto server side patches had been sent to DPDK community,
> > pls see
> >
> > [RFC PATCH 0/6] lib/librte_vhost: introduce new vhost_user crypto backend
> > support http://dpdk.org/ml/archives/dev/2017-November/081048.html
> >
> > You also can get virtio-crypto polling mode driver from:
> >
> > [PATCH] virtio: add new driver for crypto devices
> > http://dpdk.org/ml/archives/dev/2017-November/081985.html
> >
> > Gonglei (4):
> > cryptodev: add vhost-user as a new cryptodev backend
> > cryptodev: add vhost support
> > cryptodev-vhost-user: add crypto session handler
> > cryptodev-vhost-user: set the key length
> >
> > backends/Makefile.objs | 4 +
> > backends/cryptodev-builtin.c | 1 +
> > backends/cryptodev-vhost-user.c | 381
> > ++++++++++++++++++++++++++++++++++
> > backends/cryptodev-vhost.c | 297 ++++++++++++++++++++++++++
> > docs/interop/vhost-user.txt | 26 +++
> > hw/virtio/Makefile.objs | 2 +-
> > hw/virtio/vhost-user.c | 104 ++++++++++
> > hw/virtio/virtio-crypto.c | 70 +++++++
> > include/hw/virtio/vhost-backend.h | 8 +
> > include/hw/virtio/virtio-crypto.h | 1 +
> > include/sysemu/cryptodev-vhost-user.h | 47 +++++
> > include/sysemu/cryptodev-vhost.h | 154 ++++++++++++++
> > include/sysemu/cryptodev.h | 8 +
> > qemu-options.hx | 21 ++
> > vl.c | 4 +
> > 15 files changed, 1127 insertions(+), 1 deletion(-) create mode 100644
> > backends/cryptodev-vhost-user.c create mode 100644 backends/cryptodev-
> > vhost.c create mode 100644 include/sysemu/cryptodev-vhost-user.h
> > create mode 100644 include/sysemu/cryptodev-vhost.h
> >
> > --
> > 1.8.3.1
> >
prev parent reply other threads:[~2018-01-16 16:38 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-16 14:06 [Qemu-devel] [PATCH v3 0/4] cryptodev: add vhost support Jay Zhou
2018-01-16 14:06 ` [Qemu-devel] [PATCH v3 1/4] cryptodev: add vhost-user as a new cryptodev backend Jay Zhou
2018-01-16 16:41 ` Michael S. Tsirkin
2018-01-17 5:01 ` Zhoujian (jay)
2018-01-17 11:39 ` Gonglei (Arei)
2018-01-16 14:06 ` [Qemu-devel] [PATCH v3 2/4] cryptodev: add vhost support Jay Zhou
2018-01-16 14:06 ` [Qemu-devel] [PATCH v3 3/4] cryptodev-vhost-user: add crypto session handler Jay Zhou
2018-03-21 3:40 ` Zhang, Roy Fan
2018-01-16 14:06 ` [Qemu-devel] [PATCH v3 4/4] cryptodev-vhost-user: set the key length Jay Zhou
2018-01-16 14:21 ` [Qemu-devel] [PATCH v3 0/4] cryptodev: add vhost support Zhoujian (jay)
2018-01-16 16:38 ` Michael S. Tsirkin [this message]
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=20180116183754-mutt-send-email-mst@kernel.org \
--to=mst@redhat.com \
--cc=arei.gonglei@huawei.com \
--cc=jianjay.zhou@huawei.com \
--cc=longpeng2@huawei.com \
--cc=pasic@linux.vnet.ibm.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=roy.fan.zhang@intel.com \
--cc=stefanha@redhat.com \
--cc=weidong.huang@huawei.com \
--cc=xin.zeng@intel.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).