get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 59841,
    "url": "https://patches.dpdk.org/api/patches/59841/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/20190926100558.24348-2-pbhagavatula@marvell.com/",
    "project": {
        "id": 1,
        "url": "https://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": "<20190926100558.24348-2-pbhagavatula@marvell.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20190926100558.24348-2-pbhagavatula@marvell.com",
    "date": "2019-09-26T10:05:48",
    "name": "[01/11] examples/l3fwd: add framework for event device",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "bdd7355e75eb1d6efa9f39151c9bd4d0f6be3466",
    "submitter": {
        "id": 1183,
        "url": "https://patches.dpdk.org/api/people/1183/?format=api",
        "name": "Pavan Nikhilesh Bhagavatula",
        "email": "pbhagavatula@marvell.com"
    },
    "delegate": {
        "id": 1,
        "url": "https://patches.dpdk.org/api/users/1/?format=api",
        "username": "tmonjalo",
        "first_name": "Thomas",
        "last_name": "Monjalon",
        "email": "thomas@monjalon.net"
    },
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/20190926100558.24348-2-pbhagavatula@marvell.com/mbox/",
    "series": [
        {
            "id": 6542,
            "url": "https://patches.dpdk.org/api/series/6542/?format=api",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=6542",
            "date": "2019-09-26T10:05:47",
            "name": "example/l3fwd: introduce event device support",
            "version": 1,
            "mbox": "https://patches.dpdk.org/series/6542/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/59841/comments/",
    "check": "success",
    "checks": "https://patches.dpdk.org/api/patches/59841/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 23C381BE9A;\n\tThu, 26 Sep 2019 12:06:10 +0200 (CEST)",
            "from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com\n\t[67.231.156.173]) by dpdk.org (Postfix) with ESMTP id 13C281B94A\n\tfor <dev@dpdk.org>; Thu, 26 Sep 2019 12:06:07 +0200 (CEST)",
            "from pps.filterd (m0045851.ppops.net [127.0.0.1])\n\tby mx0b-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id\n\tx8QA4gPX032601; Thu, 26 Sep 2019 03:06:07 -0700",
            "from sc-exch01.marvell.com ([199.233.58.181])\n\tby mx0b-0016f401.pphosted.com with ESMTP id 2v8u5dr18r-1\n\t(version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); \n\tThu, 26 Sep 2019 03:06:07 -0700",
            "from SC-EXCH03.marvell.com (10.93.176.83) by SC-EXCH01.marvell.com\n\t(10.93.176.81) with Microsoft SMTP Server (TLS) id 15.0.1367.3;\n\tThu, 26 Sep 2019 03:06:05 -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, 26 Sep 2019 03:06:05 -0700",
            "from BG-LT7430.marvell.com (unknown [10.28.17.15])\n\tby maili.marvell.com (Postfix) with ESMTP id BF2663F7043;\n\tThu, 26 Sep 2019 03:06:02 -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=wT234Vhs8Y8c9k476/BIxg8EmkK8jr+k167M5edfI7w=;\n\tb=Ca2LohBu8/kO8l6a3LIhQEHajQTOfWYEe/pwlPRA4ctGv7ZFQARz/BKNHAZez4oGxl3J\n\tJe6LEH/i+Z8CCzD1G3Ju63z1YYLM3hanoZkMytwTFuvoTsFj4W5Tmaix3SWQ/jdIYwjZ\n\tNKmp1pJ1FWbgyGoadoXMRXgyHmqRDXWe0QSqc91vFjAgpDn14znKnwFQ5MjyAUSeLvUo\n\tqom7HawVpUrcLe7L/1pxruko68qT0Dqy8bpu8hbaexWVkcwDDMbSMeTrIvOUHCauIG6Y\n\tLrwr/FTdP2oQiCxcJbQktKUbKx+yO0Me+cloX54I7y2JFjuYj20eE7ijLXSAcsrCHdET\n\tDg== ",
        "From": "<pbhagavatula@marvell.com>",
        "To": "<jerinj@marvell.com>, <akhil.goyal@nxp.com>, Marko Kovacevic\n\t<marko.kovacevic@intel.com>, Ori Kam <orika@mellanox.com>,\n\tBruce Richardson\n\t<bruce.richardson@intel.com>, Radu Nicolau <radu.nicolau@intel.com>, \n\t\"Tomasz Kantecki\" <tomasz.kantecki@intel.com>",
        "CC": "<dev@dpdk.org>, Sunil Kumar Kori <skori@marvell.com>",
        "Date": "Thu, 26 Sep 2019 15:35:48 +0530",
        "Message-ID": "<20190926100558.24348-2-pbhagavatula@marvell.com>",
        "X-Mailer": "git-send-email 2.17.1",
        "In-Reply-To": "<20190926100558.24348-1-pbhagavatula@marvell.com>",
        "References": "<20190926100558.24348-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.95,1.0.8\n\tdefinitions=2019-09-26_04:2019-09-25,2019-09-26 signatures=0",
        "Subject": "[dpdk-dev] [PATCH 01/11] examples/l3fwd: add framework for event\n\tdevice",
        "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 framework to enable event device as a producer of packets.\nTo switch between event mode and poll mode the following options\nhave been added:\n\t`--mode=\"eventdev\"` or `--mode=\"poll\"`\nAlso, allow the user to select the schedule type to be either\nRTE_SCHED_TYPE_ORDERED or RTE_SCHED_TYPE_ATOMIC through:\n\t`--eventq-sync=\"ordered\"` or `--eventq-sync=\"atomic\"`\n\nPoll mode is still the default operation mode.\n\nSigned-off-by: Sunil Kumar Kori <skori@marvell.com>\n---\n examples/l3fwd/Makefile         |  2 +-\n examples/l3fwd/l3fwd.h          |  3 ++\n examples/l3fwd/l3fwd_eventdev.c | 79 +++++++++++++++++++++++++++++++++\n examples/l3fwd/l3fwd_eventdev.h | 54 ++++++++++++++++++++++\n examples/l3fwd/main.c           | 38 ++++++++++++++--\n examples/l3fwd/meson.build      |  4 +-\n 6 files changed, 173 insertions(+), 7 deletions(-)\n create mode 100644 examples/l3fwd/l3fwd_eventdev.c\n create mode 100644 examples/l3fwd/l3fwd_eventdev.h",
    "diff": "diff --git a/examples/l3fwd/Makefile b/examples/l3fwd/Makefile\nindex c55f5c288..4d20f3790 100644\n--- a/examples/l3fwd/Makefile\n+++ b/examples/l3fwd/Makefile\n@@ -5,7 +5,7 @@\n APP = l3fwd\n \n # all source are stored in SRCS-y\n-SRCS-y := main.c l3fwd_lpm.c l3fwd_em.c\n+SRCS-y := main.c l3fwd_lpm.c l3fwd_em.c l3fwd_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/l3fwd/l3fwd.h b/examples/l3fwd/l3fwd.h\nindex 293fb1fa2..838aeed1d 100644\n--- a/examples/l3fwd/l3fwd.h\n+++ b/examples/l3fwd/l3fwd.h\n@@ -5,6 +5,9 @@\n #ifndef __L3_FWD_H__\n #define __L3_FWD_H__\n \n+#include <stdbool.h>\n+\n+#include <rte_ethdev.h>\n #include <rte_vect.h>\n \n #define DO_RFC_1812_CHECKS\ndiff --git a/examples/l3fwd/l3fwd_eventdev.c b/examples/l3fwd/l3fwd_eventdev.c\nnew file mode 100644\nindex 000000000..319a20746\n--- /dev/null\n+++ b/examples/l3fwd/l3fwd_eventdev.c\n@@ -0,0 +1,79 @@\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 \"l3fwd.h\"\n+#include \"l3fwd_eventdev.h\"\n+\n+static void\n+parse_mode(const char *optarg)\n+{\n+\tstruct l3fwd_eventdev_resources *evdev_rsrc = l3fwd_get_eventdev_rsrc();\n+\n+\tif (!strncmp(optarg, \"poll\", 4))\n+\t\tevdev_rsrc->enabled = false;\n+\telse if (!strncmp(optarg, \"eventdev\", 8))\n+\t\tevdev_rsrc->enabled = true;\n+}\n+\n+static void\n+parse_eventq_sync(const char *optarg)\n+{\n+\tstruct l3fwd_eventdev_resources *evdev_rsrc = l3fwd_get_eventdev_rsrc();\n+\n+\tif (!strncmp(optarg, \"ordered\", 7))\n+\t\tevdev_rsrc->sync_mode = RTE_SCHED_TYPE_ORDERED;\n+\telse if (!strncmp(optarg, \"atomic\", 6))\n+\t\tevdev_rsrc->sync_mode = RTE_SCHED_TYPE_ATOMIC;\n+}\n+\n+static int\n+l3fwd_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+l3fwd_eventdev_resource_setup(void)\n+{\n+\tstruct l3fwd_eventdev_resources *evdev_rsrc = l3fwd_get_eventdev_rsrc();\n+\tint32_t ret;\n+\n+\t/* Parse eventdev command line options */\n+\tret = l3fwd_parse_eventdev_args(evdev_rsrc->args, evdev_rsrc->nb_args);\n+\tif (ret < 0 || !evdev_rsrc->enabled)\n+\t\treturn;\n+}\ndiff --git a/examples/l3fwd/l3fwd_eventdev.h b/examples/l3fwd/l3fwd_eventdev.h\nnew file mode 100644\nindex 000000000..64d9207a3\n--- /dev/null\n+++ b/examples/l3fwd/l3fwd_eventdev.h\n@@ -0,0 +1,54 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ * Copyright(C) 2019 Marvell International Ltd.\n+ */\n+\n+#ifndef __L3FWD_EVENTDEV_H__\n+#define __L3FWD_EVENTDEV_H__\n+\n+#include <rte_common.h>\n+#include <rte_eventdev.h>\n+#include <rte_spinlock.h>\n+\n+#include \"l3fwd.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 l3fwd_eventdev_resources {\n+\tuint8_t sync_mode;\n+\tuint8_t enabled;\n+\tuint8_t nb_args;\n+\tchar **args;\n+};\n+\n+static inline struct l3fwd_eventdev_resources *\n+l3fwd_get_eventdev_rsrc(void)\n+{\n+\tstatic const char name[RTE_MEMZONE_NAMESIZE] = \"l3fwd_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 l3fwd_eventdev_resources),\n+\t\t\t\t 0, 0);\n+\tif (mz != NULL) {\n+\t\tmemset(mz->addr, 0, sizeof(struct l3fwd_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 l3fwd_eventdev_resource_setup(void);\n+\n+#endif /* __L3FWD_EVENTDEV_H__ */\ndiff --git a/examples/l3fwd/main.c b/examples/l3fwd/main.c\nindex 3800bad19..bd88bd4ce 100644\n--- a/examples/l3fwd/main.c\n+++ b/examples/l3fwd/main.c\n@@ -13,12 +13,12 @@\n #include <errno.h>\n #include <getopt.h>\n #include <signal.h>\n-#include <stdbool.h>\n \n #include <rte_common.h>\n #include <rte_vect.h>\n #include <rte_byteorder.h>\n #include <rte_log.h>\n+#include <rte_malloc.h>\n #include <rte_memory.h>\n #include <rte_memcpy.h>\n #include <rte_eal.h>\n@@ -33,7 +33,6 @@\n #include <rte_random.h>\n #include <rte_debug.h>\n #include <rte_ether.h>\n-#include <rte_ethdev.h>\n #include <rte_mempool.h>\n #include <rte_mbuf.h>\n #include <rte_ip.h>\n@@ -52,6 +51,7 @@\n  */\n #define RTE_TEST_RX_DESC_DEFAULT 1024\n #define RTE_TEST_TX_DESC_DEFAULT 1024\n+#include \"l3fwd_eventdev.h\"\n \n #define MAX_TX_QUEUE_PER_PORT RTE_MAX_ETHPORTS\n #define MAX_RX_QUEUE_PER_PORT 128\n@@ -289,7 +289,9 @@ print_usage(const char *prgname)\n \t\t\" [--hash-entry-num]\"\n \t\t\" [--ipv6]\"\n \t\t\" [--parse-ptype]\"\n-\t\t\" [--per-port-pool]\\n\\n\"\n+\t\t\" [--per-port-pool]\"\n+\t\t\" [--mode]\"\n+\t\t\" [--eventq-sync]\\n\\n\"\n \n \t\t\"  -p PORTMASK: Hexadecimal bitmask of ports to configure\\n\"\n \t\t\"  -P : Enable promiscuous mode\\n\"\n@@ -304,7 +306,12 @@ print_usage(const char *prgname)\n \t\t\"  --hash-entry-num: Specify the hash entry number in hexadecimal to be setup\\n\"\n \t\t\"  --ipv6: Set if running ipv6 packets\\n\"\n \t\t\"  --parse-ptype: Set to use software to analyze packet type\\n\"\n-\t\t\"  --per-port-pool: Use separate buffer pool per port\\n\\n\",\n+\t\t\"  --per-port-pool: Use separate buffer pool per port\\n\"\n+\t\t\"  --mode: Packet transfer mode for I/O, poll or eventdev\\n\"\n+\t\t\"          Default mode = poll\\n\"\n+\t\t\"  --eventq-sync: Event queue synchronization method \"\n+\t\t\"                 ordered or atomic.\\n\\t\\tDefault: atomic\\n\\t\\t\"\n+\t\t\"                 Valid only if --mode=eventdev\\n\\n\",\n \t\tprgname);\n }\n \n@@ -504,11 +511,19 @@ static const struct option lgopts[] = {\n static int\n parse_args(int argc, char **argv)\n {\n+\tstruct l3fwd_eventdev_resources *evdev_rsrc;\n \tint opt, ret;\n \tchar **argvopt;\n \tint option_index;\n \tchar *prgname = argv[0];\n \n+\tevdev_rsrc = l3fwd_get_eventdev_rsrc();\n+\tevdev_rsrc->args = rte_zmalloc(\"l3fwd_event_args\", sizeof(char *), 0);\n+\tif (evdev_rsrc->args == NULL)\n+\t\trte_exit(EXIT_FAILURE,\n+\t\t\t\t\"Unable to allocate memory for eventdev arg\");\n+\tevdev_rsrc->args[0] = argv[0];\n+\tevdev_rsrc->nb_args++;\n \targvopt = argv;\n \n \t/* Error or normal output strings. */\n@@ -538,6 +553,15 @@ parse_args(int argc, char **argv)\n \t\t\tl3fwd_lpm_on = 1;\n \t\t\tbreak;\n \n+\t\tcase '?':\n+\t\t\t/* Eventdev options are encountered skip for\n+\t\t\t * now and processed later.\n+\t\t\t */\n+\t\t\tevdev_rsrc->args[evdev_rsrc->nb_args] =\n+\t\t\t\targv[optind - 1];\n+\t\t\tevdev_rsrc->nb_args++;\n+\t\t\tbreak;\n+\n \t\t/* long options */\n \t\tcase CMD_LINE_OPT_CONFIG_NUM:\n \t\t\tret = parse_config(optarg);\n@@ -803,6 +827,7 @@ prepare_ptype_parser(uint16_t portid, uint16_t queueid)\n int\n main(int argc, char **argv)\n {\n+\tstruct l3fwd_eventdev_resources *evdev_rsrc;\n \tstruct lcore_conf *qconf;\n \tstruct rte_eth_dev_info dev_info;\n \tstruct rte_eth_txconf *txconf;\n@@ -831,11 +856,16 @@ main(int argc, char **argv)\n \t\t*(uint64_t *)(val_eth + portid) = dest_eth_addr[portid];\n \t}\n \n+\tevdev_rsrc = l3fwd_get_eventdev_rsrc();\n+\tRTE_SET_USED(evdev_rsrc);\n \t/* parse application arguments (after the EAL ones) */\n \tret = parse_args(argc, argv);\n \tif (ret < 0)\n \t\trte_exit(EXIT_FAILURE, \"Invalid L3FWD parameters\\n\");\n \n+\t/* Configure eventdev parameters if user has requested */\n+\tl3fwd_eventdev_resource_setup();\n+\n \tif (check_lcore_params() < 0)\n \t\trte_exit(EXIT_FAILURE, \"check_lcore_params failed\\n\");\n \ndiff --git a/examples/l3fwd/meson.build b/examples/l3fwd/meson.build\nindex 6dd4b9022..c88676817 100644\n--- a/examples/l3fwd/meson.build\n+++ b/examples/l3fwd/meson.build\n@@ -6,7 +6,7 @@\n # To build this example as a standalone application with an already-installed\n # DPDK instance, use 'make'\n \n-deps += ['hash', 'lpm']\n+deps += ['hash', 'lpm', 'eventdev']\n sources = files(\n-\t'l3fwd_em.c', 'l3fwd_lpm.c', 'main.c'\n+\t'l3fwd_em.c', 'l3fwd_lpm.c', 'l3fwd_eventdev.c', 'main.c'\n )\n",
    "prefixes": [
        "01/11"
    ]
}