f-stack/dpdk/lib/librte_eal/common/eal_common_cpuflags.c

40 lines
869 B
C
Raw Normal View History

2019-06-25 11:12:58 +00:00
/* SPDX-License-Identifier: BSD-3-Clause
* Copyright(c) 2010-2014 Intel Corporation
2017-04-21 10:43:26 +00:00
*/
#include <stdio.h>
#include <rte_common.h>
#include <rte_cpuflags.h>
int
rte_cpu_is_supported(void)
2017-04-21 10:43:26 +00:00
{
/* This is generated at compile-time by the build system */
static const enum rte_cpu_flag_t compile_time_flags[] = {
RTE_COMPILE_TIME_CPUFLAGS
};
unsigned count = RTE_DIM(compile_time_flags), i;
int ret;
for (i = 0; i < count; i++) {
ret = rte_cpu_get_flag_enabled(compile_time_flags[i]);
if (ret < 0) {
fprintf(stderr,
"ERROR: CPU feature flag lookup failed with error %d\n",
ret);
return 0;
2017-04-21 10:43:26 +00:00
}
if (!ret) {
fprintf(stderr,
"ERROR: This system does not support \"%s\".\n"
"Please check that RTE_MACHINE is set correctly.\n",
rte_cpu_get_flag_name(compile_time_flags[i]));
return 0;
2017-04-21 10:43:26 +00:00
}
}
return 1;
2017-04-21 10:43:26 +00:00
}