| 64 | } |
| 65 | |
| 66 | static int |
| 67 | test_fib6_perf(void) |
| 68 | { |
| 69 | struct rte_fib6 *fib = NULL; |
| 70 | struct rte_fib6_conf conf; |
| 71 | uint64_t begin, total_time; |
| 72 | unsigned int i, j; |
| 73 | uint64_t next_hop_add; |
| 74 | int status = 0; |
| 75 | int64_t count = 0; |
| 76 | uint8_t ip_batch[NUM_IPS_ENTRIES][16]; |
| 77 | uint64_t next_hops[NUM_IPS_ENTRIES]; |
| 78 | |
| 79 | conf.type = RTE_FIB6_TRIE; |
| 80 | conf.default_nh = 0; |
| 81 | conf.max_routes = 1000000; |
| 82 | conf.rib_ext_sz = 0; |
| 83 | conf.trie.nh_sz = RTE_FIB6_TRIE_4B; |
| 84 | conf.trie.num_tbl8 = RTE_MIN(get_max_nh(conf.trie.nh_sz), 1000000U); |
| 85 | |
| 86 | rte_srand(rte_rdtsc()); |
| 87 | |
| 88 | printf("No. routes = %u\n", (unsigned int) NUM_ROUTE_ENTRIES); |
| 89 | |
| 90 | print_route_distribution(large_route_table, |
| 91 | (uint32_t)NUM_ROUTE_ENTRIES); |
| 92 | |
| 93 | /* Only generate IPv6 address of each item in large IPS table, |
| 94 | * here next_hop is not needed. |
| 95 | */ |
| 96 | generate_large_ips_table(0); |
| 97 | |
| 98 | fib = rte_fib6_create(__func__, SOCKET_ID_ANY, &conf); |
| 99 | TEST_FIB_ASSERT(fib != NULL); |
| 100 | |
| 101 | /* Measure add. */ |
| 102 | begin = rte_rdtsc(); |
| 103 | |
| 104 | for (i = 0; i < NUM_ROUTE_ENTRIES; i++) { |
| 105 | next_hop_add = (i & ((1 << 14) - 1)) + 1; |
| 106 | if (rte_fib6_add(fib, large_route_table[i].ip, |
| 107 | large_route_table[i].depth, next_hop_add) == 0) |
| 108 | status++; |
| 109 | } |
| 110 | /* End Timer. */ |
| 111 | total_time = rte_rdtsc() - begin; |
| 112 | |
| 113 | printf("Unique added entries = %d\n", status); |
| 114 | printf("Average FIB Add: %g cycles\n", |
| 115 | (double)total_time / NUM_ROUTE_ENTRIES); |
| 116 | |
| 117 | /* Measure bulk Lookup */ |
| 118 | total_time = 0; |
| 119 | count = 0; |
| 120 | |
| 121 | for (i = 0; i < NUM_IPS_ENTRIES; i++) |
| 122 | memcpy(ip_batch[i], large_ips_table[i].ip, 16); |
| 123 |
nothing calls this directly
no test coverage detected