qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v3] crypto: add virtio-crypto driver


From: Gonglei (Arei)
Subject: Re: [Qemu-devel] [PATCH v3] crypto: add virtio-crypto driver
Date: Tue, 29 Nov 2016 06:47:52 +0000

>
> > > > +
> > > > +/* Note: kernel crypto API realization */
> > > > +static int virtio_crypto_ablkcipher_setkey(struct crypto_ablkcipher 
> > > > *tfm,
> > > > +                                        const uint8_t *key,
> > > > +                                        unsigned int keylen)
> > > > +{
> > > > +       struct virtio_crypto_ablkcipher_ctx *ctx =
> > crypto_ablkcipher_ctx(tfm);
> > > > +       int ret;
> > > > +
> > > > +       spin_lock(&ctx->lock);
> > > > +
> > > > +       if (!ctx->vcrypto) {
> > > > +               /* New key */
> > > > +               int node = virtio_crypto_get_current_node();
> > > > +               struct virtio_crypto *vcrypto =
> > > > +                                     virtcrypto_get_dev_node(node);
> > > > +               if (!vcrypto) {
> > > > +                       vcrypto = virtcrypto_devmgr_get_first();
> >
> > Is this the standard way to do this? How does this work with
> > multiple crypto devices (e.g. with different capabilities)?
> >
> Actually there is a simple schedule algorithms in virtcrypto_get_dev_node(),
> which return the device used fewest on the node.
> 
> If we don't find a device in the node, select the first on as default.
> But I forgot to check the first devices whether the device has started here.
> 
Oh, the virtcrypto_get_dev_node() had done this work, the calling of
virtcrypto_devmgr_get_first() here is superfluous. Will remove it.

Regards,
-Gonglei




reply via email to

[Prev in Thread] Current Thread [Next in Thread]