get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 105289,
    "url": "http://patches.dpdk.org/api/patches/105289/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20211220110837.970261-2-sean.morrissey@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": "<20211220110837.970261-2-sean.morrissey@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20211220110837.970261-2-sean.morrissey@intel.com",
    "date": "2021-12-20T11:08:36",
    "name": "[v2,1/2] examples/l3fwd: add config file support for LPM/FIB",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "0cd17eecf1c79b7b72cc817477e96cc3e6d5d13f",
    "submitter": {
        "id": 1359,
        "url": "http://patches.dpdk.org/api/people/1359/?format=api",
        "name": "Sean Morrissey",
        "email": "sean.morrissey@intel.com"
    },
    "delegate": null,
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/20211220110837.970261-2-sean.morrissey@intel.com/mbox/",
    "series": [
        {
            "id": 20983,
            "url": "http://patches.dpdk.org/api/series/20983/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=20983",
            "date": "2021-12-20T11:08:35",
            "name": "Add config file support for l3fwd",
            "version": 2,
            "mbox": "http://patches.dpdk.org/series/20983/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/105289/comments/",
    "check": "warning",
    "checks": "http://patches.dpdk.org/api/patches/105289/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 DA394A00BE;\n\tMon, 20 Dec 2021 12:08:53 +0100 (CET)",
            "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 7D5C640E01;\n\tMon, 20 Dec 2021 12:08:49 +0100 (CET)",
            "from mga11.intel.com (mga11.intel.com [192.55.52.93])\n by mails.dpdk.org (Postfix) with ESMTP id CC79640040\n for <dev@dpdk.org>; Mon, 20 Dec 2021 12:08:46 +0100 (CET)",
            "from orsmga007.jf.intel.com ([10.7.209.58])\n by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 20 Dec 2021 03:08:43 -0800",
            "from silpixa00401215.ir.intel.com ([10.55.128.96])\n by orsmga007.jf.intel.com with ESMTP; 20 Dec 2021 03:08:42 -0800"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple;\n d=intel.com; i=@intel.com; q=dns/txt; s=Intel;\n t=1639998527; x=1671534527;\n h=from:to:cc:subject:date:message-id:in-reply-to:\n references:mime-version:content-transfer-encoding;\n bh=YIRXpejOJdLYaPvLUo6LwJJr3jZtTDGUxEa6Taqnkeg=;\n b=SD/xcpv0uuYR+Vks7V7zVZajopemNPFws4EDLGsON+1sqWapkpOgP+3L\n O+02u5l0DqgjAeGfTcOcGKguCRZYbixCUMTB1vuB+l26TTrJ9LhKMsamp\n m7dyxLAJaCVOkIh2rw8ZqjJKoSssvKpn6ld20VcS1JWF6xu63cVVmIaxn\n l/RUElv7RkYyWWa45VEWsH38EegHc+FXxh7vGc38dgqY18wYUEJoiK2nA\n vAs2tWqf5Tnew3l3HxMNLCcIpHeP1kw04zGtFqh/d7097xW9jLtc4dI7p\n QWljYpqs6MhbcgZ54hz4SA22I5Bz+iOTDahIkyHv/9iXV42vde3ucVkcJ A==;",
        "X-IronPort-AV": [
            "E=McAfee;i=\"6200,9189,10203\"; a=\"237682861\"",
            "E=Sophos;i=\"5.88,220,1635231600\"; d=\"scan'208\";a=\"237682861\"",
            "E=Sophos;i=\"5.88,220,1635231600\"; d=\"scan'208\";a=\"507645761\""
        ],
        "X-ExtLoop1": "1",
        "From": "Sean Morrissey <sean.morrissey@intel.com>",
        "To": "",
        "Cc": "dev@dpdk.org, Sean Morrissey <sean.morrissey@intel.com>,\n Ravi Kerur <rkerur@gmail.com>",
        "Subject": "[PATCH v2 1/2] examples/l3fwd: add config file support for LPM/FIB",
        "Date": "Mon, 20 Dec 2021 11:08:36 +0000",
        "Message-Id": "<20211220110837.970261-2-sean.morrissey@intel.com>",
        "X-Mailer": "git-send-email 2.25.1",
        "In-Reply-To": "<20211220110837.970261-1-sean.morrissey@intel.com>",
        "References": "<20211216150104.860924-1-sean.morrissey@intel.com>\n <20211220110837.970261-1-sean.morrissey@intel.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "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"
    },
    "content": "Add support to define ipv4 and ipv6 forwarding tables\nfrom reading from a config file for LPM and FIB,\nwith format similar to l3fwd-acl one.\n\nWith the removal of the hardcoded route tables for IPv4\nand IPv6, these routes have been moved to a separate\ndefault config file for use with LPM and FIB.\n\nSigned-off-by: Sean Morrissey <sean.morrissey@intel.com>\nSigned-off-by: Ravi Kerur <rkerur@gmail.com>\n---\n examples/l3fwd/l3fwd.h            |  35 ++++\n examples/l3fwd/l3fwd_em.c         |   7 +\n examples/l3fwd/l3fwd_fib.c        |  52 +++---\n examples/l3fwd/l3fwd_lpm.c        | 281 +++++++++++++++++++++++++++---\n examples/l3fwd/l3fwd_route.h      |  17 +-\n examples/l3fwd/lpm_default_v4.cfg |  17 ++\n examples/l3fwd/lpm_default_v6.cfg |  17 ++\n examples/l3fwd/main.c             |  99 ++++++-----\n 8 files changed, 438 insertions(+), 87 deletions(-)\n create mode 100644 examples/l3fwd/lpm_default_v4.cfg\n create mode 100644 examples/l3fwd/lpm_default_v6.cfg",
    "diff": "diff --git a/examples/l3fwd/l3fwd.h b/examples/l3fwd/l3fwd.h\nindex 38ca19133c..d8b1f971e1 100644\n--- a/examples/l3fwd/l3fwd.h\n+++ b/examples/l3fwd/l3fwd.h\n@@ -58,6 +58,30 @@\n #endif\n #define HASH_ENTRY_NUMBER_DEFAULT\t16\n \n+/*Log file related character defs. */\n+#define COMMENT_LEAD_CHAR\t('#')\n+#define ROUTE_LEAD_CHAR\t\t('R')\n+\n+#define\tIPV6_ADDR_LEN\t16\n+#define\tIPV6_ADDR_U16\t(IPV6_ADDR_LEN / sizeof(uint16_t))\n+#define\tIPV6_ADDR_U32\t(IPV6_ADDR_LEN / sizeof(uint32_t))\n+\n+#define GET_CB_FIELD(in, fd, base, lim, dlm)\tdo {            \\\n+\tunsigned long val;                                      \\\n+\tchar *end;                                              \\\n+\terrno = 0;                                              \\\n+\tval = strtoul((in), &end, (base));                      \\\n+\tif (errno != 0 || end[0] != (dlm) || val > (lim))       \\\n+\t\treturn -EINVAL;                               \\\n+\t(fd) = (typeof(fd))val;                                 \\\n+\t(in) = end + 1;                                         \\\n+} while (0)\n+\n+struct parm_cfg {\n+\tconst char *rule_ipv4_name;\n+\tconst char *rule_ipv6_name;\n+};\n+\n struct mbuf_table {\n \tuint16_t len;\n \tstruct rte_mbuf *m_table[MAX_PKT_BURST];\n@@ -96,6 +120,8 @@ extern xmm_t val_eth[RTE_MAX_ETHPORTS];\n \n extern struct lcore_conf lcore_conf[RTE_MAX_LCORE];\n \n+extern struct parm_cfg parm_config;\n+\n /* Send burst of packets on an output interface */\n static inline int\n send_burst(struct lcore_conf *qconf, uint16_t n, uint16_t port)\n@@ -183,6 +209,12 @@ int\n init_mem(uint16_t portid, unsigned int nb_mbuf);\n \n /* Function pointers for LPM, EM or FIB functionality. */\n+void\n+read_config_files_lpm(void);\n+\n+void\n+read_config_files_em(void);\n+\n void\n setup_lpm(const int socketid);\n \n@@ -286,4 +318,7 @@ fib_get_ipv4_l3fwd_lookup_struct(const int socketid);\n void *\n fib_get_ipv6_l3fwd_lookup_struct(const int socketid);\n \n+int\n+is_bypass_line(const char *buff);\n+\n #endif  /* __L3_FWD_H__ */\ndiff --git a/examples/l3fwd/l3fwd_em.c b/examples/l3fwd/l3fwd_em.c\nindex 5cc4a4d979..4953cdae4e 100644\n--- a/examples/l3fwd/l3fwd_em.c\n+++ b/examples/l3fwd/l3fwd_em.c\n@@ -972,6 +972,13 @@ em_event_main_loop_tx_q_burst_vector(__rte_unused void *dummy)\n \treturn 0;\n }\n \n+/* Load rules from the input file */\n+void\n+read_config_files_em(void)\n+{\n+\t/* Empty till config file support added to EM */\n+}\n+\n /* Initialize exact match (hash) parameters. 8< */\n void\n setup_hash(const int socketid)\ndiff --git a/examples/l3fwd/l3fwd_fib.c b/examples/l3fwd/l3fwd_fib.c\nindex 2110459cc3..003721c908 100644\n--- a/examples/l3fwd/l3fwd_fib.c\n+++ b/examples/l3fwd/l3fwd_fib.c\n@@ -583,7 +583,7 @@ setup_fib(const int socketid)\n \tstruct rte_eth_dev_info dev_info;\n \tstruct rte_fib6_conf config;\n \tstruct rte_fib_conf config_ipv4;\n-\tunsigned int i;\n+\tint i;\n \tint ret;\n \tchar s[64];\n \tchar abuf[INET6_ADDRSTRLEN];\n@@ -603,37 +603,39 @@ setup_fib(const int socketid)\n \t\t\t\"Unable to create the l3fwd FIB table on socket %d\\n\",\n \t\t\tsocketid);\n \n+\n \t/* Populate the fib ipv4 table. */\n-\tfor (i = 0; i < RTE_DIM(ipv4_l3fwd_route_array); i++) {\n+\tfor (i = 0; i < route_num_v4; i++) {\n \t\tstruct in_addr in;\n \n \t\t/* Skip unused ports. */\n-\t\tif ((1 << ipv4_l3fwd_route_array[i].if_out &\n+\t\tif ((1 << route_base_v4[i].if_out &\n \t\t\t\tenabled_port_mask) == 0)\n \t\t\tcontinue;\n \n-\t\trte_eth_dev_info_get(ipv4_l3fwd_route_array[i].if_out,\n+\t\trte_eth_dev_info_get(route_base_v4[i].if_out,\n \t\t\t\t     &dev_info);\n \t\tret = rte_fib_add(ipv4_l3fwd_fib_lookup_struct[socketid],\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+\t\t\troute_base_v4[i].ip,\n+\t\t\troute_base_v4[i].depth,\n+\t\t\troute_base_v4[i].if_out);\n \n \t\tif (ret < 0) {\n+\t\t\tfree(route_base_v4);\n \t\t\trte_exit(EXIT_FAILURE,\n \t\t\t\t\t\"Unable to add entry %u to the l3fwd FIB table on socket %d\\n\",\n \t\t\t\t\ti, socketid);\n \t\t}\n \n-\t\tin.s_addr = htonl(ipv4_l3fwd_route_array[i].ip);\n+\t\tin.s_addr = htonl(route_base_v4[i].ip);\n \t\tif (inet_ntop(AF_INET, &in, abuf, sizeof(abuf)) != NULL) {\n \t\t\tprintf(\"FIB: Adding route %s / %d (%d) [%s]\\n\", abuf,\n-\t\t\t       ipv4_l3fwd_route_array[i].depth,\n-\t\t\t       ipv4_l3fwd_route_array[i].if_out,\n+\t\t\t       route_base_v4[i].depth,\n+\t\t\t       route_base_v4[i].if_out,\n \t\t\t       dev_info.device->name);\n \t\t} else {\n \t\t\tprintf(\"FIB: IPv4 route added to port %d [%s]\\n\",\n-\t\t\t       ipv4_l3fwd_route_array[i].if_out,\n+\t\t\t       route_base_v4[i].if_out,\n \t\t\t       dev_info.device->name);\n \t\t}\n \t}\n@@ -650,44 +652,50 @@ setup_fib(const int socketid)\n \tconfig.trie.num_tbl8 = (1 << 15);\n \tipv6_l3fwd_fib_lookup_struct[socketid] = rte_fib6_create(s, socketid,\n \t\t\t&config);\n-\tif (ipv6_l3fwd_fib_lookup_struct[socketid] == NULL)\n+\tif (ipv6_l3fwd_fib_lookup_struct[socketid] == NULL) {\n+\t\tfree(route_base_v4);\n \t\trte_exit(EXIT_FAILURE,\n \t\t\t\t\"Unable to create the l3fwd FIB table on socket %d\\n\",\n \t\t\t\tsocketid);\n+\t}\n \n \t/* Populate the fib IPv6 table. */\n-\tfor (i = 0; i < RTE_DIM(ipv6_l3fwd_route_array); i++) {\n+\tfor (i = 0; i < route_num_v6; i++) {\n \n \t\t/* Skip unused ports. */\n-\t\tif ((1 << ipv6_l3fwd_route_array[i].if_out &\n+\t\tif ((1 << route_base_v6[i].if_out &\n \t\t\t\tenabled_port_mask) == 0)\n \t\t\tcontinue;\n \n-\t\trte_eth_dev_info_get(ipv6_l3fwd_route_array[i].if_out,\n+\t\trte_eth_dev_info_get(route_base_v6[i].if_out,\n \t\t\t\t     &dev_info);\n \t\tret = rte_fib6_add(ipv6_l3fwd_fib_lookup_struct[socketid],\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+\t\t\troute_base_v6[i].ip_8,\n+\t\t\troute_base_v6[i].depth,\n+\t\t\troute_base_v6[i].if_out);\n \n \t\tif (ret < 0) {\n+\t\t\tfree(route_base_v4);\n+\t\t\tfree(route_base_v6);\n \t\t\trte_exit(EXIT_FAILURE,\n \t\t\t\t\t\"Unable to add entry %u to the l3fwd FIB table on socket %d\\n\",\n \t\t\t\t\ti, socketid);\n \t\t}\n \n-\t\tif (inet_ntop(AF_INET6, ipv6_l3fwd_route_array[i].ip,\n+\t\tif (inet_ntop(AF_INET6, route_base_v6[i].ip_8,\n \t\t\t\tabuf, sizeof(abuf)) != NULL) {\n \t\t\tprintf(\"FIB: Adding route %s / %d (%d) [%s]\\n\", abuf,\n-\t\t\t       ipv6_l3fwd_route_array[i].depth,\n-\t\t\t       ipv6_l3fwd_route_array[i].if_out,\n+\t\t\t       route_base_v6[i].depth,\n+\t\t\t       route_base_v6[i].if_out,\n \t\t\t       dev_info.device->name);\n \t\t} else {\n \t\t\tprintf(\"FIB: IPv6 route added to port %d [%s]\\n\",\n-\t\t\t       ipv6_l3fwd_route_array[i].if_out,\n+\t\t\t       route_base_v6[i].if_out,\n \t\t\t       dev_info.device->name);\n \t\t}\n \t}\n+\tfree(route_base_v4);\n+\tfree(route_base_v6);\n }\n \n /* Return ipv4 fib lookup struct. */\ndiff --git a/examples/l3fwd/l3fwd_lpm.c b/examples/l3fwd/l3fwd_lpm.c\nindex a5b476ced3..4157f16c07 100644\n--- a/examples/l3fwd/l3fwd_lpm.c\n+++ b/examples/l3fwd/l3fwd_lpm.c\n@@ -39,6 +39,16 @@\n \n static struct rte_lpm *ipv4_l3fwd_lpm_lookup_struct[NB_SOCKETS];\n static struct rte_lpm6 *ipv6_l3fwd_lpm_lookup_struct[NB_SOCKETS];\n+struct lpm_route_rule *route_base_v4;\n+struct lpm_route_rule *route_base_v6;\n+int route_num_v4;\n+int route_num_v6;\n+\n+enum {\n+\tCB_FLD_DST_ADDR,\n+\tCB_FLD_IF_OUT,\n+\tCB_FLD_MAX\n+};\n \n /* Performing LPM-based lookups. 8< */\n static inline uint16_t\n@@ -139,6 +149,199 @@ lpm_get_dst_port_with_ipv4(const struct lcore_conf *qconf, struct rte_mbuf *pkt,\n #include \"l3fwd_lpm.h\"\n #endif\n \n+static int\n+parse_ipv6_addr_mask(char *token, uint32_t *ipv6, uint8_t *mask)\n+{\n+\tchar *sa, *sm, *sv;\n+\tconst char *dlm =  \"/\";\n+\n+\tsv = NULL;\n+\tsa = strtok_r(token, dlm, &sv);\n+\tif (sa == NULL)\n+\t\treturn -EINVAL;\n+\tsm = strtok_r(NULL, dlm, &sv);\n+\tif (sm == NULL)\n+\t\treturn -EINVAL;\n+\n+\tif (inet_pton(AF_INET6, sa, ipv6) != 1)\n+\t\treturn -EINVAL;\n+\n+\tGET_CB_FIELD(sm, *mask, 0, 128, 0);\n+\treturn 0;\n+}\n+\n+static int\n+parse_ipv4_addr_mask(char *token, uint32_t *ipv4, uint8_t *mask)\n+{\n+\tchar *sa, *sm, *sv;\n+\tconst char *dlm =  \"/\";\n+\n+\tsv = NULL;\n+\tsa = strtok_r(token, dlm, &sv);\n+\tif (sa == NULL)\n+\t\treturn -EINVAL;\n+\tsm = strtok_r(NULL, dlm, &sv);\n+\tif (sm == NULL)\n+\t\treturn -EINVAL;\n+\n+\tif (inet_pton(AF_INET, sa, ipv4) != 1)\n+\t\treturn -EINVAL;\n+\n+\tGET_CB_FIELD(sm, *mask, 0, 32, 0);\n+\t*ipv4 = ntohl(*ipv4);\n+\treturn 0;\n+}\n+\n+static int\n+lpm_parse_v6_net(char *in, uint32_t *v, uint8_t *mask_len)\n+{\n+\tint32_t rc;\n+\n+\t/* get address. */\n+\trc = parse_ipv6_addr_mask(in, v, mask_len);\n+\n+\treturn rc;\n+}\n+\n+static int\n+lpm_parse_v6_rule(char *str, struct lpm_route_rule *v)\n+{\n+\tint i, rc;\n+\tchar *s, *sp, *in[CB_FLD_MAX];\n+\tstatic const char *dlm = \" \\t\\n\";\n+\tint dim = CB_FLD_MAX;\n+\ts = str;\n+\n+\tfor (i = 0; i != dim; i++, s = NULL) {\n+\t\tin[i] = strtok_r(s, dlm, &sp);\n+\t\tif (in[i] == NULL)\n+\t\t\treturn -EINVAL;\n+\t}\n+\n+\trc = lpm_parse_v6_net(in[CB_FLD_DST_ADDR], v->ip_32, &v->depth);\n+\n+\tGET_CB_FIELD(in[CB_FLD_IF_OUT], v->if_out, 0, UINT8_MAX, 0);\n+\n+\treturn rc;\n+}\n+\n+static int\n+lpm_parse_v4_rule(char *str, struct lpm_route_rule *v)\n+{\n+\tint i, rc;\n+\tchar *s, *sp, *in[CB_FLD_MAX];\n+\tstatic const char *dlm = \" \\t\\n\";\n+\tint dim = CB_FLD_MAX;\n+\ts = str;\n+\n+\tfor (i = 0; i != dim; i++, s = NULL) {\n+\t\tin[i] = strtok_r(s, dlm, &sp);\n+\t\tif (in[i] == NULL)\n+\t\t\treturn -EINVAL;\n+\t}\n+\n+\trc = parse_ipv4_addr_mask(in[CB_FLD_DST_ADDR], &v->ip, &v->depth);\n+\n+\tGET_CB_FIELD(in[CB_FLD_IF_OUT], v->if_out, 0, UINT8_MAX, 0);\n+\n+\treturn rc;\n+}\n+\n+static int\n+lpm_add_rules(const char *rule_path,\n+\t\tstruct lpm_route_rule **proute_base,\n+\t\tint (*parser)(char *, struct lpm_route_rule *))\n+{\n+\tstruct lpm_route_rule *route_rules;\n+\tstruct lpm_route_rule *next;\n+\tunsigned int route_num = 0;\n+\tunsigned int route_cnt = 0;\n+\tchar buff[LINE_MAX];\n+\tFILE *fh;\n+\tunsigned int i = 0, rule_size = sizeof(*next);\n+\tint val;\n+\n+\t*proute_base = NULL;\n+\tfh = fopen(rule_path, \"rb\");\n+\tif (fh == NULL)\n+\t\treturn -EINVAL;\n+\n+\twhile ((fgets(buff, LINE_MAX, fh) != NULL)) {\n+\t\tif (buff[0] == ROUTE_LEAD_CHAR)\n+\t\t\troute_num++;\n+\t}\n+\n+\tif (route_num == 0) {\n+\t\tfclose(fh);\n+\t\treturn -EINVAL;\n+\t}\n+\n+\tval = fseek(fh, 0, SEEK_SET);\n+\tif (val < 0) {\n+\t\tfclose(fh);\n+\t\treturn -EINVAL;\n+\t}\n+\n+\troute_rules = calloc(route_num, rule_size);\n+\n+\tif (route_rules == NULL) {\n+\t\tfclose(fh);\n+\t\treturn -EINVAL;\n+\t}\n+\n+\ti = 0;\n+\twhile (fgets(buff, LINE_MAX, fh) != NULL) {\n+\t\ti++;\n+\t\tif (is_bypass_line(buff))\n+\t\t\tcontinue;\n+\n+\t\tchar s = buff[0];\n+\n+\t\t/* Route entry */\n+\t\tif (s == ROUTE_LEAD_CHAR)\n+\t\t\tnext = &route_rules[route_cnt];\n+\n+\t\t/* Illegal line */\n+\t\telse {\n+\t\t\tRTE_LOG(ERR, L3FWD,\n+\t\t\t\t\"%s Line %u: should start with leading \"\n+\t\t\t\t\"char %c\\n\",\n+\t\t\t\trule_path, i, ROUTE_LEAD_CHAR);\n+\t\t\tfclose(fh);\n+\t\t\tfree(route_rules);\n+\t\t\treturn -EINVAL;\n+\t\t}\n+\n+\t\tif (parser(buff + 1, next) != 0) {\n+\t\t\tRTE_LOG(ERR, L3FWD,\n+\t\t\t\t\"%s Line %u: parse rules error\\n\",\n+\t\t\t\trule_path, i);\n+\t\t\tfclose(fh);\n+\t\t\tfree(route_rules);\n+\t\t\treturn -EINVAL;\n+\t\t}\n+\n+\t\troute_cnt++;\n+\t}\n+\n+\tfclose(fh);\n+\n+\t*proute_base = route_rules;\n+\n+\treturn route_cnt;\n+}\n+\n+static void\n+free_lpm_routes(void)\n+{\n+\tfree(route_base_v4);\n+\tfree(route_base_v6);\n+\troute_base_v4 = NULL;\n+\troute_base_v6 = NULL;\n+\troute_num_v4 = 0;\n+\troute_num_v6 = 0;\n+}\n+\n /* main processing loop */\n int\n lpm_main_loop(__rte_unused void *dummy)\n@@ -153,6 +356,9 @@ lpm_main_loop(__rte_unused void *dummy)\n \tconst uint64_t drain_tsc = (rte_get_tsc_hz() + US_PER_S - 1) /\n \t\tUS_PER_S * BURST_TX_DRAIN_US;\n \n+\t/* Config read and setup, free structs */\n+\tfree_lpm_routes();\n+\n \tlcore_id = rte_lcore_id();\n \tqconf = &lcore_conf[lcore_id];\n \n@@ -548,13 +754,44 @@ lpm_event_main_loop_tx_q_burst_vector(__rte_unused void *dummy)\n \treturn 0;\n }\n \n+/* Load rules from the input file */\n+void\n+read_config_files_lpm(void)\n+{\n+\t/* ipv4 check */\n+\tif (parm_config.rule_ipv4_name != NULL) {\n+\t\troute_num_v4 = lpm_add_rules(parm_config.rule_ipv4_name,\n+\t\t\t\t\t&route_base_v4, &lpm_parse_v4_rule);\n+\t\tif (route_num_v4 < 0) {\n+\t\t\tfree_lpm_routes();\n+\t\t\trte_exit(EXIT_FAILURE, \"Failed to add IPv4 rules\\n\");\n+\t\t}\n+\t} else {\n+\t\tRTE_LOG(ERR, L3FWD, \"IPv4 rule file not specified\\n\");\n+\t\trte_exit(EXIT_FAILURE, \"Failed to get valid route options\\n\");\n+\t}\n+\n+\t/* ipv6 check */\n+\tif (parm_config.rule_ipv6_name != NULL) {\n+\t\troute_num_v6 = lpm_add_rules(parm_config.rule_ipv6_name,\n+\t\t\t\t\t&route_base_v6, &lpm_parse_v6_rule);\n+\t\tif (route_num_v6 < 0) {\n+\t\t\tfree_lpm_routes();\n+\t\t\trte_exit(EXIT_FAILURE, \"Failed to add IPv6 rules\\n\");\n+\t\t}\n+\t} else {\n+\t\tRTE_LOG(ERR, L3FWD, \"IPv6 rule file not specified\\n\");\n+\t\trte_exit(EXIT_FAILURE, \"Failed to get valid route options\\n\");\n+\t}\n+}\n+\n void\n setup_lpm(const int socketid)\n {\n \tstruct rte_eth_dev_info dev_info;\n \tstruct rte_lpm6_config config;\n \tstruct rte_lpm_config config_ipv4;\n-\tunsigned i;\n+\tint i;\n \tint ret;\n \tchar s[64];\n \tchar abuf[INET6_ADDRSTRLEN];\n@@ -572,32 +809,33 @@ 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_route_array); i++) {\n+\tfor (i = 0; i < route_num_v4; i++) {\n \t\tstruct in_addr in;\n \n \t\t/* skip unused ports */\n-\t\tif ((1 << ipv4_l3fwd_route_array[i].if_out &\n+\t\tif ((1 << route_base_v4[i].if_out &\n \t\t\t\tenabled_port_mask) == 0)\n \t\t\tcontinue;\n \n-\t\trte_eth_dev_info_get(ipv4_l3fwd_route_array[i].if_out,\n+\t\trte_eth_dev_info_get(route_base_v4[i].if_out,\n \t\t\t\t     &dev_info);\n \t\tret = rte_lpm_add(ipv4_l3fwd_lpm_lookup_struct[socketid],\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+\t\t\troute_base_v4[i].ip,\n+\t\t\troute_base_v4[i].depth,\n+\t\t\troute_base_v4[i].if_out);\n \n \t\tif (ret < 0) {\n+\t\t\tfree_lpm_routes();\n \t\t\trte_exit(EXIT_FAILURE,\n \t\t\t\t\"Unable to add entry %u to the l3fwd LPM table on socket %d\\n\",\n \t\t\t\ti, socketid);\n \t\t}\n \n-\t\tin.s_addr = htonl(ipv4_l3fwd_route_array[i].ip);\n+\t\tin.s_addr = htonl(route_base_v4[i].ip);\n \t\tprintf(\"LPM: Adding route %s / %d (%d) [%s]\\n\",\n \t\t       inet_ntop(AF_INET, &in, abuf, sizeof(abuf)),\n-\t\t       ipv4_l3fwd_route_array[i].depth,\n-\t\t       ipv4_l3fwd_route_array[i].if_out, dev_info.device->name);\n+\t\t       route_base_v4[i].depth,\n+\t\t       route_base_v4[i].if_out, dev_info.device->name);\n \t}\n \n \t/* create the LPM6 table */\n@@ -608,37 +846,40 @@ setup_lpm(const int socketid)\n \tconfig.flags = 0;\n \tipv6_l3fwd_lpm_lookup_struct[socketid] = rte_lpm6_create(s, socketid,\n \t\t\t\t&config);\n-\tif (ipv6_l3fwd_lpm_lookup_struct[socketid] == NULL)\n+\tif (ipv6_l3fwd_lpm_lookup_struct[socketid] == NULL) {\n+\t\tfree_lpm_routes();\n \t\trte_exit(EXIT_FAILURE,\n \t\t\t\"Unable to create the l3fwd LPM table on socket %d\\n\",\n \t\t\tsocketid);\n+\t}\n \n \t/* populate the LPM table */\n-\tfor (i = 0; i < RTE_DIM(ipv6_l3fwd_route_array); i++) {\n+\tfor (i = 0; i < route_num_v6; i++) {\n \n \t\t/* skip unused ports */\n-\t\tif ((1 << ipv6_l3fwd_route_array[i].if_out &\n+\t\tif ((1 << route_base_v6[i].if_out &\n \t\t\t\tenabled_port_mask) == 0)\n \t\t\tcontinue;\n \n-\t\trte_eth_dev_info_get(ipv4_l3fwd_route_array[i].if_out,\n+\t\trte_eth_dev_info_get(route_base_v6[i].if_out,\n \t\t\t\t     &dev_info);\n \t\tret = rte_lpm6_add(ipv6_l3fwd_lpm_lookup_struct[socketid],\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+\t\t\troute_base_v6[i].ip_8,\n+\t\t\troute_base_v6[i].depth,\n+\t\t\troute_base_v6[i].if_out);\n \n \t\tif (ret < 0) {\n+\t\t\tfree_lpm_routes();\n \t\t\trte_exit(EXIT_FAILURE,\n \t\t\t\t\"Unable to add entry %u to the l3fwd LPM table on socket %d\\n\",\n \t\t\t\ti, socketid);\n \t\t}\n \n \t\tprintf(\"LPM: Adding route %s / %d (%d) [%s]\\n\",\n-\t\t       inet_ntop(AF_INET6, ipv6_l3fwd_route_array[i].ip, abuf,\n+\t\t       inet_ntop(AF_INET6, route_base_v6[i].ip_8, abuf,\n \t\t\t\t sizeof(abuf)),\n-\t\t       ipv6_l3fwd_route_array[i].depth,\n-\t\t       ipv6_l3fwd_route_array[i].if_out, dev_info.device->name);\n+\t\t       route_base_v6[i].depth,\n+\t\t       route_base_v6[i].if_out, dev_info.device->name);\n \t}\n }\n \ndiff --git a/examples/l3fwd/l3fwd_route.h b/examples/l3fwd/l3fwd_route.h\nindex c7eba06c4d..6d41c926b1 100644\n--- a/examples/l3fwd/l3fwd_route.h\n+++ b/examples/l3fwd/l3fwd_route.h\n@@ -14,6 +14,19 @@ struct ipv6_l3fwd_route {\n \tuint8_t if_out;\n };\n \n-extern const struct ipv4_l3fwd_route ipv4_l3fwd_route_array[16];\n+struct lpm_route_rule {\n+\tunion {\n+\t\tuint32_t ip;\n+\t\tunion {\n+\t\t\tuint32_t ip_32[4];\n+\t\t\tuint8_t ip_8[16];\n+\t\t};\n+\t};\n+\tuint8_t depth;\n+\tuint8_t if_out;\n+};\n \n-extern const struct ipv6_l3fwd_route ipv6_l3fwd_route_array[16];\n+extern struct lpm_route_rule *route_base_v4;\n+extern struct lpm_route_rule *route_base_v6;\n+extern int route_num_v4;\n+extern int route_num_v6;\ndiff --git a/examples/l3fwd/lpm_default_v4.cfg b/examples/l3fwd/lpm_default_v4.cfg\nnew file mode 100644\nindex 0000000000..4db5597ed8\n--- /dev/null\n+++ b/examples/l3fwd/lpm_default_v4.cfg\n@@ -0,0 +1,17 @@\n+#Copy of hard-coded IPv4 FWD table for L3FWD LPM\n+R198.18.0.0/24 0\n+R198.18.1.0/24 1\n+R198.18.2.0/24 2\n+R198.18.3.0/24 3\n+R198.18.4.0/24 4\n+R198.18.5.0/24 5\n+R198.18.6.0/24 6\n+R198.18.7.0/24 7\n+R198.18.8.0/24 8\n+R198.18.9.0/24 9\n+R198.18.10.0/24 10\n+R198.18.11.0/24 11\n+R198.18.12.0/24 12\n+R198.18.13.0/24 13\n+R198.18.14.0/24 14\n+R198.18.15.0/24 15\ndiff --git a/examples/l3fwd/lpm_default_v6.cfg b/examples/l3fwd/lpm_default_v6.cfg\nnew file mode 100644\nindex 0000000000..c50233e0ba\n--- /dev/null\n+++ b/examples/l3fwd/lpm_default_v6.cfg\n@@ -0,0 +1,17 @@\n+#Copy of hard-coded IPv6 FWD table for L3FWD LPM\n+R2001:0200:0000:0000:0000:0000:0000:0000/64 0\n+R2001:0200:0000:0001:0000:0000:0000:0000/64 1\n+R2001:0200:0000:0002:0000:0000:0000:0000/64 2\n+R2001:0200:0000:0003:0000:0000:0000:0000/64 3\n+R2001:0200:0000:0004:0000:0000:0000:0000/64 4\n+R2001:0200:0000:0005:0000:0000:0000:0000/64 5\n+R2001:0200:0000:0006:0000:0000:0000:0000/64 6\n+R2001:0200:0000:0007:0000:0000:0000:0000/64 7\n+R2001:0200:0000:0008:0000:0000:0000:0000/64 8\n+R2001:0200:0000:0009:0000:0000:0000:0000/64 9\n+R2001:0200:0000:000A:0000:0000:0000:0000/64 10\n+R2001:0200:0000:000B:0000:0000:0000:0000/64 11\n+R2001:0200:0000:000C:0000:0000:0000:0000/64 12\n+R2001:0200:0000:000D:0000:0000:0000:0000/64 13\n+R2001:0200:0000:000E:0000:0000:0000:0000/64 14\n+R2001:0200:0000:000F:0000:0000:0000:0000/64 15\ndiff --git a/examples/l3fwd/main.c b/examples/l3fwd/main.c\nindex eb68ffc5aa..927164561e 100644\n--- a/examples/l3fwd/main.c\n+++ b/examples/l3fwd/main.c\n@@ -94,6 +94,8 @@ uint32_t hash_entry_number = HASH_ENTRY_NUMBER_DEFAULT;\n \n struct lcore_conf lcore_conf[RTE_MAX_LCORE];\n \n+struct parm_cfg parm_config;\n+\n struct lcore_params {\n \tuint16_t port_id;\n \tuint8_t queue_id;\n@@ -141,6 +143,7 @@ static struct rte_mempool *vector_pool[RTE_MAX_ETHPORTS];\n static uint8_t lkp_per_socket[NB_SOCKETS];\n \n struct l3fwd_lkp_mode {\n+\tvoid  (*read_config_files)(void);\n \tvoid  (*setup)(int);\n \tint   (*check_ptype)(int);\n \trte_rx_callback_fn cb_parse_ptype;\n@@ -152,6 +155,7 @@ struct l3fwd_lkp_mode {\n static struct l3fwd_lkp_mode l3fwd_lkp;\n \n static struct l3fwd_lkp_mode l3fwd_em_lkp = {\n+\t.read_config_files\t\t= read_config_files_em,\n \t.setup                  = setup_hash,\n \t.check_ptype\t\t= em_check_ptype,\n \t.cb_parse_ptype\t\t= em_cb_parse_ptype,\n@@ -161,6 +165,7 @@ static struct l3fwd_lkp_mode l3fwd_em_lkp = {\n };\n \n static struct l3fwd_lkp_mode l3fwd_lpm_lkp = {\n+\t.read_config_files\t\t= read_config_files_lpm,\n \t.setup                  = setup_lpm,\n \t.check_ptype\t\t= lpm_check_ptype,\n \t.cb_parse_ptype\t\t= lpm_cb_parse_ptype,\n@@ -170,6 +175,7 @@ static struct l3fwd_lkp_mode l3fwd_lpm_lkp = {\n };\n \n static struct l3fwd_lkp_mode l3fwd_fib_lkp = {\n+\t.read_config_files\t\t= read_config_files_lpm,\n \t.setup                  = setup_fib,\n \t.check_ptype            = lpm_check_ptype,\n \t.cb_parse_ptype         = lpm_cb_parse_ptype,\n@@ -179,50 +185,19 @@ static struct l3fwd_lkp_mode l3fwd_fib_lkp = {\n };\n \n /*\n- * 198.18.0.0/16 are set aside for RFC2544 benchmarking (RFC5735).\n- * 198.18.{0-15}.0/24 = Port {0-15}\n+ * API's called during initialization to setup ACL/EM/LPM rules.\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-\t{RTE_IPV4(198, 18, 8, 0), 24, 8},\n-\t{RTE_IPV4(198, 18, 9, 0), 24, 9},\n-\t{RTE_IPV4(198, 18, 10, 0), 24, 10},\n-\t{RTE_IPV4(198, 18, 11, 0), 24, 11},\n-\t{RTE_IPV4(198, 18, 12, 0), 24, 12},\n-\t{RTE_IPV4(198, 18, 13, 0), 24, 13},\n-\t{RTE_IPV4(198, 18, 14, 0), 24, 14},\n-\t{RTE_IPV4(198, 18, 15, 0), 24, 15},\n-};\n+static void\n+l3fwd_set_rule_ipv4_name(const char *optarg)\n+{\n+\tparm_config.rule_ipv4_name = optarg;\n+}\n \n-/*\n- * 2001:200::/48 is IANA reserved range for IPv6 benchmarking (RFC5180).\n- * 2001:200:0:{0-f}::/64 = Port {0-15}\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-\t{{32, 1, 2, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0}, 64, 8},\n-\t{{32, 1, 2, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0}, 64, 9},\n-\t{{32, 1, 2, 0, 0, 0, 0, 10, 0, 0, 0, 0, 0, 0, 0, 0}, 64, 10},\n-\t{{32, 1, 2, 0, 0, 0, 0, 11, 0, 0, 0, 0, 0, 0, 0, 0}, 64, 11},\n-\t{{32, 1, 2, 0, 0, 0, 0, 12, 0, 0, 0, 0, 0, 0, 0, 0}, 64, 12},\n-\t{{32, 1, 2, 0, 0, 0, 0, 13, 0, 0, 0, 0, 0, 0, 0, 0}, 64, 13},\n-\t{{32, 1, 2, 0, 0, 0, 0, 14, 0, 0, 0, 0, 0, 0, 0, 0}, 64, 14},\n-\t{{32, 1, 2, 0, 0, 0, 0, 15, 0, 0, 0, 0, 0, 0, 0, 0}, 64, 15},\n-};\n+static void\n+l3fwd_set_rule_ipv6_name(const char *optarg)\n+{\n+\tparm_config.rule_ipv6_name = optarg;\n+}\n \n /*\n  * Setup lookup methods for forwarding.\n@@ -339,6 +314,8 @@ print_usage(const char *prgname)\n {\n \tfprintf(stderr, \"%s [EAL options] --\"\n \t\t\" -p PORTMASK\"\n+\t\t\"  --rule_ipv4=FILE\"\n+\t\t\"  --rule_ipv6=FILE\"\n \t\t\" [-P]\"\n \t\t\" [--lookup]\"\n \t\t\" --config (port,queue,lcore)[,(port,queue,lcore)]\"\n@@ -381,7 +358,10 @@ print_usage(const char *prgname)\n \t\t\"  --event-vector-size: Max vector size if event vectorization is enabled.\\n\"\n \t\t\"  --event-vector-tmo: Max timeout to form vector in nanoseconds if event vectorization is enabled\\n\"\n \t\t\"  -E : Enable exact match, legacy flag please use --lookup=em instead\\n\"\n-\t\t\"  -L : Enable longest prefix match, legacy flag please use --lookup=lpm instead\\n\\n\",\n+\t\t\"  -L : Enable longest prefix match, legacy flag please use --lookup=lpm instead\\n\"\n+\t\t\"  --rule_ipv4=FILE: Specify the ipv4 rules entries file.\\n\"\n+\t\t\"                    Each rule occupies one line.\\n\"\n+\t\t\"  --rule_ipv6=FILE: Specify the ipv6 rules entries file.\\n\\n\",\n \t\tprgname);\n }\n \n@@ -596,6 +576,8 @@ static const char short_options[] =\n #define CMD_LINE_OPT_ENABLE_VECTOR \"event-vector\"\n #define CMD_LINE_OPT_VECTOR_SIZE \"event-vector-size\"\n #define CMD_LINE_OPT_VECTOR_TMO_NS \"event-vector-tmo\"\n+#define CMD_LINE_OPT_RULE_IPV4 \"rule_ipv4\"\n+#define CMD_LINE_OPT_RULE_IPV6 \"rule_ipv6\"\n \n enum {\n \t/* long options mapped to a short option */\n@@ -610,6 +592,8 @@ enum {\n \tCMD_LINE_OPT_MAX_PKT_LEN_NUM,\n \tCMD_LINE_OPT_HASH_ENTRY_NUM_NUM,\n \tCMD_LINE_OPT_PARSE_PTYPE_NUM,\n+\tCMD_LINE_OPT_RULE_IPV4_NUM,\n+\tCMD_LINE_OPT_RULE_IPV6_NUM,\n \tCMD_LINE_OPT_PARSE_PER_PORT_POOL,\n \tCMD_LINE_OPT_MODE_NUM,\n \tCMD_LINE_OPT_EVENTQ_SYNC_NUM,\n@@ -637,6 +621,8 @@ static const struct option lgopts[] = {\n \t{CMD_LINE_OPT_ENABLE_VECTOR, 0, 0, CMD_LINE_OPT_ENABLE_VECTOR_NUM},\n \t{CMD_LINE_OPT_VECTOR_SIZE, 1, 0, CMD_LINE_OPT_VECTOR_SIZE_NUM},\n \t{CMD_LINE_OPT_VECTOR_TMO_NS, 1, 0, CMD_LINE_OPT_VECTOR_TMO_NS_NUM},\n+\t{CMD_LINE_OPT_RULE_IPV4,   1, 0, CMD_LINE_OPT_RULE_IPV4_NUM},\n+\t{CMD_LINE_OPT_RULE_IPV6,   1, 0, CMD_LINE_OPT_RULE_IPV6_NUM},\n \t{NULL, 0, 0, 0}\n };\n \n@@ -791,6 +777,12 @@ parse_args(int argc, char **argv)\n \t\tcase CMD_LINE_OPT_VECTOR_TMO_NS_NUM:\n \t\t\tevt_rsrc->vector_tmo_ns = strtoull(optarg, NULL, 10);\n \t\t\tbreak;\n+\t\tcase CMD_LINE_OPT_RULE_IPV4_NUM:\n+\t\t\tl3fwd_set_rule_ipv4_name(optarg);\n+\t\t\tbreak;\n+\t\tcase CMD_LINE_OPT_RULE_IPV6_NUM:\n+\t\t\tl3fwd_set_rule_ipv6_name(optarg);\n+\t\t\tbreak;\n \t\tdefault:\n \t\t\tprint_usage(prgname);\n \t\t\treturn -1;\n@@ -1358,6 +1350,24 @@ l3fwd_event_service_setup(void)\n \t}\n }\n \n+/* Bypass comment and empty lines */\n+int\n+is_bypass_line(const char *buff)\n+{\n+\tint i = 0;\n+\n+\t/* comment line */\n+\tif (buff[0] == COMMENT_LEAD_CHAR)\n+\t\treturn 1;\n+\t/* empty line */\n+\twhile (buff[i] != '\\0') {\n+\t\tif (!isspace(buff[i]))\n+\t\t\treturn 0;\n+\t\ti++;\n+\t}\n+\treturn 1;\n+}\n+\n int\n main(int argc, char **argv)\n {\n@@ -1395,6 +1405,9 @@ main(int argc, char **argv)\n \t/* Setup function pointers for lookup method. */\n \tsetup_l3fwd_lookup_tables();\n \n+\t/* Add the config file rules */\n+\tl3fwd_lkp.read_config_files();\n+\n \tevt_rsrc->per_port_pool = per_port_pool;\n \tevt_rsrc->pkt_pool = pktmbuf_pool;\n \tevt_rsrc->vec_pool = vector_pool;\n",
    "prefixes": [
        "v2",
        "1/2"
    ]
}