---
name: "rte_power_uncore_get_num_pkgs"
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_uncore.h"
---

# rte\_power\_uncore\_get\_num\_pkgs(3)

Part of [rte\_power\_uncore.h(3)](/rte_power_uncore.h/3.md).

## NAME

rte\_power\_uncore.h

## SYNOPSIS

`#include 'power_uncore_ops.h'`\

### Functions

\_\_rte\_experimental int **rte\_power\_set\_uncore\_env** (enum rte\_uncore\_power\_mgmt\_env env)\
 \_\_rte\_experimental void **rte\_power\_unset\_uncore\_env** (void)\
 \_\_rte\_experimental enum rte\_uncore\_power\_mgmt\_env **rte\_power\_get\_uncore\_env** (void)\
 int **rte\_power\_uncore\_init** (unsigned int pkg, unsigned int die)\
 int **rte\_power\_uncore\_exit** (unsigned int pkg, unsigned int die)\
 uint32\_t **rte\_power\_get\_uncore\_freq** (unsigned int pkg, unsigned int die)\
 int **rte\_power\_set\_uncore\_freq** (unsigned int pkg, unsigned int die, uint32\_t index)\
 int **rte\_power\_uncore\_freq\_max** (unsigned int pkg, unsigned int die)\
 int **rte\_power\_uncore\_freq\_min** (unsigned int pkg, unsigned int die)\
 \_\_rte\_experimental int **rte\_power\_uncore\_freqs** (unsigned int pkg, unsigned int die, uint32\_t \*freqs, uint32\_t num)\
 int **rte\_power\_uncore\_get\_num\_freqs** (unsigned int pkg, unsigned int die)\
 unsigned int **rte\_power\_uncore\_get\_num\_pkgs** (void)\
 unsigned int **rte\_power\_uncore\_get\_num\_dies** (unsigned int pkg)\

## Detailed Description

Uncore Frequency Management

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

## Function Documentation

### \_\_rte\_experimental int rte\_power\_set\_uncore\_env (enum rte\_uncore\_power\_mgmt\_env env)

Set the default uncore power management implementation. This has to be called prior to calling any other rte\_power\_uncore\_\*() API. It is thread safe. New env can be set only in uninitialized state. rte\_power\_unset\_uncore\_env must be called if different env was already set.

**Parameters**

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

**Returns**

- •

  0 on success.

- •

  Negative on error.

### \_\_rte\_experimental void rte\_power\_unset\_uncore\_env (void)

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

### \_\_rte\_experimental enum rte\_uncore\_power\_mgmt\_env rte\_power\_get\_uncore\_env (void)

Get the default uncore power management implementation.

**Returns**

power\_management\_env The configured environment.

### int rte\_power\_uncore\_init (unsigned int pkg, unsigned int die)

Initialize uncore frequency management for specific die on a package. It will get the available frequencies and prepare to set new die frequencies.

This function should NOT be called in the fast path.

**Parameters**

*pkg* Package number. Each physical CPU in a system is referred to as a package. \
 *die* Die number. Each package can have several dies connected together via the uncore mesh.

**Returns**

- •

  0 on success.

- •

  Negative on error.

### int rte\_power\_uncore\_exit (unsigned int pkg, unsigned int die)

Exit uncore frequency management on a specific die on a package. It will restore uncore min and\* max values to previous values before initialization of API.

This function should NOT be called in the fast path.

**Parameters**

*pkg* Package number. Each physical CPU in a system is referred to as a package. \
 *die* Die number. Each package can have several dies connected together via the uncore mesh.

**Returns**

- •

  0 on success.

- •

  Negative on error.

### uint32\_t rte\_power\_get\_uncore\_freq (unsigned int pkg, unsigned int die)

Return the current index of available frequencies of a specific die on a package. It should be protected outside of this function for threadsafe.

This function should NOT be called in the fast path.

**Parameters**

*pkg* Package number. Each physical CPU in a system is referred to as a package. \
 *die* Die number. Each package can have several dies connected together via the uncore mesh.

**Returns**

The current index of available frequencies. If error, it will return 'RTE\_POWER\_INVALID\_FREQ\_INDEX = (~0)'.

### int rte\_power\_set\_uncore\_freq (unsigned int pkg, unsigned int die, uint32\_t index)

Set minimum and maximum uncore frequency for specified die on a package to specified index value. It should be protected outside of this function for threadsafe.

This function should NOT be called in the fast path.

**Parameters**

*pkg* Package number. Each physical CPU in a system is referred to as a package. \
 *die* Die number. Each package can have several dies connected together via the uncore mesh. \
 *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\_uncore\_freq\_max (unsigned int pkg, unsigned int die)

Set minimum and maximum uncore frequency for specified die on a package to maximum value according to the available frequencies. It should be protected outside of this function for threadsafe.

This function should NOT be called in the fast path.

**Parameters**

*pkg* Package number. Each physical CPU in a system is referred to as a package. \
 *die* Die number. Each package can have several dies connected together via the uncore mesh.

**Returns**

- •

  1 on success with frequency changed.

- •

  0 on success without frequency changed.

- •

  Negative on error.

### int rte\_power\_uncore\_freq\_min (unsigned int pkg, unsigned int die)

Set minimum and maximum uncore frequency for specified die on a package to minimum value according to the available frequencies. It should be protected outside of this function for threadsafe.

This function should NOT be called in the fast path.

**Parameters**

*pkg* Package number. Each physical CPU in a system is referred to as a package. \
 *die* Die number. Each package can have several dies connected together via the uncore mesh.

**Returns**

- •

  1 on success with frequency changed.

- •

  0 on success without frequency changed.

- •

  Negative on error.

### \_\_rte\_experimental int rte\_power\_uncore\_freqs (unsigned int pkg, unsigned int die, uint32\_t \* freqs, uint32\_t num)

Return the list of available frequencies in the index array.

This function should NOT be called in the fast path.

**Parameters**

*pkg* Package number. Each physical CPU in a system is referred to as a package. \
 *die* Die number. Each package can have several dies connected together via the uncore mesh. \
 *freqs* The buffer array to save the frequencies. \
 *num* The number of frequencies to get.

**Returns**

- •

  The number of available index's in frequency array.

- •

  Negative on error.

### int rte\_power\_uncore\_get\_num\_freqs (unsigned int pkg, unsigned int die)

Return the list length of available frequencies in the index array.

This function should NOT be called in the fast path.

**Parameters**

*pkg* Package number. Each physical CPU in a system is referred to as a package. \
 *die* Die number. Each package can have several dies connected together via the uncore mesh.

**Returns**

- •

  The number of available index's in frequency array.

- •

  Negative on error.

### unsigned int rte\_power\_uncore\_get\_num\_pkgs (void)

Return the number of packages (CPUs) on a system by parsing the uncore sysfs directory.

This function should NOT be called in the fast path.

**Returns**

- •

  Zero on error.

- •

  Number of package on system on success.

### unsigned int rte\_power\_uncore\_get\_num\_dies (unsigned int pkg)

Return the number of dies for pakckages (CPUs) specified from parsing the uncore sysfs directory.

This function should NOT be called in the fast path.

**Parameters**

*pkg* Package number. Each physical CPU in a system is referred to as a package.

**Returns**

- •

  Zero on error.

- •

  Number of dies for package on sucecss.

## Author

Generated automatically by Doxygen for DPDK from the source code.
