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

Function modify_fib

dpdk/lib/fib/dir24_8.c:361–409  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

359}
360
361static int
362modify_fib(struct dir24_8_tbl *dp, struct rte_rib *rib, uint32_t ip,
363 uint8_t depth, uint64_t next_hop)
364{
365 struct rte_rib_node *tmp = NULL;
366 uint32_t ledge, redge, tmp_ip;
367 int ret;
368 uint8_t tmp_depth;
369
370 ledge = ip;
371 do {
372 tmp = rte_rib_get_nxt(rib, ip, depth, tmp,
373 RTE_RIB_GET_NXT_COVER);
374 if (tmp != NULL) {
375 rte_rib_get_depth(tmp, &tmp_depth);
376 if (tmp_depth == depth)
377 continue;
378 rte_rib_get_ip(tmp, &tmp_ip);
379 redge = tmp_ip & rte_rib_depth_to_mask(tmp_depth);
380 if (ledge == redge) {
381 ledge = redge +
382 (uint32_t)(1ULL << (32 - tmp_depth));
383 continue;
384 }
385 ret = install_to_fib(dp, ledge, redge,
386 next_hop);
387 if (ret != 0)
388 return ret;
389 ledge = redge +
390 (uint32_t)(1ULL << (32 - tmp_depth));
391 /*
392 * we got to the end of address space
393 * and wrapped around
394 */
395 if (ledge == 0)
396 break;
397 } else {
398 redge = ip + (uint32_t)(1ULL << (32 - depth));
399 if (ledge == redge && ledge != 0)
400 break;
401 ret = install_to_fib(dp, ledge, redge,
402 next_hop);
403 if (ret != 0)
404 return ret;
405 }
406 } while (tmp);
407
408 return 0;
409}
410
411int
412dir24_8_modify(struct rte_fib *fib, uint32_t ip, uint8_t depth,

Callers 1

dir24_8_modifyFunction · 0.85

Calls 5

rte_rib_get_nxtFunction · 0.85
rte_rib_get_depthFunction · 0.85
rte_rib_get_ipFunction · 0.85
rte_rib_depth_to_maskFunction · 0.85
install_to_fibFunction · 0.85

Tested by

no test coverage detected