From: Halil Pasic <pasic@linux.vnet.ibm.com>
To: Gonglei <arei.gonglei@huawei.com>,
linux-kernel@vger.kernel.org, qemu-devel@nongnu.org,
virtio-dev@lists.oasis-open.org,
virtualization@lists.linux-foundation.org,
linux-crypto@vger.kernel.org
Cc: weidong.huang@huawei.com, claudio.fontana@huawei.com,
mst@redhat.com, luonengjun@huawei.com, hanweidong@huawei.com,
xin.zeng@intel.com, xuquan8@huawei.com, wanzongshun@huawei.com,
stefanha@redhat.com, jianjay.zhou@huawei.com,
cornelia.huck@de.ibm.com, longpeng2@huawei.com,
arei.gonglei@hotmail.com, davem@davemloft.net,
wu.wubin@huawei.com, herbert@gondor.apana.org.au
Subject: Re: [Qemu-devel] [PATCH v7 1/1] crypto: add virtio-crypto driver
Date: Wed, 14 Dec 2016 16:38:33 +0100 [thread overview]
Message-ID: <bcf62fa0-8fc9-daaf-ea7b-e09eb83b593a@linux.vnet.ibm.com> (raw)
In-Reply-To: <1481716249-185392-2-git-send-email-arei.gonglei@huawei.com>
On 12/14/2016 12:50 PM, Gonglei wrote:
> diff --git a/drivers/crypto/virtio/virtio_crypto_core.c b/drivers/crypto/virtio/virtio_crypto_core.c
> new file mode 100644
> index 0000000..c0854a1
> --- /dev/null
> +++ b/drivers/crypto/virtio/virtio_crypto_core.c
> @@ -0,0 +1,474 @@
[..]
> +
> +static void virtcrypto_dataq_callback(struct virtqueue *vq)
> +{
> + struct virtio_crypto *vcrypto = vq->vdev->priv;
> + struct virtio_crypto_request *vc_req;
> + unsigned long flags;
> + unsigned int len;
> + struct ablkcipher_request *ablk_req;
> + int error;
> +
> + spin_lock_irqsave(&vcrypto->lock, flags);
Would it make sense to use a per virtqueue lock
like in virtio_blk for example instead of locking on the whole
device? OK, it seems you use only one dataqueue, so it
may not be that relevant.
> + do {
> + virtqueue_disable_cb(vq);
> + while ((vc_req = virtqueue_get_buf(vq, &len)) != NULL) {
> + if (vc_req->type == VIRTIO_CRYPTO_SYM_OP_CIPHER) {
> + switch (vc_req->status) {
> + case VIRTIO_CRYPTO_OK:
> + error = 0;
> + break;
> + case VIRTIO_CRYPTO_INVSESS:
> + case VIRTIO_CRYPTO_ERR:
> + error = -EINVAL;
> + break;
> + case VIRTIO_CRYPTO_BADMSG:
> + error = -EBADMSG;
> + break;
> + default:
> + error = -EIO;
> + break;
> + }
> + ablk_req = vc_req->ablkcipher_req;
> + virtcrypto_clear_request(vc_req);
> +
> + spin_unlock_irqrestore(&vcrypto->lock, flags);
> + /* Finish the encrypt or decrypt process */
> + ablk_req->base.complete(&ablk_req->base, error);
> + spin_lock_irqsave(&vcrypto->lock, flags);
> + }
> + }
> + } while (!virtqueue_enable_cb(vq));
> + spin_unlock_irqrestore(&vcrypto->lock, flags);
> +}
next prev parent reply other threads:[~2016-12-14 15:38 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-14 11:50 [PATCH v7 0/1] virtio-crypto: add Linux driver Gonglei
2016-12-14 11:50 ` [Qemu-devel] " Gonglei
2016-12-14 11:50 ` [PATCH v7 1/1] crypto: add virtio-crypto driver Gonglei
2016-12-14 11:50 ` [Qemu-devel] " Gonglei
2016-12-14 11:50 ` Gonglei
2016-12-14 11:50 ` Gonglei
2016-12-14 15:38 ` [Qemu-devel] " Halil Pasic
2016-12-14 15:38 ` Halil Pasic [this message]
2016-12-15 0:45 ` Gonglei (Arei)
2016-12-15 0:45 ` Gonglei (Arei)
2016-12-15 0:45 ` Gonglei (Arei)
2016-12-15 0:45 ` Gonglei (Arei)
2016-12-15 0:59 ` Zeng, Xin
2016-12-15 0:59 ` Zeng, Xin
2016-12-15 0:59 ` Zeng, Xin
2016-12-15 0:59 ` Zeng, Xin
2016-12-15 1:08 ` Gonglei (Arei)
2016-12-15 1:08 ` Gonglei (Arei)
2016-12-15 16:42 ` Michael S. Tsirkin
2016-12-15 16:42 ` Michael S. Tsirkin
2016-12-15 16:42 ` Michael S. Tsirkin
2016-12-16 0:40 ` [virtio-dev] " Gonglei (Arei)
2016-12-16 0:40 ` Gonglei (Arei)
2016-12-16 0:40 ` [Qemu-devel] [virtio-dev] " Gonglei (Arei)
2016-12-16 0:40 ` [virtio-dev] Re: [Qemu-devel] " Gonglei (Arei)
2016-12-15 1:08 ` Gonglei (Arei)
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=bcf62fa0-8fc9-daaf-ea7b-e09eb83b593a@linux.vnet.ibm.com \
--to=pasic@linux.vnet.ibm.com \
--cc=arei.gonglei@hotmail.com \
--cc=arei.gonglei@huawei.com \
--cc=claudio.fontana@huawei.com \
--cc=cornelia.huck@de.ibm.com \
--cc=davem@davemloft.net \
--cc=hanweidong@huawei.com \
--cc=herbert@gondor.apana.org.au \
--cc=jianjay.zhou@huawei.com \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=longpeng2@huawei.com \
--cc=luonengjun@huawei.com \
--cc=mst@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
--cc=virtio-dev@lists.oasis-open.org \
--cc=virtualization@lists.linux-foundation.org \
--cc=wanzongshun@huawei.com \
--cc=weidong.huang@huawei.com \
--cc=wu.wubin@huawei.com \
--cc=xin.zeng@intel.com \
--cc=xuquan8@huawei.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 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.