MCPcopy Create free account
hub / github.com/F-Stack/f-stack / test22

Function test22

dpdk/app/test/test_lpm6.c:1361–1471  ·  view source on GitHub ↗

* Adds 5 rules and look them up. * Use the delete_bulk function to delete two of them. Lookup again. * Use the delete_bulk function to delete one more. Lookup again. * Use the delete_bulk function to delete two more, one invalid. Lookup again. * Use the delete_bulk function to delete the remaining one. Lookup again. */

Source from the content-addressed store, hash-verified

1359 * Use the delete_bulk function to delete the remaining one. Lookup again.
1360 */
1361int32_t
1362test22(void)
1363{
1364 struct rte_lpm6 *lpm = NULL;
1365 struct rte_lpm6_config config;
1366 uint8_t ip_batch[5][16];
1367 uint8_t depth[5];
1368 uint32_t next_hop_add;
1369 int32_t next_hop_return[5];
1370 int32_t status = 0;
1371
1372 config.max_rules = MAX_RULES;
1373 config.number_tbl8s = NUMBER_TBL8S;
1374 config.flags = 0;
1375
1376 lpm = rte_lpm6_create(__func__, SOCKET_ID_ANY, &config);
1377 TEST_LPM_ASSERT(lpm != NULL);
1378
1379 /* Adds 5 rules and look them up */
1380
1381 IPv6(ip_batch[0], 128, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
1382 depth[0] = 48;
1383 next_hop_add = 101;
1384
1385 status = rte_lpm6_add(lpm, ip_batch[0], depth[0], next_hop_add);
1386 TEST_LPM_ASSERT(status == 0);
1387
1388 IPv6(ip_batch[1], 128, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
1389 depth[1] = 48;
1390 next_hop_add = 102;
1391
1392 status = rte_lpm6_add(lpm, ip_batch[1], depth[1], next_hop_add);
1393 TEST_LPM_ASSERT(status == 0);
1394
1395 IPv6(ip_batch[2], 128, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
1396 depth[2] = 48;
1397 next_hop_add = 103;
1398
1399 status = rte_lpm6_add(lpm, ip_batch[2], depth[2], next_hop_add);
1400 TEST_LPM_ASSERT(status == 0);
1401
1402 IPv6(ip_batch[3], 128, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
1403 depth[3] = 48;
1404 next_hop_add = 104;
1405
1406 status = rte_lpm6_add(lpm, ip_batch[3], depth[3], next_hop_add);
1407 TEST_LPM_ASSERT(status == 0);
1408
1409 IPv6(ip_batch[4], 128, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
1410 depth[4] = 48;
1411 next_hop_add = 105;
1412
1413 status = rte_lpm6_add(lpm, ip_batch[4], depth[4], next_hop_add);
1414 TEST_LPM_ASSERT(status == 0);
1415
1416 status = rte_lpm6_lookup_bulk_func(lpm, ip_batch,
1417 next_hop_return, 5);
1418 TEST_LPM_ASSERT(status == 0 && next_hop_return[0] == 101

Callers

nothing calls this directly

Calls 6

IPv6Function · 0.85
rte_lpm6_createFunction · 0.50
rte_lpm6_addFunction · 0.50
rte_lpm6_freeFunction · 0.50

Tested by

no test coverage detected