get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 63553,
    "url": "http://patches.dpdk.org/api/patches/63553/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20191204144345.5736-2-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": "<20191204144345.5736-2-pbhagavatula@marvell.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20191204144345.5736-2-pbhagavatula@marvell.com",
    "date": "2019-12-04T14:43:34",
    "name": "[v2,01/11] examples/l3fwd: add framework for event device",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "37561ba82dc6e80c369d3fc7c737876ecbcbba55",
    "submitter": {
        "id": 1183,
        "url": "http://patches.dpdk.org/api/people/1183/?format=api",
        "name": "Pavan Nikhilesh Bhagavatula",
        "email": "pbhagavatula@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/20191204144345.5736-2-pbhagavatula@marvell.com/mbox/",
    "series": [
        {
            "id": 7727,
            "url": "http://patches.dpdk.org/api/series/7727/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=7727",
            "date": "2019-12-04T14:43:33",
            "name": "example/l3fwd: introduce event device support",
            "version": 2,
            "mbox": "http://patches.dpdk.org/series/7727/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/63553/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/63553/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-Original-To": "patchwork@inbox.dpdk.org",
        "Delivered-To": "patchwork@inbox.dpdk.org",
        "Received": [
            "from dpdk.org (dpdk.org [92.243.14.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id AF969A04B5;\n\tWed,  4 Dec 2019 15:44:01 +0100 (CET)",
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 822041BF72;\n\tWed,  4 Dec 2019 15:44:01 +0100 (CET)",
            "from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com\n [67.231.156.173]) by dpdk.org (Postfix) with ESMTP id D66FF1BF70\n for <dev@dpdk.org>; Wed,  4 Dec 2019 15:43:59 +0100 (CET)",
            "from pps.filterd (m0045851.ppops.net [127.0.0.1])\n by mx0b-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id\n xB4EeNNZ024588; Wed, 4 Dec 2019 06:43:59 -0800",
            "from sc-exch02.marvell.com ([199.233.58.182])\n by mx0b-0016f401.pphosted.com with ESMTP id 2wp2npjrmk-1\n (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT);\n Wed, 04 Dec 2019 06:43:59 -0800",
            "from SC-EXCH01.marvell.com (10.93.176.81) by SC-EXCH02.marvell.com\n (10.93.176.82) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Wed, 4 Dec\n 2019 06:43:54 -0800",
            "from maili.marvell.com (10.93.176.43) by SC-EXCH01.marvell.com\n (10.93.176.81) with Microsoft SMTP Server id 15.0.1367.3 via Frontend\n Transport; Wed, 4 Dec 2019 06:43:54 -0800",
            "from localhost.localdomain (unknown [10.36.16.86])\n by maili.marvell.com (Postfix) with ESMTP id E81BE3F703F;\n Wed,  4 Dec 2019 06:43:50 -0800 (PST)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com;\n h=from : to : cc :\n subject : date : message-id : in-reply-to : references : mime-version :\n content-transfer-encoding : content-type; s=pfpt0818;\n bh=e/Pr/rPjYn0gyobR3ik0V/MxVe6XrvUln5SNb86dxuA=;\n b=KxdUkUIadiMGETQMK8SUffjlAk46dLzgokquTDMRcboa0dNifLREHwurTCfT6MnBcVS2\n 34I7ZQiG4EPqPGXGuDLSkXxYSW/h/rrQq71mIAIgzThUGPIuknoQy8QB9yn8Bq/xfZ4L\n Q8m8YTag+cXfs0Clm/m4B8K3hNSxA/KY+o2LXI4zfwL4MPOZJzQaROjBq3mOoRb4wTKU\n mVZvAjuio4K/7Oz0VeP7eZgdfF7OiKruyc0VaeWXreianqJbA+gu3H3tu5qGBmTGwv8V\n KEB1N2wWEKcDuwKHea3yX/zyrBFgdjUXUzrh6SHEJOzu2n/iZouK7/BmubaH7WQw1Crw Jg==",
        "From": "<pbhagavatula@marvell.com>",
        "To": "<jerinj@marvell.com>, Marko Kovacevic <marko.kovacevic@intel.com>, Ori Kam\n <orika@mellanox.com>, Bruce Richardson <bruce.richardson@intel.com>, \"Radu\n Nicolau\" <radu.nicolau@intel.com>, Akhil Goyal <akhil.goyal@nxp.com>,\n \"Tomasz Kantecki\" <tomasz.kantecki@intel.com>,\n Sunil Kumar Kori <skori@marvell.com>,\n Pavan Nikhilesh <pbhagavatula@marvell.com>",
        "CC": "<dev@dpdk.org>",
        "Date": "Wed, 4 Dec 2019 20:13:34 +0530",
        "Message-ID": "<20191204144345.5736-2-pbhagavatula@marvell.com>",
        "X-Mailer": "git-send-email 2.17.1",
        "In-Reply-To": "<20191204144345.5736-1-pbhagavatula@marvell.com>",
        "References": "<20191204144345.5736-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,18.0.572\n definitions=2019-12-04_03:2019-12-04,2019-12-04 signatures=0",
        "Subject": "[dpdk-dev] [PATCH v2 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 <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 <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, RTE_SCHED_TYPE_ATOMIC or RTE_SCHED_TYPE_PARALLEL\nthrough:\n\t`--eventq-sched=\"ordered\"` or `--eventq-sched=\"atomic\"` or\n\t\t`--eventq-sched=\"parallel\"`\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       |  6 +++\n examples/l3fwd/l3fwd_event.c | 75 ++++++++++++++++++++++++++++++++++++\n examples/l3fwd/l3fwd_event.h | 54 ++++++++++++++++++++++++++\n examples/l3fwd/main.c        | 41 +++++++++++++++++---\n examples/l3fwd/meson.build   |  4 +-\n 6 files changed, 174 insertions(+), 8 deletions(-)\n create mode 100644 examples/l3fwd/l3fwd_event.c\n create mode 100644 examples/l3fwd/l3fwd_event.h",
    "diff": "diff --git a/examples/l3fwd/Makefile b/examples/l3fwd/Makefile\nindex b2dbf2607..c892b867b 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_event.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..cd17a41b3 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\n@@ -169,6 +172,9 @@ is_valid_ipv4_pkt(struct rte_ipv4_hdr *pkt, uint32_t link_len)\n }\n #endif /* DO_RFC_1812_CHECKS */\n \n+void\n+print_usage(const char *prgname);\n+\n /* Function pointers for LPM or EM functionality. */\n void\n setup_lpm(const int socketid);\ndiff --git a/examples/l3fwd/l3fwd_event.c b/examples/l3fwd/l3fwd_event.c\nnew file mode 100644\nindex 000000000..3892720be\n--- /dev/null\n+++ b/examples/l3fwd/l3fwd_event.c\n@@ -0,0 +1,75 @@\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_event.h\"\n+\n+static void\n+parse_mode(const char *optarg)\n+{\n+\tstruct l3fwd_event_resources *evt_rsrc = l3fwd_get_eventdev_rsrc();\n+\n+\tif (!strncmp(optarg, \"poll\", 4))\n+\t\tevt_rsrc->enabled = false;\n+\telse if (!strncmp(optarg, \"eventdev\", 8))\n+\t\tevt_rsrc->enabled = true;\n+}\n+\n+static void\n+parse_eventq_sync(const char *optarg)\n+{\n+\tstruct l3fwd_event_resources *evt_rsrc = l3fwd_get_eventdev_rsrc();\n+\n+\tif (!strncmp(optarg, \"ordered\", 7))\n+\t\tevt_rsrc->sched_type = RTE_SCHED_TYPE_ORDERED;\n+\tif (!strncmp(optarg, \"atomic\", 6))\n+\t\tevt_rsrc->sched_type = RTE_SCHED_TYPE_ATOMIC;\n+\tif (!strncmp(optarg, \"parallel\", 8))\n+\t\tevt_rsrc->sched_type = RTE_SCHED_TYPE_PARALLEL;\n+}\n+\n+static void\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 *prgname = argv[0];\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\tdefault:\n+\t\t\tprint_usage(prgname);\n+\t\t\texit(1);\n+\t\t}\n+\t}\n+}\n+\n+void\n+l3fwd_event_resource_setup(void)\n+{\n+\tstruct l3fwd_event_resources *evt_rsrc = l3fwd_get_eventdev_rsrc();\n+\n+\t/* Parse eventdev command line options */\n+\tl3fwd_parse_eventdev_args(evt_rsrc->args, evt_rsrc->nb_args);\n+\tif (!evt_rsrc->enabled)\n+\t\treturn;\n+}\ndiff --git a/examples/l3fwd/l3fwd_event.h b/examples/l3fwd/l3fwd_event.h\nnew file mode 100644\nindex 000000000..c95296c38\n--- /dev/null\n+++ b/examples/l3fwd/l3fwd_event.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-sched\"\n+\n+enum {\n+\tCMD_LINE_OPT_MODE_NUM = 265,\n+\tCMD_LINE_OPT_EVENTQ_SYNC_NUM,\n+};\n+\n+struct l3fwd_event_resources {\n+\tuint8_t sched_type;\n+\tuint8_t enabled;\n+\tuint8_t nb_args;\n+\tchar **args;\n+};\n+\n+static inline struct l3fwd_event_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_event_resources),\n+\t\t\t\t 0, 0);\n+\tif (mz != NULL) {\n+\t\tmemset(mz->addr, 0, sizeof(struct l3fwd_event_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_event_resource_setup(void);\n+\n+#endif /* __L3FWD_EVENTDEV_H__ */\ndiff --git a/examples/l3fwd/main.c b/examples/l3fwd/main.c\nindex 4dea12a65..19ca4483c 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@@ -46,6 +45,7 @@\n #include <cmdline_parse_etheraddr.h>\n \n #include \"l3fwd.h\"\n+#include \"l3fwd_event.h\"\n \n /*\n  * Configurable number of RX/TX ring descriptors\n@@ -274,7 +274,7 @@ init_lcore_rx_queues(void)\n }\n \n /* display usage */\n-static void\n+void\n print_usage(const char *prgname)\n {\n \tfprintf(stderr, \"%s [EAL options] --\"\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-sched]\\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,13 @@ 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-sched: Event queue synchronization method \"\n+\t\t\"                  ordered, atomic or parallel.\\n\\t\\t\"\n+\t\t\"\t\t   Default: atomic\\n\\t\\t\"\n+\t\t\"                  Valid only if --mode=eventdev\\n\\n\",\n \t\tprgname);\n }\n \n@@ -504,11 +512,19 @@ static const struct option lgopts[] = {\n static int\n parse_args(int argc, char **argv)\n {\n+\tstruct l3fwd_event_resources *evt_rsrc;\n \tint opt, ret;\n \tchar **argvopt;\n \tint option_index;\n \tchar *prgname = argv[0];\n \n+\tevt_rsrc = l3fwd_get_eventdev_rsrc();\n+\tevt_rsrc->args = rte_zmalloc(\"l3fwd_event_args\", sizeof(char *), 0);\n+\tif (evt_rsrc->args == NULL)\n+\t\trte_exit(EXIT_FAILURE,\n+\t\t\t\t\"Unable to allocate memory for eventdev arg\");\n+\tevt_rsrc->args[0] = argv[0];\n+\tevt_rsrc->nb_args++;\n \targvopt = argv;\n \n \t/* Error or normal output strings. */\n@@ -538,6 +554,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\tevt_rsrc->args[evt_rsrc->nb_args] =\n+\t\t\t\targv[optind - 1];\n+\t\t\tevt_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@@ -811,6 +836,7 @@ prepare_ptype_parser(uint16_t portid, uint16_t queueid)\n int\n main(int argc, char **argv)\n {\n+\tstruct l3fwd_event_resources *evt_rsrc;\n \tstruct lcore_conf *qconf;\n \tstruct rte_eth_dev_info dev_info;\n \tstruct rte_eth_txconf *txconf;\n@@ -839,11 +865,16 @@ main(int argc, char **argv)\n \t\t*(uint64_t *)(val_eth + portid) = dest_eth_addr[portid];\n \t}\n \n+\tevt_rsrc = l3fwd_get_eventdev_rsrc();\n+\tRTE_SET_USED(evt_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_event_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..864327c7b 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_event.c', 'main.c'\n )\n",
    "prefixes": [
        "v2",
        "01/11"
    ]
}