> > > > > + > > > > +/* 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 -- To unsubscribe from this list: send the line "unsubscribe linux-crypto" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html