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

Function tbl8_get_idx

dpdk/lib/fib/dir24_8.c:148–163  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

146}
147
148static int
149tbl8_get_idx(struct dir24_8_tbl *dp)
150{
151 uint32_t i;
152 int bit_idx;
153
154 for (i = 0; (i < (dp->number_tbl8s >> BITMAP_SLAB_BIT_SIZE_LOG2)) &&
155 (dp->tbl8_idxes[i] == UINT64_MAX); i++)
156 ;
157 if (i < (dp->number_tbl8s >> BITMAP_SLAB_BIT_SIZE_LOG2)) {
158 bit_idx = rte_ctz64(~dp->tbl8_idxes[i]);
159 dp->tbl8_idxes[i] |= (1ULL << bit_idx);
160 return (i << BITMAP_SLAB_BIT_SIZE_LOG2) + bit_idx;
161 }
162 return -ENOSPC;
163}
164
165static inline void
166tbl8_free_idx(struct dir24_8_tbl *dp, int idx)

Callers 2

tbl8_allocFunction · 0.85
install_to_fibFunction · 0.85

Calls 1

rte_ctz64Function · 0.85

Tested by

no test coverage detected