The preprocessor comparison string to check AVX512 capabilities are lengthy and effecting user readability. Simpify this by aliasing the checks.
Suggested-by: Eelco Chaudron <[email protected]> Signed-off-by: Sunil Pai G <[email protected]> --- lib/dpif-netdev-private-dpif.c | 6 ++++-- lib/dpif-netdev-private-extract.c | 3 +-- lib/dpif-netdev-private-extract.h | 10 +++++----- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/lib/dpif-netdev-private-dpif.c b/lib/dpif-netdev-private-dpif.c index 84d4ec156..ffd6ff907 100644 --- a/lib/dpif-netdev-private-dpif.c +++ b/lib/dpif-netdev-private-dpif.c @@ -27,6 +27,8 @@ #include "util.h" VLOG_DEFINE_THIS_MODULE(dpif_netdev_impl); +#define DPIF_NETDEV_IMPL_AVX512_CHECK (__x86_64__ && HAVE_AVX512F \ + && HAVE_LD_AVX512_GOOD && __SSE4_2__) enum dpif_netdev_impl_info_idx { DPIF_NETDEV_IMPL_SCALAR, @@ -40,7 +42,7 @@ static struct dpif_netdev_impl_info_t dpif_impls[] = { .probe = NULL, .name = "dpif_scalar", }, -#if (__x86_64__ && HAVE_AVX512F && HAVE_LD_AVX512_GOOD && __SSE4_2__) +#if DPIF_NETDEV_IMPL_AVX512_CHECK /* Only available on x86_64 bit builds with SSE 4.2 used for OVS core. */ [DPIF_NETDEV_IMPL_AVX512] = { .input_func = dp_netdev_input_outer_avx512, .probe = dp_netdev_input_outer_avx512_probe, @@ -59,7 +61,7 @@ dp_netdev_impl_get_default(void) int dpif_idx = DPIF_NETDEV_IMPL_SCALAR; /* Configure-time overriding to run test suite on all implementations. */ -#if (__x86_64__ && HAVE_AVX512F && HAVE_LD_AVX512_GOOD && __SSE4_2__) +#if DPIF_NETDEV_IMPL_AVX512_CHECK #ifdef DPIF_AVX512_DEFAULT dp_netdev_input_func_probe probe; diff --git a/lib/dpif-netdev-private-extract.c b/lib/dpif-netdev-private-extract.c index 9ce4e0909..a70ab6a4d 100644 --- a/lib/dpif-netdev-private-extract.c +++ b/lib/dpif-netdev-private-extract.c @@ -54,8 +54,7 @@ static struct dpif_miniflow_extract_impl mfex_impls[] = { .name = "study", }, /* Compile in implementations only if the compiler ISA checks pass. */ -#if (__x86_64__ && HAVE_AVX512F && HAVE_LD_AVX512_GOOD && HAVE_AVX512BW \ - && __SSE4_2__) +#if MFEX_IMPL_AVX512_CHECK #if HAVE_AVX512VBMI [MFEX_IMPL_VBMI_IPv4_UDP] = { .probe = mfex_avx512_vbmi_probe, diff --git a/lib/dpif-netdev-private-extract.h b/lib/dpif-netdev-private-extract.h index 092126106..b2cd6779d 100644 --- a/lib/dpif-netdev-private-extract.h +++ b/lib/dpif-netdev-private-extract.h @@ -19,6 +19,9 @@ #include <sys/types.h> +#define MFEX_IMPL_AVX512_CHECK (__x86_64__ && HAVE_AVX512F \ + && HAVE_LD_AVX512_GOOD && HAVE_AVX512BW && __SSE4_2__) + /* Forward declarations. */ struct dp_packet; struct miniflow; @@ -81,8 +84,7 @@ enum dpif_miniflow_extract_impl_idx { MFEX_IMPL_AUTOVALIDATOR, MFEX_IMPL_SCALAR, MFEX_IMPL_STUDY, -#if (__x86_64__ && HAVE_AVX512F && HAVE_LD_AVX512_GOOD && HAVE_AVX512BW \ - && __SSE4_2__) +#if MFEX_IMPL_AVX512_CHECK #if HAVE_AVX512VBMI MFEX_IMPL_VBMI_IPv4_UDP, #endif @@ -108,9 +110,7 @@ extern struct ovs_mutex dp_netdev_mutex; /* Define a index which points to the first traffic optimized MFEX * option from the enum list else holds max value. */ -#if (__x86_64__ && HAVE_AVX512F && HAVE_LD_AVX512_GOOD && HAVE_AVX512BW \ - && __SSE4_2__) - +#if MFEX_IMPL_AVX512_CHECK #if HAVE_AVX512VBMI #define MFEX_IMPL_START_IDX MFEX_IMPL_VBMI_IPv4_UDP #else -- 2.36.1 _______________________________________________ dev mailing list [email protected] https://mail.openvswitch.org/mailman/listinfo/ovs-dev
