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

Function test23

dpdk/app/test/test_lpm6.c:1478–1518  ·  view source on GitHub ↗

* Add an extended rule (i.e. depth greater than 24, lookup (hit), delete, * lookup (miss) in a for loop of 30 times. This will check tbl8 extension * and contraction. */

Source from the content-addressed store, hash-verified

1476 * and contraction.
1477 */
1478int32_t
1479test23(void)
1480{
1481 struct rte_lpm6 *lpm = NULL;
1482 struct rte_lpm6_config config;
1483 uint32_t i;
1484 uint8_t ip[16];
1485 uint8_t depth;
1486 uint32_t next_hop_add, next_hop_return;
1487 int32_t status = 0;
1488
1489 config.max_rules = MAX_RULES;
1490 config.number_tbl8s = NUMBER_TBL8S;
1491 config.flags = 0;
1492
1493 lpm = rte_lpm6_create(__func__, SOCKET_ID_ANY, &config);
1494 TEST_LPM_ASSERT(lpm != NULL);
1495
1496 IPv6(ip, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
1497 depth = 128;
1498 next_hop_add = 100;
1499
1500 for (i = 0; i < 30; i++) {
1501 status = rte_lpm6_add(lpm, ip, depth, next_hop_add);
1502 TEST_LPM_ASSERT(status == 0);
1503
1504 status = rte_lpm6_lookup(lpm, ip, &next_hop_return);
1505 TEST_LPM_ASSERT((status == 0) &&
1506 (next_hop_return == next_hop_add));
1507
1508 status = rte_lpm6_delete(lpm, ip, depth);
1509 TEST_LPM_ASSERT(status == 0);
1510
1511 status = rte_lpm6_lookup(lpm, ip, &next_hop_return);
1512 TEST_LPM_ASSERT(status == -ENOENT);
1513 }
1514
1515 rte_lpm6_free(lpm);
1516
1517 return PASS;
1518}
1519
1520/*
1521 * Sequence of operations for find existing lpm table

Callers

nothing calls this directly

Calls 6

IPv6Function · 0.85
rte_lpm6_createFunction · 0.50
rte_lpm6_addFunction · 0.50
rte_lpm6_lookupFunction · 0.50
rte_lpm6_deleteFunction · 0.50
rte_lpm6_freeFunction · 0.50

Tested by

no test coverage detected