diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/vnet/classify/vnet_classify.c | 11 | ||||
-rw-r--r-- | src/vnet/classify/vnet_classify.h | 7 |
2 files changed, 9 insertions, 9 deletions
diff --git a/src/vnet/classify/vnet_classify.c b/src/vnet/classify/vnet_classify.c index 48d444271c5..796250735e4 100644 --- a/src/vnet/classify/vnet_classify.c +++ b/src/vnet/classify/vnet_classify.c @@ -139,7 +139,7 @@ vnet_classify_new_table (vnet_classify_main_t *cm, const u8 *mask, pool_get_aligned_zero (cm->tables, t, CLIB_CACHE_LINE_BYTES); - vec_validate_aligned (t->mask, match_n_vectors - 1, sizeof (u32x4)); + clib_memset_u32 (t->mask, 0, 4 * ARRAY_LEN (t->mask)); clib_memcpy_fast (t->mask, mask, match_n_vectors * sizeof (u32x4)); t->next_table_index = ~0; @@ -175,7 +175,6 @@ vnet_classify_delete_table_index (vnet_classify_main_t * cm, /* Recursively delete the entire chain */ vnet_classify_delete_table_index (cm, t->next_table_index, del_chain); - vec_free (t->mask); vec_free (t->buckets); clib_mem_destroy_heap (t->mheap); pool_put (cm->tables, t); @@ -1649,13 +1648,13 @@ filter_table_mask_compare (void *a1, void *a2) m1 = (u8 *) (t1->mask); m2 = (u8 *) (t2->mask); - for (i = 0; i < vec_len (t1->mask) * sizeof (u32x4); i++) + for (i = 0; i < t1->match_n_vectors * sizeof (u32x4); i++) { n1 += count_set_bits (m1[0]); m1++; } - for (i = 0; i < vec_len (t2->mask) * sizeof (u32x4); i++) + for (i = 0; i < t2->match_n_vectors * sizeof (u32x4); i++) { n2 += count_set_bits (m2[0]); m2++; @@ -1815,11 +1814,11 @@ classify_lookup_chain (u32 table_index, u8 * mask, u32 n_skip, u32 n_match) continue; /* Masks aren't congruent, can't use this table. */ - if (vec_len (t->mask) * sizeof (u32x4) != vec_len (mask)) + if (t->match_n_vectors * sizeof (u32x4) != vec_len (mask)) continue; /* Masks aren't bit-for-bit identical, can't use this table. */ - if (memcmp (t->mask, mask, vec_len (mask))) + if (memcmp (t->mask, mask, t->match_n_vectors * sizeof (u32x4))) continue; /* Winner... */ diff --git a/src/vnet/classify/vnet_classify.h b/src/vnet/classify/vnet_classify.h index 06784e0541e..196a24172cc 100644 --- a/src/vnet/classify/vnet_classify.h +++ b/src/vnet/classify/vnet_classify.h @@ -147,9 +147,6 @@ typedef struct typedef struct { CLIB_CACHE_LINE_ALIGN_MARK (cacheline0); - /* Mask to apply after skipping N vectors */ - u32x4 *mask; - /* hash Buckets */ vnet_classify_bucket_t *buckets; @@ -196,6 +193,10 @@ typedef struct /* Writer (only) lock for this table */ clib_spinlock_t writer_lock; + CLIB_CACHE_LINE_ALIGN_MARK (cacheline2); + /* Mask to apply after skipping N vectors */ + u32x4 mask[8]; + } vnet_classify_table_t; /** |