@@ -58,19 +58,6 @@ struct dpif_userdata {
struct pkt_flow_meta pkt_meta[NETDEV_MAX_BURST];
};
-int32_t
-dp_netdev_input_outer_avx512_probe(void)
-{
- bool avx512f_available = dpdk_get_cpu_has_isa("x86_64", "avx512f");
- bool bmi2_available = dpdk_get_cpu_has_isa("x86_64", "bmi2");
-
- if (!avx512f_available || !bmi2_available) {
- return -ENOTSUP;
- }
-
- return 0;
-}
-
int32_t
dp_netdev_input_outer_avx512(struct dp_netdev_pmd_thread *pmd,
struct dp_packet_batch *packets,
@@ -43,7 +43,6 @@
#include <string.h>
#include "flow.h"
-#include "dpdk.h"
#include "dpif-netdev-private-dpcls.h"
#include "dpif-netdev-private-extract.h"
@@ -663,47 +662,5 @@ DECLARE_MFEX_FUNC(ip_udp, PROFILE_ETH_IPV4_UDP)
DECLARE_MFEX_FUNC(ip_tcp, PROFILE_ETH_IPV4_TCP)
DECLARE_MFEX_FUNC(dot1q_ip_udp, PROFILE_ETH_VLAN_IPV4_UDP)
DECLARE_MFEX_FUNC(dot1q_ip_tcp, PROFILE_ETH_VLAN_IPV4_TCP)
-
-
-static int32_t
-avx512_isa_probe(uint32_t needs_vbmi)
-{
- static const char *isa_required[] = {
- "avx512f",
- "avx512bw",
- "bmi2",
- };
-
- int32_t ret = 0;
- for (uint32_t i = 0; i < ARRAY_SIZE(isa_required); i++) {
- if (!dpdk_get_cpu_has_isa("x86_64", isa_required[i])) {
- ret = -ENOTSUP;
- }
- }
-
- if (needs_vbmi) {
- if (!dpdk_get_cpu_has_isa("x86_64", "avx512vbmi")) {
- ret = -ENOTSUP;
- }
- }
-
- return ret;
-}
-
-/* Probe functions to check ISA requirements. */
-int32_t
-mfex_avx512_probe(void)
-{
- const uint32_t needs_vbmi = 0;
- return avx512_isa_probe(needs_vbmi);
-}
-
-int32_t
-mfex_avx512_vbmi_probe(void)
-{
- const uint32_t needs_vbmi = 1;
- return avx512_isa_probe(needs_vbmi);
-}
-
#endif /* __CHECKER__ */
#endif /* __x86_64__ */
@@ -394,18 +394,11 @@ dpcls_avx512_gather_mf_any(struct dpcls_subtable *subtable, uint32_t keys_map,
}
dpcls_subtable_lookup_func
-dpcls_subtable_avx512_gather_probe(uint32_t u0_bits, uint32_t u1_bits)
+dpcls_subtable_avx512_gather_probe__(uint32_t u0_bits, uint32_t u1_bits,
+ bool use_vpop)
{
dpcls_subtable_lookup_func f = NULL;
- int avx512f_available = dpdk_get_cpu_has_isa("x86_64", "avx512f");
- int bmi2_available = dpdk_get_cpu_has_isa("x86_64", "bmi2");
- if (!avx512f_available || !bmi2_available) {
- return NULL;
- }
-
- int use_vpop = dpdk_get_cpu_has_isa("x86_64", "avx512vpopcntdq");
-
CHECK_LOOKUP_FUNCTION(9, 4, use_vpop);
CHECK_LOOKUP_FUNCTION(9, 1, use_vpop);
CHECK_LOOKUP_FUNCTION(5, 3, use_vpop);
@@ -22,6 +22,20 @@
VLOG_DEFINE_THIS_MODULE(dpif_netdev_lookup);
+#if (__x86_64__ && HAVE_AVX512F && HAVE_LD_AVX512_GOOD && __SSE4_2__)
+static dpcls_subtable_lookup_func
+dpcls_subtable_avx512_gather_probe(uint32_t u0_bits, uint32_t u1_bits)
+{
+ if (!dpdk_get_cpu_has_isa("x86_64", "avx512f")
+ || !dpdk_get_cpu_has_isa("x86_64", "bmi2")) {
+ return NULL;
+ }
+
+ return dpcls_subtable_avx512_gather_probe__(u0_bits, u1_bits,
+ dpdk_get_cpu_has_isa("x86_64", "avx512vpopcntdq"));
+}
+#endif
+
/* Actual list of implementations goes here */
static struct dpcls_subtable_lookup_info_t subtable_lookups[] = {
/* The autovalidator implementation will not be used by default, it must
@@ -44,7 +44,8 @@ dpcls_subtable_generic_probe(uint32_t u0_bit_count, uint32_t u1_bit_count);
/* Probe function for AVX-512 gather implementation */
dpcls_subtable_lookup_func
-dpcls_subtable_avx512_gather_probe(uint32_t u0_bit_cnt, uint32_t u1_bit_cnt);
+dpcls_subtable_avx512_gather_probe__(uint32_t u0_bit_cnt, uint32_t u1_bit_cnt,
+ bool use_vpop);
/* Subtable registration and iteration helpers */
@@ -33,6 +33,19 @@ enum dpif_netdev_impl_info_idx {
DPIF_NETDEV_IMPL_AVX512
};
+#if (__x86_64__ && HAVE_AVX512F && HAVE_LD_AVX512_GOOD && __SSE4_2__)
+static int32_t
+dp_netdev_input_outer_avx512_probe(void)
+{
+ if (!dpdk_get_cpu_has_isa("x86_64", "avx512f")
+ || !dpdk_get_cpu_has_isa("x86_64", "bmi2")) {
+ return -ENOTSUP;
+ }
+
+ return 0;
+}
+#endif
+
/* Actual list of implementations goes here. */
static struct dpif_netdev_impl_info_t dpif_impls[] = {
/* The default scalar C code implementation. */
@@ -67,10 +67,7 @@ dp_netdev_input(struct dp_netdev_pmd_thread *pmd,
struct dp_packet_batch *packets,
odp_port_t in_port);
-/* AVX512 enabled DPIF implementation and probe functions. */
-int32_t
-dp_netdev_input_outer_avx512_probe(void);
-
+/* AVX512 enabled DPIF implementation function. */
int32_t
dp_netdev_input_outer_avx512(struct dp_netdev_pmd_thread *pmd,
struct dp_packet_batch *packets,
@@ -33,6 +33,43 @@ VLOG_DEFINE_THIS_MODULE(dpif_netdev_extract);
/* Variable to hold the default MFEX implementation. */
static ATOMIC(miniflow_extract_func) default_mfex_func;
+#if (__x86_64__ && HAVE_AVX512F && HAVE_LD_AVX512_GOOD && __SSE4_2__)
+static int32_t
+avx512_isa_probe(bool needs_vbmi)
+{
+ static const char *isa_required[] = {
+ "avx512f",
+ "avx512bw",
+ "bmi2",
+ };
+
+ for (uint32_t i = 0; i < ARRAY_SIZE(isa_required); i++) {
+ if (!dpdk_get_cpu_has_isa("x86_64", isa_required[i])) {
+ return -ENOTSUP;
+ }
+ }
+
+ if (needs_vbmi && !dpdk_get_cpu_has_isa("x86_64", "avx512vbmi")) {
+ return -ENOTSUP;
+ }
+
+ return 0;
+}
+
+/* Probe functions to check ISA requirements. */
+static int32_t
+mfex_avx512_probe(void)
+{
+ return avx512_isa_probe(false);
+}
+
+static int32_t
+mfex_avx512_vbmi_probe(void)
+{
+ return avx512_isa_probe(true);
+}
+#endif
+
/* Implementations of available extract options and
* the implementations are always in order of preference.
*/
@@ -176,10 +176,8 @@ mfex_study_traffic(struct dp_packet_batch *packets,
int
mfex_set_study_pkt_cnt(uint32_t pkt_cmp_count, const char *name);
-/* AVX512 MFEX Probe and Implementations functions. */
+/* AVX512 MFEX Implementation functions. */
#ifdef __x86_64__
-int32_t mfex_avx512_probe(void);
-int32_t mfex_avx512_vbmi_probe(void);
#define DECLARE_AVX512_MFEX_PROTOTYPE(name) \
uint32_t \