get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 65176,
    "url": "http://patches.dpdk.org/api/patches/65176/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20200128053506.2173-9-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": "<20200128053506.2173-9-pbhagavatula@marvell.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20200128053506.2173-9-pbhagavatula@marvell.com",
    "date": "2020-01-28T05:35:02",
    "name": "[v6,08/11] examples/l3fwd: add event lpm main loop",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "795b4e2cad1a5e34bb0499c59568a4ca16512650",
    "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/20200128053506.2173-9-pbhagavatula@marvell.com/mbox/",
    "series": [
        {
            "id": 8312,
            "url": "http://patches.dpdk.org/api/series/8312/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=8312",
            "date": "2020-01-28T05:34:54",
            "name": "example/l3fwd: introduce event device support",
            "version": 6,
            "mbox": "http://patches.dpdk.org/series/8312/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/65176/comments/",
    "check": "fail",
    "checks": "http://patches.dpdk.org/api/patches/65176/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 14CA0A04B3;\n\tTue, 28 Jan 2020 06:36:42 +0100 (CET)",
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 98BF81C0C6;\n\tTue, 28 Jan 2020 06:35:59 +0100 (CET)",
            "from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com\n [67.231.156.173]) by dpdk.org (Postfix) with ESMTP id 9D2CB1C0C5\n for <dev@dpdk.org>; Tue, 28 Jan 2020 06:35:57 +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 00S5YjFV016830; Mon, 27 Jan 2020 21:35:57 -0800",
            "from sc-exch03.marvell.com ([199.233.58.183])\n by mx0b-0016f401.pphosted.com with ESMTP id 2xrp2t2fx9-1\n (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT);\n Mon, 27 Jan 2020 21:35:56 -0800",
            "from SC-EXCH01.marvell.com (10.93.176.81) by SC-EXCH03.marvell.com\n (10.93.176.83) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 27 Jan\n 2020 21:35: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.1497.2 via Frontend\n Transport; Mon, 27 Jan 2020 21:35:54 -0800",
            "from BG-LT7430.marvell.com (unknown [10.28.17.49])\n by maili.marvell.com (Postfix) with ESMTP id 966183F7043;\n Mon, 27 Jan 2020 21:35: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=zqxbq3NI7YzAds/8SZs37cvuO9X5dIvwAhj6CWD5mYU=;\n b=r9vrUklyTWQ2Bo6tQr7UiB/tstuxeJPdWOmN7zXA7ibd5Het//wU2DUTJZKaSSNqNI0Z\n pm1XeCIn254Ya4zPEBArYDAdZR9godrWWdEPeu2x2cYr80AWbXud3uWDPDw9xFkJH4C8\n AKjlpdfBy8guSRZ/s/PeiWv4i7rmfoT2tyBekl5Zk3c1tIgpRgI9KKxXF88HHY0O1FOb\n iwTiUAto1lQ4isTjrYUZrRdCvAYU8WiGvgdGqFmXZX6yX401gIl9VoPQHf//qQfy67Am\n HB4361KZ/cgFFpVTE+N/Zm/Ef3NvV9tZuq4sy9QXLFUdqI1LgzccE4SbFOVV6uxZ6gY5 Zw==",
        "From": "<pbhagavatula@marvell.com>",
        "To": "<jerinj@marvell.com>, <konstantin.ananyev@intel.com>, Marko Kovacevic\n <marko.kovacevic@intel.com>, Ori Kam <orika@mellanox.com>, Bruce Richardson\n <bruce.richardson@intel.com>, Radu Nicolau <radu.nicolau@intel.com>, \"Akhil\n Goyal\" <akhil.goyal@nxp.com>, Tomasz Kantecki <tomasz.kantecki@intel.com>,\n Sunil Kumar Kori <skori@marvell.com>, Pavan Nikhilesh\n <pbhagavatula@marvell.com>",
        "CC": "<dev@dpdk.org>",
        "Date": "Tue, 28 Jan 2020 11:05:02 +0530",
        "Message-ID": "<20200128053506.2173-9-pbhagavatula@marvell.com>",
        "X-Mailer": "git-send-email 2.17.1",
        "In-Reply-To": "<20200128053506.2173-1-pbhagavatula@marvell.com>",
        "References": "<20200124040542.2360--1-pbhagavatula@marvell.com>\n <20200128053506.2173-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.138, 18.0.572\n definitions=2020-01-27_08:2020-01-24,\n 2020-01-27 signatures=0",
        "Subject": "[dpdk-dev] [PATCH v6 08/11] examples/l3fwd: add event lpm main loop",
        "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: Pavan Nikhilesh <pbhagavatula@marvell.com>\n\nAdd lpm main loop for handling events based on capabilities of the\nevent device.\n\nSigned-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>\n---\n examples/l3fwd/l3fwd.h       |   9 ++\n examples/l3fwd/l3fwd_event.c |   9 ++\n examples/l3fwd/l3fwd_event.h |   5 +\n examples/l3fwd/l3fwd_lpm.c   | 203 +++++++++++++++++++++++++++++++++++\n examples/l3fwd/main.c        |   1 +\n 5 files changed, 227 insertions(+)",
    "diff": "diff --git a/examples/l3fwd/l3fwd.h b/examples/l3fwd/l3fwd.h\nindex ed5ba5f3b..b3cdcd496 100644\n--- a/examples/l3fwd/l3fwd.h\n+++ b/examples/l3fwd/l3fwd.h\n@@ -207,6 +207,15 @@ em_main_loop(__attribute__((unused)) void *dummy);\n int\n lpm_main_loop(__attribute__((unused)) void *dummy);\n \n+int\n+lpm_event_main_loop_tx_d(__attribute__((unused)) void *dummy);\n+int\n+lpm_event_main_loop_tx_d_burst(__attribute__((unused)) void *dummy);\n+int\n+lpm_event_main_loop_tx_q(__attribute__((unused)) void *dummy);\n+int\n+lpm_event_main_loop_tx_q_burst(__attribute__((unused)) void *dummy);\n+\n /* Return ipv4/ipv6 fwd lookup struct for LPM or EM. */\n void *\n em_get_ipv4_l3fwd_lookup_struct(const int socketid);\ndiff --git a/examples/l3fwd/l3fwd_event.c b/examples/l3fwd/l3fwd_event.c\nindex 1ed42c3ab..ebddd8f97 100644\n--- a/examples/l3fwd/l3fwd_event.c\n+++ b/examples/l3fwd/l3fwd_event.c\n@@ -211,6 +211,12 @@ void\n l3fwd_event_resource_setup(struct rte_eth_conf *port_conf)\n {\n \tstruct l3fwd_event_resources *evt_rsrc = l3fwd_get_eventdev_rsrc();\n+\tconst event_loop_cb lpm_event_loop[2][2] = {\n+\t\t[0][0] = lpm_event_main_loop_tx_d,\n+\t\t[0][1] = lpm_event_main_loop_tx_d_burst,\n+\t\t[1][0] = lpm_event_main_loop_tx_q,\n+\t\t[1][1] = lpm_event_main_loop_tx_q_burst,\n+\t};\n \tuint32_t event_queue_cfg;\n \tint ret;\n \n@@ -242,4 +248,7 @@ l3fwd_event_resource_setup(struct rte_eth_conf *port_conf)\n \tret = rte_event_dev_start(evt_rsrc->event_d_id);\n \tif (ret < 0)\n \t\trte_exit(EXIT_FAILURE, \"Error in starting eventdev\");\n+\n+\tevt_rsrc->ops.lpm_event_loop = lpm_event_loop[evt_rsrc->tx_mode_q]\n+\t\t\t\t\t\t       [evt_rsrc->has_burst];\n }\ndiff --git a/examples/l3fwd/l3fwd_event.h b/examples/l3fwd/l3fwd_event.h\nindex b1ae970d4..0e4616417 100644\n--- a/examples/l3fwd/l3fwd_event.h\n+++ b/examples/l3fwd/l3fwd_event.h\n@@ -14,6 +14,11 @@\n \n #include \"l3fwd.h\"\n \n+#define L3FWD_EVENT_SINGLE     0x1\n+#define L3FWD_EVENT_BURST      0x2\n+#define L3FWD_EVENT_TX_DIRECT  0x4\n+#define L3FWD_EVENT_TX_ENQ     0x8\n+\n typedef uint32_t (*event_device_setup_cb)(void);\n typedef void (*event_queue_setup_cb)(uint32_t event_queue_cfg);\n typedef void (*event_port_setup_cb)(void);\ndiff --git a/examples/l3fwd/l3fwd_lpm.c b/examples/l3fwd/l3fwd_lpm.c\nindex 349de2703..058a60b1d 100644\n--- a/examples/l3fwd/l3fwd_lpm.c\n+++ b/examples/l3fwd/l3fwd_lpm.c\n@@ -28,6 +28,7 @@\n #include <rte_lpm6.h>\n \n #include \"l3fwd.h\"\n+#include \"l3fwd_event.h\"\n \n struct ipv4_l3fwd_lpm_route {\n \tuint32_t ip;\n@@ -254,6 +255,208 @@ lpm_main_loop(__attribute__((unused)) void *dummy)\n \treturn 0;\n }\n \n+static __rte_always_inline uint16_t\n+lpm_process_event_pkt(const struct lcore_conf *lconf, struct rte_mbuf *mbuf)\n+{\n+\tmbuf->port = lpm_get_dst_port(lconf, mbuf, mbuf->port);\n+\n+#if defined RTE_ARCH_X86 || defined RTE_MACHINE_CPUFLAG_NEON \\\n+\t|| defined RTE_ARCH_PPC_64\n+\tprocess_packet(mbuf, &mbuf->port);\n+#else\n+\n+\tstruct rte_ether_hdr *eth_hdr = rte_pktmbuf_mtod(mbuf,\n+\t\t\tstruct rte_ether_hdr *);\n+#ifdef DO_RFC_1812_CHECKS\n+\tstruct rte_ipv4_hdr *ipv4_hdr;\n+\tif (RTE_ETH_IS_IPV4_HDR(mbuf->packet_type)) {\n+\t\t/* Handle IPv4 headers.*/\n+\t\tipv4_hdr = rte_pktmbuf_mtod_offset(mbuf,\n+\t\t\t\tstruct rte_ipv4_hdr *,\n+\t\t\t\tsizeof(struct rte_ether_hdr));\n+\n+\t\tif (is_valid_ipv4_pkt(ipv4_hdr, mbuf->pkt_len)\n+\t\t\t\t< 0) {\n+\t\t\tmbuf->port = BAD_PORT;\n+\t\t\tcontinue;\n+\t\t}\n+\t\t/* Update time to live and header checksum */\n+\t\t--(ipv4_hdr->time_to_live);\n+\t\t++(ipv4_hdr->hdr_checksum);\n+\t}\n+#endif\n+\t/* dst addr */\n+\t*(uint64_t *)&eth_hdr->d_addr = dest_eth_addr[mbuf->port];\n+\n+\t/* src addr */\n+\trte_ether_addr_copy(&ports_eth_addr[mbuf->port],\n+\t\t\t&eth_hdr->s_addr);\n+#endif\n+\treturn mbuf->port;\n+}\n+\n+static __rte_always_inline void\n+lpm_event_loop_single(struct l3fwd_event_resources *evt_rsrc,\n+\t\tconst uint8_t flags)\n+{\n+\tconst int event_p_id = l3fwd_get_free_event_port(evt_rsrc);\n+\tconst uint8_t tx_q_id = evt_rsrc->evq.event_q_id[\n+\t\tevt_rsrc->evq.nb_queues - 1];\n+\tconst uint8_t event_d_id = evt_rsrc->event_d_id;\n+\tstruct lcore_conf *lconf;\n+\tunsigned int lcore_id;\n+\tstruct rte_event ev;\n+\n+\tif (event_p_id < 0)\n+\t\treturn;\n+\n+\tlcore_id = rte_lcore_id();\n+\tlconf = &lcore_conf[lcore_id];\n+\n+\tRTE_LOG(INFO, L3FWD, \"entering %s on lcore %u\\n\", __func__, lcore_id);\n+\twhile (!force_quit) {\n+\t\tif (!rte_event_dequeue_burst(event_d_id, event_p_id, &ev, 1, 0))\n+\t\t\tcontinue;\n+\n+\t\tif (lpm_process_event_pkt(lconf, ev.mbuf) == BAD_PORT) {\n+\t\t\trte_pktmbuf_free(ev.mbuf);\n+\t\t\tcontinue;\n+\t\t}\n+\n+\t\tif (flags & L3FWD_EVENT_TX_ENQ) {\n+\t\t\tev.queue_id = tx_q_id;\n+\t\t\tev.op = RTE_EVENT_OP_FORWARD;\n+\t\t\twhile (rte_event_enqueue_burst(event_d_id, event_p_id,\n+\t\t\t\t\t\t&ev, 1) && !force_quit)\n+\t\t\t\t;\n+\t\t}\n+\n+\t\tif (flags & L3FWD_EVENT_TX_DIRECT) {\n+\t\t\trte_event_eth_tx_adapter_txq_set(ev.mbuf, 0);\n+\t\t\twhile (!rte_event_eth_tx_adapter_enqueue(event_d_id,\n+\t\t\t\t\t\tevent_p_id, &ev, 1, 0) &&\n+\t\t\t\t\t!force_quit)\n+\t\t\t\t;\n+\t\t}\n+\t}\n+}\n+\n+static __rte_always_inline void\n+lpm_event_loop_burst(struct l3fwd_event_resources *evt_rsrc,\n+\t\tconst uint8_t flags)\n+{\n+\tconst int event_p_id = l3fwd_get_free_event_port(evt_rsrc);\n+\tconst uint8_t tx_q_id = evt_rsrc->evq.event_q_id[\n+\t\tevt_rsrc->evq.nb_queues - 1];\n+\tconst uint8_t event_d_id = evt_rsrc->event_d_id;\n+\tconst uint16_t deq_len = evt_rsrc->deq_depth;\n+\tstruct rte_event events[MAX_PKT_BURST];\n+\tstruct lcore_conf *lconf;\n+\tunsigned int lcore_id;\n+\tint i, nb_enq, nb_deq;\n+\n+\tif (event_p_id < 0)\n+\t\treturn;\n+\n+\tlcore_id = rte_lcore_id();\n+\n+\tlconf = &lcore_conf[lcore_id];\n+\n+\tRTE_LOG(INFO, L3FWD, \"entering %s on lcore %u\\n\", __func__, lcore_id);\n+\n+\twhile (!force_quit) {\n+\t\t/* Read events from RX queues */\n+\t\tnb_deq = rte_event_dequeue_burst(event_d_id, event_p_id,\n+\t\t\t\tevents, deq_len, 0);\n+\t\tif (nb_deq == 0) {\n+\t\t\trte_pause();\n+\t\t\tcontinue;\n+\t\t}\n+\n+\t\tfor (i = 0; i < nb_deq; i++) {\n+\t\t\tif (flags & L3FWD_EVENT_TX_ENQ) {\n+\t\t\t\tevents[i].queue_id = tx_q_id;\n+\t\t\t\tevents[i].op = RTE_EVENT_OP_FORWARD;\n+\t\t\t}\n+\n+\t\t\tif (flags & L3FWD_EVENT_TX_DIRECT)\n+\t\t\t\trte_event_eth_tx_adapter_txq_set(events[i].mbuf,\n+\t\t\t\t\t\t\t\t 0);\n+\n+\t\t\tlpm_process_event_pkt(lconf, events[i].mbuf);\n+\t\t}\n+\n+\t\tif (flags & L3FWD_EVENT_TX_ENQ) {\n+\t\t\tnb_enq = rte_event_enqueue_burst(event_d_id, event_p_id,\n+\t\t\t\t\tevents, nb_deq);\n+\t\t\twhile (nb_enq < nb_deq && !force_quit)\n+\t\t\t\tnb_enq += rte_event_enqueue_burst(event_d_id,\n+\t\t\t\t\t\tevent_p_id, events + nb_enq,\n+\t\t\t\t\t\tnb_deq - nb_enq);\n+\t\t}\n+\n+\t\tif (flags & L3FWD_EVENT_TX_DIRECT) {\n+\t\t\tnb_enq = rte_event_eth_tx_adapter_enqueue(event_d_id,\n+\t\t\t\t\tevent_p_id, events, nb_deq, 0);\n+\t\t\twhile (nb_enq < nb_deq && !force_quit)\n+\t\t\t\tnb_enq += rte_event_eth_tx_adapter_enqueue(\n+\t\t\t\t\t\tevent_d_id, event_p_id,\n+\t\t\t\t\t\tevents + nb_enq,\n+\t\t\t\t\t\tnb_deq - nb_enq, 0);\n+\t\t}\n+\t}\n+}\n+\n+static __rte_always_inline void\n+lpm_event_loop(struct l3fwd_event_resources *evt_rsrc,\n+\t\t const uint8_t flags)\n+{\n+\tif (flags & L3FWD_EVENT_SINGLE)\n+\t\tlpm_event_loop_single(evt_rsrc, flags);\n+\tif (flags & L3FWD_EVENT_BURST)\n+\t\tlpm_event_loop_burst(evt_rsrc, flags);\n+}\n+\n+int __rte_noinline\n+lpm_event_main_loop_tx_d(__attribute__((unused)) void *dummy)\n+{\n+\tstruct l3fwd_event_resources *evt_rsrc =\n+\t\t\t\t\tl3fwd_get_eventdev_rsrc();\n+\n+\tlpm_event_loop(evt_rsrc, L3FWD_EVENT_TX_DIRECT | L3FWD_EVENT_SINGLE);\n+\treturn 0;\n+}\n+\n+int __rte_noinline\n+lpm_event_main_loop_tx_d_burst(__attribute__((unused)) void *dummy)\n+{\n+\tstruct l3fwd_event_resources *evt_rsrc =\n+\t\t\t\t\tl3fwd_get_eventdev_rsrc();\n+\n+\tlpm_event_loop(evt_rsrc, L3FWD_EVENT_TX_DIRECT | L3FWD_EVENT_BURST);\n+\treturn 0;\n+}\n+\n+int __rte_noinline\n+lpm_event_main_loop_tx_q(__attribute__((unused)) void *dummy)\n+{\n+\tstruct l3fwd_event_resources *evt_rsrc =\n+\t\t\t\t\tl3fwd_get_eventdev_rsrc();\n+\n+\tlpm_event_loop(evt_rsrc, L3FWD_EVENT_TX_ENQ | L3FWD_EVENT_SINGLE);\n+\treturn 0;\n+}\n+\n+int __rte_noinline\n+lpm_event_main_loop_tx_q_burst(__attribute__((unused)) void *dummy)\n+{\n+\tstruct l3fwd_event_resources *evt_rsrc =\n+\t\t\t\t\tl3fwd_get_eventdev_rsrc();\n+\n+\tlpm_event_loop(evt_rsrc, L3FWD_EVENT_TX_ENQ | L3FWD_EVENT_BURST);\n+\treturn 0;\n+}\n+\n void\n setup_lpm(const int socketid)\n {\ndiff --git a/examples/l3fwd/main.c b/examples/l3fwd/main.c\nindex 4bb00a48b..b8bd19b41 100644\n--- a/examples/l3fwd/main.c\n+++ b/examples/l3fwd/main.c\n@@ -1226,6 +1226,7 @@ main(int argc, char **argv)\n \t/* Configure eventdev parameters if user has requested */\n \tif (evt_rsrc->enabled) {\n \t\tl3fwd_event_resource_setup(&port_conf);\n+\t\tl3fwd_lkp.main_loop = evt_rsrc->ops.lpm_event_loop;\n \t\tl3fwd_event_service_setup();\n \t} else\n \t\tl3fwd_poll_resource_setup();\n",
    "prefixes": [
        "v6",
        "08/11"
    ]
}