get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 66920,
    "url": "http://patches.dpdk.org/api/patches/66920/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20200318213551.3489504-27-jerinj@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": "<20200318213551.3489504-27-jerinj@marvell.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20200318213551.3489504-27-jerinj@marvell.com",
    "date": "2020-03-18T21:35:51",
    "name": "[v1,26/26] l3fwd-graph: add graph config and main loop",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "e7a05773e5bee14d4fb9fb1ce4befa712fdd7873",
    "submitter": {
        "id": 1188,
        "url": "http://patches.dpdk.org/api/people/1188/?format=api",
        "name": "Jerin Jacob Kollanukkaran",
        "email": "jerinj@marvell.com"
    },
    "delegate": {
        "id": 1,
        "url": "http://patches.dpdk.org/api/users/1/?format=api",
        "username": "tmonjalo",
        "first_name": "Thomas",
        "last_name": "Monjalon",
        "email": "thomas@monjalon.net"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/20200318213551.3489504-27-jerinj@marvell.com/mbox/",
    "series": [
        {
            "id": 8974,
            "url": "http://patches.dpdk.org/api/series/8974/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=8974",
            "date": "2020-03-18T21:35:25",
            "name": "graph: introduce graph subsystem",
            "version": 1,
            "mbox": "http://patches.dpdk.org/series/8974/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/66920/comments/",
    "check": "fail",
    "checks": "http://patches.dpdk.org/api/patches/66920/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 5F06CA057D;\n\tWed, 18 Mar 2020 22:40:03 +0100 (CET)",
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 144131C122;\n\tWed, 18 Mar 2020 22:37:10 +0100 (CET)",
            "from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com\n [67.231.156.173]) by dpdk.org (Postfix) with ESMTP id A473C1C122\n for <dev@dpdk.org>; Wed, 18 Mar 2020 22:37:08 +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 02ILVPcI013826; Wed, 18 Mar 2020 14:37:07 -0700",
            "from sc-exch01.marvell.com ([199.233.58.181])\n by mx0b-0016f401.pphosted.com with ESMTP id 2yu9rpcc7y-2\n (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT);\n Wed, 18 Mar 2020 14:37:07 -0700",
            "from SC-EXCH01.marvell.com (10.93.176.81) by SC-EXCH01.marvell.com\n (10.93.176.81) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 18 Mar\n 2020 14:37:05 -0700",
            "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; Wed, 18 Mar 2020 14:37:05 -0700",
            "from jerin-lab.marvell.com (jerin-lab.marvell.com [10.28.34.14])\n by maili.marvell.com (Postfix) with ESMTP id 847843F704E;\n Wed, 18 Mar 2020 14:37:01 -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=cVckand9r0/Jr1ZOG/cJPu2sIw6GxkaHUkL6apEIsAI=;\n b=OomCpZPuZhHQMnL8anrJmzvyCwoanS4L4GC7/jGt+0crEFvhxA/qeeC9PRwZpRkNrVsO\n fW0N6BDx8X9a8fhOcfCEQ6L7UWeZdy9gITGAItF9pXsWoHsxHT0dxeobd5AfaE5L+28P\n Ntj898PrAwteULUuf/zzuBlwSNLru34mViYAaLAdRJbrxoigHDLwW7cEMvl2TjuTBf2O\n YKU8MXb+QvEvq6FMfi/g07xfrYcduLjbLubml1cKuaiDFJUFtTEK5GzwozqRYhUO0Lj1\n bHnPs8d6N7z9dCL0L/GclwYbWQsjggOetz/Vatps41qSMyl87cFRS10g8FHzErgvEAhO tw==",
        "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>, <kirankumark@marvell.com>",
        "Date": "Thu, 19 Mar 2020 03:05:51 +0530",
        "Message-ID": "<20200318213551.3489504-27-jerinj@marvell.com>",
        "X-Mailer": "git-send-email 2.25.1",
        "In-Reply-To": "<20200318213551.3489504-1-jerinj@marvell.com>",
        "References": "<20200318213551.3489504-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.645\n definitions=2020-03-18_07:2020-03-18,\n 2020-03-18 signatures=0",
        "Subject": "[dpdk-dev] [PATCH v1 26/26] 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 | 241 +++++++++++++++++++++++++++++++++++-\n 1 file changed, 239 insertions(+), 2 deletions(-)",
    "diff": "diff --git a/examples/l3fwd-graph/main.c b/examples/l3fwd-graph/main.c\nindex 436987877..104a4d8db 100644\n--- a/examples/l3fwd-graph/main.c\n+++ b/examples/l3fwd-graph/main.c\n@@ -22,9 +22,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@@ -74,12 +78,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@@ -118,6 +127,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@@ -627,17 +655,87 @@ 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+\tconst char *node_patterns[64] = {\n+\t\t\"ip4*\",\n+\t\t\"ethdev_tx-*\",\n+\t\t\"pkt_drop\",\n+\t};\n+\tuint8_t rewrite_data[2 * sizeof(struct rte_ether_addr)];\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 \tstruct lcore_conf *qconf;\n+\tuint16_t nb_patterns = 3;\n+\tuint16_t nb_graphs = 0;\n+\tuint8_t rewrite_len;\n \tuint32_t lcore_id;\n-\tuint32_t nb_ports;\n \tint ret;\n \n \t/* Init EAL */\n@@ -786,6 +884,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@@ -829,11 +939,26 @@ 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\tqconf->graph_id = nb_graphs;\n+\t\t\tnb_graphs++;\n \t\t}\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@@ -861,6 +986,118 @@ main(int argc, char **argv)\n \n \tcheck_all_ports_link_status(enabled_port_mask);\n \n+\t/* Graph Initialization */\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 != qconf->graph_id)\n+\t\t\trte_exit(EXIT_FAILURE,\n+\t\t\t\t \"rte_graph_create(): graph_id=%d not \"\n+\t\t\t\t \" as expected for lcore %u(%u\\n\",\n+\t\t\t\t graph_id, lcore_id, qconf->graph_id);\n+\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+\t\tuint16_t next_hop;\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+\t\tnext_hop = i;\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\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, next_hop,\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 for a given destination */\n+\t\tret = rte_node_ip4_rewrite_add(next_hop, 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\",\n+\t\t\t\t next_hop, route_str);\n+\n+\t\tRTE_LOG(INFO, L3FWD_GRAPH, \"Added route %s, next_hop %u\\n\",\n+\t\t\troute_str, next_hop);\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\trte_graph_destroy(lcore_conf[lcore_id].name);\n+\t\tif (ret < 0) {\n+\t\t\tret = -1;\n+\t\t\tbreak;\n+\t\t}\n+\t}\n+\n \t/* Stop ports */\n \tRTE_ETH_FOREACH_DEV(portid) {\n \t\tif ((enabled_port_mask & (1 << portid)) == 0)\n",
    "prefixes": [
        "v1",
        "26/26"
    ]
}