40 #ifndef included_ip_ip4_fib_h 41 #define included_ip_ip4_fib_h 54 #define IP4_FIB_MTRIE_LEAF_EMPTY (1 + 2*0) 62 #define PLY_16_SIZE (1<<16) 72 #ifdef CLIB_HAVE_VEC128 95 #ifdef CLIB_HAVE_VEC128 96 u32x4 leaves_as_u32x4[256 / 4];
123 "IP4 Mtrie ply cache line");
154 u32 dst_address_length,
u32 adj_index);
160 u32 dst_address_length,
162 u32 cover_address_length,
u32 cover_adj_index);
198 ip4_fib_mtrie_leaf_t current_leaf,
200 u32 dst_address_byte_index)
202 ip4_fib_mtrie_8_ply_t *ply;
206 if (!current_is_terminal)
208 ply = ip4_ply_pool + (current_leaf >> 1);
209 return (ply->
leaves[dst_address->
as_u8[dst_address_byte_index]]);
222 ip4_fib_mtrie_leaf_t next_leaf;
u8 pad[3]
log2 (size of the packing page block)
STATIC_ASSERT(0==sizeof(ip4_fib_mtrie_8_ply_t)%CLIB_CACHE_LINE_BYTES,"IP4 Mtrie ply cache line")
static ip4_fib_mtrie_leaf_t ip4_fib_mtrie_lookup_step(const ip4_fib_mtrie_t *m, ip4_fib_mtrie_leaf_t current_leaf, const ip4_address_t *dst_address, u32 dst_address_byte_index)
Lookup step.
void ip4_mtrie_free(ip4_fib_mtrie_t *m)
Free an mtrie, It must be emty when free'd.
Definitions for all things IP (v4|v6) unicast and multicast lookup related.
ip4_fib_mtrie_leaf_t leaves[256]
#define PLY_16_SIZE
the 16 way stride that is the top PLY of the mtrie We do not maintain the count of 'real' leaves in t...
u8 dst_address_bits_of_leaves[PLY_16_SIZE]
Prefix length for terminal leaves.
One ply of the 4 ply mtrie fib.
void ip4_fib_mtrie_route_del(ip4_fib_mtrie_t *m, const ip4_address_t *dst_address, u32 dst_address_length, u32 adj_index, u32 cover_address_length, u32 cover_adj_index)
remove a route/rntry to the mtrie
ip4_fib_mtrie_leaf_t leaves[PLY_16_SIZE]
static u32 ip4_fib_mtrie_leaf_get_adj_index(ip4_fib_mtrie_leaf_t n)
From the stored slot value extract the LB index value.
struct ip4_fib_mtrie_8_ply_t_ ip4_fib_mtrie_8_ply_t
One ply of the 4 ply mtrie fib.
ip4_fib_mtrie_8_ply_t * ip4_ply_pool
A global pool of 8bit stride plys.
ip4_fib_mtrie_16_ply_t root_ply
Embed the PLY with the mtrie struct.
void ip4_fib_mtrie_route_add(ip4_fib_mtrie_t *m, const ip4_address_t *dst_address, u32 dst_address_length, u32 adj_index)
Add a route/rntry to the mtrie.
static ip4_fib_mtrie_leaf_t ip4_fib_mtrie_lookup_step_one(const ip4_fib_mtrie_t *m, const ip4_address_t *dst_address)
Lookup step number 1.
i32 n_non_empty_leafs
Number of non-empty leafs (whether terminal or not).
i32 dst_address_bits_base
The length of the ply's coviering prefix.
format_function_t format_ip4_fib_mtrie
Format/display the contents of the mtrie.
void ip4_mtrie_init(ip4_fib_mtrie_t *m)
Initialise an mtrie.
#define CLIB_CACHE_LINE_BYTES
struct ip4_fib_mtrie_16_ply_t_ ip4_fib_mtrie_16_ply_t
static u32 ip4_fib_mtrie_leaf_is_terminal(ip4_fib_mtrie_leaf_t n)
Is the leaf terminal (i.e.