1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2018 HUAWEI TECHNOLOGIES CO., LTD.
5 #ifndef _VIRTIO_CRYPTODEV_H_
6 #define _VIRTIO_CRYPTODEV_H_
8 #include "virtio_crypto.h"
9 #include "virtio_pci.h"
10 #include "virtio_ring.h"
12 /* Features desired/implemented by this driver. */
13 #define VIRTIO_CRYPTO_PMD_GUEST_FEATURES (1ULL << VIRTIO_F_VERSION_1)
15 #define CRYPTODEV_NAME_VIRTIO_PMD crypto_virtio
17 #define NUM_ENTRY_VIRTIO_CRYPTO_OP 7
19 #define VIRTIO_CRYPTO_MAX_IV_SIZE 16
21 #define VIRTIO_CRYPTO_MAX_KEY_SIZE 256
23 extern uint8_t cryptodev_virtio_driver_id;
25 enum virtio_crypto_cmd_id {
26 VIRTIO_CRYPTO_CMD_CIPHER = 0,
27 VIRTIO_CRYPTO_CMD_AUTH = 1,
28 VIRTIO_CRYPTO_CMD_CIPHER_HASH = 2,
29 VIRTIO_CRYPTO_CMD_HASH_CIPHER = 3
32 struct virtio_crypto_op_cookie {
33 struct virtio_crypto_op_data_req data_req;
34 struct virtio_crypto_inhdr inhdr;
35 struct vring_desc desc[NUM_ENTRY_VIRTIO_CRYPTO_OP];
36 uint8_t iv[VIRTIO_CRYPTO_MAX_IV_SIZE];
40 * Control queue function prototype
42 void virtio_crypto_ctrlq_start(struct rte_cryptodev *dev);
45 * Data queue function prototype
47 void virtio_crypto_dataq_start(struct rte_cryptodev *dev);
49 int virtio_crypto_queue_setup(struct rte_cryptodev *dev,
51 uint16_t vtpci_queue_idx,
54 struct virtqueue **pvq);
56 void virtio_crypto_queue_release(struct virtqueue *vq);
58 uint16_t virtio_crypto_pkt_tx_burst(void *tx_queue,
59 struct rte_crypto_op **tx_pkts,
62 uint16_t virtio_crypto_pkt_rx_burst(void *tx_queue,
63 struct rte_crypto_op **tx_pkts,
66 #endif /* _VIRTIO_CRYPTODEV_H_ */