DPDK: Data Plane Development Kit

17.11.0-rc0
rte_tm.h File Reference
#include <stdint.h>
#include <rte_common.h>

Go to the source code of this file.

Data Structures

struct  rte_tm_node_stats
struct  rte_tm_capabilities
struct  rte_tm_level_capabilities
struct  rte_tm_node_capabilities
struct  rte_tm_red_params
struct  rte_tm_wred_params
struct  rte_tm_token_bucket
struct  rte_tm_shaper_params
struct  rte_tm_node_params
struct  rte_tm_error

Macros

#define RTE_TM_ETH_FRAMING_OVERHEAD   20
#define RTE_TM_ETH_FRAMING_OVERHEAD_FCS   24
#define RTE_TM_WRED_PROFILE_ID_NONE   UINT32_MAX
#define RTE_TM_SHAPER_PROFILE_ID_NONE   UINT32_MAX
#define RTE_TM_NODE_ID_NULL   UINT32_MAX
#define RTE_TM_NODE_LEVEL_ID_ANY   UINT32_MAX

Enumerations

enum  rte_tm_color { RTE_TM_GREEN = 0, RTE_TM_YELLOW, RTE_TM_RED, RTE_TM_COLORS }
enum  rte_tm_stats_type {
  RTE_TM_STATS_N_PKTS = 1 << 0, RTE_TM_STATS_N_BYTES = 1 << 1, RTE_TM_STATS_N_PKTS_GREEN_DROPPED = 1 << 2, RTE_TM_STATS_N_PKTS_YELLOW_DROPPED = 1 << 3,
  RTE_TM_STATS_N_PKTS_RED_DROPPED = 1 << 4, RTE_TM_STATS_N_BYTES_GREEN_DROPPED = 1 << 5, RTE_TM_STATS_N_BYTES_YELLOW_DROPPED = 1 << 6, RTE_TM_STATS_N_BYTES_RED_DROPPED = 1 << 7,
  RTE_TM_STATS_N_PKTS_QUEUED = 1 << 8, RTE_TM_STATS_N_BYTES_QUEUED = 1 << 9
}
enum  rte_tm_dynamic_update_type {
  RTE_TM_UPDATE_NODE_PARENT_KEEP_LEVEL = 1 << 0, RTE_TM_UPDATE_NODE_PARENT_CHANGE_LEVEL = 1 << 1, RTE_TM_UPDATE_NODE_ADD_DELETE = 1 << 2, RTE_TM_UPDATE_NODE_SUSPEND_RESUME = 1 << 3,
  RTE_TM_UPDATE_NODE_WFQ_WEIGHT_MODE = 1 << 4, RTE_TM_UPDATE_NODE_N_SP_PRIORITIES = 1 << 5, RTE_TM_UPDATE_NODE_CMAN = 1 << 6, RTE_TM_UPDATE_NODE_STATS = 1 << 7
}
enum  rte_tm_cman_mode { RTE_TM_CMAN_TAIL_DROP = 0, RTE_TM_CMAN_HEAD_DROP, RTE_TM_CMAN_WRED }
enum  rte_tm_error_type { RTE_TM_ERROR_TYPE_NONE, RTE_TM_ERROR_TYPE_UNSPECIFIED }

Functions

int rte_tm_get_number_of_leaf_nodes (uint8_t port_id, uint32_t *n_leaf_nodes, struct rte_tm_error *error)
int rte_tm_node_type_get (uint8_t port_id, uint32_t node_id, int *is_leaf, struct rte_tm_error *error)
int rte_tm_capabilities_get (uint8_t port_id, struct rte_tm_capabilities *cap, struct rte_tm_error *error)
int rte_tm_level_capabilities_get (uint8_t port_id, uint32_t level_id, struct rte_tm_level_capabilities *cap, struct rte_tm_error *error)
int rte_tm_node_capabilities_get (uint8_t port_id, uint32_t node_id, struct rte_tm_node_capabilities *cap, struct rte_tm_error *error)
int rte_tm_wred_profile_add (uint8_t port_id, uint32_t wred_profile_id, struct rte_tm_wred_params *profile, struct rte_tm_error *error)
int rte_tm_wred_profile_delete (uint8_t port_id, uint32_t wred_profile_id, struct rte_tm_error *error)
int rte_tm_shared_wred_context_add_update (uint8_t port_id, uint32_t shared_wred_context_id, uint32_t wred_profile_id, struct rte_tm_error *error)
int rte_tm_shared_wred_context_delete (uint8_t port_id, uint32_t shared_wred_context_id, struct rte_tm_error *error)
int rte_tm_shaper_profile_add (uint8_t port_id, uint32_t shaper_profile_id, struct rte_tm_shaper_params *profile, struct rte_tm_error *error)
int rte_tm_shaper_profile_delete (uint8_t port_id, uint32_t shaper_profile_id, struct rte_tm_error *error)
int rte_tm_shared_shaper_add_update (uint8_t port_id, uint32_t shared_shaper_id, uint32_t shaper_profile_id, struct rte_tm_error *error)
int rte_tm_shared_shaper_delete (uint8_t port_id, uint32_t shared_shaper_id, struct rte_tm_error *error)
int rte_tm_node_add (uint8_t port_id, uint32_t node_id, uint32_t parent_node_id, uint32_t priority, uint32_t weight, uint32_t level_id, struct rte_tm_node_params *params, struct rte_tm_error *error)
int rte_tm_node_delete (uint8_t port_id, uint32_t node_id, struct rte_tm_error *error)
int rte_tm_node_suspend (uint8_t port_id, uint32_t node_id, struct rte_tm_error *error)
int rte_tm_node_resume (uint8_t port_id, uint32_t node_id, struct rte_tm_error *error)
int rte_tm_hierarchy_commit (uint8_t port_id, int clear_on_fail, struct rte_tm_error *error)
int rte_tm_node_parent_update (uint8_t port_id, uint32_t node_id, uint32_t parent_node_id, uint32_t priority, uint32_t weight, struct rte_tm_error *error)
int rte_tm_node_shaper_update (uint8_t port_id, uint32_t node_id, uint32_t shaper_profile_id, struct rte_tm_error *error)
int rte_tm_node_shared_shaper_update (uint8_t port_id, uint32_t node_id, uint32_t shared_shaper_id, int add, struct rte_tm_error *error)
int rte_tm_node_stats_update (uint8_t port_id, uint32_t node_id, uint64_t stats_mask, struct rte_tm_error *error)
int rte_tm_node_wfq_weight_mode_update (uint8_t port_id, uint32_t node_id, int *wfq_weight_mode, uint32_t n_sp_priorities, struct rte_tm_error *error)
int rte_tm_node_cman_update (uint8_t port_id, uint32_t node_id, enum rte_tm_cman_mode cman, struct rte_tm_error *error)
int rte_tm_node_wred_context_update (uint8_t port_id, uint32_t node_id, uint32_t wred_profile_id, struct rte_tm_error *error)
int rte_tm_node_shared_wred_context_update (uint8_t port_id, uint32_t node_id, uint32_t shared_wred_context_id, int add, struct rte_tm_error *error)
int rte_tm_node_stats_read (uint8_t port_id, uint32_t node_id, struct rte_tm_node_stats *stats, uint64_t *stats_mask, int clear, struct rte_tm_error *error)
int rte_tm_mark_vlan_dei (uint8_t port_id, int mark_green, int mark_yellow, int mark_red, struct rte_tm_error *error)
int rte_tm_mark_ip_ecn (uint8_t port_id, int mark_green, int mark_yellow, int mark_red, struct rte_tm_error *error)
int rte_tm_mark_ip_dscp (uint8_t port_id, int mark_green, int mark_yellow, int mark_red, struct rte_tm_error *error)

Detailed Description

RTE Generic Traffic Manager API

This interface provides the ability to configure the traffic manager in a generic way. It includes features such as: hierarchical scheduling, traffic shaping, congestion management, packet marking, etc.

Warning
EXPERIMENTAL: this API may change without prior notice

Definition in file rte_tm.h.

Macro Definition Documentation

#define RTE_TM_ETH_FRAMING_OVERHEAD   20

Ethernet framing overhead.

Overhead fields per Ethernet frame:

  1. Preamble: 7 bytes;
  2. Start of Frame Delimiter (SFD): 1 byte;
  3. Inter-Frame Gap (IFG): 12 bytes.

One of the typical values for the pkt_length_adjust field of the shaper profile.

See Also
struct rte_tm_shaper_params

Definition at line 72 of file rte_tm.h.

#define RTE_TM_ETH_FRAMING_OVERHEAD_FCS   24

Ethernet framing overhead including the Frame Check Sequence (FCS) field. Useful when FCS is generated and added at the end of the Ethernet frame on TX side without any SW intervention.

One of the typical values for the pkt_length_adjust field of the shaper profile.

See Also
struct rte_tm_shaper_params

Definition at line 84 of file rte_tm.h.

#define RTE_TM_WRED_PROFILE_ID_NONE   UINT32_MAX

Invalid WRED profile ID.

See Also
struct rte_tm_node_params
rte_tm_node_add()
rte_tm_node_wred_context_update()

Definition at line 93 of file rte_tm.h.

#define RTE_TM_SHAPER_PROFILE_ID_NONE   UINT32_MAX

*Invalid shaper profile ID.

See Also
struct rte_tm_node_params
rte_tm_node_add()
rte_tm_node_shaper_update()

Definition at line 102 of file rte_tm.h.

#define RTE_TM_NODE_ID_NULL   UINT32_MAX

Node ID for the parent of the root node.

See Also
rte_tm_node_add()

Definition at line 109 of file rte_tm.h.

#define RTE_TM_NODE_LEVEL_ID_ANY   UINT32_MAX

Node level ID used to disable level ID checking.

See Also
rte_tm_node_add()

Definition at line 116 of file rte_tm.h.

Enumeration Type Documentation

Color

Enumerator:
RTE_TM_GREEN 

Green

RTE_TM_YELLOW 

Yellow

RTE_TM_RED 

Red

RTE_TM_COLORS 

Number of colors

Definition at line 121 of file rte_tm.h.

Node statistics counter type

Enumerator:
RTE_TM_STATS_N_PKTS 

Number of packets scheduled from current node.

RTE_TM_STATS_N_BYTES 

Number of bytes scheduled from current node.

RTE_TM_STATS_N_PKTS_GREEN_DROPPED 

Number of green packets dropped by current leaf node.

RTE_TM_STATS_N_PKTS_YELLOW_DROPPED 

Number of yellow packets dropped by current leaf node.

RTE_TM_STATS_N_PKTS_RED_DROPPED 

Number of red packets dropped by current leaf node.

RTE_TM_STATS_N_BYTES_GREEN_DROPPED 

Number of green bytes dropped by current leaf node.

RTE_TM_STATS_N_BYTES_YELLOW_DROPPED 

Number of yellow bytes dropped by current leaf node.

RTE_TM_STATS_N_BYTES_RED_DROPPED 

Number of red bytes dropped by current leaf node.

RTE_TM_STATS_N_PKTS_QUEUED 

Number of packets currently waiting in the packet queue of current leaf node.

RTE_TM_STATS_N_BYTES_QUEUED 

Number of bytes currently waiting in the packet queue of current leaf node.

Definition at line 131 of file rte_tm.h.

Traffic manager dynamic updates

Enumerator:
RTE_TM_UPDATE_NODE_PARENT_KEEP_LEVEL 

Dynamic parent node update. The new parent node is located on same hierarchy level as the former parent node. Consequently, the node whose parent is changed preserves its hierarchy level.

RTE_TM_UPDATE_NODE_PARENT_CHANGE_LEVEL 

Dynamic parent node update. The new parent node is located on different hierarchy level than the former parent node. Consequently, the node whose parent is changed also changes its hierarchy level.

RTE_TM_UPDATE_NODE_ADD_DELETE 

Dynamic node add/delete.

RTE_TM_UPDATE_NODE_SUSPEND_RESUME 

Suspend/resume nodes.

RTE_TM_UPDATE_NODE_WFQ_WEIGHT_MODE 

Dynamic switch between byte-based and packet-based WFQ weights.

RTE_TM_UPDATE_NODE_N_SP_PRIORITIES 

Dynamic update on number of SP priorities.

RTE_TM_UPDATE_NODE_CMAN 

Dynamic update of congestion management mode for leaf nodes.

RTE_TM_UPDATE_NODE_STATS 

Dynamic update of the set of enabled stats counter types.

Definition at line 204 of file rte_tm.h.

Congestion management (CMAN) mode

This is used for controlling the admission of packets into a packet queue or group of packet queues on congestion. On request of writing a new packet into the current queue while the queue is full, the tail drop algorithm drops the new packet while leaving the queue unmodified, as opposed to head drop algorithm, which drops the packet at the head of the queue (the oldest packet waiting in the queue) and admits the new packet at the tail of the queue.

The Random Early Detection (RED) algorithm works by proactively dropping more and more input packets as the queue occupancy builds up. When the queue is full or almost full, RED effectively works as tail drop. The Weighted RED algorithm uses a separate set of RED thresholds for each packet color.

Enumerator:
RTE_TM_CMAN_TAIL_DROP 

Tail drop

RTE_TM_CMAN_HEAD_DROP 

Head drop

RTE_TM_CMAN_WRED 

Weighted Random Early Detection (WRED)

Definition at line 783 of file rte_tm.h.

Verbose error types.

Most of them provide the type of the object referenced by struct rte_tm_error::cause.

Enumerator:
RTE_TM_ERROR_TYPE_NONE 

No error.

RTE_TM_ERROR_TYPE_UNSPECIFIED 

Cause unspecified.

Definition at line 972 of file rte_tm.h.

Function Documentation

int rte_tm_get_number_of_leaf_nodes ( uint8_t  port_id,
uint32_t *  n_leaf_nodes,
struct rte_tm_error error 
)

Traffic manager get number of leaf nodes

Each leaf node sits on on top of a TX queue of the current Ethernet port. Therefore, the set of leaf nodes is predefined, their number is always equal to N (where N is the number of TX queues configured for the current port) and their IDs are 0 .. (N-1).

Parameters
[in]port_idThe port identifier of the Ethernet device.
[out]n_leaf_nodesNumber of leaf nodes for the current port.
[out]errorError details. Filled in only on error, when not NULL.
Returns
0 on success, non-zero error code otherwise.
int rte_tm_node_type_get ( uint8_t  port_id,
uint32_t  node_id,
int *  is_leaf,
struct rte_tm_error error 
)

Traffic manager node ID validate and type (i.e. leaf or non-leaf) get

The leaf nodes have predefined IDs in the range of 0 .. (N-1), where N is the number of TX queues of the current Ethernet port. The non-leaf nodes have their IDs generated by the application outside of the above range, which is reserved for leaf nodes.

Parameters
[in]port_idThe port identifier of the Ethernet device.
[in]node_idNode ID value. Needs to be valid.
[out]is_leafSet to non-zero value when node is leaf and to zero otherwise (non-leaf).
[out]errorError details. Filled in only on error, when not NULL.
Returns
0 on success, non-zero error code otherwise.
int rte_tm_capabilities_get ( uint8_t  port_id,
struct rte_tm_capabilities cap,
struct rte_tm_error error 
)

Traffic manager capabilities get

Parameters
[in]port_idThe port identifier of the Ethernet device.
[out]capTraffic manager capabilities. Needs to be pre-allocated and valid.
[out]errorError details. Filled in only on error, when not NULL.
Returns
0 on success, non-zero error code otherwise.
int rte_tm_level_capabilities_get ( uint8_t  port_id,
uint32_t  level_id,
struct rte_tm_level_capabilities cap,
struct rte_tm_error error 
)

Traffic manager level capabilities get

Parameters
[in]port_idThe port identifier of the Ethernet device.
[in]level_idThe hierarchy level identifier. The value of 0 identifies the level of the root node.
[out]capTraffic manager level capabilities. Needs to be pre-allocated and valid.
[out]errorError details. Filled in only on error, when not NULL.
Returns
0 on success, non-zero error code otherwise.
int rte_tm_node_capabilities_get ( uint8_t  port_id,
uint32_t  node_id,
struct rte_tm_node_capabilities cap,
struct rte_tm_error error 
)

Traffic manager node capabilities get

Parameters
[in]port_idThe port identifier of the Ethernet device.
[in]node_idNode ID. Needs to be valid.
[out]capTraffic manager node capabilities. Needs to be pre-allocated and valid.
[out]errorError details. Filled in only on error, when not NULL.
Returns
0 on success, non-zero error code otherwise.
int rte_tm_wred_profile_add ( uint8_t  port_id,
uint32_t  wred_profile_id,
struct rte_tm_wred_params profile,
struct rte_tm_error error 
)

Traffic manager WRED profile add

Create a new WRED profile with ID set to wred_profile_id. The new profile is used to create one or several WRED contexts.

Parameters
[in]port_idThe port identifier of the Ethernet device.
[in]wred_profile_idWRED profile ID for the new profile. Needs to be unused.
[in]profileWRED profile parameters. Needs to be pre-allocated and valid.
[out]errorError details. Filled in only on error, when not NULL.
Returns
0 on success, non-zero error code otherwise.
See Also
struct rte_tm_capabilities::cman_wred_context_n_max
int rte_tm_wred_profile_delete ( uint8_t  port_id,
uint32_t  wred_profile_id,
struct rte_tm_error error 
)

Traffic manager WRED profile delete

Delete an existing WRED profile. This operation fails when there is currently at least one user (i.e. WRED context) of this WRED profile.

Parameters
[in]port_idThe port identifier of the Ethernet device.
[in]wred_profile_idWRED profile ID. Needs to be the valid.
[out]errorError details. Filled in only on error, when not NULL.
Returns
0 on success, non-zero error code otherwise.
See Also
struct rte_tm_capabilities::cman_wred_context_n_max
int rte_tm_shared_wred_context_add_update ( uint8_t  port_id,
uint32_t  shared_wred_context_id,
uint32_t  wred_profile_id,
struct rte_tm_error error 
)

Traffic manager shared WRED context add or update

When shared_wred_context_id is invalid, a new WRED context with this ID is created by using the WRED profile identified by wred_profile_id.

When shared_wred_context_id is valid, this WRED context is no longer using the profile previously assigned to it and is updated to use the profile identified by wred_profile_id.

A valid shared WRED context can be assigned to several hierarchy leaf nodes configured to use WRED as the congestion management mode.

Parameters
[in]port_idThe port identifier of the Ethernet device.
[in]shared_wred_context_idShared WRED context ID
[in]wred_profile_idWRED profile ID. Needs to be the valid.
[out]errorError details. Filled in only on error, when not NULL.
Returns
0 on success, non-zero error code otherwise.
See Also
struct rte_tm_capabilities::cman_wred_context_shared_n_max
int rte_tm_shared_wred_context_delete ( uint8_t  port_id,
uint32_t  shared_wred_context_id,
struct rte_tm_error error 
)

Traffic manager shared WRED context delete

Delete an existing shared WRED context. This operation fails when there is currently at least one user (i.e. hierarchy leaf node) of this shared WRED context.

Parameters
[in]port_idThe port identifier of the Ethernet device.
[in]shared_wred_context_idShared WRED context ID. Needs to be the valid.
[out]errorError details. Filled in only on error, when not NULL.
Returns
0 on success, non-zero error code otherwise.
See Also
struct rte_tm_capabilities::cman_wred_context_shared_n_max
int rte_tm_shaper_profile_add ( uint8_t  port_id,
uint32_t  shaper_profile_id,
struct rte_tm_shaper_params profile,
struct rte_tm_error error 
)

Traffic manager shaper profile add

Create a new shaper profile with ID set to shaper_profile_id. The new shaper profile is used to create one or several shapers.

Parameters
[in]port_idThe port identifier of the Ethernet device.
[in]shaper_profile_idShaper profile ID for the new profile. Needs to be unused.
[in]profileShaper profile parameters. Needs to be pre-allocated and valid.
[out]errorError details. Filled in only on error, when not NULL.
Returns
0 on success, non-zero error code otherwise.
See Also
struct rte_tm_capabilities::shaper_n_max
int rte_tm_shaper_profile_delete ( uint8_t  port_id,
uint32_t  shaper_profile_id,
struct rte_tm_error error 
)

Traffic manager shaper profile delete

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

Parameters
[in]port_idThe port identifier of the Ethernet device.
[in]shaper_profile_idShaper profile ID. Needs to be the valid.
[out]errorError details. Filled in only on error, when not NULL.
Returns
0 on success, non-zero error code otherwise.
See Also
struct rte_tm_capabilities::shaper_n_max
int rte_tm_shared_shaper_add_update ( uint8_t  port_id,
uint32_t  shared_shaper_id,
uint32_t  shaper_profile_id,
struct rte_tm_error error 
)

Traffic manager shared shaper add or update

When shared_shaper_id is not a valid shared shaper ID, a new shared shaper with this ID is created using the shaper profile identified by shaper_profile_id.

When shared_shaper_id is a valid shared shaper ID, this shared shaper is no longer using the shaper profile previously assigned to it and is updated to use the shaper profile identified by shaper_profile_id.

Parameters
[in]port_idThe port identifier of the Ethernet device.
[in]shared_shaper_idShared shaper ID
[in]shaper_profile_idShaper profile ID. Needs to be the valid.
[out]errorError details. Filled in only on error, when not NULL.
Returns
0 on success, non-zero error code otherwise.
See Also
struct rte_tm_capabilities::shaper_shared_n_max
int rte_tm_shared_shaper_delete ( uint8_t  port_id,
uint32_t  shared_shaper_id,
struct rte_tm_error error 
)

Traffic manager shared shaper delete

Delete an existing shared shaper. This operation fails when there is currently at least one user (i.e. hierarchy node) of this shared shaper.

Parameters
[in]port_idThe port identifier of the Ethernet device.
[in]shared_shaper_idShared shaper ID. Needs to be the valid.
[out]errorError details. Filled in only on error, when not NULL.
Returns
0 on success, non-zero error code otherwise.
See Also
struct rte_tm_capabilities::shaper_shared_n_max
int rte_tm_node_add ( uint8_t  port_id,
uint32_t  node_id,
uint32_t  parent_node_id,
uint32_t  priority,
uint32_t  weight,
uint32_t  level_id,
struct rte_tm_node_params params,
struct rte_tm_error error 
)

Traffic manager node add

Create new node and connect it as child of an existing node. The new node is further identified by node_id, which needs to be unused by any of the existing nodes. The parent node is identified by parent_node_id, which needs to be the valid ID of an existing non-leaf node. The parent node is going to use the provided SP priority and WFQ weight to schedule its new child node.

This function has to be called for both leaf and non-leaf nodes. In the case of leaf nodes (i.e. node_id is within the range of 0 .. (N-1), with N as the number of configured TX queues of the current port), the leaf node is configured rather than created (as the set of leaf nodes is predefined) and it is also connected as child of an existing node.

The first node that is added becomes the root node and all the nodes that are subsequently added have to be added as descendants of the root node. The parent of the root node has to be specified as RTE_TM_NODE_ID_NULL and there can only be one node with this parent ID (i.e. the root node). Further restrictions for root node: needs to be non-leaf, its private shaper profile needs to be valid and single rate, cannot use any shared shapers.

When called before rte_tm_hierarchy_commit() invocation, this function is typically used to define the initial start-up hierarchy for the port. Provided that dynamic hierarchy updates are supported by the current port (as advertised in the port capability set), this function can be also called after the rte_tm_hierarchy_commit() invocation.

Parameters
[in]port_idThe port identifier of the Ethernet device.
[in]node_idNode ID. Needs to be unused by any of the existing nodes.
[in]parent_node_idParent node ID. Needs to be the valid.
[in]priorityNode priority. The highest node priority is zero. Used by the SP algorithm running on the parent of the current node for scheduling this child node.
[in]weightNode weight. The node weight is relative to the weight sum of all siblings that have the same priority. The lowest weight is one. Used by the WFQ algorithm running on the parent of the current node for scheduling this child node.
[in]level_idLevel ID that should be met by this node. The hierarchy level of the current node is already fully specified through its parent node (i.e. the level of this node is equal to the level of its parent node plus one), therefore the reason for providing this parameter is to enable the application to perform step-by-step checking of the node level during successive invocations of this function. When not desired, this check can be disabled by assigning value RTE_TM_NODE_LEVEL_ID_ANY to this parameter.
[in]paramsNode parameters. Needs to be pre-allocated and valid.
[out]errorError details. Filled in only on error, when not NULL.
Returns
0 on success, non-zero error code otherwise.
See Also
rte_tm_hierarchy_commit()
RTE_TM_UPDATE_NODE_ADD_DELETE
RTE_TM_NODE_LEVEL_ID_ANY
struct rte_tm_capabilities
int rte_tm_node_delete ( uint8_t  port_id,
uint32_t  node_id,
struct rte_tm_error error 
)

Traffic manager node delete

Delete an existing node. This operation fails when this node currently has at least one user (i.e. child node).

When called before rte_tm_hierarchy_commit() invocation, this function is typically used to define the initial start-up hierarchy for the port. Provided that dynamic hierarchy updates are supported by the current port (as advertised in the port capability set), this function can be also called after the rte_tm_hierarchy_commit() invocation.

Parameters
[in]port_idThe port identifier of the Ethernet device.
[in]node_idNode ID. Needs to be valid.
[out]errorError details. Filled in only on error, when not NULL.
Returns
0 on success, non-zero error code otherwise.
See Also
RTE_TM_UPDATE_NODE_ADD_DELETE
int rte_tm_node_suspend ( uint8_t  port_id,
uint32_t  node_id,
struct rte_tm_error error 
)

Traffic manager node suspend

Suspend an existing node. While the node is in suspended state, no packet is scheduled from this node and its descendants. The node exits the suspended state through the node resume operation.

Parameters
[in]port_idThe port identifier of the Ethernet device.
[in]node_idNode ID. Needs to be valid.
[out]errorError details. Filled in only on error, when not NULL.
Returns
0 on success, non-zero error code otherwise.
See Also
rte_tm_node_resume()
RTE_TM_UPDATE_NODE_SUSPEND_RESUME
int rte_tm_node_resume ( uint8_t  port_id,
uint32_t  node_id,
struct rte_tm_error error 
)

Traffic manager node resume

Resume an existing node that is currently in suspended state. The node entered the suspended state as result of a previous node suspend operation.

Parameters
[in]port_idThe port identifier of the Ethernet device.
[in]node_idNode ID. Needs to be valid.
[out]errorError details. Filled in only on error, when not NULL.
Returns
0 on success, non-zero error code otherwise.
See Also
rte_tm_node_suspend()
RTE_TM_UPDATE_NODE_SUSPEND_RESUME
int rte_tm_hierarchy_commit ( uint8_t  port_id,
int  clear_on_fail,
struct rte_tm_error error 
)

Traffic manager hierarchy commit

This function is called during the port initialization phase (before the Ethernet port is started) to freeze the start-up hierarchy.

This function typically performs the following steps: a) It validates the start-up hierarchy that was previously defined for the current port through successive rte_tm_node_add() invocations; b) Assuming successful validation, it performs all the necessary port specific configuration operations to install the specified hierarchy on the current port, with immediate effect once the port is started.

This function fails when the currently configured hierarchy is not supported by the Ethernet port, in which case the user can abort or try out another hierarchy configuration (e.g. a hierarchy with less leaf nodes), which can be build from scratch (when clear_on_fail is enabled) or by modifying the existing hierarchy configuration (when clear_on_fail is disabled).

Note that this function can still fail due to other causes (e.g. not enough memory available in the system, etc), even though the specified hierarchy is supported in principle by the current port.

Parameters
[in]port_idThe port identifier of the Ethernet device.
[in]clear_on_failOn function call failure, hierarchy is cleared when this parameter is non-zero and preserved when this parameter is equal to zero.
[out]errorError details. Filled in only on error, when not NULL.
Returns
0 on success, non-zero error code otherwise.
See Also
rte_tm_node_add()
rte_tm_node_delete()
int rte_tm_node_parent_update ( uint8_t  port_id,
uint32_t  node_id,
uint32_t  parent_node_id,
uint32_t  priority,
uint32_t  weight,
struct rte_tm_error error 
)

Traffic manager node parent update

Restriction for root node: its parent cannot be changed.

This function can only be called after the rte_tm_hierarchy_commit() invocation. Its success depends on the port support for this operation, as advertised through the port capability set.

Parameters
[in]port_idThe port identifier of the Ethernet device.
[in]node_idNode ID. Needs to be valid.
[in]parent_node_idNode ID for the new parent. Needs to be valid.
[in]priorityNode priority. The highest node priority is zero. Used by the SP algorithm running on the parent of the current node for scheduling this child node.
[in]weightNode weight. The node weight is relative to the weight sum of all siblings that have the same priority. The lowest weight is zero. Used by the WFQ algorithm running on the parent of the current node for scheduling this child node.
[out]errorError details. Filled in only on error, when not NULL.
Returns
0 on success, non-zero error code otherwise.
See Also
RTE_TM_UPDATE_NODE_PARENT_KEEP_LEVEL
RTE_TM_UPDATE_NODE_PARENT_CHANGE_LEVEL
int rte_tm_node_shaper_update ( uint8_t  port_id,
uint32_t  node_id,
uint32_t  shaper_profile_id,
struct rte_tm_error error 
)

Traffic manager node private shaper update

Restriction for the root node: its private shaper profile needs to be valid and single rate.

Parameters
[in]port_idThe port identifier of the Ethernet device.
[in]node_idNode ID. Needs to be valid.
[in]shaper_profile_idShaper profile ID for the private shaper of the current node. Needs to be either valid shaper profile ID or RTE_TM_SHAPER_PROFILE_ID_NONE, with the latter disabling the private shaper of the current node.
[out]errorError details. Filled in only on error, when not NULL.
Returns
0 on success, non-zero error code otherwise.
See Also
struct rte_tm_capabilities::shaper_private_n_max
int rte_tm_node_shared_shaper_update ( uint8_t  port_id,
uint32_t  node_id,
uint32_t  shared_shaper_id,
int  add,
struct rte_tm_error error 
)

Traffic manager node shared shapers update

Restriction for root node: cannot use any shared rate shapers.

Parameters
[in]port_idThe port identifier of the Ethernet device.
[in]node_idNode ID. Needs to be valid.
[in]shared_shaper_idShared shaper ID. Needs to be valid.
[in]addSet to non-zero value to add this shared shaper to current node or to zero to delete this shared shaper from current node.
[out]errorError details. Filled in only on error, when not NULL.
Returns
0 on success, non-zero error code otherwise.
See Also
struct rte_tm_capabilities::shaper_shared_n_max
int rte_tm_node_stats_update ( uint8_t  port_id,
uint32_t  node_id,
uint64_t  stats_mask,
struct rte_tm_error error 
)

Traffic manager node enabled statistics counters update

Parameters
[in]port_idThe port identifier of the Ethernet device.
[in]node_idNode ID. Needs to be valid.
[in]stats_maskMask of statistics counter types to be enabled for the current node. This needs to be a subset of the statistics counter types available for the current node. Any statistics counter type not included in this set is to be disabled for the current node.
[out]errorError details. Filled in only on error, when not NULL.
Returns
0 on success, non-zero error code otherwise.
See Also
enum rte_tm_stats_type
RTE_TM_UPDATE_NODE_STATS
int rte_tm_node_wfq_weight_mode_update ( uint8_t  port_id,
uint32_t  node_id,
int *  wfq_weight_mode,
uint32_t  n_sp_priorities,
struct rte_tm_error error 
)

Traffic manager node WFQ weight mode update

Parameters
[in]port_idThe port identifier of the Ethernet device.
[in]node_idNode ID. Needs to be valid leaf node ID.
[in]wfq_weight_modeWFQ weight mode for each SP priority. When NULL, it indicates that WFQ is to be used for all priorities. When non-NULL, it points to a pre-allocated array of n_sp_priorities values, with non-zero value for byte-mode and zero for packet-mode.
[in]n_sp_prioritiesNumber of SP priorities.
[out]errorError details. Filled in only on error, when not NULL.
Returns
0 on success, non-zero error code otherwise.
See Also
RTE_TM_UPDATE_NODE_WFQ_WEIGHT_MODE
RTE_TM_UPDATE_NODE_N_SP_PRIORITIES
int rte_tm_node_cman_update ( uint8_t  port_id,
uint32_t  node_id,
enum rte_tm_cman_mode  cman,
struct rte_tm_error error 
)

Traffic manager node congestion management mode update

Parameters
[in]port_idThe port identifier of the Ethernet device.
[in]node_idNode ID. Needs to be valid leaf node ID.
[in]cmanCongestion management mode.
[out]errorError details. Filled in only on error, when not NULL.
Returns
0 on success, non-zero error code otherwise.
See Also
RTE_TM_UPDATE_NODE_CMAN
int rte_tm_node_wred_context_update ( uint8_t  port_id,
uint32_t  node_id,
uint32_t  wred_profile_id,
struct rte_tm_error error 
)

Traffic manager node private WRED context update

Parameters
[in]port_idThe port identifier of the Ethernet device.
[in]node_idNode ID. Needs to be valid leaf node ID.
[in]wred_profile_idWRED profile ID for the private WRED context of the current node. Needs to be either valid WRED profile ID or RTE_TM_WRED_PROFILE_ID_NONE, with the latter disabling the private WRED context of the current node.
[out]errorError details. Filled in only on error, when not NULL.
Returns
0 on success, non-zero error code otherwise.
See Also
struct rte_tm_capabilities::cman_wred_context_private_n_max
int rte_tm_node_shared_wred_context_update ( uint8_t  port_id,
uint32_t  node_id,
uint32_t  shared_wred_context_id,
int  add,
struct rte_tm_error error 
)

Traffic manager node shared WRED context update

Parameters
[in]port_idThe port identifier of the Ethernet device.
[in]node_idNode ID. Needs to be valid leaf node ID.
[in]shared_wred_context_idShared WRED context ID. Needs to be valid.
[in]addSet to non-zero value to add this shared WRED context to current node or to zero to delete this shared WRED context from current node.
[out]errorError details. Filled in only on error, when not NULL.
Returns
0 on success, non-zero error code otherwise.
See Also
struct rte_tm_capabilities::cman_wred_context_shared_n_max
int rte_tm_node_stats_read ( uint8_t  port_id,
uint32_t  node_id,
struct rte_tm_node_stats stats,
uint64_t *  stats_mask,
int  clear,
struct rte_tm_error error 
)

Traffic manager node statistics counters read

Parameters
[in]port_idThe port identifier of the Ethernet device.
[in]node_idNode ID. Needs to be valid.
[out]statsWhen non-NULL, it contains the current value for the statistics counters enabled for the current node.
[out]stats_maskWhen non-NULL, it contains the mask of statistics counter types that are currently enabled for this node, indicating which of the counters retrieved with the stats structure are valid.
[in]clearWhen 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.
[out]errorError details. Filled in only on error, when not NULL.
Returns
0 on success, non-zero error code otherwise.
See Also
enum rte_tm_stats_type
int rte_tm_mark_vlan_dei ( uint8_t  port_id,
int  mark_green,
int  mark_yellow,
int  mark_red,
struct rte_tm_error error 
)

Traffic manager packet marking - VLAN DEI (IEEE 802.1Q)

IEEE 802.1p maps the traffic class to the VLAN Priority Code Point (PCP) field (3 bits), while IEEE 802.1q maps the drop priority to the VLAN Drop Eligible Indicator (DEI) field (1 bit), which was previously named Canonical Format Indicator (CFI).

All VLAN frames of a given color get their DEI bit set if marking is enabled for this color; otherwise, their DEI bit is left as is (either set or not).

Parameters
[in]port_idThe port identifier of the Ethernet device.
[in]mark_greenSet to non-zero value to enable marking of green packets and to zero to disable it.
[in]mark_yellowSet to non-zero value to enable marking of yellow packets and to zero to disable it.
[in]mark_redSet to non-zero value to enable marking of red packets and to zero to disable it.
[out]errorError details. Filled in only on error, when not NULL.
Returns
0 on success, non-zero error code otherwise.
See Also
struct rte_tm_capabilities::mark_vlan_dei_supported
int rte_tm_mark_ip_ecn ( uint8_t  port_id,
int  mark_green,
int  mark_yellow,
int  mark_red,
struct rte_tm_error error 
)

Traffic manager packet marking - IPv4 / IPv6 ECN (IETF RFC 3168)

IETF RFCs 2474 and 3168 reorganize the IPv4 Type of Service (TOS) field (8 bits) and the IPv6 Traffic Class (TC) field (8 bits) into Differentiated Services Codepoint (DSCP) field (6 bits) and Explicit Congestion Notification (ECN) field (2 bits). The DSCP field is typically used to encode the traffic class and/or drop priority (RFC 2597), while the ECN field is used by RFC 3168 to implement a congestion notification mechanism to be leveraged by transport layer protocols such as TCP and SCTP that have congestion control mechanisms.

When congestion is experienced, as alternative to dropping the packet, routers can change the ECN field of input packets from 2'b01 or 2'b10 (values indicating that source endpoint is ECN-capable) to 2'b11 (meaning that congestion is experienced). The destination endpoint can use the ECN-Echo (ECE) TCP flag to relay the congestion indication back to the source endpoint, which acknowledges it back to the destination endpoint with the Congestion Window Reduced (CWR) TCP flag.

All IPv4/IPv6 packets of a given color with ECN set to 2’b01 or 2’b10 carrying TCP or SCTP have their ECN set to 2’b11 if the marking feature is enabled for the current color, otherwise the ECN field is left as is.

Parameters
[in]port_idThe port identifier of the Ethernet device.
[in]mark_greenSet to non-zero value to enable marking of green packets and to zero to disable it.
[in]mark_yellowSet to non-zero value to enable marking of yellow packets and to zero to disable it.
[in]mark_redSet to non-zero value to enable marking of red packets and to zero to disable it.
[out]errorError details. Filled in only on error, when not NULL.
Returns
0 on success, non-zero error code otherwise.
See Also
struct rte_tm_capabilities::mark_ip_ecn_tcp_supported
struct rte_tm_capabilities::mark_ip_ecn_sctp_supported
int rte_tm_mark_ip_dscp ( uint8_t  port_id,
int  mark_green,
int  mark_yellow,
int  mark_red,
struct rte_tm_error error 
)

Traffic manager packet marking - IPv4 / IPv6 DSCP (IETF RFC 2597)

IETF RFC 2597 maps the traffic class and the drop priority to the IPv4/IPv6 Differentiated Services Codepoint (DSCP) field (6 bits). Here are the DSCP values proposed by this RFC:

                   Class 1    Class 2    Class 3    Class 4   
                 +----------+----------+----------+----------+
Low Drop Prec    |  001010  |  010010  |  011010  |  100010  |
Medium Drop Prec |  001100  |  010100  |  011100  |  100100  |
High Drop Prec   |  001110  |  010110  |  011110  |  100110  |
                 +----------+----------+----------+----------+

There are 4 traffic classes (classes 1 .. 4) encoded by DSCP bits 1 and 2, as well as 3 drop priorities (low/medium/high) encoded by DSCP bits 3 and 4.

All IPv4/IPv6 packets have their color marked into DSCP bits 3 and 4 as follows: green mapped to Low Drop Precedence (2’b01), yellow to Medium (2’b10) and red to High (2’b11). Marking needs to be explicitly enabled for each color; when not enabled for a given color, the DSCP field of all packets with that color is left as is.

Parameters
[in]port_idThe port identifier of the Ethernet device.
[in]mark_greenSet to non-zero value to enable marking of green packets and to zero to disable it.
[in]mark_yellowSet to non-zero value to enable marking of yellow packets and to zero to disable it.
[in]mark_redSet to non-zero value to enable marking of red packets and to zero to disable it.
[out]errorError details. Filled in only on error, when not NULL.
Returns
0 on success, non-zero error code otherwise.
See Also
struct rte_tm_capabilities::mark_ip_dscp_supported