- vlib_cli_output (vm, "%U, fib_index %d, flow hash: %U",
- format_fib_table_name, fib->index, FIB_PROTOCOL_IP4,
- fib->index,
- format_ip_flow_hash_config, fib_table->ft_flow_hash_config);
+ if (memory)
+ {
+ uword mtrie_size, hash_size, *old_heap;
+
+
+ mtrie_size = ip4_fib_mtrie_memory_usage(&fib->mtrie);
+ hash_size = 0;
+
+ old_heap = clib_mem_set_heap (ip4_main.mtrie_mheap);
+ for (i = 0; i < ARRAY_LEN (fib->fib_entry_by_dst_address); i++)
+ {
+ uword * hash = fib->fib_entry_by_dst_address[i];
+ if (NULL != hash)
+ {
+ hash_size += hash_bytes(hash);
+ }
+ }
+ clib_mem_set_heap (old_heap);
+
+ if (verbose)
+ vlib_cli_output (vm, "%U mtrie:%d hash:%d",
+ format_fib_table_name, fib->index,
+ FIB_PROTOCOL_IP4,
+ mtrie_size,
+ hash_size);
+ total_mtrie_memory += mtrie_size;
+ total_hash_memory += hash_size;
+ continue;
+ }
+
+ s = format(s, "%U, fib_index:%d, flow hash:[%U] epoch:%d flags:%U locks:[",
+ format_fib_table_name, fib->index,
+ FIB_PROTOCOL_IP4,
+ fib->index,
+ format_ip_flow_hash_config,
+ fib_table->ft_flow_hash_config,
+ fib_table->ft_epoch,
+ format_fib_table_flags, fib_table->ft_flags);
+ vec_foreach_index(source, fib_table->ft_locks)
+ {
+ if (0 != fib_table->ft_locks[source])
+ {
+ s = format(s, "%U:%d, ",
+ format_fib_source, source,
+ fib_table->ft_locks[source]);
+ }
+ }
+ s = format (s, "]");
+ vlib_cli_output (vm, "%v", s);
+ vec_free(s);