classify: use clib_crc32c on supporting uarch 99/26399/10
authorRay Kinsella <mdr@ashroe.eu>
Tue, 7 Apr 2020 06:51:23 +0000 (07:51 +0100)
committerDamjan Marion <dmarion@me.com>
Mon, 28 Sep 2020 16:40:56 +0000 (16:40 +0000)
Use clib_crc32c in place of clib_xxhash on supporting uarch.

Type: improvement

Signed-off-by: Ray Kinsella <mdr@ashroe.eu>
Change-Id: Icdfb4ffa92c2c9e7aebc3ec99f20e91392a103ab

src/vnet/classify/vnet_classify.h

index c08cedf..db3821b 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