From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from foss.arm.com (usa-sjc-mx-foss1.foss.arm.com [217.140.101.70]) by dpdk.org (Postfix) with ESMTP id 4F3746833 for ; Thu, 31 May 2018 22:23:54 +0200 (CEST) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 78A5915AD; Thu, 31 May 2018 13:23:53 -0700 (PDT) Received: from ubuntu.localdomain (U202406.usa.Arm.com [10.118.30.32]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 2B5AE3F53D; Thu, 31 May 2018 13:23:53 -0700 (PDT) From: Honnappa Nagarahalli To: jerin.jacob@caviumnetworks.com Cc: dev@dpdk.org, Honnappa Nagarahalli Date: Thu, 31 May 2018 15:23:42 -0500 Message-Id: <1527798222-1873-1-git-send-email-honnappa.nagarahalli@arm.com> X-Mailer: git-send-email 2.7.4 Subject: [dpdk-dev] [PATCH] doc/event: improve eventdev library documentation 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: , X-List-Received-Date: Thu, 31 May 2018 20:23:54 -0000 Add small amount of additional code, use consistent variable names across code blocks, change the image to represent queues and CPU cores intuitively. These help improve the eventdev library documentation. Signed-off-by: Honnappa Nagarahalli Reviewed-by: Gavin Hu --- doc/guides/prog_guide/eventdev.rst | 55 +- doc/guides/prog_guide/img/eventdev_usage.svg | 1518 +++++++++----------------- 2 files changed, 570 insertions(+), 1003 deletions(-) diff --git a/doc/guides/prog_guide/eventdev.rst b/doc/guides/prog_guide/eventdev.rst index ce19997..0203d9e 100644 --- a/doc/guides/prog_guide/eventdev.rst +++ b/doc/guides/prog_guide/eventdev.rst @@ -1,5 +1,6 @@ .. SPDX-License-Identifier: BSD-3-Clause Copyright(c) 2017 Intel Corporation. + Copyright(c) 2018 Arm Limited. Event Device Library ==================== @@ -129,7 +130,7 @@ API Walk-through This section will introduce the reader to the eventdev API, showing how to create and configure an eventdev and use it for a two-stage atomic pipeline -with a single core for TX. The diagram below shows the final state of the +with one core each for RX and TX. The diagram below shows the final state of the application after this walk-through: .. _figure_eventdev-usage1: @@ -196,23 +197,29 @@ calling the setup function. Repeat this step for each queue, starting from .nb_atomic_flows = 1024, .nb_atomic_order_sequences = 1024, }; + struct rte_event_queue_conf single_link_conf = { + .event_queue_cfg = RTE_EVENT_QUEUE_CFG_SINGLE_LINK, + }; int dev_id = 0; - int queue_id = 0; - int err = rte_event_queue_setup(dev_id, queue_id, &atomic_conf); + int atomic_q_1 = 0; + int atomic_q_2 = 1; + int single_link_q = 2; + int err = rte_event_queue_setup(dev_id, atomic_q_1, &atomic_conf); + int err = rte_event_queue_setup(dev_id, atomic_q_2, &atomic_conf); + int err = rte_event_queue_setup(dev_id, single_link_q, &single_link_conf); -The remainder of this walk-through assumes that the queues are configured as -follows: +As shown above, queue IDs are as follows: * id 0, atomic queue #1 * id 1, atomic queue #2 * id 2, single-link queue +These queues are used for the remainder of this walk-through. + Setting up Ports ~~~~~~~~~~~~~~~~ -Once queues are set up successfully, create the ports as required. Each port -should be set up with its corresponding port_conf type, worker for worker cores, -rx and tx for the RX and TX cores: +Once queues are set up successfully, create the ports as required. .. code-block:: c @@ -232,15 +239,24 @@ rx and tx for the RX and TX cores: .new_event_threshold = 4096, }; int dev_id = 0; - int port_id = 0; - int err = rte_event_port_setup(dev_id, port_id, &CORE_FUNCTION_conf); + int rx_port_id = 0; + int err = rte_event_port_setup(dev_id, rx_port_id, &rx_conf); + + for(int worker_port_id = 1; worker_port_id <= 4; worker_port_id++) { + int err = rte_event_port_setup(dev_id, worker_port_id, &worker_conf); + } -It is now assumed that: + int tx_port_id = 5; + int err = rte_event_port_setup(dev_id, tx_port_id, &tx_conf); + +As shown above: * port 0: RX core * ports 1,2,3,4: Workers * port 5: TX core +These ports are used for the remainder of this walk-through. + Linking Queues and Ports ~~~~~~~~~~~~~~~~~~~~~~~~ @@ -254,15 +270,14 @@ can be achieved like this: .. code-block:: c - uint8_t port_id = 0; + uint8_t rx_port_id = 0; + uint8_t tx_port_id = 5; uint8_t atomic_qs[] = {0, 1}; uint8_t single_link_q = 2; - uint8_t tx_port_id = 5; uin8t_t priority = RTE_EVENT_DEV_PRIORITY_NORMAL; - for(int i = 0; i < 4; i++) { - int worker_port = i + 1; - int links_made = rte_event_port_link(dev_id, worker_port, atomic_qs, NULL, 2); + for(int worker_port_id = 1; worker_port_id <= 4; worker_port_id++) { + int links_made = rte_event_port_link(dev_id, worker_port_id, atomic_qs, NULL, 2); } int links_made = rte_event_port_link(dev_id, tx_port_id, &single_link_q, &priority, 1); @@ -295,14 +310,14 @@ The following code shows how those packets can be enqueued into the eventdev: ev[i].flow_id = mbufs[i]->hash.rss; ev[i].op = RTE_EVENT_OP_NEW; ev[i].sched_type = RTE_SCHED_TYPE_ATOMIC; - ev[i].queue_id = 0; + ev[i].queue_id = atomic_q_1; ev[i].event_type = RTE_EVENT_TYPE_ETHDEV; ev[i].sub_event_type = 0; ev[i].priority = RTE_EVENT_DEV_PRIORITY_NORMAL; ev[i].mbuf = mbufs[i]; } - const int nb_tx = rte_event_enqueue_burst(dev_id, port_id, ev, nb_rx); + const int nb_tx = rte_event_enqueue_burst(dev_id, rx_port_id, ev, nb_rx); if (nb_tx != nb_rx) { for(i = nb_tx; i < nb_rx; i++) rte_pktmbuf_free(mbufs[i]); @@ -325,7 +340,7 @@ the event to the next stage in the pipeline. int timeout = 0; struct rte_event events[BATCH_SIZE]; - uint16_t nb_rx = rte_event_dequeue_burst(dev_id, worker_port_id, events, BATCH_SIZE, timeout); + uint16_t nb_rx = rte_event_dequeue_burst(dev_id, worker_port_id1, events, BATCH_SIZE, timeout); for (i = 0; i < nb_rx; i++) { /* process mbuf using events[i].queue_id as pipeline stage */ @@ -334,7 +349,7 @@ the event to the next stage in the pipeline. events[i].queue_id++; } - uint16_t nb_tx = rte_event_enqueue_burst(dev_id, port_id, events, nb_rx); + uint16_t nb_tx = rte_event_enqueue_burst(dev_id, worker_port_id1, events, nb_rx); Egress of Events diff --git a/doc/guides/prog_guide/img/eventdev_usage.svg b/doc/guides/prog_guide/img/eventdev_usage.svg index 7765649..b0792dc 100644 --- a/doc/guides/prog_guide/img/eventdev_usage.svg +++ b/doc/guides/prog_guide/img/eventdev_usage.svg @@ -1,994 +1,546 @@ + + + + -image/svg+xml - - - - - - - - -- 2.7.4