From patchwork Fri Oct 4 06:55:46 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nipun Gupta X-Patchwork-Id: 175207 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp315874ill; Fri, 4 Oct 2019 00:11:16 -0700 (PDT) X-Google-Smtp-Source: APXvYqybNh3YowqgVSsb2nvrsV1k1h0z4WEDQhEhtnF9z79cAeF7jvyLw5xdSBMDGmK4lyDpibed X-Received: by 2002:a50:d090:: with SMTP id v16mr13748520edd.176.1570173076265; Fri, 04 Oct 2019 00:11:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570173076; cv=none; d=google.com; s=arc-20160816; b=JloKmgalNdeIvjlJWc4aCZHrLzOdzF8MHPJ+CT/F6XC14UFFfSnUsv9TdF6d3jx5ql SL+3p4vLc8gIPR/e3Fbhrn5o+K15I40QUcqMST/CovjdULeWVyEzgnlQxr//8FvKtWnB vdqpYI562pNn0mge6oxQNgkBZqOP2+HZ22nKbFPbNlcZKE0T7eMOGtroExowsxgx5Zv0 g2Gl0Z43fDuQIfTnYedLppfTe7UkTn9Z3rKDWSx8qEWFHZb419JHgHmm9xP2zc+5FI4V cxHb6Zd1T04GOyAztPokjUd/Ey/ryk+GigvVhhvL0JEruFvTGZfEUkYrM6IvdzInJuA6 wLIw== 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=5GvVyM4y/7AZhYu5EHgUiMnxwVznoDdunyuY5qp47zw=; b=pOFNus4b/AsiltCBu0nKH4XwZ1fVEdfld0U82HH6vqk8dObrvvRcz1SXL7k3g0D/eo +atM0nl6nPqfMayppo7rr+ArcUa9ZEmjPV5LnNdSJ461mXvY509MgAySOfoZ/hPgR5fK QPP37+74R5gY0zO6gXAaWTpT4HrL9JaGikbnn568KMPWY8DykRtA8INSUV0oJzzZjWrl UNPaY0VKw7Nt3BhAZRVHP+mJ4FKrEKZgf+cPNBJVbkj8nW6L/6uVTVvgpE0+pd+1ER7R AyjKpkn5i0yfhwGhJTz076R+Sd35+DPIu+J4BdnKSgDLPnHCGGqxv8FvKx9mXpRBjd4N 7TuA== 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 y47si2955930edd.236.2019.10.04.00.11.16; Fri, 04 Oct 2019 00:11:16 -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 0550B1BF39; Fri, 4 Oct 2019 09:11:15 +0200 (CEST) Received: from inva021.nxp.com (inva021.nxp.com [92.121.34.21]) by dpdk.org (Postfix) with ESMTP id 9C090B62 for ; Fri, 4 Oct 2019 09:11:13 +0200 (CEST) Received: from inva021.nxp.com (localhost [127.0.0.1]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id 1E83A2000A0; Fri, 4 Oct 2019 09:11:13 +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 9C9862000D8; Fri, 4 Oct 2019 09:11:06 +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 9D05B402E0; Fri, 4 Oct 2019 15:10:58 +0800 (SGT) From: Nipun Gupta To: dev@dpdk.org Cc: jerinj@marvell.com, aconole@redhat.com, pbhagavatula@marvell.com, skori@marvell.com, hemant.agrawal@nxp.com, bruce.richardson@intel.com, marko.kovacevic@intel.com, orika@mellanox.com, radu.nicolau@intel.com, tomasz.kantecki@intel.com, harry.van.haaren@intel.com, nikhil.rao@intel.com, Nipun Gupta Date: Fri, 4 Oct 2019 12:25:46 +0530 Message-Id: <20191004065546.11942-1-nipun.gupta@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191001064641.28404-1-nipun.gupta@nxp.com> References: <20191001064641.28404-1-nipun.gupta@nxp.com> X-Virus-Scanned: ClamAV using ClamSMTP Subject: [dpdk-dev] [PATCH v2] eventdev: flag to identify same destined packets enqueue 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 introduces a `flag` in the Eth TX adapter enqueue API. Some drivers may support burst functionality only with the packets having same destination device and queue. The flag `RTE_EVENT_ETH_TX_ADAPTER_ENQUEUE_SAME_DEST` can be used to indicate this so the underlying driver, for drivers to utilize burst functionality appropriately. Signed-off-by: Nipun Gupta --- Changes in v2: - have separate internal API in tx adapter for sending burst packets to same eth dev, queue pair on the basis of the passed flag - fix compilation of examples/eventdev_pipeline/ app/test-eventdev/test_pipeline_common.h | 6 +++--- .../prog_guide/event_ethernet_tx_adapter.rst | 3 ++- .../eventdev_pipeline/pipeline_worker_tx.c | 2 +- .../rte_event_eth_tx_adapter.h | 19 +++++++++++++++++-- lib/librte_eventdev/rte_eventdev.c | 12 ++++++++++++ lib/librte_eventdev/rte_eventdev.h | 9 +++++++++ 6 files changed, 44 insertions(+), 7 deletions(-) -- 2.17.1 diff --git a/app/test-eventdev/test_pipeline_common.h b/app/test-eventdev/test_pipeline_common.h index 0440b9e29..6e73c6ab2 100644 --- a/app/test-eventdev/test_pipeline_common.h +++ b/app/test-eventdev/test_pipeline_common.h @@ -106,7 +106,7 @@ pipeline_event_tx(const uint8_t dev, const uint8_t port, struct rte_event * const ev) { rte_event_eth_tx_adapter_txq_set(ev->mbuf, 0); - while (!rte_event_eth_tx_adapter_enqueue(dev, port, ev, 1)) + while (!rte_event_eth_tx_adapter_enqueue(dev, port, ev, 1, 0)) rte_pause(); } @@ -116,10 +116,10 @@ pipeline_event_tx_burst(const uint8_t dev, const uint8_t port, { uint16_t enq; - enq = rte_event_eth_tx_adapter_enqueue(dev, port, ev, nb_rx); + enq = rte_event_eth_tx_adapter_enqueue(dev, port, ev, nb_rx, 0); while (enq < nb_rx) { enq += rte_event_eth_tx_adapter_enqueue(dev, port, - ev + enq, nb_rx - enq); + ev + enq, nb_rx - enq, 0); } } diff --git a/doc/guides/prog_guide/event_ethernet_tx_adapter.rst b/doc/guides/prog_guide/event_ethernet_tx_adapter.rst index 192f9e1cf..a8c13e136 100644 --- a/doc/guides/prog_guide/event_ethernet_tx_adapter.rst +++ b/doc/guides/prog_guide/event_ethernet_tx_adapter.rst @@ -137,11 +137,12 @@ should use the ``rte_event_enqueue_burst()`` function. if (cap & RTE_EVENT_ETH_TX_ADAPTER_CAP_INTERNAL_PORT) { event.mbuf = m; + eq_flags = 0; m->port = tx_port; rte_event_eth_tx_adapter_txq_set(m, tx_queue_id); - rte_event_eth_tx_adapter_enqueue(dev_id, ev_port, &event, 1); + rte_event_eth_tx_adapter_enqueue(dev_id, ev_port, &event, 1, eq_flags); } else { event.queue_id = qid; /* event queue linked to adapter port */ diff --git a/examples/eventdev_pipeline/pipeline_worker_tx.c b/examples/eventdev_pipeline/pipeline_worker_tx.c index 8961cd656..a0f40c27c 100644 --- a/examples/eventdev_pipeline/pipeline_worker_tx.c +++ b/examples/eventdev_pipeline/pipeline_worker_tx.c @@ -40,7 +40,7 @@ worker_tx_pkt(const uint8_t dev, const uint8_t port, struct rte_event *ev) { exchange_mac(ev->mbuf); rte_event_eth_tx_adapter_txq_set(ev->mbuf, 0); - while (!rte_event_eth_tx_adapter_enqueue(dev, port, ev, 1)) + while (!rte_event_eth_tx_adapter_enqueue(dev, port, ev, 1, 0)) rte_pause(); } diff --git a/lib/librte_eventdev/rte_event_eth_tx_adapter.h b/lib/librte_eventdev/rte_event_eth_tx_adapter.h index c848261c4..f552b6023 100644 --- a/lib/librte_eventdev/rte_event_eth_tx_adapter.h +++ b/lib/librte_eventdev/rte_event_eth_tx_adapter.h @@ -300,6 +300,11 @@ rte_event_eth_tx_adapter_txq_get(struct rte_mbuf *pkt) int rte_event_eth_tx_adapter_event_port_get(uint8_t id, uint8_t *event_port_id); +#define RTE_EVENT_ETH_TX_ADAPTER_ENQUEUE_SAME_DEST 0x1 +/**< This flag is used when all the packets enqueued in the tx adapter are + * destined for the same Ethernet device, queue pair. + */ + /** * Enqueue a burst of events objects or an event object supplied in *rte_event* * structure on an event device designated by its *dev_id* through the event @@ -324,6 +329,10 @@ rte_event_eth_tx_adapter_event_port_get(uint8_t id, uint8_t *event_port_id); * The number of event objects to enqueue, typically number of * rte_event_port_attr_get(...RTE_EVENT_PORT_ATTR_ENQ_DEPTH...) * available for this port. + * @param flags + * See RTE_EVENT_ETH_TX_ADAPTER_ENQUEUE_ flags. + * #RTE_EVENT_ETH_TX_ADAPTER_ENQUEUE_SAME_DEST signifies that all the packets + * which are enqueued are destined for the same Ethernet device, queue pair. * * @return * The number of event objects actually enqueued on the event device. The @@ -343,7 +352,8 @@ static inline uint16_t rte_event_eth_tx_adapter_enqueue(uint8_t dev_id, uint8_t port_id, struct rte_event ev[], - uint16_t nb_events) + uint16_t nb_events, + const uint8_t flags) { const struct rte_eventdev *dev = &rte_eventdevs[dev_id]; @@ -359,7 +369,12 @@ rte_event_eth_tx_adapter_enqueue(uint8_t dev_id, return 0; } #endif - return dev->txa_enqueue(dev->data->ports[port_id], ev, nb_events); + if (flags) + return dev->txa_enqueue_same_dest(dev->data->ports[port_id], + ev, nb_events, flags); + else + return dev->txa_enqueue(dev->data->ports[port_id], ev, + nb_events); } /** diff --git a/lib/librte_eventdev/rte_eventdev.c b/lib/librte_eventdev/rte_eventdev.c index f44c869cb..7c8ffdfef 100644 --- a/lib/librte_eventdev/rte_eventdev.c +++ b/lib/librte_eventdev/rte_eventdev.c @@ -1330,6 +1330,16 @@ rte_event_tx_adapter_enqueue(__rte_unused void *port, return 0; } +static uint16_t +rte_event_tx_adapter_enqueue_same_dest(__rte_unused void *port, + __rte_unused struct rte_event ev[], + __rte_unused uint16_t nb_events, + __rte_unused const uint8_t flags) +{ + rte_errno = ENOTSUP; + return 0; +} + struct rte_eventdev * rte_event_pmd_allocate(const char *name, int socket_id) { @@ -1351,6 +1361,8 @@ rte_event_pmd_allocate(const char *name, int socket_id) eventdev = &rte_eventdevs[dev_id]; eventdev->txa_enqueue = rte_event_tx_adapter_enqueue; + eventdev->txa_enqueue_same_dest = + rte_event_tx_adapter_enqueue_same_dest; if (eventdev->data == NULL) { struct rte_eventdev_data *eventdev_data = NULL; diff --git a/lib/librte_eventdev/rte_eventdev.h b/lib/librte_eventdev/rte_eventdev.h index 5044a13d0..ea61f52f6 100644 --- a/lib/librte_eventdev/rte_eventdev.h +++ b/lib/librte_eventdev/rte_eventdev.h @@ -1230,6 +1230,13 @@ typedef uint16_t (*event_tx_adapter_enqueue)(void *port, struct rte_event ev[], uint16_t nb_events); /**< @internal Enqueue burst of events on port of a device */ +typedef uint16_t (*event_tx_adapter_enqueue_same_dest)(void *port, + struct rte_event ev[], uint16_t nb_events, + const uint8_t flags); +/**< @internal Enqueue burst of events on port of a device supporting flag to + * indicate burst having same dest eth port and queue. + */ + #define RTE_EVENTDEV_NAME_MAX_LEN (64) /**< @internal Max length of name of event PMD */ @@ -1292,6 +1299,8 @@ struct rte_eventdev { /**< Pointer to PMD dequeue function. */ event_dequeue_burst_t dequeue_burst; /**< Pointer to PMD dequeue burst function. */ + event_tx_adapter_enqueue_same_dest txa_enqueue_same_dest; + /**< Pointer to PMD eth Tx adapter enqueue burst function. */ event_tx_adapter_enqueue txa_enqueue; /**< Pointer to PMD eth Tx adapter enqueue function. */ struct rte_eventdev_data *data;