the implementation of algorithm to generate large IPS table * at run time. if gen_expected_nex_hop is non-zero, the expected * next_hop of the IPv6 address of each item in IPS table is computed. */
| 1126 | * next_hop of the IPv6 address of each item in IPS table is computed. |
| 1127 | */ |
| 1128 | static void generate_large_ips_table(int gen_expected_next_hop) |
| 1129 | { |
| 1130 | uint32_t i, j, k; |
| 1131 | |
| 1132 | for (i = 0; i < NUM_IPS_ENTRIES; i++) { |
| 1133 | for (j = 0; j < 16; j++) |
| 1134 | large_ips_table[i].ip[j] = rte_rand(); |
| 1135 | } |
| 1136 | |
| 1137 | for (k = j = 0, i = 0; i < NUM_IPS_ENTRIES; i++) { |
| 1138 | mask_ip6_prefix(large_ips_table[i].ip, |
| 1139 | large_route_table[j].ip, large_route_table[j].depth); |
| 1140 | k++; |
| 1141 | if (k == (NUM_IPS_ENTRIES / NUM_ROUTE_ENTRIES)) { |
| 1142 | j++; |
| 1143 | k = 0; |
| 1144 | } |
| 1145 | if (j == NUM_ROUTE_ENTRIES) |
| 1146 | j = 0; |
| 1147 | } |
| 1148 | |
| 1149 | if (gen_expected_next_hop == 0) |
| 1150 | return; |
| 1151 | |
| 1152 | for (k = 0; k < NUM_IPS_ENTRIES; k++) |
| 1153 | get_next_hop(large_ips_table[k].ip, |
| 1154 | &(large_ips_table[k].next_hop), |
| 1155 | large_route_table, |
| 1156 | NUM_ROUTE_ENTRIES); |
| 1157 | |
| 1158 | } |
| 1159 | |
| 1160 | #endif /* _TEST_LPM_ROUTES_H_ */ |
no test coverage detected