---
name: "rte_mtr_policy_drop_red"
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_mtr.h"
---

# rte\_mtr\_policy\_drop\_red(3)

Part of [rte\_mtr.h(3)](/rte_mtr.h/3.md).

## NAME

rte\_mtr.h

## SYNOPSIS

`#include <stdint.h>`\
 `#include <rte_compat.h>`\
 `#include <rte_common.h>`\
 `#include <rte_meter.h>`\
 `#include <rte_flow.h>`\

### Data Structures

struct **rte\_mtr\_stats**\
 struct **rte\_mtr\_meter\_profile**\
 struct **rte\_mtr\_meter\_policy\_params**\
 struct **rte\_mtr\_params**\
 struct **rte\_mtr\_capabilities**\
 struct **rte\_mtr\_error**\

### Macros

\#define **rte\_mtr\_policy\_pass\_color**(policy)\
 \#define **rte\_mtr\_policy\_drop\_red**(policy)\

### Enumerations

enum **rte\_mtr\_stats\_type** { **RTE\_MTR\_STATS\_N\_PKTS\_GREEN** = 1 \<\< 0, **RTE\_MTR\_STATS\_N\_PKTS\_YELLOW** = 1 \<\< 1, **RTE\_MTR\_STATS\_N\_PKTS\_RED** = 1 \<\< 2, **RTE\_MTR\_STATS\_N\_PKTS\_DROPPED** = 1 \<\< 3, **RTE\_MTR\_STATS\_N\_BYTES\_GREEN** = 1 \<\< 4, **RTE\_MTR\_STATS\_N\_BYTES\_YELLOW** = 1 \<\< 5, **RTE\_MTR\_STATS\_N\_BYTES\_RED** = 1 \<\< 6, **RTE\_MTR\_STATS\_N\_BYTES\_DROPPED** = 1 \<\< 7 }\
 enum **rte\_mtr\_algorithm** { **RTE\_MTR\_NONE** = 0, **RTE\_MTR\_SRTCM\_RFC2697**, **RTE\_MTR\_TRTCM\_RFC2698**, **RTE\_MTR\_TRTCM\_RFC4115** }\
 enum **rte\_mtr\_color\_in\_protocol** { **RTE\_MTR\_COLOR\_IN\_PROTO\_OUTER\_VLAN** = RTE\_BIT64(0), **RTE\_MTR\_COLOR\_IN\_PROTO\_INNER\_VLAN** = RTE\_BIT64(1), **RTE\_MTR\_COLOR\_IN\_PROTO\_OUTER\_IP** = RTE\_BIT64(2), **RTE\_MTR\_COLOR\_IN\_PROTO\_INNER\_IP** = [RTE\_BIT64(3)](/RTE_BIT64/3.md) }\
 enum **rte\_mtr\_error\_type** { **RTE\_MTR\_ERROR\_TYPE\_NONE**, **RTE\_MTR\_ERROR\_TYPE\_UNSPECIFIED**, **RTE\_MTR\_ERROR\_TYPE\_METER\_PROFILE\_ID**, **RTE\_MTR\_ERROR\_TYPE\_METER\_PROFILE**, **RTE\_MTR\_ERROR\_TYPE\_METER\_PROFILE\_PACKET\_MODE**, **RTE\_MTR\_ERROR\_TYPE\_MTR\_ID**, **RTE\_MTR\_ERROR\_TYPE\_MTR\_PARAMS**, **RTE\_MTR\_ERROR\_TYPE\_POLICER\_ACTION\_GREEN**, **RTE\_MTR\_ERROR\_TYPE\_POLICER\_ACTION\_YELLOW**, **RTE\_MTR\_ERROR\_TYPE\_POLICER\_ACTION\_RED**, **RTE\_MTR\_ERROR\_TYPE\_STATS\_MASK**, **RTE\_MTR\_ERROR\_TYPE\_STATS**, **RTE\_MTR\_ERROR\_TYPE\_SHARED**, **RTE\_MTR\_ERROR\_TYPE\_METER\_POLICY\_ID**, **RTE\_MTR\_ERROR\_TYPE\_METER\_POLICY** }\

### Functions

\_\_rte\_experimental int **rte\_mtr\_capabilities\_get** (uint16\_t port\_id, struct **rte\_mtr\_capabilities** \*cap, struct **rte\_mtr\_error** \*error)\
 \_\_rte\_experimental int **rte\_mtr\_meter\_profile\_add** (uint16\_t port\_id, uint32\_t meter\_profile\_id, struct **rte\_mtr\_meter\_profile** \*profile, struct **rte\_mtr\_error** \*error)\
 \_\_rte\_experimental int **rte\_mtr\_meter\_profile\_delete** (uint16\_t port\_id, uint32\_t meter\_profile\_id, struct **rte\_mtr\_error** \*error)\
 \_\_rte\_experimental struct rte\_flow\_meter\_profile \* **rte\_mtr\_meter\_profile\_get** (uint16\_t port\_id, uint32\_t meter\_profile\_id, struct **rte\_mtr\_error** \*error)\
 \_\_rte\_experimental int **rte\_mtr\_meter\_policy\_validate** (uint16\_t port\_id, struct **rte\_mtr\_meter\_policy\_params** \*policy, struct **rte\_mtr\_error** \*error)\
 \_\_rte\_experimental int **rte\_mtr\_meter\_policy\_add** (uint16\_t port\_id, uint32\_t policy\_id, struct **rte\_mtr\_meter\_policy\_params** \*policy, struct **rte\_mtr\_error** \*error)\
 \_\_rte\_experimental struct rte\_flow\_meter\_policy \* **rte\_mtr\_meter\_policy\_get** (uint16\_t port\_id, uint32\_t policy\_id, struct **rte\_mtr\_error** \*error)\
 \_\_rte\_experimental int **rte\_mtr\_meter\_policy\_delete** (uint16\_t port\_id, uint32\_t policy\_id, struct **rte\_mtr\_error** \*error)\
 \_\_rte\_experimental int **rte\_mtr\_create** (uint16\_t port\_id, uint32\_t mtr\_id, struct **rte\_mtr\_params** \*params, int shared, struct **rte\_mtr\_error** \*error)\
 \_\_rte\_experimental int **rte\_mtr\_destroy** (uint16\_t port\_id, uint32\_t mtr\_id, struct **rte\_mtr\_error** \*error)\
 \_\_rte\_experimental int **rte\_mtr\_meter\_disable** (uint16\_t port\_id, uint32\_t mtr\_id, struct **rte\_mtr\_error** \*error)\
 \_\_rte\_experimental int **rte\_mtr\_meter\_enable** (uint16\_t port\_id, uint32\_t mtr\_id, struct **rte\_mtr\_error** \*error)\
 \_\_rte\_experimental int **rte\_mtr\_meter\_profile\_update** (uint16\_t port\_id, uint32\_t mtr\_id, uint32\_t meter\_profile\_id, struct **rte\_mtr\_error** \*error)\
 \_\_rte\_experimental int **rte\_mtr\_meter\_policy\_update** (uint16\_t port\_id, uint32\_t mtr\_id, uint32\_t meter\_policy\_id, struct **rte\_mtr\_error** \*error)\
 \_\_rte\_experimental int **rte\_mtr\_meter\_dscp\_table\_update** (uint16\_t port\_id, uint32\_t mtr\_id, enum **rte\_mtr\_color\_in\_protocol** proto, enum **rte\_color** \*dscp\_table, struct **rte\_mtr\_error** \*error)\
 \_\_rte\_experimental int **rte\_mtr\_meter\_vlan\_table\_update** (uint16\_t port\_id, uint32\_t mtr\_id, enum **rte\_mtr\_color\_in\_protocol** proto, enum **rte\_color** \*vlan\_table, struct **rte\_mtr\_error** \*error)\
 \_\_rte\_experimental int **rte\_mtr\_color\_in\_protocol\_set** (uint16\_t port\_id, uint32\_t mtr\_id, enum **rte\_mtr\_color\_in\_protocol** proto, uint32\_t priority, struct **rte\_mtr\_error** \*error)\
 \_\_rte\_experimental int **rte\_mtr\_color\_in\_protocol\_get** (uint16\_t port\_id, uint32\_t mtr\_id, uint64\_t \*proto\_mask, struct **rte\_mtr\_error** \*error)\
 \_\_rte\_experimental int **rte\_mtr\_color\_in\_protocol\_priority\_get** (uint16\_t port\_id, uint32\_t mtr\_id, enum **rte\_mtr\_color\_in\_protocol** proto, uint32\_t \*priority, struct **rte\_mtr\_error** \*error)\
 \_\_rte\_experimental int **rte\_mtr\_stats\_update** (uint16\_t port\_id, uint32\_t mtr\_id, uint64\_t stats\_mask, struct **rte\_mtr\_error** \*error)\
 \_\_rte\_experimental int **rte\_mtr\_stats\_read** (uint16\_t port\_id, uint32\_t mtr\_id, struct **rte\_mtr\_stats** \*stats, uint64\_t \*stats\_mask, int clear, struct **rte\_mtr\_error** \*error)\

## Detailed Description

RTE Generic Traffic Metering and Policing API

This interface provides the ability to configure the traffic metering and policing (MTR) in a generic way.

The processing done for each input packet hitting a MTR object is: A) Traffic metering: The packet is assigned a color (the meter output color), based on the previous history of the flow reflected in the current state of the MTR object, according to the specific traffic metering algorithm. The traffic metering algorithm can typically work in color aware mode, in which case the input packet already has an initial color (the input color), or in color blind mode, which is equivalent to considering all input packets initially colored as green. B) Policing: There is a separate policer action configured for each meter output color, which can: a) Drop the packet. b) Keep the same packet color: the policer output color matches the meter output color (essentially a no-op action). c) Recolor the packet: the policer output color is different than the meter output color. The policer output color is the output color of the packet, which is set in the packet meta-data (i.e. struct rte\_mbuf::sched::color). C) Statistics: The set of counters maintained for each MTR object is configurable and subject to the implementation support. This set includes the number of packets and bytes dropped or passed for each output color.

Once successfully created, an MTR object is linked to one or several flows through the meter action of the flow API. A) Whether an MTR object is private to a flow or potentially shared by several flows has to be specified at creation time. B) Several meter actions can be potentially registered for the same flow.

**Warning**

**EXPERIMENTAL:** this API may change without prior notice

Definition in file **rte\_mtr.h**.

## Macro Definition Documentation

### #define rte\_mtr\_policy\_pass\_color(policy)

Define meter policy action list: GREEN - GREEN, YELLOW - YELLOW, RED - RED

Definition at line **724** of file **rte\_mtr.h**.

### #define rte\_mtr\_policy\_drop\_red(policy)

**Value:**.PP

```
struct rte_mtr_meter_policy_params policy = \
{ \
    .actions[RTE_COLOR_GREEN] = NULL, \
    .actions[RTE_COLOR_YELLOW] = NULL, \
    .actions[RTE_COLOR_RED] = (struct rte_flow_action[]) { \
        { \
            .type = RTE_FLOW_ACTION_TYPE_DROP, \
        }, \
        { \
            .type = RTE_FLOW_ACTION_TYPE_END, \
        }, \
    }, \
}
```

Define meter policy action list: GREEN - Do nothing, YELLOW - Do nothing, RED - DROP

Definition at line **766** of file **rte\_mtr.h**.

## Enumeration Type Documentation

### enum rte\_mtr\_stats\_type

Statistics counter type

**Enumerator**

- *RTE\_MTR\_STATS\_N\_PKTS\_GREEN*

  *Number of packets passed as green by the policer.*

- *RTE\_MTR\_STATS\_N\_PKTS\_YELLOW*

  *Number of packets passed as yellow by the policer.*

- *RTE\_MTR\_STATS\_N\_PKTS\_RED*

  *Number of packets passed as red by the policer.*

- *RTE\_MTR\_STATS\_N\_PKTS\_DROPPED*

  *Number of packets dropped by the policer.*

- *RTE\_MTR\_STATS\_N\_BYTES\_GREEN*

  *Number of bytes passed as green by the policer.*

- *RTE\_MTR\_STATS\_N\_BYTES\_YELLOW*

  *Number of bytes passed as yellow by the policer.*

- *RTE\_MTR\_STATS\_N\_BYTES\_RED*

  *Number of bytes passed as red by the policer.*

- *RTE\_MTR\_STATS\_N\_BYTES\_DROPPED*

  *Number of bytes dropped by the policer.*

*Definition at line* **61** *of file* **rte\_mtr.h***.*

### enum rte\_mtr\_algorithm

*Traffic metering algorithms*

**Enumerator**

- *RTE\_MTR\_NONE*

  *No traffic metering performed, the output color is the same as the input color for every input packet. The meter of the MTR object is working in pass-through mode, having same effect as meter disable.*

**See also**

**rte\_mtr\_meter\_disable()**

- *RTE\_MTR\_SRTCM\_RFC2697*

  *Single Rate Three Color Marker (srTCM) - IETF RFC 2697.*

- *RTE\_MTR\_TRTCM\_RFC2698*

  *Two Rate Three Color Marker (trTCM) - IETF RFC 2698.*

- *RTE\_MTR\_TRTCM\_RFC4115*

  *Two Rate Three Color Marker (trTCM) - IETF RFC 4115.*

*Definition at line* **107** *of file* **rte\_mtr.h***.*

### enum rte\_mtr\_color\_in\_protocol

*Input color protocol method*

*More than one of the method can be enabled for a given meter. Even if enabled, a method might not be applicable to each input packet, in case the associated protocol header is not present in the packet. The highest priority method that is both enabled for the meter and also applicable for the current input packet wins; if none is both enabled and applicable, the default input color is used.*

**See also**

*function* **rte\_mtr\_color\_in\_protocol\_set()**

**Enumerator**

- *RTE\_MTR\_COLOR\_IN\_PROTO\_OUTER\_VLAN*

  *Enable the detection of the packet input color based on the outermost VLAN header fields DEI (1 bit) and PCP (3 bits). These fields are used as index into the VLAN table.*

**See also**

*struct* **rte\_mtr\_params::vlan\_table**

- *RTE\_MTR\_COLOR\_IN\_PROTO\_INNER\_VLAN*

  *Enable the detection of the packet input color based on the innermost VLAN header fields DEI (1 bit) and PCP (3 bits). These fields are used as index into the VLAN table.*

**See also**

*struct* **rte\_mtr\_params::vlan\_table**

- *RTE\_MTR\_COLOR\_IN\_PROTO\_OUTER\_IP*

  *Enable the detection of the packet input color based on the outermost IP DSCP field. These fields are used as index into the DSCP table.*

**See also**

*struct* **rte\_mtr\_params::dscp\_table**

- *RTE\_MTR\_COLOR\_IN\_PROTO\_INNER\_IP*

  *Enable the detection of the packet input color based on the innermost IP DSCP field. These fields are used as index into the DSCP table.*

**See also**

*struct* **rte\_mtr\_params::dscp\_table**

*Definition at line* **226** *of file* **rte\_mtr.h***.*

### enum rte\_mtr\_error\_type

*Verbose error types.*

*Most of them provide the type of the object referenced by struct* **rte\_mtr\_error::cause***.*

**Enumerator**

- *RTE\_MTR\_ERROR\_TYPE\_NONE*

  *No error.*

- *RTE\_MTR\_ERROR\_TYPE\_UNSPECIFIED*

  *Cause unspecified.*

*Definition at line* **525** *of file* **rte\_mtr.h***.*

## Function Documentation

### \_\_rte\_experimental int rte\_mtr\_capabilities\_get (uint16\_t port\_id, struct rte\_mtr\_capabilities \* cap, struct rte\_mtr\_error \* error)

*MTR capabilities get*

**Parameters**

*port\_id The port identifier of the Ethernet device.* \
 *cap MTR capabilities. Needs to be pre-allocated and valid.* \
 *error Error details. Filled in only on error, when not NULL.*

**Returns**

*0 on success, non-zero error code otherwise.*

### \_\_rte\_experimental int rte\_mtr\_meter\_profile\_add (uint16\_t port\_id, uint32\_t meter\_profile\_id, struct rte\_mtr\_meter\_profile \* profile, struct rte\_mtr\_error \* error)

*Meter profile add*

*Create a new meter profile with ID set to meter\_profile\_id. The new profile is used to create one or several MTR objects.*

**Parameters**

*port\_id The port identifier of the Ethernet device.* \
 *meter\_profile\_id ID for the new meter profile. Needs to be unused by any of the existing meter profiles added for the current port.* \
 *profile Meter profile parameters. Needs to be pre-allocated and valid.* \
 *error Error details. Filled in only on error, when not NULL.*

**Returns**

*0 on success, non-zero error code otherwise.*

### \_\_rte\_experimental int rte\_mtr\_meter\_profile\_delete (uint16\_t port\_id, uint32\_t meter\_profile\_id, struct rte\_mtr\_error \* error)

*Meter profile delete*

*Delete an existing meter profile. This operation fails when there is currently at least one user (i.e. MTR object) of this profile.*

**Parameters**

*port\_id The port identifier of the Ethernet device.* \
 *meter\_profile\_id Meter profile ID. Needs to be the valid.* \
 *error Error details. Filled in only on error, when not NULL.*

**Returns**

*0 on success, non-zero error code otherwise.*

### \_\_rte\_experimental struct rte\_flow\_meter\_profile \* rte\_mtr\_meter\_profile\_get (uint16\_t port\_id, uint32\_t meter\_profile\_id, struct rte\_mtr\_error \* error)

*Meter profile object get*

*Get meter profile object for a given meter profile ID.*

**Parameters**

*port\_id The port identifier of the Ethernet device.* \
 *meter\_profile\_id Meter profile ID. Needs to be the valid.* \
 *error Error details. Filled in only on error, when not NULL.*

**Returns**

*A valid handle in case of success, NULL otherwise.*

### \_\_rte\_experimental int rte\_mtr\_meter\_policy\_validate (uint16\_t port\_id, struct rte\_mtr\_meter\_policy\_params \* policy, struct rte\_mtr\_error \* error)

*Check whether a meter policy can be created on a given port.*

*The meter policy is validated for correctness and whether it could be accepted by the device given sufficient resources. The policy is checked against the current capability information meter\_policy\_n\_max configuration. The policy may also optionally be validated against existing device policy resources. This function has no effect on the target device.*

**Parameters**

*port\_id The port identifier of the Ethernet device.* \
 *policy Associated action list per color. list NULL is legal and means no special action. (list terminated by the END action).* \
 *error Error details. Filled in only on error, when not NULL.*

**Returns**

*0 on success, non-zero error code otherwise.*

### \_\_rte\_experimental int rte\_mtr\_meter\_policy\_add (uint16\_t port\_id, uint32\_t policy\_id, struct rte\_mtr\_meter\_policy\_params \* policy, struct rte\_mtr\_error \* error)

*Meter policy add*

*Create a new meter policy. The new policy is used to create single or multiple MTR objects. The same policy can be used to create multiple MTR objects.*

**Parameters**

*port\_id The port identifier of the Ethernet device.* \
 *policy\_id Policy identifier for the new meter policy.* \
 *policy Associated actions per color. list NULL is legal and means no special action. Non-NULL list must be terminated. (list terminated by the END action).* \
 *error Error details. Filled in only on error, when not NULL.*

**Returns**

*0 on success, non-zero error code otherwise.*

### \_\_rte\_experimental struct rte\_flow\_meter\_policy \* rte\_mtr\_meter\_policy\_get (uint16\_t port\_id, uint32\_t policy\_id, struct rte\_mtr\_error \* error)

*Meter policy object get*

*Get meter policy object for a given meter policy ID.*

**Parameters**

*port\_id The port identifier of the Ethernet device.* \
 *policy\_id Meter policy ID. Needs to be the valid.* \
 *error Error details. Filled in only on error, when not NULL.*

**Returns**

*A valid handle in case of success, NULL otherwise.*

### \_\_rte\_experimental int rte\_mtr\_meter\_policy\_delete (uint16\_t port\_id, uint32\_t policy\_id, struct rte\_mtr\_error \* error)

*Meter policy delete*

*Delete an existing meter policy. This operation fails when there is currently at least one user (i.e. MTR object) of this policy.*

**Parameters**

*port\_id The port identifier of the Ethernet device.* \
 *policy\_id Policy identifier.* \
 *error Error details. Filled in only on error, when not NULL.*

**Returns**

*0 on success, non-zero error code otherwise.*

### \_\_rte\_experimental int rte\_mtr\_create (uint16\_t port\_id, uint32\_t mtr\_id, struct rte\_mtr\_params \* params, int shared, struct rte\_mtr\_error \* error)

*MTR object create*

*Create a new MTR object for the current port. This object is run as part of associated flow action for traffic metering and policing.*

**Parameters**

*port\_id The port identifier of the Ethernet device.* \
 *mtr\_id MTR object ID. Needs to be unused by any of the existing MTR objects. created for the current port.* \
 *params MTR object params. Needs to be pre-allocated and valid.* \
 *shared Non-zero when this MTR object can be shared by multiple flows, zero when this MTR object can be used by a single flow.* \
 *error Error details. Filled in only on error, when not NULL.*

**Returns**

*0 on success, non-zero error code otherwise.*

**See also**

*enum rte\_flow\_action\_type::RTE\_FLOW\_ACTION\_TYPE\_METER*

### \_\_rte\_experimental int rte\_mtr\_destroy (uint16\_t port\_id, uint32\_t mtr\_id, struct rte\_mtr\_error \* error)

*MTR object destroy*

*Delete an existing MTR object. This operation fails when there is currently at least one user (i.e. flow) of this MTR object.*

**Parameters**

*port\_id The port identifier of the Ethernet device.* \
 *mtr\_id MTR object ID. Needs to be valid. created for the current port.* \
 *error Error details. Filled in only on error, when not NULL.*

**Returns**

*0 on success, non-zero error code otherwise.*

### \_\_rte\_experimental int rte\_mtr\_meter\_disable (uint16\_t port\_id, uint32\_t mtr\_id, struct rte\_mtr\_error \* error)

*MTR object meter disable*

*Disable the meter of an existing MTR object. In disabled state, the meter of the current MTR object works in pass-through mode, meaning that for each input packet the meter output color is always the same as the input color. In particular, when the meter of the current MTR object is configured in color blind mode, the input color is always green, so the meter output color is also always green. Note that the policer and the statistics of the current MTR object are working as usual while the meter is disabled. No action is taken and this function returns successfully when the meter of the current MTR object is already disabled.*

**Parameters**

*port\_id The port identifier of the Ethernet device.* \
 *mtr\_id MTR object ID.* \
 *error Error details. Filled in only on error, when not NULL.*

**Returns**

*0 on success, non-zero error code otherwise.*

### \_\_rte\_experimental int rte\_mtr\_meter\_enable (uint16\_t port\_id, uint32\_t mtr\_id, struct rte\_mtr\_error \* error)

*MTR object meter enable*

*Enable the meter of an existing MTR object. If the MTR object has its meter already enabled, then no action is taken and this function returns successfully.*

**Parameters**

*port\_id The port identifier of the Ethernet device.* \
 *mtr\_id MTR object ID.* \
 *error Error details. Filled in only on error, when not NULL.*

**Returns**

*0 on success, non-zero error code otherwise.*

### \_\_rte\_experimental int rte\_mtr\_meter\_profile\_update (uint16\_t port\_id, uint32\_t mtr\_id, uint32\_t meter\_profile\_id, struct rte\_mtr\_error \* error)

*MTR object meter profile update*

**Parameters**

*port\_id The port identifier of the Ethernet device.* \
 *mtr\_id MTR object ID. Needs to be valid.* \
 *meter\_profile\_id Meter profile ID for the current MTR object. Needs to be valid.* \
 *error Error details. Filled in only on error, when not NULL.*

**Returns**

*0 on success, non-zero error code otherwise.*

### \_\_rte\_experimental int rte\_mtr\_meter\_policy\_update (uint16\_t port\_id, uint32\_t mtr\_id, uint32\_t meter\_policy\_id, struct rte\_mtr\_error \* error)

*MTR object meter policy update*

**Parameters**

*port\_id The port identifier of the Ethernet device.* \
 *mtr\_id MTR object ID. Needs to be valid.* \
 *meter\_policy\_id Meter policy ID for the current MTR object. Needs to be valid.* \
 *error Error details. Filled in only on error, when not NULL.*

**Returns**

*0 on success, non-zero error code otherwise.*

### \_\_rte\_experimental int rte\_mtr\_meter\_dscp\_table\_update (uint16\_t port\_id, uint32\_t mtr\_id, enum rte\_mtr\_color\_in\_protocol proto, enum rte\_color \* dscp\_table, struct rte\_mtr\_error \* error)

*MTR object DSCP table update*

**Parameters**

*port\_id The port identifier of the Ethernet device.* \
 *mtr\_id MTR object ID. Needs to be valid.* \
 *proto Input color protocol.* \
 *dscp\_table When non-NULL: it points to a pre-allocated and pre-populated table with exactly 64 elements providing the input color for each value of the IPv4/IPv6 Differentiated Services Code Point (DSCP) input packet field. When NULL: it is equivalent to setting this parameter to an 'all-green' populated table (i.e. table with all the 64 elements set to green color).* \
 *error Error details. Filled in only on error, when not NULL.*

**Returns**

*0 on success, non-zero error code otherwise.*

### \_\_rte\_experimental int rte\_mtr\_meter\_vlan\_table\_update (uint16\_t port\_id, uint32\_t mtr\_id, enum rte\_mtr\_color\_in\_protocol proto, enum rte\_color \* vlan\_table, struct rte\_mtr\_error \* error)

*MTR object VLAN table update*

**Parameters**

*port\_id The port identifier of the Ethernet device.* \
 *mtr\_id MTR object ID. Needs to be valid.* \
 *proto Input color protocol.* \
 *vlan\_table When non-NULL: it points to a pre-allocated and pre-populated table with exactly 16 elements providing the input color for each value of the each value of the DEI(1bit), PCP(3 bits) input packet field. When NULL: it is equivalent to setting this parameter to an 'all-green' populated table (i.e. table with all the 16 elements set to green color).* \
 *error Error details. Filled in only on error, when not NULL.*

**Returns**

*0 on success, non-zero error code otherwise.*

### \_\_rte\_experimental int rte\_mtr\_color\_in\_protocol\_set (uint16\_t port\_id, uint32\_t mtr\_id, enum rte\_mtr\_color\_in\_protocol proto, uint32\_t priority, struct rte\_mtr\_error \* error)

*Set the input color protocol for a given MTR object*

*More than one of the method can be enabled for a given meter. Even if enabled, a method might not be applicable to each input packet, in case the associated protocol header is not present in the packet. The highest priority method that is both enabled for the meter and also applicable for the current input packet wins; if none is both enabled and applicable, the default input color is used.*

**Parameters**

*port\_id The port identifier of the Ethernet device.* \
 *mtr\_id MTR object ID. Needs to be valid.* \
 *proto Input color protocol.* \
 *priority Input color protocol priority. Value zero indicates the highest priority.* \
 *error Error details. Filled in only on error, when not NULL.*

**Returns**

*0 on success, non-zero error code otherwise.*

### \_\_rte\_experimental int rte\_mtr\_color\_in\_protocol\_get (uint16\_t port\_id, uint32\_t mtr\_id, uint64\_t \* proto\_mask, struct rte\_mtr\_error \* error)

*Get the input color protocol for a given MTR object*

**Parameters**

*port\_id The port identifier of the Ethernet device.* \
 *mtr\_id MTR object ID. Needs to be valid.* \
 *proto\_mask Selected input color protocols as bit mask.* \
 *error Error details. Filled in only on error, when not NULL.*

**Returns**

*0 on success, non-zero error code otherwise.*

### \_\_rte\_experimental int rte\_mtr\_color\_in\_protocol\_priority\_get (uint16\_t port\_id, uint32\_t mtr\_id, enum rte\_mtr\_color\_in\_protocol proto, uint32\_t \* priority, struct rte\_mtr\_error \* error)

*Get the priority associated with input color protocol for a given MTR object*

**Parameters**

*port\_id The port identifier of the Ethernet device.* \
 *mtr\_id MTR object ID. Needs to be valid.* \
 *proto Input color protocol.* \
 *priority Input color protocol priority associated with proto.* \
 *error Error details. Filled in only on error, when not NULL.*

**Returns**

*0 on success, non-zero error code otherwise.*

### \_\_rte\_experimental int rte\_mtr\_stats\_update (uint16\_t port\_id, uint32\_t mtr\_id, uint64\_t stats\_mask, struct rte\_mtr\_error \* error)

*MTR object enabled statistics counters update*

**Parameters**

*port\_id The port identifier of the Ethernet device.* \
 *mtr\_id MTR object ID. Needs to be valid.* \
 *stats\_mask Mask of statistics counter types to be enabled for the current MTR object. Any statistics counter type not included in this set is to be disabled for the current MTR object.* \
 *error Error details. Filled in only on error, when not NULL.*

**Returns**

*0 on success, non-zero error code otherwise.*

**See also**

*enum* **rte\_mtr\_stats\_type**

### \_\_rte\_experimental int rte\_mtr\_stats\_read (uint16\_t port\_id, uint32\_t mtr\_id, struct rte\_mtr\_stats \* stats, uint64\_t \* stats\_mask, int clear, struct rte\_mtr\_error \* error)

*MTR object statistics counters read*

**Parameters**

*port\_id The port identifier of the Ethernet device.* \
 *mtr\_id MTR object ID. Needs to be valid.* \
 *stats When non-NULL, it contains the current value for the statistics counters enabled for the current MTR object.* \
 *stats\_mask When non-NULL, it contains the mask of statistics counter types that are currently enabled for this MTR object, indicating which of the counters retrieved with the stats structure are valid.* \
 *clear When this parameter has a non-zero value, the statistics counters are cleared (i.e. set to zero) immediately after they have been read, otherwise the statistics counters are left untouched.* \
 *error Error details. Filled in only on error, when not NULL.*

**Returns**

*0 on success, non-zero error code otherwise.*

**See also**

*enum* **rte\_mtr\_stats\_type**

## Author

*Generated automatically by Doxygen for DPDK from the source code.*
