get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 53769,
    "url": "http://patches.dpdk.org/api/patches/53769/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20190528115158.73245-3-ray.kinsella@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": "<20190528115158.73245-3-ray.kinsella@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20190528115158.73245-3-ray.kinsella@intel.com",
    "date": "2019-05-28T11:51:58",
    "name": "[2/2] app/test: LPMv4 ABI Version Testing",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "0a339828821efa9e205413b36cb3cb3fe288a4d0",
    "submitter": {
        "id": 956,
        "url": "http://patches.dpdk.org/api/people/956/?format=api",
        "name": "Kinsella, Ray",
        "email": "ray.kinsella@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/20190528115158.73245-3-ray.kinsella@intel.com/mbox/",
    "series": [
        {
            "id": 4797,
            "url": "http://patches.dpdk.org/api/series/4797/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=4797",
            "date": "2019-05-28T11:51:56",
            "name": "Add ABI Version Testing to app/test",
            "version": 1,
            "mbox": "http://patches.dpdk.org/series/4797/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/53769/comments/",
    "check": "fail",
    "checks": "http://patches.dpdk.org/api/patches/53769/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-Original-To": "patchwork@dpdk.org",
        "Delivered-To": "patchwork@dpdk.org",
        "Received": [
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id A83EB1B96E;\n\tTue, 28 May 2019 15:13:05 +0200 (CEST)",
            "from mga14.intel.com (mga14.intel.com [192.55.52.115])\n\tby dpdk.org (Postfix) with ESMTP id 58A352C55\n\tfor <dev@dpdk.org>; Tue, 28 May 2019 13:53:05 +0200 (CEST)",
            "from fmsmga001.fm.intel.com ([10.253.24.23])\n\tby fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t28 May 2019 04:53:04 -0700",
            "from silpixa00395806.ir.intel.com (HELO\n\tsilpixa00395806.ger.corp.intel.com) ([10.237.222.41])\n\tby fmsmga001.fm.intel.com with ESMTP; 28 May 2019 04:53:01 -0700"
        ],
        "X-Amp-Result": "SKIPPED(no attachment in message)",
        "X-Amp-File-Uploaded": "False",
        "X-ExtLoop1": "1",
        "From": "Ray Kinsella <ray.kinsella@intel.com>",
        "To": "bruce.richardson@intel.com,\n\tvladimir.medvedkin@intel.com",
        "Cc": "dev@dpdk.org,\n\tRay Kinsella <ray.kinsella@intel.com>",
        "Date": "Tue, 28 May 2019 12:51:58 +0100",
        "Message-Id": "<20190528115158.73245-3-ray.kinsella@intel.com>",
        "X-Mailer": "git-send-email 2.17.1",
        "In-Reply-To": "<20190528115158.73245-1-ray.kinsella@intel.com>",
        "References": "<20190528115158.73245-1-ray.kinsella@intel.com>",
        "X-Mailman-Approved-At": "Tue, 28 May 2019 15:12:47 +0200",
        "Subject": "[dpdk-dev] [PATCH 2/2] app/test: LPMv4 ABI Version Testing",
        "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\t<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\t<mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "This second patch adds the LPM ABI Version Unit Tests, comprised of\n\n1. Registering DPDK v2.0 and DPDK v16.04 ABI Versions with the\n   infrastructure.\n2. Forward Porting the DPDK v2.0 and DPDK v16.04 LPM Unit Test\n   cases, remapping the LPM Library symbols to the appropriate versions.\n3. Refactoring the lpm perf routes table to make this\n   functionality available to the v2.0 and v16.04 unit tests, forwarding\n   porting this code also from v2.0 etc would have increased the DPDK\n   codebase several MLoC.q\n\nSigned-off-by: Ray Kinsella <ray.kinsella@intel.com>\n---\n app/test/Makefile              |   12 +-\n app/test/meson.build           |    5 +\n app/test/test_lpm.c            |    1 +\n app/test/test_lpm_perf.c       |  293 +------\n app/test/test_lpm_routes.c     |  287 +++++++\n app/test/test_lpm_routes.h     |   25 +\n app/test/v16.04/dcompat.h      |   23 +\n app/test/v16.04/rte_lpm.h      |  463 +++++++++++\n app/test/v16.04/rte_lpm_neon.h |  119 +++\n app/test/v16.04/rte_lpm_sse.h  |  120 +++\n app/test/v16.04/test_lpm.c     | 1405 ++++++++++++++++++++++++++++++++\n app/test/v16.04/test_v1604.c   |   14 +\n app/test/v2.0/dcompat.h        |   23 +\n app/test/v2.0/rte_lpm.h        |  443 ++++++++++\n app/test/v2.0/test_lpm.c       | 1306 +++++++++++++++++++++++++++++\n app/test/v2.0/test_v20.c       |   14 +\n 16 files changed, 4261 insertions(+), 292 deletions(-)\n create mode 100644 app/test/test_lpm_routes.c\n create mode 100644 app/test/test_lpm_routes.h\n create mode 100644 app/test/v16.04/dcompat.h\n create mode 100644 app/test/v16.04/rte_lpm.h\n create mode 100644 app/test/v16.04/rte_lpm_neon.h\n create mode 100644 app/test/v16.04/rte_lpm_sse.h\n create mode 100644 app/test/v16.04/test_lpm.c\n create mode 100644 app/test/v16.04/test_v1604.c\n create mode 100644 app/test/v2.0/dcompat.h\n create mode 100644 app/test/v2.0/rte_lpm.h\n create mode 100644 app/test/v2.0/test_lpm.c\n create mode 100644 app/test/v2.0/test_v20.c",
    "diff": "diff --git a/app/test/Makefile b/app/test/Makefile\nindex 68d6b4fbc..5899eb8b9 100644\n--- a/app/test/Makefile\n+++ b/app/test/Makefile\n@@ -78,6 +78,10 @@ SRCS-y += test_ring.c\n SRCS-y += test_ring_perf.c\n SRCS-y += test_pmd_perf.c\n \n+#ABI Version Testing\n+SRCS-$(CONFIG_RTE_BUILD_SHARED_LIB) += v2.0/test_v20.c\n+SRCS-$(CONFIG_RTE_BUILD_SHARED_LIB) += v16.04/test_v1604.c\n+\n ifeq ($(CONFIG_RTE_LIBRTE_TABLE),y)\n SRCS-y += test_table.c\n SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += test_table_pipeline.c\n@@ -107,7 +111,6 @@ SRCS-y += test_logs.c\n SRCS-y += test_memcpy.c\n SRCS-y += test_memcpy_perf.c\n \n-\n SRCS-$(CONFIG_RTE_LIBRTE_MEMBER) += test_member.c\n SRCS-$(CONFIG_RTE_LIBRTE_MEMBER) += test_member_perf.c\n \n@@ -122,11 +125,18 @@ SRCS-$(CONFIG_RTE_LIBRTE_HASH) += test_hash_multiwriter.c\n SRCS-$(CONFIG_RTE_LIBRTE_HASH) += test_hash_readwrite.c\n SRCS-$(CONFIG_RTE_LIBRTE_HASH) += test_hash_readwrite_lf.c\n \n+SRCS-$(CONFIG_RTE_LIBRTE_LPM) += test_lpm_routes.c\n SRCS-$(CONFIG_RTE_LIBRTE_LPM) += test_lpm.c\n SRCS-$(CONFIG_RTE_LIBRTE_LPM) += test_lpm_perf.c\n SRCS-$(CONFIG_RTE_LIBRTE_LPM) += test_lpm6.c\n SRCS-$(CONFIG_RTE_LIBRTE_LPM) += test_lpm6_perf.c\n \n+#LPM ABI Testing\n+ifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),y)\n+SRCS-$(CONFIG_RTE_LIBRTE_LPM) += v2.0/test_lpm.c\n+SRCS-$(CONFIG_RTE_LIBRTE_LPM) += v16.04/test_lpm.c\n+endif\n+\n SRCS-y += test_debug.c\n SRCS-y += test_errno.c\n SRCS-y += test_tailq.c\ndiff --git a/app/test/meson.build b/app/test/meson.build\nindex 83391cef0..628f4e1ff 100644\n--- a/app/test/meson.build\n+++ b/app/test/meson.build\n@@ -4,6 +4,8 @@\n test_sources = files('commands.c',\n \t'packet_burst_generator.c',\n \t'sample_packet_forward.c',\n+\t'v2.0/test_v20.c',\n+\t'v16.04/test_v1604.c',\n \t'test.c',\n \t'test_acl.c',\n \t'test_alarm.c',\n@@ -63,6 +65,9 @@ test_sources = files('commands.c',\n \t'test_lpm6.c',\n \t'test_lpm6_perf.c',\n \t'test_lpm_perf.c',\n+\t'test_lpm_routes.c',\n+\t'v2.0/test_lpm.c',\n+\t'v16.04/test_lpm.c',\n \t'test_malloc.c',\n \t'test_mbuf.c',\n \t'test_member.c',\ndiff --git a/app/test/test_lpm.c b/app/test/test_lpm.c\nindex 5d697dd0f..bfa702677 100644\n--- a/app/test/test_lpm.c\n+++ b/app/test/test_lpm.c\n@@ -1277,6 +1277,7 @@ test_lpm(void)\n \tint status, global_status = 0;\n \n \tfor (i = 0; i < NUM_LPM_TESTS; i++) {\n+\t\tprintf(\"# test %02d\\n\", i);\n \t\tstatus = tests[i]();\n \t\tif (status < 0) {\n \t\t\tprintf(\"ERROR: LPM Test %u: FAIL\\n\", i);\ndiff --git a/app/test/test_lpm_perf.c b/app/test/test_lpm_perf.c\nindex 3b98ce0c8..a6b8b35c2 100644\n--- a/app/test/test_lpm_perf.c\n+++ b/app/test/test_lpm_perf.c\n@@ -5,7 +5,6 @@\n #include <stdio.h>\n #include <stdint.h>\n #include <stdlib.h>\n-#include <math.h>\n \n #include <rte_cycles.h>\n #include <rte_random.h>\n@@ -13,6 +12,7 @@\n #include <rte_ip.h>\n #include <rte_lpm.h>\n \n+#include \"test_lpm_routes.h\"\n #include \"test.h\"\n #include \"test_xmmt_ops.h\"\n \n@@ -27,295 +27,6 @@\n #define BATCH_SIZE (1 << 12)\n #define BULK_SIZE 32\n \n-#define MAX_RULE_NUM (1200000)\n-\n-struct route_rule {\n-\tuint32_t ip;\n-\tuint8_t depth;\n-};\n-\n-struct route_rule large_route_table[MAX_RULE_NUM];\n-\n-static uint32_t num_route_entries;\n-#define NUM_ROUTE_ENTRIES num_route_entries\n-\n-enum {\n-\tIP_CLASS_A,\n-\tIP_CLASS_B,\n-\tIP_CLASS_C\n-};\n-\n-/* struct route_rule_count defines the total number of rules in following a/b/c\n- * each item in a[]/b[]/c[] is the number of common IP address class A/B/C, not\n- * including the ones for private local network.\n- */\n-struct route_rule_count {\n-\tuint32_t a[RTE_LPM_MAX_DEPTH];\n-\tuint32_t b[RTE_LPM_MAX_DEPTH];\n-\tuint32_t c[RTE_LPM_MAX_DEPTH];\n-};\n-\n-/* All following numbers of each depth of each common IP class are just\n- * got from previous large constant table in app/test/test_lpm_routes.h .\n- * In order to match similar performance, they keep same depth and IP\n- * address coverage as previous constant table. These numbers don't\n- * include any private local IP address. As previous large const rule\n- * table was just dumped from a real router, there are no any IP address\n- * in class C or D.\n- */\n-static struct route_rule_count rule_count = {\n-\t.a = { /* IP class A in which the most significant bit is 0 */\n-\t\t    0, /* depth =  1 */\n-\t\t    0, /* depth =  2 */\n-\t\t    1, /* depth =  3 */\n-\t\t    0, /* depth =  4 */\n-\t\t    2, /* depth =  5 */\n-\t\t    1, /* depth =  6 */\n-\t\t    3, /* depth =  7 */\n-\t\t  185, /* depth =  8 */\n-\t\t   26, /* depth =  9 */\n-\t\t   16, /* depth = 10 */\n-\t\t   39, /* depth = 11 */\n-\t\t  144, /* depth = 12 */\n-\t\t  233, /* depth = 13 */\n-\t\t  528, /* depth = 14 */\n-\t\t  866, /* depth = 15 */\n-\t\t 3856, /* depth = 16 */\n-\t\t 3268, /* depth = 17 */\n-\t\t 5662, /* depth = 18 */\n-\t\t17301, /* depth = 19 */\n-\t\t22226, /* depth = 20 */\n-\t\t11147, /* depth = 21 */\n-\t\t16746, /* depth = 22 */\n-\t\t17120, /* depth = 23 */\n-\t\t77578, /* depth = 24 */\n-\t\t  401, /* depth = 25 */\n-\t\t  656, /* depth = 26 */\n-\t\t 1107, /* depth = 27 */\n-\t\t 1121, /* depth = 28 */\n-\t\t 2316, /* depth = 29 */\n-\t\t  717, /* depth = 30 */\n-\t\t   10, /* depth = 31 */\n-\t\t   66  /* depth = 32 */\n-\t},\n-\t.b = { /* IP class A in which the most 2 significant bits are 10 */\n-\t\t    0, /* depth =  1 */\n-\t\t    0, /* depth =  2 */\n-\t\t    0, /* depth =  3 */\n-\t\t    0, /* depth =  4 */\n-\t\t    1, /* depth =  5 */\n-\t\t    1, /* depth =  6 */\n-\t\t    1, /* depth =  7 */\n-\t\t    3, /* depth =  8 */\n-\t\t    3, /* depth =  9 */\n-\t\t   30, /* depth = 10 */\n-\t\t   25, /* depth = 11 */\n-\t\t  168, /* depth = 12 */\n-\t\t  305, /* depth = 13 */\n-\t\t  569, /* depth = 14 */\n-\t\t 1129, /* depth = 15 */\n-\t\t50800, /* depth = 16 */\n-\t\t 1645, /* depth = 17 */\n-\t\t 1820, /* depth = 18 */\n-\t\t 3506, /* depth = 19 */\n-\t\t 3258, /* depth = 20 */\n-\t\t 3424, /* depth = 21 */\n-\t\t 4971, /* depth = 22 */\n-\t\t 6885, /* depth = 23 */\n-\t\t39771, /* depth = 24 */\n-\t\t  424, /* depth = 25 */\n-\t\t  170, /* depth = 26 */\n-\t\t  433, /* depth = 27 */\n-\t\t   92, /* depth = 28 */\n-\t\t  366, /* depth = 29 */\n-\t\t  377, /* depth = 30 */\n-\t\t    2, /* depth = 31 */\n-\t\t  200  /* depth = 32 */\n-\t},\n-\t.c = { /* IP class A in which the most 3 significant bits are 110 */\n-\t\t     0, /* depth =  1 */\n-\t\t     0, /* depth =  2 */\n-\t\t     0, /* depth =  3 */\n-\t\t     0, /* depth =  4 */\n-\t\t     0, /* depth =  5 */\n-\t\t     0, /* depth =  6 */\n-\t\t     0, /* depth =  7 */\n-\t\t    12, /* depth =  8 */\n-\t\t     8, /* depth =  9 */\n-\t\t     9, /* depth = 10 */\n-\t\t    33, /* depth = 11 */\n-\t\t    69, /* depth = 12 */\n-\t\t   237, /* depth = 13 */\n-\t\t  1007, /* depth = 14 */\n-\t\t  1717, /* depth = 15 */\n-\t\t 14663, /* depth = 16 */\n-\t\t  8070, /* depth = 17 */\n-\t\t 16185, /* depth = 18 */\n-\t\t 48261, /* depth = 19 */\n-\t\t 36870, /* depth = 20 */\n-\t\t 33960, /* depth = 21 */\n-\t\t 50638, /* depth = 22 */\n-\t\t 61422, /* depth = 23 */\n-\t\t466549, /* depth = 24 */\n-\t\t  1829, /* depth = 25 */\n-\t\t  4824, /* depth = 26 */\n-\t\t  4927, /* depth = 27 */\n-\t\t  5914, /* depth = 28 */\n-\t\t 10254, /* depth = 29 */\n-\t\t  4905, /* depth = 30 */\n-\t\t     1, /* depth = 31 */\n-\t\t   716  /* depth = 32 */\n-\t}\n-};\n-\n-static void generate_random_rule_prefix(uint32_t ip_class, uint8_t depth)\n-{\n-/* IP address class A, the most significant bit is 0 */\n-#define IP_HEAD_MASK_A\t\t\t0x00000000\n-#define IP_HEAD_BIT_NUM_A\t\t1\n-\n-/* IP address class B, the most significant 2 bits are 10 */\n-#define IP_HEAD_MASK_B\t\t\t0x80000000\n-#define IP_HEAD_BIT_NUM_B\t\t2\n-\n-/* IP address class C, the most significant 3 bits are 110 */\n-#define IP_HEAD_MASK_C\t\t\t0xC0000000\n-#define IP_HEAD_BIT_NUM_C\t\t3\n-\n-\tuint32_t class_depth;\n-\tuint32_t range;\n-\tuint32_t mask;\n-\tuint32_t step;\n-\tuint32_t start;\n-\tuint32_t fixed_bit_num;\n-\tuint32_t ip_head_mask;\n-\tuint32_t rule_num;\n-\tuint32_t k;\n-\tstruct route_rule *ptr_rule;\n-\n-\tif (ip_class == IP_CLASS_A) {        /* IP Address class A */\n-\t\tfixed_bit_num = IP_HEAD_BIT_NUM_A;\n-\t\tip_head_mask = IP_HEAD_MASK_A;\n-\t\trule_num = rule_count.a[depth - 1];\n-\t} else if (ip_class == IP_CLASS_B) { /* IP Address class B */\n-\t\tfixed_bit_num = IP_HEAD_BIT_NUM_B;\n-\t\tip_head_mask = IP_HEAD_MASK_B;\n-\t\trule_num = rule_count.b[depth - 1];\n-\t} else {                             /* IP Address class C */\n-\t\tfixed_bit_num = IP_HEAD_BIT_NUM_C;\n-\t\tip_head_mask = IP_HEAD_MASK_C;\n-\t\trule_num = rule_count.c[depth - 1];\n-\t}\n-\n-\tif (rule_num == 0)\n-\t\treturn;\n-\n-\t/* the number of rest bits which don't include the most significant\n-\t * fixed bits for this IP address class\n-\t */\n-\tclass_depth = depth - fixed_bit_num;\n-\n-\t/* range is the maximum number of rules for this depth and\n-\t * this IP address class\n-\t */\n-\trange = 1 << class_depth;\n-\n-\t/* only mask the most depth significant generated bits\n-\t * except fixed bits for IP address class\n-\t */\n-\tmask = range - 1;\n-\n-\t/* Widen coverage of IP address in generated rules */\n-\tif (range <= rule_num)\n-\t\tstep = 1;\n-\telse\n-\t\tstep = round((double)range / rule_num);\n-\n-\t/* Only generate rest bits except the most significant\n-\t * fixed bits for IP address class\n-\t */\n-\tstart = lrand48() & mask;\n-\tptr_rule = &large_route_table[num_route_entries];\n-\tfor (k = 0; k < rule_num; k++) {\n-\t\tptr_rule->ip = (start << (RTE_LPM_MAX_DEPTH - depth))\n-\t\t\t| ip_head_mask;\n-\t\tptr_rule->depth = depth;\n-\t\tptr_rule++;\n-\t\tstart = (start + step) & mask;\n-\t}\n-\tnum_route_entries += rule_num;\n-}\n-\n-static void insert_rule_in_random_pos(uint32_t ip, uint8_t depth)\n-{\n-\tuint32_t pos;\n-\tint try_count = 0;\n-\tstruct route_rule tmp;\n-\n-\tdo {\n-\t\tpos = lrand48();\n-\t\ttry_count++;\n-\t} while ((try_count < 10) && (pos > num_route_entries));\n-\n-\tif ((pos > num_route_entries) || (pos >= MAX_RULE_NUM))\n-\t\tpos = num_route_entries >> 1;\n-\n-\ttmp = large_route_table[pos];\n-\tlarge_route_table[pos].ip = ip;\n-\tlarge_route_table[pos].depth = depth;\n-\tif (num_route_entries < MAX_RULE_NUM)\n-\t\tlarge_route_table[num_route_entries++] = tmp;\n-}\n-\n-static void generate_large_route_rule_table(void)\n-{\n-\tuint32_t ip_class;\n-\tuint8_t  depth;\n-\n-\tnum_route_entries = 0;\n-\tmemset(large_route_table, 0, sizeof(large_route_table));\n-\n-\tfor (ip_class = IP_CLASS_A; ip_class <= IP_CLASS_C; ip_class++) {\n-\t\tfor (depth = 1; depth <= RTE_LPM_MAX_DEPTH; depth++) {\n-\t\t\tgenerate_random_rule_prefix(ip_class, depth);\n-\t\t}\n-\t}\n-\n-\t/* Add following rules to keep same as previous large constant table,\n-\t * they are 4 rules with private local IP address and 1 all-zeros prefix\n-\t * with depth = 8.\n-\t */\n-\tinsert_rule_in_random_pos(IPv4(0, 0, 0, 0), 8);\n-\tinsert_rule_in_random_pos(IPv4(10, 2, 23, 147), 32);\n-\tinsert_rule_in_random_pos(IPv4(192, 168, 100, 10), 24);\n-\tinsert_rule_in_random_pos(IPv4(192, 168, 25, 100), 24);\n-\tinsert_rule_in_random_pos(IPv4(192, 168, 129, 124), 32);\n-}\n-\n-static void\n-print_route_distribution(const struct route_rule *table, uint32_t n)\n-{\n-\tunsigned i, j;\n-\n-\tprintf(\"Route distribution per prefix width: \\n\");\n-\tprintf(\"DEPTH    QUANTITY (PERCENT)\\n\");\n-\tprintf(\"--------------------------- \\n\");\n-\n-\t/* Count depths. */\n-\tfor (i = 1; i <= 32; i++) {\n-\t\tunsigned depth_counter = 0;\n-\t\tdouble percent_hits;\n-\n-\t\tfor (j = 0; j < n; j++)\n-\t\t\tif (table[j].depth == (uint8_t) i)\n-\t\t\t\tdepth_counter++;\n-\n-\t\tpercent_hits = ((double)depth_counter)/((double)n) * 100;\n-\t\tprintf(\"%.2u%15u (%.2f)\\n\", i, depth_counter, percent_hits);\n-\t}\n-\tprintf(\"\\n\");\n-}\n-\n static int\n test_lpm_perf(void)\n {\n@@ -375,7 +86,7 @@ test_lpm_perf(void)\n \t\t\t(unsigned) cache_line_counter, (unsigned) cache_line_counter * 64);\n \n \tprintf(\"Average LPM Add: %g cycles\\n\",\n-\t\t\t(double)total_time / NUM_ROUTE_ENTRIES);\n+\t       (double)total_time / NUM_ROUTE_ENTRIES);\n \n \t/* Measure single Lookup */\n \ttotal_time = 0;\ndiff --git a/app/test/test_lpm_routes.c b/app/test/test_lpm_routes.c\nnew file mode 100644\nindex 000000000..08128542a\n--- /dev/null\n+++ b/app/test/test_lpm_routes.c\n@@ -0,0 +1,287 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ * Copyright(c) 2010-2019 Intel Corporation\n+ */\n+\n+#include <math.h>\n+\n+#include \"rte_lpm.h\"\n+#include \"test_lpm_routes.h\"\n+\n+uint32_t num_route_entries;\n+struct route_rule large_route_table[MAX_RULE_NUM];\n+\n+enum {\n+\tIP_CLASS_A,\n+\tIP_CLASS_B,\n+\tIP_CLASS_C\n+};\n+\n+/* struct route_rule_count defines the total number of rules in following a/b/c\n+ * each item in a[]/b[]/c[] is the number of common IP address class A/B/C, not\n+ * including the ones for private local network.\n+ */\n+struct route_rule_count {\n+\tuint32_t a[RTE_LPM_MAX_DEPTH];\n+\tuint32_t b[RTE_LPM_MAX_DEPTH];\n+\tuint32_t c[RTE_LPM_MAX_DEPTH];\n+};\n+\n+/* All following numbers of each depth of each common IP class are just\n+ * got from previous large constant table in app/test/test_lpm_routes.h .\n+ * In order to match similar performance, they keep same depth and IP\n+ * address coverage as previous constant table. These numbers don't\n+ * include any private local IP address. As previous large const rule\n+ * table was just dumped from a real router, there are no any IP address\n+ * in class C or D.\n+ */\n+static struct route_rule_count rule_count = {\n+\t.a = { /* IP class A in which the most significant bit is 0 */\n+\t\t    0, /* depth =  1 */\n+\t\t    0, /* depth =  2 */\n+\t\t    1, /* depth =  3 */\n+\t\t    0, /* depth =  4 */\n+\t\t    2, /* depth =  5 */\n+\t\t    1, /* depth =  6 */\n+\t\t    3, /* depth =  7 */\n+\t\t  185, /* depth =  8 */\n+\t\t   26, /* depth =  9 */\n+\t\t   16, /* depth = 10 */\n+\t\t   39, /* depth = 11 */\n+\t\t  144, /* depth = 12 */\n+\t\t  233, /* depth = 13 */\n+\t\t  528, /* depth = 14 */\n+\t\t  866, /* depth = 15 */\n+\t\t 3856, /* depth = 16 */\n+\t\t 3268, /* depth = 17 */\n+\t\t 5662, /* depth = 18 */\n+\t\t17301, /* depth = 19 */\n+\t\t22226, /* depth = 20 */\n+\t\t11147, /* depth = 21 */\n+\t\t16746, /* depth = 22 */\n+\t\t17120, /* depth = 23 */\n+\t\t77578, /* depth = 24 */\n+\t\t  401, /* depth = 25 */\n+\t\t  656, /* depth = 26 */\n+\t\t 1107, /* depth = 27 */\n+\t\t 1121, /* depth = 28 */\n+\t\t 2316, /* depth = 29 */\n+\t\t  717, /* depth = 30 */\n+\t\t   10, /* depth = 31 */\n+\t\t   66  /* depth = 32 */\n+\t},\n+\t.b = { /* IP class A in which the most 2 significant bits are 10 */\n+\t\t    0, /* depth =  1 */\n+\t\t    0, /* depth =  2 */\n+\t\t    0, /* depth =  3 */\n+\t\t    0, /* depth =  4 */\n+\t\t    1, /* depth =  5 */\n+\t\t    1, /* depth =  6 */\n+\t\t    1, /* depth =  7 */\n+\t\t    3, /* depth =  8 */\n+\t\t    3, /* depth =  9 */\n+\t\t   30, /* depth = 10 */\n+\t\t   25, /* depth = 11 */\n+\t\t  168, /* depth = 12 */\n+\t\t  305, /* depth = 13 */\n+\t\t  569, /* depth = 14 */\n+\t\t 1129, /* depth = 15 */\n+\t\t50800, /* depth = 16 */\n+\t\t 1645, /* depth = 17 */\n+\t\t 1820, /* depth = 18 */\n+\t\t 3506, /* depth = 19 */\n+\t\t 3258, /* depth = 20 */\n+\t\t 3424, /* depth = 21 */\n+\t\t 4971, /* depth = 22 */\n+\t\t 6885, /* depth = 23 */\n+\t\t39771, /* depth = 24 */\n+\t\t  424, /* depth = 25 */\n+\t\t  170, /* depth = 26 */\n+\t\t  433, /* depth = 27 */\n+\t\t   92, /* depth = 28 */\n+\t\t  366, /* depth = 29 */\n+\t\t  377, /* depth = 30 */\n+\t\t    2, /* depth = 31 */\n+\t\t  200  /* depth = 32 */\n+\t},\n+\t.c = { /* IP class A in which the most 3 significant bits are 110 */\n+\t\t     0, /* depth =  1 */\n+\t\t     0, /* depth =  2 */\n+\t\t     0, /* depth =  3 */\n+\t\t     0, /* depth =  4 */\n+\t\t     0, /* depth =  5 */\n+\t\t     0, /* depth =  6 */\n+\t\t     0, /* depth =  7 */\n+\t\t    12, /* depth =  8 */\n+\t\t     8, /* depth =  9 */\n+\t\t     9, /* depth = 10 */\n+\t\t    33, /* depth = 11 */\n+\t\t    69, /* depth = 12 */\n+\t\t   237, /* depth = 13 */\n+\t\t  1007, /* depth = 14 */\n+\t\t  1717, /* depth = 15 */\n+\t\t 14663, /* depth = 16 */\n+\t\t  8070, /* depth = 17 */\n+\t\t 16185, /* depth = 18 */\n+\t\t 48261, /* depth = 19 */\n+\t\t 36870, /* depth = 20 */\n+\t\t 33960, /* depth = 21 */\n+\t\t 50638, /* depth = 22 */\n+\t\t 61422, /* depth = 23 */\n+\t\t466549, /* depth = 24 */\n+\t\t  1829, /* depth = 25 */\n+\t\t  4824, /* depth = 26 */\n+\t\t  4927, /* depth = 27 */\n+\t\t  5914, /* depth = 28 */\n+\t\t 10254, /* depth = 29 */\n+\t\t  4905, /* depth = 30 */\n+\t\t     1, /* depth = 31 */\n+\t\t   716  /* depth = 32 */\n+\t}\n+};\n+\n+static void generate_random_rule_prefix(uint32_t ip_class, uint8_t depth)\n+{\n+/* IP address class A, the most significant bit is 0 */\n+#define IP_HEAD_MASK_A\t\t\t0x00000000\n+#define IP_HEAD_BIT_NUM_A\t\t1\n+\n+/* IP address class B, the most significant 2 bits are 10 */\n+#define IP_HEAD_MASK_B\t\t\t0x80000000\n+#define IP_HEAD_BIT_NUM_B\t\t2\n+\n+/* IP address class C, the most significant 3 bits are 110 */\n+#define IP_HEAD_MASK_C\t\t\t0xC0000000\n+#define IP_HEAD_BIT_NUM_C\t\t3\n+\n+\tuint32_t class_depth;\n+\tuint32_t range;\n+\tuint32_t mask;\n+\tuint32_t step;\n+\tuint32_t start;\n+\tuint32_t fixed_bit_num;\n+\tuint32_t ip_head_mask;\n+\tuint32_t rule_num;\n+\tuint32_t k;\n+\tstruct route_rule *ptr_rule;\n+\n+\tif (ip_class == IP_CLASS_A) {        /* IP Address class A */\n+\t\tfixed_bit_num = IP_HEAD_BIT_NUM_A;\n+\t\tip_head_mask = IP_HEAD_MASK_A;\n+\t\trule_num = rule_count.a[depth - 1];\n+\t} else if (ip_class == IP_CLASS_B) { /* IP Address class B */\n+\t\tfixed_bit_num = IP_HEAD_BIT_NUM_B;\n+\t\tip_head_mask = IP_HEAD_MASK_B;\n+\t\trule_num = rule_count.b[depth - 1];\n+\t} else {                             /* IP Address class C */\n+\t\tfixed_bit_num = IP_HEAD_BIT_NUM_C;\n+\t\tip_head_mask = IP_HEAD_MASK_C;\n+\t\trule_num = rule_count.c[depth - 1];\n+\t}\n+\n+\tif (rule_num == 0)\n+\t\treturn;\n+\n+\t/* the number of rest bits which don't include the most significant\n+\t * fixed bits for this IP address class\n+\t */\n+\tclass_depth = depth - fixed_bit_num;\n+\n+\t/* range is the maximum number of rules for this depth and\n+\t * this IP address class\n+\t */\n+\trange = 1 << class_depth;\n+\n+\t/* only mask the most depth significant generated bits\n+\t * except fixed bits for IP address class\n+\t */\n+\tmask = range - 1;\n+\n+\t/* Widen coverage of IP address in generated rules */\n+\tif (range <= rule_num)\n+\t\tstep = 1;\n+\telse\n+\t\tstep = round((double)range / rule_num);\n+\n+\t/* Only generate rest bits except the most significant\n+\t * fixed bits for IP address class\n+\t */\n+\tstart = lrand48() & mask;\n+\tptr_rule = &large_route_table[num_route_entries];\n+\tfor (k = 0; k < rule_num; k++) {\n+\t\tptr_rule->ip = (start << (RTE_LPM_MAX_DEPTH - depth))\n+\t\t\t| ip_head_mask;\n+\t\tptr_rule->depth = depth;\n+\t\tptr_rule++;\n+\t\tstart = (start + step) & mask;\n+\t}\n+\tnum_route_entries += rule_num;\n+}\n+\n+static void insert_rule_in_random_pos(uint32_t ip, uint8_t depth)\n+{\n+\tuint32_t pos;\n+\tint try_count = 0;\n+\tstruct route_rule tmp;\n+\n+\tdo {\n+\t\tpos = lrand48();\n+\t\ttry_count++;\n+\t} while ((try_count < 10) && (pos > num_route_entries));\n+\n+\tif ((pos > num_route_entries) || (pos >= MAX_RULE_NUM))\n+\t\tpos = num_route_entries >> 1;\n+\n+\ttmp = large_route_table[pos];\n+\tlarge_route_table[pos].ip = ip;\n+\tlarge_route_table[pos].depth = depth;\n+\tif (num_route_entries < MAX_RULE_NUM)\n+\t\tlarge_route_table[num_route_entries++] = tmp;\n+}\n+\n+void generate_large_route_rule_table(void)\n+{\n+\tuint32_t ip_class;\n+\tuint8_t  depth;\n+\n+\tnum_route_entries = 0;\n+\tmemset(large_route_table, 0, sizeof(large_route_table));\n+\n+\tfor (ip_class = IP_CLASS_A; ip_class <= IP_CLASS_C; ip_class++) {\n+\t\tfor (depth = 1; depth <= RTE_LPM_MAX_DEPTH; depth++)\n+\t\t\tgenerate_random_rule_prefix(ip_class, depth);\n+\t}\n+\n+\t/* Add following rules to keep same as previous large constant table,\n+\t * they are 4 rules with private local IP address and 1 all-zeros prefix\n+\t * with depth = 8.\n+\t */\n+\tinsert_rule_in_random_pos(IPv4(0, 0, 0, 0), 8);\n+\tinsert_rule_in_random_pos(IPv4(10, 2, 23, 147), 32);\n+\tinsert_rule_in_random_pos(IPv4(192, 168, 100, 10), 24);\n+\tinsert_rule_in_random_pos(IPv4(192, 168, 25, 100), 24);\n+\tinsert_rule_in_random_pos(IPv4(192, 168, 129, 124), 32);\n+}\n+\n+void\n+print_route_distribution(const struct route_rule *table, uint32_t n)\n+{\n+\tunsigned int i, j;\n+\n+\tprintf(\"Route distribution per prefix width: \\n\");\n+\tprintf(\"DEPTH    QUANTITY (PERCENT)\\n\");\n+\tprintf(\"---------------------------\\n\");\n+\n+\t/* Count depths. */\n+\tfor (i = 1; i <= 32; i++) {\n+\t\tunsigned int depth_counter = 0;\n+\t\tdouble percent_hits;\n+\n+\t\tfor (j = 0; j < n; j++)\n+\t\t\tif (table[j].depth == (uint8_t) i)\n+\t\t\t\tdepth_counter++;\n+\n+\t\tpercent_hits = ((double)depth_counter)/((double)n) * 100;\n+\t\tprintf(\"%.2u%15u (%.2f)\\n\", i, depth_counter, percent_hits);\n+\t}\n+\tprintf(\"\\n\");\n+}\ndiff --git a/app/test/test_lpm_routes.h b/app/test/test_lpm_routes.h\nnew file mode 100644\nindex 000000000..c7874ea8f\n--- /dev/null\n+++ b/app/test/test_lpm_routes.h\n@@ -0,0 +1,25 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ * Copyright(c) 2010-2019 Intel Corporation\n+ */\n+\n+#ifndef _TEST_LPM_ROUTES_H_\n+#define _TEST_LPM_ROUTES_H_\n+\n+#include <rte_ip.h>\n+\n+#define MAX_RULE_NUM (1200000)\n+\n+struct route_rule {\n+\tuint32_t ip;\n+\tuint8_t depth;\n+};\n+\n+extern struct route_rule large_route_table[MAX_RULE_NUM];\n+\n+extern uint32_t num_route_entries;\n+#define NUM_ROUTE_ENTRIES num_route_entries\n+\n+void generate_large_route_rule_table(void);\n+void print_route_distribution(const struct route_rule *table, uint32_t n);\n+\n+#endif\ndiff --git a/app/test/v16.04/dcompat.h b/app/test/v16.04/dcompat.h\nnew file mode 100644\nindex 000000000..889c3b503\n--- /dev/null\n+++ b/app/test/v16.04/dcompat.h\n@@ -0,0 +1,23 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ * Copyright(c) 2010-2019 Intel Corporation\n+ */\n+\n+#ifndef _DCOMPAT_H_\n+#define _DCOMPAT_H_\n+\n+#define ABI_VERSION DPDK_16.04\n+\n+#define MAP_ABI_SYMBOL(name) \\\n+\tMAP_ABI_SYMBOL_VERSION(name, ABI_VERSION)\n+\n+MAP_ABI_SYMBOL(rte_lpm_add);\n+MAP_ABI_SYMBOL(rte_lpm_create);\n+MAP_ABI_SYMBOL(rte_lpm_delete);\n+MAP_ABI_SYMBOL(rte_lpm_delete_all);\n+MAP_ABI_SYMBOL(rte_lpm_find_existing);\n+MAP_ABI_SYMBOL(rte_lpm_free);\n+MAP_ABI_SYMBOL(rte_lpm_is_rule_present);\n+\n+#undef MAP_ABI_SYMBOL\n+\n+#endif\ndiff --git a/app/test/v16.04/rte_lpm.h b/app/test/v16.04/rte_lpm.h\nnew file mode 100644\nindex 000000000..c3348fbc1\n--- /dev/null\n+++ b/app/test/v16.04/rte_lpm.h\n@@ -0,0 +1,463 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ * Copyright(c) 2010-2014 Intel Corporation\n+ */\n+\n+#ifndef _RTE_LPM_H_\n+#define _RTE_LPM_H_\n+\n+/**\n+ * @file\n+ * RTE Longest Prefix Match (LPM)\n+ */\n+\n+#include <errno.h>\n+#include <sys/queue.h>\n+#include <stdint.h>\n+#include <stdlib.h>\n+#include <rte_branch_prediction.h>\n+#include <rte_byteorder.h>\n+#include <rte_memory.h>\n+#include <rte_common.h>\n+#include <rte_vect.h>\n+#include <rte_compat.h>\n+\n+#ifdef __cplusplus\n+extern \"C\" {\n+#endif\n+\n+/** Max number of characters in LPM name. */\n+#define RTE_LPM_NAMESIZE                32\n+\n+/** Maximum depth value possible for IPv4 LPM. */\n+#define RTE_LPM_MAX_DEPTH               32\n+\n+/** @internal Total number of tbl24 entries. */\n+#define RTE_LPM_TBL24_NUM_ENTRIES       (1 << 24)\n+\n+/** @internal Number of entries in a tbl8 group. */\n+#define RTE_LPM_TBL8_GROUP_NUM_ENTRIES  256\n+\n+/** @internal Max number of tbl8 groups in the tbl8. */\n+#define RTE_LPM_MAX_TBL8_NUM_GROUPS         (1 << 24)\n+\n+/** @internal Total number of tbl8 groups in the tbl8. */\n+#define RTE_LPM_TBL8_NUM_GROUPS         256\n+\n+/** @internal Total number of tbl8 entries. */\n+#define RTE_LPM_TBL8_NUM_ENTRIES        (RTE_LPM_TBL8_NUM_GROUPS * \\\n+\t\t\t\t\tRTE_LPM_TBL8_GROUP_NUM_ENTRIES)\n+\n+/** @internal Macro to enable/disable run-time checks. */\n+#if defined(RTE_LIBRTE_LPM_DEBUG)\n+#define RTE_LPM_RETURN_IF_TRUE(cond, retval) do { \\\n+\tif (cond) \\\n+\t\treturn (retval); \\\n+} while (0)\n+#else\n+#define RTE_LPM_RETURN_IF_TRUE(cond, retval)\n+#endif\n+\n+/** @internal bitmask with valid and valid_group fields set */\n+#define RTE_LPM_VALID_EXT_ENTRY_BITMASK 0x03000000\n+\n+/** Bitmask used to indicate successful lookup */\n+#define RTE_LPM_LOOKUP_SUCCESS          0x01000000\n+\n+#if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN\n+/** @internal Tbl24 entry structure. */\n+struct rte_lpm_tbl_entry_v20 {\n+\t/**\n+\t * Stores Next hop (tbl8 or tbl24 when valid_group is not set) or\n+\t * a group index pointing to a tbl8 structure (tbl24 only, when\n+\t * valid_group is set)\n+\t */\n+\tunion {\n+\t\tuint8_t next_hop;\n+\t\tuint8_t group_idx;\n+\t};\n+\t/* Using single uint8_t to store 3 values. */\n+\tuint8_t valid     :1;   /**< Validation flag. */\n+\t/**\n+\t * For tbl24:\n+\t *  - valid_group == 0: entry stores a next hop\n+\t *  - valid_group == 1: entry stores a group_index pointing to a tbl8\n+\t * For tbl8:\n+\t *  - valid_group indicates whether the current tbl8 is in use or not\n+\t */\n+\tuint8_t valid_group :1;\n+\tuint8_t depth       :6; /**< Rule depth. */\n+};\n+\n+struct rte_lpm_tbl_entry {\n+\t/**\n+\t * Stores Next hop (tbl8 or tbl24 when valid_group is not set) or\n+\t * a group index pointing to a tbl8 structure (tbl24 only, when\n+\t * valid_group is set)\n+\t */\n+\tuint32_t next_hop    :24;\n+\t/* Using single uint8_t to store 3 values. */\n+\tuint32_t valid       :1;   /**< Validation flag. */\n+\t/**\n+\t * For tbl24:\n+\t *  - valid_group == 0: entry stores a next hop\n+\t *  - valid_group == 1: entry stores a group_index pointing to a tbl8\n+\t * For tbl8:\n+\t *  - valid_group indicates whether the current tbl8 is in use or not\n+\t */\n+\tuint32_t valid_group :1;\n+\tuint32_t depth       :6; /**< Rule depth. */\n+};\n+\n+#else\n+struct rte_lpm_tbl_entry_v20 {\n+\tuint8_t depth       :6;\n+\tuint8_t valid_group :1;\n+\tuint8_t valid       :1;\n+\tunion {\n+\t\tuint8_t group_idx;\n+\t\tuint8_t next_hop;\n+\t};\n+};\n+\n+struct rte_lpm_tbl_entry {\n+\tuint32_t depth       :6;\n+\tuint32_t valid_group :1;\n+\tuint32_t valid       :1;\n+\tuint32_t next_hop    :24;\n+\n+};\n+\n+#endif\n+\n+/** LPM configuration structure. */\n+struct rte_lpm_config {\n+\tuint32_t max_rules;      /**< Max number of rules. */\n+\tuint32_t number_tbl8s;   /**< Number of tbl8s to allocate. */\n+\tint flags;               /**< This field is currently unused. */\n+};\n+\n+/** @internal Rule structure. */\n+struct rte_lpm_rule_v20 {\n+\tuint32_t ip; /**< Rule IP address. */\n+\tuint8_t  next_hop; /**< Rule next hop. */\n+};\n+\n+struct rte_lpm_rule {\n+\tuint32_t ip; /**< Rule IP address. */\n+\tuint32_t next_hop; /**< Rule next hop. */\n+};\n+\n+/** @internal Contains metadata about the rules table. */\n+struct rte_lpm_rule_info {\n+\tuint32_t used_rules; /**< Used rules so far. */\n+\tuint32_t first_rule; /**< Indexes the first rule of a given depth. */\n+};\n+\n+/** @internal LPM structure. */\n+struct rte_lpm_v20 {\n+\t/* LPM metadata. */\n+\tchar name[RTE_LPM_NAMESIZE];        /**< Name of the lpm. */\n+\tuint32_t max_rules; /**< Max. balanced rules per lpm. */\n+\tstruct rte_lpm_rule_info rule_info[RTE_LPM_MAX_DEPTH]; /**< Rule info table. */\n+\n+\t/* LPM Tables. */\n+\tstruct rte_lpm_tbl_entry_v20 tbl24[RTE_LPM_TBL24_NUM_ENTRIES]\n+\t\t\t__rte_cache_aligned; /**< LPM tbl24 table. */\n+\tstruct rte_lpm_tbl_entry_v20 tbl8[RTE_LPM_TBL8_NUM_ENTRIES]\n+\t\t\t__rte_cache_aligned; /**< LPM tbl8 table. */\n+\tstruct rte_lpm_rule_v20 rules_tbl[0] \\\n+\t\t\t__rte_cache_aligned; /**< LPM rules. */\n+};\n+\n+struct rte_lpm {\n+\t/* LPM metadata. */\n+\tchar name[RTE_LPM_NAMESIZE];        /**< Name of the lpm. */\n+\tuint32_t max_rules; /**< Max. balanced rules per lpm. */\n+\tuint32_t number_tbl8s; /**< Number of tbl8s. */\n+\tstruct rte_lpm_rule_info rule_info[RTE_LPM_MAX_DEPTH]; /**< Rule info table. */\n+\n+\t/* LPM Tables. */\n+\tstruct rte_lpm_tbl_entry tbl24[RTE_LPM_TBL24_NUM_ENTRIES]\n+\t\t\t__rte_cache_aligned; /**< LPM tbl24 table. */\n+\tstruct rte_lpm_tbl_entry *tbl8; /**< LPM tbl8 table. */\n+\tstruct rte_lpm_rule *rules_tbl; /**< LPM rules. */\n+};\n+\n+/**\n+ * Create an LPM object.\n+ *\n+ * @param name\n+ *   LPM object name\n+ * @param socket_id\n+ *   NUMA socket ID for LPM table memory allocation\n+ * @param config\n+ *   Structure containing the configuration\n+ * @return\n+ *   Handle to LPM object on success, NULL otherwise with rte_errno set\n+ *   to an appropriate values. Possible rte_errno values include:\n+ *    - E_RTE_NO_CONFIG - function could not get pointer to rte_config structure\n+ *    - E_RTE_SECONDARY - function was called from a secondary process instance\n+ *    - EINVAL - invalid parameter passed to function\n+ *    - ENOSPC - the maximum number of memzones has already been allocated\n+ *    - EEXIST - a memzone with the same name already exists\n+ *    - ENOMEM - no appropriate memory area found in which to create memzone\n+ */\n+struct rte_lpm *\n+rte_lpm_create(const char *name, int socket_id,\n+\t\tconst struct rte_lpm_config *config);\n+struct rte_lpm_v20 *\n+rte_lpm_create_v20(const char *name, int socket_id, int max_rules, int flags);\n+struct rte_lpm *\n+rte_lpm_create_v1604(const char *name, int socket_id,\n+\t\tconst struct rte_lpm_config *config);\n+\n+/**\n+ * Find an existing LPM object and return a pointer to it.\n+ *\n+ * @param name\n+ *   Name of the lpm object as passed to rte_lpm_create()\n+ * @return\n+ *   Pointer to lpm object or NULL if object not found with rte_errno\n+ *   set appropriately. Possible rte_errno values include:\n+ *    - ENOENT - required entry not available to return.\n+ */\n+struct rte_lpm *\n+rte_lpm_find_existing(const char *name);\n+struct rte_lpm_v20 *\n+rte_lpm_find_existing_v20(const char *name);\n+struct rte_lpm *\n+rte_lpm_find_existing_v1604(const char *name);\n+\n+/**\n+ * Free an LPM object.\n+ *\n+ * @param lpm\n+ *   LPM object handle\n+ * @return\n+ *   None\n+ */\n+void\n+rte_lpm_free(struct rte_lpm *lpm);\n+void\n+rte_lpm_free_v20(struct rte_lpm_v20 *lpm);\n+void\n+rte_lpm_free_v1604(struct rte_lpm *lpm);\n+\n+/**\n+ * Add a rule to the LPM table.\n+ *\n+ * @param lpm\n+ *   LPM object handle\n+ * @param ip\n+ *   IP of the rule to be added to the LPM table\n+ * @param depth\n+ *   Depth of the rule to be added to the LPM table\n+ * @param next_hop\n+ *   Next hop of the rule to be added to the LPM table\n+ * @return\n+ *   0 on success, negative value otherwise\n+ */\n+int\n+rte_lpm_add(struct rte_lpm *lpm, uint32_t ip, uint8_t depth, uint32_t next_hop);\n+int\n+rte_lpm_add_v20(struct rte_lpm_v20 *lpm, uint32_t ip, uint8_t depth,\n+\t\tuint8_t next_hop);\n+int\n+rte_lpm_add_v1604(struct rte_lpm *lpm, uint32_t ip, uint8_t depth,\n+\t\tuint32_t next_hop);\n+\n+/**\n+ * Check if a rule is present in the LPM table,\n+ * and provide its next hop if it is.\n+ *\n+ * @param lpm\n+ *   LPM object handle\n+ * @param ip\n+ *   IP of the rule to be searched\n+ * @param depth\n+ *   Depth of the rule to searched\n+ * @param next_hop\n+ *   Next hop of the rule (valid only if it is found)\n+ * @return\n+ *   1 if the rule exists, 0 if it does not, a negative value on failure\n+ */\n+int\n+rte_lpm_is_rule_present(struct rte_lpm *lpm, uint32_t ip, uint8_t depth,\n+uint32_t *next_hop);\n+int\n+rte_lpm_is_rule_present_v20(struct rte_lpm_v20 *lpm, uint32_t ip, uint8_t depth,\n+uint8_t *next_hop);\n+int\n+rte_lpm_is_rule_present_v1604(struct rte_lpm *lpm, uint32_t ip, uint8_t depth,\n+uint32_t *next_hop);\n+\n+/**\n+ * Delete a rule from the LPM table.\n+ *\n+ * @param lpm\n+ *   LPM object handle\n+ * @param ip\n+ *   IP of the rule to be deleted from the LPM table\n+ * @param depth\n+ *   Depth of the rule to be deleted from the LPM table\n+ * @return\n+ *   0 on success, negative value otherwise\n+ */\n+int\n+rte_lpm_delete(struct rte_lpm *lpm, uint32_t ip, uint8_t depth);\n+int\n+rte_lpm_delete_v20(struct rte_lpm_v20 *lpm, uint32_t ip, uint8_t depth);\n+int\n+rte_lpm_delete_v1604(struct rte_lpm *lpm, uint32_t ip, uint8_t depth);\n+\n+/**\n+ * Delete all rules from the LPM table.\n+ *\n+ * @param lpm\n+ *   LPM object handle\n+ */\n+void\n+rte_lpm_delete_all(struct rte_lpm *lpm);\n+void\n+rte_lpm_delete_all_v20(struct rte_lpm_v20 *lpm);\n+void\n+rte_lpm_delete_all_v1604(struct rte_lpm *lpm);\n+\n+/**\n+ * Lookup an IP into the LPM table.\n+ *\n+ * @param lpm\n+ *   LPM object handle\n+ * @param ip\n+ *   IP to be looked up in the LPM table\n+ * @param next_hop\n+ *   Next hop of the most specific rule found for IP (valid on lookup hit only)\n+ * @return\n+ *   -EINVAL for incorrect arguments, -ENOENT on lookup miss, 0 on lookup hit\n+ */\n+static inline int\n+rte_lpm_lookup(struct rte_lpm *lpm, uint32_t ip, uint32_t *next_hop)\n+{\n+\tunsigned tbl24_index = (ip >> 8);\n+\tuint32_t tbl_entry;\n+\tconst uint32_t *ptbl;\n+\n+\t/* DEBUG: Check user input arguments. */\n+\tRTE_LPM_RETURN_IF_TRUE(((lpm == NULL) || (next_hop == NULL)), -EINVAL);\n+\n+\t/* Copy tbl24 entry */\n+\tptbl = (const uint32_t *)(&lpm->tbl24[tbl24_index]);\n+\ttbl_entry = *ptbl;\n+\n+\t/* Copy tbl8 entry (only if needed) */\n+\tif (unlikely((tbl_entry & RTE_LPM_VALID_EXT_ENTRY_BITMASK) ==\n+\t\t\tRTE_LPM_VALID_EXT_ENTRY_BITMASK)) {\n+\n+\t\tunsigned tbl8_index = (uint8_t)ip +\n+\t\t\t\t(((uint32_t)tbl_entry & 0x00FFFFFF) *\n+\t\t\t\t\t\tRTE_LPM_TBL8_GROUP_NUM_ENTRIES);\n+\n+\t\tptbl = (const uint32_t *)&lpm->tbl8[tbl8_index];\n+\t\ttbl_entry = *ptbl;\n+\t}\n+\n+\t*next_hop = ((uint32_t)tbl_entry & 0x00FFFFFF);\n+\treturn (tbl_entry & RTE_LPM_LOOKUP_SUCCESS) ? 0 : -ENOENT;\n+}\n+\n+/**\n+ * Lookup multiple IP addresses in an LPM table. This may be implemented as a\n+ * macro, so the address of the function should not be used.\n+ *\n+ * @param lpm\n+ *   LPM object handle\n+ * @param ips\n+ *   Array of IPs to be looked up in the LPM table\n+ * @param next_hops\n+ *   Next hop of the most specific rule found for IP (valid on lookup hit only).\n+ *   This is an array of two byte values. The most significant byte in each\n+ *   value says whether the lookup was successful (bitmask\n+ *   RTE_LPM_LOOKUP_SUCCESS is set). The least significant byte is the\n+ *   actual next hop.\n+ * @param n\n+ *   Number of elements in ips (and next_hops) array to lookup. This should be a\n+ *   compile time constant, and divisible by 8 for best performance.\n+ *  @return\n+ *   -EINVAL for incorrect arguments, otherwise 0\n+ */\n+#define rte_lpm_lookup_bulk(lpm, ips, next_hops, n) \\\n+\t\trte_lpm_lookup_bulk_func(lpm, ips, next_hops, n)\n+\n+static inline int\n+rte_lpm_lookup_bulk_func(const struct rte_lpm *lpm, const uint32_t *ips,\n+\t\tuint32_t *next_hops, const unsigned n)\n+{\n+\tunsigned i;\n+\tunsigned tbl24_indexes[n];\n+\tconst uint32_t *ptbl;\n+\n+\t/* DEBUG: Check user input arguments. */\n+\tRTE_LPM_RETURN_IF_TRUE(((lpm == NULL) || (ips == NULL) ||\n+\t\t\t(next_hops == NULL)), -EINVAL);\n+\n+\tfor (i = 0; i < n; i++) {\n+\t\ttbl24_indexes[i] = ips[i] >> 8;\n+\t}\n+\n+\tfor (i = 0; i < n; i++) {\n+\t\t/* Simply copy tbl24 entry to output */\n+\t\tptbl = (const uint32_t *)&lpm->tbl24[tbl24_indexes[i]];\n+\t\tnext_hops[i] = *ptbl;\n+\n+\t\t/* Overwrite output with tbl8 entry if needed */\n+\t\tif (unlikely((next_hops[i] & RTE_LPM_VALID_EXT_ENTRY_BITMASK) ==\n+\t\t\t\tRTE_LPM_VALID_EXT_ENTRY_BITMASK)) {\n+\n+\t\t\tunsigned tbl8_index = (uint8_t)ips[i] +\n+\t\t\t\t\t(((uint32_t)next_hops[i] & 0x00FFFFFF) *\n+\t\t\t\t\t RTE_LPM_TBL8_GROUP_NUM_ENTRIES);\n+\n+\t\t\tptbl = (const uint32_t *)&lpm->tbl8[tbl8_index];\n+\t\t\tnext_hops[i] = *ptbl;\n+\t\t}\n+\t}\n+\treturn 0;\n+}\n+\n+/* Mask four results. */\n+#define\t RTE_LPM_MASKX4_RES\tUINT64_C(0x00ffffff00ffffff)\n+\n+/**\n+ * Lookup four IP addresses in an LPM table.\n+ *\n+ * @param lpm\n+ *   LPM object handle\n+ * @param ip\n+ *   Four IPs to be looked up in the LPM table\n+ * @param hop\n+ *   Next hop of the most specific rule found for IP (valid on lookup hit only).\n+ *   This is an 4 elements array of two byte values.\n+ *   If the lookup was succesfull for the given IP, then least significant byte\n+ *   of the corresponding element is the  actual next hop and the most\n+ *   significant byte is zero.\n+ *   If the lookup for the given IP failed, then corresponding element would\n+ *   contain default value, see description of then next parameter.\n+ * @param defv\n+ *   Default value to populate into corresponding element of hop[] array,\n+ *   if lookup would fail.\n+ */\n+static inline void\n+rte_lpm_lookupx4(const struct rte_lpm *lpm, xmm_t ip, uint32_t hop[4],\n+\tuint32_t defv);\n+\n+#if defined(RTE_ARCH_ARM) || defined(RTE_ARCH_ARM64)\n+#include \"rte_lpm_neon.h\"\n+#else\n+#include \"rte_lpm_sse.h\"\n+#endif\n+\n+#ifdef __cplusplus\n+}\n+#endif\n+\n+#endif /* _RTE_LPM_H_ */\ndiff --git a/app/test/v16.04/rte_lpm_neon.h b/app/test/v16.04/rte_lpm_neon.h\nnew file mode 100644\nindex 000000000..936ec7af3\n--- /dev/null\n+++ b/app/test/v16.04/rte_lpm_neon.h\n@@ -0,0 +1,119 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ * Copyright(c) 2010-2014 Intel Corporation\n+ */\n+\n+#ifndef _RTE_LPM_NEON_H_\n+#define _RTE_LPM_NEON_H_\n+\n+#include <rte_branch_prediction.h>\n+#include <rte_byteorder.h>\n+#include <rte_common.h>\n+#include <rte_vect.h>\n+\n+#ifdef __cplusplus\n+extern \"C\" {\n+#endif\n+\n+static inline void\n+rte_lpm_lookupx4(const struct rte_lpm *lpm, xmm_t ip, uint32_t hop[4],\n+\tuint32_t defv)\n+{\n+\tuint32x4_t i24;\n+\trte_xmm_t i8;\n+\tuint32_t tbl[4];\n+\tuint64_t idx, pt, pt2;\n+\tconst uint32_t *ptbl;\n+\n+\tconst uint32_t mask = UINT8_MAX;\n+\tconst int32x4_t mask8 = vdupq_n_s32(mask);\n+\n+\t/*\n+\t * RTE_LPM_VALID_EXT_ENTRY_BITMASK for 2 LPM entries\n+\t * as one 64-bit value (0x0300000003000000).\n+\t */\n+\tconst uint64_t mask_xv =\n+\t\t((uint64_t)RTE_LPM_VALID_EXT_ENTRY_BITMASK |\n+\t\t(uint64_t)RTE_LPM_VALID_EXT_ENTRY_BITMASK << 32);\n+\n+\t/*\n+\t * RTE_LPM_LOOKUP_SUCCESS for 2 LPM entries\n+\t * as one 64-bit value (0x0100000001000000).\n+\t */\n+\tconst uint64_t mask_v =\n+\t\t((uint64_t)RTE_LPM_LOOKUP_SUCCESS |\n+\t\t(uint64_t)RTE_LPM_LOOKUP_SUCCESS << 32);\n+\n+\t/* get 4 indexes for tbl24[]. */\n+\ti24 = vshrq_n_u32((uint32x4_t)ip, CHAR_BIT);\n+\n+\t/* extract values from tbl24[] */\n+\tidx = vgetq_lane_u64((uint64x2_t)i24, 0);\n+\n+\tptbl = (const uint32_t *)&lpm->tbl24[(uint32_t)idx];\n+\ttbl[0] = *ptbl;\n+\tptbl = (const uint32_t *)&lpm->tbl24[idx >> 32];\n+\ttbl[1] = *ptbl;\n+\n+\tidx = vgetq_lane_u64((uint64x2_t)i24, 1);\n+\n+\tptbl = (const uint32_t *)&lpm->tbl24[(uint32_t)idx];\n+\ttbl[2] = *ptbl;\n+\tptbl = (const uint32_t *)&lpm->tbl24[idx >> 32];\n+\ttbl[3] = *ptbl;\n+\n+\t/* get 4 indexes for tbl8[]. */\n+\ti8.x = vandq_s32(ip, mask8);\n+\n+\tpt = (uint64_t)tbl[0] |\n+\t\t(uint64_t)tbl[1] << 32;\n+\tpt2 = (uint64_t)tbl[2] |\n+\t\t(uint64_t)tbl[3] << 32;\n+\n+\t/* search successfully finished for all 4 IP addresses. */\n+\tif (likely((pt & mask_xv) == mask_v) &&\n+\t\t\tlikely((pt2 & mask_xv) == mask_v)) {\n+\t\t*(uint64_t *)hop = pt & RTE_LPM_MASKX4_RES;\n+\t\t*(uint64_t *)(hop + 2) = pt2 & RTE_LPM_MASKX4_RES;\n+\t\treturn;\n+\t}\n+\n+\tif (unlikely((pt & RTE_LPM_VALID_EXT_ENTRY_BITMASK) ==\n+\t\t\tRTE_LPM_VALID_EXT_ENTRY_BITMASK)) {\n+\t\ti8.u32[0] = i8.u32[0] +\n+\t\t\t(uint8_t)tbl[0] * RTE_LPM_TBL8_GROUP_NUM_ENTRIES;\n+\t\tptbl = (const uint32_t *)&lpm->tbl8[i8.u32[0]];\n+\t\ttbl[0] = *ptbl;\n+\t}\n+\tif (unlikely((pt >> 32 & RTE_LPM_VALID_EXT_ENTRY_BITMASK) ==\n+\t\t\tRTE_LPM_VALID_EXT_ENTRY_BITMASK)) {\n+\t\ti8.u32[1] = i8.u32[1] +\n+\t\t\t(uint8_t)tbl[1] * RTE_LPM_TBL8_GROUP_NUM_ENTRIES;\n+\t\tptbl = (const uint32_t *)&lpm->tbl8[i8.u32[1]];\n+\t\ttbl[1] = *ptbl;\n+\t}\n+\tif (unlikely((pt2 & RTE_LPM_VALID_EXT_ENTRY_BITMASK) ==\n+\t\t\tRTE_LPM_VALID_EXT_ENTRY_BITMASK)) {\n+\t\ti8.u32[2] = i8.u32[2] +\n+\t\t\t(uint8_t)tbl[2] * RTE_LPM_TBL8_GROUP_NUM_ENTRIES;\n+\t\tptbl = (const uint32_t *)&lpm->tbl8[i8.u32[2]];\n+\t\ttbl[2] = *ptbl;\n+\t}\n+\tif (unlikely((pt2 >> 32 & RTE_LPM_VALID_EXT_ENTRY_BITMASK) ==\n+\t\t\tRTE_LPM_VALID_EXT_ENTRY_BITMASK)) {\n+\t\ti8.u32[3] = i8.u32[3] +\n+\t\t\t(uint8_t)tbl[3] * RTE_LPM_TBL8_GROUP_NUM_ENTRIES;\n+\t\tptbl = (const uint32_t *)&lpm->tbl8[i8.u32[3]];\n+\t\ttbl[3] = *ptbl;\n+\t}\n+\n+\thop[0] = (tbl[0] & RTE_LPM_LOOKUP_SUCCESS) ? tbl[0] & 0x00FFFFFF : defv;\n+\thop[1] = (tbl[1] & RTE_LPM_LOOKUP_SUCCESS) ? tbl[1] & 0x00FFFFFF : defv;\n+\thop[2] = (tbl[2] & RTE_LPM_LOOKUP_SUCCESS) ? tbl[2] & 0x00FFFFFF : defv;\n+\thop[3] = (tbl[3] & RTE_LPM_LOOKUP_SUCCESS) ? tbl[3] & 0x00FFFFFF : defv;\n+}\n+\n+#ifdef __cplusplus\n+}\n+#endif\n+\n+#endif /* _RTE_LPM_NEON_H_ */\ndiff --git a/app/test/v16.04/rte_lpm_sse.h b/app/test/v16.04/rte_lpm_sse.h\nnew file mode 100644\nindex 000000000..edfa36be1\n--- /dev/null\n+++ b/app/test/v16.04/rte_lpm_sse.h\n@@ -0,0 +1,120 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ * Copyright(c) 2010-2014 Intel Corporation\n+ */\n+\n+#ifndef _RTE_LPM_SSE_H_\n+#define _RTE_LPM_SSE_H_\n+\n+#include <rte_branch_prediction.h>\n+#include <rte_byteorder.h>\n+#include <rte_common.h>\n+#include <rte_vect.h>\n+\n+#ifdef __cplusplus\n+extern \"C\" {\n+#endif\n+\n+static inline void\n+rte_lpm_lookupx4(const struct rte_lpm *lpm, xmm_t ip, uint32_t hop[4],\n+\tuint32_t defv)\n+{\n+\t__m128i i24;\n+\trte_xmm_t i8;\n+\tuint32_t tbl[4];\n+\tuint64_t idx, pt, pt2;\n+\tconst uint32_t *ptbl;\n+\n+\tconst __m128i mask8 =\n+\t\t_mm_set_epi32(UINT8_MAX, UINT8_MAX, UINT8_MAX, UINT8_MAX);\n+\n+\t/*\n+\t * RTE_LPM_VALID_EXT_ENTRY_BITMASK for 2 LPM entries\n+\t * as one 64-bit value (0x0300000003000000).\n+\t */\n+\tconst uint64_t mask_xv =\n+\t\t((uint64_t)RTE_LPM_VALID_EXT_ENTRY_BITMASK |\n+\t\t(uint64_t)RTE_LPM_VALID_EXT_ENTRY_BITMASK << 32);\n+\n+\t/*\n+\t * RTE_LPM_LOOKUP_SUCCESS for 2 LPM entries\n+\t * as one 64-bit value (0x0100000001000000).\n+\t */\n+\tconst uint64_t mask_v =\n+\t\t((uint64_t)RTE_LPM_LOOKUP_SUCCESS |\n+\t\t(uint64_t)RTE_LPM_LOOKUP_SUCCESS << 32);\n+\n+\t/* get 4 indexes for tbl24[]. */\n+\ti24 = _mm_srli_epi32(ip, CHAR_BIT);\n+\n+\t/* extract values from tbl24[] */\n+\tidx = _mm_cvtsi128_si64(i24);\n+\ti24 = _mm_srli_si128(i24, sizeof(uint64_t));\n+\n+\tptbl = (const uint32_t *)&lpm->tbl24[(uint32_t)idx];\n+\ttbl[0] = *ptbl;\n+\tptbl = (const uint32_t *)&lpm->tbl24[idx >> 32];\n+\ttbl[1] = *ptbl;\n+\n+\tidx = _mm_cvtsi128_si64(i24);\n+\n+\tptbl = (const uint32_t *)&lpm->tbl24[(uint32_t)idx];\n+\ttbl[2] = *ptbl;\n+\tptbl = (const uint32_t *)&lpm->tbl24[idx >> 32];\n+\ttbl[3] = *ptbl;\n+\n+\t/* get 4 indexes for tbl8[]. */\n+\ti8.x = _mm_and_si128(ip, mask8);\n+\n+\tpt = (uint64_t)tbl[0] |\n+\t\t(uint64_t)tbl[1] << 32;\n+\tpt2 = (uint64_t)tbl[2] |\n+\t\t(uint64_t)tbl[3] << 32;\n+\n+\t/* search successfully finished for all 4 IP addresses. */\n+\tif (likely((pt & mask_xv) == mask_v) &&\n+\t\t\tlikely((pt2 & mask_xv) == mask_v)) {\n+\t\t*(uint64_t *)hop = pt & RTE_LPM_MASKX4_RES;\n+\t\t*(uint64_t *)(hop + 2) = pt2 & RTE_LPM_MASKX4_RES;\n+\t\treturn;\n+\t}\n+\n+\tif (unlikely((pt & RTE_LPM_VALID_EXT_ENTRY_BITMASK) ==\n+\t\t\tRTE_LPM_VALID_EXT_ENTRY_BITMASK)) {\n+\t\ti8.u32[0] = i8.u32[0] +\n+\t\t\t(uint8_t)tbl[0] * RTE_LPM_TBL8_GROUP_NUM_ENTRIES;\n+\t\tptbl = (const uint32_t *)&lpm->tbl8[i8.u32[0]];\n+\t\ttbl[0] = *ptbl;\n+\t}\n+\tif (unlikely((pt >> 32 & RTE_LPM_VALID_EXT_ENTRY_BITMASK) ==\n+\t\t\tRTE_LPM_VALID_EXT_ENTRY_BITMASK)) {\n+\t\ti8.u32[1] = i8.u32[1] +\n+\t\t\t(uint8_t)tbl[1] * RTE_LPM_TBL8_GROUP_NUM_ENTRIES;\n+\t\tptbl = (const uint32_t *)&lpm->tbl8[i8.u32[1]];\n+\t\ttbl[1] = *ptbl;\n+\t}\n+\tif (unlikely((pt2 & RTE_LPM_VALID_EXT_ENTRY_BITMASK) ==\n+\t\t\tRTE_LPM_VALID_EXT_ENTRY_BITMASK)) {\n+\t\ti8.u32[2] = i8.u32[2] +\n+\t\t\t(uint8_t)tbl[2] * RTE_LPM_TBL8_GROUP_NUM_ENTRIES;\n+\t\tptbl = (const uint32_t *)&lpm->tbl8[i8.u32[2]];\n+\t\ttbl[2] = *ptbl;\n+\t}\n+\tif (unlikely((pt2 >> 32 & RTE_LPM_VALID_EXT_ENTRY_BITMASK) ==\n+\t\t\tRTE_LPM_VALID_EXT_ENTRY_BITMASK)) {\n+\t\ti8.u32[3] = i8.u32[3] +\n+\t\t\t(uint8_t)tbl[3] * RTE_LPM_TBL8_GROUP_NUM_ENTRIES;\n+\t\tptbl = (const uint32_t *)&lpm->tbl8[i8.u32[3]];\n+\t\ttbl[3] = *ptbl;\n+\t}\n+\n+\thop[0] = (tbl[0] & RTE_LPM_LOOKUP_SUCCESS) ? tbl[0] & 0x00FFFFFF : defv;\n+\thop[1] = (tbl[1] & RTE_LPM_LOOKUP_SUCCESS) ? tbl[1] & 0x00FFFFFF : defv;\n+\thop[2] = (tbl[2] & RTE_LPM_LOOKUP_SUCCESS) ? tbl[2] & 0x00FFFFFF : defv;\n+\thop[3] = (tbl[3] & RTE_LPM_LOOKUP_SUCCESS) ? tbl[3] & 0x00FFFFFF : defv;\n+}\n+\n+#ifdef __cplusplus\n+}\n+#endif\n+\n+#endif /* _RTE_LPM_SSE_H_ */\ndiff --git a/app/test/v16.04/test_lpm.c b/app/test/v16.04/test_lpm.c\nnew file mode 100644\nindex 000000000..2aab8d0cc\n--- /dev/null\n+++ b/app/test/v16.04/test_lpm.c\n@@ -0,0 +1,1405 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ * Copyright(c) 2010-2019 Intel Corporation\n+ *\n+ * LPM Autotests from DPDK v16.04 for abi compability testing.\n+ *\n+ */\n+\n+#include <stdio.h>\n+#include <stdint.h>\n+#include <stdlib.h>\n+#include <errno.h>\n+#include <sys/queue.h>\n+\n+#include <rte_common.h>\n+#include <rte_cycles.h>\n+#include <rte_memory.h>\n+#include <rte_random.h>\n+#include <rte_branch_prediction.h>\n+#include <rte_ip.h>\n+#include <time.h>\n+\n+#include \"../test_lpm_routes.h\"\n+#include \"../test.h\"\n+#include \"../test_xmmt_ops.h\"\n+\n+/* backported header from DPDK v16.04 */\n+#include \"rte_lpm.h\"\n+/* remapping of DPDK v16.04 symbols */\n+#include \"dcompat.h\"\n+\n+#define TEST_LPM_ASSERT(cond) do {                                            \\\n+\tif (!(cond)) {                                                        \\\n+\t\tprintf(\"Error at line %d: \\n\", __LINE__);                     \\\n+\t\treturn -1;                                                    \\\n+\t}                                                                     \\\n+} while (0)\n+\n+typedef int32_t (*rte_lpm_test)(void);\n+\n+static int32_t test0(void);\n+static int32_t test1(void);\n+static int32_t test2(void);\n+static int32_t test3(void);\n+static int32_t test4(void);\n+static int32_t test5(void);\n+static int32_t test6(void);\n+static int32_t test7(void);\n+static int32_t test8(void);\n+static int32_t test9(void);\n+static int32_t test10(void);\n+static int32_t test11(void);\n+static int32_t test12(void);\n+static int32_t test13(void);\n+static int32_t test14(void);\n+static int32_t test15(void);\n+static int32_t test16(void);\n+static int32_t test17(void);\n+static int32_t perf_test(void);\n+\n+static rte_lpm_test tests[] = {\n+/* Test Cases */\n+\ttest0,\n+\ttest1,\n+\ttest2,\n+\ttest3,\n+\ttest4,\n+\ttest5,\n+\ttest6,\n+\ttest7,\n+\ttest8,\n+\ttest9,\n+\ttest10,\n+\ttest11,\n+\ttest12,\n+\ttest13,\n+\ttest14,\n+\ttest15,\n+\ttest16,\n+\ttest17,\n+\tperf_test,\n+};\n+\n+#define NUM_LPM_TESTS (sizeof(tests)/sizeof(tests[0]))\n+#define MAX_DEPTH 32\n+#define MAX_RULES 256\n+#define NUMBER_TBL8S 256\n+#define PASS 0\n+\n+/*\n+ * Check that rte_lpm_create fails gracefully for incorrect user input\n+ * arguments\n+ */\n+int32_t\n+test0(void)\n+{\n+\tstruct rte_lpm *lpm = NULL;\n+\tstruct rte_lpm_config config;\n+\n+\tconfig.max_rules = MAX_RULES;\n+\tconfig.number_tbl8s = NUMBER_TBL8S;\n+\tconfig.flags = 0;\n+\n+\t/* rte_lpm_create: lpm name == NULL */\n+\tlpm = rte_lpm_create(NULL, SOCKET_ID_ANY, &config);\n+\tTEST_LPM_ASSERT(lpm == NULL);\n+\n+\t/* rte_lpm_create: max_rules = 0 */\n+\t/* Note: __func__ inserts the function name, in this case \"test0\". */\n+\tconfig.max_rules = 0;\n+\tlpm = rte_lpm_create(__func__, SOCKET_ID_ANY, &config);\n+\tTEST_LPM_ASSERT(lpm == NULL);\n+\n+\t/* socket_id < -1 is invalid */\n+\tconfig.max_rules = MAX_RULES;\n+\tlpm = rte_lpm_create(__func__, -2, &config);\n+\tTEST_LPM_ASSERT(lpm == NULL);\n+\n+\treturn PASS;\n+}\n+\n+/*\n+ * Create lpm table then delete lpm table 100 times\n+ * Use a slightly different rules size each time\n+ * */\n+int32_t\n+test1(void)\n+{\n+\tstruct rte_lpm *lpm = NULL;\n+\tstruct rte_lpm_config config;\n+\n+\tconfig.number_tbl8s = NUMBER_TBL8S;\n+\tconfig.flags = 0;\n+\tint32_t i;\n+\n+\t/* rte_lpm_free: Free NULL */\n+\tfor (i = 0; i < 100; i++) {\n+\t\tconfig.max_rules = MAX_RULES - i;\n+\t\tlpm = rte_lpm_create(__func__, SOCKET_ID_ANY, &config);\n+\t\tTEST_LPM_ASSERT(lpm != NULL);\n+\n+\t\trte_lpm_free(lpm);\n+\t}\n+\n+\t/* Can not test free so return success */\n+\treturn PASS;\n+}\n+\n+/*\n+ * Call rte_lpm_free for NULL pointer user input. Note: free has no return and\n+ * therefore it is impossible to check for failure but this test is added to\n+ * increase function coverage metrics and to validate that freeing null does\n+ * not crash.\n+ */\n+int32_t\n+test2(void)\n+{\n+\tstruct rte_lpm *lpm = NULL;\n+\tstruct rte_lpm_config config;\n+\n+\tconfig.max_rules = MAX_RULES;\n+\tconfig.number_tbl8s = NUMBER_TBL8S;\n+\tconfig.flags = 0;\n+\n+\tlpm = rte_lpm_create(__func__, SOCKET_ID_ANY, &config);\n+\tTEST_LPM_ASSERT(lpm != NULL);\n+\n+\trte_lpm_free(lpm);\n+\trte_lpm_free(NULL);\n+\treturn PASS;\n+}\n+\n+/*\n+ * Check that rte_lpm_add fails gracefully for incorrect user input arguments\n+ */\n+int32_t\n+test3(void)\n+{\n+\tstruct rte_lpm *lpm = NULL;\n+\tstruct rte_lpm_config config;\n+\n+\tconfig.max_rules = MAX_RULES;\n+\tconfig.number_tbl8s = NUMBER_TBL8S;\n+\tconfig.flags = 0;\n+\tuint32_t ip = IPv4(0, 0, 0, 0), next_hop = 100;\n+\tuint8_t depth = 24;\n+\tint32_t status = 0;\n+\n+\t/* rte_lpm_add: lpm == NULL */\n+\tstatus = rte_lpm_add(NULL, ip, depth, next_hop);\n+\tTEST_LPM_ASSERT(status < 0);\n+\n+\t/*Create vaild lpm to use in rest of test. */\n+\tlpm = rte_lpm_create(__func__, SOCKET_ID_ANY, &config);\n+\tTEST_LPM_ASSERT(lpm != NULL);\n+\n+\t/* rte_lpm_add: depth < 1 */\n+\tstatus = rte_lpm_add(lpm, ip, 0, next_hop);\n+\tTEST_LPM_ASSERT(status < 0);\n+\n+\t/* rte_lpm_add: depth > MAX_DEPTH */\n+\tstatus = rte_lpm_add(lpm, ip, (MAX_DEPTH + 1), next_hop);\n+\tTEST_LPM_ASSERT(status < 0);\n+\n+\trte_lpm_free(lpm);\n+\n+\treturn PASS;\n+}\n+\n+/*\n+ * Check that rte_lpm_delete fails gracefully for incorrect user input\n+ * arguments\n+ */\n+int32_t\n+test4(void)\n+{\n+\tstruct rte_lpm *lpm = NULL;\n+\tstruct rte_lpm_config config;\n+\n+\tconfig.max_rules = MAX_RULES;\n+\tconfig.number_tbl8s = NUMBER_TBL8S;\n+\tconfig.flags = 0;\n+\tuint32_t ip = IPv4(0, 0, 0, 0);\n+\tuint8_t depth = 24;\n+\tint32_t status = 0;\n+\n+\t/* rte_lpm_delete: lpm == NULL */\n+\tstatus = rte_lpm_delete(NULL, ip, depth);\n+\tTEST_LPM_ASSERT(status < 0);\n+\n+\t/*Create vaild lpm to use in rest of test. */\n+\tlpm = rte_lpm_create(__func__, SOCKET_ID_ANY, &config);\n+\tTEST_LPM_ASSERT(lpm != NULL);\n+\n+\t/* rte_lpm_delete: depth < 1 */\n+\tstatus = rte_lpm_delete(lpm, ip, 0);\n+\tTEST_LPM_ASSERT(status < 0);\n+\n+\t/* rte_lpm_delete: depth > MAX_DEPTH */\n+\tstatus = rte_lpm_delete(lpm, ip, (MAX_DEPTH + 1));\n+\tTEST_LPM_ASSERT(status < 0);\n+\n+\trte_lpm_free(lpm);\n+\n+\treturn PASS;\n+}\n+\n+/*\n+ * Check that rte_lpm_lookup fails gracefully for incorrect user input\n+ * arguments\n+ */\n+int32_t\n+test5(void)\n+{\n+#if defined(RTE_LIBRTE_LPM_DEBUG)\n+\tstruct rte_lpm *lpm = NULL;\n+\tstruct rte_lpm_config config;\n+\n+\tconfig.max_rules = MAX_RULES;\n+\tconfig.number_tbl8s = NUMBER_TBL8S;\n+\tconfig.flags = 0;\n+\tuint32_t ip = IPv4(0, 0, 0, 0), next_hop_return = 0;\n+\tint32_t status = 0;\n+\n+\t/* rte_lpm_lookup: lpm == NULL */\n+\tstatus = rte_lpm_lookup(NULL, ip, &next_hop_return);\n+\tTEST_LPM_ASSERT(status < 0);\n+\n+\t/*Create vaild lpm to use in rest of test. */\n+\tlpm = rte_lpm_create(__func__, SOCKET_ID_ANY, &config);\n+\tTEST_LPM_ASSERT(lpm != NULL);\n+\n+\t/* rte_lpm_lookup: depth < 1 */\n+\tstatus = rte_lpm_lookup(lpm, ip, NULL);\n+\tTEST_LPM_ASSERT(status < 0);\n+\n+\trte_lpm_free(lpm);\n+#endif\n+\treturn PASS;\n+}\n+\n+\n+\n+/*\n+ * Call add, lookup and delete for a single rule with depth <= 24\n+ */\n+int32_t\n+test6(void)\n+{\n+\tstruct rte_lpm *lpm = NULL;\n+\tstruct rte_lpm_config config;\n+\n+\tconfig.max_rules = MAX_RULES;\n+\tconfig.number_tbl8s = NUMBER_TBL8S;\n+\tconfig.flags = 0;\n+\tuint32_t ip = IPv4(0, 0, 0, 0), next_hop_add = 100, next_hop_return = 0;\n+\tuint8_t depth = 24;\n+\tint32_t status = 0;\n+\n+\tlpm = rte_lpm_create(__func__, SOCKET_ID_ANY, &config);\n+\tTEST_LPM_ASSERT(lpm != NULL);\n+\n+\tstatus = rte_lpm_add(lpm, ip, depth, next_hop_add);\n+\tTEST_LPM_ASSERT(status == 0);\n+\n+\tstatus = rte_lpm_lookup(lpm, ip, &next_hop_return);\n+\tTEST_LPM_ASSERT((status == 0) && (next_hop_return == next_hop_add));\n+\n+\tstatus = rte_lpm_delete(lpm, ip, depth);\n+\tTEST_LPM_ASSERT(status == 0);\n+\n+\tstatus = rte_lpm_lookup(lpm, ip, &next_hop_return);\n+\tTEST_LPM_ASSERT(status == -ENOENT);\n+\n+\trte_lpm_free(lpm);\n+\n+\treturn PASS;\n+}\n+\n+/*\n+ * Call add, lookup and delete for a single rule with depth > 24\n+ */\n+\n+int32_t\n+test7(void)\n+{\n+\txmm_t ipx4;\n+\tuint32_t hop[4];\n+\tstruct rte_lpm *lpm = NULL;\n+\tstruct rte_lpm_config config;\n+\n+\tconfig.max_rules = MAX_RULES;\n+\tconfig.number_tbl8s = NUMBER_TBL8S;\n+\tconfig.flags = 0;\n+\tuint32_t ip = IPv4(0, 0, 0, 0), next_hop_add = 100, next_hop_return = 0;\n+\tuint8_t depth = 32;\n+\tint32_t status = 0;\n+\n+\tlpm = rte_lpm_create(__func__, SOCKET_ID_ANY, &config);\n+\tTEST_LPM_ASSERT(lpm != NULL);\n+\n+\tstatus = rte_lpm_add(lpm, ip, depth, next_hop_add);\n+\tTEST_LPM_ASSERT(status == 0);\n+\n+\tstatus = rte_lpm_lookup(lpm, ip, &next_hop_return);\n+\tTEST_LPM_ASSERT((status == 0) && (next_hop_return == next_hop_add));\n+\n+\tipx4 = vect_set_epi32(ip, ip + 0x100, ip - 0x100, ip);\n+\trte_lpm_lookupx4(lpm, ipx4, hop, UINT32_MAX);\n+\tTEST_LPM_ASSERT(hop[0] == next_hop_add);\n+\tTEST_LPM_ASSERT(hop[1] == UINT32_MAX);\n+\tTEST_LPM_ASSERT(hop[2] == UINT32_MAX);\n+\tTEST_LPM_ASSERT(hop[3] == next_hop_add);\n+\n+\tstatus = rte_lpm_delete(lpm, ip, depth);\n+\tTEST_LPM_ASSERT(status == 0);\n+\n+\tstatus = rte_lpm_lookup(lpm, ip, &next_hop_return);\n+\tTEST_LPM_ASSERT(status == -ENOENT);\n+\n+\trte_lpm_free(lpm);\n+\n+\treturn PASS;\n+}\n+\n+/*\n+ * Use rte_lpm_add to add rules which effect only the second half of the lpm\n+ * table. Use all possible depths ranging from 1..32. Set the next hop = to the\n+ * depth. Check lookup hit for on every add and check for lookup miss on the\n+ * first half of the lpm table after each add. Finally delete all rules going\n+ * backwards (i.e. from depth = 32 ..1) and carry out a lookup after each\n+ * delete. The lookup should return the next_hop_add value related to the\n+ * previous depth value (i.e. depth -1).\n+ */\n+int32_t\n+test8(void)\n+{\n+\txmm_t ipx4;\n+\tuint32_t hop[4];\n+\tstruct rte_lpm *lpm = NULL;\n+\tstruct rte_lpm_config config;\n+\n+\tconfig.max_rules = MAX_RULES;\n+\tconfig.number_tbl8s = NUMBER_TBL8S;\n+\tconfig.flags = 0;\n+\tuint32_t ip1 = IPv4(127, 255, 255, 255), ip2 = IPv4(128, 0, 0, 0);\n+\tuint32_t next_hop_add, next_hop_return;\n+\tuint8_t depth;\n+\tint32_t status = 0;\n+\n+\tlpm = rte_lpm_create(__func__, SOCKET_ID_ANY, &config);\n+\tTEST_LPM_ASSERT(lpm != NULL);\n+\n+\t/* Loop with rte_lpm_add. */\n+\tfor (depth = 1; depth <= 32; depth++) {\n+\t\t/* Let the next_hop_add value = depth. Just for change. */\n+\t\tnext_hop_add = depth;\n+\n+\t\tstatus = rte_lpm_add(lpm, ip2, depth, next_hop_add);\n+\t\tTEST_LPM_ASSERT(status == 0);\n+\n+\t\t/* Check IP in first half of tbl24 which should be empty. */\n+\t\tstatus = rte_lpm_lookup(lpm, ip1, &next_hop_return);\n+\t\tTEST_LPM_ASSERT(status == -ENOENT);\n+\n+\t\tstatus = rte_lpm_lookup(lpm, ip2, &next_hop_return);\n+\t\tTEST_LPM_ASSERT((status == 0) &&\n+\t\t\t(next_hop_return == next_hop_add));\n+\n+\t\tipx4 = vect_set_epi32(ip2, ip1, ip2, ip1);\n+\t\trte_lpm_lookupx4(lpm, ipx4, hop, UINT32_MAX);\n+\t\tTEST_LPM_ASSERT(hop[0] == UINT32_MAX);\n+\t\tTEST_LPM_ASSERT(hop[1] == next_hop_add);\n+\t\tTEST_LPM_ASSERT(hop[2] == UINT32_MAX);\n+\t\tTEST_LPM_ASSERT(hop[3] == next_hop_add);\n+\t}\n+\n+\t/* Loop with rte_lpm_delete. */\n+\tfor (depth = 32; depth >= 1; depth--) {\n+\t\tnext_hop_add = (uint8_t) (depth - 1);\n+\n+\t\tstatus = rte_lpm_delete(lpm, ip2, depth);\n+\t\tTEST_LPM_ASSERT(status == 0);\n+\n+\t\tstatus = rte_lpm_lookup(lpm, ip2, &next_hop_return);\n+\n+\t\tif (depth != 1) {\n+\t\t\tTEST_LPM_ASSERT((status == 0) &&\n+\t\t\t\t(next_hop_return == next_hop_add));\n+\t\t} else {\n+\t\t\tTEST_LPM_ASSERT(status == -ENOENT);\n+\t\t}\n+\n+\t\tstatus = rte_lpm_lookup(lpm, ip1, &next_hop_return);\n+\t\tTEST_LPM_ASSERT(status == -ENOENT);\n+\n+\t\tipx4 = vect_set_epi32(ip1, ip1, ip2, ip2);\n+\t\trte_lpm_lookupx4(lpm, ipx4, hop, UINT32_MAX);\n+\t\tif (depth != 1) {\n+\t\t\tTEST_LPM_ASSERT(hop[0] == next_hop_add);\n+\t\t\tTEST_LPM_ASSERT(hop[1] == next_hop_add);\n+\t\t} else {\n+\t\t\tTEST_LPM_ASSERT(hop[0] == UINT32_MAX);\n+\t\t\tTEST_LPM_ASSERT(hop[1] == UINT32_MAX);\n+\t\t}\n+\t\tTEST_LPM_ASSERT(hop[2] == UINT32_MAX);\n+\t\tTEST_LPM_ASSERT(hop[3] == UINT32_MAX);\n+\t}\n+\n+\trte_lpm_free(lpm);\n+\n+\treturn PASS;\n+}\n+\n+/*\n+ * - Add & lookup to hit invalid TBL24 entry\n+ * - Add & lookup to hit valid TBL24 entry not extended\n+ * - Add & lookup to hit valid extended TBL24 entry with invalid TBL8 entry\n+ * - Add & lookup to hit valid extended TBL24 entry with valid TBL8 entry\n+ *\n+ */\n+int32_t\n+test9(void)\n+{\n+\tstruct rte_lpm *lpm = NULL;\n+\tstruct rte_lpm_config config;\n+\n+\tconfig.max_rules = MAX_RULES;\n+\tconfig.number_tbl8s = NUMBER_TBL8S;\n+\tconfig.flags = 0;\n+\tuint32_t ip, ip_1, ip_2;\n+\tuint8_t depth, depth_1, depth_2;\n+\tuint32_t next_hop_add, next_hop_add_1, next_hop_add_2, next_hop_return;\n+\tint32_t status = 0;\n+\n+\t/* Add & lookup to hit invalid TBL24 entry */\n+\tip = IPv4(128, 0, 0, 0);\n+\tdepth = 24;\n+\tnext_hop_add = 100;\n+\n+\tlpm = rte_lpm_create(__func__, SOCKET_ID_ANY, &config);\n+\tTEST_LPM_ASSERT(lpm != NULL);\n+\n+\tstatus = rte_lpm_add(lpm, ip, depth, next_hop_add);\n+\tTEST_LPM_ASSERT(status == 0);\n+\n+\tstatus = rte_lpm_lookup(lpm, ip, &next_hop_return);\n+\tTEST_LPM_ASSERT((status == 0) && (next_hop_return == next_hop_add));\n+\n+\tstatus = rte_lpm_delete(lpm, ip, depth);\n+\tTEST_LPM_ASSERT(status == 0);\n+\n+\tstatus = rte_lpm_lookup(lpm, ip, &next_hop_return);\n+\tTEST_LPM_ASSERT(status == -ENOENT);\n+\n+\trte_lpm_delete_all(lpm);\n+\n+\t/* Add & lookup to hit valid TBL24 entry not extended */\n+\tip = IPv4(128, 0, 0, 0);\n+\tdepth = 23;\n+\tnext_hop_add = 100;\n+\n+\tstatus = rte_lpm_add(lpm, ip, depth, next_hop_add);\n+\tTEST_LPM_ASSERT(status == 0);\n+\n+\tstatus = rte_lpm_lookup(lpm, ip, &next_hop_return);\n+\tTEST_LPM_ASSERT((status == 0) && (next_hop_return == next_hop_add));\n+\n+\tdepth = 24;\n+\tnext_hop_add = 101;\n+\n+\tstatus = rte_lpm_add(lpm, ip, depth, next_hop_add);\n+\tTEST_LPM_ASSERT(status == 0);\n+\n+\tstatus = rte_lpm_lookup(lpm, ip, &next_hop_return);\n+\tTEST_LPM_ASSERT((status == 0) && (next_hop_return == next_hop_add));\n+\n+\tdepth = 24;\n+\n+\tstatus = rte_lpm_delete(lpm, ip, depth);\n+\tTEST_LPM_ASSERT(status == 0);\n+\n+\tdepth = 23;\n+\n+\tstatus = rte_lpm_delete(lpm, ip, depth);\n+\tTEST_LPM_ASSERT(status == 0);\n+\n+\tstatus = rte_lpm_lookup(lpm, ip, &next_hop_return);\n+\tTEST_LPM_ASSERT(status == -ENOENT);\n+\n+\trte_lpm_delete_all(lpm);\n+\n+\t/* Add & lookup to hit valid extended TBL24 entry with invalid TBL8\n+\t * entry */\n+\tip = IPv4(128, 0, 0, 0);\n+\tdepth = 32;\n+\tnext_hop_add = 100;\n+\n+\tstatus = rte_lpm_add(lpm, ip, depth, next_hop_add);\n+\tTEST_LPM_ASSERT(status == 0);\n+\n+\tstatus = rte_lpm_lookup(lpm, ip, &next_hop_return);\n+\tTEST_LPM_ASSERT((status == 0) && (next_hop_return == next_hop_add));\n+\n+\tip = IPv4(128, 0, 0, 5);\n+\tdepth = 32;\n+\tnext_hop_add = 101;\n+\n+\tstatus = rte_lpm_add(lpm, ip, depth, next_hop_add);\n+\tTEST_LPM_ASSERT(status == 0);\n+\n+\tstatus = rte_lpm_lookup(lpm, ip, &next_hop_return);\n+\tTEST_LPM_ASSERT((status == 0) && (next_hop_return == next_hop_add));\n+\n+\tstatus = rte_lpm_delete(lpm, ip, depth);\n+\tTEST_LPM_ASSERT(status == 0);\n+\n+\tstatus = rte_lpm_lookup(lpm, ip, &next_hop_return);\n+\tTEST_LPM_ASSERT(status == -ENOENT);\n+\n+\tip = IPv4(128, 0, 0, 0);\n+\tdepth = 32;\n+\tnext_hop_add = 100;\n+\n+\tstatus = rte_lpm_lookup(lpm, ip, &next_hop_return);\n+\tTEST_LPM_ASSERT((status == 0) && (next_hop_return == next_hop_add));\n+\n+\tstatus = rte_lpm_delete(lpm, ip, depth);\n+\tTEST_LPM_ASSERT(status == 0);\n+\n+\tstatus = rte_lpm_lookup(lpm, ip, &next_hop_return);\n+\tTEST_LPM_ASSERT(status == -ENOENT);\n+\n+\trte_lpm_delete_all(lpm);\n+\n+\t/* Add & lookup to hit valid extended TBL24 entry with valid TBL8\n+\t * entry */\n+\tip_1 = IPv4(128, 0, 0, 0);\n+\tdepth_1 = 25;\n+\tnext_hop_add_1 = 101;\n+\n+\tip_2 = IPv4(128, 0, 0, 5);\n+\tdepth_2 = 32;\n+\tnext_hop_add_2 = 102;\n+\n+\tnext_hop_return = 0;\n+\n+\tstatus = rte_lpm_add(lpm, ip_1, depth_1, next_hop_add_1);\n+\tTEST_LPM_ASSERT(status == 0);\n+\n+\tstatus = rte_lpm_lookup(lpm, ip_1, &next_hop_return);\n+\tTEST_LPM_ASSERT((status == 0) && (next_hop_return == next_hop_add_1));\n+\n+\tstatus = rte_lpm_add(lpm, ip_2, depth_2, next_hop_add_2);\n+\tTEST_LPM_ASSERT(status == 0);\n+\n+\tstatus = rte_lpm_lookup(lpm, ip_2, &next_hop_return);\n+\tTEST_LPM_ASSERT((status == 0) && (next_hop_return == next_hop_add_2));\n+\n+\tstatus = rte_lpm_delete(lpm, ip_2, depth_2);\n+\tTEST_LPM_ASSERT(status == 0);\n+\n+\tstatus = rte_lpm_lookup(lpm, ip_2, &next_hop_return);\n+\tTEST_LPM_ASSERT((status == 0) && (next_hop_return == next_hop_add_1));\n+\n+\tstatus = rte_lpm_delete(lpm, ip_1, depth_1);\n+\tTEST_LPM_ASSERT(status == 0);\n+\n+\tstatus = rte_lpm_lookup(lpm, ip_1, &next_hop_return);\n+\tTEST_LPM_ASSERT(status == -ENOENT);\n+\n+\trte_lpm_free(lpm);\n+\n+\treturn PASS;\n+}\n+\n+\n+/*\n+ * - Add rule that covers a TBL24 range previously invalid & lookup (& delete &\n+ *   lookup)\n+ * - Add rule that extends a TBL24 invalid entry & lookup (& delete & lookup)\n+ * - Add rule that extends a TBL24 valid entry & lookup for both rules (&\n+ *   delete & lookup)\n+ * - Add rule that updates the next hop in TBL24 & lookup (& delete & lookup)\n+ * - Add rule that updates the next hop in TBL8 & lookup (& delete & lookup)\n+ * - Delete a rule that is not present in the TBL24 & lookup\n+ * - Delete a rule that is not present in the TBL8 & lookup\n+ *\n+ */\n+int32_t\n+test10(void)\n+{\n+\n+\tstruct rte_lpm *lpm = NULL;\n+\tstruct rte_lpm_config config;\n+\n+\tconfig.max_rules = MAX_RULES;\n+\tconfig.number_tbl8s = NUMBER_TBL8S;\n+\tconfig.flags = 0;\n+\tuint32_t ip, next_hop_add, next_hop_return;\n+\tuint8_t depth;\n+\tint32_t status = 0;\n+\n+\t/* Add rule that covers a TBL24 range previously invalid & lookup\n+\t * (& delete & lookup) */\n+\tlpm = rte_lpm_create(__func__, SOCKET_ID_ANY, &config);\n+\tTEST_LPM_ASSERT(lpm != NULL);\n+\n+\tip = IPv4(128, 0, 0, 0);\n+\tdepth = 16;\n+\tnext_hop_add = 100;\n+\n+\tstatus = rte_lpm_add(lpm, ip, depth, next_hop_add);\n+\tTEST_LPM_ASSERT(status == 0);\n+\n+\tstatus = rte_lpm_lookup(lpm, ip, &next_hop_return);\n+\tTEST_LPM_ASSERT((status == 0) && (next_hop_return == next_hop_add));\n+\n+\tstatus = rte_lpm_delete(lpm, ip, depth);\n+\tTEST_LPM_ASSERT(status == 0);\n+\n+\tstatus = rte_lpm_lookup(lpm, ip, &next_hop_return);\n+\tTEST_LPM_ASSERT(status == -ENOENT);\n+\n+\trte_lpm_delete_all(lpm);\n+\n+\tip = IPv4(128, 0, 0, 0);\n+\tdepth = 25;\n+\tnext_hop_add = 100;\n+\n+\tstatus = rte_lpm_add(lpm, ip, depth, next_hop_add);\n+\tTEST_LPM_ASSERT(status == 0);\n+\n+\tstatus = rte_lpm_lookup(lpm, ip, &next_hop_return);\n+\tTEST_LPM_ASSERT((status == 0) && (next_hop_return == next_hop_add));\n+\n+\tstatus = rte_lpm_delete(lpm, ip, depth);\n+\tTEST_LPM_ASSERT(status == 0);\n+\n+\trte_lpm_delete_all(lpm);\n+\n+\t/* Add rule that extends a TBL24 valid entry & lookup for both rules\n+\t * (& delete & lookup) */\n+\n+\tip = IPv4(128, 0, 0, 0);\n+\tdepth = 24;\n+\tnext_hop_add = 100;\n+\n+\tstatus = rte_lpm_add(lpm, ip, depth, next_hop_add);\n+\tTEST_LPM_ASSERT(status == 0);\n+\n+\tip = IPv4(128, 0, 0, 10);\n+\tdepth = 32;\n+\tnext_hop_add = 101;\n+\n+\tstatus = rte_lpm_add(lpm, ip, depth, next_hop_add);\n+\tTEST_LPM_ASSERT(status == 0);\n+\n+\tstatus = rte_lpm_lookup(lpm, ip, &next_hop_return);\n+\tTEST_LPM_ASSERT((status == 0) && (next_hop_return == next_hop_add));\n+\n+\tip = IPv4(128, 0, 0, 0);\n+\tnext_hop_add = 100;\n+\n+\tstatus = rte_lpm_lookup(lpm, ip, &next_hop_return);\n+\tTEST_LPM_ASSERT((status == 0) && (next_hop_return == next_hop_add));\n+\n+\tip = IPv4(128, 0, 0, 0);\n+\tdepth = 24;\n+\n+\tstatus = rte_lpm_delete(lpm, ip, depth);\n+\tTEST_LPM_ASSERT(status == 0);\n+\n+\tstatus = rte_lpm_lookup(lpm, ip, &next_hop_return);\n+\tTEST_LPM_ASSERT(status == -ENOENT);\n+\n+\tip = IPv4(128, 0, 0, 10);\n+\tdepth = 32;\n+\n+\tstatus = rte_lpm_delete(lpm, ip, depth);\n+\tTEST_LPM_ASSERT(status == 0);\n+\n+\tstatus = rte_lpm_lookup(lpm, ip, &next_hop_return);\n+\tTEST_LPM_ASSERT(status == -ENOENT);\n+\n+\trte_lpm_delete_all(lpm);\n+\n+\t/* Add rule that updates the next hop in TBL24 & lookup\n+\t * (& delete & lookup) */\n+\n+\tip = IPv4(128, 0, 0, 0);\n+\tdepth = 24;\n+\tnext_hop_add = 100;\n+\n+\tstatus = rte_lpm_add(lpm, ip, depth, next_hop_add);\n+\tTEST_LPM_ASSERT(status == 0);\n+\n+\tstatus = rte_lpm_lookup(lpm, ip, &next_hop_return);\n+\tTEST_LPM_ASSERT((status == 0) && (next_hop_return == next_hop_add));\n+\n+\tnext_hop_add = 101;\n+\n+\tstatus = rte_lpm_add(lpm, ip, depth, next_hop_add);\n+\tTEST_LPM_ASSERT(status == 0);\n+\n+\tstatus = rte_lpm_lookup(lpm, ip, &next_hop_return);\n+\tTEST_LPM_ASSERT((status == 0) && (next_hop_return == next_hop_add));\n+\n+\tstatus = rte_lpm_delete(lpm, ip, depth);\n+\tTEST_LPM_ASSERT(status == 0);\n+\n+\tstatus = rte_lpm_lookup(lpm, ip, &next_hop_return);\n+\tTEST_LPM_ASSERT(status == -ENOENT);\n+\n+\trte_lpm_delete_all(lpm);\n+\n+\t/* Add rule that updates the next hop in TBL8 & lookup\n+\t * (& delete & lookup) */\n+\n+\tip = IPv4(128, 0, 0, 0);\n+\tdepth = 32;\n+\tnext_hop_add = 100;\n+\n+\tstatus = rte_lpm_add(lpm, ip, depth, next_hop_add);\n+\tTEST_LPM_ASSERT(status == 0);\n+\n+\tstatus = rte_lpm_lookup(lpm, ip, &next_hop_return);\n+\tTEST_LPM_ASSERT((status == 0) && (next_hop_return == next_hop_add));\n+\n+\tnext_hop_add = 101;\n+\n+\tstatus = rte_lpm_add(lpm, ip, depth, next_hop_add);\n+\tTEST_LPM_ASSERT(status == 0);\n+\n+\tstatus = rte_lpm_lookup(lpm, ip, &next_hop_return);\n+\tTEST_LPM_ASSERT((status == 0) && (next_hop_return == next_hop_add));\n+\n+\tstatus = rte_lpm_delete(lpm, ip, depth);\n+\tTEST_LPM_ASSERT(status == 0);\n+\n+\tstatus = rte_lpm_lookup(lpm, ip, &next_hop_return);\n+\tTEST_LPM_ASSERT(status == -ENOENT);\n+\n+\trte_lpm_delete_all(lpm);\n+\n+\t/* Delete a rule that is not present in the TBL24 & lookup */\n+\n+\tip = IPv4(128, 0, 0, 0);\n+\tdepth = 24;\n+\n+\tstatus = rte_lpm_delete(lpm, ip, depth);\n+\tTEST_LPM_ASSERT(status < 0);\n+\n+\tstatus = rte_lpm_lookup(lpm, ip, &next_hop_return);\n+\tTEST_LPM_ASSERT(status == -ENOENT);\n+\n+\trte_lpm_delete_all(lpm);\n+\n+\t/* Delete a rule that is not present in the TBL8 & lookup */\n+\n+\tip = IPv4(128, 0, 0, 0);\n+\tdepth = 32;\n+\n+\tstatus = rte_lpm_delete(lpm, ip, depth);\n+\tTEST_LPM_ASSERT(status < 0);\n+\n+\tstatus = rte_lpm_lookup(lpm, ip, &next_hop_return);\n+\tTEST_LPM_ASSERT(status == -ENOENT);\n+\n+\trte_lpm_free(lpm);\n+\n+\treturn PASS;\n+}\n+\n+/*\n+ * Add two rules, lookup to hit the more specific one, lookup to hit the less\n+ * specific one delete the less specific rule and lookup previous values again;\n+ * add a more specific rule than the existing rule, lookup again\n+ *\n+ * */\n+int32_t\n+test11(void)\n+{\n+\n+\tstruct rte_lpm *lpm = NULL;\n+\tstruct rte_lpm_config config;\n+\n+\tconfig.max_rules = MAX_RULES;\n+\tconfig.number_tbl8s = NUMBER_TBL8S;\n+\tconfig.flags = 0;\n+\tuint32_t ip, next_hop_add, next_hop_return;\n+\tuint8_t depth;\n+\tint32_t status = 0;\n+\n+\tlpm = rte_lpm_create(__func__, SOCKET_ID_ANY, &config);\n+\tTEST_LPM_ASSERT(lpm != NULL);\n+\n+\tip = IPv4(128, 0, 0, 0);\n+\tdepth = 24;\n+\tnext_hop_add = 100;\n+\n+\tstatus = rte_lpm_add(lpm, ip, depth, next_hop_add);\n+\tTEST_LPM_ASSERT(status == 0);\n+\n+\tip = IPv4(128, 0, 0, 10);\n+\tdepth = 32;\n+\tnext_hop_add = 101;\n+\n+\tstatus = rte_lpm_add(lpm, ip, depth, next_hop_add);\n+\tTEST_LPM_ASSERT(status == 0);\n+\n+\tstatus = rte_lpm_lookup(lpm, ip, &next_hop_return);\n+\tTEST_LPM_ASSERT((status == 0) && (next_hop_return == next_hop_add));\n+\n+\tip = IPv4(128, 0, 0, 0);\n+\tnext_hop_add = 100;\n+\n+\tstatus = rte_lpm_lookup(lpm, ip, &next_hop_return);\n+\tTEST_LPM_ASSERT((status == 0) && (next_hop_return == next_hop_add));\n+\n+\tip = IPv4(128, 0, 0, 0);\n+\tdepth = 24;\n+\n+\tstatus = rte_lpm_delete(lpm, ip, depth);\n+\tTEST_LPM_ASSERT(status == 0);\n+\n+\tstatus = rte_lpm_lookup(lpm, ip, &next_hop_return);\n+\tTEST_LPM_ASSERT(status == -ENOENT);\n+\n+\tip = IPv4(128, 0, 0, 10);\n+\tdepth = 32;\n+\n+\tstatus = rte_lpm_delete(lpm, ip, depth);\n+\tTEST_LPM_ASSERT(status == 0);\n+\n+\tstatus = rte_lpm_lookup(lpm, ip, &next_hop_return);\n+\tTEST_LPM_ASSERT(status == -ENOENT);\n+\n+\trte_lpm_free(lpm);\n+\n+\treturn PASS;\n+}\n+\n+/*\n+ * Add an extended rule (i.e. depth greater than 24, lookup (hit), delete,\n+ * lookup (miss) in a for loop of 1000 times. This will check tbl8 extension\n+ * and contraction.\n+ *\n+ * */\n+\n+int32_t\n+test12(void)\n+{\n+\txmm_t ipx4;\n+\tuint32_t hop[4];\n+\tstruct rte_lpm *lpm = NULL;\n+\tstruct rte_lpm_config config;\n+\n+\tconfig.max_rules = MAX_RULES;\n+\tconfig.number_tbl8s = NUMBER_TBL8S;\n+\tconfig.flags = 0;\n+\tuint32_t ip, i, next_hop_add, next_hop_return;\n+\tuint8_t depth;\n+\tint32_t status = 0;\n+\n+\tlpm = rte_lpm_create(__func__, SOCKET_ID_ANY, &config);\n+\tTEST_LPM_ASSERT(lpm != NULL);\n+\n+\tip = IPv4(128, 0, 0, 0);\n+\tdepth = 32;\n+\tnext_hop_add = 100;\n+\n+\tfor (i = 0; i < 1000; i++) {\n+\t\tstatus = rte_lpm_add(lpm, ip, depth, next_hop_add);\n+\t\tTEST_LPM_ASSERT(status == 0);\n+\n+\t\tstatus = rte_lpm_lookup(lpm, ip, &next_hop_return);\n+\t\tTEST_LPM_ASSERT((status == 0) &&\n+\t\t\t\t(next_hop_return == next_hop_add));\n+\n+\t\tipx4 = vect_set_epi32(ip, ip + 1, ip, ip - 1);\n+\t\trte_lpm_lookupx4(lpm, ipx4, hop, UINT32_MAX);\n+\t\tTEST_LPM_ASSERT(hop[0] == UINT32_MAX);\n+\t\tTEST_LPM_ASSERT(hop[1] == next_hop_add);\n+\t\tTEST_LPM_ASSERT(hop[2] == UINT32_MAX);\n+\t\tTEST_LPM_ASSERT(hop[3] == next_hop_add);\n+\n+\t\tstatus = rte_lpm_delete(lpm, ip, depth);\n+\t\tTEST_LPM_ASSERT(status == 0);\n+\n+\t\tstatus = rte_lpm_lookup(lpm, ip, &next_hop_return);\n+\t\tTEST_LPM_ASSERT(status == -ENOENT);\n+\t}\n+\n+\trte_lpm_free(lpm);\n+\n+\treturn PASS;\n+}\n+\n+/*\n+ * Add a rule to tbl24, lookup (hit), then add a rule that will extend this\n+ * tbl24 entry, lookup (hit). delete the rule that caused the tbl24 extension,\n+ * lookup (miss) and repeat for loop of 1000 times. This will check tbl8\n+ * extension and contraction.\n+ *\n+ * */\n+\n+int32_t\n+test13(void)\n+{\n+\tstruct rte_lpm *lpm = NULL;\n+\tstruct rte_lpm_config config;\n+\n+\tconfig.max_rules = MAX_RULES;\n+\tconfig.number_tbl8s = NUMBER_TBL8S;\n+\tconfig.flags = 0;\n+\tuint32_t ip, i, next_hop_add_1, next_hop_add_2, next_hop_return;\n+\tuint8_t depth;\n+\tint32_t status = 0;\n+\n+\tlpm = rte_lpm_create(__func__, SOCKET_ID_ANY, &config);\n+\tTEST_LPM_ASSERT(lpm != NULL);\n+\n+\tip = IPv4(128, 0, 0, 0);\n+\tdepth = 24;\n+\tnext_hop_add_1 = 100;\n+\n+\tstatus = rte_lpm_add(lpm, ip, depth, next_hop_add_1);\n+\tTEST_LPM_ASSERT(status == 0);\n+\n+\tstatus = rte_lpm_lookup(lpm, ip, &next_hop_return);\n+\tTEST_LPM_ASSERT((status == 0) && (next_hop_return == next_hop_add_1));\n+\n+\tdepth = 32;\n+\tnext_hop_add_2 = 101;\n+\n+\tfor (i = 0; i < 1000; i++) {\n+\t\tstatus = rte_lpm_add(lpm, ip, depth, next_hop_add_2);\n+\t\tTEST_LPM_ASSERT(status == 0);\n+\n+\t\tstatus = rte_lpm_lookup(lpm, ip, &next_hop_return);\n+\t\tTEST_LPM_ASSERT((status == 0) &&\n+\t\t\t\t(next_hop_return == next_hop_add_2));\n+\n+\t\tstatus = rte_lpm_delete(lpm, ip, depth);\n+\t\tTEST_LPM_ASSERT(status == 0);\n+\n+\t\tstatus = rte_lpm_lookup(lpm, ip, &next_hop_return);\n+\t\tTEST_LPM_ASSERT((status == 0) &&\n+\t\t\t\t(next_hop_return == next_hop_add_1));\n+\t}\n+\n+\tdepth = 24;\n+\n+\tstatus = rte_lpm_delete(lpm, ip, depth);\n+\tTEST_LPM_ASSERT(status == 0);\n+\n+\tstatus = rte_lpm_lookup(lpm, ip, &next_hop_return);\n+\tTEST_LPM_ASSERT(status == -ENOENT);\n+\n+\trte_lpm_free(lpm);\n+\n+\treturn PASS;\n+}\n+\n+/*\n+ * Fore TBL8 extension exhaustion. Add 256 rules that require a tbl8 extension.\n+ * No more tbl8 extensions will be allowed. Now add one more rule that required\n+ * a tbl8 extension and get fail.\n+ * */\n+int32_t\n+test14(void)\n+{\n+\n+\t/* We only use depth = 32 in the loop below so we must make sure\n+\t * that we have enough storage for all rules at that depth*/\n+\n+\tstruct rte_lpm *lpm = NULL;\n+\tstruct rte_lpm_config config;\n+\n+\tconfig.max_rules = 256 * 32;\n+\tconfig.number_tbl8s = NUMBER_TBL8S;\n+\tconfig.flags = 0;\n+\tuint32_t ip, next_hop_add, next_hop_return;\n+\tuint8_t depth;\n+\tint32_t status = 0;\n+\n+\t/* Add enough space for 256 rules for every depth */\n+\tlpm = rte_lpm_create(__func__, SOCKET_ID_ANY, &config);\n+\tTEST_LPM_ASSERT(lpm != NULL);\n+\n+\tdepth = 32;\n+\tnext_hop_add = 100;\n+\tip = IPv4(0, 0, 0, 0);\n+\n+\t/* Add 256 rules that require a tbl8 extension */\n+\tfor (; ip <= IPv4(0, 0, 255, 0); ip += 256) {\n+\t\tstatus = rte_lpm_add(lpm, ip, depth, next_hop_add);\n+\t\tTEST_LPM_ASSERT(status == 0);\n+\n+\t\tstatus = rte_lpm_lookup(lpm, ip, &next_hop_return);\n+\t\tTEST_LPM_ASSERT((status == 0) &&\n+\t\t\t\t(next_hop_return == next_hop_add));\n+\t}\n+\n+\t/* All tbl8 extensions have been used above. Try to add one more and\n+\t * we get a fail */\n+\tip = IPv4(1, 0, 0, 0);\n+\tdepth = 32;\n+\n+\tstatus = rte_lpm_add(lpm, ip, depth, next_hop_add);\n+\tTEST_LPM_ASSERT(status < 0);\n+\n+\trte_lpm_free(lpm);\n+\n+\treturn PASS;\n+}\n+\n+/*\n+ * Sequence of operations for find existing lpm table\n+ *\n+ *  - create table\n+ *  - find existing table: hit\n+ *  - find non-existing table: miss\n+ *\n+ */\n+int32_t\n+test15(void)\n+{\n+\tstruct rte_lpm *lpm = NULL, *result = NULL;\n+\tstruct rte_lpm_config config;\n+\n+\tconfig.max_rules = 256 * 32;\n+\tconfig.number_tbl8s = NUMBER_TBL8S;\n+\tconfig.flags = 0;\n+\n+\t/* Create lpm  */\n+\tlpm = rte_lpm_create(\"lpm_find_existing\", SOCKET_ID_ANY, &config);\n+\tTEST_LPM_ASSERT(lpm != NULL);\n+\n+\t/* Try to find existing lpm */\n+\tresult = rte_lpm_find_existing(\"lpm_find_existing\");\n+\tTEST_LPM_ASSERT(result == lpm);\n+\n+\t/* Try to find non-existing lpm */\n+\tresult = rte_lpm_find_existing(\"lpm_find_non_existing\");\n+\tTEST_LPM_ASSERT(result == NULL);\n+\n+\t/* Cleanup. */\n+\trte_lpm_delete_all(lpm);\n+\trte_lpm_free(lpm);\n+\n+\treturn PASS;\n+}\n+\n+/*\n+ * test failure condition of overloading the tbl8 so no more will fit\n+ * Check we get an error return value in that case\n+ */\n+int32_t\n+test16(void)\n+{\n+\tuint32_t ip;\n+\tstruct rte_lpm_config config;\n+\n+\tconfig.max_rules = 256 * 32;\n+\tconfig.number_tbl8s = NUMBER_TBL8S;\n+\tconfig.flags = 0;\n+\tstruct rte_lpm *lpm = rte_lpm_create(__func__, SOCKET_ID_ANY, &config);\n+\n+\t/* ip loops through all possibilities for top 24 bits of address */\n+\tfor (ip = 0; ip < 0xFFFFFF; ip++) {\n+\t\t/* add an entry within a different tbl8 each time, since\n+\t\t * depth >24 and the top 24 bits are different */\n+\t\tif (rte_lpm_add(lpm, (ip << 8) + 0xF0, 30, 0) < 0)\n+\t\t\tbreak;\n+\t}\n+\n+\tif (ip != NUMBER_TBL8S) {\n+\t\tprintf(\"Error, unexpected failure with filling tbl8 groups\\n\");\n+\t\tprintf(\"Failed after %u additions, expected after %u\\n\",\n+\t\t\t\t(unsigned)ip, (unsigned)NUMBER_TBL8S);\n+\t}\n+\n+\trte_lpm_free(lpm);\n+\treturn 0;\n+}\n+\n+/*\n+ * Test for overwriting of tbl8:\n+ *  - add rule /32 and lookup\n+ *  - add new rule /24 and lookup\n+ *\t- add third rule /25 and lookup\n+ *\t- lookup /32 and /24 rule to ensure the table has not been overwritten.\n+ */\n+int32_t\n+test17(void)\n+{\n+\tstruct rte_lpm *lpm = NULL;\n+\tstruct rte_lpm_config config;\n+\n+\tconfig.max_rules = MAX_RULES;\n+\tconfig.number_tbl8s = NUMBER_TBL8S;\n+\tconfig.flags = 0;\n+\tconst uint32_t ip_10_32 = IPv4(10, 10, 10, 2);\n+\tconst uint32_t ip_10_24 = IPv4(10, 10, 10, 0);\n+\tconst uint32_t ip_20_25 = IPv4(10, 10, 20, 2);\n+\tconst uint8_t d_ip_10_32 = 32,\n+\t\t\td_ip_10_24 = 24,\n+\t\t\td_ip_20_25 = 25;\n+\tconst uint32_t next_hop_ip_10_32 = 100,\n+\t\t\tnext_hop_ip_10_24 = 105,\n+\t\t\tnext_hop_ip_20_25 = 111;\n+\tuint32_t next_hop_return = 0;\n+\tint32_t status = 0;\n+\n+\tlpm = rte_lpm_create(__func__, SOCKET_ID_ANY, &config);\n+\tTEST_LPM_ASSERT(lpm != NULL);\n+\n+\tstatus = rte_lpm_add(lpm, ip_10_32, d_ip_10_32, next_hop_ip_10_32);\n+\tif (status < 0)\n+\t\treturn -1;\n+\n+\tstatus = rte_lpm_lookup(lpm, ip_10_32, &next_hop_return);\n+\tuint32_t test_hop_10_32 = next_hop_return;\n+\tTEST_LPM_ASSERT(status == 0);\n+\tTEST_LPM_ASSERT(next_hop_return == next_hop_ip_10_32);\n+\n+\tstatus = rte_lpm_add(lpm, ip_10_24, d_ip_10_24, next_hop_ip_10_24);\n+\tif (status < 0)\n+\t\treturn -1;\n+\n+\tstatus = rte_lpm_lookup(lpm, ip_10_24, &next_hop_return);\n+\tuint32_t test_hop_10_24 = next_hop_return;\n+\tTEST_LPM_ASSERT(status == 0);\n+\tTEST_LPM_ASSERT(next_hop_return == next_hop_ip_10_24);\n+\n+\tstatus = rte_lpm_add(lpm, ip_20_25, d_ip_20_25, next_hop_ip_20_25);\n+\tif (status < 0)\n+\t\treturn -1;\n+\n+\tstatus = rte_lpm_lookup(lpm, ip_20_25, &next_hop_return);\n+\tuint32_t test_hop_20_25 = next_hop_return;\n+\tTEST_LPM_ASSERT(status == 0);\n+\tTEST_LPM_ASSERT(next_hop_return == next_hop_ip_20_25);\n+\n+\tif (test_hop_10_32 == test_hop_10_24) {\n+\t\tprintf(\"Next hop return equal\\n\");\n+\t\treturn -1;\n+\t}\n+\n+\tif (test_hop_10_24 == test_hop_20_25) {\n+\t\tprintf(\"Next hop return equal\\n\");\n+\t\treturn -1;\n+\t}\n+\n+\tstatus = rte_lpm_lookup(lpm, ip_10_32, &next_hop_return);\n+\tTEST_LPM_ASSERT(status == 0);\n+\tTEST_LPM_ASSERT(next_hop_return == next_hop_ip_10_32);\n+\n+\tstatus = rte_lpm_lookup(lpm, ip_10_24, &next_hop_return);\n+\tTEST_LPM_ASSERT(status == 0);\n+\tTEST_LPM_ASSERT(next_hop_return == next_hop_ip_10_24);\n+\n+\trte_lpm_free(lpm);\n+\n+\treturn PASS;\n+}\n+\n+/*\n+ * Lookup performance test\n+ */\n+\n+#define ITERATIONS (1 << 10)\n+#define BATCH_SIZE (1 << 12)\n+#define BULK_SIZE 32\n+\n+int32_t\n+perf_test(void)\n+{\n+\tstruct rte_lpm *lpm = NULL;\n+\tstruct rte_lpm_config config;\n+\n+\tconfig.max_rules = 1000000;\n+\tconfig.number_tbl8s = NUMBER_TBL8S;\n+\tconfig.flags = 0;\n+\tuint64_t begin, total_time, lpm_used_entries = 0;\n+\tunsigned i, j;\n+\tuint32_t next_hop_add = 0xAA, next_hop_return = 0;\n+\tint status = 0;\n+\tuint64_t cache_line_counter = 0;\n+\tint64_t count = 0;\n+\n+\trte_srand(rte_rdtsc());\n+\n+\t/* (re) generate the routing table */\n+\tgenerate_large_route_rule_table();\n+\n+\tprintf(\"No. routes = %u\\n\", (unsigned) NUM_ROUTE_ENTRIES);\n+\n+\tprint_route_distribution(large_route_table,\n+\t\t\t\t(uint32_t) NUM_ROUTE_ENTRIES);\n+\n+\tlpm = rte_lpm_create(__func__, SOCKET_ID_ANY, &config);\n+\tTEST_LPM_ASSERT(lpm != NULL);\n+\n+\t/* Measue add. */\n+\tbegin = rte_rdtsc();\n+\n+\tfor (i = 0; i < NUM_ROUTE_ENTRIES; i++) {\n+\t\tif (rte_lpm_add(lpm, large_route_table[i].ip,\n+\t\t\t\tlarge_route_table[i].depth, next_hop_add) == 0)\n+\t\t\tstatus++;\n+\t}\n+\t/* End Timer. */\n+\ttotal_time = rte_rdtsc() - begin;\n+\n+\tprintf(\"Unique added entries = %d\\n\", status);\n+\t/* Obtain add statistics. */\n+\tfor (i = 0; i < RTE_LPM_TBL24_NUM_ENTRIES; i++) {\n+\t\tif (lpm->tbl24[i].valid)\n+\t\t\tlpm_used_entries++;\n+\n+\t\tif (i % 32 == 0) {\n+\t\t\tif ((uint64_t)count < lpm_used_entries) {\n+\t\t\t\tcache_line_counter++;\n+\t\t\t\tcount = lpm_used_entries;\n+\t\t\t}\n+\t\t}\n+\t}\n+\n+\tprintf(\"Used table 24 entries = %u (%g%%)\\n\",\n+\t\t\t(unsigned) lpm_used_entries,\n+\t\t\t(lpm_used_entries * 100.0) / RTE_LPM_TBL24_NUM_ENTRIES);\n+\tprintf(\"64 byte Cache entries used = %u (%u bytes)\\n\",\n+\t\t\t(unsigned) cache_line_counter, (unsigned) cache_line_counter * 64);\n+\n+\tprintf(\"Average LPM Add: %g cycles\\n\",\n+\t\t\t(double)total_time / NUM_ROUTE_ENTRIES);\n+\n+\t/* Measure single Lookup */\n+\ttotal_time = 0;\n+\tcount = 0;\n+\n+\tfor (i = 0; i < ITERATIONS; i++) {\n+\t\tstatic uint32_t ip_batch[BATCH_SIZE];\n+\n+\t\tfor (j = 0; j < BATCH_SIZE; j++)\n+\t\t\tip_batch[j] = rte_rand();\n+\n+\t\t/* Lookup per batch */\n+\t\tbegin = rte_rdtsc();\n+\n+\t\tfor (j = 0; j < BATCH_SIZE; j++) {\n+\t\t\tif (rte_lpm_lookup(lpm, ip_batch[j], &next_hop_return) != 0)\n+\t\t\t\tcount++;\n+\t\t}\n+\n+\t\ttotal_time += rte_rdtsc() - begin;\n+\n+\t}\n+\tprintf(\"Average LPM Lookup: %.1f cycles (fails = %.1f%%)\\n\",\n+\t\t\t(double)total_time / ((double)ITERATIONS * BATCH_SIZE),\n+\t\t\t(count * 100.0) / (double)(ITERATIONS * BATCH_SIZE));\n+\n+\t/* Measure bulk Lookup */\n+\ttotal_time = 0;\n+\tcount = 0;\n+\tfor (i = 0; i < ITERATIONS; i++) {\n+\t\tstatic uint32_t ip_batch[BATCH_SIZE];\n+\t\tuint32_t next_hops[BULK_SIZE];\n+\n+\t\t/* Create array of random IP addresses */\n+\t\tfor (j = 0; j < BATCH_SIZE; j++)\n+\t\t\tip_batch[j] = rte_rand();\n+\n+\t\t/* Lookup per batch */\n+\t\tbegin = rte_rdtsc();\n+\t\tfor (j = 0; j < BATCH_SIZE; j += BULK_SIZE) {\n+\t\t\tunsigned k;\n+\t\t\trte_lpm_lookup_bulk(lpm, &ip_batch[j], next_hops, BULK_SIZE);\n+\t\t\tfor (k = 0; k < BULK_SIZE; k++)\n+\t\t\t\tif (unlikely(!(next_hops[k] & RTE_LPM_LOOKUP_SUCCESS)))\n+\t\t\t\t\tcount++;\n+\t\t}\n+\n+\t\ttotal_time += rte_rdtsc() - begin;\n+\t}\n+\tprintf(\"BULK LPM Lookup: %.1f cycles (fails = %.1f%%)\\n\",\n+\t\t\t(double)total_time / ((double)ITERATIONS * BATCH_SIZE),\n+\t\t\t(count * 100.0) / (double)(ITERATIONS * BATCH_SIZE));\n+\n+\t/* Measure LookupX4 */\n+\ttotal_time = 0;\n+\tcount = 0;\n+\tfor (i = 0; i < ITERATIONS; i++) {\n+\t\tstatic uint32_t ip_batch[BATCH_SIZE];\n+\t\tuint32_t next_hops[4];\n+\n+\t\t/* Create array of random IP addresses */\n+\t\tfor (j = 0; j < BATCH_SIZE; j++)\n+\t\t\tip_batch[j] = rte_rand();\n+\n+\t\t/* Lookup per batch */\n+\t\tbegin = rte_rdtsc();\n+\t\tfor (j = 0; j < BATCH_SIZE; j += RTE_DIM(next_hops)) {\n+\t\t\tunsigned k;\n+\t\t\txmm_t ipx4;\n+\n+\t\t\tipx4 = vect_loadu_sil128((xmm_t *)(ip_batch + j));\n+\t\t\tipx4 = *(xmm_t *)(ip_batch + j);\n+\t\t\trte_lpm_lookupx4(lpm, ipx4, next_hops, UINT32_MAX);\n+\t\t\tfor (k = 0; k < RTE_DIM(next_hops); k++)\n+\t\t\t\tif (unlikely(next_hops[k] == UINT32_MAX))\n+\t\t\t\t\tcount++;\n+\t\t}\n+\n+\t\ttotal_time += rte_rdtsc() - begin;\n+\t}\n+\tprintf(\"LPM LookupX4: %.1f cycles (fails = %.1f%%)\\n\",\n+\t\t\t(double)total_time / ((double)ITERATIONS * BATCH_SIZE),\n+\t\t\t(count * 100.0) / (double)(ITERATIONS * BATCH_SIZE));\n+\n+\t/* Delete */\n+\tstatus = 0;\n+\tbegin = rte_rdtsc();\n+\n+\tfor (i = 0; i < NUM_ROUTE_ENTRIES; i++) {\n+\t\t/* rte_lpm_delete(lpm, ip, depth) */\n+\t\tstatus += rte_lpm_delete(lpm, large_route_table[i].ip,\n+\t\t\t\tlarge_route_table[i].depth);\n+\t}\n+\n+\ttotal_time += rte_rdtsc() - begin;\n+\n+\tprintf(\"Average LPM Delete: %g cycles\\n\",\n+\t\t\t(double)total_time / NUM_ROUTE_ENTRIES);\n+\n+\trte_lpm_delete_all(lpm);\n+\trte_lpm_free(lpm);\n+\n+\treturn PASS;\n+}\n+\n+/*\n+ * Do all unit and performance tests.\n+ */\n+\n+static int\n+test_lpm(void)\n+{\n+\tunsigned i;\n+\tint status, global_status = 0;\n+\n+\tfor (i = 0; i < NUM_LPM_TESTS; i++) {\n+\t\tstatus = tests[i]();\n+\t\tif (status < 0) {\n+\t\t\tprintf(\"ERROR: LPM Test %s: FAIL\\n\", RTE_STR(tests[i]));\n+\t\t\tglobal_status = status;\n+\t\t}\n+\t}\n+\n+\treturn global_status;\n+}\n+\n+REGISTER_TEST_COMMAND_VERSION(lpm_autotest, test_lpm, TEST_DPDK_ABI_VERSION_V1604);\ndiff --git a/app/test/v16.04/test_v1604.c b/app/test/v16.04/test_v1604.c\nnew file mode 100644\nindex 000000000..a5399bbfe\n--- /dev/null\n+++ b/app/test/v16.04/test_v1604.c\n@@ -0,0 +1,14 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ * Copyright(c) 2010-2014 Intel Corporation\n+ */\n+\n+#include <stdio.h>\n+#include <stdint.h>\n+#include <stdlib.h>\n+\n+#include <rte_ip.h>\n+#include <rte_lpm.h>\n+\n+#include \"../test.h\"\n+\n+REGISTER_TEST_ABI_VERSION(v1604, TEST_DPDK_ABI_VERSION_V1604);\ndiff --git a/app/test/v2.0/dcompat.h b/app/test/v2.0/dcompat.h\nnew file mode 100644\nindex 000000000..108fcf8f6\n--- /dev/null\n+++ b/app/test/v2.0/dcompat.h\n@@ -0,0 +1,23 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ * Copyright(c) 2010-2019 Intel Corporation\n+ */\n+\n+#ifndef _DCOMPAT_H_\n+#define _DCOMPAT_H_\n+\n+#define ABI_VERSION DPDK_2.0\n+\n+#define MAP_ABI_SYMBOL(name) \\\n+\tMAP_ABI_SYMBOL_VERSION(name, ABI_VERSION)\n+\n+MAP_ABI_SYMBOL(rte_lpm_add);\n+MAP_ABI_SYMBOL(rte_lpm_create);\n+MAP_ABI_SYMBOL(rte_lpm_delete);\n+MAP_ABI_SYMBOL(rte_lpm_delete_all);\n+MAP_ABI_SYMBOL(rte_lpm_find_existing);\n+MAP_ABI_SYMBOL(rte_lpm_free);\n+MAP_ABI_SYMBOL(rte_lpm_is_rule_present);\n+\n+#undef MAP_ABI_SYMBOL\n+\n+#endif\ndiff --git a/app/test/v2.0/rte_lpm.h b/app/test/v2.0/rte_lpm.h\nnew file mode 100644\nindex 000000000..b1efd1c2d\n--- /dev/null\n+++ b/app/test/v2.0/rte_lpm.h\n@@ -0,0 +1,443 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ * Copyright(c) 2010-2014 Intel Corporation\n+ */\n+\n+#ifndef _RTE_LPM_H_\n+#define _RTE_LPM_H_\n+\n+/**\n+ * @file\n+ * RTE Longest Prefix Match (LPM)\n+ */\n+\n+#include <errno.h>\n+#include <sys/queue.h>\n+#include <stdint.h>\n+#include <stdlib.h>\n+#include <rte_branch_prediction.h>\n+#include <rte_memory.h>\n+#include <rte_common.h>\n+#include <rte_vect.h>\n+\n+#ifdef __cplusplus\n+extern \"C\" {\n+#endif\n+\n+/** Max number of characters in LPM name. */\n+#define RTE_LPM_NAMESIZE                32\n+\n+/** @deprecated Possible location to allocate memory. This was for last\n+ * parameter of rte_lpm_create(), but is now redundant. The LPM table is always\n+ * allocated in memory using librte_malloc which uses a memzone. */\n+#define RTE_LPM_HEAP                    0\n+\n+/** @deprecated Possible location to allocate memory. This was for last\n+ * parameter of rte_lpm_create(), but is now redundant. The LPM table is always\n+ * allocated in memory using librte_malloc which uses a memzone. */\n+#define RTE_LPM_MEMZONE                 1\n+\n+/** Maximum depth value possible for IPv4 LPM. */\n+#define RTE_LPM_MAX_DEPTH               32\n+\n+/** @internal Total number of tbl24 entries. */\n+#define RTE_LPM_TBL24_NUM_ENTRIES       (1 << 24)\n+\n+/** @internal Number of entries in a tbl8 group. */\n+#define RTE_LPM_TBL8_GROUP_NUM_ENTRIES  256\n+\n+/** @internal Total number of tbl8 groups in the tbl8. */\n+#define RTE_LPM_TBL8_NUM_GROUPS         256\n+\n+/** @internal Total number of tbl8 entries. */\n+#define RTE_LPM_TBL8_NUM_ENTRIES        (RTE_LPM_TBL8_NUM_GROUPS * \\\n+\t\t\t\t\tRTE_LPM_TBL8_GROUP_NUM_ENTRIES)\n+\n+/** @internal Macro to enable/disable run-time checks. */\n+#if defined(RTE_LIBRTE_LPM_DEBUG)\n+#define RTE_LPM_RETURN_IF_TRUE(cond, retval) do { \\\n+\tif (cond) \\\n+\t\treturn (retval); \\\n+} while (0)\n+#else\n+#define RTE_LPM_RETURN_IF_TRUE(cond, retval)\n+#endif\n+\n+/** @internal bitmask with valid and ext_entry/valid_group fields set */\n+#define RTE_LPM_VALID_EXT_ENTRY_BITMASK 0x0300\n+\n+/** Bitmask used to indicate successful lookup */\n+#define RTE_LPM_LOOKUP_SUCCESS          0x0100\n+\n+/** @internal Tbl24 entry structure. */\n+struct rte_lpm_tbl24_entry {\n+\t/* Stores Next hop or group index (i.e. gindex)into tbl8. */\n+\tunion {\n+\t\tuint8_t next_hop;\n+\t\tuint8_t tbl8_gindex;\n+\t};\n+\t/* Using single uint8_t to store 3 values. */\n+\tuint8_t valid     :1; /**< Validation flag. */\n+\tuint8_t ext_entry :1; /**< External entry. */\n+\tuint8_t depth     :6; /**< Rule depth. */\n+};\n+\n+/** @internal Tbl8 entry structure. */\n+struct rte_lpm_tbl8_entry {\n+\tuint8_t next_hop; /**< next hop. */\n+\t/* Using single uint8_t to store 3 values. */\n+\tuint8_t valid       :1; /**< Validation flag. */\n+\tuint8_t valid_group :1; /**< Group validation flag. */\n+\tuint8_t depth       :6; /**< Rule depth. */\n+};\n+\n+/** @internal Rule structure. */\n+struct rte_lpm_rule {\n+\tuint32_t ip; /**< Rule IP address. */\n+\tuint8_t  next_hop; /**< Rule next hop. */\n+};\n+\n+/** @internal Contains metadata about the rules table. */\n+struct rte_lpm_rule_info {\n+\tuint32_t used_rules; /**< Used rules so far. */\n+\tuint32_t first_rule; /**< Indexes the first rule of a given depth. */\n+};\n+\n+/** @internal LPM structure. */\n+struct rte_lpm {\n+\t/* LPM metadata. */\n+\tchar name[RTE_LPM_NAMESIZE];        /**< Name of the lpm. */\n+\tint mem_location; /**< @deprecated @see RTE_LPM_HEAP and RTE_LPM_MEMZONE. */\n+\tuint32_t max_rules; /**< Max. balanced rules per lpm. */\n+\tstruct rte_lpm_rule_info rule_info[RTE_LPM_MAX_DEPTH]; /**< Rule info table. */\n+\n+\t/* LPM Tables. */\n+\tstruct rte_lpm_tbl24_entry tbl24[RTE_LPM_TBL24_NUM_ENTRIES] \\\n+\t\t\t__rte_cache_aligned; /**< LPM tbl24 table. */\n+\tstruct rte_lpm_tbl8_entry tbl8[RTE_LPM_TBL8_NUM_ENTRIES] \\\n+\t\t\t__rte_cache_aligned; /**< LPM tbl8 table. */\n+\tstruct rte_lpm_rule rules_tbl[0] \\\n+\t\t\t__rte_cache_aligned; /**< LPM rules. */\n+};\n+\n+/**\n+ * Create an LPM object.\n+ *\n+ * @param name\n+ *   LPM object name\n+ * @param socket_id\n+ *   NUMA socket ID for LPM table memory allocation\n+ * @param max_rules\n+ *   Maximum number of LPM rules that can be added\n+ * @param flags\n+ *   This parameter is currently unused\n+ * @return\n+ *   Handle to LPM object on success, NULL otherwise with rte_errno set\n+ *   to an appropriate values. Possible rte_errno values include:\n+ *    - E_RTE_NO_CONFIG - function could not get pointer to rte_config structure\n+ *    - E_RTE_SECONDARY - function was called from a secondary process instance\n+ *    - EINVAL - invalid parameter passed to function\n+ *    - ENOSPC - the maximum number of memzones has already been allocated\n+ *    - EEXIST - a memzone with the same name already exists\n+ *    - ENOMEM - no appropriate memory area found in which to create memzone\n+ */\n+struct rte_lpm *\n+rte_lpm_create(const char *name, int socket_id, int max_rules, int flags);\n+\n+/**\n+ * Find an existing LPM object and return a pointer to it.\n+ *\n+ * @param name\n+ *   Name of the lpm object as passed to rte_lpm_create()\n+ * @return\n+ *   Pointer to lpm object or NULL if object not found with rte_errno\n+ *   set appropriately. Possible rte_errno values include:\n+ *    - ENOENT - required entry not available to return.\n+ */\n+struct rte_lpm *\n+rte_lpm_find_existing(const char *name);\n+\n+/**\n+ * Free an LPM object.\n+ *\n+ * @param lpm\n+ *   LPM object handle\n+ * @return\n+ *   None\n+ */\n+void\n+rte_lpm_free(struct rte_lpm *lpm);\n+\n+/**\n+ * Add a rule to the LPM table.\n+ *\n+ * @param lpm\n+ *   LPM object handle\n+ * @param ip\n+ *   IP of the rule to be added to the LPM table\n+ * @param depth\n+ *   Depth of the rule to be added to the LPM table\n+ * @param next_hop\n+ *   Next hop of the rule to be added to the LPM table\n+ * @return\n+ *   0 on success, negative value otherwise\n+ */\n+int\n+rte_lpm_add(struct rte_lpm *lpm, uint32_t ip, uint8_t depth, uint8_t next_hop);\n+\n+/**\n+ * Check if a rule is present in the LPM table,\n+ * and provide its next hop if it is.\n+ *\n+ * @param lpm\n+ *   LPM object handle\n+ * @param ip\n+ *   IP of the rule to be searched\n+ * @param depth\n+ *   Depth of the rule to searched\n+ * @param next_hop\n+ *   Next hop of the rule (valid only if it is found)\n+ * @return\n+ *   1 if the rule exists, 0 if it does not, a negative value on failure\n+ */\n+int\n+rte_lpm_is_rule_present(struct rte_lpm *lpm, uint32_t ip, uint8_t depth,\n+uint8_t *next_hop);\n+\n+/**\n+ * Delete a rule from the LPM table.\n+ *\n+ * @param lpm\n+ *   LPM object handle\n+ * @param ip\n+ *   IP of the rule to be deleted from the LPM table\n+ * @param depth\n+ *   Depth of the rule to be deleted from the LPM table\n+ * @return\n+ *   0 on success, negative value otherwise\n+ */\n+int\n+rte_lpm_delete(struct rte_lpm *lpm, uint32_t ip, uint8_t depth);\n+\n+/**\n+ * Delete all rules from the LPM table.\n+ *\n+ * @param lpm\n+ *   LPM object handle\n+ */\n+void\n+rte_lpm_delete_all(struct rte_lpm *lpm);\n+\n+/**\n+ * Lookup an IP into the LPM table.\n+ *\n+ * @param lpm\n+ *   LPM object handle\n+ * @param ip\n+ *   IP to be looked up in the LPM table\n+ * @param next_hop\n+ *   Next hop of the most specific rule found for IP (valid on lookup hit only)\n+ * @return\n+ *   -EINVAL for incorrect arguments, -ENOENT on lookup miss, 0 on lookup hit\n+ */\n+static inline int\n+rte_lpm_lookup(struct rte_lpm *lpm, uint32_t ip, uint8_t *next_hop)\n+{\n+\tunsigned tbl24_index = (ip >> 8);\n+\tuint16_t tbl_entry;\n+\n+\t/* DEBUG: Check user input arguments. */\n+\tRTE_LPM_RETURN_IF_TRUE(((lpm == NULL) || (next_hop == NULL)), -EINVAL);\n+\n+\t/* Copy tbl24 entry */\n+\ttbl_entry = *(const uint16_t *)&lpm->tbl24[tbl24_index];\n+\n+\t/* Copy tbl8 entry (only if needed) */\n+\tif (unlikely((tbl_entry & RTE_LPM_VALID_EXT_ENTRY_BITMASK) ==\n+\t\t\tRTE_LPM_VALID_EXT_ENTRY_BITMASK)) {\n+\n+\t\tunsigned tbl8_index = (uint8_t)ip +\n+\t\t\t\t((uint8_t)tbl_entry * RTE_LPM_TBL8_GROUP_NUM_ENTRIES);\n+\n+\t\ttbl_entry = *(const uint16_t *)&lpm->tbl8[tbl8_index];\n+\t}\n+\n+\t*next_hop = (uint8_t)tbl_entry;\n+\treturn (tbl_entry & RTE_LPM_LOOKUP_SUCCESS) ? 0 : -ENOENT;\n+}\n+\n+/**\n+ * Lookup multiple IP addresses in an LPM table. This may be implemented as a\n+ * macro, so the address of the function should not be used.\n+ *\n+ * @param lpm\n+ *   LPM object handle\n+ * @param ips\n+ *   Array of IPs to be looked up in the LPM table\n+ * @param next_hops\n+ *   Next hop of the most specific rule found for IP (valid on lookup hit only).\n+ *   This is an array of two byte values. The most significant byte in each\n+ *   value says whether the lookup was successful (bitmask\n+ *   RTE_LPM_LOOKUP_SUCCESS is set). The least significant byte is the\n+ *   actual next hop.\n+ * @param n\n+ *   Number of elements in ips (and next_hops) array to lookup. This should be a\n+ *   compile time constant, and divisible by 8 for best performance.\n+ *  @return\n+ *   -EINVAL for incorrect arguments, otherwise 0\n+ */\n+#define rte_lpm_lookup_bulk(lpm, ips, next_hops, n) \\\n+\t\trte_lpm_lookup_bulk_func(lpm, ips, next_hops, n)\n+\n+static inline int\n+rte_lpm_lookup_bulk_func(const struct rte_lpm *lpm, const uint32_t *ips,\n+\t\tuint16_t *next_hops, const unsigned n)\n+{\n+\tunsigned i;\n+\tunsigned tbl24_indexes[n];\n+\n+\t/* DEBUG: Check user input arguments. */\n+\tRTE_LPM_RETURN_IF_TRUE(((lpm == NULL) || (ips == NULL) ||\n+\t\t\t(next_hops == NULL)), -EINVAL);\n+\n+\tfor (i = 0; i < n; i++) {\n+\t\ttbl24_indexes[i] = ips[i] >> 8;\n+\t}\n+\n+\tfor (i = 0; i < n; i++) {\n+\t\t/* Simply copy tbl24 entry to output */\n+\t\tnext_hops[i] = *(const uint16_t *)&lpm->tbl24[tbl24_indexes[i]];\n+\n+\t\t/* Overwrite output with tbl8 entry if needed */\n+\t\tif (unlikely((next_hops[i] & RTE_LPM_VALID_EXT_ENTRY_BITMASK) ==\n+\t\t\t\tRTE_LPM_VALID_EXT_ENTRY_BITMASK)) {\n+\n+\t\t\tunsigned tbl8_index = (uint8_t)ips[i] +\n+\t\t\t\t\t((uint8_t)next_hops[i] *\n+\t\t\t\t\t RTE_LPM_TBL8_GROUP_NUM_ENTRIES);\n+\n+\t\t\tnext_hops[i] = *(const uint16_t *)&lpm->tbl8[tbl8_index];\n+\t\t}\n+\t}\n+\treturn 0;\n+}\n+\n+/* Mask four results. */\n+#define\t RTE_LPM_MASKX4_RES\tUINT64_C(0x00ff00ff00ff00ff)\n+\n+/**\n+ * Lookup four IP addresses in an LPM table.\n+ *\n+ * @param lpm\n+ *   LPM object handle\n+ * @param ip\n+ *   Four IPs to be looked up in the LPM table\n+ * @param hop\n+ *   Next hop of the most specific rule found for IP (valid on lookup hit only).\n+ *   This is an 4 elements array of two byte values.\n+ *   If the lookup was succesfull for the given IP, then least significant byte\n+ *   of the corresponding element is the  actual next hop and the most\n+ *   significant byte is zero.\n+ *   If the lookup for the given IP failed, then corresponding element would\n+ *   contain default value, see description of then next parameter.\n+ * @param defv\n+ *   Default value to populate into corresponding element of hop[] array,\n+ *   if lookup would fail.\n+ */\n+static inline void\n+rte_lpm_lookupx4(const struct rte_lpm *lpm, __m128i ip, uint16_t hop[4],\n+\tuint16_t defv)\n+{\n+\t__m128i i24;\n+\trte_xmm_t i8;\n+\tuint16_t tbl[4];\n+\tuint64_t idx, pt;\n+\n+\tconst __m128i mask8 =\n+\t\t_mm_set_epi32(UINT8_MAX, UINT8_MAX, UINT8_MAX, UINT8_MAX);\n+\n+\t/*\n+\t * RTE_LPM_VALID_EXT_ENTRY_BITMASK for 4 LPM entries\n+\t * as one 64-bit value (0x0300030003000300).\n+\t */\n+\tconst uint64_t mask_xv =\n+\t\t((uint64_t)RTE_LPM_VALID_EXT_ENTRY_BITMASK |\n+\t\t(uint64_t)RTE_LPM_VALID_EXT_ENTRY_BITMASK << 16 |\n+\t\t(uint64_t)RTE_LPM_VALID_EXT_ENTRY_BITMASK << 32 |\n+\t\t(uint64_t)RTE_LPM_VALID_EXT_ENTRY_BITMASK << 48);\n+\n+\t/*\n+\t * RTE_LPM_LOOKUP_SUCCESS for 4 LPM entries\n+\t * as one 64-bit value (0x0100010001000100).\n+\t */\n+\tconst uint64_t mask_v =\n+\t\t((uint64_t)RTE_LPM_LOOKUP_SUCCESS |\n+\t\t(uint64_t)RTE_LPM_LOOKUP_SUCCESS << 16 |\n+\t\t(uint64_t)RTE_LPM_LOOKUP_SUCCESS << 32 |\n+\t\t(uint64_t)RTE_LPM_LOOKUP_SUCCESS << 48);\n+\n+\t/* get 4 indexes for tbl24[]. */\n+\ti24 = _mm_srli_epi32(ip, CHAR_BIT);\n+\n+\t/* extract values from tbl24[] */\n+\tidx = _mm_cvtsi128_si64(i24);\n+\ti24 = _mm_srli_si128(i24, sizeof(uint64_t));\n+\n+\ttbl[0] = *(const uint16_t *)&lpm->tbl24[(uint32_t)idx];\n+\ttbl[1] = *(const uint16_t *)&lpm->tbl24[idx >> 32];\n+\n+\tidx = _mm_cvtsi128_si64(i24);\n+\n+\ttbl[2] = *(const uint16_t *)&lpm->tbl24[(uint32_t)idx];\n+\ttbl[3] = *(const uint16_t *)&lpm->tbl24[idx >> 32];\n+\n+\t/* get 4 indexes for tbl8[]. */\n+\ti8.x = _mm_and_si128(ip, mask8);\n+\n+\tpt = (uint64_t)tbl[0] |\n+\t\t(uint64_t)tbl[1] << 16 |\n+\t\t(uint64_t)tbl[2] << 32 |\n+\t\t(uint64_t)tbl[3] << 48;\n+\n+\t/* search successfully finished for all 4 IP addresses. */\n+\tif (likely((pt & mask_xv) == mask_v)) {\n+\t\tuintptr_t ph = (uintptr_t)hop;\n+\t\t*(uint64_t *)ph = pt & RTE_LPM_MASKX4_RES;\n+\t\treturn;\n+\t}\n+\n+\tif (unlikely((pt & RTE_LPM_VALID_EXT_ENTRY_BITMASK) ==\n+\t\t\tRTE_LPM_VALID_EXT_ENTRY_BITMASK)) {\n+\t\ti8.u32[0] = i8.u32[0] +\n+\t\t\t(uint8_t)tbl[0] * RTE_LPM_TBL8_GROUP_NUM_ENTRIES;\n+\t\ttbl[0] = *(const uint16_t *)&lpm->tbl8[i8.u32[0]];\n+\t}\n+\tif (unlikely((pt >> 16 & RTE_LPM_VALID_EXT_ENTRY_BITMASK) ==\n+\t\t\tRTE_LPM_VALID_EXT_ENTRY_BITMASK)) {\n+\t\ti8.u32[1] = i8.u32[1] +\n+\t\t\t(uint8_t)tbl[1] * RTE_LPM_TBL8_GROUP_NUM_ENTRIES;\n+\t\ttbl[1] = *(const uint16_t *)&lpm->tbl8[i8.u32[1]];\n+\t}\n+\tif (unlikely((pt >> 32 & RTE_LPM_VALID_EXT_ENTRY_BITMASK) ==\n+\t\t\tRTE_LPM_VALID_EXT_ENTRY_BITMASK)) {\n+\t\ti8.u32[2] = i8.u32[2] +\n+\t\t\t(uint8_t)tbl[2] * RTE_LPM_TBL8_GROUP_NUM_ENTRIES;\n+\t\ttbl[2] = *(const uint16_t *)&lpm->tbl8[i8.u32[2]];\n+\t}\n+\tif (unlikely((pt >> 48 & RTE_LPM_VALID_EXT_ENTRY_BITMASK) ==\n+\t\t\tRTE_LPM_VALID_EXT_ENTRY_BITMASK)) {\n+\t\ti8.u32[3] = i8.u32[3] +\n+\t\t\t(uint8_t)tbl[3] * RTE_LPM_TBL8_GROUP_NUM_ENTRIES;\n+\t\ttbl[3] = *(const uint16_t *)&lpm->tbl8[i8.u32[3]];\n+\t}\n+\n+\thop[0] = (tbl[0] & RTE_LPM_LOOKUP_SUCCESS) ? (uint8_t)tbl[0] : defv;\n+\thop[1] = (tbl[1] & RTE_LPM_LOOKUP_SUCCESS) ? (uint8_t)tbl[1] : defv;\n+\thop[2] = (tbl[2] & RTE_LPM_LOOKUP_SUCCESS) ? (uint8_t)tbl[2] : defv;\n+\thop[3] = (tbl[3] & RTE_LPM_LOOKUP_SUCCESS) ? (uint8_t)tbl[3] : defv;\n+}\n+\n+#ifdef __cplusplus\n+}\n+#endif\n+\n+#endif /* _RTE_LPM_H_ */\ndiff --git a/app/test/v2.0/test_lpm.c b/app/test/v2.0/test_lpm.c\nnew file mode 100644\nindex 000000000..e71d213ba\n--- /dev/null\n+++ b/app/test/v2.0/test_lpm.c\n@@ -0,0 +1,1306 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ * Copyright(c) 2010-2019 Intel Corporation\n+ *\n+ * LPM Autotests from DPDK v2.0 for abi compability testing.\n+ *\n+ */\n+\n+#include <stdio.h>\n+#include <stdint.h>\n+#include <stdlib.h>\n+#include <errno.h>\n+#include <sys/queue.h>\n+\n+#include <rte_common.h>\n+#include <rte_cycles.h>\n+#include <rte_memory.h>\n+#include <rte_random.h>\n+#include <rte_branch_prediction.h>\n+#include <rte_ip.h>\n+#include <time.h>\n+\n+#include \"../test_lpm_routes.h\"\n+#include \"../test.h\"\n+\n+/* remapping of DPDK v2.0 symbols */\n+#include \"dcompat.h\"\n+/* backported header from DPDK v2.0 */\n+#include \"rte_lpm.h\"\n+\n+#define TEST_LPM_ASSERT(cond) do {                                            \\\n+\tif (!(cond)) {                                                        \\\n+\t\tprintf(\"Error at line %d:\\n\", __LINE__);                      \\\n+\t\treturn -1;                                                    \\\n+\t}                                                                     \\\n+} while (0)\n+\n+typedef int32_t (*rte_lpm_test)(void);\n+\n+static int32_t test0(void);\n+static int32_t test1(void);\n+static int32_t test2(void);\n+static int32_t test3(void);\n+static int32_t test4(void);\n+static int32_t test5(void);\n+static int32_t test6(void);\n+static int32_t test7(void);\n+static int32_t test8(void);\n+static int32_t test9(void);\n+static int32_t test10(void);\n+static int32_t test11(void);\n+static int32_t test12(void);\n+static int32_t test13(void);\n+static int32_t test14(void);\n+static int32_t test15(void);\n+static int32_t test16(void);\n+static int32_t test17(void);\n+static int32_t perf_test(void);\n+\n+static rte_lpm_test tests[] = {\n+/* Test Cases */\n+\ttest0,\n+\ttest1,\n+\ttest2,\n+\ttest3,\n+\ttest4,\n+\ttest5,\n+\ttest6,\n+\ttest7,\n+\ttest8,\n+\ttest9,\n+\ttest10,\n+\ttest11,\n+\ttest12,\n+\ttest13,\n+\ttest14,\n+\ttest15,\n+\ttest16,\n+\ttest17,\n+\tperf_test,\n+};\n+\n+#define NUM_LPM_TESTS (sizeof(tests)/sizeof(tests[0]))\n+#define MAX_DEPTH 32\n+#define MAX_RULES 256\n+#define PASS 0\n+\n+/*\n+ * Check that rte_lpm_create fails gracefully for incorrect user input\n+ * arguments\n+ */\n+int32_t\n+test0(void)\n+{\n+\tstruct rte_lpm *lpm = NULL;\n+\n+\t/* rte_lpm_create: lpm name == NULL */\n+\tlpm = rte_lpm_create(NULL, SOCKET_ID_ANY, MAX_RULES, 0);\n+\tTEST_LPM_ASSERT(lpm == NULL);\n+\n+\t/* rte_lpm_create: max_rules = 0 */\n+\t/* Note: __func__ inserts the function name, in this case \"test0\". */\n+\tlpm = rte_lpm_create(__func__, SOCKET_ID_ANY, 0, 0);\n+\tTEST_LPM_ASSERT(lpm == NULL);\n+\n+\t/* socket_id < -1 is invalid */\n+\tlpm = rte_lpm_create(__func__, -2, MAX_RULES, 0);\n+\tTEST_LPM_ASSERT(lpm == NULL);\n+\n+\treturn PASS;\n+}\n+\n+/*\n+ * Create lpm table then delete lpm table 100 times\n+ * Use a slightly different rules size each time\n+ * */\n+int32_t\n+test1(void)\n+{\n+\tstruct rte_lpm *lpm = NULL;\n+\tint32_t i;\n+\n+\t/* rte_lpm_free: Free NULL */\n+\tfor (i = 0; i < 100; i++) {\n+\t\tlpm = rte_lpm_create(__func__, SOCKET_ID_ANY, MAX_RULES - i, 0);\n+\t\tTEST_LPM_ASSERT(lpm != NULL);\n+\n+\t\trte_lpm_free(lpm);\n+\t}\n+\n+\t/* Can not test free so return success */\n+\treturn PASS;\n+}\n+\n+/*\n+ * Call rte_lpm_free for NULL pointer user input. Note: free has no return and\n+ * therefore it is impossible to check for failure but this test is added to\n+ * increase function coverage metrics and to validate that freeing null does\n+ * not crash.\n+ */\n+int32_t\n+test2(void)\n+{\n+\tstruct rte_lpm *lpm = NULL;\n+\n+\tlpm = rte_lpm_create(__func__, SOCKET_ID_ANY, MAX_RULES, RTE_LPM_HEAP);\n+\tTEST_LPM_ASSERT(lpm != NULL);\n+\n+\trte_lpm_free(lpm);\n+\trte_lpm_free(NULL);\n+\treturn PASS;\n+}\n+\n+/*\n+ * Check that rte_lpm_add fails gracefully for incorrect user input arguments\n+ */\n+int32_t\n+test3(void)\n+{\n+\tstruct rte_lpm *lpm = NULL;\n+\tuint32_t ip = IPv4(0, 0, 0, 0);\n+\tuint8_t depth = 24, next_hop = 100;\n+\tint32_t status = 0;\n+\n+\t/* rte_lpm_add: lpm == NULL */\n+\tstatus = rte_lpm_add(NULL, ip, depth, next_hop);\n+\tTEST_LPM_ASSERT(status < 0);\n+\n+\t/*Create vaild lpm to use in rest of test. */\n+\tlpm = rte_lpm_create(__func__, SOCKET_ID_ANY, MAX_RULES, 0);\n+\tTEST_LPM_ASSERT(lpm != NULL);\n+\n+\t/* rte_lpm_add: depth < 1 */\n+\tstatus = rte_lpm_add(lpm, ip, 0, next_hop);\n+\tTEST_LPM_ASSERT(status < 0);\n+\n+\t/* rte_lpm_add: depth > MAX_DEPTH */\n+\tstatus = rte_lpm_add(lpm, ip, (MAX_DEPTH + 1), next_hop);\n+\tTEST_LPM_ASSERT(status < 0);\n+\n+\trte_lpm_free(lpm);\n+\n+\treturn PASS;\n+}\n+\n+/*\n+ * Check that rte_lpm_delete fails gracefully for incorrect user input\n+ * arguments\n+ */\n+int32_t\n+test4(void)\n+{\n+\tstruct rte_lpm *lpm = NULL;\n+\tuint32_t ip = IPv4(0, 0, 0, 0);\n+\tuint8_t depth = 24;\n+\tint32_t status = 0;\n+\n+\t/* rte_lpm_delete: lpm == NULL */\n+\tstatus = rte_lpm_delete(NULL, ip, depth);\n+\tTEST_LPM_ASSERT(status < 0);\n+\n+\t/*Create vaild lpm to use in rest of test. */\n+\tlpm = rte_lpm_create(__func__, SOCKET_ID_ANY, MAX_RULES, 0);\n+\tTEST_LPM_ASSERT(lpm != NULL);\n+\n+\t/* rte_lpm_delete: depth < 1 */\n+\tstatus = rte_lpm_delete(lpm, ip, 0);\n+\tTEST_LPM_ASSERT(status < 0);\n+\n+\t/* rte_lpm_delete: depth > MAX_DEPTH */\n+\tstatus = rte_lpm_delete(lpm, ip, (MAX_DEPTH + 1));\n+\tTEST_LPM_ASSERT(status < 0);\n+\n+\trte_lpm_free(lpm);\n+\n+\treturn PASS;\n+}\n+\n+/*\n+ * Check that rte_lpm_lookup fails gracefully for incorrect user input\n+ * arguments\n+ */\n+int32_t\n+test5(void)\n+{\n+#if defined(RTE_LIBRTE_LPM_DEBUG)\n+\tstruct rte_lpm *lpm = NULL;\n+\tuint32_t ip = IPv4(0, 0, 0, 0);\n+\tuint8_t next_hop_return = 0;\n+\tint32_t status = 0;\n+\n+\t/* rte_lpm_lookup: lpm == NULL */\n+\tstatus = rte_lpm_lookup(NULL, ip, &next_hop_return);\n+\tTEST_LPM_ASSERT(status < 0);\n+\n+\t/*Create vaild lpm to use in rest of test. */\n+\tlpm = rte_lpm_create(__func__, SOCKET_ID_ANY, MAX_RULES, 0);\n+\tTEST_LPM_ASSERT(lpm != NULL);\n+\n+\t/* rte_lpm_lookup: depth < 1 */\n+\tstatus = rte_lpm_lookup(lpm, ip, NULL);\n+\tTEST_LPM_ASSERT(status < 0);\n+\n+\trte_lpm_free(lpm);\n+#endif\n+\treturn PASS;\n+}\n+\n+\n+\n+/*\n+ * Call add, lookup and delete for a single rule with depth <= 24\n+ */\n+int32_t\n+test6(void)\n+{\n+\tstruct rte_lpm *lpm = NULL;\n+\tuint32_t ip = IPv4(0, 0, 0, 0);\n+\tuint8_t depth = 24, next_hop_add = 100, next_hop_return = 0;\n+\tint32_t status = 0;\n+\n+\tlpm = rte_lpm_create(__func__, SOCKET_ID_ANY, MAX_RULES, 0);\n+\tTEST_LPM_ASSERT(lpm != NULL);\n+\n+\tstatus = rte_lpm_add(lpm, ip, depth, next_hop_add);\n+\tTEST_LPM_ASSERT(status == 0);\n+\n+\tstatus = rte_lpm_lookup(lpm, ip, &next_hop_return);\n+\tTEST_LPM_ASSERT((status == 0) && (next_hop_return == next_hop_add));\n+\n+\tstatus = rte_lpm_delete(lpm, ip, depth);\n+\tTEST_LPM_ASSERT(status == 0);\n+\n+\tstatus = rte_lpm_lookup(lpm, ip, &next_hop_return);\n+\tTEST_LPM_ASSERT(status == -ENOENT);\n+\n+\trte_lpm_free(lpm);\n+\n+\treturn PASS;\n+}\n+\n+/*\n+ * Call add, lookup and delete for a single rule with depth > 24\n+ */\n+\n+int32_t\n+test7(void)\n+{\n+\t__m128i ipx4;\n+\tuint16_t hop[4];\n+\tstruct rte_lpm *lpm = NULL;\n+\tuint32_t ip = IPv4(0, 0, 0, 0);\n+\tuint8_t depth = 32, next_hop_add = 100, next_hop_return = 0;\n+\tint32_t status = 0;\n+\n+\tlpm = rte_lpm_create(__func__, SOCKET_ID_ANY, MAX_RULES, 0);\n+\tTEST_LPM_ASSERT(lpm != NULL);\n+\n+\tstatus = rte_lpm_add(lpm, ip, depth, next_hop_add);\n+\tTEST_LPM_ASSERT(status == 0);\n+\n+\tstatus = rte_lpm_lookup(lpm, ip, &next_hop_return);\n+\tTEST_LPM_ASSERT((status == 0) && (next_hop_return == next_hop_add));\n+\n+\tipx4 = _mm_set_epi32(ip, ip + 0x100, ip - 0x100, ip);\n+\trte_lpm_lookupx4(lpm, ipx4, hop, UINT16_MAX);\n+\tTEST_LPM_ASSERT(hop[0] == next_hop_add);\n+\tTEST_LPM_ASSERT(hop[1] == UINT16_MAX);\n+\tTEST_LPM_ASSERT(hop[2] == UINT16_MAX);\n+\tTEST_LPM_ASSERT(hop[3] == next_hop_add);\n+\n+\tstatus = rte_lpm_delete(lpm, ip, depth);\n+\tTEST_LPM_ASSERT(status == 0);\n+\n+\tstatus = rte_lpm_lookup(lpm, ip, &next_hop_return);\n+\tTEST_LPM_ASSERT(status == -ENOENT);\n+\n+\trte_lpm_free(lpm);\n+\n+\treturn PASS;\n+}\n+\n+/*\n+ * Use rte_lpm_add to add rules which effect only the second half of the lpm\n+ * table. Use all possible depths ranging from 1..32. Set the next hop = to the\n+ * depth. Check lookup hit for on every add and check for lookup miss on the\n+ * first half of the lpm table after each add. Finally delete all rules going\n+ * backwards (i.e. from depth = 32 ..1) and carry out a lookup after each\n+ * delete. The lookup should return the next_hop_add value related to the\n+ * previous depth value (i.e. depth -1).\n+ */\n+int32_t\n+test8(void)\n+{\n+\t__m128i ipx4;\n+\tuint16_t hop[4];\n+\tstruct rte_lpm *lpm = NULL;\n+\tuint32_t ip1 = IPv4(127, 255, 255, 255), ip2 = IPv4(128, 0, 0, 0);\n+\tuint8_t depth, next_hop_add, next_hop_return;\n+\tint32_t status = 0;\n+\n+\tlpm = rte_lpm_create(__func__, SOCKET_ID_ANY, MAX_RULES, 0);\n+\tTEST_LPM_ASSERT(lpm != NULL);\n+\n+\t/* Loop with rte_lpm_add. */\n+\tfor (depth = 1; depth <= 32; depth++) {\n+\t\t/* Let the next_hop_add value = depth. Just for change. */\n+\t\tnext_hop_add = depth;\n+\n+\t\tstatus = rte_lpm_add(lpm, ip2, depth, next_hop_add);\n+\t\tTEST_LPM_ASSERT(status == 0);\n+\n+\t\t/* Check IP in first half of tbl24 which should be empty. */\n+\t\tstatus = rte_lpm_lookup(lpm, ip1, &next_hop_return);\n+\t\tTEST_LPM_ASSERT(status == -ENOENT);\n+\n+\t\tstatus = rte_lpm_lookup(lpm, ip2, &next_hop_return);\n+\t\tTEST_LPM_ASSERT((status == 0) &&\n+\t\t\t(next_hop_return == next_hop_add));\n+\n+\t\tipx4 = _mm_set_epi32(ip2, ip1, ip2, ip1);\n+\t\trte_lpm_lookupx4(lpm, ipx4, hop, UINT16_MAX);\n+\t\tTEST_LPM_ASSERT(hop[0] == UINT16_MAX);\n+\t\tTEST_LPM_ASSERT(hop[1] == next_hop_add);\n+\t\tTEST_LPM_ASSERT(hop[2] == UINT16_MAX);\n+\t\tTEST_LPM_ASSERT(hop[3] == next_hop_add);\n+\t}\n+\n+\t/* Loop with rte_lpm_delete. */\n+\tfor (depth = 32; depth >= 1; depth--) {\n+\t\tnext_hop_add = (uint8_t) (depth - 1);\n+\n+\t\tstatus = rte_lpm_delete(lpm, ip2, depth);\n+\t\tTEST_LPM_ASSERT(status == 0);\n+\n+\t\tstatus = rte_lpm_lookup(lpm, ip2, &next_hop_return);\n+\n+\t\tif (depth != 1) {\n+\t\t\tTEST_LPM_ASSERT((status == 0) &&\n+\t\t\t\t(next_hop_return == next_hop_add));\n+\t\t} else {\n+\t\t\tTEST_LPM_ASSERT(status == -ENOENT);\n+\t\t}\n+\n+\t\tstatus = rte_lpm_lookup(lpm, ip1, &next_hop_return);\n+\t\tTEST_LPM_ASSERT(status == -ENOENT);\n+\n+\t\tipx4 = _mm_set_epi32(ip1, ip1, ip2, ip2);\n+\t\trte_lpm_lookupx4(lpm, ipx4, hop, UINT16_MAX);\n+\t\tif (depth != 1) {\n+\t\t\tTEST_LPM_ASSERT(hop[0] == next_hop_add);\n+\t\t\tTEST_LPM_ASSERT(hop[1] == next_hop_add);\n+\t\t} else {\n+\t\t\tTEST_LPM_ASSERT(hop[0] == UINT16_MAX);\n+\t\t\tTEST_LPM_ASSERT(hop[1] == UINT16_MAX);\n+\t\t}\n+\t\tTEST_LPM_ASSERT(hop[2] == UINT16_MAX);\n+\t\tTEST_LPM_ASSERT(hop[3] == UINT16_MAX);\n+\t}\n+\n+\trte_lpm_free(lpm);\n+\n+\treturn PASS;\n+}\n+\n+/*\n+ * - Add & lookup to hit invalid TBL24 entry\n+ * - Add & lookup to hit valid TBL24 entry not extended\n+ * - Add & lookup to hit valid extended TBL24 entry with invalid TBL8 entry\n+ * - Add & lookup to hit valid extended TBL24 entry with valid TBL8 entry\n+ *\n+ */\n+int32_t\n+test9(void)\n+{\n+\tstruct rte_lpm *lpm = NULL;\n+\tuint32_t ip, ip_1, ip_2;\n+\tuint8_t depth, depth_1, depth_2, next_hop_add, next_hop_add_1,\n+\t\tnext_hop_add_2, next_hop_return;\n+\tint32_t status = 0;\n+\n+\t/* Add & lookup to hit invalid TBL24 entry */\n+\tip = IPv4(128, 0, 0, 0);\n+\tdepth = 24;\n+\tnext_hop_add = 100;\n+\n+\tlpm = rte_lpm_create(__func__, SOCKET_ID_ANY, MAX_RULES, 0);\n+\tTEST_LPM_ASSERT(lpm != NULL);\n+\n+\tstatus = rte_lpm_add(lpm, ip, depth, next_hop_add);\n+\tTEST_LPM_ASSERT(status == 0);\n+\n+\tstatus = rte_lpm_lookup(lpm, ip, &next_hop_return);\n+\tTEST_LPM_ASSERT((status == 0) && (next_hop_return == next_hop_add));\n+\n+\tstatus = rte_lpm_delete(lpm, ip, depth);\n+\tTEST_LPM_ASSERT(status == 0);\n+\n+\tstatus = rte_lpm_lookup(lpm, ip, &next_hop_return);\n+\tTEST_LPM_ASSERT(status == -ENOENT);\n+\n+\trte_lpm_delete_all(lpm);\n+\n+\t/* Add & lookup to hit valid TBL24 entry not extended */\n+\tip = IPv4(128, 0, 0, 0);\n+\tdepth = 23;\n+\tnext_hop_add = 100;\n+\n+\tstatus = rte_lpm_add(lpm, ip, depth, next_hop_add);\n+\tTEST_LPM_ASSERT(status == 0);\n+\n+\tstatus = rte_lpm_lookup(lpm, ip, &next_hop_return);\n+\tTEST_LPM_ASSERT((status == 0) && (next_hop_return == next_hop_add));\n+\n+\tdepth = 24;\n+\tnext_hop_add = 101;\n+\n+\tstatus = rte_lpm_add(lpm, ip, depth, next_hop_add);\n+\tTEST_LPM_ASSERT(status == 0);\n+\n+\tstatus = rte_lpm_lookup(lpm, ip, &next_hop_return);\n+\tTEST_LPM_ASSERT((status == 0) && (next_hop_return == next_hop_add));\n+\n+\tdepth = 24;\n+\n+\tstatus = rte_lpm_delete(lpm, ip, depth);\n+\tTEST_LPM_ASSERT(status == 0);\n+\n+\tdepth = 23;\n+\n+\tstatus = rte_lpm_delete(lpm, ip, depth);\n+\tTEST_LPM_ASSERT(status == 0);\n+\n+\tstatus = rte_lpm_lookup(lpm, ip, &next_hop_return);\n+\tTEST_LPM_ASSERT(status == -ENOENT);\n+\n+\trte_lpm_delete_all(lpm);\n+\n+\t/* Add & lookup to hit valid extended TBL24 entry with invalid TBL8\n+\t * entry */\n+\tip = IPv4(128, 0, 0, 0);\n+\tdepth = 32;\n+\tnext_hop_add = 100;\n+\n+\tstatus = rte_lpm_add(lpm, ip, depth, next_hop_add);\n+\tTEST_LPM_ASSERT(status == 0);\n+\n+\tstatus = rte_lpm_lookup(lpm, ip, &next_hop_return);\n+\tTEST_LPM_ASSERT((status == 0) && (next_hop_return == next_hop_add));\n+\n+\tip = IPv4(128, 0, 0, 5);\n+\tdepth = 32;\n+\tnext_hop_add = 101;\n+\n+\tstatus = rte_lpm_add(lpm, ip, depth, next_hop_add);\n+\tTEST_LPM_ASSERT(status == 0);\n+\n+\tstatus = rte_lpm_lookup(lpm, ip, &next_hop_return);\n+\tTEST_LPM_ASSERT((status == 0) && (next_hop_return == next_hop_add));\n+\n+\tstatus = rte_lpm_delete(lpm, ip, depth);\n+\tTEST_LPM_ASSERT(status == 0);\n+\n+\tstatus = rte_lpm_lookup(lpm, ip, &next_hop_return);\n+\tTEST_LPM_ASSERT(status == -ENOENT);\n+\n+\tip = IPv4(128, 0, 0, 0);\n+\tdepth = 32;\n+\tnext_hop_add = 100;\n+\n+\tstatus = rte_lpm_lookup(lpm, ip, &next_hop_return);\n+\tTEST_LPM_ASSERT((status == 0) && (next_hop_return == next_hop_add));\n+\n+\tstatus = rte_lpm_delete(lpm, ip, depth);\n+\tTEST_LPM_ASSERT(status == 0);\n+\n+\tstatus = rte_lpm_lookup(lpm, ip, &next_hop_return);\n+\tTEST_LPM_ASSERT(status == -ENOENT);\n+\n+\trte_lpm_delete_all(lpm);\n+\n+\t/* Add & lookup to hit valid extended TBL24 entry with valid TBL8\n+\t * entry */\n+\tip_1 = IPv4(128, 0, 0, 0);\n+\tdepth_1 = 25;\n+\tnext_hop_add_1 = 101;\n+\n+\tip_2 = IPv4(128, 0, 0, 5);\n+\tdepth_2 = 32;\n+\tnext_hop_add_2 = 102;\n+\n+\tnext_hop_return = 0;\n+\n+\tstatus = rte_lpm_add(lpm, ip_1, depth_1, next_hop_add_1);\n+\tTEST_LPM_ASSERT(status == 0);\n+\n+\tstatus = rte_lpm_lookup(lpm, ip_1, &next_hop_return);\n+\tTEST_LPM_ASSERT((status == 0) && (next_hop_return == next_hop_add_1));\n+\n+\tstatus = rte_lpm_add(lpm, ip_2, depth_2, next_hop_add_2);\n+\tTEST_LPM_ASSERT(status == 0);\n+\n+\tstatus = rte_lpm_lookup(lpm, ip_2, &next_hop_return);\n+\tTEST_LPM_ASSERT((status == 0) && (next_hop_return == next_hop_add_2));\n+\n+\tstatus = rte_lpm_delete(lpm, ip_2, depth_2);\n+\tTEST_LPM_ASSERT(status == 0);\n+\n+\tstatus = rte_lpm_lookup(lpm, ip_2, &next_hop_return);\n+\tTEST_LPM_ASSERT((status == 0) && (next_hop_return == next_hop_add_1));\n+\n+\tstatus = rte_lpm_delete(lpm, ip_1, depth_1);\n+\tTEST_LPM_ASSERT(status == 0);\n+\n+\tstatus = rte_lpm_lookup(lpm, ip_1, &next_hop_return);\n+\tTEST_LPM_ASSERT(status == -ENOENT);\n+\n+\trte_lpm_free(lpm);\n+\n+\treturn PASS;\n+}\n+\n+\n+/*\n+ * - Add rule that covers a TBL24 range previously invalid & lookup (& delete &\n+ *   lookup)\n+ * - Add rule that extends a TBL24 invalid entry & lookup (& delete & lookup)\n+ * - Add rule that extends a TBL24 valid entry & lookup for both rules (&\n+ *   delete & lookup)\n+ * - Add rule that updates the next hop in TBL24 & lookup (& delete & lookup)\n+ * - Add rule that updates the next hop in TBL8 & lookup (& delete & lookup)\n+ * - Delete a rule that is not present in the TBL24 & lookup\n+ * - Delete a rule that is not present in the TBL8 & lookup\n+ *\n+ */\n+int32_t\n+test10(void)\n+{\n+\n+\tstruct rte_lpm *lpm = NULL;\n+\tuint32_t ip;\n+\tuint8_t depth, next_hop_add, next_hop_return;\n+\tint32_t status = 0;\n+\n+\t/* Add rule that covers a TBL24 range previously invalid & lookup\n+\t * (& delete & lookup) */\n+\tlpm = rte_lpm_create(__func__, SOCKET_ID_ANY, MAX_RULES, RTE_LPM_HEAP);\n+\tTEST_LPM_ASSERT(lpm != NULL);\n+\n+\tip = IPv4(128, 0, 0, 0);\n+\tdepth = 16;\n+\tnext_hop_add = 100;\n+\n+\tstatus = rte_lpm_add(lpm, ip, depth, next_hop_add);\n+\tTEST_LPM_ASSERT(status == 0);\n+\n+\tstatus = rte_lpm_lookup(lpm, ip, &next_hop_return);\n+\tTEST_LPM_ASSERT((status == 0) && (next_hop_return == next_hop_add));\n+\n+\tstatus = rte_lpm_delete(lpm, ip, depth);\n+\tTEST_LPM_ASSERT(status == 0);\n+\n+\tstatus = rte_lpm_lookup(lpm, ip, &next_hop_return);\n+\tTEST_LPM_ASSERT(status == -ENOENT);\n+\n+\trte_lpm_delete_all(lpm);\n+\n+\tip = IPv4(128, 0, 0, 0);\n+\tdepth = 25;\n+\tnext_hop_add = 100;\n+\n+\tstatus = rte_lpm_add(lpm, ip, depth, next_hop_add);\n+\tTEST_LPM_ASSERT(status == 0);\n+\n+\tstatus = rte_lpm_lookup(lpm, ip, &next_hop_return);\n+\tTEST_LPM_ASSERT((status == 0) && (next_hop_return == next_hop_add));\n+\n+\tstatus = rte_lpm_delete(lpm, ip, depth);\n+\tTEST_LPM_ASSERT(status == 0);\n+\n+\trte_lpm_delete_all(lpm);\n+\n+\t/* Add rule that extends a TBL24 valid entry & lookup for both rules\n+\t * (& delete & lookup) */\n+\n+\tip = IPv4(128, 0, 0, 0);\n+\tdepth = 24;\n+\tnext_hop_add = 100;\n+\n+\tstatus = rte_lpm_add(lpm, ip, depth, next_hop_add);\n+\tTEST_LPM_ASSERT(status == 0);\n+\n+\tip = IPv4(128, 0, 0, 10);\n+\tdepth = 32;\n+\tnext_hop_add = 101;\n+\n+\tstatus = rte_lpm_add(lpm, ip, depth, next_hop_add);\n+\tTEST_LPM_ASSERT(status == 0);\n+\n+\tstatus = rte_lpm_lookup(lpm, ip, &next_hop_return);\n+\tTEST_LPM_ASSERT((status == 0) && (next_hop_return == next_hop_add));\n+\n+\tip = IPv4(128, 0, 0, 0);\n+\tnext_hop_add = 100;\n+\n+\tstatus = rte_lpm_lookup(lpm, ip, &next_hop_return);\n+\tTEST_LPM_ASSERT((status == 0) && (next_hop_return == next_hop_add));\n+\n+\tip = IPv4(128, 0, 0, 0);\n+\tdepth = 24;\n+\n+\tstatus = rte_lpm_delete(lpm, ip, depth);\n+\tTEST_LPM_ASSERT(status == 0);\n+\n+\tstatus = rte_lpm_lookup(lpm, ip, &next_hop_return);\n+\tTEST_LPM_ASSERT(status == -ENOENT);\n+\n+\tip = IPv4(128, 0, 0, 10);\n+\tdepth = 32;\n+\n+\tstatus = rte_lpm_delete(lpm, ip, depth);\n+\tTEST_LPM_ASSERT(status == 0);\n+\n+\tstatus = rte_lpm_lookup(lpm, ip, &next_hop_return);\n+\tTEST_LPM_ASSERT(status == -ENOENT);\n+\n+\trte_lpm_delete_all(lpm);\n+\n+\t/* Add rule that updates the next hop in TBL24 & lookup\n+\t * (& delete & lookup) */\n+\n+\tip = IPv4(128, 0, 0, 0);\n+\tdepth = 24;\n+\tnext_hop_add = 100;\n+\n+\tstatus = rte_lpm_add(lpm, ip, depth, next_hop_add);\n+\tTEST_LPM_ASSERT(status == 0);\n+\n+\tstatus = rte_lpm_lookup(lpm, ip, &next_hop_return);\n+\tTEST_LPM_ASSERT((status == 0) && (next_hop_return == next_hop_add));\n+\n+\tnext_hop_add = 101;\n+\n+\tstatus = rte_lpm_add(lpm, ip, depth, next_hop_add);\n+\tTEST_LPM_ASSERT(status == 0);\n+\n+\tstatus = rte_lpm_lookup(lpm, ip, &next_hop_return);\n+\tTEST_LPM_ASSERT((status == 0) && (next_hop_return == next_hop_add));\n+\n+\tstatus = rte_lpm_delete(lpm, ip, depth);\n+\tTEST_LPM_ASSERT(status == 0);\n+\n+\tstatus = rte_lpm_lookup(lpm, ip, &next_hop_return);\n+\tTEST_LPM_ASSERT(status == -ENOENT);\n+\n+\trte_lpm_delete_all(lpm);\n+\n+\t/* Add rule that updates the next hop in TBL8 & lookup\n+\t * (& delete & lookup) */\n+\n+\tip = IPv4(128, 0, 0, 0);\n+\tdepth = 32;\n+\tnext_hop_add = 100;\n+\n+\tstatus = rte_lpm_add(lpm, ip, depth, next_hop_add);\n+\tTEST_LPM_ASSERT(status == 0);\n+\n+\tstatus = rte_lpm_lookup(lpm, ip, &next_hop_return);\n+\tTEST_LPM_ASSERT((status == 0) && (next_hop_return == next_hop_add));\n+\n+\tnext_hop_add = 101;\n+\n+\tstatus = rte_lpm_add(lpm, ip, depth, next_hop_add);\n+\tTEST_LPM_ASSERT(status == 0);\n+\n+\tstatus = rte_lpm_lookup(lpm, ip, &next_hop_return);\n+\tTEST_LPM_ASSERT((status == 0) && (next_hop_return == next_hop_add));\n+\n+\tstatus = rte_lpm_delete(lpm, ip, depth);\n+\tTEST_LPM_ASSERT(status == 0);\n+\n+\tstatus = rte_lpm_lookup(lpm, ip, &next_hop_return);\n+\tTEST_LPM_ASSERT(status == -ENOENT);\n+\n+\trte_lpm_delete_all(lpm);\n+\n+\t/* Delete a rule that is not present in the TBL24 & lookup */\n+\n+\tip = IPv4(128, 0, 0, 0);\n+\tdepth = 24;\n+\n+\tstatus = rte_lpm_delete(lpm, ip, depth);\n+\tTEST_LPM_ASSERT(status < 0);\n+\n+\tstatus = rte_lpm_lookup(lpm, ip, &next_hop_return);\n+\tTEST_LPM_ASSERT(status == -ENOENT);\n+\n+\trte_lpm_delete_all(lpm);\n+\n+\t/* Delete a rule that is not present in the TBL8 & lookup */\n+\n+\tip = IPv4(128, 0, 0, 0);\n+\tdepth = 32;\n+\n+\tstatus = rte_lpm_delete(lpm, ip, depth);\n+\tTEST_LPM_ASSERT(status < 0);\n+\n+\tstatus = rte_lpm_lookup(lpm, ip, &next_hop_return);\n+\tTEST_LPM_ASSERT(status == -ENOENT);\n+\n+\trte_lpm_free(lpm);\n+\n+\treturn PASS;\n+}\n+\n+/*\n+ * Add two rules, lookup to hit the more specific one, lookup to hit the less\n+ * specific one delete the less specific rule and lookup previous values again;\n+ * add a more specific rule than the existing rule, lookup again\n+ *\n+ * */\n+int32_t\n+test11(void)\n+{\n+\n+\tstruct rte_lpm *lpm = NULL;\n+\tuint32_t ip;\n+\tuint8_t depth, next_hop_add, next_hop_return;\n+\tint32_t status = 0;\n+\n+\tlpm = rte_lpm_create(__func__, SOCKET_ID_ANY, MAX_RULES, 0);\n+\tTEST_LPM_ASSERT(lpm != NULL);\n+\n+\tip = IPv4(128, 0, 0, 0);\n+\tdepth = 24;\n+\tnext_hop_add = 100;\n+\n+\tstatus = rte_lpm_add(lpm, ip, depth, next_hop_add);\n+\tTEST_LPM_ASSERT(status == 0);\n+\n+\tip = IPv4(128, 0, 0, 10);\n+\tdepth = 32;\n+\tnext_hop_add = 101;\n+\n+\tstatus = rte_lpm_add(lpm, ip, depth, next_hop_add);\n+\tTEST_LPM_ASSERT(status == 0);\n+\n+\tstatus = rte_lpm_lookup(lpm, ip, &next_hop_return);\n+\tTEST_LPM_ASSERT((status == 0) && (next_hop_return == next_hop_add));\n+\n+\tip = IPv4(128, 0, 0, 0);\n+\tnext_hop_add = 100;\n+\n+\tstatus = rte_lpm_lookup(lpm, ip, &next_hop_return);\n+\tTEST_LPM_ASSERT((status == 0) && (next_hop_return == next_hop_add));\n+\n+\tip = IPv4(128, 0, 0, 0);\n+\tdepth = 24;\n+\n+\tstatus = rte_lpm_delete(lpm, ip, depth);\n+\tTEST_LPM_ASSERT(status == 0);\n+\n+\tstatus = rte_lpm_lookup(lpm, ip, &next_hop_return);\n+\tTEST_LPM_ASSERT(status == -ENOENT);\n+\n+\tip = IPv4(128, 0, 0, 10);\n+\tdepth = 32;\n+\n+\tstatus = rte_lpm_delete(lpm, ip, depth);\n+\tTEST_LPM_ASSERT(status == 0);\n+\n+\tstatus = rte_lpm_lookup(lpm, ip, &next_hop_return);\n+\tTEST_LPM_ASSERT(status == -ENOENT);\n+\n+\trte_lpm_free(lpm);\n+\n+\treturn PASS;\n+}\n+\n+/*\n+ * Add an extended rule (i.e. depth greater than 24, lookup (hit), delete,\n+ * lookup (miss) in a for loop of 1000 times. This will check tbl8 extension\n+ * and contraction.\n+ *\n+ * */\n+\n+int32_t\n+test12(void)\n+{\n+\t__m128i ipx4;\n+\tuint16_t hop[4];\n+\tstruct rte_lpm *lpm = NULL;\n+\tuint32_t ip, i;\n+\tuint8_t depth, next_hop_add, next_hop_return;\n+\tint32_t status = 0;\n+\n+\tlpm = rte_lpm_create(__func__, SOCKET_ID_ANY, MAX_RULES, 0);\n+\tTEST_LPM_ASSERT(lpm != NULL);\n+\n+\tip = IPv4(128, 0, 0, 0);\n+\tdepth = 32;\n+\tnext_hop_add = 100;\n+\n+\tfor (i = 0; i < 1000; i++) {\n+\t\tstatus = rte_lpm_add(lpm, ip, depth, next_hop_add);\n+\t\tTEST_LPM_ASSERT(status == 0);\n+\n+\t\tstatus = rte_lpm_lookup(lpm, ip, &next_hop_return);\n+\t\tTEST_LPM_ASSERT((status == 0) &&\n+\t\t\t\t(next_hop_return == next_hop_add));\n+\n+\t\tipx4 = _mm_set_epi32(ip, ip + 1, ip, ip - 1);\n+\t\trte_lpm_lookupx4(lpm, ipx4, hop, UINT16_MAX);\n+\t\tTEST_LPM_ASSERT(hop[0] == UINT16_MAX);\n+\t\tTEST_LPM_ASSERT(hop[1] == next_hop_add);\n+\t\tTEST_LPM_ASSERT(hop[2] == UINT16_MAX);\n+\t\tTEST_LPM_ASSERT(hop[3] == next_hop_add);\n+\n+\t\tstatus = rte_lpm_delete(lpm, ip, depth);\n+\t\tTEST_LPM_ASSERT(status == 0);\n+\n+\t\tstatus = rte_lpm_lookup(lpm, ip, &next_hop_return);\n+\t\tTEST_LPM_ASSERT(status == -ENOENT);\n+\t}\n+\n+\trte_lpm_free(lpm);\n+\n+\treturn PASS;\n+}\n+\n+/*\n+ * Add a rule to tbl24, lookup (hit), then add a rule that will extend this\n+ * tbl24 entry, lookup (hit). delete the rule that caused the tbl24 extension,\n+ * lookup (miss) and repeat for loop of 1000 times. This will check tbl8\n+ * extension and contraction.\n+ *\n+ * */\n+\n+int32_t\n+test13(void)\n+{\n+\tstruct rte_lpm *lpm = NULL;\n+\tuint32_t ip, i;\n+\tuint8_t depth, next_hop_add_1, next_hop_add_2, next_hop_return;\n+\tint32_t status = 0;\n+\n+\tlpm = rte_lpm_create(__func__, SOCKET_ID_ANY, MAX_RULES, 0);\n+\tTEST_LPM_ASSERT(lpm != NULL);\n+\n+\tip = IPv4(128, 0, 0, 0);\n+\tdepth = 24;\n+\tnext_hop_add_1 = 100;\n+\n+\tstatus = rte_lpm_add(lpm, ip, depth, next_hop_add_1);\n+\tTEST_LPM_ASSERT(status == 0);\n+\n+\tstatus = rte_lpm_lookup(lpm, ip, &next_hop_return);\n+\tTEST_LPM_ASSERT((status == 0) && (next_hop_return == next_hop_add_1));\n+\n+\tdepth = 32;\n+\tnext_hop_add_2 = 101;\n+\n+\tfor (i = 0; i < 1000; i++) {\n+\t\tstatus = rte_lpm_add(lpm, ip, depth, next_hop_add_2);\n+\t\tTEST_LPM_ASSERT(status == 0);\n+\n+\t\tstatus = rte_lpm_lookup(lpm, ip, &next_hop_return);\n+\t\tTEST_LPM_ASSERT((status == 0) &&\n+\t\t\t\t(next_hop_return == next_hop_add_2));\n+\n+\t\tstatus = rte_lpm_delete(lpm, ip, depth);\n+\t\tTEST_LPM_ASSERT(status == 0);\n+\n+\t\tstatus = rte_lpm_lookup(lpm, ip, &next_hop_return);\n+\t\tTEST_LPM_ASSERT((status == 0) &&\n+\t\t\t\t(next_hop_return == next_hop_add_1));\n+\t}\n+\n+\tdepth = 24;\n+\n+\tstatus = rte_lpm_delete(lpm, ip, depth);\n+\tTEST_LPM_ASSERT(status == 0);\n+\n+\tstatus = rte_lpm_lookup(lpm, ip, &next_hop_return);\n+\tTEST_LPM_ASSERT(status == -ENOENT);\n+\n+\trte_lpm_free(lpm);\n+\n+\treturn PASS;\n+}\n+\n+/*\n+ * Fore TBL8 extension exhaustion. Add 256 rules that require a tbl8 extension.\n+ * No more tbl8 extensions will be allowed. Now add one more rule that required\n+ * a tbl8 extension and get fail.\n+ * */\n+int32_t\n+test14(void)\n+{\n+\n+\t/* We only use depth = 32 in the loop below so we must make sure\n+\t * that we have enough storage for all rules at that depth*/\n+\n+\tstruct rte_lpm *lpm = NULL;\n+\tuint32_t ip;\n+\tuint8_t depth, next_hop_add, next_hop_return;\n+\tint32_t status = 0;\n+\n+\t/* Add enough space for 256 rules for every depth */\n+\tlpm = rte_lpm_create(__func__, SOCKET_ID_ANY, 256 * 32, 0);\n+\tTEST_LPM_ASSERT(lpm != NULL);\n+\n+\tdepth = 32;\n+\tnext_hop_add = 100;\n+\tip = IPv4(0, 0, 0, 0);\n+\n+\t/* Add 256 rules that require a tbl8 extension */\n+\tfor (; ip <= IPv4(0, 0, 255, 0); ip += 256) {\n+\t\tstatus = rte_lpm_add(lpm, ip, depth, next_hop_add);\n+\t\tTEST_LPM_ASSERT(status == 0);\n+\n+\t\tstatus = rte_lpm_lookup(lpm, ip, &next_hop_return);\n+\t\tTEST_LPM_ASSERT((status == 0) &&\n+\t\t\t\t(next_hop_return == next_hop_add));\n+\t}\n+\n+\t/* All tbl8 extensions have been used above. Try to add one more and\n+\t * we get a fail */\n+\tip = IPv4(1, 0, 0, 0);\n+\tdepth = 32;\n+\n+\tstatus = rte_lpm_add(lpm, ip, depth, next_hop_add);\n+\tTEST_LPM_ASSERT(status < 0);\n+\n+\trte_lpm_free(lpm);\n+\n+\treturn PASS;\n+}\n+\n+/*\n+ * Sequence of operations for find existing lpm table\n+ *\n+ *  - create table\n+ *  - find existing table: hit\n+ *  - find non-existing table: miss\n+ *\n+ */\n+int32_t\n+test15(void)\n+{\n+\tstruct rte_lpm *lpm = NULL, *result = NULL;\n+\n+\t/* Create lpm  */\n+\tlpm = rte_lpm_create(\"lpm_find_existing\", SOCKET_ID_ANY, 256 * 32, 0);\n+\tTEST_LPM_ASSERT(lpm != NULL);\n+\n+\t/* Try to find existing lpm */\n+\tresult = rte_lpm_find_existing(\"lpm_find_existing\");\n+\tTEST_LPM_ASSERT(result == lpm);\n+\n+\t/* Try to find non-existing lpm */\n+\tresult = rte_lpm_find_existing(\"lpm_find_non_existing\");\n+\tTEST_LPM_ASSERT(result == NULL);\n+\n+\t/* Cleanup. */\n+\trte_lpm_delete_all(lpm);\n+\trte_lpm_free(lpm);\n+\n+\treturn PASS;\n+}\n+\n+/*\n+ * test failure condition of overloading the tbl8 so no more will fit\n+ * Check we get an error return value in that case\n+ */\n+int32_t\n+test16(void)\n+{\n+\tuint32_t ip;\n+\tstruct rte_lpm *lpm = rte_lpm_create(__func__, SOCKET_ID_ANY,\n+\t\t\t256 * 32, 0);\n+\n+\t/* ip loops through all possibilities for top 24 bits of address */\n+\tfor (ip = 0; ip < 0xFFFFFF; ip++) {\n+\t\t/* add an entry within a different tbl8 each time, since\n+\t\t * depth >24 and the top 24 bits are different */\n+\t\tif (rte_lpm_add(lpm, (ip << 8) + 0xF0, 30, 0) < 0)\n+\t\t\tbreak;\n+\t}\n+\n+\tif (ip != RTE_LPM_TBL8_NUM_GROUPS) {\n+\t\tprintf(\"Error, unexpected failure with filling tbl8 groups\\n\");\n+\t\tprintf(\"Failed after %u additions, expected after %u\\n\",\n+\t\t\t\t(unsigned)ip, (unsigned)RTE_LPM_TBL8_NUM_GROUPS);\n+\t}\n+\n+\trte_lpm_free(lpm);\n+\treturn 0;\n+}\n+\n+/*\n+ * Test for overwriting of tbl8:\n+ *  - add rule /32 and lookup\n+ *  - add new rule /24 and lookup\n+ *\t- add third rule /25 and lookup\n+ *\t- lookup /32 and /24 rule to ensure the table has not been overwritten.\n+ */\n+int32_t\n+test17(void)\n+{\n+\tstruct rte_lpm *lpm = NULL;\n+\tconst uint32_t ip_10_32 = IPv4(10, 10, 10, 2);\n+\tconst uint32_t ip_10_24 = IPv4(10, 10, 10, 0);\n+\tconst uint32_t ip_20_25 = IPv4(10, 10, 20, 2);\n+\tconst uint8_t d_ip_10_32 = 32,\n+\t\t\td_ip_10_24 = 24,\n+\t\t\td_ip_20_25 = 25;\n+\tconst uint8_t next_hop_ip_10_32 = 100,\n+\t\t\tnext_hop_ip_10_24 = 105,\n+\t\t\tnext_hop_ip_20_25 = 111;\n+\tuint8_t next_hop_return = 0;\n+\tint32_t status = 0;\n+\n+\tlpm = rte_lpm_create(__func__, SOCKET_ID_ANY, MAX_RULES, 0);\n+\tTEST_LPM_ASSERT(lpm != NULL);\n+\n+\tstatus = rte_lpm_add(lpm, ip_10_32, d_ip_10_32, next_hop_ip_10_32);\n+\tif (status < 0)\n+\t\treturn -1;\n+\n+\tstatus = rte_lpm_lookup(lpm, ip_10_32, &next_hop_return);\n+\tuint8_t test_hop_10_32 = next_hop_return;\n+\tTEST_LPM_ASSERT(status == 0);\n+\tTEST_LPM_ASSERT(next_hop_return == next_hop_ip_10_32);\n+\n+\tstatus = rte_lpm_add(lpm, ip_10_24, d_ip_10_24, next_hop_ip_10_24);\n+\tif (status < 0)\n+\t\treturn -1;\n+\n+\tstatus = rte_lpm_lookup(lpm, ip_10_24, &next_hop_return);\n+\tuint8_t test_hop_10_24 = next_hop_return;\n+\tTEST_LPM_ASSERT(status == 0);\n+\tTEST_LPM_ASSERT(next_hop_return == next_hop_ip_10_24);\n+\n+\tstatus = rte_lpm_add(lpm, ip_20_25, d_ip_20_25, next_hop_ip_20_25);\n+\tif (status < 0)\n+\t\treturn -1;\n+\n+\tstatus = rte_lpm_lookup(lpm, ip_20_25, &next_hop_return);\n+\tuint8_t test_hop_20_25 = next_hop_return;\n+\tTEST_LPM_ASSERT(status == 0);\n+\tTEST_LPM_ASSERT(next_hop_return == next_hop_ip_20_25);\n+\n+\tif (test_hop_10_32 == test_hop_10_24) {\n+\t\tprintf(\"Next hop return equal\\n\");\n+\t\treturn -1;\n+\t}\n+\n+\tif (test_hop_10_24 == test_hop_20_25) {\n+\t\tprintf(\"Next hop return equal\\n\");\n+\t\treturn -1;\n+\t}\n+\n+\tstatus = rte_lpm_lookup(lpm, ip_10_32, &next_hop_return);\n+\tTEST_LPM_ASSERT(status == 0);\n+\tTEST_LPM_ASSERT(next_hop_return == next_hop_ip_10_32);\n+\n+\tstatus = rte_lpm_lookup(lpm, ip_10_24, &next_hop_return);\n+\tTEST_LPM_ASSERT(status == 0);\n+\tTEST_LPM_ASSERT(next_hop_return == next_hop_ip_10_24);\n+\n+\trte_lpm_free(lpm);\n+\n+\treturn PASS;\n+}\n+\n+/*\n+ * Lookup performance test\n+ */\n+\n+#define ITERATIONS (1 << 10)\n+#define BATCH_SIZE (1 << 12)\n+#define BULK_SIZE 32\n+\n+int32_t\n+perf_test(void)\n+{\n+\tstruct rte_lpm *lpm = NULL;\n+\tuint64_t begin, total_time, lpm_used_entries = 0;\n+\tunsigned i, j;\n+\tuint8_t next_hop_add = 0xAA, next_hop_return = 0;\n+\tint status = 0;\n+\tuint64_t cache_line_counter = 0;\n+\tint64_t count = 0;\n+\n+\trte_srand(rte_rdtsc());\n+\n+\t/* (re) generate the routing table */\n+\tgenerate_large_route_rule_table();\n+\n+\tprintf(\"No. routes = %u\\n\", (unsigned) NUM_ROUTE_ENTRIES);\n+\n+\tprint_route_distribution(large_route_table,\n+\t\t\t\t (uint32_t) NUM_ROUTE_ENTRIES);\n+\n+\tlpm = rte_lpm_create(__func__, SOCKET_ID_ANY, 1000000, 0);\n+\tTEST_LPM_ASSERT(lpm != NULL);\n+\n+\t/* Measue add. */\n+\tbegin = rte_rdtsc();\n+\n+\tfor (i = 0; i < NUM_ROUTE_ENTRIES; i++) {\n+\t\tif (rte_lpm_add(lpm, large_route_table[i].ip,\n+\t\t\t\tlarge_route_table[i].depth, next_hop_add) == 0)\n+\t\t\tstatus++;\n+\t}\n+\t/* End Timer. */\n+\ttotal_time = rte_rdtsc() - begin;\n+\n+\tprintf(\"Unique added entries = %d\\n\", status);\n+\t/* Obtain add statistics. */\n+\tfor (i = 0; i < RTE_LPM_TBL24_NUM_ENTRIES; i++) {\n+\t\tif (lpm->tbl24[i].valid)\n+\t\t\tlpm_used_entries++;\n+\n+\t\tif (i % 32 == 0) {\n+\t\t\tif ((uint64_t)count < lpm_used_entries) {\n+\t\t\t\tcache_line_counter++;\n+\t\t\t\tcount = lpm_used_entries;\n+\t\t\t}\n+\t\t}\n+\t}\n+\n+\tprintf(\"Used table 24 entries = %u (%g%%)\\n\",\n+\t\t\t(unsigned) lpm_used_entries,\n+\t\t\t(lpm_used_entries * 100.0) / RTE_LPM_TBL24_NUM_ENTRIES);\n+\tprintf(\"64 byte Cache entries used = %u (%u bytes)\\n\",\n+\t\t\t(unsigned) cache_line_counter, (unsigned) cache_line_counter * 64);\n+\n+\tprintf(\"Average LPM Add: %g cycles\\n\", (double)total_time / NUM_ROUTE_ENTRIES);\n+\n+\t/* Measure single Lookup */\n+\ttotal_time = 0;\n+\tcount = 0;\n+\n+\tfor (i = 0; i < ITERATIONS; i++) {\n+\t\tstatic uint32_t ip_batch[BATCH_SIZE];\n+\n+\t\tfor (j = 0; j < BATCH_SIZE; j++)\n+\t\t\tip_batch[j] = rte_rand();\n+\n+\t\t/* Lookup per batch */\n+\t\tbegin = rte_rdtsc();\n+\n+\t\tfor (j = 0; j < BATCH_SIZE; j++) {\n+\t\t\tif (rte_lpm_lookup(lpm, ip_batch[j], &next_hop_return) != 0)\n+\t\t\t\tcount++;\n+\t\t}\n+\n+\t\ttotal_time += rte_rdtsc() - begin;\n+\n+\t}\n+\tprintf(\"Average LPM Lookup: %.1f cycles (fails = %.1f%%)\\n\",\n+\t\t\t(double)total_time / ((double)ITERATIONS * BATCH_SIZE),\n+\t\t\t(count * 100.0) / (double)(ITERATIONS * BATCH_SIZE));\n+\n+\t/* Measure bulk Lookup */\n+\ttotal_time = 0;\n+\tcount = 0;\n+\tfor (i = 0; i < ITERATIONS; i++) {\n+\t\tstatic uint32_t ip_batch[BATCH_SIZE];\n+\t\tuint16_t next_hops[BULK_SIZE];\n+\n+\t\t/* Create array of random IP addresses */\n+\t\tfor (j = 0; j < BATCH_SIZE; j++)\n+\t\t\tip_batch[j] = rte_rand();\n+\n+\t\t/* Lookup per batch */\n+\t\tbegin = rte_rdtsc();\n+\t\tfor (j = 0; j < BATCH_SIZE; j += BULK_SIZE) {\n+\t\t\tunsigned k;\n+\t\t\trte_lpm_lookup_bulk(lpm, &ip_batch[j], next_hops, BULK_SIZE);\n+\t\t\tfor (k = 0; k < BULK_SIZE; k++)\n+\t\t\t\tif (unlikely(!(next_hops[k] & RTE_LPM_LOOKUP_SUCCESS)))\n+\t\t\t\t\tcount++;\n+\t\t}\n+\n+\t\ttotal_time += rte_rdtsc() - begin;\n+\t}\n+\tprintf(\"BULK LPM Lookup: %.1f cycles (fails = %.1f%%)\\n\",\n+\t\t\t(double)total_time / ((double)ITERATIONS * BATCH_SIZE),\n+\t\t\t(count * 100.0) / (double)(ITERATIONS * BATCH_SIZE));\n+\n+\t/* Measure LookupX4 */\n+\ttotal_time = 0;\n+\tcount = 0;\n+\tfor (i = 0; i < ITERATIONS; i++) {\n+\t\tstatic uint32_t ip_batch[BATCH_SIZE];\n+\t\tuint16_t next_hops[4];\n+\n+\t\t/* Create array of random IP addresses */\n+\t\tfor (j = 0; j < BATCH_SIZE; j++)\n+\t\t\tip_batch[j] = rte_rand();\n+\n+\t\t/* Lookup per batch */\n+\t\tbegin = rte_rdtsc();\n+\t\tfor (j = 0; j < BATCH_SIZE; j += RTE_DIM(next_hops)) {\n+\t\t\tunsigned k;\n+\t\t\t__m128i ipx4;\n+\n+\t\t\tipx4 = _mm_loadu_si128((__m128i *)(ip_batch + j));\n+\t\t\tipx4 = *(__m128i *)(ip_batch + j);\n+\t\t\trte_lpm_lookupx4(lpm, ipx4, next_hops, UINT16_MAX);\n+\t\t\tfor (k = 0; k < RTE_DIM(next_hops); k++)\n+\t\t\t\tif (unlikely(next_hops[k] == UINT16_MAX))\n+\t\t\t\t\tcount++;\n+\t\t}\n+\n+\t\ttotal_time += rte_rdtsc() - begin;\n+\t}\n+\tprintf(\"LPM LookupX4: %.1f cycles (fails = %.1f%%)\\n\",\n+\t\t\t(double)total_time / ((double)ITERATIONS * BATCH_SIZE),\n+\t\t\t(count * 100.0) / (double)(ITERATIONS * BATCH_SIZE));\n+\n+\t/* Delete */\n+\tstatus = 0;\n+\tbegin = rte_rdtsc();\n+\n+\tfor (i = 0; i < NUM_ROUTE_ENTRIES; i++) {\n+\t\t/* rte_lpm_delete(lpm, ip, depth) */\n+\t\tstatus += rte_lpm_delete(lpm, large_route_table[i].ip,\n+\t\t\t\tlarge_route_table[i].depth);\n+\t}\n+\n+\ttotal_time += rte_rdtsc() - begin;\n+\n+\tprintf(\"Average LPM Delete: %g cycles\\n\",\n+\t\t\t(double)total_time / NUM_ROUTE_ENTRIES);\n+\n+\trte_lpm_delete_all(lpm);\n+\trte_lpm_free(lpm);\n+\n+\treturn PASS;\n+}\n+\n+/*\n+ * Do all unit and performance tests.\n+ */\n+\n+static int\n+test_lpm(void)\n+{\n+\tunsigned i;\n+\tint status, global_status = 0;\n+\n+\tfor (i = 0; i < NUM_LPM_TESTS; i++) {\n+\t\tstatus = tests[i]();\n+\t\tif (status < 0) {\n+\t\t\tprintf(\"ERROR: LPM Test %s: FAIL\\n\", RTE_STR(tests[i]));\n+\t\t\tglobal_status = status;\n+\t\t}\n+\t}\n+\n+\treturn global_status;\n+}\n+\n+REGISTER_TEST_COMMAND_VERSION(lpm_autotest, test_lpm, TEST_DPDK_ABI_VERSION_V20);\ndiff --git a/app/test/v2.0/test_v20.c b/app/test/v2.0/test_v20.c\nnew file mode 100644\nindex 000000000..6285e2882\n--- /dev/null\n+++ b/app/test/v2.0/test_v20.c\n@@ -0,0 +1,14 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ * Copyright(c) 2010-2014 Intel Corporation\n+ */\n+\n+#include <stdio.h>\n+#include <stdint.h>\n+#include <stdlib.h>\n+\n+#include <rte_ip.h>\n+#include <rte_lpm.h>\n+\n+#include \"../test.h\"\n+\n+REGISTER_TEST_ABI_VERSION(v20, TEST_DPDK_ABI_VERSION_V20);\n",
    "prefixes": [
        "2/2"
    ]
}