2017-12-19 15:49:03 +00:00
|
|
|
/* SPDX-License-Identifier: BSD-3-Clause
|
|
|
|
* Copyright(c) 2010-2014 Intel Corporation
|
2012-09-04 13:54:00 +01:00
|
|
|
*/
|
2016-02-03 00:10:23 +01:00
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
2015-07-09 16:25:12 +08:00
|
|
|
#include <rte_common.h>
|
2012-09-04 13:54:00 +01:00
|
|
|
#include <rte_cpuflags.h>
|
|
|
|
|
2017-03-22 16:19:28 -04:00
|
|
|
int
|
|
|
|
rte_cpu_is_supported(void)
|
2012-09-04 13:54:00 +01: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
|
|
|
|
};
|
2015-07-09 16:25:12 +08:00
|
|
|
unsigned count = RTE_DIM(compile_time_flags), i;
|
2014-03-25 15:52:59 -04:00
|
|
|
int ret;
|
2012-09-04 13:54:00 +01:00
|
|
|
|
2015-07-09 16:25:12 +08:00
|
|
|
for (i = 0; i < count; i++) {
|
2014-03-25 15:52:59 -04:00
|
|
|
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);
|
2017-03-22 16:19:28 -04:00
|
|
|
return 0;
|
2014-03-25 15:52:59 -04:00
|
|
|
}
|
|
|
|
if (!ret) {
|
2012-09-04 13:54:00 +01:00
|
|
|
fprintf(stderr,
|
|
|
|
"ERROR: This system does not support \"%s\".\n"
|
|
|
|
"Please check that RTE_MACHINE is set correctly.\n",
|
2016-02-02 23:59:49 +01:00
|
|
|
rte_cpu_get_flag_name(compile_time_flags[i]));
|
2017-03-22 16:19:28 -04:00
|
|
|
return 0;
|
2012-09-04 13:54:00 +01:00
|
|
|
}
|
2014-04-16 06:50:40 -04:00
|
|
|
}
|
2017-03-22 16:19:28 -04:00
|
|
|
|
|
|
|
return 1;
|
2012-09-04 13:54:00 +01:00
|
|
|
}
|