#include <rte_eventdev_pmd_vdev.h>
#include <rte_ethdev.h>
#include <rte_event_eth_rx_adapter.h>
+#include <rte_cryptodev.h>
#include <rte_dpaa_bus.h>
#include <rte_dpaa_logs.h>
#include <rte_cycles.h>
#include <rte_kvargs.h>
#include <dpaa_ethdev.h>
+#include <dpaa_sec_event.h>
#include "dpaa_eventdev.h"
#include <dpaa_mempool.h>
EVENTDEV_INIT_FUNC_TRACE();
RTE_SET_USED(dev);
- dev_info->driver_name = "event_dpaa";
+ dev_info->driver_name = "event_dpaa1";
dev_info->min_dequeue_timeout_ns =
DPAA_EVENT_MIN_DEQUEUE_TIMEOUT;
dev_info->max_dequeue_timeout_ns =
return 0;
}
+static int
+dpaa_eventdev_crypto_caps_get(const struct rte_eventdev *dev,
+ const struct rte_cryptodev *cdev,
+ uint32_t *caps)
+{
+ const char *name = cdev->data->name;
+
+ EVENTDEV_INIT_FUNC_TRACE();
+
+ RTE_SET_USED(dev);
+
+ if (!strncmp(name, "dpaa_sec-", 9))
+ *caps = RTE_EVENT_CRYPTO_ADAPTER_DPAA_CAP;
+ else
+ return -1;
+
+ return 0;
+}
+
+static int
+dpaa_eventdev_crypto_queue_add_all(const struct rte_eventdev *dev,
+ const struct rte_cryptodev *cryptodev,
+ const struct rte_event *ev)
+{
+ struct dpaa_eventdev *priv = dev->data->dev_private;
+ uint8_t ev_qid = ev->queue_id;
+ u16 ch_id = priv->evq_info[ev_qid].ch_id;
+ int i, ret;
+
+ EVENTDEV_INIT_FUNC_TRACE();
+
+ for (i = 0; i < cryptodev->data->nb_queue_pairs; i++) {
+ ret = dpaa_sec_eventq_attach(cryptodev, i,
+ ch_id, ev);
+ if (ret) {
+ DPAA_EVENTDEV_ERR("dpaa_sec_eventq_attach failed: ret %d\n",
+ ret);
+ goto fail;
+ }
+ }
+ return 0;
+fail:
+ for (i = (i - 1); i >= 0 ; i--)
+ dpaa_sec_eventq_detach(cryptodev, i);
+
+ return ret;
+}
+
+static int
+dpaa_eventdev_crypto_queue_add(const struct rte_eventdev *dev,
+ const struct rte_cryptodev *cryptodev,
+ int32_t rx_queue_id,
+ const struct rte_event *ev)
+{
+ struct dpaa_eventdev *priv = dev->data->dev_private;
+ uint8_t ev_qid = ev->queue_id;
+ u16 ch_id = priv->evq_info[ev_qid].ch_id;
+ int ret;
+
+ EVENTDEV_INIT_FUNC_TRACE();
+
+ if (rx_queue_id == -1)
+ return dpaa_eventdev_crypto_queue_add_all(dev,
+ cryptodev, ev);
+
+ ret = dpaa_sec_eventq_attach(cryptodev, rx_queue_id,
+ ch_id, ev);
+ if (ret) {
+ DPAA_EVENTDEV_ERR(
+ "dpaa_sec_eventq_attach failed: ret: %d\n", ret);
+ return ret;
+ }
+ return 0;
+}
+
+static int
+dpaa_eventdev_crypto_queue_del_all(const struct rte_eventdev *dev,
+ const struct rte_cryptodev *cdev)
+{
+ int i, ret;
+
+ EVENTDEV_INIT_FUNC_TRACE();
+
+ RTE_SET_USED(dev);
+
+ for (i = 0; i < cdev->data->nb_queue_pairs; i++) {
+ ret = dpaa_sec_eventq_detach(cdev, i);
+ if (ret) {
+ DPAA_EVENTDEV_ERR(
+ "dpaa_sec_eventq_detach failed:ret %d\n", ret);
+ return ret;
+ }
+ }
+
+ return 0;
+}
+
+static int
+dpaa_eventdev_crypto_queue_del(const struct rte_eventdev *dev,
+ const struct rte_cryptodev *cryptodev,
+ int32_t rx_queue_id)
+{
+ int ret;
+
+ EVENTDEV_INIT_FUNC_TRACE();
+
+ if (rx_queue_id == -1)
+ return dpaa_eventdev_crypto_queue_del_all(dev, cryptodev);
+
+ ret = dpaa_sec_eventq_detach(cryptodev, rx_queue_id);
+ if (ret) {
+ DPAA_EVENTDEV_ERR(
+ "dpaa_sec_eventq_detach failed: ret: %d\n", ret);
+ return ret;
+ }
+
+ return 0;
+}
+
+static int
+dpaa_eventdev_crypto_start(const struct rte_eventdev *dev,
+ const struct rte_cryptodev *cryptodev)
+{
+ EVENTDEV_INIT_FUNC_TRACE();
+
+ RTE_SET_USED(dev);
+ RTE_SET_USED(cryptodev);
+
+ return 0;
+}
+
+static int
+dpaa_eventdev_crypto_stop(const struct rte_eventdev *dev,
+ const struct rte_cryptodev *cryptodev)
+{
+ EVENTDEV_INIT_FUNC_TRACE();
+
+ RTE_SET_USED(dev);
+ RTE_SET_USED(cryptodev);
+
+ return 0;
+}
+
static struct rte_eventdev_ops dpaa_eventdev_ops = {
.dev_infos_get = dpaa_event_dev_info_get,
.dev_configure = dpaa_event_dev_configure,
.eth_rx_adapter_queue_del = dpaa_event_eth_rx_adapter_queue_del,
.eth_rx_adapter_start = dpaa_event_eth_rx_adapter_start,
.eth_rx_adapter_stop = dpaa_event_eth_rx_adapter_stop,
+ .crypto_adapter_caps_get = dpaa_eventdev_crypto_caps_get,
+ .crypto_adapter_queue_pair_add = dpaa_eventdev_crypto_queue_add,
+ .crypto_adapter_queue_pair_del = dpaa_eventdev_crypto_queue_del,
+ .crypto_adapter_start = dpaa_eventdev_crypto_start,
+ .crypto_adapter_stop = dpaa_eventdev_crypto_stop,
};
static int flag_check_handler(__rte_unused const char *key,
eventdev->dequeue_burst = dpaa_event_dequeue_burst_intr;
}
+ RTE_LOG(INFO, PMD, "%s eventdev added", name);
+
/* For secondary processes, the primary has done all the work */
if (rte_eal_process_type() != RTE_PROC_PRIMARY)
return 0;