Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/91660/?format=api
https://patches.dpdk.org/api/patches/91660/?format=api", "web_url": "https://patches.dpdk.org/project/dpdk/patch/20210416171941.346166-3-conor.walsh@intel.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": "<20210416171941.346166-3-conor.walsh@intel.com>", "list_archive_url": "https://inbox.dpdk.org/dev/20210416171941.346166-3-conor.walsh@intel.com", "date": "2021-04-16T17:19:38", "name": "[v8,2/5] examples/l3fwd: move l3fwd routes to common header", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": true, "hash": "2196ed93bd59c179ed4390b4b8c97d046e09a379", "submitter": { "id": 1935, "url": "https://patches.dpdk.org/api/people/1935/?format=api", "name": "Conor Walsh", "email": "conor.walsh@intel.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/20210416171941.346166-3-conor.walsh@intel.com/mbox/", "series": [ { "id": 16450, "url": "https://patches.dpdk.org/api/series/16450/?format=api", "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=16450", "date": "2021-04-16T17:19:36", "name": "examples/l3fwd: add FIB lookup method to l3fwd", "version": 8, "mbox": "https://patches.dpdk.org/series/16450/mbox/" } ], "comments": "https://patches.dpdk.org/api/patches/91660/comments/", "check": "success", "checks": "https://patches.dpdk.org/api/patches/91660/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 33FB5A0C43;\n\tFri, 16 Apr 2021 19:20:03 +0200 (CEST)", "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 1B36E161B2D;\n\tFri, 16 Apr 2021 19:19:58 +0200 (CEST)", "from mga09.intel.com (mga09.intel.com [134.134.136.24])\n by mails.dpdk.org (Postfix) with ESMTP id 925A3161AE6\n for <dev@dpdk.org>; Fri, 16 Apr 2021 19:19:54 +0200 (CEST)", "from orsmga005.jf.intel.com ([10.7.209.41])\n by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 16 Apr 2021 10:19:53 -0700", "from silpixa00400466.ir.intel.com ([10.237.213.210])\n by orsmga005.jf.intel.com with ESMTP; 16 Apr 2021 10:19:50 -0700" ], "IronPort-SDR": [ "\n 3UoYkt2G8dK3QAhIjfS3sDouZtSnuk5t5VfEKmf2cnKGHYuGQQ9UpCaj8n04+J4JgKUytwEbKh\n Ze60ujh5IryQ==", "\n HD/G41vTofFbjwyipICOUDWGnTxPrxvXeUDGR2zzqJU98tux+kPpBJgPesi0wcHyrzRrnHDTV+\n AzXktMT8mZLw==" ], "X-IronPort-AV": [ "E=McAfee;i=\"6200,9189,9956\"; a=\"195184273\"", "E=Sophos;i=\"5.82,226,1613462400\"; d=\"scan'208\";a=\"195184273\"", "E=Sophos;i=\"5.82,226,1613462400\"; d=\"scan'208\";a=\"601528442\"" ], "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, anatoly.burakov@intel.com,\n john.mcnamara@intel.com, david.marchand@redhat.com", "Cc": "dev@dpdk.org,\n\tConor Walsh <conor.walsh@intel.com>", "Date": "Fri, 16 Apr 2021 17:19:38 +0000", "Message-Id": "<20210416171941.346166-3-conor.walsh@intel.com>", "X-Mailer": "git-send-email 2.25.1", "In-Reply-To": "<20210416171941.346166-1-conor.walsh@intel.com>", "References": "<20210406111106.2020555-1-conor.walsh@intel.com>\n <20210416171941.346166-1-conor.walsh@intel.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[dpdk-dev] [PATCH v8 2/5] examples/l3fwd: move l3fwd routes to\n common header", "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": "To prevent code duplication from the addition of lookup methods\nthe routes specified in lpm should be moved to a common header.\n\nSigned-off-by: Conor Walsh <conor.walsh@intel.com>\nAcked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>\nAcked-by: Vladimir Medvedkin <vladimir.medvedkin@intel.com>\n---\n examples/l3fwd/l3fwd_lpm.c | 74 +++++++++---------------------------\n examples/l3fwd/l3fwd_route.h | 19 +++++++++\n examples/l3fwd/main.c | 31 +++++++++++++++\n 3 files changed, 67 insertions(+), 57 deletions(-)\n create mode 100644 examples/l3fwd/l3fwd_route.h", "diff": "diff --git a/examples/l3fwd/l3fwd_lpm.c b/examples/l3fwd/l3fwd_lpm.c\nindex 1cfaf36572..351cc91a11 100644\n--- a/examples/l3fwd/l3fwd_lpm.c\n+++ b/examples/l3fwd/l3fwd_lpm.c\n@@ -30,47 +30,7 @@\n #include \"l3fwd.h\"\n #include \"l3fwd_event.h\"\n \n-struct ipv4_l3fwd_lpm_route {\n-\tuint32_t ip;\n-\tuint8_t depth;\n-\tuint8_t if_out;\n-};\n-\n-struct ipv6_l3fwd_lpm_route {\n-\tuint8_t ip[16];\n-\tuint8_t depth;\n-\tuint8_t if_out;\n-};\n-\n-/*\n- * 198.18.0.0/16 are set aside for RFC2544 benchmarking (RFC5735).\n- * 198.18.{0-7}.0/24 = Port {0-7}\n- */\n-static const struct ipv4_l3fwd_lpm_route ipv4_l3fwd_lpm_route_array[] = {\n-\t{RTE_IPV4(198, 18, 0, 0), 24, 0},\n-\t{RTE_IPV4(198, 18, 1, 0), 24, 1},\n-\t{RTE_IPV4(198, 18, 2, 0), 24, 2},\n-\t{RTE_IPV4(198, 18, 3, 0), 24, 3},\n-\t{RTE_IPV4(198, 18, 4, 0), 24, 4},\n-\t{RTE_IPV4(198, 18, 5, 0), 24, 5},\n-\t{RTE_IPV4(198, 18, 6, 0), 24, 6},\n-\t{RTE_IPV4(198, 18, 7, 0), 24, 7},\n-};\n-\n-/*\n- * 2001:200::/48 is IANA reserved range for IPv6 benchmarking (RFC5180).\n- * 2001:200:0:{0-7}::/64 = Port {0-7}\n- */\n-static const struct ipv6_l3fwd_lpm_route ipv6_l3fwd_lpm_route_array[] = {\n-\t{{32, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, 64, 0},\n-\t{{32, 1, 2, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0}, 64, 1},\n-\t{{32, 1, 2, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0}, 64, 2},\n-\t{{32, 1, 2, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0}, 64, 3},\n-\t{{32, 1, 2, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0}, 64, 4},\n-\t{{32, 1, 2, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0}, 64, 5},\n-\t{{32, 1, 2, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0}, 64, 6},\n-\t{{32, 1, 2, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0}, 64, 7},\n-};\n+#include \"l3fwd_route.h\"\n \n #define IPV4_L3FWD_LPM_MAX_RULES 1024\n #define IPV4_L3FWD_LPM_NUMBER_TBL8S (1 << 8)\n@@ -485,18 +445,18 @@ setup_lpm(const int socketid)\n \t\t\tsocketid);\n \n \t/* populate the LPM table */\n-\tfor (i = 0; i < RTE_DIM(ipv4_l3fwd_lpm_route_array); i++) {\n+\tfor (i = 0; i < RTE_DIM(ipv4_l3fwd_route_array); i++) {\n \t\tstruct in_addr in;\n \n \t\t/* skip unused ports */\n-\t\tif ((1 << ipv4_l3fwd_lpm_route_array[i].if_out &\n+\t\tif ((1 << ipv4_l3fwd_route_array[i].if_out &\n \t\t\t\tenabled_port_mask) == 0)\n \t\t\tcontinue;\n \n \t\tret = rte_lpm_add(ipv4_l3fwd_lpm_lookup_struct[socketid],\n-\t\t\tipv4_l3fwd_lpm_route_array[i].ip,\n-\t\t\tipv4_l3fwd_lpm_route_array[i].depth,\n-\t\t\tipv4_l3fwd_lpm_route_array[i].if_out);\n+\t\t\tipv4_l3fwd_route_array[i].ip,\n+\t\t\tipv4_l3fwd_route_array[i].depth,\n+\t\t\tipv4_l3fwd_route_array[i].if_out);\n \n \t\tif (ret < 0) {\n \t\t\trte_exit(EXIT_FAILURE,\n@@ -504,11 +464,11 @@ setup_lpm(const int socketid)\n \t\t\t\ti, socketid);\n \t\t}\n \n-\t\tin.s_addr = htonl(ipv4_l3fwd_lpm_route_array[i].ip);\n+\t\tin.s_addr = htonl(ipv4_l3fwd_route_array[i].ip);\n \t\tprintf(\"LPM: Adding route %s / %d (%d)\\n\",\n \t\t inet_ntop(AF_INET, &in, abuf, sizeof(abuf)),\n-\t\t\tipv4_l3fwd_lpm_route_array[i].depth,\n-\t\t\tipv4_l3fwd_lpm_route_array[i].if_out);\n+\t\t\tipv4_l3fwd_route_array[i].depth,\n+\t\t\tipv4_l3fwd_route_array[i].if_out);\n \t}\n \n \t/* create the LPM6 table */\n@@ -525,17 +485,17 @@ setup_lpm(const int socketid)\n \t\t\tsocketid);\n \n \t/* populate the LPM table */\n-\tfor (i = 0; i < RTE_DIM(ipv6_l3fwd_lpm_route_array); i++) {\n+\tfor (i = 0; i < RTE_DIM(ipv6_l3fwd_route_array); i++) {\n \n \t\t/* skip unused ports */\n-\t\tif ((1 << ipv6_l3fwd_lpm_route_array[i].if_out &\n+\t\tif ((1 << ipv6_l3fwd_route_array[i].if_out &\n \t\t\t\tenabled_port_mask) == 0)\n \t\t\tcontinue;\n \n \t\tret = rte_lpm6_add(ipv6_l3fwd_lpm_lookup_struct[socketid],\n-\t\t\tipv6_l3fwd_lpm_route_array[i].ip,\n-\t\t\tipv6_l3fwd_lpm_route_array[i].depth,\n-\t\t\tipv6_l3fwd_lpm_route_array[i].if_out);\n+\t\t\tipv6_l3fwd_route_array[i].ip,\n+\t\t\tipv6_l3fwd_route_array[i].depth,\n+\t\t\tipv6_l3fwd_route_array[i].if_out);\n \n \t\tif (ret < 0) {\n \t\t\trte_exit(EXIT_FAILURE,\n@@ -544,10 +504,10 @@ setup_lpm(const int socketid)\n \t\t}\n \n \t\tprintf(\"LPM: Adding route %s / %d (%d)\\n\",\n-\t\t inet_ntop(AF_INET6, ipv6_l3fwd_lpm_route_array[i].ip,\n+\t\t inet_ntop(AF_INET6, ipv6_l3fwd_route_array[i].ip,\n \t\t\t\t abuf, sizeof(abuf)),\n-\t\t ipv6_l3fwd_lpm_route_array[i].depth,\n-\t\t ipv6_l3fwd_lpm_route_array[i].if_out);\n+\t\t ipv6_l3fwd_route_array[i].depth,\n+\t\t ipv6_l3fwd_route_array[i].if_out);\n \t}\n }\n \ndiff --git a/examples/l3fwd/l3fwd_route.h b/examples/l3fwd/l3fwd_route.h\nnew file mode 100644\nindex 0000000000..89f8634443\n--- /dev/null\n+++ b/examples/l3fwd/l3fwd_route.h\n@@ -0,0 +1,19 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ * Copyright(c) 2021 Intel Corporation\n+ */\n+\n+struct ipv4_l3fwd_route {\n+\tuint32_t ip;\n+\tuint8_t depth;\n+\tuint8_t if_out;\n+};\n+\n+struct ipv6_l3fwd_route {\n+\tuint8_t ip[16];\n+\tuint8_t depth;\n+\tuint8_t if_out;\n+};\n+\n+extern const struct ipv4_l3fwd_route ipv4_l3fwd_route_array[8];\n+\n+extern const struct ipv6_l3fwd_route ipv6_l3fwd_route_array[8];\ndiff --git a/examples/l3fwd/main.c b/examples/l3fwd/main.c\nindex bb49e5faff..355064a1c7 100644\n--- a/examples/l3fwd/main.c\n+++ b/examples/l3fwd/main.c\n@@ -47,6 +47,7 @@\n \n #include \"l3fwd.h\"\n #include \"l3fwd_event.h\"\n+#include \"l3fwd_route.h\"\n \n #define MAX_TX_QUEUE_PER_PORT RTE_MAX_LCORE\n #define MAX_RX_QUEUE_PER_PORT 128\n@@ -162,6 +163,36 @@ static struct l3fwd_lkp_mode l3fwd_lpm_lkp = {\n \t.get_ipv6_lookup_struct = lpm_get_ipv6_l3fwd_lookup_struct,\n };\n \n+/*\n+ * 198.18.0.0/16 are set aside for RFC2544 benchmarking (RFC5735).\n+ * 198.18.{0-7}.0/24 = Port {0-7}\n+ */\n+const struct ipv4_l3fwd_route ipv4_l3fwd_route_array[] = {\n+\t{RTE_IPV4(198, 18, 0, 0), 24, 0},\n+\t{RTE_IPV4(198, 18, 1, 0), 24, 1},\n+\t{RTE_IPV4(198, 18, 2, 0), 24, 2},\n+\t{RTE_IPV4(198, 18, 3, 0), 24, 3},\n+\t{RTE_IPV4(198, 18, 4, 0), 24, 4},\n+\t{RTE_IPV4(198, 18, 5, 0), 24, 5},\n+\t{RTE_IPV4(198, 18, 6, 0), 24, 6},\n+\t{RTE_IPV4(198, 18, 7, 0), 24, 7},\n+};\n+\n+/*\n+ * 2001:200::/48 is IANA reserved range for IPv6 benchmarking (RFC5180).\n+ * 2001:200:0:{0-7}::/64 = Port {0-7}\n+ */\n+const struct ipv6_l3fwd_route ipv6_l3fwd_route_array[] = {\n+\t{{32, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, 64, 0},\n+\t{{32, 1, 2, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0}, 64, 1},\n+\t{{32, 1, 2, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0}, 64, 2},\n+\t{{32, 1, 2, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0}, 64, 3},\n+\t{{32, 1, 2, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0}, 64, 4},\n+\t{{32, 1, 2, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0}, 64, 5},\n+\t{{32, 1, 2, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0}, 64, 6},\n+\t{{32, 1, 2, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0}, 64, 7},\n+};\n+\n /*\n * Setup lookup methods for forwarding.\n * Currently exact-match and longest-prefix-match\n", "prefixes": [ "v8", "2/5" ] }{ "id": 91660, "url": "