2018-04-17 17:23:17 +08:00
|
|
|
/* SPDX-License-Identifier: BSD-3-Clause
|
|
|
|
* Copyright(c) 2018 HUAWEI TECHNOLOGIES CO., LTD.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _VIRTIO_CRYPTODEV_H_
|
|
|
|
#define _VIRTIO_CRYPTODEV_H_
|
|
|
|
|
crypto/virtio: support basic PMD ops
This patch implements the basic operations of virtio crypto PMD, which
includes start, stop, close, information getting, queue setup and
release of the device.
The virtio crypto device has two types of queues, data queue and
control queue. It has one data queue at least and has one and only one
control queue. For example, if a virtio crypto device has N queues,
then [0, N-2] is the data queue index, N-1 is the control
queue index.
Signed-off-by: Jay Zhou <jianjay.zhou@huawei.com>
Reviewed-by: Fan Zhang <roy.fan.zhang@intel.com>
2018-04-17 17:23:19 +08:00
|
|
|
#include "virtio_crypto.h"
|
|
|
|
#include "virtio_pci.h"
|
|
|
|
#include "virtio_ring.h"
|
2018-04-17 17:23:18 +08:00
|
|
|
|
|
|
|
/* Features desired/implemented by this driver. */
|
|
|
|
#define VIRTIO_CRYPTO_PMD_GUEST_FEATURES (1ULL << VIRTIO_F_VERSION_1)
|
|
|
|
|
2018-04-17 17:23:17 +08:00
|
|
|
#define CRYPTODEV_NAME_VIRTIO_PMD crypto_virtio
|
|
|
|
|
crypto/virtio: support basic PMD ops
This patch implements the basic operations of virtio crypto PMD, which
includes start, stop, close, information getting, queue setup and
release of the device.
The virtio crypto device has two types of queues, data queue and
control queue. It has one data queue at least and has one and only one
control queue. For example, if a virtio crypto device has N queues,
then [0, N-2] is the data queue index, N-1 is the control
queue index.
Signed-off-by: Jay Zhou <jianjay.zhou@huawei.com>
Reviewed-by: Fan Zhang <roy.fan.zhang@intel.com>
2018-04-17 17:23:19 +08:00
|
|
|
#define NUM_ENTRY_VIRTIO_CRYPTO_OP 7
|
|
|
|
|
2018-06-26 03:10:48 +01:00
|
|
|
#define VIRTIO_CRYPTO_MAX_IV_SIZE 16
|
|
|
|
|
2019-06-24 14:35:22 +01:00
|
|
|
#define VIRTIO_CRYPTO_MAX_KEY_SIZE 256
|
|
|
|
|
2018-04-17 17:23:21 +08:00
|
|
|
extern uint8_t cryptodev_virtio_driver_id;
|
|
|
|
|
2018-04-17 17:23:20 +08:00
|
|
|
enum virtio_crypto_cmd_id {
|
|
|
|
VIRTIO_CRYPTO_CMD_CIPHER = 0,
|
|
|
|
VIRTIO_CRYPTO_CMD_AUTH = 1,
|
|
|
|
VIRTIO_CRYPTO_CMD_CIPHER_HASH = 2,
|
|
|
|
VIRTIO_CRYPTO_CMD_HASH_CIPHER = 3
|
|
|
|
};
|
|
|
|
|
crypto/virtio: support basic PMD ops
This patch implements the basic operations of virtio crypto PMD, which
includes start, stop, close, information getting, queue setup and
release of the device.
The virtio crypto device has two types of queues, data queue and
control queue. It has one data queue at least and has one and only one
control queue. For example, if a virtio crypto device has N queues,
then [0, N-2] is the data queue index, N-1 is the control
queue index.
Signed-off-by: Jay Zhou <jianjay.zhou@huawei.com>
Reviewed-by: Fan Zhang <roy.fan.zhang@intel.com>
2018-04-17 17:23:19 +08:00
|
|
|
struct virtio_crypto_op_cookie {
|
|
|
|
struct virtio_crypto_op_data_req data_req;
|
|
|
|
struct virtio_crypto_inhdr inhdr;
|
|
|
|
struct vring_desc desc[NUM_ENTRY_VIRTIO_CRYPTO_OP];
|
2018-06-26 03:10:48 +01:00
|
|
|
uint8_t iv[VIRTIO_CRYPTO_MAX_IV_SIZE];
|
crypto/virtio: support basic PMD ops
This patch implements the basic operations of virtio crypto PMD, which
includes start, stop, close, information getting, queue setup and
release of the device.
The virtio crypto device has two types of queues, data queue and
control queue. It has one data queue at least and has one and only one
control queue. For example, if a virtio crypto device has N queues,
then [0, N-2] is the data queue index, N-1 is the control
queue index.
Signed-off-by: Jay Zhou <jianjay.zhou@huawei.com>
Reviewed-by: Fan Zhang <roy.fan.zhang@intel.com>
2018-04-17 17:23:19 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Control queue function prototype
|
|
|
|
*/
|
|
|
|
void virtio_crypto_ctrlq_start(struct rte_cryptodev *dev);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Data queue function prototype
|
|
|
|
*/
|
|
|
|
void virtio_crypto_dataq_start(struct rte_cryptodev *dev);
|
|
|
|
|
|
|
|
int virtio_crypto_queue_setup(struct rte_cryptodev *dev,
|
|
|
|
int queue_type,
|
|
|
|
uint16_t vtpci_queue_idx,
|
|
|
|
uint16_t nb_desc,
|
|
|
|
int socket_id,
|
|
|
|
struct virtqueue **pvq);
|
|
|
|
|
|
|
|
void virtio_crypto_queue_release(struct virtqueue *vq);
|
|
|
|
|
2018-04-17 17:23:18 +08:00
|
|
|
uint16_t virtio_crypto_pkt_tx_burst(void *tx_queue,
|
|
|
|
struct rte_crypto_op **tx_pkts,
|
|
|
|
uint16_t nb_pkts);
|
|
|
|
|
|
|
|
uint16_t virtio_crypto_pkt_rx_burst(void *tx_queue,
|
|
|
|
struct rte_crypto_op **tx_pkts,
|
|
|
|
uint16_t nb_pkts);
|
|
|
|
|
2018-04-17 17:23:17 +08:00
|
|
|
#endif /* _VIRTIO_CRYPTODEV_H_ */
|