Modify of test_lpm6.c to reflect that we no longer have a maximum number
of rules.

Check in some places that we are using the same number of tbl8 as the
previous implementation after a rte_lpm6_delete.

Signed-off-by: Nikita Kozlov <nikita at gandi.net>
Signed-off-by: Baptiste Daroussin <bapt at gandi.net>
---
 app/test/test_lpm6.c                  | 244 +++++++++++-----------------------
 app/test/test_lpm6_perf.c             |   6 +-
 lib/librte_table/rte_table_lpm_ipv6.c |   7 +-
 3 files changed, 84 insertions(+), 173 deletions(-)

diff --git a/app/test/test_lpm6.c b/app/test/test_lpm6.c
index 0fd0ef7..7929e44 100644
--- a/app/test/test_lpm6.c
+++ b/app/test/test_lpm6.c
@@ -77,8 +77,6 @@ static int32_t test22(void);
 static int32_t test23(void);
 static int32_t test24(void);
 static int32_t test25(void);
-static int32_t test26(void);
-static int32_t test27(void);

 rte_lpm6_test tests6[] = {
 /* Test Cases */
@@ -108,13 +106,10 @@ rte_lpm6_test tests6[] = {
        test23,
        test24,
        test25,
-       test26,
-       test27,
 };

 #define NUM_LPM6_TESTS                (sizeof(tests6)/sizeof(tests6[0]))
 #define MAX_DEPTH                                                    128
-#define MAX_RULES                                                1000000
 #define NUMBER_TBL8S                                           (1 << 16)
 #define MAX_NUM_TBL8S                                          (1 << 21)
 #define PASS 0
@@ -153,7 +148,6 @@ test0(void)
        struct rte_lpm6 *lpm = NULL;
        struct rte_lpm6_config config;

-       config.max_rules = MAX_RULES;
        config.number_tbl8s = NUMBER_TBL8S;
        config.flags = 0;

@@ -161,14 +155,7 @@ test0(void)
        lpm = rte_lpm6_create(NULL, SOCKET_ID_ANY, &config);
        TEST_LPM_ASSERT(lpm == NULL);

-       /* rte_lpm6_create: max_rules = 0 */
-       /* Note: __func__ inserts the function name, in this case "test0". */
-       config.max_rules = 0;
-       lpm = rte_lpm6_create(__func__, SOCKET_ID_ANY, &config);
-       TEST_LPM_ASSERT(lpm == NULL);
-
        /* socket_id < -1 is invalid */
-       config.max_rules = MAX_RULES;
        lpm = rte_lpm6_create(__func__, -2, &config);
        TEST_LPM_ASSERT(lpm == NULL);

@@ -195,7 +182,6 @@ test1(void)
        struct rte_lpm6 *lpm1 = NULL, *lpm2 = NULL, *lpm3 = NULL;
        struct rte_lpm6_config config;

-       config.max_rules = MAX_RULES;
        config.number_tbl8s = NUMBER_TBL8S;
        config.flags = 0;

@@ -219,7 +205,6 @@ test1(void)

 /*
  * Create lpm table then delete lpm table 20 times
- * Use a slightly different rules size each time
  */
 int32_t
 test2(void)
@@ -233,7 +218,6 @@ test2(void)

        /* rte_lpm6_free: Free NULL */
        for (i = 0; i < 20; i++) {
-               config.max_rules = MAX_RULES - i;
                lpm = rte_lpm6_create(__func__, SOCKET_ID_ANY, &config);
                TEST_LPM_ASSERT(lpm != NULL);

@@ -256,7 +240,6 @@ test3(void)
        struct rte_lpm6 *lpm = NULL;
        struct rte_lpm6_config config;

-       config.max_rules = MAX_RULES;
        config.number_tbl8s = NUMBER_TBL8S;
        config.flags = 0;

@@ -278,10 +261,10 @@ test4(void)
        struct rte_lpm6_config config;

        uint8_t ip[] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
-       uint8_t depth = 24, next_hop = 100;
+       uint8_t depth = 24;
+       uint16_t next_hop = 100;
        int32_t status = 0;

-       config.max_rules = MAX_RULES;
        config.number_tbl8s = NUMBER_TBL8S;
        config.flags = 0;

@@ -319,7 +302,6 @@ test5(void)
        uint8_t depth = 24;
        int32_t status = 0;

-       config.max_rules = MAX_RULES;
        config.number_tbl8s = NUMBER_TBL8S;
        config.flags = 0;

@@ -354,10 +336,9 @@ test6(void)
        struct rte_lpm6 *lpm = NULL;
        struct rte_lpm6_config config;
        uint8_t ip[] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
-       uint8_t next_hop_return = 0;
+       uint16_t next_hop_return = 0;
        int32_t status = 0;

-       config.max_rules = MAX_RULES;
        config.number_tbl8s = NUMBER_TBL8S;
        config.flags = 0;

@@ -392,10 +373,9 @@ test7(void)
        struct rte_lpm6 *lpm = NULL;
        struct rte_lpm6_config config;
        uint8_t ip[10][16];
-       int16_t next_hop_return[10];
+       int32_t next_hop_return[10];
        int32_t status = 0;

-       config.max_rules = MAX_RULES;
        config.number_tbl8s = NUMBER_TBL8S;
        config.flags = 0;

@@ -433,7 +413,6 @@ test8(void)
        uint8_t depth[10];
        int32_t status = 0;

-       config.max_rules = MAX_RULES;
        config.number_tbl8s = NUMBER_TBL8S;
        config.flags = 0;

@@ -469,11 +448,11 @@ test9(void)
        struct rte_lpm6 *lpm = NULL;
        struct rte_lpm6_config config;
        uint8_t ip[] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
-       uint8_t depth = 16, next_hop_add = 100, next_hop_return = 0;
+       uint8_t depth = 16;
+       uint16_t next_hop_add = 100, next_hop_return = 0;
        int32_t status = 0;
        uint8_t i;

-       config.max_rules = MAX_RULES;
        config.number_tbl8s = NUMBER_TBL8S;
        config.flags = 0;

@@ -503,56 +482,13 @@ test9(void)
        return PASS;
 }

-/*
- * Adds max_rules + 1 and expects a failure. Deletes a rule, then adds
- * another one and expects success.
- */
-int32_t
-test10(void)
-{
-       struct rte_lpm6 *lpm = NULL;
-       struct rte_lpm6_config config;
-       uint8_t ip[] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
-       uint8_t depth, next_hop_add = 100;
-       int32_t status = 0;
-       int i;
-
-       config.max_rules = 127;
-       config.number_tbl8s = NUMBER_TBL8S;
-       config.flags = 0;
-
-       lpm = rte_lpm6_create(__func__, SOCKET_ID_ANY, &config);
-       TEST_LPM_ASSERT(lpm != NULL);
-
-       for (i = 1; i < 128; i++) {
-               depth = (uint8_t)i;
-               status = rte_lpm6_add(lpm, ip, depth, next_hop_add);
-               TEST_LPM_ASSERT(status == 0);
-       }
-
-       depth = 128;
-       status = rte_lpm6_add(lpm, ip, depth, next_hop_add);
-       TEST_LPM_ASSERT(status == -ENOSPC);
-
-       depth = 127;
-       status = rte_lpm6_delete(lpm, ip, depth);
-       TEST_LPM_ASSERT(status == 0);
-
-       depth = 128;
-       status = rte_lpm6_add(lpm, ip, depth, next_hop_add);
-       TEST_LPM_ASSERT(status == 0);
-
-       rte_lpm6_free(lpm);
-
-       return PASS;
-}

 /*
  * Creates an LPM table with a small number of tbl8s and exhaust them in the
  * middle of the process of creating a rule.
  */
 int32_t
-test11(void)
+test10(void)
 {
        struct rte_lpm6 *lpm = NULL;
        struct rte_lpm6_config config;
@@ -560,43 +496,69 @@ test11(void)
        uint8_t depth, next_hop_add = 100;
        int32_t status = 0;

-       config.max_rules = MAX_RULES;
        config.number_tbl8s = 16;
        config.flags = 0;

        lpm = rte_lpm6_create(__func__, SOCKET_ID_ANY, &config);
        TEST_LPM_ASSERT(lpm != NULL);

+       /* use 13 tlb8 */
        depth = 128;
        status = rte_lpm6_add(lpm, ip, depth, next_hop_add);
        TEST_LPM_ASSERT(status == 0);

+       status = rte_lpm6_tbl8_count(lpm);
+       TEST_LPM_ASSERT(status == 13);
+
+       /* use 14 tbl8 */
        ip[0] = 1;
        depth = 25;
        status = rte_lpm6_add(lpm, ip, depth, next_hop_add);
        TEST_LPM_ASSERT(status == 0);

+       status = rte_lpm6_tbl8_count(lpm);
+       TEST_LPM_ASSERT(status == 14);
+
        status = rte_lpm6_delete(lpm, ip, depth);
        TEST_LPM_ASSERT(status == 0);

+       status = rte_lpm6_tbl8_count(lpm);
+       TEST_LPM_ASSERT(status == 13);
+
+       /* use 15 tbl8 */
        depth = 33;
        status = rte_lpm6_add(lpm, ip, depth, next_hop_add);
        TEST_LPM_ASSERT(status == 0);

+       status = rte_lpm6_tbl8_count(lpm);
+       TEST_LPM_ASSERT(status == 15);
+
        status = rte_lpm6_delete(lpm, ip, depth);
        TEST_LPM_ASSERT(status == 0);

+       status = rte_lpm6_tbl8_count(lpm);
+       TEST_LPM_ASSERT(status == 13);
+
+       /* use 16 tbl8 */
        depth = 41;
        status = rte_lpm6_add(lpm, ip, depth, next_hop_add);
        TEST_LPM_ASSERT(status == 0);

+       status = rte_lpm6_tbl8_count(lpm);
+       TEST_LPM_ASSERT(status == 16);
+
        status = rte_lpm6_delete(lpm, ip, depth);
        TEST_LPM_ASSERT(status == 0);

+       status = rte_lpm6_tbl8_count(lpm);
+       TEST_LPM_ASSERT(status == 13);
+
+       /* try to use 17 tbl8 */
        depth = 49;
        status = rte_lpm6_add(lpm, ip, depth, next_hop_add);
        TEST_LPM_ASSERT(status == -ENOSPC);

+       /* use 16 tbl8 */
        depth = 41;
        status = rte_lpm6_add(lpm, ip, depth, next_hop_add);
        TEST_LPM_ASSERT(status == 0);
@@ -612,7 +574,7 @@ test11(void)
  * in that position and needs to be extended.
  */
 int32_t
-test12(void)
+test11(void)
 {
        struct rte_lpm6 *lpm = NULL;
        struct rte_lpm6_config config;
@@ -620,7 +582,6 @@ test12(void)
        uint8_t depth, next_hop_add = 100;
        int32_t status = 0;

-       config.max_rules = MAX_RULES;
        config.number_tbl8s = 16;
        config.flags = 0;

@@ -646,58 +607,13 @@ test12(void)
 }

 /*
- * Creates an LPM table with max_rules = 2 and tries to add 3 rules.
- * Delete one of the rules and tries to add the third one again.
- */
-int32_t
-test13(void)
-{
-       struct rte_lpm6 *lpm = NULL;
-       struct rte_lpm6_config config;
-       uint8_t ip[] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
-       uint8_t depth, next_hop_add = 100;
-       int32_t status = 0;
-
-       config.max_rules = 2;
-       config.number_tbl8s = NUMBER_TBL8S;
-       config.flags = 0;
-
-       lpm = rte_lpm6_create(__func__, SOCKET_ID_ANY, &config);
-       TEST_LPM_ASSERT(lpm != NULL);
-
-       depth = 1;
-       status = rte_lpm6_add(lpm, ip, depth, next_hop_add);
-       TEST_LPM_ASSERT(status == 0);
-
-       depth = 2;
-       status = rte_lpm6_add(lpm, ip, depth, next_hop_add);
-       TEST_LPM_ASSERT(status == 0);
-
-       depth = 3;
-       status = rte_lpm6_add(lpm, ip, depth, next_hop_add);
-       TEST_LPM_ASSERT(status == -ENOSPC);
-
-       depth = 2;
-       status = rte_lpm6_delete(lpm, ip, depth);
-       TEST_LPM_ASSERT(status == 0);
-
-       depth = 3;
-       status = rte_lpm6_add(lpm, ip, depth, next_hop_add);
-       TEST_LPM_ASSERT(status == 0);
-
-       rte_lpm6_free(lpm);
-
-       return PASS;
-}
-
-/*
  * Add 2^12 routes with different first 12 bits and depth 25.
  * Add one more route with the same depth and check that results in a failure.
  * After that delete the last rule and create the one that was attempted to be
  * created. This checks tbl8 exhaustion.
  */
 int32_t
-test14(void)
+test12(void)
 {
        struct rte_lpm6 *lpm = NULL;
        struct rte_lpm6_config config;
@@ -706,7 +622,6 @@ test14(void)
        int32_t status = 0;
        int i;

-       config.max_rules = MAX_RULES;
        config.number_tbl8s = 256;
        config.flags = 0;

@@ -743,15 +658,15 @@ test14(void)
  * Call add, lookup and delete for a single rule with depth = 24
  */
 int32_t
-test15(void)
+test13(void)
 {
        struct rte_lpm6 *lpm = NULL;
        struct rte_lpm6_config config;
        uint8_t ip[] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
-       uint8_t depth = 24, next_hop_add = 100, next_hop_return = 0;
+       uint8_t depth = 24;
+       uint16_t next_hop_add = 100, next_hop_return = 0;
        int32_t status = 0;

-       config.max_rules = MAX_RULES;
        config.number_tbl8s = NUMBER_TBL8S;
        config.flags = 0;

@@ -779,15 +694,15 @@ test15(void)
  * Call add, lookup and delete for a single rule with depth > 24
  */
 int32_t
-test16(void)
+test14(void)
 {
        struct rte_lpm6 *lpm = NULL;
        struct rte_lpm6_config config;
        uint8_t ip[] = {12,12,1,0,0,0,0,0,0,0,0,0,0,0,0,0};
-       uint8_t depth = 128, next_hop_add = 100, next_hop_return = 0;
+       uint8_t depth = 128;
+       uint16_t next_hop_add = 100, next_hop_return = 0;
        int32_t status = 0;

-       config.max_rules = MAX_RULES;
        config.number_tbl8s = NUMBER_TBL8S;
        config.flags = 0;

@@ -821,17 +736,17 @@ test16(void)
  * previous depth value (i.e. depth -1).
  */
 int32_t
-test17(void)
+test15(void)
 {
        struct rte_lpm6 *lpm = NULL;
        struct rte_lpm6_config config;
        uint8_t ip1[] = {127,255,255,255,255,255,255,255,255,
                        255,255,255,255,255,255,255};
        uint8_t ip2[] = {128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
-       uint8_t depth, next_hop_add, next_hop_return;
+       uint8_t depth;
+       uint16_t next_hop_add, next_hop_return;
        int32_t status = 0;

-       config.max_rules = MAX_RULES;
        config.number_tbl8s = NUMBER_TBL8S;
        config.flags = 0;

@@ -888,16 +803,16 @@ test17(void)
  * - Add & lookup to hit valid extended TBL24 entry with valid TBL8 entry
  */
 int32_t
-test18(void)
+test16(void)
 {
        struct rte_lpm6 *lpm = NULL;
        struct rte_lpm6_config config;
        uint8_t ip[16], ip_1[16], ip_2[16];
-       uint8_t depth, depth_1, depth_2, next_hop_add, next_hop_add_1,
+       uint8_t depth, depth_1, depth_2;
+       uint16_t next_hop_add, next_hop_add_1,
                next_hop_add_2, next_hop_return;
        int32_t status = 0;

-       config.max_rules = MAX_RULES;
        config.number_tbl8s = NUMBER_TBL8S;
        config.flags = 0;

@@ -1050,15 +965,15 @@ test18(void)
  * - Delete a rule that is not present in the TBL8 & lookup
  */
 int32_t
-test19(void)
+test17(void)
 {
        struct rte_lpm6 *lpm = NULL;
        struct rte_lpm6_config config;
        uint8_t ip[16];
-       uint8_t depth, next_hop_add, next_hop_return;
+       uint8_t depth;
+       uint16_t next_hop_add, next_hop_return;
        int32_t status = 0;

-       config.max_rules = MAX_RULES;
        config.number_tbl8s = NUMBER_TBL8S;
        config.flags = 0;

@@ -1248,15 +1163,15 @@ test19(void)
  * add a more specific rule than the existing rule, lookup again
  */
 int32_t
-test20(void)
+test18(void)
 {
        struct rte_lpm6 *lpm = NULL;
        struct rte_lpm6_config config;
        uint8_t ip[16];
-       uint8_t depth, next_hop_add, next_hop_return;
+       uint8_t depth;
+       uint16_t next_hop_add, next_hop_return;
        int32_t status = 0;

-       config.max_rules = MAX_RULES;
        config.number_tbl8s = NUMBER_TBL8S;
        config.flags = 0;

@@ -1315,16 +1230,16 @@ test20(void)
  * and checks that the result is as expected.
  */
 int32_t
-test21(void)
+test19(void)
 {
        struct rte_lpm6 *lpm = NULL;
        struct rte_lpm6_config config;
        uint8_t ip_batch[4][16];
-       uint8_t depth, next_hop_add;
-       int16_t next_hop_return[4];
+       uint8_t depth;
+       uint16_t next_hop_add;
+       int32_t next_hop_return[4];
        int32_t status = 0;

-       config.max_rules = MAX_RULES;
        config.number_tbl8s = NUMBER_TBL8S;
        config.flags = 0;

@@ -1373,16 +1288,15 @@ test21(void)
  * Use the delete_bulk function to delete the remaining one. Lookup again.
  */
 int32_t
-test22(void)
+test20(void)
 {
        struct rte_lpm6 *lpm = NULL;
        struct rte_lpm6_config config;
        uint8_t ip_batch[5][16];
        uint8_t depth[5], next_hop_add;
-       int16_t next_hop_return[5];
+       int32_t next_hop_return[5];
        int32_t status = 0;

-       config.max_rules = MAX_RULES;
        config.number_tbl8s = NUMBER_TBL8S;
        config.flags = 0;

@@ -1489,16 +1403,16 @@ test22(void)
  * and contraction.
  */
 int32_t
-test23(void)
+test21(void)
 {
        struct rte_lpm6 *lpm = NULL;
        struct rte_lpm6_config config;
        uint32_t i;
        uint8_t ip[16];
-       uint8_t depth, next_hop_add, next_hop_return;
+       uint8_t depth;
+       uint16_t next_hop_add, next_hop_return;
        int32_t status = 0;

-       config.max_rules = MAX_RULES;
        config.number_tbl8s = NUMBER_TBL8S;
        config.flags = 0;

@@ -1537,12 +1451,11 @@ test23(void)
  *  - find non-existing table: miss
  */
 int32_t
-test24(void)
+test22(void)
 {
        struct rte_lpm6 *lpm = NULL, *result = NULL;
        struct rte_lpm6_config config;

-       config.max_rules = 256 * 32;
        config.number_tbl8s = NUMBER_TBL8S;
        config.flags = 0;

@@ -1573,16 +1486,16 @@ test24(void)
  * precalculated by using a python script and stored in a .h file.
  */
 int32_t
-test25(void)
+test23(void)
 {
        struct rte_lpm6 *lpm = NULL;
        struct rte_lpm6_config config;
        uint8_t ip[16];
        uint32_t i;
-       uint8_t depth, next_hop_add, next_hop_return, next_hop_expected;
+       uint8_t depth;
+       uint16_t next_hop_add, next_hop_return, next_hop_expected;
        int32_t status = 0;

-       config.max_rules = MAX_RULES;
        config.number_tbl8s = NUMBER_TBL8S;
        config.flags = 0;

@@ -1619,7 +1532,7 @@ test25(void)
  *     - lookup /32 and /24 rule to ensure the table has not been overwritten.
  */
 int32_t
-test26(void)
+test24(void)
 {
        struct rte_lpm6 *lpm = NULL;
        struct rte_lpm6_config config;
@@ -1629,13 +1542,12 @@ test26(void)
        uint8_t d_ip_10_32 = 32;
        uint8_t d_ip_10_24 = 24;
        uint8_t d_ip_20_25 = 25;
-       uint8_t next_hop_ip_10_32 = 100;
-       uint8_t next_hop_ip_10_24 = 105;
-       uint8_t next_hop_ip_20_25 = 111;
-       uint8_t next_hop_return = 0;
+       uint16_t next_hop_ip_10_32 = 100;
+       uint16_t next_hop_ip_10_24 = 105;
+       uint16_t next_hop_ip_20_25 = 111;
+       uint16_t next_hop_return = 0;
        int32_t status = 0;

-       config.max_rules = MAX_RULES;
        config.number_tbl8s = NUMBER_TBL8S;
        config.flags = 0;

@@ -1647,7 +1559,7 @@ test26(void)
                return -1;

        status = rte_lpm6_lookup(lpm, ip_10_32, &next_hop_return);
-       uint8_t test_hop_10_32 = next_hop_return;
+       uint16_t test_hop_10_32 = next_hop_return;
        TEST_LPM_ASSERT(status == 0);
        TEST_LPM_ASSERT(next_hop_return == next_hop_ip_10_32);

@@ -1656,7 +1568,7 @@ test26(void)
                        return -1;

        status = rte_lpm6_lookup(lpm, ip_10_24, &next_hop_return);
-       uint8_t test_hop_10_24 = next_hop_return;
+       uint16_t test_hop_10_24 = next_hop_return;
        TEST_LPM_ASSERT(status == 0);
        TEST_LPM_ASSERT(next_hop_return == next_hop_ip_10_24);

@@ -1665,7 +1577,7 @@ test26(void)
                return -1;

        status = rte_lpm6_lookup(lpm, ip_20_25, &next_hop_return);
-       uint8_t test_hop_20_25 = next_hop_return;
+       uint16_t test_hop_20_25 = next_hop_return;
        TEST_LPM_ASSERT(status == 0);
        TEST_LPM_ASSERT(next_hop_return == next_hop_ip_20_25);

@@ -1699,16 +1611,16 @@ test26(void)
  * This tests tbl expansion.
  */
 int32_t
-test27(void)
+test25(void)
 {
                struct rte_lpm6 *lpm = NULL;
                struct rte_lpm6_config config;
                uint8_t ip[] = 
{128,128,128,128,128,128,128,128,128,128,128,128,128,128,0,0};
-               uint8_t depth = 128, next_hop_add = 100, next_hop_return;
+               uint8_t depth = 128;
+               uint16_t next_hop_add = 100, next_hop_return;
                int32_t status = 0;
                int i, j;

-               config.max_rules = MAX_RULES;
                config.number_tbl8s = NUMBER_TBL8S;
                config.flags = 0;

diff --git a/app/test/test_lpm6_perf.c b/app/test/test_lpm6_perf.c
index be47d4a..169318c 100644
--- a/app/test/test_lpm6_perf.c
+++ b/app/test/test_lpm6_perf.c
@@ -86,11 +86,10 @@ test_lpm6_perf(void)
        struct rte_lpm6_config config;
        uint64_t begin, total_time;
        unsigned i, j;
-       uint8_t next_hop_add = 0xAA, next_hop_return = 0;
+       uint16_t next_hop_add = 0xAA, next_hop_return = 0;
        int status = 0;
        int64_t count = 0;

-       config.max_rules = 1000000;
        config.number_tbl8s = NUMBER_TBL8S;
        config.flags = 0;

@@ -143,7 +142,7 @@ test_lpm6_perf(void)
        count = 0;

        uint8_t ip_batch[NUM_IPS_ENTRIES][16];
-       int16_t next_hops[NUM_IPS_ENTRIES];
+       int32_t next_hops[NUM_IPS_ENTRIES];

        for (i = 0; i < NUM_IPS_ENTRIES; i++)
                memcpy(ip_batch[i], large_ips_table[i].ip, 16);
@@ -185,3 +184,4 @@ test_lpm6_perf(void)
 }

 REGISTER_TEST_COMMAND(lpm6_perf_autotest, test_lpm6_perf);
+
diff --git a/lib/librte_table/rte_table_lpm_ipv6.c 
b/lib/librte_table/rte_table_lpm_ipv6.c
index 836f4cf..abd5b28 100644
--- a/lib/librte_table/rte_table_lpm_ipv6.c
+++ b/lib/librte_table/rte_table_lpm_ipv6.c
@@ -129,7 +129,6 @@ rte_table_lpm_ipv6_create(void *params, int socket_id, 
uint32_t entry_size)
        }

        /* LPM low-level table creation */
-       lpm6_config.max_rules = p->n_rules;
        lpm6_config.number_tbl8s = p->number_tbl8s;
        lpm6_config.flags = 0;
        lpm->lpm = rte_lpm6_create(p->name, socket_id, &lpm6_config);
@@ -213,7 +212,7 @@ rte_table_lpm_ipv6_entry_add(
                (struct rte_table_lpm_ipv6_key *) key;
        uint32_t nht_pos, nht_pos0_valid;
        int status;
-       uint8_t nht_pos0;
+       uint16_t nht_pos0;

        /* Check input parameters */
        if (lpm == NULL) {
@@ -280,7 +279,7 @@ rte_table_lpm_ipv6_entry_delete(
        struct rte_table_lpm_ipv6 *lpm = (struct rte_table_lpm_ipv6 *) table;
        struct rte_table_lpm_ipv6_key *ip_prefix =
                (struct rte_table_lpm_ipv6_key *) key;
-       uint8_t nht_pos;
+       uint16_t nht_pos;
        int status;

        /* Check input parameters */
@@ -356,7 +355,7 @@ rte_table_lpm_ipv6_lookup(
                        uint8_t *ip = RTE_MBUF_METADATA_UINT8_PTR(pkt,
                                lpm->offset);
                        int status;
-                       uint8_t nht_pos;
+                       uint16_t nht_pos;

                        status = rte_lpm6_lookup(lpm->lpm, ip, &nht_pos);
                        if (status == 0) {
-- 
2.9.2

Reply via email to