vppinfra: don't call dlmalloc API directly from the code
[vpp.git] / src / vnet / classify / vnet_classify.h
index c08cedf..f0c8124 100644 (file)
@@ -21,6 +21,7 @@
 #include <vppinfra/error.h>
 #include <vppinfra/hash.h>
 #include <vppinfra/cache.h>
+#include <vppinfra/crc32.h>
 #include <vppinfra/xxhash.h>
 
 extern vlib_node_registration_t ip4_classify_node;
@@ -280,7 +281,11 @@ vnet_classify_hash_packet_inline (vnet_classify_table_t * t, u8 * h)
     }
 #endif /* CLIB_HAVE_VEC128 */
 
+#ifdef clib_crc32c_uses_intrinsics
+  return clib_crc32c ((u8 *) & xor_sum, sizeof (xor_sum));
+#else
   return clib_xxhash (xor_sum.as_u64[0] ^ xor_sum.as_u64[1]);
+#endif
 }
 
 static inline void
@@ -298,7 +303,7 @@ vnet_classify_prefetch_bucket (vnet_classify_table_t * t, u64 hash)
 static inline vnet_classify_entry_t *
 vnet_classify_get_entry (vnet_classify_table_t * t, uword offset)
 {
-  u8 *hp = t->mheap;
+  u8 *hp = clib_mem_get_heap_base (t->mheap);
   u8 *vp = hp + offset;
 
   return (void *) vp;
@@ -310,7 +315,7 @@ vnet_classify_get_offset (vnet_classify_table_t * t,
 {
   u8 *hp, *vp;
 
-  hp = (u8 *) t->mheap;
+  hp = (u8 *) clib_mem_get_heap_base (t->mheap);
   vp = (u8 *) v;
 
   ASSERT ((vp - hp) < 0x100000000ULL);