summaryrefslogtreecommitdiff
path: root/lib/dpif-netdev-avx512.c
diff options
context:
space:
mode:
authorHarry van Haaren <harry.van.haaren@intel.com>2021-07-09 15:58:18 +0000
committerIan Stokes <ian.stokes@intel.com>2021-07-09 17:13:24 +0100
commitabb807e27dd4b1449429eb813858ef237665fbfd (patch)
tree7c73a9750cd0499a912b0f027d455ef59c3760ca /lib/dpif-netdev-avx512.c
parent9ac84a1a3698526c964f0bf883fe3c4f2e081e28 (diff)
downloadopenvswitch-abb807e27dd4b1449429eb813858ef237665fbfd.tar.gz
dpif-netdev: Add command to switch dpif implementation.
This commit adds a new command to allow the user to switch the active DPIF implementation at runtime. A probe function is executed before switching the DPIF implementation, to ensure the CPU is capable of running the ISA required. For example, the below code will switch to the AVX512 enabled DPIF assuming that the runtime CPU is capable of running AVX512 instructions: $ ovs-appctl dpif-netdev/dpif-impl-set dpif_avx512 A new configuration flag is added to allow selection of the default DPIF. This is useful for running the unit-tests against the available DPIF implementations, without modifying each unit test. The design of the testing & validation for ISA optimized DPIF implementations is based around the work already upstream for DPCLS. Note however that a DPCLS lookup has no state or side-effects, allowing the auto-validator implementation to perform multiple lookups and provide consistent statistic counters. The DPIF component does have state, so running two implementations in parallel and comparing output is not a valid testing method, as there are changes in DPIF statistic counters (side effects). As a result, the DPIF is tested directly against the unit-tests. Signed-off-by: Harry van Haaren <harry.van.haaren@intel.com> Co-authored-by: Cian Ferriter <cian.ferriter@intel.com> Signed-off-by: Cian Ferriter <cian.ferriter@intel.com> Acked-by: Flavio Leitner <fbl@sysclose.org> Signed-off-by: Ian Stokes <ian.stokes@intel.com>
Diffstat (limited to 'lib/dpif-netdev-avx512.c')
-rw-r--r--lib/dpif-netdev-avx512.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/dpif-netdev-avx512.c b/lib/dpif-netdev-avx512.c
index f59c1bbe0..1ae66ca6c 100644
--- a/lib/dpif-netdev-avx512.c
+++ b/lib/dpif-netdev-avx512.c
@@ -24,6 +24,7 @@
#include "dpif-netdev-perf.h"
#include "dpif-netdev-private.h"
+#include <errno.h>
#include <immintrin.h>
#include "dp-packet.h"
@@ -58,6 +59,19 @@ struct dpif_userdata {
};
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,
odp_port_t in_port)