get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 68217,
    "url": "https://patches.dpdk.org/api/patches/68217/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/20200411141428.1987768-28-jerinj@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": "<20200411141428.1987768-28-jerinj@marvell.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20200411141428.1987768-28-jerinj@marvell.com",
    "date": "2020-04-11T14:14:26",
    "name": "[v5,27/29] l3fwd-graph: add graph config and main loop",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "d676c0d1d6c71665101bfa458a22f55fd87dc744",
    "submitter": {
        "id": 1188,
        "url": "https://patches.dpdk.org/api/people/1188/?format=api",
        "name": "Jerin Jacob Kollanukkaran",
        "email": "jerinj@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/20200411141428.1987768-28-jerinj@marvell.com/mbox/",
    "series": [
        {
            "id": 9314,
            "url": "https://patches.dpdk.org/api/series/9314/?format=api",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=9314",
            "date": "2020-04-11T14:13:59",
            "name": "graph: introduce graph subsystem",
            "version": 5,
            "mbox": "https://patches.dpdk.org/series/9314/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/68217/comments/",
    "check": "success",
    "checks": "https://patches.dpdk.org/api/patches/68217/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 A7C81A059F;\n\tSat, 11 Apr 2020 16:20:07 +0200 (CEST)",
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id D411D1C2F6;\n\tSat, 11 Apr 2020 16:16:30 +0200 (CEST)",
            "from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com\n [67.231.156.173]) by dpdk.org (Postfix) with ESMTP id 8F9881C1B1\n for <dev@dpdk.org>; Sat, 11 Apr 2020 16:16:29 +0200 (CEST)",
            "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 03BEEvWn023876; Sat, 11 Apr 2020 07:16:28 -0700",
            "from sc-exch01.marvell.com ([199.233.58.181])\n by mx0b-0016f401.pphosted.com with ESMTP id 30bddkgayc-1\n (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT);\n Sat, 11 Apr 2020 07:16:28 -0700",
            "from DC5-EXCH01.marvell.com (10.69.176.38) by SC-EXCH01.marvell.com\n (10.93.176.81) with Microsoft SMTP Server (TLS) id 15.0.1497.2;\n Sat, 11 Apr 2020 07:16:25 -0700",
            "from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH01.marvell.com\n (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.2;\n Sat, 11 Apr 2020 07:16:25 -0700",
            "from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com\n (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.2 via Frontend\n Transport; Sat, 11 Apr 2020 07:16:25 -0700",
            "from jerin-lab.marvell.com (jerin-lab.marvell.com [10.28.34.14])\n by maili.marvell.com (Postfix) with ESMTP id 1F4943F7040;\n Sat, 11 Apr 2020 07:16:19 -0700 (PDT)"
        ],
        "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=/3eFYPGDnPm8o6Ko5NOIk9O2aMeBDnNcCjUNQCdq/U4=;\n b=uG7VYGfc9zAzFmYC0QMTjONYBKQe7Jc/jRJdLr4tr+lZgrD7LzGeTF7yvOZBlaTnOPXe\n +yCMCgIsIYtIAQcxUKQeYSX8kMmcoZwdOiFyOa2mA1c8pKoafDsvCDwWX6iRFCoG3YXd\n IL4Ga7zrXA9pQR6InR6IK6zy1Dlo6llVS4FChEN9id+P+L/ZDV1rx1HIAaaaz2iDA7yb\n 8h2j0zGnJS/EMkXvzHh1B6F3OgVRh+4FBrWyQkFDed23GI3XnNvo9x7mWKfgU/yIS8zt\n tHsqNX6GT5N9hK4N79kAODljs57KG7fM+BzBCtMtam+MVinue7Rm6q7KhSvcI17jptbI UA==",
        "From": "<jerinj@marvell.com>",
        "To": "Marko Kovacevic <marko.kovacevic@intel.com>, Ori Kam <orika@mellanox.com>,\n Bruce Richardson <bruce.richardson@intel.com>, Radu Nicolau\n <radu.nicolau@intel.com>, Akhil Goyal <akhil.goyal@nxp.com>,\n Tomasz Kantecki <tomasz.kantecki@intel.com>,\n Sunil Kumar Kori <skori@marvell.com>, \"Pavan\n Nikhilesh\" <pbhagavatula@marvell.com>, Nithin Dabilpuram\n <ndabilpuram@marvell.com>",
        "CC": "<dev@dpdk.org>, <thomas@monjalon.net>, <david.marchand@redhat.com>,\n <mdr@ashroe.eu>, <mattias.ronnblom@ericsson.com>,\n <kirankumark@marvell.com>, <xiao.w.wang@intel.com>, <amo@semihalf.com>",
        "Date": "Sat, 11 Apr 2020 19:44:26 +0530",
        "Message-ID": "<20200411141428.1987768-28-jerinj@marvell.com>",
        "X-Mailer": "git-send-email 2.25.1",
        "In-Reply-To": "<20200411141428.1987768-1-jerinj@marvell.com>",
        "References": "<20200405085613.1336841-1-jerinj@marvell.com>\n <20200411141428.1987768-1-jerinj@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.676\n definitions=2020-04-11_04:2020-04-09,\n 2020-04-11 signatures=0",
        "Subject": "[dpdk-dev] [PATCH v5 27/29] l3fwd-graph: add graph config and main\n\tloop",
        "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: Nithin Dabilpuram <ndabilpuram@marvell.com>\n\nAdd graph creation, configuration logic and graph main loop.\nThis graph main loop is run on every slave lcore and calls\nrte_graph_walk() to walk over lcore specific rte_graph.\nMaster core accumulates and prints graph walk stats of all the\nlcore's graph's.\n\nSigned-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>\n---\n examples/l3fwd-graph/main.c | 248 +++++++++++++++++++++++++++++++++++-\n 1 file changed, 246 insertions(+), 2 deletions(-)",
    "diff": "diff --git a/examples/l3fwd-graph/main.c b/examples/l3fwd-graph/main.c\nindex 7ea788589..40108a0d3 100644\n--- a/examples/l3fwd-graph/main.c\n+++ b/examples/l3fwd-graph/main.c\n@@ -23,9 +23,13 @@\n #include <rte_cycles.h>\n #include <rte_eal.h>\n #include <rte_ethdev.h>\n+#include <rte_graph_worker.h>\n+#include <rte_launch.h>\n #include <rte_lcore.h>\n #include <rte_log.h>\n #include <rte_mempool.h>\n+#include <rte_node_eth_api.h>\n+#include <rte_node_ip4_api.h>\n #include <rte_per_lcore.h>\n #include <rte_string_fns.h>\n #include <rte_vect.h>\n@@ -75,12 +79,17 @@ static uint32_t enabled_port_mask;\n struct lcore_rx_queue {\n \tuint16_t port_id;\n \tuint8_t queue_id;\n+\tchar node_name[RTE_NODE_NAMESIZE];\n };\n \n /* Lcore conf */\n struct lcore_conf {\n \tuint16_t n_rx_queue;\n \tstruct lcore_rx_queue rx_queue_list[MAX_RX_QUEUE_PER_LCORE];\n+\n+\tstruct rte_graph *graph;\n+\tchar name[RTE_GRAPH_NAMESIZE];\n+\trte_graph_t graph_id;\n } __rte_cache_aligned;\n \n static struct lcore_conf lcore_conf[RTE_MAX_LCORE];\n@@ -119,6 +128,25 @@ static struct rte_eth_conf port_conf = {\n \n static struct rte_mempool *pktmbuf_pool[RTE_MAX_ETHPORTS][NB_SOCKETS];\n \n+static struct rte_node_ethdev_config ethdev_conf[RTE_MAX_ETHPORTS];\n+\n+struct ipv4_l3fwd_lpm_route {\n+\tuint32_t ip;\n+\tuint8_t depth;\n+\tuint8_t if_out;\n+};\n+\n+#define IPV4_L3FWD_LPM_NUM_ROUTES                                              \\\n+\t(sizeof(ipv4_l3fwd_lpm_route_array) /                                  \\\n+\t sizeof(ipv4_l3fwd_lpm_route_array[0]))\n+/* 198.18.0.0/16 are set aside for RFC2544 benchmarking. */\n+static struct ipv4_l3fwd_lpm_route ipv4_l3fwd_lpm_route_array[] = {\n+\t{RTE_IPV4(198, 18, 0, 0), 24, 0}, {RTE_IPV4(198, 18, 1, 0), 24, 1},\n+\t{RTE_IPV4(198, 18, 2, 0), 24, 2}, {RTE_IPV4(198, 18, 3, 0), 24, 3},\n+\t{RTE_IPV4(198, 18, 4, 0), 24, 4}, {RTE_IPV4(198, 18, 5, 0), 24, 5},\n+\t{RTE_IPV4(198, 18, 6, 0), 24, 6}, {RTE_IPV4(198, 18, 7, 0), 24, 7},\n+};\n+\n static int\n check_lcore_params(void)\n {\n@@ -633,17 +661,89 @@ signal_handler(int signum)\n \t}\n }\n \n+static void\n+print_stats(void)\n+{\n+\tconst char topLeft[] = {27, '[', '1', ';', '1', 'H', '\\0'};\n+\tconst char clr[] = {27, '[', '2', 'J', '\\0'};\n+\tstruct rte_graph_cluster_stats_param s_param;\n+\tstruct rte_graph_cluster_stats *stats;\n+\tconst char *pattern = \"worker_*\";\n+\n+\t/* Prepare stats object */\n+\tmemset(&s_param, 0, sizeof(s_param));\n+\ts_param.f = stdout;\n+\ts_param.socket_id = SOCKET_ID_ANY;\n+\ts_param.graph_patterns = &pattern;\n+\ts_param.nb_graph_patterns = 1;\n+\n+\tstats = rte_graph_cluster_stats_create(&s_param);\n+\tif (stats == NULL)\n+\t\trte_exit(EXIT_FAILURE, \"Unable to create stats object\\n\");\n+\n+\twhile (!force_quit) {\n+\t\t/* Clear screen and move to top left */\n+\t\tprintf(\"%s%s\", clr, topLeft);\n+\t\trte_graph_cluster_stats_get(stats, 0);\n+\t\trte_delay_ms(1E3);\n+\t}\n+\n+\trte_graph_cluster_stats_destroy(stats);\n+}\n+\n+/* Main processing loop */\n+static int\n+graph_main_loop(void *conf)\n+{\n+\tstruct lcore_conf *qconf;\n+\tstruct rte_graph *graph;\n+\tuint32_t lcore_id;\n+\n+\tRTE_SET_USED(conf);\n+\n+\tlcore_id = rte_lcore_id();\n+\tqconf = &lcore_conf[lcore_id];\n+\tgraph = qconf->graph;\n+\n+\tif (!graph) {\n+\t\tRTE_LOG(INFO, L3FWD_GRAPH, \"Lcore %u has nothing to do\\n\",\n+\t\t\tlcore_id);\n+\t\treturn 0;\n+\t}\n+\n+\tRTE_LOG(INFO, L3FWD_GRAPH,\n+\t\t\"Entering main loop on lcore %u, graph %s(%p)\\n\", lcore_id,\n+\t\tqconf->name, graph);\n+\n+\twhile (likely(!force_quit))\n+\t\trte_graph_walk(graph);\n+\n+\treturn 0;\n+}\n+\n int\n main(int argc, char **argv)\n {\n+\t/* Rewrite data of src and dst ether addr */\n+\tuint8_t rewrite_data[2 * sizeof(struct rte_ether_addr)];\n+\tstatic const char * const default_patterns[] = {\n+\t\t\"ip4*\",\n+\t\t\"ethdev_tx-*\",\n+\t\t\"pkt_drop\",\n+\t};\n \tuint8_t nb_rx_queue, queue, socketid;\n+\tstruct rte_graph_param graph_conf;\n \tstruct rte_eth_dev_info dev_info;\n+\tuint32_t nb_ports, nb_conf = 0;\n \tuint32_t n_tx_queue, nb_lcores;\n \tstruct rte_eth_txconf *txconf;\n-\tuint16_t queueid, portid;\n+\tuint16_t queueid, portid, i;\n+\tconst char **node_patterns;\n \tstruct lcore_conf *qconf;\n+\tuint16_t nb_graphs = 0;\n+\tuint16_t nb_patterns;\n+\tuint8_t rewrite_len;\n \tuint32_t lcore_id;\n-\tuint32_t nb_ports;\n \tint ret;\n \n \t/* Init EAL */\n@@ -792,6 +892,18 @@ main(int argc, char **argv)\n \t\t\tqueueid++;\n \t\t}\n \n+\t\t/* Setup ethdev node config */\n+\t\tethdev_conf[nb_conf].port_id = portid;\n+\t\tethdev_conf[nb_conf].num_rx_queues = nb_rx_queue;\n+\t\tethdev_conf[nb_conf].num_tx_queues = n_tx_queue;\n+\t\tif (!per_port_pool)\n+\t\t\tethdev_conf[nb_conf].mp = pktmbuf_pool[0];\n+\n+\t\telse\n+\t\t\tethdev_conf[nb_conf].mp = pktmbuf_pool[portid];\n+\t\tethdev_conf[nb_conf].mp_count = NB_SOCKETS;\n+\n+\t\tnb_conf++;\n \t\tprintf(\"\\n\");\n \t}\n \n@@ -835,11 +947,24 @@ main(int argc, char **argv)\n \t\t\t\t\t \"port=%d\\n\",\n \t\t\t\t\t ret, portid);\n \n+\t\t\t/* Add this queue node to its graph */\n+\t\t\tsnprintf(qconf->rx_queue_list[queue].node_name,\n+\t\t\t\t RTE_NODE_NAMESIZE, \"ethdev_rx-%u-%u\", portid,\n+\t\t\t\t queueid);\n \t\t}\n+\n+\t\t/* Alloc a graph to this lcore only if source exists  */\n+\t\tif (qconf->n_rx_queue)\n+\t\t\tnb_graphs++;\n \t}\n \n \tprintf(\"\\n\");\n \n+\t/* Ethdev node config, skip rx queue mapping */\n+\tret = rte_node_eth_config(ethdev_conf, nb_conf, nb_graphs);\n+\tif (ret)\n+\t\trte_exit(EXIT_FAILURE, \"rte_node_eth_config: err=%d\\n\", ret);\n+\n \t/* Start ports */\n \tRTE_ETH_FOREACH_DEV(portid)\n \t{\n@@ -867,6 +992,125 @@ main(int argc, char **argv)\n \n \tcheck_all_ports_link_status(enabled_port_mask);\n \n+\t/* Graph Initialization */\n+\tnb_patterns = RTE_DIM(default_patterns);\n+\tnode_patterns = malloc((MAX_RX_QUEUE_PER_LCORE + nb_patterns) *\n+\t\t\t       sizeof(*node_patterns));\n+\tif (!node_patterns)\n+\t\treturn -ENOMEM;\n+\tmemcpy(node_patterns, default_patterns,\n+\t       nb_patterns * sizeof(*node_patterns));\n+\n+\tmemset(&graph_conf, 0, sizeof(graph_conf));\n+\tgraph_conf.node_patterns = node_patterns;\n+\n+\tfor (lcore_id = 0; lcore_id < RTE_MAX_LCORE; lcore_id++) {\n+\t\trte_graph_t graph_id;\n+\t\trte_edge_t i;\n+\n+\t\tif (rte_lcore_is_enabled(lcore_id) == 0)\n+\t\t\tcontinue;\n+\n+\t\tqconf = &lcore_conf[lcore_id];\n+\n+\t\t/* Skip graph creation if no source exists */\n+\t\tif (!qconf->n_rx_queue)\n+\t\t\tcontinue;\n+\n+\t\t/* Add rx node patterns of this lcore */\n+\t\tfor (i = 0; i < qconf->n_rx_queue; i++) {\n+\t\t\tgraph_conf.node_patterns[nb_patterns + i] =\n+\t\t\t\tqconf->rx_queue_list[i].node_name;\n+\t\t}\n+\n+\t\tgraph_conf.nb_node_patterns = nb_patterns + i;\n+\t\tgraph_conf.socket_id = rte_lcore_to_socket_id(lcore_id);\n+\n+\t\tsnprintf(qconf->name, sizeof(qconf->name), \"worker_%u\",\n+\t\t\t lcore_id);\n+\n+\t\tgraph_id = rte_graph_create(qconf->name, &graph_conf);\n+\t\tif (graph_id == RTE_GRAPH_ID_INVALID)\n+\t\t\trte_exit(EXIT_FAILURE,\n+\t\t\t\t \"rte_graph_create(): graph_id invalid\"\n+\t\t\t\t \" for lcore %u\\n\", lcore_id);\n+\n+\t\tqconf->graph_id = graph_id;\n+\t\tqconf->graph = rte_graph_lookup(qconf->name);\n+\t\tif (!qconf->graph)\n+\t\t\trte_exit(EXIT_FAILURE,\n+\t\t\t\t \"rte_graph_lookup(): graph %s not found\\n\",\n+\t\t\t\t qconf->name);\n+\t}\n+\n+\tmemset(&rewrite_data, 0, sizeof(rewrite_data));\n+\trewrite_len = sizeof(rewrite_data);\n+\n+\t/* Add route to ip4 graph infra */\n+\tfor (i = 0; i < IPV4_L3FWD_LPM_NUM_ROUTES; i++) {\n+\t\tchar route_str[INET6_ADDRSTRLEN * 4];\n+\t\tchar abuf[INET6_ADDRSTRLEN];\n+\t\tstruct in_addr in;\n+\t\tuint32_t dst_port;\n+\n+\t\t/* Skip unused ports */\n+\t\tif ((1 << ipv4_l3fwd_lpm_route_array[i].if_out &\n+\t\t     enabled_port_mask) == 0)\n+\t\t\tcontinue;\n+\n+\t\tdst_port = ipv4_l3fwd_lpm_route_array[i].if_out;\n+\n+\t\tin.s_addr = htonl(ipv4_l3fwd_lpm_route_array[i].ip);\n+\t\tsnprintf(route_str, sizeof(route_str), \"%s / %d (%d)\",\n+\t\t\t inet_ntop(AF_INET, &in, abuf, sizeof(abuf)),\n+\t\t\t ipv4_l3fwd_lpm_route_array[i].depth,\n+\t\t\t ipv4_l3fwd_lpm_route_array[i].if_out);\n+\n+\t\t/* Use route index 'i' as next hop id */\n+\t\tret = rte_node_ip4_route_add(\n+\t\t\tipv4_l3fwd_lpm_route_array[i].ip,\n+\t\t\tipv4_l3fwd_lpm_route_array[i].depth, i,\n+\t\t\tRTE_NODE_IP4_LOOKUP_NEXT_REWRITE);\n+\n+\t\tif (ret < 0)\n+\t\t\trte_exit(EXIT_FAILURE,\n+\t\t\t\t \"Unable to add ip4 route %s to graph\\n\",\n+\t\t\t\t route_str);\n+\n+\t\tmemcpy(rewrite_data, val_eth + dst_port, rewrite_len);\n+\n+\t\t/* Add next hop rewrite data for id 'i' */\n+\t\tret = rte_node_ip4_rewrite_add(i, rewrite_data,\n+\t\t\t\t\t       rewrite_len, dst_port);\n+\t\tif (ret < 0)\n+\t\t\trte_exit(EXIT_FAILURE,\n+\t\t\t\t \"Unable to add next hop %u for \"\n+\t\t\t\t \"route %s\\n\", i, route_str);\n+\n+\t\tRTE_LOG(INFO, L3FWD_GRAPH, \"Added route %s, next_hop %u\\n\",\n+\t\t\troute_str, i);\n+\t}\n+\n+\t/* Launch per-lcore init on every slave lcore */\n+\trte_eal_mp_remote_launch(graph_main_loop, NULL, SKIP_MASTER);\n+\n+\t/* Accumulate and print stats on master until exit */\n+\tif (rte_graph_has_stats_feature())\n+\t\tprint_stats();\n+\n+\t/* Wait for slave cores to exit */\n+\tret = 0;\n+\tRTE_LCORE_FOREACH_SLAVE(lcore_id) {\n+\t\tret = rte_eal_wait_lcore(lcore_id);\n+\t\t/* Destroy graph */\n+\t\tif (ret < 0 || rte_graph_destroy(\n+\t\t\trte_graph_from_name(lcore_conf[lcore_id].name))) {\n+\t\t\tret = -1;\n+\t\t\tbreak;\n+\t\t}\n+\t}\n+\tfree(node_patterns);\n+\n \t/* Stop ports */\n \tRTE_ETH_FOREACH_DEV(portid) {\n \t\tif ((enabled_port_mask & (1 << portid)) == 0)\n",
    "prefixes": [
        "v5",
        "27/29"
    ]
}