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

Function gen_random_rt_4

dpdk/app/test-fib/main.c:323–347  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

321}
322
323static void
324gen_random_rt_4(struct rt_rule_4 *rt, int nh_sz)
325{
326 uint32_t i, j, k = 0;
327
328 if (config.nb_routes_per_depth[0] != 0) {
329 rt[k].addr = 0;
330 rt[k].depth = 0;
331 rt[k++].nh = rte_rand() & get_max_nh(nh_sz);
332 }
333
334 for (i = 1; i <= 32; i++) {
335 double edge = 0;
336 double step;
337 step = (double)(1ULL << i) / config.nb_routes_per_depth[i];
338 for (j = 0; j < config.nb_routes_per_depth[i];
339 j++, k++, edge += step) {
340 uint64_t rnd_val = get_rnd_rng((uint64_t)edge,
341 (uint64_t)(edge + step));
342 rt[k].addr = rnd_val << (32 - i);
343 rt[k].depth = i;
344 rt[k].nh = rte_rand() & get_max_nh(nh_sz);
345 }
346 }
347}
348
349static void
350complete_v6_addr(uint32_t *addr, uint32_t rnd, int n)

Callers 1

mainFunction · 0.85

Calls 3

rte_randFunction · 0.85
get_max_nhFunction · 0.70
get_rnd_rngFunction · 0.70

Tested by

no test coverage detected