get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 59417,
    "url": "http://patches.dpdk.org/api/patches/59417/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20190919092603.5485-3-pbhagavatula@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": "<20190919092603.5485-3-pbhagavatula@marvell.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20190919092603.5485-3-pbhagavatula@marvell.com",
    "date": "2019-09-19T09:25:56",
    "name": "[v2,02/10] examples/l2fwd-event: add infra for eventdev",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "e051a9ca0f302f4595f579b7f8c467103c69259f",
    "submitter": {
        "id": 1183,
        "url": "http://patches.dpdk.org/api/people/1183/?format=api",
        "name": "Pavan Nikhilesh Bhagavatula",
        "email": "pbhagavatula@marvell.com"
    },
    "delegate": null,
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/20190919092603.5485-3-pbhagavatula@marvell.com/mbox/",
    "series": [
        {
            "id": 6446,
            "url": "http://patches.dpdk.org/api/series/6446/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=6446",
            "date": "2019-09-19T09:25:54",
            "name": "example/l2fwd-event: introduce l2fwd-event example",
            "version": 2,
            "mbox": "http://patches.dpdk.org/series/6446/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/59417/comments/",
    "check": "warning",
    "checks": "http://patches.dpdk.org/api/patches/59417/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 9FF711ECBD;\n\tThu, 19 Sep 2019 11:26:19 +0200 (CEST)",
            "from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com\n\t[67.231.148.174]) by dpdk.org (Postfix) with ESMTP id C69CE1ECBD\n\tfor <dev@dpdk.org>; Thu, 19 Sep 2019 11:26:17 +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\tx8J9PUUU012561; Thu, 19 Sep 2019 02:26:17 -0700",
            "from sc-exch02.marvell.com ([199.233.58.182])\n\tby mx0a-0016f401.pphosted.com with ESMTP id 2v3vcdt75k-1\n\t(version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); \n\tThu, 19 Sep 2019 02:26:16 -0700",
            "from SC-EXCH03.marvell.com (10.93.176.83) by SC-EXCH02.marvell.com\n\t(10.93.176.82) with Microsoft SMTP Server (TLS) id 15.0.1367.3;\n\tThu, 19 Sep 2019 02:26:15 -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; Thu, 19 Sep 2019 02:26:15 -0700",
            "from BG-LT7430.marvell.com (unknown [10.28.17.12])\n\tby maili.marvell.com (Postfix) with ESMTP id 28DFB3F703F;\n\tThu, 19 Sep 2019 02:26:11 -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=+fuOlTpherMMoU2jRHPYGSNZrtZN0RZANEHOXSTWXE8=;\n\tb=KY32uwL9/RzdivIJvp+/9lm5dZPdaTgmegBZ0phPhqO6bRnJIipgOe85T34TDQDcIgoU\n\thsBLA3S3tsVsudWDZb6C6IANbfqMZ1lTzfHMGWcA/ALP7KFiK3POeGvrTVYg8RcJOGeB\n\t4oTWKMK6IHggypt5XcWkyPf+M3EOBL2F2Ye48Ca/CKGBJXHdbqTGbHiZuNC1blGmNlTP\n\tS2zyFj/g2+kY3nc5iBIF8eFMTe9+k7TfJ6uJLq9B2ZInDIuBpi2J1gyWQApE+IY9mrN5\n\tkUHEXRZj7NVbK857aaoAWmlWR44U5eGST9oTr3nf0+cQnwjYIKJiBJFhAhoBHc6R6OWX\n\tfg== ",
        "From": "<pbhagavatula@marvell.com>",
        "To": "<jerinj@marvell.com>, <bruce.richardson@intel.com>, <akhil.goyal@nxp.com>,\n\tMarko Kovacevic <marko.kovacevic@intel.com>,\n\tOri Kam <orika@mellanox.com>, Radu Nicolau <radu.nicolau@intel.com>, \n\tTomasz Kantecki <tomasz.kantecki@intel.com>,\n\tSunil Kumar Kori <skori@marvell.com>, \"Pavan\n\tNikhilesh\" <pbhagavatula@marvell.com>",
        "CC": "<dev@dpdk.org>",
        "Date": "Thu, 19 Sep 2019 14:55:56 +0530",
        "Message-ID": "<20190919092603.5485-3-pbhagavatula@marvell.com>",
        "X-Mailer": "git-send-email 2.17.1",
        "In-Reply-To": "<20190919092603.5485-1-pbhagavatula@marvell.com>",
        "References": "<20190919092603.5485-1-pbhagavatula@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.70,1.0.8\n\tdefinitions=2019-09-19_03:2019-09-18,2019-09-19 signatures=0",
        "Subject": "[dpdk-dev] [PATCH v2 02/10] examples/l2fwd-event: add infra for\n\teventdev",
        "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": "From: Sunil Kumar Kori <skori@marvell.com>\n\nAdd infra to select event device as a mode to process packets through\ncommand line arguments. Also, allow the user to select the schedule type\nto be either RTE_SCHED_TYPE_ORDERED or RTE_SCHED_TYPE_ATOMIC.\n\nUsage:\n\n`--mode=\"eventdev\"` or `--mode=\"poll\"`\n`--eventq-sync=\"ordered\"` or `--eventq-sync=\"atomic\"`\n\nSigned-off-by: Sunil Kumar Kori <skori@marvell.com>\n---\n examples/l2fwd-event/Makefile         |   1 +\n examples/l2fwd-event/l2fwd_eventdev.c | 107 ++++++++++++++++++++++++++\n examples/l2fwd-event/l2fwd_eventdev.h |  62 +++++++++++++++\n examples/l2fwd-event/main.c           |  22 +++++-\n examples/l2fwd-event/meson.build      |   3 +-\n 5 files changed, 192 insertions(+), 3 deletions(-)\n create mode 100644 examples/l2fwd-event/l2fwd_eventdev.c\n create mode 100644 examples/l2fwd-event/l2fwd_eventdev.h",
    "diff": "diff --git a/examples/l2fwd-event/Makefile b/examples/l2fwd-event/Makefile\nindex a156c4162..bfe0058a2 100644\n--- a/examples/l2fwd-event/Makefile\n+++ b/examples/l2fwd-event/Makefile\n@@ -7,6 +7,7 @@ APP = l2fwd-event\n \n # all source are stored in SRCS-y\n SRCS-y := main.c\n+SRCS-y += l2fwd_eventdev.c\n \n # Build using pkg-config variables if possible\n ifeq ($(shell pkg-config --exists libdpdk && echo 0),0)\ndiff --git a/examples/l2fwd-event/l2fwd_eventdev.c b/examples/l2fwd-event/l2fwd_eventdev.c\nnew file mode 100644\nindex 000000000..19efb6d1e\n--- /dev/null\n+++ b/examples/l2fwd-event/l2fwd_eventdev.c\n@@ -0,0 +1,107 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ * Copyright(C) 2019 Marvell International Ltd.\n+ */\n+\n+#include <stdbool.h>\n+#include <getopt.h>\n+\n+#include <rte_atomic.h>\n+#include <rte_cycles.h>\n+#include <rte_ethdev.h>\n+#include <rte_eventdev.h>\n+#include <rte_event_eth_rx_adapter.h>\n+#include <rte_event_eth_tx_adapter.h>\n+#include <rte_lcore.h>\n+#include <rte_log.h>\n+#include <rte_spinlock.h>\n+\n+#include \"l2fwd_common.h\"\n+#include \"l2fwd_eventdev.h\"\n+\n+static void\n+parse_mode(const char *optarg)\n+{\n+\tstruct eventdev_resources *eventdev_rsrc = get_eventdev_rsrc();\n+\n+\tif (!strncmp(optarg, \"poll\", 4))\n+\t\teventdev_rsrc->enabled = false;\n+\telse if (!strncmp(optarg, \"eventdev\", 8))\n+\t\teventdev_rsrc->enabled = true;\n+}\n+\n+static void\n+parse_eventq_sync(const char *optarg)\n+{\n+\tstruct eventdev_resources *eventdev_rsrc = get_eventdev_rsrc();\n+\n+\tif (!strncmp(optarg, \"ordered\", 7))\n+\t\teventdev_rsrc->sync_mode = RTE_SCHED_TYPE_ORDERED;\n+\telse if (!strncmp(optarg, \"atomic\", 6))\n+\t\teventdev_rsrc->sync_mode = RTE_SCHED_TYPE_ATOMIC;\n+}\n+\n+static int\n+parse_eventdev_args(char **argv, int argc)\n+{\n+\tconst struct option eventdev_lgopts[] = {\n+\t\t{CMD_LINE_OPT_MODE, 1, 0, CMD_LINE_OPT_MODE_NUM},\n+\t\t{CMD_LINE_OPT_EVENTQ_SYNC, 1, 0, CMD_LINE_OPT_EVENTQ_SYNC_NUM},\n+\t\t{NULL, 0, 0, 0}\n+\t};\n+\tchar **argvopt = argv;\n+\tint32_t option_index;\n+\tint32_t opt;\n+\n+\twhile ((opt = getopt_long(argc, argvopt, \"\", eventdev_lgopts,\n+\t\t\t\t\t&option_index)) != EOF) {\n+\t\tswitch (opt) {\n+\t\tcase CMD_LINE_OPT_MODE_NUM:\n+\t\t\tparse_mode(optarg);\n+\t\t\tbreak;\n+\n+\t\tcase CMD_LINE_OPT_EVENTQ_SYNC_NUM:\n+\t\t\tparse_eventq_sync(optarg);\n+\t\t\tbreak;\n+\n+\t\tcase '?':\n+\t\t\t/* skip other parameters except eventdev specific */\n+\t\t\tbreak;\n+\n+\t\tdefault:\n+\t\t\tprintf(\"Invalid eventdev parameter\\n\");\n+\t\t\treturn -1;\n+\t\t}\n+\t}\n+\n+\treturn 0;\n+}\n+\n+void\n+eventdev_resource_setup(void)\n+{\n+\tstruct eventdev_resources *eventdev_rsrc = get_eventdev_rsrc();\n+\tuint32_t service_id;\n+\tint32_t ret;\n+\n+\t/* Parse eventdev command line options */\n+\tret = parse_eventdev_args(eventdev_rsrc->args, eventdev_rsrc->nb_args);\n+\tif (ret < 0)\n+\t\treturn;\n+\n+\tif (!rte_event_dev_count())\n+\t\trte_exit(EXIT_FAILURE, \"No Eventdev found\");\n+\t/* Start event device service */\n+\tret = rte_event_dev_service_id_get(eventdev_rsrc->event_d_id,\n+\t\t\t&service_id);\n+\tif (ret != -ESRCH && ret != 0)\n+\t\trte_exit(EXIT_FAILURE, \"Error in starting eventdev\");\n+\n+\trte_service_runstate_set(service_id, 1);\n+\trte_service_set_runstate_mapped_check(service_id, 0);\n+\teventdev_rsrc->service_id = service_id;\n+\n+\t/* Start event device */\n+\tret = rte_event_dev_start(eventdev_rsrc->event_d_id);\n+\tif (ret < 0)\n+\t\trte_exit(EXIT_FAILURE, \"Error in starting eventdev\");\n+}\ndiff --git a/examples/l2fwd-event/l2fwd_eventdev.h b/examples/l2fwd-event/l2fwd_eventdev.h\nnew file mode 100644\nindex 000000000..f823cf6e9\n--- /dev/null\n+++ b/examples/l2fwd-event/l2fwd_eventdev.h\n@@ -0,0 +1,62 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ * Copyright(C) 2019 Marvell International Ltd.\n+ */\n+\n+#ifndef __L2FWD_EVENTDEV_H__\n+#define __L2FWD_EVENTDEV_H__\n+\n+#include <rte_common.h>\n+#include <rte_spinlock.h>\n+\n+#include \"l2fwd_common.h\"\n+\n+#define CMD_LINE_OPT_MODE \"mode\"\n+#define CMD_LINE_OPT_EVENTQ_SYNC \"eventq-sync\"\n+\n+enum {\n+\tCMD_LINE_OPT_MODE_NUM = 265,\n+\tCMD_LINE_OPT_EVENTQ_SYNC_NUM,\n+};\n+\n+struct eventdev_resources {\n+\tstruct l2fwd_port_statistics *stats;\n+\tstruct rte_mempool *pkt_pool;\n+\tuint64_t timer_period;\n+\tuint32_t *dst_ports;\n+\tuint32_t service_id;\n+\tuint32_t port_mask;\n+\tvolatile bool *done;\n+\tuint8_t event_d_id;\n+\tuint8_t sync_mode;\n+\tuint8_t tx_mode_q;\n+\tuint8_t mac_updt;\n+\tuint8_t enabled;\n+\tuint8_t nb_args;\n+\tchar **args;\n+};\n+\n+static inline struct eventdev_resources *\n+get_eventdev_rsrc(void)\n+{\n+\tconst char name[RTE_MEMZONE_NAMESIZE] = \"l2fwd_event_rsrc\";\n+\tconst struct rte_memzone *mz;\n+\n+\tmz = rte_memzone_lookup(name);\n+\n+\tif (mz != NULL)\n+\t\treturn mz->addr;\n+\n+\tmz = rte_memzone_reserve(name, sizeof(struct eventdev_resources), 0, 0);\n+\tif (mz != NULL) {\n+\t\tmemset(mz->addr, 0, sizeof(struct eventdev_resources));\n+\t\treturn mz->addr;\n+\t}\n+\n+\trte_exit(EXIT_FAILURE, \"Unable to allocate memory for eventdev cfg\\n\");\n+\n+\treturn NULL;\n+}\n+\n+void eventdev_resource_setup(void);\n+\n+#endif /* __L2FWD_EVENTDEV_H__ */\ndiff --git a/examples/l2fwd-event/main.c b/examples/l2fwd-event/main.c\nindex cc47fa203..661f0833f 100644\n--- a/examples/l2fwd-event/main.c\n+++ b/examples/l2fwd-event/main.c\n@@ -42,6 +42,7 @@\n #include <rte_spinlock.h>\n \n #include \"l2fwd_common.h\"\n+#include \"l2fwd_eventdev.h\"\n \n static volatile bool force_quit;\n \n@@ -288,7 +289,12 @@ l2fwd_usage(const char *prgname)\n \t       \"  --[no-]mac-updating: Enable or disable MAC addresses updating (enabled by default)\\n\"\n \t       \"      When enabled:\\n\"\n \t       \"       - The source MAC address is replaced by the TX port MAC address\\n\"\n-\t       \"       - The destination MAC address is replaced by 02:00:00:00:00:TX_PORT_ID\\n\",\n+\t       \"       - The destination MAC address is replaced by 02:00:00:00:00:TX_PORT_ID\\n\"\n+\t       \"  --mode: Packet transfer mode for I/O, poll or eventdev\\n\"\n+\t       \"          Default mode = eventdev\\n\"\n+\t       \"  --eventq-sync:Event queue synchronization method,\\n\"\n+\t       \"                ordered or atomic.\\nDefault: atomic\\n\"\n+\t       \"                Valid only if --mode=eventdev\\n\\n\",\n \t       prgname);\n }\n \n@@ -503,6 +509,7 @@ signal_handler(int signum)\n int\n main(int argc, char **argv)\n {\n+\tstruct eventdev_resources *eventdev_rsrc;\n \tuint16_t nb_ports_available = 0;\n \tstruct lcore_queue_conf *qconf;\n \tuint32_t nb_ports_in_mask = 0;\n@@ -524,6 +531,7 @@ main(int argc, char **argv)\n \tsignal(SIGINT, signal_handler);\n \tsignal(SIGTERM, signal_handler);\n \n+\teventdev_rsrc = get_eventdev_rsrc();\n \t/* parse application arguments (after the EAL ones) */\n \tret = l2fwd_parse_args(argc, argv);\n \tif (ret < 0)\n@@ -584,6 +592,17 @@ main(int argc, char **argv)\n \tif (l2fwd_pktmbuf_pool == NULL)\n \t\trte_exit(EXIT_FAILURE, \"Cannot init mbuf pool\\n\");\n \n+\teventdev_rsrc->port_mask = l2fwd_enabled_port_mask;\n+\teventdev_rsrc->pkt_pool = l2fwd_pktmbuf_pool;\n+\teventdev_rsrc->dst_ports = l2fwd_dst_ports;\n+\teventdev_rsrc->timer_period = timer_period;\n+\teventdev_rsrc->mac_updt = mac_updating;\n+\teventdev_rsrc->stats = port_statistics;\n+\teventdev_rsrc->done = &force_quit;\n+\n+\t/* Configure eventdev parameters if user has requested */\n+\teventdev_resource_setup();\n+\n \t/* Initialize the port/queue configuration of each logical core */\n \tRTE_ETH_FOREACH_DEV(portid) {\n \t\t/* skip ports that are not enabled */\n@@ -610,7 +629,6 @@ main(int argc, char **argv)\n \t\tprintf(\"Lcore %u: RX port %u\\n\", rx_lcore_id, portid);\n \t}\n \n-\n \t/* Initialise each port */\n \tRTE_ETH_FOREACH_DEV(portid) {\n \t\tstruct rte_eth_rxconf rxq_conf;\ndiff --git a/examples/l2fwd-event/meson.build b/examples/l2fwd-event/meson.build\nindex 16eadb0b4..b1ad48cc5 100644\n--- a/examples/l2fwd-event/meson.build\n+++ b/examples/l2fwd-event/meson.build\n@@ -8,5 +8,6 @@\n # DPDK instance, use 'make'\n \n sources = files(\n-\t'main.c'\n+\t'main.c',\n+\t'l2fwd_eventdev.c'\n )\n",
    "prefixes": [
        "v2",
        "02/10"
    ]
}