From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id DEB7AA2F67 for ; Fri, 4 Oct 2019 13:42:38 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 9C7931C223; Fri, 4 Oct 2019 13:42:27 +0200 (CEST) Received: from inva021.nxp.com (inva021.nxp.com [92.121.34.21]) by dpdk.org (Postfix) with ESMTP id 66F351C20A for ; Fri, 4 Oct 2019 13:42:23 +0200 (CEST) Received: from inva021.nxp.com (localhost [127.0.0.1]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id 47D0A200777; Fri, 4 Oct 2019 13:42:23 +0200 (CEST) Received: from invc005.ap-rdc01.nxp.com (invc005.ap-rdc01.nxp.com [165.114.16.14]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id 4796A2001A8; Fri, 4 Oct 2019 13:42:20 +0200 (CEST) Received: from GDB1.ap.freescale.net (GDB1.ap.freescale.net [10.232.132.179]) by invc005.ap-rdc01.nxp.com (Postfix) with ESMTP id 79BD1402E0; Fri, 4 Oct 2019 19:42:16 +0800 (SGT) From: Akhil Goyal To: dev@dpdk.org Cc: jerinj@marvell.com, hemant.agrawal@nxp.com, anoobj@marvell.com, Akhil Goyal Date: Fri, 4 Oct 2019 16:56:59 +0530 Message-Id: <20191004112659.32394-3-akhil.goyal@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191004112659.32394-1-akhil.goyal@nxp.com> References: <20190930191348.16577-1-akhil.goyal@nxp.com> <20191004112659.32394-1-akhil.goyal@nxp.com> X-Virus-Scanned: ClamAV using ClamSMTP Subject: [dpdk-dev] [PATCH v3 2/2] event/dpaa: support event crypto adapter X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" event dpaa device support both ethernet as well as crypto queues to be attached to it. eth_rx_adapter provide infrastructure to attach ethernet queues and crypto_adapter provide support for crypto queues. This patch add support for dpaa_eventdev to attach dpaa_sec queues. Signed-off-by: Akhil Goyal --- drivers/event/dpaa/Makefile | 3 + drivers/event/dpaa/dpaa_eventdev.c | 154 ++++++++++++++++++++++++++++- drivers/event/dpaa/dpaa_eventdev.h | 5 + drivers/event/dpaa/meson.build | 3 +- 4 files changed, 163 insertions(+), 2 deletions(-) diff --git a/drivers/event/dpaa/Makefile b/drivers/event/dpaa/Makefile index cf9626495..1856fa468 100644 --- a/drivers/event/dpaa/Makefile +++ b/drivers/event/dpaa/Makefile @@ -21,6 +21,9 @@ CFLAGS += -I$(RTE_SDK)/drivers/bus/dpaa/include/ CFLAGS += -I$(RTE_SDK)/drivers/mempool/dpaa CFLAGS += -I$(RTE_SDK)/lib/librte_eal/common/include +LDLIBS += -lrte_pmd_dpaa_sec +CFLAGS += -I$(RTE_SDK)/drivers/crypto/dpaa_sec + EXPORT_MAP := rte_pmd_dpaa_event_version.map LIBABIVER := 1 diff --git a/drivers/event/dpaa/dpaa_eventdev.c b/drivers/event/dpaa/dpaa_eventdev.c index 1e247e4f4..d02b8694e 100644 --- a/drivers/event/dpaa/dpaa_eventdev.c +++ b/drivers/event/dpaa/dpaa_eventdev.c @@ -27,12 +27,14 @@ #include #include #include +#include #include #include #include #include #include +#include #include "dpaa_eventdev.h" #include @@ -322,7 +324,7 @@ dpaa_event_dev_info_get(struct rte_eventdev *dev, 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 = @@ -718,6 +720,149 @@ dpaa_event_eth_rx_adapter_stop(const struct rte_eventdev *dev, 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, @@ -738,6 +883,11 @@ static struct rte_eventdev_ops dpaa_eventdev_ops = { .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, @@ -806,6 +956,8 @@ dpaa_event_dev_create(const char *name, const char *params) 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; diff --git a/drivers/event/dpaa/dpaa_eventdev.h b/drivers/event/dpaa/dpaa_eventdev.h index 8134e6ba9..b8f247c61 100644 --- a/drivers/event/dpaa/dpaa_eventdev.h +++ b/drivers/event/dpaa/dpaa_eventdev.h @@ -40,6 +40,11 @@ do { \ RTE_EVENT_ETH_RX_ADAPTER_CAP_MULTI_EVENTQ | \ RTE_EVENT_ETH_RX_ADAPTER_CAP_OVERRIDE_FLOW_ID) +#define RTE_EVENT_CRYPTO_ADAPTER_DPAA_CAP \ + (RTE_EVENT_CRYPTO_ADAPTER_CAP_INTERNAL_PORT_OP_NEW | \ + RTE_EVENT_CRYPTO_ADAPTER_CAP_INTERNAL_PORT_QP_EV_BIND | \ + RTE_EVENT_CRYPTO_ADAPTER_CAP_SESSION_PRIVATE_DATA) + struct dpaa_eventq { /* Channel Id */ uint16_t ch_id; diff --git a/drivers/event/dpaa/meson.build b/drivers/event/dpaa/meson.build index c1e725475..b74f3bf32 100644 --- a/drivers/event/dpaa/meson.build +++ b/drivers/event/dpaa/meson.build @@ -5,7 +5,8 @@ if not is_linux build = false reason = 'only supported on linux' endif -deps += ['pmd_dpaa'] +deps += ['pmd_dpaa', 'pmd_dpaa_sec'] sources = files('dpaa_eventdev.c') allow_experimental_apis = true +includes += include_directories('../../crypto/dpaa_sec/') -- 2.17.1