#include <rte_dev.h>
#include <rte_errno.h>
#include <rte_cryptodev.h>
-#include <rte_cryptodev_pmd.h>
+#include <cryptodev_pmd.h>
#include <rte_log.h>
#include <rte_malloc.h>
#include <rte_service_component.h>
#include "rte_eventdev.h"
#include "eventdev_pmd.h"
-#include "rte_eventdev_trace.h"
+#include "eventdev_trace.h"
#include "rte_event_crypto_adapter.h"
#define BATCH_SIZE 32
*/
#define CRYPTO_ENQ_FLUSH_THRESHOLD 1024
-struct rte_event_crypto_adapter {
+struct event_crypto_adapter {
/* Event device identifier */
uint8_t eventdev_id;
/* Event port identifier */
uint8_t len;
} __rte_cache_aligned;
-static struct rte_event_crypto_adapter **event_crypto_adapter;
+static struct event_crypto_adapter **event_crypto_adapter;
/* Macros to check for valid adapter */
#define EVENT_CRYPTO_ADAPTER_ID_VALID_OR_ERR_RET(id, retval) do { \
return 0;
}
-static inline struct rte_event_crypto_adapter *
+static inline struct event_crypto_adapter *
eca_id_to_adapter(uint8_t id)
{
return event_crypto_adapter ?
int started;
int ret;
struct rte_event_port_conf *port_conf = arg;
- struct rte_event_crypto_adapter *adapter = eca_id_to_adapter(id);
+ struct event_crypto_adapter *adapter = eca_id_to_adapter(id);
if (adapter == NULL)
return -EINVAL;
enum rte_event_crypto_adapter_mode mode,
void *conf_arg)
{
- struct rte_event_crypto_adapter *adapter;
+ struct event_crypto_adapter *adapter;
char mem_name[CRYPTO_ADAPTER_NAME_LEN];
struct rte_event_dev_info dev_info;
int socket_id;
int
rte_event_crypto_adapter_free(uint8_t id)
{
- struct rte_event_crypto_adapter *adapter;
+ struct event_crypto_adapter *adapter;
EVENT_CRYPTO_ADAPTER_ID_VALID_OR_ERR_RET(id, -EINVAL);
}
static inline unsigned int
-eca_enq_to_cryptodev(struct rte_event_crypto_adapter *adapter,
- struct rte_event *ev, unsigned int cnt)
+eca_enq_to_cryptodev(struct event_crypto_adapter *adapter, struct rte_event *ev,
+ unsigned int cnt)
{
struct rte_event_crypto_adapter_stats *stats = &adapter->crypto_stats;
union rte_event_crypto_metadata *m_data = NULL;
}
static unsigned int
-eca_crypto_enq_flush(struct rte_event_crypto_adapter *adapter)
+eca_crypto_enq_flush(struct event_crypto_adapter *adapter)
{
struct rte_event_crypto_adapter_stats *stats = &adapter->crypto_stats;
struct crypto_device_info *curr_dev;
}
static int
-eca_crypto_adapter_enq_run(struct rte_event_crypto_adapter *adapter,
- unsigned int max_enq)
+eca_crypto_adapter_enq_run(struct event_crypto_adapter *adapter,
+ unsigned int max_enq)
{
struct rte_event_crypto_adapter_stats *stats = &adapter->crypto_stats;
struct rte_event ev[BATCH_SIZE];
}
static inline void
-eca_ops_enqueue_burst(struct rte_event_crypto_adapter *adapter,
- struct rte_crypto_op **ops, uint16_t num)
+eca_ops_enqueue_burst(struct event_crypto_adapter *adapter,
+ struct rte_crypto_op **ops, uint16_t num)
{
struct rte_event_crypto_adapter_stats *stats = &adapter->crypto_stats;
union rte_event_crypto_metadata *m_data = NULL;
}
static inline unsigned int
-eca_crypto_adapter_deq_run(struct rte_event_crypto_adapter *adapter,
- unsigned int max_deq)
+eca_crypto_adapter_deq_run(struct event_crypto_adapter *adapter,
+ unsigned int max_deq)
{
struct rte_event_crypto_adapter_stats *stats = &adapter->crypto_stats;
struct crypto_device_info *curr_dev;
}
static void
-eca_crypto_adapter_run(struct rte_event_crypto_adapter *adapter,
- unsigned int max_ops)
+eca_crypto_adapter_run(struct event_crypto_adapter *adapter,
+ unsigned int max_ops)
{
- while (max_ops) {
+ unsigned int ops_left = max_ops;
+
+ while (ops_left > 0) {
unsigned int e_cnt, d_cnt;
- e_cnt = eca_crypto_adapter_deq_run(adapter, max_ops);
- max_ops -= RTE_MIN(max_ops, e_cnt);
+ e_cnt = eca_crypto_adapter_deq_run(adapter, ops_left);
+ ops_left -= RTE_MIN(ops_left, e_cnt);
- d_cnt = eca_crypto_adapter_enq_run(adapter, max_ops);
- max_ops -= RTE_MIN(max_ops, d_cnt);
+ d_cnt = eca_crypto_adapter_enq_run(adapter, ops_left);
+ ops_left -= RTE_MIN(ops_left, d_cnt);
if (e_cnt == 0 && d_cnt == 0)
break;
}
+
+ if (ops_left == max_ops)
+ rte_event_maintain(adapter->eventdev_id,
+ adapter->event_port_id, 0);
}
static int
eca_service_func(void *args)
{
- struct rte_event_crypto_adapter *adapter = args;
+ struct event_crypto_adapter *adapter = args;
if (rte_spinlock_trylock(&adapter->lock) == 0)
return 0;
}
static int
-eca_init_service(struct rte_event_crypto_adapter *adapter, uint8_t id)
+eca_init_service(struct event_crypto_adapter *adapter, uint8_t id)
{
struct rte_event_crypto_adapter_conf adapter_conf;
struct rte_service_spec service;
}
static void
-eca_update_qp_info(struct rte_event_crypto_adapter *adapter,
- struct crypto_device_info *dev_info,
- int32_t queue_pair_id,
- uint8_t add)
+eca_update_qp_info(struct event_crypto_adapter *adapter,
+ struct crypto_device_info *dev_info, int32_t queue_pair_id,
+ uint8_t add)
{
struct crypto_queue_pair_info *qp_info;
int enabled;
}
static int
-eca_add_queue_pair(struct rte_event_crypto_adapter *adapter,
- uint8_t cdev_id,
- int queue_pair_id)
+eca_add_queue_pair(struct event_crypto_adapter *adapter, uint8_t cdev_id,
+ int queue_pair_id)
{
struct crypto_device_info *dev_info = &adapter->cdevs[cdev_id];
struct crypto_queue_pair_info *qpairs;
int32_t queue_pair_id,
const struct rte_event *event)
{
- struct rte_event_crypto_adapter *adapter;
+ struct event_crypto_adapter *adapter;
struct rte_eventdev *dev;
struct crypto_device_info *dev_info;
uint32_t cap;
EVENT_CRYPTO_ADAPTER_ID_VALID_OR_ERR_RET(id, -EINVAL);
- if (!rte_cryptodev_pmd_is_valid_dev(cdev_id)) {
+ if (!rte_cryptodev_is_valid_dev(cdev_id)) {
RTE_EDEV_LOG_ERR("Invalid dev_id=%" PRIu8, cdev_id);
return -EINVAL;
}
rte_event_crypto_adapter_queue_pair_del(uint8_t id, uint8_t cdev_id,
int32_t queue_pair_id)
{
- struct rte_event_crypto_adapter *adapter;
+ struct event_crypto_adapter *adapter;
struct crypto_device_info *dev_info;
struct rte_eventdev *dev;
int ret;
EVENT_CRYPTO_ADAPTER_ID_VALID_OR_ERR_RET(id, -EINVAL);
- if (!rte_cryptodev_pmd_is_valid_dev(cdev_id)) {
+ if (!rte_cryptodev_is_valid_dev(cdev_id)) {
RTE_EDEV_LOG_ERR("Invalid dev_id=%" PRIu8, cdev_id);
return -EINVAL;
}
static int
eca_adapter_ctrl(uint8_t id, int start)
{
- struct rte_event_crypto_adapter *adapter;
+ struct event_crypto_adapter *adapter;
struct crypto_device_info *dev_info;
struct rte_eventdev *dev;
uint32_t i;
int
rte_event_crypto_adapter_start(uint8_t id)
{
- struct rte_event_crypto_adapter *adapter;
+ struct event_crypto_adapter *adapter;
EVENT_CRYPTO_ADAPTER_ID_VALID_OR_ERR_RET(id, -EINVAL);
adapter = eca_id_to_adapter(id);
rte_event_crypto_adapter_stats_get(uint8_t id,
struct rte_event_crypto_adapter_stats *stats)
{
- struct rte_event_crypto_adapter *adapter;
+ struct event_crypto_adapter *adapter;
struct rte_event_crypto_adapter_stats dev_stats_sum = { 0 };
struct rte_event_crypto_adapter_stats dev_stats;
struct rte_eventdev *dev;
int
rte_event_crypto_adapter_stats_reset(uint8_t id)
{
- struct rte_event_crypto_adapter *adapter;
+ struct event_crypto_adapter *adapter;
struct crypto_device_info *dev_info;
struct rte_eventdev *dev;
uint32_t i;
int
rte_event_crypto_adapter_service_id_get(uint8_t id, uint32_t *service_id)
{
- struct rte_event_crypto_adapter *adapter;
+ struct event_crypto_adapter *adapter;
EVENT_CRYPTO_ADAPTER_ID_VALID_OR_ERR_RET(id, -EINVAL);
int
rte_event_crypto_adapter_event_port_get(uint8_t id, uint8_t *event_port_id)
{
- struct rte_event_crypto_adapter *adapter;
+ struct event_crypto_adapter *adapter;
EVENT_CRYPTO_ADAPTER_ID_VALID_OR_ERR_RET(id, -EINVAL);