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

Function test18

dpdk/app/test/test_lpm6.c:872–1022  ·  view source on GitHub ↗

* - Add & lookup to hit invalid TBL24 entry * - Add & lookup to hit valid TBL24 entry not extended * - Add & lookup to hit valid extended TBL24 entry with invalid TBL8 entry * - Add & lookup to hit valid extended TBL24 entry with valid TBL8 entry */

Source from the content-addressed store, hash-verified

870 * - Add & lookup to hit valid extended TBL24 entry with valid TBL8 entry
871 */
872int32_t
873test18(void)
874{
875 struct rte_lpm6 *lpm = NULL;
876 struct rte_lpm6_config config;
877 uint8_t ip[16], ip_1[16], ip_2[16];
878 uint8_t depth, depth_1, depth_2;
879 uint32_t next_hop_add, next_hop_add_1,
880 next_hop_add_2, next_hop_return;
881 int32_t status = 0;
882
883 config.max_rules = MAX_RULES;
884 config.number_tbl8s = NUMBER_TBL8S;
885 config.flags = 0;
886
887 /* Add & lookup to hit invalid TBL24 entry */
888 IPv6(ip, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
889 depth = 24;
890 next_hop_add = 100;
891
892 lpm = rte_lpm6_create(__func__, SOCKET_ID_ANY, &config);
893 TEST_LPM_ASSERT(lpm != NULL);
894
895 status = rte_lpm6_add(lpm, ip, depth, next_hop_add);
896 TEST_LPM_ASSERT(status == 0);
897
898 status = rte_lpm6_lookup(lpm, ip, &next_hop_return);
899 TEST_LPM_ASSERT((status == 0) && (next_hop_return == next_hop_add));
900
901 status = rte_lpm6_delete(lpm, ip, depth);
902 TEST_LPM_ASSERT(status == 0);
903
904 status = rte_lpm6_lookup(lpm, ip, &next_hop_return);
905 TEST_LPM_ASSERT(status == -ENOENT);
906
907 rte_lpm6_delete_all(lpm);
908
909 /* Add & lookup to hit valid TBL24 entry not extended */
910 IPv6(ip, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
911 depth = 23;
912 next_hop_add = 100;
913
914 status = rte_lpm6_add(lpm, ip, depth, next_hop_add);
915 TEST_LPM_ASSERT(status == 0);
916
917 status = rte_lpm6_lookup(lpm, ip, &next_hop_return);
918 TEST_LPM_ASSERT((status == 0) && (next_hop_return == next_hop_add));
919
920 depth = 24;
921 next_hop_add = 101;
922
923 status = rte_lpm6_add(lpm, ip, depth, next_hop_add);
924 TEST_LPM_ASSERT(status == 0);
925
926 status = rte_lpm6_lookup(lpm, ip, &next_hop_return);
927 TEST_LPM_ASSERT((status == 0) && (next_hop_return == next_hop_add));
928
929 depth = 24;

Callers

nothing calls this directly

Calls 7

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_delete_allFunction · 0.50
rte_lpm6_freeFunction · 0.50

Tested by

no test coverage detected