* Adds 3 rules and look them up through the lookup_bulk function. * Includes in the lookup a fourth IP address that won't match * and checks that the result is as expected. */
| 1300 | * and checks that the result is as expected. |
| 1301 | */ |
| 1302 | int32_t |
| 1303 | test21(void) |
| 1304 | { |
| 1305 | struct rte_lpm6 *lpm = NULL; |
| 1306 | struct rte_lpm6_config config; |
| 1307 | uint8_t ip_batch[4][16]; |
| 1308 | uint8_t depth; |
| 1309 | uint32_t next_hop_add; |
| 1310 | int32_t next_hop_return[4]; |
| 1311 | int32_t status = 0; |
| 1312 | |
| 1313 | config.max_rules = MAX_RULES; |
| 1314 | config.number_tbl8s = NUMBER_TBL8S; |
| 1315 | config.flags = 0; |
| 1316 | |
| 1317 | lpm = rte_lpm6_create(__func__, SOCKET_ID_ANY, &config); |
| 1318 | TEST_LPM_ASSERT(lpm != NULL); |
| 1319 | |
| 1320 | IPv6(ip_batch[0], 128, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); |
| 1321 | depth = 48; |
| 1322 | next_hop_add = 100; |
| 1323 | |
| 1324 | status = rte_lpm6_add(lpm, ip_batch[0], depth, next_hop_add); |
| 1325 | TEST_LPM_ASSERT(status == 0); |
| 1326 | |
| 1327 | IPv6(ip_batch[1], 128, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); |
| 1328 | depth = 48; |
| 1329 | next_hop_add = 101; |
| 1330 | |
| 1331 | status = rte_lpm6_add(lpm, ip_batch[1], depth, next_hop_add); |
| 1332 | TEST_LPM_ASSERT(status == 0); |
| 1333 | |
| 1334 | IPv6(ip_batch[2], 128, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); |
| 1335 | depth = 48; |
| 1336 | next_hop_add = 102; |
| 1337 | |
| 1338 | status = rte_lpm6_add(lpm, ip_batch[2], depth, next_hop_add); |
| 1339 | TEST_LPM_ASSERT(status == 0); |
| 1340 | |
| 1341 | IPv6(ip_batch[3], 128, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); |
| 1342 | |
| 1343 | status = rte_lpm6_lookup_bulk_func(lpm, ip_batch, |
| 1344 | next_hop_return, 4); |
| 1345 | TEST_LPM_ASSERT(status == 0 && next_hop_return[0] == 100 |
| 1346 | && next_hop_return[1] == 101 && next_hop_return[2] == 102 |
| 1347 | && next_hop_return[3] == -1); |
| 1348 | |
| 1349 | rte_lpm6_free(lpm); |
| 1350 | |
| 1351 | return PASS; |
| 1352 | } |
| 1353 | |
| 1354 | /* |
| 1355 | * Adds 5 rules and look them up. |
nothing calls this directly
no test coverage detected