* - Add & lookup to hit invalid TBL24 entry * - Add & lookup to hit valid TBL24 entry not extended * - Add & lookup to hit valid extended TBL24 entry with invalid TBL8 entry * - Add & lookup to hit valid extended TBL24 entry with valid TBL8 entry */
| 870 | * - Add & lookup to hit valid extended TBL24 entry with valid TBL8 entry |
| 871 | */ |
| 872 | int32_t |
| 873 | test18(void) |
| 874 | { |
| 875 | struct rte_lpm6 *lpm = NULL; |
| 876 | struct rte_lpm6_config config; |
| 877 | uint8_t ip[16], ip_1[16], ip_2[16]; |
| 878 | uint8_t depth, depth_1, depth_2; |
| 879 | uint32_t next_hop_add, next_hop_add_1, |
| 880 | next_hop_add_2, next_hop_return; |
| 881 | int32_t status = 0; |
| 882 | |
| 883 | config.max_rules = MAX_RULES; |
| 884 | config.number_tbl8s = NUMBER_TBL8S; |
| 885 | config.flags = 0; |
| 886 | |
| 887 | /* Add & lookup to hit invalid TBL24 entry */ |
| 888 | IPv6(ip, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); |
| 889 | depth = 24; |
| 890 | next_hop_add = 100; |
| 891 | |
| 892 | lpm = rte_lpm6_create(__func__, SOCKET_ID_ANY, &config); |
| 893 | TEST_LPM_ASSERT(lpm != NULL); |
| 894 | |
| 895 | status = rte_lpm6_add(lpm, ip, depth, next_hop_add); |
| 896 | TEST_LPM_ASSERT(status == 0); |
| 897 | |
| 898 | status = rte_lpm6_lookup(lpm, ip, &next_hop_return); |
| 899 | TEST_LPM_ASSERT((status == 0) && (next_hop_return == next_hop_add)); |
| 900 | |
| 901 | status = rte_lpm6_delete(lpm, ip, depth); |
| 902 | TEST_LPM_ASSERT(status == 0); |
| 903 | |
| 904 | status = rte_lpm6_lookup(lpm, ip, &next_hop_return); |
| 905 | TEST_LPM_ASSERT(status == -ENOENT); |
| 906 | |
| 907 | rte_lpm6_delete_all(lpm); |
| 908 | |
| 909 | /* Add & lookup to hit valid TBL24 entry not extended */ |
| 910 | IPv6(ip, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); |
| 911 | depth = 23; |
| 912 | next_hop_add = 100; |
| 913 | |
| 914 | status = rte_lpm6_add(lpm, ip, depth, next_hop_add); |
| 915 | TEST_LPM_ASSERT(status == 0); |
| 916 | |
| 917 | status = rte_lpm6_lookup(lpm, ip, &next_hop_return); |
| 918 | TEST_LPM_ASSERT((status == 0) && (next_hop_return == next_hop_add)); |
| 919 | |
| 920 | depth = 24; |
| 921 | next_hop_add = 101; |
| 922 | |
| 923 | status = rte_lpm6_add(lpm, ip, depth, next_hop_add); |
| 924 | TEST_LPM_ASSERT(status == 0); |
| 925 | |
| 926 | status = rte_lpm6_lookup(lpm, ip, &next_hop_return); |
| 927 | TEST_LPM_ASSERT((status == 0) && (next_hop_return == next_hop_add)); |
| 928 | |
| 929 | depth = 24; |
nothing calls this directly
no test coverage detected