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

Function test13

dpdk/app/test/test_lpm6.c:629–669  ·  view source on GitHub ↗

* Creates an LPM table with max_rules = 2 and tries to add 3 rules. * Delete one of the rules and tries to add the third one again. */

Source from the content-addressed store, hash-verified

627 * Delete one of the rules and tries to add the third one again.
628 */
629int32_t
630test13(void)
631{
632 struct rte_lpm6 *lpm = NULL;
633 struct rte_lpm6_config config;
634 uint8_t ip[] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
635 uint8_t depth;
636 uint32_t next_hop_add = 100;
637 int32_t status = 0;
638
639 config.max_rules = 2;
640 config.number_tbl8s = NUMBER_TBL8S;
641 config.flags = 0;
642
643 lpm = rte_lpm6_create(__func__, SOCKET_ID_ANY, &config);
644 TEST_LPM_ASSERT(lpm != NULL);
645
646 depth = 1;
647 status = rte_lpm6_add(lpm, ip, depth, next_hop_add);
648 TEST_LPM_ASSERT(status == 0);
649
650 depth = 2;
651 status = rte_lpm6_add(lpm, ip, depth, next_hop_add);
652 TEST_LPM_ASSERT(status == 0);
653
654 depth = 3;
655 status = rte_lpm6_add(lpm, ip, depth, next_hop_add);
656 TEST_LPM_ASSERT(status == -ENOSPC);
657
658 depth = 2;
659 status = rte_lpm6_delete(lpm, ip, depth);
660 TEST_LPM_ASSERT(status == 0);
661
662 depth = 3;
663 status = rte_lpm6_add(lpm, ip, depth, next_hop_add);
664 TEST_LPM_ASSERT(status == 0);
665
666 rte_lpm6_free(lpm);
667
668 return PASS;
669}
670
671/*
672 * Add 2^12 routes with different first 12 bits and depth 25.

Callers

nothing calls this directly

Calls 4

rte_lpm6_createFunction · 0.50
rte_lpm6_addFunction · 0.50
rte_lpm6_deleteFunction · 0.50
rte_lpm6_freeFunction · 0.50

Tested by

no test coverage detected