#include <vlib/threads.h>
#include <vnet/fib/fib_entry.h>
#include <vnet/fib/fib_table.h>
+#include <vnet/fib/ip4_fib.h>
#include <vnet/dpo/load_balance.h>
#define STATS_DEBUG 0
void
dslock (stats_main_t * sm, int release_hint, int tag)
{
- u32 thread_id;
+ u32 thread_index;
data_structure_lock_t *l = sm->data_structure_lock;
if (PREDICT_FALSE (l == 0))
return;
- thread_id = os_get_cpu_number ();
- if (l->lock && l->thread_id == thread_id)
+ thread_index = vlib_get_thread_index ();
+ if (l->lock && l->thread_index == thread_index)
{
l->count++;
return;
while (__sync_lock_test_and_set (&l->lock, 1))
/* zzzz */ ;
l->tag = tag;
- l->thread_id = thread_id;
+ l->thread_index = thread_index;
l->count = 1;
}
void
dsunlock (stats_main_t * sm)
{
- u32 thread_id;
+ u32 thread_index;
data_structure_lock_t *l = sm->data_structure_lock;
if (PREDICT_FALSE (l == 0))
return;
- thread_id = os_get_cpu_number ();
- ASSERT (l->lock && l->thread_id == thread_id);
+ thread_index = vlib_get_thread_index ();
+ ASSERT (l->lock && l->thread_index == thread_index);
l->count--;
if (l->count == 0)
{
static ip4_route_t *routes;
ip4_route_t *r;
fib_table_t *fib;
+ ip4_fib_t *v4_fib;
ip_lookup_main_t *lm = &im4->lookup_main;
static uword *results;
vl_api_vnet_ip4_fib_counters_t *mp = 0;
while ((fib - im4->fibs) < start_at_fib_index)
continue;
+ v4_fib = pool_elt_at_index (im4->v4_fibs, fib->ft_index);
+
if (mp == 0)
{
items_this_message = IP4_FIB_COUNTER_BATCH_SIZE;
vec_reset_length (routes);
vec_reset_length (results);
- for (i = 0; i < ARRAY_LEN (fib->v4.fib_entry_by_dst_address); i++)
+ for (i = 0; i < ARRAY_LEN (v4_fib->fib_entry_by_dst_address); i++)
{
- uword *hash = fib->v4.fib_entry_by_dst_address[i];
+ uword *hash = v4_fib->fib_entry_by_dst_address[i];
hash_pair_t *p;
ip4_route_t x;