2 * QEMU Cryptodev backend for QEMU cipher APIs
4 * Copyright (c) 2016 HUAWEI TECHNOLOGIES CO., LTD.
7 * Gonglei <arei.gonglei@huawei.com>
8 * Jay Zhou <jianjay.zhou@huawei.com>
10 * This library is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU Lesser General Public
12 * License as published by the Free Software Foundation; either
13 * version 2 of the License, or (at your option) any later version.
15 * This library is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * Lesser General Public License for more details.
20 * You should have received a copy of the GNU Lesser General Public
21 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
25 #include "qemu/osdep.h"
26 #include "sysemu/cryptodev-vhost.h"
28 #ifdef CONFIG_VHOST_CRYPTO
30 cryptodev_vhost_get_max_queues(
31 CryptoDevBackendVhost
*crypto
)
33 return crypto
->dev
.max_queues
;
36 void cryptodev_vhost_cleanup(CryptoDevBackendVhost
*crypto
)
38 vhost_dev_cleanup(&crypto
->dev
);
42 struct CryptoDevBackendVhost
*
44 CryptoDevBackendVhostOptions
*options
)
47 CryptoDevBackendVhost
*crypto
;
49 crypto
= g_new(CryptoDevBackendVhost
, 1);
50 crypto
->dev
.max_queues
= 1;
52 crypto
->dev
.vqs
= crypto
->vqs
;
54 crypto
->cc
= options
->cc
;
56 crypto
->dev
.protocol_features
= 0;
59 /* vhost-user needs vq_index to initiate a specific queue pair */
60 crypto
->dev
.vq_index
= crypto
->cc
->queue_index
* crypto
->dev
.nvqs
;
62 r
= vhost_dev_init(&crypto
->dev
, options
->opaque
, options
->backend_type
, 0);
75 cryptodev_vhost_get_max_queues(CryptoDevBackendVhost
*crypto
)
80 void cryptodev_vhost_cleanup(CryptoDevBackendVhost
*crypto
)
84 struct CryptoDevBackendVhost
*
85 cryptodev_vhost_init(CryptoDevBackendVhostOptions
*options
)