1 /* SPDX-License-Identifier: BSD-3-Clause 2 * Copyright(c) 2010-2014 Intel Corporation 3 */ 4 5 #include <stdio.h> 6 7 #include <rte_common.h> 8 #include <rte_cpuflags.h> 9 10 int rte_cpu_is_supported(void)11rte_cpu_is_supported(void) 12 { 13 /* This is generated at compile-time by the build system */ 14 static const enum rte_cpu_flag_t compile_time_flags[] = { 15 RTE_COMPILE_TIME_CPUFLAGS 16 }; 17 unsigned count = RTE_DIM(compile_time_flags), i; 18 int ret; 19 20 for (i = 0; i < count; i++) { 21 ret = rte_cpu_get_flag_enabled(compile_time_flags[i]); 22 23 if (ret < 0) { 24 fprintf(stderr, 25 "ERROR: CPU feature flag lookup failed with error %d\n", 26 ret); 27 return 0; 28 } 29 if (!ret) { 30 fprintf(stderr, 31 "ERROR: This system does not support \"%s\".\n" 32 "Please check that RTE_MACHINE is set correctly.\n", 33 rte_cpu_get_flag_name(compile_time_flags[i])); 34 return 0; 35 } 36 } 37 38 return 1; 39 } 40