xref: /dpdk/drivers/crypto/virtio/virtio_cryptodev.h (revision 6f0175ff53e0d9c4fbca4796a6c64c78d657a61d)
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2018 HUAWEI TECHNOLOGIES CO., LTD.
3  */
4 
5 #ifndef _VIRTIO_CRYPTODEV_H_
6 #define _VIRTIO_CRYPTODEV_H_
7 
8 #include "virtio_crypto.h"
9 #include "virtio_pci.h"
10 #include "virtio_ring.h"
11 
12 /* Features desired/implemented by this driver. */
13 #define VIRTIO_CRYPTO_PMD_GUEST_FEATURES (1ULL << VIRTIO_F_VERSION_1)
14 
15 #define CRYPTODEV_NAME_VIRTIO_PMD crypto_virtio
16 
17 #define NUM_ENTRY_VIRTIO_CRYPTO_OP 7
18 
19 struct virtio_crypto_op_cookie {
20 	struct virtio_crypto_op_data_req data_req;
21 	struct virtio_crypto_inhdr inhdr;
22 	struct vring_desc desc[NUM_ENTRY_VIRTIO_CRYPTO_OP];
23 };
24 
25 /*
26  * Control queue function prototype
27  */
28 void virtio_crypto_ctrlq_start(struct rte_cryptodev *dev);
29 
30 /*
31  * Data queue function prototype
32  */
33 void virtio_crypto_dataq_start(struct rte_cryptodev *dev);
34 
35 int virtio_crypto_queue_setup(struct rte_cryptodev *dev,
36 		int queue_type,
37 		uint16_t vtpci_queue_idx,
38 		uint16_t nb_desc,
39 		int socket_id,
40 		struct virtqueue **pvq);
41 
42 void virtio_crypto_queue_release(struct virtqueue *vq);
43 
44 uint16_t virtio_crypto_pkt_tx_burst(void *tx_queue,
45 		struct rte_crypto_op **tx_pkts,
46 		uint16_t nb_pkts);
47 
48 uint16_t virtio_crypto_pkt_rx_burst(void *tx_queue,
49 		struct rte_crypto_op **tx_pkts,
50 		uint16_t nb_pkts);
51 
52 #endif /* _VIRTIO_CRYPTODEV_H_ */
53