get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/54260/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 54260,
    "url": "http://patches.dpdk.org/api/patches/54260/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/1559583160-13944-37-git-send-email-anoobj@marvell.com/",
    "project": {
        "id": 1,
        "url": "http://patches.dpdk.org/api/projects/1/?format=api",
        "name": "DPDK",
        "link_name": "dpdk",
        "list_id": "dev.dpdk.org",
        "list_email": "dev@dpdk.org",
        "web_url": "http://core.dpdk.org",
        "scm_url": "git://dpdk.org/dpdk",
        "webscm_url": "http://git.dpdk.org/dpdk",
        "list_archive_url": "https://inbox.dpdk.org/dev",
        "list_archive_url_format": "https://inbox.dpdk.org/dev/{}",
        "commit_url_format": ""
    },
    "msgid": "<1559583160-13944-37-git-send-email-anoobj@marvell.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1559583160-13944-37-git-send-email-anoobj@marvell.com",
    "date": "2019-06-03T17:32:36",
    "name": "[36/39] examples/l2fwd-event: add eventmode for l2fwd",
    "commit_ref": null,
    "pull_url": null,
    "state": "changes-requested",
    "archived": true,
    "hash": "98544630d461089c8c09807797767d573be6a08f",
    "submitter": {
        "id": 1205,
        "url": "http://patches.dpdk.org/api/people/1205/?format=api",
        "name": "Anoob Joseph",
        "email": "anoobj@marvell.com"
    },
    "delegate": {
        "id": 310,
        "url": "http://patches.dpdk.org/api/users/310/?format=api",
        "username": "jerin",
        "first_name": "Jerin",
        "last_name": "Jacob",
        "email": "jerinj@marvell.com"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/1559583160-13944-37-git-send-email-anoobj@marvell.com/mbox/",
    "series": [
        {
            "id": 4868,
            "url": "http://patches.dpdk.org/api/series/4868/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=4868",
            "date": "2019-06-03T17:32:00",
            "name": "adding eventmode helper library",
            "version": 1,
            "mbox": "http://patches.dpdk.org/series/4868/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/54260/comments/",
    "check": "fail",
    "checks": "http://patches.dpdk.org/api/patches/54260/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-Original-To": "patchwork@dpdk.org",
        "Delivered-To": "patchwork@dpdk.org",
        "Received": [
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id CF7691BC12;\n\tMon,  3 Jun 2019 19:37:11 +0200 (CEST)",
            "from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com\n\t[67.231.148.174]) by dpdk.org (Postfix) with ESMTP id 58B2D1BB12\n\tfor <dev@dpdk.org>; Mon,  3 Jun 2019 19:37:08 +0200 (CEST)",
            "from pps.filterd (m0045849.ppops.net [127.0.0.1])\n\tby mx0a-0016f401.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id\n\tx53HKlnN000910; Mon, 3 Jun 2019 10:37:07 -0700",
            "from sc-exch03.marvell.com ([199.233.58.183])\n\tby mx0a-0016f401.pphosted.com with ESMTP id 2sw2wmhdvh-4\n\t(version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); \n\tMon, 03 Jun 2019 10:37:07 -0700",
            "from SC-EXCH03.marvell.com (10.93.176.83) by SC-EXCH03.marvell.com\n\t(10.93.176.83) with Microsoft SMTP Server (TLS) id 15.0.1367.3;\n\tMon, 3 Jun 2019 10:37:04 -0700",
            "from maili.marvell.com (10.93.176.43) by SC-EXCH03.marvell.com\n\t(10.93.176.83) with Microsoft SMTP Server id 15.0.1367.3 via Frontend\n\tTransport; Mon, 3 Jun 2019 10:37:01 -0700",
            "from ajoseph83.caveonetworks.com.com (unknown [10.29.45.56])\n\tby maili.marvell.com (Postfix) with ESMTP id 73BFE3F7040;\n\tMon,  3 Jun 2019 10:36:56 -0700 (PDT)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com;\n\th=from : to : cc :\n\tsubject : date : message-id : in-reply-to : references : mime-version\n\t: content-transfer-encoding : content-type; s=pfpt0818;\n\tbh=Wkq+T8i12t0NwIngB7HbSjBkXnS9mZZseBf5Ow/dXcE=;\n\tb=kC7gtNbdhVQNPS/bMgD2QCrfQANSD22zkzbM/8gz06pdavyViOB7Ke8c7rWyyvYowglG\n\t7heSxFVNVD1Fr5FWilRAr199kwle0Oh6USMV6oIL8MYqbWEvYdvj1uCIeO+pmpNVFace\n\tIUUZBPFB7bHaZ4+nqQmEHM1c8yCcNunSj+oJ6nln8m4gEEdx0oq5NtAckUoHBPAszL6/\n\tuG6IBWqBuvD27H5kPtGSGQrcik+3YNHi94vPirgiExxeK+acK5k29KA5Gymd3eoEqmcd\n\t20JTbgbjRMBAiOqxdMH3JITP5X9GrevEz0Im/8xFquoexXI/6Bw8rpS1Di1gvlNgZfjh\n\t1Q== ",
        "From": "Anoob Joseph <anoobj@marvell.com>",
        "To": "Jerin Jacob <jerinj@marvell.com>, Nikhil Rao <nikhil.rao@intel.com>,\n\t\"Erik Gabriel Carrillo\" <erik.g.carrillo@intel.com>, Abhinandan Gujjar\n\t<abhinandan.gujjar@intel.com>,\n\tBruce Richardson <bruce.richardson@intel.com>,\n\tPablo de Lara <pablo.de.lara.guarch@intel.com>",
        "CC": "Anoob Joseph <anoobj@marvell.com>, Narayana Prasad <pathreya@marvell.com>,\n\t<dev@dpdk.org>, Lukasz Bartosik <lbartosik@marvell.com>, Pavan Nikhilesh\n\t<pbhagavatula@marvell.com>, Hemant Agrawal <hemant.agrawal@nxp.com>,\n\t\"Nipun  Gupta\" <nipun.gupta@nxp.com>, Harry van Haaren\n\t<harry.van.haaren@intel.com>, =?utf-8?q?Mattias_R=C3=B6nnblom?=\n\t<mattias.ronnblom@ericsson.com>,  Liang Ma <liang.j.ma@intel.com>",
        "Date": "Mon, 3 Jun 2019 23:02:36 +0530",
        "Message-ID": "<1559583160-13944-37-git-send-email-anoobj@marvell.com>",
        "X-Mailer": "git-send-email 2.7.4",
        "In-Reply-To": "<1559583160-13944-1-git-send-email-anoobj@marvell.com>",
        "References": "<1559583160-13944-1-git-send-email-anoobj@marvell.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Content-Type": "text/plain",
        "X-Proofpoint-Virus-Version": "vendor=fsecure engine=2.50.10434:, ,\n\tdefinitions=2019-06-03_13:, , signatures=0",
        "Subject": "[dpdk-dev] [PATCH 36/39] examples/l2fwd-event: add eventmode for\n\tl2fwd",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.15",
        "Precedence": "list",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "List-Archive": "<http://mails.dpdk.org/archives/dev/>",
        "List-Post": "<mailto:dev@dpdk.org>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "List-Subscribe": "<https://mails.dpdk.org/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "Adding eventmode support in l2fwd. This uses rte_eventmode_helper APIs\nto setup and use the eventmode capabilties.\n\nAdding non-burst no Tx internal-port eventmode worker.\n\nSigned-off-by: Anoob Joseph <anoobj@marvell.com>\nSigned-off-by: Lukasz Bartosik <lbartosik@marvell.com>\n---\n examples/l2fwd-event/Makefile       |   1 +\n examples/l2fwd-event/l2fwd_worker.c | 314 ++++++++++++++++++++++++++++++++++--\n examples/l2fwd-event/main.c         |  64 ++++++--\n examples/l2fwd-event/meson.build    |   2 +\n 4 files changed, 360 insertions(+), 21 deletions(-)",
    "diff": "diff --git a/examples/l2fwd-event/Makefile b/examples/l2fwd-event/Makefile\nindex d6bdb9e..dbb793f 100644\n--- a/examples/l2fwd-event/Makefile\n+++ b/examples/l2fwd-event/Makefile\n@@ -49,6 +49,7 @@ RTE_TARGET ?= x86_64-native-linuxapp-gcc\n \n include $(RTE_SDK)/mk/rte.vars.mk\n \n+CFLAGS += -DALLOW_EXPERIMENTAL_API\n CFLAGS += -O3\n CFLAGS += $(WERROR_FLAGS)\n \ndiff --git a/examples/l2fwd-event/l2fwd_worker.c b/examples/l2fwd-event/l2fwd_worker.c\nindex 1a7ee2b..92eae02 100644\n--- a/examples/l2fwd-event/l2fwd_worker.c\n+++ b/examples/l2fwd-event/l2fwd_worker.c\n@@ -25,15 +25,38 @@\n #include <rte_branch_prediction.h>\n #include <rte_ether.h>\n #include <rte_ethdev.h>\n+#include <rte_eventdev.h>\n+#include <rte_eventmode_helper.h>\n+#include <rte_malloc.h>\n #include <rte_mbuf.h>\n \n #include \"l2fwd_common.h\"\n #include \"l2fwd_worker.h\"\n \n+/* Reset eth stats */\n+static void\n+reset_eth_stats(int is_master_core)\n+{\n+\tint portid;\n+\n+\t/* Only master core need to do this */\n+\tif (!is_master_core)\n+\t\treturn;\n+\n+\t/* Reset stats */\n+\tfor (portid = 0; portid < RTE_MAX_ETHPORTS; portid++) {\n+\t\t/* skip disabled ports */\n+\t\tif ((l2fwd_enabled_port_mask & (1 << portid)) == 0)\n+\t\t\tcontinue;\n+\t\trte_eth_stats_reset(portid);\n+\t}\n+}\n+\n /* Print out statistics on packets dropped */\n static void\n print_stats(void)\n {\n+\tstruct rte_eth_stats stats;\n \tuint64_t total_packets_dropped, total_packets_tx, total_packets_rx;\n \tunsigned int portid;\n \n@@ -53,19 +76,21 @@ print_stats(void)\n \t\t/* skip disabled ports */\n \t\tif ((l2fwd_enabled_port_mask & (1 << portid)) == 0)\n \t\t\tcontinue;\n+\t\trte_eth_stats_get(portid, &stats);\n \t\tprintf(\"\\nStatistics for port %u ------------------------------\"\n \t\t\t   \"\\nPackets sent: %24\"PRIu64\n \t\t\t   \"\\nPackets received: %20\"PRIu64\n \t\t\t   \"\\nPackets dropped: %21\"PRIu64,\n \t\t\t   portid,\n-\t\t\t   port_statistics[portid].tx,\n-\t\t\t   port_statistics[portid].rx,\n-\t\t\t   port_statistics[portid].dropped);\n+\t\t\t   stats.opackets,\n+\t\t\t   stats.ipackets,\n+\t\t\t   stats.oerrors);\n \n-\t\ttotal_packets_dropped += port_statistics[portid].dropped;\n-\t\ttotal_packets_tx += port_statistics[portid].tx;\n-\t\ttotal_packets_rx += port_statistics[portid].rx;\n+\t\ttotal_packets_dropped += stats.oerrors;\n+\t\ttotal_packets_tx += stats.opackets;\n+\t\ttotal_packets_rx += stats.ipackets;\n \t}\n+\n \tprintf(\"\\nAggregate statistics ===============================\"\n \t\t   \"\\nTotal packets sent: %18\"PRIu64\n \t\t   \"\\nTotal packets received: %14\"PRIu64\n@@ -138,6 +163,16 @@ l2fwd_periodic_drain_stats_monitor(struct lcore_queue_conf *qconf,\n \t}\n }\n \n+static inline void\n+l2fwd_drain_loop(struct lcore_queue_conf *qconf, struct tsc_tracker *t,\n+\t\tint is_master_core)\n+{\n+\twhile (!force_quit) {\n+\t\t/* Do periodic operations (buffer drain & stats monitor) */\n+\t\tl2fwd_periodic_drain_stats_monitor(qconf, t, is_master_core);\n+\t}\n+}\n+\n static void\n l2fwd_mac_updating(struct rte_mbuf *m, unsigned int dest_portid)\n {\n@@ -180,9 +215,40 @@ l2fwd_simple_forward(struct rte_mbuf *m, unsigned int portid)\n \tl2fwd_send_pkt(m, dst_port);\n }\n \n-/* main processing loop */\n+static inline void\n+l2fwd_event_pre_forward(struct rte_event *ev, unsigned int portid)\n+{\n+\tunsigned int dst_port;\n+\tstruct rte_mbuf *m;\n+\n+\t/* Get the mbuf */\n+\tm = ev->mbuf;\n+\n+\t/* Get the destination port from the tables */\n+\tdst_port = l2fwd_dst_ports[portid];\n+\n+\t/* Save the destination port in the mbuf */\n+\tm->port = dst_port;\n+\n+\t/* Use tx queue 0 */\n+\trte_event_eth_tx_adapter_txq_set(m, 0);\n+\n+\t/* Perform work */\n+\tif (mac_updating)\n+\t\tl2fwd_mac_updating(m, dst_port);\n+}\n+\n+static inline void\n+l2fwd_event_switch_to_tx_queue(struct rte_event *ev, uint8_t tx_queue_id)\n+{\n+\tev->event_type = RTE_EVENT_TYPE_CPU;\n+\tev->op = RTE_EVENT_OP_FORWARD;\n+\tev->queue_id = tx_queue_id;\n+}\n+\n+/* poll mode processing loop */\n static void\n-l2fwd_main_loop(void)\n+l2fwd_poll_mode_worker(void)\n {\n \tstruct rte_mbuf *pkts_burst[MAX_PKT_BURST];\n \tstruct rte_mbuf *m;\n@@ -242,9 +308,237 @@ l2fwd_main_loop(void)\n \t}\n }\n \n+/*\n+ * Event mode exposes various operating modes depending on the\n+ * capabilities of the event device and the operating mode\n+ * selected.\n+ */\n+\n+/* Workers registered */\n+#define L2FWD_EVENTMODE_WORKERS\t\t1\n+\n+/*\n+ * Event mode worker\n+ * Operating mode : non-burst no internal port (regular tx worker)\n+ */\n+static void\n+l2fwd_eventmode_non_burst_no_internal_port(void *args)\n+{\n+\tstruct rte_event ev;\n+\tstruct rte_mbuf *pkt;\n+\tstruct rte_eventmode_helper_conf *mode_conf;\n+\tstruct rte_eventmode_helper_event_link_info *links = NULL;\n+\tunsigned int lcore_nb_link = 0;\n+\tuint32_t lcore_id;\n+\tunsigned int i, nb_rx = 0;\n+\tunsigned int portid;\n+\tstruct lcore_queue_conf *qconf;\n+\tint is_master_core;\n+\tstruct tsc_tracker tsc = {0};\n+\tuint8_t tx_queue;\n+\n+\t/* Get core ID */\n+\tlcore_id = rte_lcore_id();\n+\n+\tRTE_LOG(INFO, L2FWD,\n+\t\t\"Launching event mode non-burst worker no internal port \"\n+\t\t\"(regular tx worker) on lcore %d\\n\", lcore_id);\n+\n+\t/* Set the flag if master core */\n+\tis_master_core = (lcore_id == rte_get_master_lcore()) ? 1 : 0;\n+\n+\t/* Get qconf for this core */\n+\tqconf = &lcore_queue_conf[lcore_id];\n+\n+\t/* Set drain tsc */\n+\ttsc.drain_tsc = (rte_get_tsc_hz() + US_PER_S - 1) /\n+\t\t\tUS_PER_S * BURST_TX_DRAIN_US;\n+\n+\t/* Mode conf will be passed as args */\n+\tmode_conf = (struct rte_eventmode_helper_conf *)args;\n+\n+\t/* Get the links configured for this lcore */\n+\tlcore_nb_link = rte_eventmode_helper_get_event_lcore_links(lcore_id,\n+\t\t\tmode_conf, &links);\n+\n+\t/* Check if we have links registered for this lcore */\n+\tif (lcore_nb_link == 0) {\n+\t\t/* No links registered. The core could do periodic drains */\n+\t\tl2fwd_drain_loop(qconf, &tsc, is_master_core);\n+\t\tgoto clean_and_exit;\n+\t}\n+\n+\t/* We have valid links */\n+\n+\t/* Reset stats before proceeding */\n+\treset_eth_stats(is_master_core);\n+\n+\t/*\n+\t * There is no internal port between ethdev and eventdev. So the worker\n+\t * thread needs to submit event to a designated tx queue. Internally\n+\t * eth core would receive events from multiple worker threads and send\n+\t * out packets on wire.\n+\t */\n+\ttx_queue = rte_eventmode_helper_get_tx_queue(mode_conf,\n+\t\t\t\t\t\t     links[0].eventdev_id);\n+\t/* See if it's single link */\n+\tif (lcore_nb_link == 1)\n+\t\tgoto single_link_loop;\n+\telse\n+\t\tgoto multi_link_loop;\n+\n+single_link_loop:\n+\n+\tRTE_LOG(INFO, L2FWD, \" -- lcoreid=%u event_port_id=%u\\n\", lcore_id,\n+\t\t\tlinks[0].event_portid);\n+\n+\twhile (!force_quit) {\n+\n+\t\t/* Do periodic operations (buffer drain & stats monitor) */\n+\t\tl2fwd_periodic_drain_stats_monitor(qconf, &tsc, is_master_core);\n+\n+\t\t/* Read packet from event queues */\n+\t\tnb_rx = rte_event_dequeue_burst(links[0].eventdev_id,\n+\t\t\t\tlinks[0].event_portid,\n+\t\t\t\t&ev,\t/* events */\n+\t\t\t\t1,\t/* nb_events */\n+\t\t\t\t0\t/* timeout_ticks */);\n+\n+\t\tif (nb_rx == 0)\n+\t\t\tcontinue;\n+\n+\t\tportid = ev.queue_id;\n+\t\tport_statistics[portid].rx++;\n+\t\tpkt = ev.mbuf;\n+\n+\t\trte_prefetch0(rte_pktmbuf_mtod(pkt, void *));\n+\n+\t\t/* Process packet */\n+\t\tl2fwd_event_pre_forward(&ev, portid);\n+\n+\t\t/*\n+\t\t * Internal port is not available, the packet needs\n+\t\t * to be enqueued to the designated event queue.\n+\t\t */\n+\n+\t\t/* Prepare event for submission to tx event queue */\n+\t\tl2fwd_event_switch_to_tx_queue(&ev, tx_queue);\n+\n+\t\t/* Submit the updated event for tx stage */\n+\t\trte_event_enqueue_burst(links[0].eventdev_id,\n+\t\t\t\tlinks[0].event_portid,\n+\t\t\t\t&ev,\t/* events */\n+\t\t\t\t1\t/* nb_events */);\n+\t}\n+\tgoto clean_and_exit;\n+\n+multi_link_loop:\n+\n+\tfor (i = 0; i < lcore_nb_link; i++) {\n+\t\tRTE_LOG(INFO, L2FWD, \" -- lcoreid=%u event_port_id=%u\\n\",\n+\t\t\t\tlcore_id, links[i].event_portid);\n+\t}\n+\n+\twhile (!force_quit) {\n+\n+\t\t/* Do periodic operations (buffer drain & stats monitor) */\n+\t\tl2fwd_periodic_drain_stats_monitor(qconf, &tsc, is_master_core);\n+\n+\t\tfor (i = 0; i < lcore_nb_link; i++) {\n+\t\t\t/* Read packet from event queues */\n+\t\t\tnb_rx = rte_event_dequeue_burst(links[i].eventdev_id,\n+\t\t\t\t\tlinks[i].event_portid,\n+\t\t\t\t\t&ev,\t/* events */\n+\t\t\t\t\t1,\t/* nb_events */\n+\t\t\t\t\t0\t/* timeout_ticks */);\n+\n+\t\t\tif (nb_rx == 0)\n+\t\t\t\tcontinue;\n+\n+\t\t\tportid = ev.queue_id;\n+\t\t\tport_statistics[portid].rx++;\n+\t\t\tpkt = ev.mbuf;\n+\n+\t\t\trte_prefetch0(rte_pktmbuf_mtod(pkt, void *));\n+\n+\t\t\t/* Process packet */\n+\t\t\tl2fwd_event_pre_forward(&ev, portid);\n+\n+\t\t\t/*\n+\t\t\t * Internal port is not available, the packet needs\n+\t\t\t * to be enqueued to the designated event queue.\n+\t\t\t */\n+\n+\t\t\t/* Prepare event for submission to tx event queue */\n+\t\t\tl2fwd_event_switch_to_tx_queue(&ev, tx_queue);\n+\n+\t\t\t/* Submit the updated event for tx stage */\n+\t\t\trte_event_enqueue_burst(links[i].eventdev_id,\n+\t\t\t\t\tlinks[i].event_portid,\n+\t\t\t\t\t&ev,\t/* events */\n+\t\t\t\t\t1\t/* nb_events */);\n+\t\t}\n+\t}\n+\tgoto clean_and_exit;\n+\n+clean_and_exit:\n+\tif (links != NULL)\n+\t\trte_free(links);\n+}\n+\n+static uint8_t\n+l2fwd_eventmode_populate_wrkr_params(\n+\t\tstruct rte_eventmode_helper_app_worker_params *wrkrs)\n+{\n+\tuint8_t nb_wrkr_param = 0;\n+\tstruct rte_eventmode_helper_app_worker_params *wrkr;\n+\n+\t/* Save workers */\n+\twrkr = wrkrs;\n+\n+\t/* Non-burst no internal port (regular tx worker) */\n+\twrkr->cap.burst = RTE_EVENTMODE_HELPER_RX_TYPE_NON_BURST;\n+\twrkr->cap.tx_internal_port =\n+\t\t\tRTE_EVENTMODE_HELPER_TX_TYPE_NO_INTERNAL_PORT;\n+\twrkr->worker_thread = l2fwd_eventmode_non_burst_no_internal_port;\n+\n+\tnb_wrkr_param++;\n+\treturn nb_wrkr_param;\n+}\n+\n+static void\n+l2fwd_eventmode_worker(struct rte_eventmode_helper_conf *mode_conf)\n+{\n+\tstruct rte_eventmode_helper_app_worker_params\n+\t\t\tl2fwd_wrkr[L2FWD_EVENTMODE_WORKERS] = {\n+\t\t\t\t\t{{{0} }, NULL } };\n+\tuint8_t nb_wrkr_param;\n+\n+\t/* Populate l2fwd_wrkr params */\n+\tnb_wrkr_param = l2fwd_eventmode_populate_wrkr_params(l2fwd_wrkr);\n+\n+\t/*\n+\t * The helper function will launch the correct worker after checking the\n+\t * event device's capabilities.\n+\t */\n+\trte_eventmode_helper_launch_worker(mode_conf, l2fwd_wrkr,\n+\t\t\tnb_wrkr_param);\n+}\n+\n int\n-l2fwd_launch_one_lcore(__attribute__((unused)) void *dummy)\n+l2fwd_launch_one_lcore(void *args)\n {\n-\tl2fwd_main_loop();\n+\tstruct rte_eventmode_helper_conf *mode_conf;\n+\n+\tmode_conf = (struct rte_eventmode_helper_conf *)args;\n+\n+\tif (mode_conf->mode == RTE_EVENTMODE_HELPER_PKT_TRANSFER_MODE_POLL) {\n+\t\t/* App is initialized to run in poll mode */\n+\t\tl2fwd_poll_mode_worker();\n+\t} else if (mode_conf->mode ==\n+\t\t\tRTE_EVENTMODE_HELPER_PKT_TRANSFER_MODE_EVENT) {\n+\t\t/* App is initialized to run in event mode */\n+\t\tl2fwd_eventmode_worker(mode_conf);\n+\t}\n \treturn 0;\n }\ndiff --git a/examples/l2fwd-event/main.c b/examples/l2fwd-event/main.c\nindex 4e83b41..62228e6 100644\n--- a/examples/l2fwd-event/main.c\n+++ b/examples/l2fwd-event/main.c\n@@ -39,6 +39,7 @@\n #include <rte_ethdev.h>\n #include <rte_mempool.h>\n #include <rte_mbuf.h>\n+#include <rte_eventmode_helper.h>\n \n #include \"l2fwd_common.h\"\n #include \"l2fwd_worker.h\"\n@@ -68,6 +69,8 @@ l2fwd_usage(const char *prgname)\n \t\t\" [-q NQ]\",\n \t\tprgname);\n \n+\trte_eventmode_helper_print_options_list();\n+\n \tfprintf(stderr, \"\\n\\n\");\n \n \tfprintf(stderr,\n@@ -78,7 +81,9 @@ l2fwd_usage(const char *prgname)\n \t\t\"      When enabled:\\n\"\n \t\t\"       - The source MAC address is replaced by the TX port MAC address\\n\"\n \t\t\"       - The destination MAC address is replaced by 02:00:00:00:00:TX_PORT_ID\\n\"\n-\t\t\"\\n\");\n+\t\t\"\");\n+\n+\trte_eventmode_helper_print_options_description();\n }\n \n static int\n@@ -158,12 +163,14 @@ static const struct option lgopts[] = {\n \n /* Parse the argument given in the command line of the application */\n static int\n-l2fwd_parse_args(int argc, char **argv)\n+l2fwd_parse_args(int argc, char **argv,\n+\t\tstruct rte_eventmode_helper_conf **mode_conf)\n {\n-\tint opt, ret, timer_secs;\n+\tint opt, timer_secs;\n \tchar **argvopt;\n \tint option_index;\n \tchar *prgname = argv[0];\n+\tint options_parsed = 0;\n \n \targvopt = argv;\n \n@@ -212,12 +219,31 @@ l2fwd_parse_args(int argc, char **argv)\n \t\t}\n \t}\n \n-\tif (optind >= 0)\n-\t\targv[optind-1] = prgname;\n+\t/* Update argc & argv to move to event mode options */\n+\toptions_parsed = optind-1;\n+\targc -= options_parsed;\n+\targv += options_parsed;\n \n-\tret = optind-1;\n-\toptind = 1; /* reset getopt lib */\n-\treturn ret;\n+\t/* Reset getopt lib */\n+\toptind = 1;\n+\n+\t/* Check for event mode parameters and get the conf prepared*/\n+\t*mode_conf = rte_eventmode_helper_parse_args(argc, argv);\n+\tif (*mode_conf == NULL) {\n+\t\tl2fwd_usage(prgname);\n+\t\treturn -1;\n+\t}\n+\n+\t/* Add the number of options parsed */\n+\toptions_parsed += optind-1;\n+\n+\tif (options_parsed >= 0)\n+\t\targv[options_parsed] = prgname;\n+\n+\t/* Reset getopt lib */\n+\toptind = 1;\n+\n+\treturn options_parsed;\n }\n \n /* Check the link status of all ports in up to 9s, and print them finally */\n@@ -315,6 +341,7 @@ main(int argc, char **argv)\n \tunsigned int nb_ports_in_mask = 0;\n \tunsigned int nb_lcores = 0;\n \tunsigned int nb_mbufs;\n+\tstruct rte_eventmode_helper_conf *mode_conf = NULL;\n \n \t/* Set default values for global vars */\n \tl2fwd_init_global_vars();\n@@ -329,8 +356,12 @@ main(int argc, char **argv)\n \tsignal(SIGINT, signal_handler);\n \tsignal(SIGTERM, signal_handler);\n \n-\t/* parse application arguments (after the EAL ones) */\n-\tret = l2fwd_parse_args(argc, argv);\n+\t/*\n+\t * Parse application arguments (after the EAL ones). This would parse\n+\t * the event mode options too, and would set the conf pointer\n+\t * accordingly.\n+\t */\n+\tret = l2fwd_parse_args(argc, argv, &mode_conf);\n \tif (ret < 0)\n \t\trte_exit(EXIT_FAILURE, \"Invalid L2FWD arguments\\n\");\n \n@@ -519,9 +550,20 @@ main(int argc, char **argv)\n \n \tcheck_all_ports_link_status(l2fwd_enabled_port_mask);\n \n+\t/*\n+\t * Set the enabled port mask in helper conf to be used by helper\n+\t * sub-system. This would be used while intializing devices using\n+\t * helper sub-system.\n+\t */\n+\tmode_conf->eth_portmask = l2fwd_enabled_port_mask;\n+\n+\t/* Initialize eventmode components */\n+\trte_eventmode_helper_initialize_devs(mode_conf);\n+\n \tret = 0;\n \t/* launch per-lcore init on every lcore */\n-\trte_eal_mp_remote_launch(l2fwd_launch_one_lcore, NULL, CALL_MASTER);\n+\trte_eal_mp_remote_launch(l2fwd_launch_one_lcore, (void *)mode_conf,\n+\t\t\tCALL_MASTER);\n \tRTE_LCORE_FOREACH_SLAVE(lcore_id) {\n \t\tif (rte_eal_wait_lcore(lcore_id) < 0) {\n \t\t\tret = -1;\ndiff --git a/examples/l2fwd-event/meson.build b/examples/l2fwd-event/meson.build\nindex 1d2df49..10e6e66 100644\n--- a/examples/l2fwd-event/meson.build\n+++ b/examples/l2fwd-event/meson.build\n@@ -6,6 +6,8 @@\n # To build this example as a standalone application with an already-installed\n # DPDK instance, use 'make'\n \n+allow_experimental_apis = true\n+deps += ['eventdev']\n sources = files(\n \t'l2fwd_worker.c',\n \t'main.c'\n",
    "prefixes": [
        "36/39"
    ]
}