get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 88018,
    "url": "http://patches.dpdk.org/api/patches/88018/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20210219150945.2071651-4-conor.walsh@intel.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": "<20210219150945.2071651-4-conor.walsh@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20210219150945.2071651-4-conor.walsh@intel.com",
    "date": "2021-02-19T15:09:43",
    "name": "[v3,3/5] examples/l3fwd: add FIB infrastructure",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "ebf154454537a4e823309e1b49a781ea95fe6d5a",
    "submitter": {
        "id": 1935,
        "url": "http://patches.dpdk.org/api/people/1935/?format=api",
        "name": "Conor Walsh",
        "email": "conor.walsh@intel.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/20210219150945.2071651-4-conor.walsh@intel.com/mbox/",
    "series": [
        {
            "id": 15306,
            "url": "http://patches.dpdk.org/api/series/15306/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=15306",
            "date": "2021-02-19T15:09:40",
            "name": "examples/l3fwd: add FIB lookup method to l3fwd",
            "version": 3,
            "mbox": "http://patches.dpdk.org/series/15306/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/88018/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/88018/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 mails.dpdk.org (mails.dpdk.org [217.70.189.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id 9C5FCA0546;\n\tFri, 19 Feb 2021 16:10:16 +0100 (CET)",
            "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 7504A16094A;\n\tFri, 19 Feb 2021 16:09:58 +0100 (CET)",
            "from mga07.intel.com (mga07.intel.com [134.134.136.100])\n by mails.dpdk.org (Postfix) with ESMTP id 720DF160941\n for <dev@dpdk.org>; Fri, 19 Feb 2021 16:09:56 +0100 (CET)",
            "from fmsmga008.fm.intel.com ([10.253.24.58])\n by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 19 Feb 2021 07:09:56 -0800",
            "from silpixa00400466.ir.intel.com ([10.237.213.210])\n by fmsmga008.fm.intel.com with ESMTP; 19 Feb 2021 07:09:54 -0800"
        ],
        "IronPort-SDR": [
            "\n x1VWw4A3ebh/l4UT71oyfQnorb83uBvqOa2QVse3VcPMn4FXuyRTZMDrQdgFEgYn2iuD3bgr2P\n qlfeE+Nsm2uQ==",
            "\n thv5wt6pznXXPx1juU+THTSlsjlcamWlfJ+juWvjkmcZsijiM0k5L2BSmu324hhfcSpDka+A1H\n nOENYwXddlwA=="
        ],
        "X-IronPort-AV": [
            "E=McAfee;i=\"6000,8403,9899\"; a=\"247932130\"",
            "E=Sophos;i=\"5.81,189,1610438400\"; d=\"scan'208\";a=\"247932130\"",
            "E=Sophos;i=\"5.81,189,1610438400\"; d=\"scan'208\";a=\"386999243\""
        ],
        "X-ExtLoop1": "1",
        "From": "Conor Walsh <conor.walsh@intel.com>",
        "To": "jerinj@marvell.com, stephen@networkplumber.org,\n bernard.iremonger@intel.com, konstantin.ananyev@intel.com,\n vladimir.medvedkin@intel.com",
        "Cc": "dev@dpdk.org,\n\tConor Walsh <conor.walsh@intel.com>",
        "Date": "Fri, 19 Feb 2021 15:09:43 +0000",
        "Message-Id": "<20210219150945.2071651-4-conor.walsh@intel.com>",
        "X-Mailer": "git-send-email 2.25.1",
        "In-Reply-To": "<20210219150945.2071651-1-conor.walsh@intel.com>",
        "References": "<20210218152056.1893590-1-conor.walsh@intel.com>\n <20210219150945.2071651-1-conor.walsh@intel.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[dpdk-dev] [PATCH v3 3/5] examples/l3fwd: add FIB infrastructure",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.29",
        "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": "The purpose of this commit is to add the necessary function calls\nand supporting infrastructure to allow the Forwarding Information Base\n(FIB) library to be integrated into the l3fwd sample app.\nThe flag '-F' has been added to the applications options to allow\nthe user to specify that l3fwd uses FIB as its lookup method.\n\nSigned-off-by: Conor Walsh <conor.walsh@intel.com>\n---\n examples/l3fwd/Makefile      |  2 +-\n examples/l3fwd/l3fwd.h       | 27 ++++++++++++++--\n examples/l3fwd/l3fwd_event.c |  9 ++++++\n examples/l3fwd/l3fwd_event.h |  1 +\n examples/l3fwd/l3fwd_fib.c   | 60 ++++++++++++++++++++++++++++++++++++\n examples/l3fwd/main.c        | 43 +++++++++++++++++++-------\n examples/l3fwd/meson.build   |  4 +--\n 7 files changed, 129 insertions(+), 17 deletions(-)\n create mode 100644 examples/l3fwd/l3fwd_fib.c",
    "diff": "diff --git a/examples/l3fwd/Makefile b/examples/l3fwd/Makefile\nindex 7e70bbd826..5f7baffbf7 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 l3fwd_event.c\n+SRCS-y := main.c l3fwd_lpm.c l3fwd_fib.c l3fwd_em.c l3fwd_event.c\n SRCS-y += l3fwd_event_generic.c l3fwd_event_internal_port.c\n \n # Build using pkg-config variables if possible\ndiff --git a/examples/l3fwd/l3fwd.h b/examples/l3fwd/l3fwd.h\nindex 2cf06099e0..a808d60247 100644\n--- a/examples/l3fwd/l3fwd.h\n+++ b/examples/l3fwd/l3fwd.h\n@@ -1,5 +1,5 @@\n /* SPDX-License-Identifier: BSD-3-Clause\n- * Copyright(c) 2010-2016 Intel Corporation\n+ * Copyright(c) 2010-2021 Intel Corporation\n  */\n \n #ifndef __L3_FWD_H__\n@@ -180,13 +180,16 @@ is_valid_ipv4_pkt(struct rte_ipv4_hdr *pkt, uint32_t link_len)\n int\n init_mem(uint16_t portid, unsigned int nb_mbuf);\n \n-/* Function pointers for LPM or EM functionality. */\n+/* Function pointers for LPM, EM or FIB functionality. */\n void\n setup_lpm(const int socketid);\n \n void\n setup_hash(const int socketid);\n \n+void\n+setup_fib(const int socketid);\n+\n int\n em_check_ptype(int portid);\n \n@@ -207,6 +210,9 @@ em_main_loop(__rte_unused void *dummy);\n int\n lpm_main_loop(__rte_unused void *dummy);\n \n+int\n+fib_main_loop(__rte_unused void *dummy);\n+\n int\n lpm_event_main_loop_tx_d(__rte_unused void *dummy);\n int\n@@ -225,8 +231,17 @@ em_event_main_loop_tx_q(__rte_unused void *dummy);\n int\n em_event_main_loop_tx_q_burst(__rte_unused void *dummy);\n \n+int\n+fib_event_main_loop_tx_d(__rte_unused void *dummy);\n+int\n+fib_event_main_loop_tx_d_burst(__rte_unused void *dummy);\n+int\n+fib_event_main_loop_tx_q(__rte_unused void *dummy);\n+int\n+fib_event_main_loop_tx_q_burst(__rte_unused void *dummy);\n+\n \n-/* Return ipv4/ipv6 fwd lookup struct for LPM or EM. */\n+/* Return ipv4/ipv6 fwd lookup struct for LPM, EM or FIB. */\n void *\n em_get_ipv4_l3fwd_lookup_struct(const int socketid);\n \n@@ -239,4 +254,10 @@ lpm_get_ipv4_l3fwd_lookup_struct(const int socketid);\n void *\n lpm_get_ipv6_l3fwd_lookup_struct(const int socketid);\n \n+void *\n+fib_get_ipv4_l3fwd_lookup_struct(const int socketid);\n+\n+void *\n+fib_get_ipv6_l3fwd_lookup_struct(const int socketid);\n+\n #endif  /* __L3_FWD_H__ */\ndiff --git a/examples/l3fwd/l3fwd_event.c b/examples/l3fwd/l3fwd_event.c\nindex 4d31593a0a..961860ea18 100644\n--- a/examples/l3fwd/l3fwd_event.c\n+++ b/examples/l3fwd/l3fwd_event.c\n@@ -227,6 +227,12 @@ l3fwd_event_resource_setup(struct rte_eth_conf *port_conf)\n \t\t[1][0] = em_event_main_loop_tx_q,\n \t\t[1][1] = em_event_main_loop_tx_q_burst,\n \t};\n+\tconst event_loop_cb fib_event_loop[2][2] = {\n+\t\t[0][0] = fib_event_main_loop_tx_d,\n+\t\t[0][1] = fib_event_main_loop_tx_d_burst,\n+\t\t[1][0] = fib_event_main_loop_tx_q,\n+\t\t[1][1] = fib_event_main_loop_tx_q_burst,\n+\t};\n \tuint32_t event_queue_cfg;\n \tint ret;\n \n@@ -264,4 +270,7 @@ l3fwd_event_resource_setup(struct rte_eth_conf *port_conf)\n \n \tevt_rsrc->ops.em_event_loop = em_event_loop[evt_rsrc->tx_mode_q]\n \t\t\t\t\t\t       [evt_rsrc->has_burst];\n+\n+\tevt_rsrc->ops.fib_event_loop = fib_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 0e46164170..3ad1902ab5 100644\n--- a/examples/l3fwd/l3fwd_event.h\n+++ b/examples/l3fwd/l3fwd_event.h\n@@ -55,6 +55,7 @@ struct l3fwd_event_setup_ops {\n \tadapter_setup_cb adapter_setup;\n \tevent_loop_cb lpm_event_loop;\n \tevent_loop_cb em_event_loop;\n+\tevent_loop_cb fib_event_loop;\n };\n \n struct l3fwd_event_resources {\ndiff --git a/examples/l3fwd/l3fwd_fib.c b/examples/l3fwd/l3fwd_fib.c\nnew file mode 100644\nindex 0000000000..0a2d02db2f\n--- /dev/null\n+++ b/examples/l3fwd/l3fwd_fib.c\n@@ -0,0 +1,60 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ * Copyright(c) 2021 Intel Corporation\n+ */\n+\n+#include <rte_fib.h>\n+#include <rte_fib6.h>\n+\n+#include \"l3fwd.h\"\n+#include \"l3fwd_event.h\"\n+#include \"l3fwd_common_route.h\"\n+\n+/* Main fib processing loop. */\n+int\n+fib_main_loop(__rte_unused void *dummy)\n+{\n+\treturn 0;\n+}\n+\n+int __rte_noinline\n+fib_event_main_loop_tx_d(__rte_unused void *dummy)\n+{\n+\treturn 0;\n+}\n+\n+int __rte_noinline\n+fib_event_main_loop_tx_d_burst(__rte_unused void *dummy)\n+{\n+\treturn 0;\n+}\n+\n+int __rte_noinline\n+fib_event_main_loop_tx_q(__rte_unused void *dummy)\n+{\n+\treturn 0;\n+}\n+\n+int __rte_noinline\n+fib_event_main_loop_tx_q_burst(__rte_unused void *dummy)\n+{\n+\treturn 0;\n+}\n+\n+/* Function to setup fib. */\n+void\n+setup_fib(__rte_unused const int socketid)\n+{}\n+\n+/* Return ipv4 fib lookup struct. */\n+void *\n+fib_get_ipv4_l3fwd_lookup_struct(__rte_unused const int socketid)\n+{\n+\treturn 0;\n+}\n+\n+/* Return ipv6 fib lookup struct. */\n+void *\n+fib_get_ipv6_l3fwd_lookup_struct(__rte_unused const int socketid)\n+{\n+\treturn 0;\n+}\ndiff --git a/examples/l3fwd/main.c b/examples/l3fwd/main.c\nindex bb49e5faff..6881b49478 100644\n--- a/examples/l3fwd/main.c\n+++ b/examples/l3fwd/main.c\n@@ -1,5 +1,5 @@\n /* SPDX-License-Identifier: BSD-3-Clause\n- * Copyright(c) 2010-2016 Intel Corporation\n+ * Copyright(c) 2010-2021 Intel Corporation\n  */\n \n #include <stdio.h>\n@@ -60,9 +60,10 @@ static uint16_t nb_txd = RTE_TEST_TX_DESC_DEFAULT;\n /**< Ports set in promiscuous mode off by default. */\n static int promiscuous_on;\n \n-/* Select Longest-Prefix or Exact match. */\n+/* Select Longest-Prefix, Exact match or Forwarding Information Base. */\n static int l3fwd_lpm_on;\n static int l3fwd_em_on;\n+static int l3fwd_fib_on;\n \n /* Global variables. */\n \n@@ -162,10 +163,19 @@ static struct l3fwd_lkp_mode l3fwd_lpm_lkp = {\n \t.get_ipv6_lookup_struct = lpm_get_ipv6_l3fwd_lookup_struct,\n };\n \n+static struct l3fwd_lkp_mode l3fwd_fib_lkp = {\n+\t.setup                  = setup_fib,\n+\t.check_ptype            = lpm_check_ptype,\n+\t.cb_parse_ptype         = lpm_cb_parse_ptype,\n+\t.main_loop              = fib_main_loop,\n+\t.get_ipv4_lookup_struct = fib_get_ipv4_l3fwd_lookup_struct,\n+\t.get_ipv6_lookup_struct = fib_get_ipv6_l3fwd_lookup_struct,\n+};\n+\n /*\n  * Setup lookup methods for forwarding.\n- * Currently exact-match and longest-prefix-match\n- * are supported ones.\n+ * Currently exact-match, longest-prefix-match and forwarding information\n+ * base are the supported ones.\n  */\n static void\n setup_l3fwd_lookup_tables(void)\n@@ -173,6 +183,9 @@ setup_l3fwd_lookup_tables(void)\n \t/* Setup HASH lookup functions. */\n \tif (l3fwd_em_on)\n \t\tl3fwd_lkp = l3fwd_em_lkp;\n+\t/* Setup FIB lookup functions. */\n+\telse if (l3fwd_fib_on)\n+\t\tl3fwd_lkp = l3fwd_fib_lkp;\n \t/* Setup LPM lookup functions. */\n \telse\n \t\tl3fwd_lkp = l3fwd_lpm_lkp;\n@@ -292,6 +305,7 @@ print_usage(const char *prgname)\n \t\t\"  -P : Enable promiscuous mode\\n\"\n \t\t\"  -E : Enable exact match\\n\"\n \t\t\"  -L : Enable longest prefix match (default)\\n\"\n+\t\t\"  -F : Enable forwarding information base\\n\"\n \t\t\"  --config (port,queue,lcore): Rx queue configuration\\n\"\n \t\t\"  --eth-dest=X,MM:MM:MM:MM:MM:MM: Ethernet destination for port X\\n\"\n \t\t\"  --enable-jumbo: Enable jumbo frames\\n\"\n@@ -492,6 +506,7 @@ static const char short_options[] =\n \t\"P\"   /* promiscuous */\n \t\"L\"   /* enable long prefix match */\n \t\"E\"   /* enable exact match */\n+\t\"F\"   /* forwarding information base */\n \t;\n \n #define CMD_LINE_OPT_CONFIG \"config\"\n@@ -596,6 +611,10 @@ parse_args(int argc, char **argv)\n \t\t\tl3fwd_lpm_on = 1;\n \t\t\tbreak;\n \n+\t\tcase 'F':\n+\t\t\tl3fwd_fib_on = 1;\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@@ -686,9 +705,9 @@ parse_args(int argc, char **argv)\n \t\t}\n \t}\n \n-\t/* If both LPM and EM are selected, return error. */\n-\tif (l3fwd_lpm_on && l3fwd_em_on) {\n-\t\tfprintf(stderr, \"LPM and EM are mutually exclusive, select only one\\n\");\n+\t/* If more than 1 of LPM, EM and FIB are selected, return error. */\n+\tif ((l3fwd_lpm_on + l3fwd_em_on + l3fwd_fib_on) > 1) {\n+\t\tfprintf(stderr, \"LPM, EM and FIB are mutually exclusive, select only one\\n\");\n \t\treturn -1;\n \t}\n \n@@ -711,14 +730,14 @@ parse_args(int argc, char **argv)\n \t * Nothing is selected, pick longest-prefix match\n \t * as default match.\n \t */\n-\tif (!l3fwd_lpm_on && !l3fwd_em_on) {\n-\t\tfprintf(stderr, \"LPM or EM none selected, default LPM on\\n\");\n+\tif (!l3fwd_lpm_on && !l3fwd_em_on && !l3fwd_fib_on) {\n+\t\tfprintf(stderr, \"Neither LPM, EM, or FIB selected, default LPM on\\n\");\n \t\tl3fwd_lpm_on = 1;\n \t}\n \n \t/*\n \t * ipv6 and hash flags are valid only for\n-\t * exact macth, reset them to default for\n+\t * exact match, reset them to default for\n \t * longest-prefix match.\n \t */\n \tif (l3fwd_lpm_on) {\n@@ -780,7 +799,7 @@ init_mem(uint16_t portid, unsigned int nb_mbuf)\n \t\t\t\tprintf(\"Allocated mbuf pool on socket %d\\n\",\n \t\t\t\t\tsocketid);\n \n-\t\t\t/* Setup either LPM or EM(f.e Hash). But, only once per\n+\t\t\t/* Setup LPM, EM(f.e Hash) or FIB. But, only once per\n \t\t\t * available socket.\n \t\t\t */\n \t\t\tif (!lkp_per_socket[socketid]) {\n@@ -1221,6 +1240,8 @@ main(int argc, char **argv)\n \t\tl3fwd_event_resource_setup(&port_conf);\n \t\tif (l3fwd_em_on)\n \t\t\tl3fwd_lkp.main_loop = evt_rsrc->ops.em_event_loop;\n+\t\telse if (l3fwd_fib_on)\n+\t\t\tl3fwd_lkp.main_loop = evt_rsrc->ops.fib_event_loop;\n \t\telse\n \t\t\tl3fwd_lkp.main_loop = evt_rsrc->ops.lpm_event_loop;\n \t\tl3fwd_event_service_setup();\ndiff --git a/examples/l3fwd/meson.build b/examples/l3fwd/meson.build\nindex 7d72b1b365..2e5d1d34f2 100644\n--- a/examples/l3fwd/meson.build\n+++ b/examples/l3fwd/meson.build\n@@ -7,8 +7,8 @@\n # DPDK instance, use 'make'\n \n allow_experimental_apis = true\n-deps += ['hash', 'lpm', 'eventdev']\n+deps += ['hash', 'lpm', 'fib', 'eventdev']\n sources = files(\n-\t'l3fwd_em.c', 'l3fwd_lpm.c', 'l3fwd_event.c',\n+\t'l3fwd_em.c', 'l3fwd_lpm.c', 'l3fwd_fib.c', 'l3fwd_event.c',\n \t'l3fwd_event_internal_port.c', 'l3fwd_event_generic.c', 'main.c'\n )\n",
    "prefixes": [
        "v3",
        "3/5"
    ]
}