aboutsummaryrefslogtreecommitdiff
path: root/backends/cryptodev-vhost-user.c
diff options
context:
space:
mode:
Diffstat (limited to 'backends/cryptodev-vhost-user.c')
-rw-r--r--backends/cryptodev-vhost-user.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/backends/cryptodev-vhost-user.c b/backends/cryptodev-vhost-user.c
index 93c3f10a8f..151a0e6ca7 100644
--- a/backends/cryptodev-vhost-user.c
+++ b/backends/cryptodev-vhost-user.c
@@ -29,6 +29,7 @@
#include "standard-headers/linux/virtio_crypto.h"
#include "sysemu/cryptodev-vhost.h"
#include "chardev/char-fe.h"
+#include "sysemu/cryptodev-vhost-user.h"
/**
@@ -58,6 +59,20 @@ cryptodev_vhost_user_running(
return crypto ? 1 : 0;
}
+CryptoDevBackendVhost *
+cryptodev_vhost_user_get_vhost(
+ CryptoDevBackendClient *cc,
+ CryptoDevBackend *b,
+ uint16_t queue)
+{
+ CryptoDevBackendVhostUser *s =
+ CRYPTODEV_BACKEND_VHOST_USER(b);
+ assert(cc->type == CRYPTODEV_BACKEND_TYPE_VHOST_USER);
+ assert(queue < MAX_CRYPTO_QUEUE_NUM);
+
+ return s->vhost_crypto[queue];
+}
+
static void cryptodev_vhost_user_stop(int queues,
CryptoDevBackendVhostUser *s)
{
@@ -188,6 +203,7 @@ static void cryptodev_vhost_user_init(
cc->info_str = g_strdup_printf("cryptodev-vhost-user%zu to %s ",
i, chr->label);
cc->queue_index = i;
+ cc->type = CRYPTODEV_BACKEND_TYPE_VHOST_USER;
backend->conf.peers.ccs[i] = cc;