1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2018 HUAWEI TECHNOLOGIES CO., LTD.
5 #include "virtio_cryptodev.h"
8 virtio_crypto_vring_start(struct virtqueue *vq)
10 struct virtio_crypto_hw *hw = vq->hw;
11 int i, size = vq->vq_nentries;
12 struct vring *vr = &vq->vq_ring;
13 uint8_t *ring_mem = vq->vq_ring_virt_mem;
15 PMD_INIT_FUNC_TRACE();
17 vring_init(vr, size, ring_mem, VIRTIO_PCI_VRING_ALIGN);
18 vq->vq_desc_tail_idx = (uint16_t)(vq->vq_nentries - 1);
19 vq->vq_free_cnt = vq->vq_nentries;
21 /* Chain all the descriptors in the ring with an END */
22 for (i = 0; i < size - 1; i++)
23 vr->desc[i].next = (uint16_t)(i + 1);
24 vr->desc[i].next = VQ_RING_DESC_CHAIN_END;
27 * Disable device(host) interrupting guest
29 virtqueue_disable_intr(vq);
32 * Set guest physical address of the virtqueue
33 * in VIRTIO_PCI_QUEUE_PFN config register of device
34 * to share with the backend
36 if (VTPCI_OPS(hw)->setup_queue(hw, vq) < 0) {
37 VIRTIO_CRYPTO_INIT_LOG_ERR("setup_queue failed");
45 virtio_crypto_ctrlq_start(struct rte_cryptodev *dev)
47 struct virtio_crypto_hw *hw = dev->data->dev_private;
50 virtio_crypto_vring_start(hw->cvq);
51 VIRTQUEUE_DUMP((struct virtqueue *)hw->cvq);
56 virtio_crypto_dataq_start(struct rte_cryptodev *dev)
60 * - Setup vring structure for data queues
63 struct virtio_crypto_hw *hw = dev->data->dev_private;
65 PMD_INIT_FUNC_TRACE();
67 /* Start data vring. */
68 for (i = 0; i < hw->max_dataqueues; i++) {
69 virtio_crypto_vring_start(dev->data->queue_pairs[i]);
70 VIRTQUEUE_DUMP((struct virtqueue *)dev->data->queue_pairs[i]);
75 virtio_crypto_pkt_rx_burst(
76 void *tx_queue __rte_unused,
77 struct rte_crypto_op **rx_pkts __rte_unused,
78 uint16_t nb_pkts __rte_unused)
86 virtio_crypto_pkt_tx_burst(
87 void *tx_queue __rte_unused,
88 struct rte_crypto_op **tx_pkts __rte_unused,
89 uint16_t nb_pkts __rte_unused)