From patchwork Fri Oct 4 11:57:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nipun Gupta X-Patchwork-Id: 175228 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp613828ill; Fri, 4 Oct 2019 05:12:55 -0700 (PDT) X-Google-Smtp-Source: APXvYqxxtGivg9JfO5V8dnNsNDD+ov3poh2GGbQLmWWDYPgJk03fehuYJZZY21WWyauiNkRdC8wL X-Received: by 2002:aa7:d654:: with SMTP id v20mr14936352edr.46.1570191175088; Fri, 04 Oct 2019 05:12:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570191175; cv=none; d=google.com; s=arc-20160816; b=0ufjNiNSOu51cfoQgAC6nWFUuuIfw97b+Q+++J7vXPIfoTxiCG+dixNDb9FnWspI9L iVMuI/2RrYQT7em/0NM4QEpbykp7rqngS48gZCRLbaPPT3hlI5jSPTDFc2ENi41Uz6vE b40TDE7bq8NPrJt83pF1T80H7k/DDAx0tk1pqhQGqOe1XYKkNXYPeGADdIce5N2FYfhB P7Ynbjno4q13VLz9/0vUssmD527LTC8yKnrY+bfT3UI0MYnsSbh26ZeiAOCA/RXf8Nsy mwP9n3h33FNucRRPqrcuFmhdQUFb5lu1affp/onHsKyRWOUh2VI95f08aJzq6wf0rDe8 PrdQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:references:in-reply-to :message-id:date:cc:to:from; bh=hLDdH7S93q3rpxSfgFZVzRTJEbQmtZXuF9xOG7QsAOA=; b=f5GVe3B1H8qklsJqL0EikBdvQJgvPikt/dS715lcAmJrqcajvsKqmd3MOwhkqsx7cQ gx+JHtBcYz0BmqaEdWRZIT/CiHeHsjtrxRvZwbNrw8CkvE8wBGjy9CWSPBOGNirfXT0p 5XdAHy3uCodgEohXIAkG6UC/V+dXU+g0P9gsYc/iRAtqWw9ztbU9kTOBr1ljGbYTUcwA 8fJLl2gqf9DURAZ3DN7IzsHh3ZIEfOc4Y/lPnSQ7bdPmtehQTeL1Kx2g2jsM9mwTHGnG itw6ZcOLezlZvm28Ci6EP87sLrjAGuRL8ynUov9aDqaHKVfVKH9JVT5EKhlAM27UPc9N CQBg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of dev-bounces@dpdk.org designates 92.243.14.124 as permitted sender) smtp.mailfrom=dev-bounces@dpdk.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from dpdk.org (dpdk.org. [92.243.14.124]) by mx.google.com with ESMTP id l22si3273960edq.174.2019.10.04.05.12.54; Fri, 04 Oct 2019 05:12:55 -0700 (PDT) Received-SPF: pass (google.com: domain of dev-bounces@dpdk.org designates 92.243.14.124 as permitted sender) client-ip=92.243.14.124; Authentication-Results: mx.google.com; spf=pass (google.com: domain of dev-bounces@dpdk.org designates 92.243.14.124 as permitted sender) smtp.mailfrom=dev-bounces@dpdk.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 06D241C225; Fri, 4 Oct 2019 14:12:48 +0200 (CEST) Received: from inva020.nxp.com (inva020.nxp.com [92.121.34.13]) by dpdk.org (Postfix) with ESMTP id 154811C217 for ; Fri, 4 Oct 2019 14:12:45 +0200 (CEST) Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id CE79A1A00DE; Fri, 4 Oct 2019 14:12:44 +0200 (CEST) Received: from invc005.ap-rdc01.nxp.com (invc005.ap-rdc01.nxp.com [165.114.16.14]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 3B20F1A0196; Fri, 4 Oct 2019 14:12:42 +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 E4671402BE; Fri, 4 Oct 2019 20:12:38 +0800 (SGT) From: Nipun Gupta To: dev@dpdk.org Cc: jerinj@marvell.com, hemant.agrawal@nxp.com, Nipun Gupta Date: Fri, 4 Oct 2019 17:27:25 +0530 Message-Id: <20191004115725.1915-2-nipun.gupta@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191004115725.1915-1-nipun.gupta@nxp.com> References: <20191004115725.1915-1-nipun.gupta@nxp.com> X-Virus-Scanned: ClamAV using ClamSMTP Subject: [dpdk-dev] [PATCH 2/2] event/dpaa2: support Tx 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" This patch adds the support of Tx adapter for DPAA2 platform Signed-off-by: Nipun Gupta --- This patch is based over "eventdev: flag to identify same destined packets enqueue" patch drivers/event/dpaa2/dpaa2_eventdev.c | 75 ++++++++++++++++++++++++++-- drivers/event/dpaa2/dpaa2_eventdev.h | 3 +- 2 files changed, 72 insertions(+), 6 deletions(-) -- 2.17.1 Acked-by: Hemant Agrawal diff --git a/drivers/event/dpaa2/dpaa2_eventdev.c b/drivers/event/dpaa2/dpaa2_eventdev.c index 56cea5f90..4ee2c460e 100644 --- a/drivers/event/dpaa2/dpaa2_eventdev.c +++ b/drivers/event/dpaa2/dpaa2_eventdev.c @@ -27,6 +27,7 @@ #include #include #include +#include #include #include @@ -947,6 +948,66 @@ dpaa2_eventdev_crypto_stop(const struct rte_eventdev *dev, return 0; } +static int +dpaa2_eventdev_tx_adapter_create(uint8_t id, + const struct rte_eventdev *dev) +{ + RTE_SET_USED(id); + RTE_SET_USED(dev); + + /* Nothing to do. Simply return. */ + return 0; +} + +static int +dpaa2_eventdev_tx_adapter_caps(const struct rte_eventdev *dev, + const struct rte_eth_dev *eth_dev, + uint32_t *caps) +{ + RTE_SET_USED(dev); + RTE_SET_USED(eth_dev); + + *caps = RTE_EVENT_ETH_TX_ADAPTER_CAP_INTERNAL_PORT; + return 0; +} + +static uint16_t +dpaa2_eventdev_txa_enqueue_same_dest(void *port, + struct rte_event ev[], + uint16_t nb_events) +{ + struct rte_mbuf *m[DPAA2_EVENT_MAX_PORT_ENQUEUE_DEPTH], *m0; + uint8_t qid, i; + + RTE_SET_USED(port); + + m0 = (struct rte_mbuf *)ev[0].mbuf; + qid = rte_event_eth_tx_adapter_txq_get(m0); + + for (i = 0; i < nb_events; i++) + m[i] = (struct rte_mbuf *)ev[i].mbuf; + + return rte_eth_tx_burst(m0->port, qid, m, nb_events); +} + +static uint16_t +dpaa2_eventdev_txa_enqueue(void *port, + struct rte_event ev[], + uint16_t nb_events) +{ + struct rte_mbuf *m = (struct rte_mbuf *)ev[0].mbuf; + uint8_t qid, i; + + RTE_SET_USED(port); + + for (i = 0; i < nb_events; i++) { + qid = rte_event_eth_tx_adapter_txq_get(m); + rte_eth_tx_burst(m->port, qid, &m, 1); + } + + return nb_events; +} + static struct rte_eventdev_ops dpaa2_eventdev_ops = { .dev_infos_get = dpaa2_eventdev_info_get, .dev_configure = dpaa2_eventdev_configure, @@ -964,11 +1025,13 @@ static struct rte_eventdev_ops dpaa2_eventdev_ops = { .timeout_ticks = dpaa2_eventdev_timeout_ticks, .dump = dpaa2_eventdev_dump, .dev_selftest = test_eventdev_dpaa2, - .eth_rx_adapter_caps_get = dpaa2_eventdev_eth_caps_get, - .eth_rx_adapter_queue_add = dpaa2_eventdev_eth_queue_add, - .eth_rx_adapter_queue_del = dpaa2_eventdev_eth_queue_del, - .eth_rx_adapter_start = dpaa2_eventdev_eth_start, - .eth_rx_adapter_stop = dpaa2_eventdev_eth_stop, + .eth_rx_adapter_caps_get = dpaa2_eventdev_eth_caps_get, + .eth_rx_adapter_queue_add = dpaa2_eventdev_eth_queue_add, + .eth_rx_adapter_queue_del = dpaa2_eventdev_eth_queue_del, + .eth_rx_adapter_start = dpaa2_eventdev_eth_start, + .eth_rx_adapter_stop = dpaa2_eventdev_eth_stop, + .eth_tx_adapter_caps_get = dpaa2_eventdev_tx_adapter_caps, + .eth_tx_adapter_create = dpaa2_eventdev_tx_adapter_create, .crypto_adapter_caps_get = dpaa2_eventdev_crypto_caps_get, .crypto_adapter_queue_pair_add = dpaa2_eventdev_crypto_queue_add, .crypto_adapter_queue_pair_del = dpaa2_eventdev_crypto_queue_del, @@ -1035,6 +1098,8 @@ dpaa2_eventdev_create(const char *name) eventdev->enqueue_forward_burst = dpaa2_eventdev_enqueue_burst; eventdev->dequeue = dpaa2_eventdev_dequeue; eventdev->dequeue_burst = dpaa2_eventdev_dequeue_burst; + eventdev->txa_enqueue = dpaa2_eventdev_txa_enqueue; + eventdev->txa_enqueue_same_dest = dpaa2_eventdev_txa_enqueue_same_dest; /* For secondary processes, the primary has done all the work */ if (rte_eal_process_type() != RTE_PROC_PRIMARY) diff --git a/drivers/event/dpaa2/dpaa2_eventdev.h b/drivers/event/dpaa2/dpaa2_eventdev.h index 7c5d00550..785e52032 100644 --- a/drivers/event/dpaa2/dpaa2_eventdev.h +++ b/drivers/event/dpaa2/dpaa2_eventdev.h @@ -38,7 +38,8 @@ enum { #define RTE_EVENT_ETH_RX_ADAPTER_DPAA2_CAP \ (RTE_EVENT_ETH_RX_ADAPTER_CAP_INTERNAL_PORT | \ RTE_EVENT_ETH_RX_ADAPTER_CAP_MULTI_EVENTQ | \ - RTE_EVENT_ETH_RX_ADAPTER_CAP_OVERRIDE_FLOW_ID) + RTE_EVENT_ETH_RX_ADAPTER_CAP_OVERRIDE_FLOW_ID | \ + RTE_EVENT_ETH_TX_ADAPTER_CAP_INTERNAL_PORT) /**< Crypto Rx adapter cap to return If the packet transfers from * the cryptodev to eventdev with DPAA2 devices.