---
name: "rte_power_get_env"
section: "3"
platform: "linux"
package: "dpdk-doc"
version: "24.11.4-0+deb13u1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/rte_power_cpufreq.h"
---

# rte\_power\_get\_env(3)

Part of [rte\_power\_cpufreq.h(3)](/rte_power_cpufreq.h/3.md).

## NAME

rte\_power\_cpufreq.h

## SYNOPSIS

`#include <rte_common.h>`\
 `#include <rte_log.h>`\
 `#include 'power_cpufreq.h'`\

### Functions

int **rte\_power\_check\_env\_supported** (enum power\_management\_env env)\
 int **rte\_power\_set\_env** (enum power\_management\_env env)\
 void **rte\_power\_unset\_env** (void)\
 enum power\_management\_env **rte\_power\_get\_env** (void)\
 int **rte\_power\_init** (unsigned int lcore\_id)\
 int **rte\_power\_exit** (unsigned int lcore\_id)\
 uint32\_t **rte\_power\_freqs** (unsigned int lcore\_id, uint32\_t \*freqs, uint32\_t num)\
 uint32\_t **rte\_power\_get\_freq** (unsigned int lcore\_id)\
 uint32\_t **rte\_power\_set\_freq** (unsigned int lcore\_id, uint32\_t index)\
 int **rte\_power\_freq\_up** (unsigned int lcore\_id)\
 int **rte\_power\_freq\_down** (unsigned int lcore\_id)\
 int **rte\_power\_freq\_max** (unsigned int lcore\_id)\
 int **rte\_power\_freq\_min** (unsigned int lcore\_id)\
 int **rte\_power\_turbo\_status** (unsigned int lcore\_id)\
 int **rte\_power\_freq\_enable\_turbo** (unsigned int lcore\_id)\
 int **rte\_power\_freq\_disable\_turbo** (unsigned int lcore\_id)\
 int **rte\_power\_get\_capabilities** (unsigned int lcore\_id, struct rte\_power\_core\_capabilities \*caps)\

## Detailed Description

CPU Frequency Management

Definition in file **rte\_power\_cpufreq.h**.

## Function Documentation

### int rte\_power\_check\_env\_supported (enum power\_management\_env env)

Check if a specific power management environment type is supported on a currently running system.

**Parameters**

*env* The environment type to check support for.

**Returns**

- •

  1 if supported

- •

  0 if unsupported

- •

  \-1 if error, with rte\_errno indicating reason for error.

### int rte\_power\_set\_env (enum power\_management\_env env)

Set the default power management implementation. If this is not called prior to **rte\_power\_init()**, then auto-detect of the environment will take place. It is thread safe. New env can be set only in uninitialized state (thus rte\_power\_unset\_env must be called if different env was already set).

**Parameters**

*env* env. The environment in which to initialise Power Management for.

**Returns**

- •

  0 on success.

- •

  Negative on error.

### void rte\_power\_unset\_env (void)

Unset the global environment configuration. This can only be called after all threads have completed.

### enum power\_management\_env rte\_power\_get\_env (void)

Get the default power management implementation.

**Returns**

power\_management\_env The configured environment.

### int rte\_power\_init (unsigned int lcore\_id)

Initialize power management for a specific lcore. If **rte\_power\_set\_env()** has not been called then an auto-detect of the environment will start and initialise the corresponding resources.

**Parameters**

*lcore\_id* lcore id.

**Returns**

- •

  0 on success.

- •

  Negative on error.

### int rte\_power\_exit (unsigned int lcore\_id)

Exit power management on a specific lcore. This will call the environment dependent exit function.

**Parameters**

*lcore\_id* lcore id.

**Returns**

- •

  0 on success.

- •

  Negative on error.

### uint32\_t rte\_power\_freqs (unsigned int lcore\_id, uint32\_t \* freqs, uint32\_t num)

Get the available frequencies of a specific lcore. Function pointer definition. Review each environments specific documentation for usage.

**Parameters**

*lcore\_id* lcore id. \
 *freqs* The buffer array to save the frequencies. \
 *num* The number of frequencies to get.

**Returns**

The number of available frequencies.

### uint32\_t rte\_power\_get\_freq (unsigned int lcore\_id)

Return the current index of available frequencies of a specific lcore. Function pointer definition. Review each environments specific documentation for usage.

**Parameters**

*lcore\_id* lcore id.

**Returns**

The current index of available frequencies.

### uint32\_t rte\_power\_set\_freq (unsigned int lcore\_id, uint32\_t index)

Set the new frequency for a specific lcore by indicating the index of available frequencies. Function pointer definition. Review each environments specific documentation for usage.

**Parameters**

*lcore\_id* lcore id. \
 *index* The index of available frequencies.

**Returns**

- •

  1 on success with frequency changed.

- •

  0 on success without frequency changed.

- •

  Negative on error.

### int rte\_power\_freq\_up (unsigned int lcore\_id)

Scale up the frequency of a specific lcore according to the available frequencies. Review each environments specific documentation for usage.

**Parameters**

*lcore\_id* lcore id.

**Returns**

- •

  1 on success with frequency changed.

- •

  0 on success without frequency changed.

- •

  Negative on error.

### int rte\_power\_freq\_down (unsigned int lcore\_id)

Scale down the frequency of a specific lcore according to the available frequencies. Review each environments specific documentation for usage.

**Parameters**

*lcore\_id* lcore id.

**Returns**

- •

  1 on success with frequency changed.

- •

  0 on success without frequency changed.

- •

  Negative on error.

### int rte\_power\_freq\_max (unsigned int lcore\_id)

Scale up the frequency of a specific lcore to the highest according to the available frequencies. Review each environments specific documentation for usage.

**Parameters**

*lcore\_id* lcore id.

**Returns**

- •

  1 on success with frequency changed.

- •

  0 on success without frequency changed.

- •

  Negative on error.

### int rte\_power\_freq\_min (unsigned int lcore\_id)

Scale down the frequency of a specific lcore to the lowest according to the available frequencies. Review each environments specific documentation for usage..

**Parameters**

*lcore\_id* lcore id.

**Returns**

- •

  1 on success with frequency changed.

- •

  0 on success without frequency changed.

- •

  Negative on error.

### int rte\_power\_turbo\_status (unsigned int lcore\_id)

Query the Turbo Boost status of a specific lcore. Review each environments specific documentation for usage..

**Parameters**

*lcore\_id* lcore id.

**Returns**

- •

  1 turbo boost enabled.

- •

  0 turbo boost disabled.

- •

  Negative on error.

### int rte\_power\_freq\_enable\_turbo (unsigned int lcore\_id)

Enable Turbo Boost for this lcore. Review each environments specific documentation for usage..

**Parameters**

*lcore\_id* lcore id.

**Returns**

- •

  0 on success.

- •

  Negative on error.

### int rte\_power\_freq\_disable\_turbo (unsigned int lcore\_id)

Disable Turbo Boost for this lcore. Review each environments specific documentation for usage..

**Parameters**

*lcore\_id* lcore id.

**Returns**

- •

  0 on success.

- •

  Negative on error.

### int rte\_power\_get\_capabilities (unsigned int lcore\_id, struct rte\_power\_core\_capabilities \* caps)

Returns power capabilities for a specific lcore. Function pointer definition. Review each environments specific documentation for usage.

**Parameters**

*lcore\_id* lcore id. \
 *caps* pointer to rte\_power\_core\_capabilities object.

**Returns**

- •

  0 on success.

- •

  Negative on error.

## Author

Generated automatically by Doxygen for DPDK from the source code.
