get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 60810,
    "url": "http://patches.dpdk.org/api/patches/60810/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/1570633816-4706-5-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": "<1570633816-4706-5-git-send-email-anoobj@marvell.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1570633816-4706-5-git-send-email-anoobj@marvell.com",
    "date": "2019-10-09T15:10:07",
    "name": "[RFC,04/13] examples/ipsec-secgw: add Tx adapter support",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "875d36607938ac5b9c40b58ede21c0c90e430cff",
    "submitter": {
        "id": 1205,
        "url": "http://patches.dpdk.org/api/people/1205/?format=api",
        "name": "Anoob Joseph",
        "email": "anoobj@marvell.com"
    },
    "delegate": {
        "id": 6690,
        "url": "http://patches.dpdk.org/api/users/6690/?format=api",
        "username": "akhil",
        "first_name": "akhil",
        "last_name": "goyal",
        "email": "gakhil@marvell.com"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/1570633816-4706-5-git-send-email-anoobj@marvell.com/mbox/",
    "series": [
        {
            "id": 6769,
            "url": "http://patches.dpdk.org/api/series/6769/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=6769",
            "date": "2019-10-09T15:10:03",
            "name": "add eventmode to ipsec-secgw",
            "version": 1,
            "mbox": "http://patches.dpdk.org/series/6769/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/60810/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/60810/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 3725A1E90C;\n\tWed,  9 Oct 2019 17:10:54 +0200 (CEST)",
            "from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com\n\t[67.231.148.174]) by dpdk.org (Postfix) with ESMTP id 53F221C214\n\tfor <dev@dpdk.org>; Wed,  9 Oct 2019 17:10:52 +0200 (CEST)",
            "from pps.filterd (m0045849.ppops.net [127.0.0.1])\n\tby mx0a-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id\n\tx99Et1V3020519; Wed, 9 Oct 2019 08:10:51 -0700",
            "from sc-exch03.marvell.com ([199.233.58.183])\n\tby mx0a-0016f401.pphosted.com with ESMTP id 2vh5rqjkkp-1\n\t(version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); \n\tWed, 09 Oct 2019 08:10:51 -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\tWed, 9 Oct 2019 08:10:50 -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; Wed, 9 Oct 2019 08:10:50 -0700",
            "from ajoseph83.caveonetworks.com.com (unknown [10.29.45.60])\n\tby maili.marvell.com (Postfix) with ESMTP id 148F13F703F;\n\tWed,  9 Oct 2019 08:10:46 -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=UJ0E4m4KrcoZp0oD4uRLhLVMThHERNP8+F3q+bkwl94=;\n\tb=v8FbNAMN/iv9Ct29Hu4HUw90v1qvV9gY4NQlthZXOVWCHmAVOOhwoCBuRsFxTgDNbqno\n\t3rxO703JFIbV3r1tGnDJN76ffwsU/FgSG2IbOmC/SSG/72VduEmT6hIFATTcs3Y0V86y\n\tHe3UI18xkwlxOCvyVbNeieYsJau4Ef2NSjA6VAbTti7OY4aJ2BZz9etEgmvumwxX3dof\n\tqj9ezNc0Zxuc5+/KJjtrilE6nlzLz/nMrvZcB50sxh1safNe0p+WiinQe7w4dNEECNFY\n\t0McDpmwq0zCa+nONgiAVxDho93Xoc0pZER2MuIteVjWavR+GFdvgJwMpKIIvm089b/50\n\tRA== ",
        "From": "Anoob Joseph <anoobj@marvell.com>",
        "To": "Akhil Goyal <akhil.goyal@nxp.com>, Radu Nicolau <radu.nicolau@intel.com>",
        "CC": "Anoob Joseph <anoobj@marvell.com>, Thomas Monjalon <thomas@monjalon.net>,\n\tJerin Jacob <jerinj@marvell.com>,\n\tNarayana Prasad <pathreya@marvell.com>, <dev@dpdk.org>,\n\tLukasz Bartosik <lbartosik@marvell.com>",
        "Date": "Wed, 9 Oct 2019 20:40:07 +0530",
        "Message-ID": "<1570633816-4706-5-git-send-email-anoobj@marvell.com>",
        "X-Mailer": "git-send-email 2.7.4",
        "In-Reply-To": "<1570633816-4706-1-git-send-email-anoobj@marvell.com>",
        "References": "<1570633816-4706-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:6.0.95,1.0.8\n\tdefinitions=2019-10-09_06:2019-10-08,2019-10-09 signatures=0",
        "Subject": "[dpdk-dev] [RFC PATCH 04/13] examples/ipsec-secgw: add Tx adapter\n\tsupport",
        "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": "Add Tx adapter support. The event helper init routine will initialize\nthe Tx adapter according to the configuration. If Tx adapter config\nis not present it will generate a default config.\n\nSigned-off-by: Anoob Joseph <anoobj@marvell.com>\nSigned-off-by: Lukasz Bartosik <lbartosik@marvell.com>\n---\n examples/ipsec-secgw/event_helper.c | 375 +++++++++++++++++++++++++++++++++++-\n examples/ipsec-secgw/event_helper.h |  58 ++++++\n 2 files changed, 424 insertions(+), 9 deletions(-)",
    "diff": "diff --git a/examples/ipsec-secgw/event_helper.c b/examples/ipsec-secgw/event_helper.c\nindex b5417a0..7745fbb 100644\n--- a/examples/ipsec-secgw/event_helper.c\n+++ b/examples/ipsec-secgw/event_helper.c\n@@ -2,31 +2,58 @@\n  * Copyright (C) 2019 Marvell International Ltd.\n  */\n #include <rte_event_eth_rx_adapter.h>\n+#include <rte_event_eth_tx_adapter.h>\n #include <rte_ethdev.h>\n #include <rte_bitmap.h>\n #include <rte_malloc.h>\n \n #include \"event_helper.h\"\n \n+static int\n+eh_get_enabled_cores(struct rte_bitmap *eth_core_mask)\n+{\n+\tint i;\n+\tint count = 0;\n+\n+\tRTE_LCORE_FOREACH(i) {\n+\t\t/* Check if this core is enabled in core_mask*/\n+\t\tif (rte_bitmap_get(eth_core_mask, i)) {\n+\t\t\t/* We have enabled core */\n+\t\t\tcount++;\n+\t\t}\n+\t}\n+\treturn count;\n+}\n+\n static inline unsigned int\n-eh_get_next_rx_core(struct eventmode_conf *em_conf,\n-\t\tunsigned int prev_core)\n+eh_get_next_eth_core(struct eventmode_conf *em_conf)\n {\n \tunsigned int next_core;\n+\tstatic unsigned int prev_core = -1;\n+\n+\t/*\n+\t * Make sure we have atleast one eth core running, else the following\n+\t * logic would lead to an infinite loop.\n+\t */\n+\tif (eh_get_enabled_cores(em_conf->eth_core_mask) == 0) {\n+\t\tEH_LOG_ERR(\"No enabled eth core found\");\n+\t\treturn RTE_MAX_LCORE;\n+\t}\n \n get_next_core:\n \t/* Get the next core */\n-\tnext_core = rte_get_next_lcore(prev_core, 0, 0);\n+\tnext_core = rte_get_next_lcore(prev_core, 0, 1);\n \n \t/* Check if we have reached max lcores */\n \tif (next_core == RTE_MAX_LCORE)\n \t\treturn next_core;\n \n-\t/* Only some cores would be marked as rx cores. Skip others */\n-\tif (!(rte_bitmap_get(em_conf->eth_core_mask, next_core))) {\n-\t\tprev_core = next_core;\n+\t/* Update prev_core */\n+\tprev_core = next_core;\n+\n+\t/* Only some cores would be marked as eth cores. Skip others */\n+\tif (!(rte_bitmap_get(em_conf->eth_core_mask, next_core)))\n \t\tgoto get_next_core;\n-\t}\n \n \treturn next_core;\n }\n@@ -45,7 +72,7 @@ eh_get_next_active_core(struct eventmode_conf *em_conf,\n \tif (next_core == RTE_MAX_LCORE)\n \t\treturn next_core;\n \n-\t/* Some cores would be reserved as rx cores. Skip them */\n+\t/* Some cores would be reserved as eth cores. Skip them */\n \tif (rte_bitmap_get(em_conf->eth_core_mask, next_core)) {\n \t\tprev_core = next_core;\n \t\tgoto get_next_core;\n@@ -54,6 +81,23 @@ eh_get_next_active_core(struct eventmode_conf *em_conf,\n \treturn next_core;\n }\n \n+static struct eventdev_params *\n+eh_get_eventdev_params(struct eventmode_conf *em_conf,\n+\t\tuint8_t eventdev_id)\n+{\n+\tint i;\n+\n+\tfor (i = 0; i < em_conf->nb_eventdev; i++) {\n+\t\tif (em_conf->eventdev_config[i].eventdev_id == eventdev_id)\n+\t\t\tbreak;\n+\t}\n+\n+\t/* No match */\n+\tif (i == em_conf->nb_eventdev)\n+\t\treturn NULL;\n+\n+\treturn &(em_conf->eventdev_config[i]);\n+}\n static int\n eh_validate_user_params(struct eventmode_conf *em_conf)\n {\n@@ -224,7 +268,7 @@ eh_set_default_conf_rx_adapter(struct eventmode_conf *em_conf)\n \t/* Set adapter conf */\n \tadapter->eventdev_id = eventdev_id;\n \tadapter->adapter_id = adapter_id;\n-\tadapter->rx_core_id = eh_get_next_rx_core(em_conf, -1);\n+\tadapter->rx_core_id = eh_get_next_eth_core(em_conf);\n \n \t/*\n \t * All queues of one eth device (port) will be mapped to one event\n@@ -271,6 +315,100 @@ eh_set_default_conf_rx_adapter(struct eventmode_conf *em_conf)\n }\n \n static int\n+eh_set_default_conf_tx_adapter(struct eventmode_conf *em_conf)\n+{\n+\tint nb_eth_dev;\n+\tint eventdev_id;\n+\tint adapter_id;\n+\tint i;\n+\tint conn_id;\n+\tstruct eventdev_params *eventdev_config;\n+\tstruct tx_adapter_conf *tx_adapter;\n+\tstruct tx_adapter_connection_info *conn;\n+\n+\t/*\n+\t * Create one Tx adapter with all eth queues mapped to event queues\n+\t * 1:1.\n+\t */\n+\n+\tif (em_conf->nb_eventdev == 0) {\n+\t\tEH_LOG_ERR(\"No event devs registered\");\n+\t\treturn -EINVAL;\n+\t}\n+\n+\t/* Get the number of eth devs */\n+\tnb_eth_dev = rte_eth_dev_count_avail();\n+\n+\t/* Use the first event dev */\n+\teventdev_config = &(em_conf->eventdev_config[0]);\n+\n+\t/* Get eventdev ID */\n+\teventdev_id = eventdev_config->eventdev_id;\n+\tadapter_id = 0;\n+\n+\t/* Get adapter conf */\n+\ttx_adapter = &(em_conf->tx_adapter[adapter_id]);\n+\n+\t/* Set adapter conf */\n+\ttx_adapter->eventdev_id = eventdev_id;\n+\ttx_adapter->adapter_id = adapter_id;\n+\n+\t/* TODO: Tx core is required only when internal port is not present */\n+\n+\ttx_adapter->tx_core_id = eh_get_next_eth_core(em_conf);\n+\n+\t/*\n+\t * Application would need to use one event queue per adapter for\n+\t * submitting packets for Tx. Reserving the last queue available\n+\t * and decrementing the total available event queues for this\n+\t */\n+\n+\t/* Queue numbers start at 0 */\n+\ttx_adapter->tx_ev_queue = eventdev_config->nb_eventqueue - 1;\n+\n+\t/* Update the number of event queues available in eventdev */\n+\teventdev_config->nb_eventqueue--;\n+\n+\t/*\n+\t * All Tx queues of the eth device (port) will be mapped to the event\n+\t * device.\n+\t */\n+\n+\t/* Set defaults for connections */\n+\n+\t/*\n+\t * One eth device (port) would be one connection. All Tx queues of\n+\t * the device would be mapped to the Tx adapter.\n+\t */\n+\n+\tfor (i = 0; i < nb_eth_dev; i++) {\n+\n+\t\t/* Use only the ports enabled */\n+\t\tif ((em_conf->eth_portmask & (1 << i)) == 0)\n+\t\t\tcontinue;\n+\n+\t\t/* Get the connection id */\n+\t\tconn_id = tx_adapter->nb_connections;\n+\n+\t\t/* Get the connection */\n+\t\tconn = &(tx_adapter->conn[conn_id]);\n+\n+\t\t/* Add ethdev to connections */\n+\t\tconn->ethdev_id = i;\n+\n+\t\t/* Add all eth tx queues to adapter */\n+\t\tconn->ethdev_tx_qid = -1;\n+\n+\t\t/* Update no of connections */\n+\t\ttx_adapter->nb_connections++;\n+\t}\n+\n+\t/* We have setup one adapter */\n+\tem_conf->nb_tx_adapter = 1;\n+\treturn 0;\n+}\n+\n+static int\n eh_validate_conf(struct eventmode_conf *em_conf)\n {\n \tint ret;\n@@ -310,6 +448,16 @@ eh_validate_conf(struct eventmode_conf *em_conf)\n \t\t\treturn ret;\n \t}\n \n+\t/*\n+\t * See if tx adapters are specified. Else generate a default conf\n+\t * with one tx adapter.\n+\t */\n+\tif (em_conf->nb_tx_adapter == 0) {\n+\t\tret = eh_set_default_conf_tx_adapter(em_conf);\n+\t\tif (ret != 0)\n+\t\t\treturn ret;\n+\t}\n+\n \treturn 0;\n }\n \n@@ -579,6 +727,147 @@ eh_initialize_rx_adapter(struct eventmode_conf *em_conf)\n \treturn 0;\n }\n \n+static int\n+eh_tx_adapter_configure(struct eventmode_conf *em_conf,\n+\tstruct tx_adapter_conf *adapter)\n+{\n+\tint ret, j;\n+\tuint8_t tx_port_id = 0;\n+\tuint8_t eventdev_id;\n+\tuint32_t service_id;\n+\tstruct rte_event_port_conf port_conf = {0};\n+\tstruct rte_event_dev_info evdev_default_conf = {0};\n+\tstruct tx_adapter_connection_info *conn;\n+\tstruct eventdev_params *eventdev_config;\n+\n+\t/* Get event dev ID */\n+\teventdev_id = adapter->eventdev_id;\n+\n+\t/* Get event device conf */\n+\teventdev_config = eh_get_eventdev_params(em_conf, eventdev_id);\n+\n+\t/* Create Tx adapter */\n+\n+\t/* Get default configuration of event dev */\n+\tret = rte_event_dev_info_get(eventdev_id, &evdev_default_conf);\n+\tif (ret < 0) {\n+\t\tEH_LOG_ERR(\"Error in getting event device info[devID:%d]\",\n+\t\t\teventdev_id);\n+\t\treturn ret;\n+\t}\n+\n+\t/* Setup port conf */\n+\tport_conf.new_event_threshold =\n+\t\t\tevdev_default_conf.max_num_events;\n+\tport_conf.dequeue_depth =\n+\t\t\tevdev_default_conf.max_event_port_dequeue_depth;\n+\tport_conf.enqueue_depth =\n+\t\t\tevdev_default_conf.max_event_port_enqueue_depth;\n+\n+\t/* Create Tx adapter */\n+\tret = rte_event_eth_tx_adapter_create(adapter->adapter_id,\n+\t\t\tadapter->eventdev_id,\n+\t\t\t&port_conf);\n+\tif (ret < 0) {\n+\t\tEH_LOG_ERR(\"Error in Tx adapter creation\");\n+\t\treturn ret;\n+\t}\n+\n+\t/* Setup various connections in the adapter */\n+\tfor (j = 0; j < adapter->nb_connections; j++) {\n+\n+\t\t/* Get connection */\n+\t\tconn = &(adapter->conn[j]);\n+\n+\t\t/* Add queue to the adapter */\n+\t\tret = rte_event_eth_tx_adapter_queue_add(\n+\t\t\t\tadapter->adapter_id,\n+\t\t\t\tconn->ethdev_id,\n+\t\t\t\tconn->ethdev_tx_qid);\n+\t\tif (ret < 0) {\n+\t\t\tEH_LOG_ERR(\"Error in adding eth queue in Tx adapter\");\n+\t\t\treturn ret;\n+\t\t}\n+\t}\n+\n+\t/* Get event port used by the adapter */\n+\tret = rte_event_eth_tx_adapter_event_port_get(\n+\t\t\tadapter->adapter_id,\n+\t\t\t&tx_port_id);\n+\tif (ret) {\n+\t\tEH_LOG_ERR(\"Failed to get Tx adapter port ID\");\n+\t\treturn ret;\n+\t}\n+\n+\t/*\n+\t * TODO: event queue for Tx adapter is required only if the\n+\t * INTERNAL PORT is not present.\n+\t */\n+\n+\t/*\n+\t * Tx event queue would be reserved for Tx adapter. Need to unlink\n+\t * this queue from all other ports\n+\t *\n+\t */\n+\tfor (j = 0; j < eventdev_config->nb_eventport; j++) {\n+\t\trte_event_port_unlink(eventdev_id, j,\n+\t\t\t\t      &(adapter->tx_ev_queue), 1);\n+\t}\n+\n+\tret = rte_event_port_link(\n+\t\t\teventdev_id,\n+\t\t\ttx_port_id,\n+\t\t\t&(adapter->tx_ev_queue),\n+\t\t\tNULL, 1);\n+\tif (ret != 1) {\n+\t\tEH_LOG_ERR(\"Failed to link event queue to port\");\n+\t\treturn ret;\n+\t}\n+\n+\t/* Get the service ID used by Tx adapter */\n+\tret = rte_event_eth_tx_adapter_service_id_get(adapter->adapter_id,\n+\t\t\t\t\t\t      &service_id);\n+\tif (ret != -ESRCH && ret != 0) {\n+\t\tEH_LOG_ERR(\"Error getting service ID used by adapter\");\n+\t\treturn ret;\n+\t}\n+\n+\t/*\n+\t * TODO\n+\t * Tx core will invoke the service when required. The runstate check\n+\t * is not required.\n+\t *\n+\t */\n+\trte_service_set_runstate_mapped_check(service_id, 0);\n+\n+\t/* Start adapter */\n+\tret = rte_event_eth_tx_adapter_start(adapter->adapter_id);\n+\tif (ret) {\n+\t\tEH_LOG_ERR(\"Error in starting Tx adapter\");\n+\t\treturn ret;\n+\t}\n+\n+\treturn 0;\n+}\n+\n+static int\n+eh_initialize_tx_adapter(struct eventmode_conf *em_conf)\n+{\n+\tint i, ret;\n+\tstruct tx_adapter_conf *adapter;\n+\n+\t/* Configure Tx adapters */\n+\tfor (i = 0; i < em_conf->nb_tx_adapter; i++) {\n+\t\tadapter = &(em_conf->tx_adapter[i]);\n+\t\tret = eh_tx_adapter_configure(em_conf, adapter);\n+\t\tif (ret < 0) {\n+\t\t\tEH_LOG_ERR(\"Tx adapter configuration failed\");\n+\t\t\treturn ret;\n+\t\t}\n+\t}\n+\treturn 0;\n+}\n+\n int32_t\n eh_devs_init(struct eh_conf *mode_conf)\n {\n@@ -631,6 +920,11 @@ eh_devs_init(struct eh_conf *mode_conf)\n \tif (ret != 0)\n \t\treturn ret;\n \n+\t/* Setup Tx adapter */\n+\tret = eh_initialize_tx_adapter(em_conf);\n+\tif (ret != 0)\n+\t\treturn ret;\n+\n \t/* Start eth devices after setting up adapter */\n \tRTE_ETH_FOREACH_DEV(portid) {\n \n@@ -713,5 +1007,68 @@ eh_devs_uninit(struct eh_conf *mode_conf)\n \t\t}\n \t}\n \n+\t/* Stop and release tx adapters */\n+\tfor (i = 0; i < em_conf->nb_tx_adapter; i++) {\n+\n+\t\tid = em_conf->tx_adapter[i].adapter_id;\n+\t\tret = rte_event_eth_tx_adapter_stop(id);\n+\t\tif (ret < 0) {\n+\t\t\tEH_LOG_ERR(\"Error stopping tx adapter %d\", id);\n+\t\t\treturn ret;\n+\t\t}\n+\n+\t\tfor (j = 0; j < em_conf->tx_adapter[i].nb_connections; j++) {\n+\n+\t\t\tret = rte_event_eth_tx_adapter_queue_del(id,\n+\t\t\t\tem_conf->tx_adapter[i].conn[j].ethdev_id, -1);\n+\t\t\tif (ret < 0) {\n+\t\t\t\tEH_LOG_ERR(\n+\t\t\t\t\t\"Error deleting tx adapter queues %d\",\n+\t\t\t\t\tid);\n+\t\t\t\treturn ret;\n+\t\t\t}\n+\t\t}\n+\n+\t\tret = rte_event_eth_tx_adapter_free(id);\n+\t\tif (ret < 0) {\n+\t\t\tEH_LOG_ERR(\"Error freeing tx adapter %d\", id);\n+\t\t\treturn ret;\n+\t\t}\n+\t}\n+\n \treturn 0;\n }\n+\n+uint8_t\n+eh_get_tx_queue(struct eh_conf *mode_conf, uint8_t eventdev_id)\n+{\n+\tstruct eventdev_params *eventdev_config;\n+\tstruct eventmode_conf *em_conf;\n+\n+\tif (mode_conf == NULL) {\n+\t\tEH_LOG_ERR(\"Invalid conf\");\n+\t\treturn -EINVAL;\n+\t}\n+\n+\tif (mode_conf->mode_params == NULL) {\n+\t\tEH_LOG_ERR(\"Invalid mode params\");\n+\t\treturn -EINVAL;\n+\t}\n+\n+\t/* Get eventmode conf */\n+\tem_conf = (struct eventmode_conf *)(mode_conf->mode_params);\n+\n+\t/* Get event device conf */\n+\teventdev_config = eh_get_eventdev_params(em_conf, eventdev_id);\n+\n+\tif (eventdev_config == NULL) {\n+\t\tEH_LOG_ERR(\"Error reading eventdev conf\");\n+\t\treturn -EINVAL;\n+\t}\n+\n+\t/*\n+\t * The last queue would be reserved to be used as atomic queue for the\n+\t * last stage (eth packet tx stage)\n+\t */\n+\treturn eventdev_config->nb_eventqueue - 1;\n+}\ndiff --git a/examples/ipsec-secgw/event_helper.h b/examples/ipsec-secgw/event_helper.h\nindex 4233b42..01e2aca 100644\n--- a/examples/ipsec-secgw/event_helper.h\n+++ b/examples/ipsec-secgw/event_helper.h\n@@ -10,6 +10,16 @@ extern \"C\" {\n \n #include <rte_log.h>\n \n+/**\n+ * Flag to indicate that the event device used by all adapters is same\n+ */\n+#define EH_TX_EV_LINK_COMMON_EVENT_DEV\t\t(1 << 0)\n+\n+/**\n+ * Flag to indicate that the event queue to be used for all adapters is same\n+ */\n+#define EH_TX_EV_LINK_COMMON_EVENT_QUEUE\t(1 << 1)\n+\n #define RTE_LOGTYPE_EH  RTE_LOGTYPE_USER4\n \n #define EH_LOG_ERR(...) \\\n@@ -23,9 +33,15 @@ extern \"C\" {\n /* Max Rx adapters supported */\n #define EVENT_MODE_MAX_RX_ADAPTERS RTE_EVENT_MAX_DEVS\n \n+/* Max Tx adapters supported */\n+#define EVENT_MODE_MAX_TX_ADAPTERS RTE_EVENT_MAX_DEVS\n+\n /* Max Rx adapter connections */\n #define EVENT_MODE_MAX_CONNECTIONS_PER_ADAPTER 16\n \n+/* Max Tx adapter connections */\n+#define EVENT_MODE_MAX_CONNECTIONS_PER_TX_ADAPTER 16\n+\n /* Max event queues supported per event device */\n #define EVENT_MODE_MAX_EVENT_QUEUES_PER_DEV RTE_EVENT_MAX_QUEUES_PER_DEV\n \n@@ -33,6 +49,9 @@ extern \"C\" {\n #define EVENT_MODE_MAX_LCORE_LINKS \\\n \t(EVENT_MODE_MAX_EVENT_DEVS * EVENT_MODE_MAX_EVENT_QUEUES_PER_DEV)\n \n+/* Max adapters that one Tx core can handle */\n+#define EVENT_MODE_MAX_ADAPTERS_PER_TX_CORE EVENT_MODE_MAX_TX_ADAPTERS\n+\n /**\n  * Packet transfer mode of the application\n  */\n@@ -80,6 +99,23 @@ struct rx_adapter_conf {\n \t\t\tconn[EVENT_MODE_MAX_CONNECTIONS_PER_ADAPTER];\n };\n \n+/* Tx adapter connection info */\n+struct tx_adapter_connection_info {\n+\tuint8_t ethdev_id;\n+\tint32_t ethdev_tx_qid;\n+};\n+\n+/* Tx adapter conf */\n+struct tx_adapter_conf {\n+\tint32_t eventdev_id;\n+\tint32_t adapter_id;\n+\tuint32_t tx_core_id;\n+\tuint8_t nb_connections;\n+\tstruct tx_adapter_connection_info\n+\t\t\tconn[EVENT_MODE_MAX_CONNECTIONS_PER_TX_ADAPTER];\n+\tuint8_t tx_ev_queue;\n+};\n+\n /* Eventmode conf data */\n struct eventmode_conf {\n \tint nb_eventdev;\n@@ -90,6 +126,10 @@ struct eventmode_conf {\n \t\t/**< No of Rx adapters */\n \tstruct rx_adapter_conf rx_adapter[EVENT_MODE_MAX_RX_ADAPTERS];\n \t\t/**< Rx adapter conf */\n+\tuint8_t nb_tx_adapter;\n+\t\t/**< No of Tx adapters */\n+\tstruct tx_adapter_conf tx_adapter[EVENT_MODE_MAX_TX_ADAPTERS];\n+\t\t/** Tx adapter conf */\n \tuint8_t nb_link;\n \t\t/**< No of links */\n \tstruct eh_event_link_info\n@@ -170,6 +210,24 @@ eh_devs_init(struct eh_conf *mode_conf);\n int32_t\n eh_devs_uninit(struct eh_conf *mode_conf);\n \n+/**\n+ * Get eventdev tx queue\n+ *\n+ * If the application uses event device which does not support internal port\n+ * then it needs to submit the events to a Tx queue before final transmission.\n+ * This Tx queue will be created internally by the eventmode helper subsystem,\n+ * and application will need its queue ID when it runs the execution loop.\n+ *\n+ * @param mode_conf\n+ *   Configuration of the mode in which app is doing packet handling\n+ * @param eventdev_id\n+ *   Event device ID\n+ * @return\n+ *   Tx queue ID\n+ */\n+uint8_t\n+eh_get_tx_queue(struct eh_conf *mode_conf, uint8_t eventdev_id);\n+\n #ifdef __cplusplus\n }\n #endif\n",
    "prefixes": [
        "RFC",
        "04/13"
    ]
}