2018-12-06 14:17:51 +00:00
|
|
|
/* SPDX-License-Identifier: BSD-3-Clause
|
|
|
|
* Copyright(c) 2010-2014 Intel Corporation
|
2017-04-21 10:43:26 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _RTE_CPUFLAGS_H_
|
|
|
|
#define _RTE_CPUFLAGS_H_
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @file
|
|
|
|
* Architecture specific API to determine available CPU features at runtime.
|
|
|
|
*/
|
|
|
|
|
2018-05-15 09:49:22 +00:00
|
|
|
#include "rte_common.h"
|
2017-04-21 10:43:26 +00:00
|
|
|
#include <errno.h>
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Enumeration of all CPU features supported
|
|
|
|
*/
|
2018-05-15 09:49:22 +00:00
|
|
|
__extension__
|
2017-04-21 10:43:26 +00:00
|
|
|
enum rte_cpu_flag_t;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get name of CPU flag
|
|
|
|
*
|
|
|
|
* @param feature
|
|
|
|
* CPU flag ID
|
|
|
|
* @return
|
|
|
|
* flag name
|
|
|
|
* NULL if flag ID is invalid
|
|
|
|
*/
|
2018-05-15 09:49:22 +00:00
|
|
|
__extension__
|
2017-04-21 10:43:26 +00:00
|
|
|
const char *
|
|
|
|
rte_cpu_get_flag_name(enum rte_cpu_flag_t feature);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function for checking a CPU flag availability
|
|
|
|
*
|
|
|
|
* @param feature
|
|
|
|
* CPU flag to query CPU for
|
|
|
|
* @return
|
|
|
|
* 1 if flag is available
|
|
|
|
* 0 if flag is not available
|
|
|
|
* -ENOENT if flag is invalid
|
|
|
|
*/
|
2018-05-15 09:49:22 +00:00
|
|
|
__extension__
|
2017-04-21 10:43:26 +00:00
|
|
|
int
|
|
|
|
rte_cpu_get_flag_enabled(enum rte_cpu_flag_t feature);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This function checks that the currently used CPU supports the CPU features
|
|
|
|
* that were specified at compile time. It is called automatically within the
|
|
|
|
* EAL, so does not need to be used by applications.
|
|
|
|
*/
|
2018-05-15 09:49:22 +00:00
|
|
|
__rte_deprecated
|
2017-04-21 10:43:26 +00:00
|
|
|
void
|
|
|
|
rte_cpu_check_supported(void);
|
|
|
|
|
2018-05-15 09:49:22 +00:00
|
|
|
/**
|
|
|
|
* This function checks that the currently used CPU supports the CPU features
|
|
|
|
* that were specified at compile time. It is called automatically within the
|
|
|
|
* EAL, so does not need to be used by applications. This version returns a
|
|
|
|
* result so that decisions may be made (for instance, graceful shutdowns).
|
|
|
|
*/
|
|
|
|
int
|
|
|
|
rte_cpu_is_supported(void);
|
|
|
|
|
2018-12-06 14:17:51 +00:00
|
|
|
/**
|
|
|
|
* This function attempts to retrieve a value from the auxiliary vector.
|
|
|
|
* If it is unsuccessful, the result will be 0, and errno will be set.
|
|
|
|
*
|
|
|
|
* @return A value from the auxiliary vector. When the value is 0, check
|
|
|
|
* errno to determine if an error occurred.
|
|
|
|
*/
|
|
|
|
unsigned long
|
|
|
|
rte_cpu_getauxval(unsigned long type);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This function retrieves a value from the auxiliary vector, and compares it
|
|
|
|
* as a string against the value retrieved.
|
|
|
|
*
|
|
|
|
* @return The result of calling strcmp() against the value retrieved from
|
|
|
|
* the auxiliary vector. When the value is 0 (meaning a match is found),
|
|
|
|
* check errno to determine if an error occurred.
|
|
|
|
*/
|
|
|
|
int
|
|
|
|
rte_cpu_strcmp_auxval(unsigned long type, const char *str);
|
|
|
|
|
2017-04-21 10:43:26 +00:00
|
|
|
#endif /* _RTE_CPUFLAGS_H_ */
|