lkml.org 
[lkml]   [2016]   [Nov]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRE: [PATCH v3] crypto: add virtio-crypto driver
Date
>
> > > > +
> > > > +/* 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

\
 
 \ /
  Last update: 2016-11-29 07:49    [W:0.321 / U:0.040 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site