2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-31 06:15:47 +00:00

dpif-netdev: Call cpuid for x86 isa availability.

DPIF AVX512 optimizations currently rely on DPDK availability while
they can be used without DPDK.
Besides, checking for availability of some isa only has to be done once
and won't change while a OVS process runs.

Resolve isa availability in constructors by using a simplified query
based on cpuid API that comes from the compiler.

Note: this also fixes the check on BMI2 availability: DPDK had a bug
for this isa, see https://git.dpdk.org/dpdk/commit/?id=aae3037ab1e0.

Suggested-by: Ilya Maximets <i.maximets@ovn.org>
Signed-off-by: David Marchand <david.marchand@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
This commit is contained in:
David Marchand
2021-12-15 17:35:33 +01:00
committed by Ilya Maximets
parent 11441385c2
commit b366fa2f49
9 changed files with 119 additions and 74 deletions

View File

@@ -20,6 +20,7 @@
#include <config.h>
#include "cpu.h"
#include "dpif-netdev.h"
#include "dpif-netdev-perf.h"
#include "dpif-netdev-private.h"
@@ -61,8 +62,8 @@ 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");
bool avx512f_available = cpu_has_isa(OVS_CPU_ISA_X86_AVX512F);
bool bmi2_available = cpu_has_isa(OVS_CPU_ISA_X86_BMI2);
if (!avx512f_available || !bmi2_available) {
return -ENOTSUP;