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

Function build_common_root

dpdk/lib/fib/trie.c:284–314  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

282}
283
284static inline int
285build_common_root(struct rte_trie_tbl *dp, const uint8_t *ip,
286 int common_bytes, void **tbl)
287{
288 void *tbl_ptr = NULL;
289 uint64_t *cur_tbl;
290 uint64_t val;
291 int i, j, idx, prev_idx = 0;
292
293 cur_tbl = dp->tbl24;
294 for (i = 3, j = 0; i <= common_bytes; i++) {
295 idx = get_idx(ip, prev_idx, i - j, j);
296 val = get_tbl_val_by_idx(cur_tbl, idx, dp->nh_sz);
297 tbl_ptr = get_tbl_p_by_idx(cur_tbl, idx, dp->nh_sz);
298 if ((val & TRIE_EXT_ENT) != TRIE_EXT_ENT) {
299 idx = tbl8_alloc(dp, val);
300 if (unlikely(idx < 0))
301 return idx;
302 write_to_dp(tbl_ptr, (idx << 1) |
303 TRIE_EXT_ENT, dp->nh_sz, 1);
304 prev_idx = idx;
305 } else
306 prev_idx = val >> 1;
307
308 j = i;
309 cur_tbl = dp->tbl8;
310 }
311 *tbl = get_tbl_p_by_idx(cur_tbl, prev_idx * TRIE_TBL8_GRP_NUM_ENT,
312 dp->nh_sz);
313 return 0;
314}
315
316static int
317write_edge(struct rte_trie_tbl *dp, const uint8_t *ip_part, uint64_t next_hop,

Callers 1

install_to_dpFunction · 0.85

Calls 5

get_idxFunction · 0.85
get_tbl_val_by_idxFunction · 0.85
get_tbl_p_by_idxFunction · 0.85
write_to_dpFunction · 0.85
tbl8_allocFunction · 0.70

Tested by

no test coverage detected