Avoids crash due to missing symbol, when build system detects toolchain
which is not able to produce binaries for all targets we need....
Type: fix
Change-Id: I77ee63cb8dca3c9e4e83a6235c60f1439a472444
Signed-off-by: Damjan Marion <damarion@cisco.com>
# limitations under the License.
if(CMAKE_SYSTEM_PROCESSOR MATCHES "amd64.*|x86_64.*|AMD64.*")
# limitations under the License.
if(CMAKE_SYSTEM_PROCESSOR MATCHES "amd64.*|x86_64.*|AMD64.*")
- list(APPEND VARIANTS "sse42\;-march=silvermont")
- list(APPEND VARIANTS "avx2\;-march=core-avx2")
- if(compiler_flag_march_skylake_avx512)
- list(APPEND VARIANTS "avx512\;-march=skylake-avx512")
+ list(APPEND VARIANTS "slm\;-march=silvermont")
+ list(APPEND VARIANTS "hsw\;-march=haswell")
+ if(compiler_flag_march_skylake_avx512 AND compiler_flag_mprefer_vector_width)
+ list(APPEND VARIANTS "skx\;-march=skylake-avx512 -mprefer-vector-width=256")
- if(compiler_flag_march_icelake_client)
- list(APPEND VARIANTS "vaesni\;-march=icelake-client")
+ if(compiler_flag_march_icelake_client AND compiler_flag_mprefer_vector_width)
+ list(APPEND VARIANTS "icl\;-march=icelake-client -mprefer-vector-width=512")
endif()
set (COMPILE_FILES aes_cbc.c aes_gcm.c)
set (COMPILE_OPTS -Wall -fno-common -maes)
endif()
set (COMPILE_FILES aes_cbc.c aes_gcm.c)
set (COMPILE_OPTS -Wall -fno-common -maes)
set(l crypto_native_${v})
add_library(${l} OBJECT ${COMPILE_FILES})
set_target_properties(${l} PROPERTIES POSITION_INDEPENDENT_CODE ON)
set(l crypto_native_${v})
add_library(${l} OBJECT ${COMPILE_FILES})
set_target_properties(${l} PROPERTIES POSITION_INDEPENDENT_CODE ON)
target_compile_options(${l} PUBLIC ${f} ${COMPILE_OPTS})
target_sources(crypto_native_plugin PRIVATE $<TARGET_OBJECTS:${l}>)
endforeach()
target_compile_options(${l} PUBLIC ${f} ${COMPILE_OPTS})
target_sources(crypto_native_plugin PRIVATE $<TARGET_OBJECTS:${l}>)
endforeach()
clib_error_t *
#ifdef __VAES__
clib_error_t *
#ifdef __VAES__
-crypto_native_aes_cbc_init_vaes (vlib_main_t * vm)
+crypto_native_aes_cbc_init_icl (vlib_main_t * vm)
-crypto_native_aes_cbc_init_avx512 (vlib_main_t * vm)
+crypto_native_aes_cbc_init_skx (vlib_main_t * vm)
#elif __aarch64__
crypto_native_aes_cbc_init_neon (vlib_main_t * vm)
#elif __AVX2__
#elif __aarch64__
crypto_native_aes_cbc_init_neon (vlib_main_t * vm)
#elif __AVX2__
-crypto_native_aes_cbc_init_avx2 (vlib_main_t * vm)
+crypto_native_aes_cbc_init_hsw (vlib_main_t * vm)
-crypto_native_aes_cbc_init_sse42 (vlib_main_t * vm)
+crypto_native_aes_cbc_init_slm (vlib_main_t * vm)
#endif
{
crypto_native_main_t *cm = &crypto_native_main;
#endif
{
crypto_native_main_t *cm = &crypto_native_main;
clib_error_t *
#ifdef __VAES__
clib_error_t *
#ifdef __VAES__
-crypto_native_aes_gcm_init_vaes (vlib_main_t * vm)
+crypto_native_aes_gcm_init_icl (vlib_main_t * vm)
-crypto_native_aes_gcm_init_avx512 (vlib_main_t * vm)
+crypto_native_aes_gcm_init_skx (vlib_main_t * vm)
-crypto_native_aes_gcm_init_avx2 (vlib_main_t * vm)
+crypto_native_aes_gcm_init_hsw (vlib_main_t * vm)
#elif __aarch64__
crypto_native_aes_gcm_init_neon (vlib_main_t * vm)
#else
#elif __aarch64__
crypto_native_aes_gcm_init_neon (vlib_main_t * vm)
#else
-crypto_native_aes_gcm_init_sse42 (vlib_main_t * vm)
+crypto_native_aes_gcm_init_slm (vlib_main_t * vm)
#endif
{
crypto_native_main_t *cm = &crypto_native_main;
#endif
{
crypto_native_main_t *cm = &crypto_native_main;
extern crypto_native_main_t crypto_native_main;
extern crypto_native_main_t crypto_native_main;
-clib_error_t *crypto_native_aes_cbc_init_sse42 (vlib_main_t * vm);
-clib_error_t *crypto_native_aes_cbc_init_avx2 (vlib_main_t * vm);
-clib_error_t *crypto_native_aes_cbc_init_avx512 (vlib_main_t * vm);
-clib_error_t *crypto_native_aes_cbc_init_vaes (vlib_main_t * vm);
-clib_error_t *crypto_native_aes_cbc_init_neon (vlib_main_t * vm);
-
-clib_error_t *crypto_native_aes_gcm_init_sse42 (vlib_main_t * vm);
-clib_error_t *crypto_native_aes_gcm_init_avx2 (vlib_main_t * vm);
-clib_error_t *crypto_native_aes_gcm_init_avx512 (vlib_main_t * vm);
-clib_error_t *crypto_native_aes_gcm_init_vaes (vlib_main_t * vm);
-clib_error_t *crypto_native_aes_gcm_init_neon (vlib_main_t * vm);
+#define foreach_crypto_native_march_variant _(slm) _(hsw) _(skx) _(icl) _(neon)
+
+#define _(v) \
+clib_error_t __clib_weak *crypto_native_aes_cbc_init_##v (vlib_main_t * vm); \
+clib_error_t __clib_weak *crypto_native_aes_gcm_init_##v (vlib_main_t * vm); \
+
+foreach_crypto_native_march_variant;
+#undef _
+
#endif /* __crypto_native_h__ */
/*
#endif /* __crypto_native_h__ */
/*
vnet_crypto_register_engine (vm, "native", 100,
"Native ISA Optimized Crypto");
vnet_crypto_register_engine (vm, "native", 100,
"Native ISA Optimized Crypto");
- if (clib_cpu_supports_vaes ())
- error = crypto_native_aes_cbc_init_vaes (vm);
- else if (clib_cpu_supports_avx512f ())
- error = crypto_native_aes_cbc_init_avx512 (vm);
- else if (clib_cpu_supports_avx2 ())
- error = crypto_native_aes_cbc_init_avx2 (vm);
+ else if (crypto_native_aes_cbc_init_icl && clib_cpu_supports_vaes ())
+ error = crypto_native_aes_cbc_init_icl (vm);
+ else if (crypto_native_aes_cbc_init_skx && clib_cpu_supports_avx512f ())
+ error = crypto_native_aes_cbc_init_skx (vm);
+ else if (crypto_native_aes_cbc_init_hsw && clib_cpu_supports_avx2 ())
+ error = crypto_native_aes_cbc_init_hsw (vm);
+ else if (crypto_native_aes_cbc_init_slm)
+ error = crypto_native_aes_cbc_init_slm (vm);
+#endif
+#if __aarch64__
+ else if (crypto_native_aes_cbc_init_neon)
+ error = crypto_native_aes_cbc_init_neon (vm);
+#endif
- error = crypto_native_aes_cbc_init_sse42 (vm);
+ error = clib_error_return (0, "No AES CBC implemenation available");
if (clib_cpu_supports_pclmulqdq ())
{
if (clib_cpu_supports_pclmulqdq ())
{
- if (clib_cpu_supports_vaes ())
- error = crypto_native_aes_gcm_init_vaes (vm);
- else if (clib_cpu_supports_avx512f ())
- error = crypto_native_aes_gcm_init_avx512 (vm);
- else if (clib_cpu_supports_avx2 ())
- error = crypto_native_aes_gcm_init_avx2 (vm);
+ if (crypto_native_aes_gcm_init_icl && clib_cpu_supports_vaes ())
+ error = crypto_native_aes_gcm_init_icl (vm);
+ else if (crypto_native_aes_gcm_init_skx && clib_cpu_supports_avx512f ())
+ error = crypto_native_aes_gcm_init_skx (vm);
+ else if (crypto_native_aes_gcm_init_hsw && clib_cpu_supports_avx2 ())
+ error = crypto_native_aes_gcm_init_hsw (vm);
+ else if (crypto_native_aes_gcm_init_slm)
+ error = crypto_native_aes_gcm_init_slm (vm);
- error = crypto_native_aes_gcm_init_sse42 (vm);
+ error = clib_error_return (0, "No AES GCM implemenation available");
if (error)
goto error;
}
#endif
#if __aarch64__
if (error)
goto error;
}
#endif
#if __aarch64__
- if ((error = crypto_native_aes_cbc_init_neon (vm)))
- goto error;
+ if (crypto_native_aes_gcm_init_neon)
+ error = crypto_native_aes_gcm_init_neon (vm);
+ else
+ error = clib_error_return (0, "No AES GCM implemenation available");
- if ((error = crypto_native_aes_gcm_init_neon (vm)))