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

Function test12

dpdk/app/test/test_lpm6.c:590–623  ·  view source on GitHub ↗

* Creates an LPM table with a small number of tbl8s and exhaust them in the * middle of the process of adding a rule when there is already an existing rule * in that position and needs to be extended. */

Source from the content-addressed store, hash-verified

588 * in that position and needs to be extended.
589 */
590int32_t
591test12(void)
592{
593 struct rte_lpm6 *lpm = NULL;
594 struct rte_lpm6_config config;
595 uint8_t ip[] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
596 uint8_t depth;
597 uint32_t next_hop_add = 100;
598 int32_t status = 0;
599
600 config.max_rules = MAX_RULES;
601 config.number_tbl8s = 16;
602 config.flags = 0;
603
604 lpm = rte_lpm6_create(__func__, SOCKET_ID_ANY, &config);
605 TEST_LPM_ASSERT(lpm != NULL);
606
607 depth = 128;
608 status = rte_lpm6_add(lpm, ip, depth, next_hop_add);
609 TEST_LPM_ASSERT(status == 0);
610
611 ip[0] = 1;
612 depth = 41;
613 status = rte_lpm6_add(lpm, ip, depth, next_hop_add);
614 TEST_LPM_ASSERT(status == 0);
615
616 depth = 49;
617 status = rte_lpm6_add(lpm, ip, depth, next_hop_add);
618 TEST_LPM_ASSERT(status == -ENOSPC);
619
620 rte_lpm6_free(lpm);
621
622 return PASS;
623}
624
625/*
626 * Creates an LPM table with max_rules = 2 and tries to add 3 rules.

Callers

nothing calls this directly

Calls 3

rte_lpm6_createFunction · 0.50
rte_lpm6_addFunction · 0.50
rte_lpm6_freeFunction · 0.50

Tested by

no test coverage detected