199a2dd95SBruce Richardson /* SPDX-License-Identifier: BSD-3-Clause 299a2dd95SBruce Richardson * Copyright(c) 2017 Intel Corporation. 399a2dd95SBruce Richardson * Copyright(c) 2017 Cavium. 499a2dd95SBruce Richardson * Copyright(c) 2017 NXP. 599a2dd95SBruce Richardson */ 699a2dd95SBruce Richardson 799a2dd95SBruce Richardson #ifndef __INCLUDE_RTE_TM_H__ 899a2dd95SBruce Richardson #define __INCLUDE_RTE_TM_H__ 999a2dd95SBruce Richardson 1099a2dd95SBruce Richardson /** 1199a2dd95SBruce Richardson * @file 1299a2dd95SBruce Richardson * RTE Generic Traffic Manager API 1399a2dd95SBruce Richardson * 1499a2dd95SBruce Richardson * This interface provides the ability to configure the traffic manager in a 1599a2dd95SBruce Richardson * generic way. It includes features such as: hierarchical scheduling, 1699a2dd95SBruce Richardson * traffic shaping, congestion management, packet marking, etc. 1799a2dd95SBruce Richardson * 1899a2dd95SBruce Richardson * @warning 1999a2dd95SBruce Richardson * @b EXPERIMENTAL: 2099a2dd95SBruce Richardson * All functions in this file may be changed or removed without prior notice. 2199a2dd95SBruce Richardson */ 2299a2dd95SBruce Richardson 2399a2dd95SBruce Richardson #include <stdint.h> 2499a2dd95SBruce Richardson 2599a2dd95SBruce Richardson #include <rte_common.h> 2699a2dd95SBruce Richardson #include <rte_meter.h> 2799a2dd95SBruce Richardson 2899a2dd95SBruce Richardson #ifdef __cplusplus 2999a2dd95SBruce Richardson extern "C" { 3099a2dd95SBruce Richardson #endif 3199a2dd95SBruce Richardson 3299a2dd95SBruce Richardson /** 3399a2dd95SBruce Richardson * Ethernet framing overhead. 3499a2dd95SBruce Richardson * 3599a2dd95SBruce Richardson * Overhead fields per Ethernet frame: 3699a2dd95SBruce Richardson * 1. Preamble: 7 bytes; 3799a2dd95SBruce Richardson * 2. Start of Frame Delimiter (SFD): 1 byte; 3899a2dd95SBruce Richardson * 3. Inter-Frame Gap (IFG): 12 bytes. 3999a2dd95SBruce Richardson * 4099a2dd95SBruce Richardson * One of the typical values for the *pkt_length_adjust* field of the shaper 4199a2dd95SBruce Richardson * profile. 4299a2dd95SBruce Richardson * 4399a2dd95SBruce Richardson * @see struct rte_tm_shaper_params 4499a2dd95SBruce Richardson */ 4599a2dd95SBruce Richardson #define RTE_TM_ETH_FRAMING_OVERHEAD 20 4699a2dd95SBruce Richardson 4799a2dd95SBruce Richardson /** 4899a2dd95SBruce Richardson * Ethernet framing overhead including the Frame Check Sequence (FCS) field. 4999a2dd95SBruce Richardson * Useful when FCS is generated and added at the end of the Ethernet frame on 50*09fd4227SAndrew Rybchenko * Tx side without any SW intervention. 5199a2dd95SBruce Richardson * 5299a2dd95SBruce Richardson * One of the typical values for the pkt_length_adjust field of the shaper 5399a2dd95SBruce Richardson * profile. 5499a2dd95SBruce Richardson * 5599a2dd95SBruce Richardson * @see struct rte_tm_shaper_params 5699a2dd95SBruce Richardson */ 5799a2dd95SBruce Richardson #define RTE_TM_ETH_FRAMING_OVERHEAD_FCS 24 5899a2dd95SBruce Richardson 5999a2dd95SBruce Richardson /** 6099a2dd95SBruce Richardson * Invalid WRED profile ID. 6199a2dd95SBruce Richardson * 6299a2dd95SBruce Richardson * @see struct rte_tm_node_params 6399a2dd95SBruce Richardson * @see rte_tm_node_add() 6499a2dd95SBruce Richardson * @see rte_tm_node_wred_context_update() 6599a2dd95SBruce Richardson */ 6699a2dd95SBruce Richardson #define RTE_TM_WRED_PROFILE_ID_NONE UINT32_MAX 6799a2dd95SBruce Richardson 6899a2dd95SBruce Richardson /** 6999a2dd95SBruce Richardson *Invalid shaper profile ID. 7099a2dd95SBruce Richardson * 7199a2dd95SBruce Richardson * @see struct rte_tm_node_params 7299a2dd95SBruce Richardson * @see rte_tm_node_add() 7399a2dd95SBruce Richardson * @see rte_tm_node_shaper_update() 7499a2dd95SBruce Richardson */ 7599a2dd95SBruce Richardson #define RTE_TM_SHAPER_PROFILE_ID_NONE UINT32_MAX 7699a2dd95SBruce Richardson 7799a2dd95SBruce Richardson /** 7899a2dd95SBruce Richardson * Node ID for the parent of the root node. 7999a2dd95SBruce Richardson * 8099a2dd95SBruce Richardson * @see rte_tm_node_add() 8199a2dd95SBruce Richardson */ 8299a2dd95SBruce Richardson #define RTE_TM_NODE_ID_NULL UINT32_MAX 8399a2dd95SBruce Richardson 8499a2dd95SBruce Richardson /** 8599a2dd95SBruce Richardson * Node level ID used to disable level ID checking. 8699a2dd95SBruce Richardson * 8799a2dd95SBruce Richardson * @see rte_tm_node_add() 8899a2dd95SBruce Richardson */ 8999a2dd95SBruce Richardson #define RTE_TM_NODE_LEVEL_ID_ANY UINT32_MAX 9099a2dd95SBruce Richardson 9199a2dd95SBruce Richardson /** 9299a2dd95SBruce Richardson * Node statistics counter type 9399a2dd95SBruce Richardson */ 9499a2dd95SBruce Richardson enum rte_tm_stats_type { 9599a2dd95SBruce Richardson /** Number of packets scheduled from current node. */ 9699a2dd95SBruce Richardson RTE_TM_STATS_N_PKTS = 1 << 0, 9799a2dd95SBruce Richardson 9899a2dd95SBruce Richardson /** Number of bytes scheduled from current node. */ 9999a2dd95SBruce Richardson RTE_TM_STATS_N_BYTES = 1 << 1, 10099a2dd95SBruce Richardson 10199a2dd95SBruce Richardson /** Number of green packets dropped by current leaf node. */ 10299a2dd95SBruce Richardson RTE_TM_STATS_N_PKTS_GREEN_DROPPED = 1 << 2, 10399a2dd95SBruce Richardson 10499a2dd95SBruce Richardson /** Number of yellow packets dropped by current leaf node. */ 10599a2dd95SBruce Richardson RTE_TM_STATS_N_PKTS_YELLOW_DROPPED = 1 << 3, 10699a2dd95SBruce Richardson 10799a2dd95SBruce Richardson /** Number of red packets dropped by current leaf node. */ 10899a2dd95SBruce Richardson RTE_TM_STATS_N_PKTS_RED_DROPPED = 1 << 4, 10999a2dd95SBruce Richardson 11099a2dd95SBruce Richardson /** Number of green bytes dropped by current leaf node. */ 11199a2dd95SBruce Richardson RTE_TM_STATS_N_BYTES_GREEN_DROPPED = 1 << 5, 11299a2dd95SBruce Richardson 11399a2dd95SBruce Richardson /** Number of yellow bytes dropped by current leaf node. */ 11499a2dd95SBruce Richardson RTE_TM_STATS_N_BYTES_YELLOW_DROPPED = 1 << 6, 11599a2dd95SBruce Richardson 11699a2dd95SBruce Richardson /** Number of red bytes dropped by current leaf node. */ 11799a2dd95SBruce Richardson RTE_TM_STATS_N_BYTES_RED_DROPPED = 1 << 7, 11899a2dd95SBruce Richardson 11999a2dd95SBruce Richardson /** Number of packets currently waiting in the packet queue of current 12099a2dd95SBruce Richardson * leaf node. 12199a2dd95SBruce Richardson */ 12299a2dd95SBruce Richardson RTE_TM_STATS_N_PKTS_QUEUED = 1 << 8, 12399a2dd95SBruce Richardson 12499a2dd95SBruce Richardson /** Number of bytes currently waiting in the packet queue of current 12599a2dd95SBruce Richardson * leaf node. 12699a2dd95SBruce Richardson */ 12799a2dd95SBruce Richardson RTE_TM_STATS_N_BYTES_QUEUED = 1 << 9, 12899a2dd95SBruce Richardson }; 12999a2dd95SBruce Richardson 13099a2dd95SBruce Richardson /** 13199a2dd95SBruce Richardson * Node statistics counters 13299a2dd95SBruce Richardson */ 13399a2dd95SBruce Richardson struct rte_tm_node_stats { 13499a2dd95SBruce Richardson /** Number of packets scheduled from current node. */ 13599a2dd95SBruce Richardson uint64_t n_pkts; 13699a2dd95SBruce Richardson 13799a2dd95SBruce Richardson /** Number of bytes scheduled from current node. */ 13899a2dd95SBruce Richardson uint64_t n_bytes; 13999a2dd95SBruce Richardson 14099a2dd95SBruce Richardson /** Statistics counters for leaf nodes only. */ 14199a2dd95SBruce Richardson struct { 14299a2dd95SBruce Richardson /** Number of packets dropped by current leaf node per each 14399a2dd95SBruce Richardson * color. 14499a2dd95SBruce Richardson */ 14599a2dd95SBruce Richardson uint64_t n_pkts_dropped[RTE_COLORS]; 14699a2dd95SBruce Richardson 14799a2dd95SBruce Richardson /** Number of bytes dropped by current leaf node per each 14899a2dd95SBruce Richardson * color. 14999a2dd95SBruce Richardson */ 15099a2dd95SBruce Richardson uint64_t n_bytes_dropped[RTE_COLORS]; 15199a2dd95SBruce Richardson 15299a2dd95SBruce Richardson /** Number of packets currently waiting in the packet queue of 15399a2dd95SBruce Richardson * current leaf node. 15499a2dd95SBruce Richardson */ 15599a2dd95SBruce Richardson uint64_t n_pkts_queued; 15699a2dd95SBruce Richardson 15799a2dd95SBruce Richardson /** Number of bytes currently waiting in the packet queue of 15899a2dd95SBruce Richardson * current leaf node. 15999a2dd95SBruce Richardson */ 16099a2dd95SBruce Richardson uint64_t n_bytes_queued; 16199a2dd95SBruce Richardson } leaf; 16299a2dd95SBruce Richardson }; 16399a2dd95SBruce Richardson 16499a2dd95SBruce Richardson /** 16599a2dd95SBruce Richardson * Traffic manager dynamic updates 16699a2dd95SBruce Richardson */ 16799a2dd95SBruce Richardson enum rte_tm_dynamic_update_type { 16899a2dd95SBruce Richardson /** Dynamic parent node update. The new parent node is located on same 16999a2dd95SBruce Richardson * hierarchy level as the former parent node. Consequently, the node 17099a2dd95SBruce Richardson * whose parent is changed preserves its hierarchy level. 17199a2dd95SBruce Richardson */ 17299a2dd95SBruce Richardson RTE_TM_UPDATE_NODE_PARENT_KEEP_LEVEL = 1 << 0, 17399a2dd95SBruce Richardson 17499a2dd95SBruce Richardson /** Dynamic parent node update. The new parent node is located on 17599a2dd95SBruce Richardson * different hierarchy level than the former parent node. Consequently, 17699a2dd95SBruce Richardson * the node whose parent is changed also changes its hierarchy level. 17799a2dd95SBruce Richardson */ 17899a2dd95SBruce Richardson RTE_TM_UPDATE_NODE_PARENT_CHANGE_LEVEL = 1 << 1, 17999a2dd95SBruce Richardson 18099a2dd95SBruce Richardson /** Dynamic node add/delete. */ 18199a2dd95SBruce Richardson RTE_TM_UPDATE_NODE_ADD_DELETE = 1 << 2, 18299a2dd95SBruce Richardson 18399a2dd95SBruce Richardson /** Suspend/resume nodes. */ 18499a2dd95SBruce Richardson RTE_TM_UPDATE_NODE_SUSPEND_RESUME = 1 << 3, 18599a2dd95SBruce Richardson 18699a2dd95SBruce Richardson /** Dynamic switch between byte-based and packet-based WFQ weights. */ 18799a2dd95SBruce Richardson RTE_TM_UPDATE_NODE_WFQ_WEIGHT_MODE = 1 << 4, 18899a2dd95SBruce Richardson 18999a2dd95SBruce Richardson /** Dynamic update on number of SP priorities. */ 19099a2dd95SBruce Richardson RTE_TM_UPDATE_NODE_N_SP_PRIORITIES = 1 << 5, 19199a2dd95SBruce Richardson 19299a2dd95SBruce Richardson /** Dynamic update of congestion management mode for leaf nodes. */ 19399a2dd95SBruce Richardson RTE_TM_UPDATE_NODE_CMAN = 1 << 6, 19499a2dd95SBruce Richardson 19599a2dd95SBruce Richardson /** Dynamic update of the set of enabled stats counter types. */ 19699a2dd95SBruce Richardson RTE_TM_UPDATE_NODE_STATS = 1 << 7, 19799a2dd95SBruce Richardson }; 19899a2dd95SBruce Richardson 19999a2dd95SBruce Richardson /** 20099a2dd95SBruce Richardson * Traffic manager capabilities 20199a2dd95SBruce Richardson */ 20299a2dd95SBruce Richardson struct rte_tm_capabilities { 20399a2dd95SBruce Richardson /** Maximum number of nodes. */ 20499a2dd95SBruce Richardson uint32_t n_nodes_max; 20599a2dd95SBruce Richardson 20699a2dd95SBruce Richardson /** Maximum number of levels (i.e. number of nodes connecting the root 20799a2dd95SBruce Richardson * node with any leaf node, including the root and the leaf). 20899a2dd95SBruce Richardson */ 20999a2dd95SBruce Richardson uint32_t n_levels_max; 21099a2dd95SBruce Richardson 21199a2dd95SBruce Richardson /** When non-zero, this flag indicates that all the non-leaf nodes 21299a2dd95SBruce Richardson * (with the exception of the root node) have identical capability set. 21399a2dd95SBruce Richardson */ 21499a2dd95SBruce Richardson int non_leaf_nodes_identical; 21599a2dd95SBruce Richardson 21699a2dd95SBruce Richardson /** When non-zero, this flag indicates that all the leaf nodes have 21799a2dd95SBruce Richardson * identical capability set. 21899a2dd95SBruce Richardson */ 21999a2dd95SBruce Richardson int leaf_nodes_identical; 22099a2dd95SBruce Richardson 22199a2dd95SBruce Richardson /** Maximum number of shapers, either private or shared. In case the 22299a2dd95SBruce Richardson * implementation does not share any resources between private and 22399a2dd95SBruce Richardson * shared shapers, it is typically equal to the sum of 22499a2dd95SBruce Richardson * *shaper_private_n_max* and *shaper_shared_n_max*. The 22599a2dd95SBruce Richardson * value of zero indicates that traffic shaping is not supported. 22699a2dd95SBruce Richardson */ 22799a2dd95SBruce Richardson uint32_t shaper_n_max; 22899a2dd95SBruce Richardson 22999a2dd95SBruce Richardson /** Maximum number of private shapers. Indicates the maximum number of 23099a2dd95SBruce Richardson * nodes that can concurrently have their private shaper enabled. The 23199a2dd95SBruce Richardson * value of zero indicates that private shapers are not supported. 23299a2dd95SBruce Richardson */ 23399a2dd95SBruce Richardson uint32_t shaper_private_n_max; 23499a2dd95SBruce Richardson 23599a2dd95SBruce Richardson /** Maximum number of private shapers that support dual rate shaping. 23699a2dd95SBruce Richardson * Indicates the maximum number of nodes that can concurrently have 23799a2dd95SBruce Richardson * their private shaper enabled with dual rate support. Only valid when 23899a2dd95SBruce Richardson * private shapers are supported. The value of zero indicates that dual 23999a2dd95SBruce Richardson * rate shaping is not available for private shapers. The maximum value 24099a2dd95SBruce Richardson * is *shaper_private_n_max*. 24199a2dd95SBruce Richardson */ 24299a2dd95SBruce Richardson int shaper_private_dual_rate_n_max; 24399a2dd95SBruce Richardson 24499a2dd95SBruce Richardson /** Minimum committed/peak rate (bytes per second) for any private 24599a2dd95SBruce Richardson * shaper. Valid only when private shapers are supported. 24699a2dd95SBruce Richardson */ 24799a2dd95SBruce Richardson uint64_t shaper_private_rate_min; 24899a2dd95SBruce Richardson 24999a2dd95SBruce Richardson /** Maximum committed/peak rate (bytes per second) for any private 25099a2dd95SBruce Richardson * shaper. Valid only when private shapers are supported. 25199a2dd95SBruce Richardson */ 25299a2dd95SBruce Richardson uint64_t shaper_private_rate_max; 25399a2dd95SBruce Richardson 25499a2dd95SBruce Richardson /** Shaper private packet mode supported. When non-zero, this parameter 25599a2dd95SBruce Richardson * indicates that there is at least one node that can be configured 25699a2dd95SBruce Richardson * with packet mode in its private shaper. When shaper is configured 25799a2dd95SBruce Richardson * in packet mode, committed/peak rate provided is interpreted 25899a2dd95SBruce Richardson * in packets per second. 25999a2dd95SBruce Richardson */ 26099a2dd95SBruce Richardson int shaper_private_packet_mode_supported; 26199a2dd95SBruce Richardson 26299a2dd95SBruce Richardson /** Shaper private byte mode supported. When non-zero, this parameter 26399a2dd95SBruce Richardson * indicates that there is at least one node that can be configured 26499a2dd95SBruce Richardson * with byte mode in its private shaper. When shaper is configured 26599a2dd95SBruce Richardson * in byte mode, committed/peak rate provided is interpreted in 26699a2dd95SBruce Richardson * bytes per second. 26799a2dd95SBruce Richardson */ 26899a2dd95SBruce Richardson int shaper_private_byte_mode_supported; 26999a2dd95SBruce Richardson 27099a2dd95SBruce Richardson 27199a2dd95SBruce Richardson /** Maximum number of shared shapers. The value of zero indicates that 27299a2dd95SBruce Richardson * shared shapers are not supported. 27399a2dd95SBruce Richardson */ 27499a2dd95SBruce Richardson uint32_t shaper_shared_n_max; 27599a2dd95SBruce Richardson 27699a2dd95SBruce Richardson /** Maximum number of nodes that can share the same shared shaper. 27799a2dd95SBruce Richardson * Only valid when shared shapers are supported. 27899a2dd95SBruce Richardson */ 27999a2dd95SBruce Richardson uint32_t shaper_shared_n_nodes_per_shaper_max; 28099a2dd95SBruce Richardson 28199a2dd95SBruce Richardson /** Maximum number of shared shapers a node can be part of. This 28299a2dd95SBruce Richardson * parameter indicates that there is at least one node that can be 28399a2dd95SBruce Richardson * configured with this many shared shapers, which might not be true for 28499a2dd95SBruce Richardson * all the nodes. Only valid when shared shapers are supported, in which 28599a2dd95SBruce Richardson * case it ranges from 1 to *shaper_shared_n_max*. 28699a2dd95SBruce Richardson */ 28799a2dd95SBruce Richardson uint32_t shaper_shared_n_shapers_per_node_max; 28899a2dd95SBruce Richardson 28999a2dd95SBruce Richardson /** Maximum number of shared shapers that can be configured with dual 29099a2dd95SBruce Richardson * rate shaping. The value of zero indicates that dual rate shaping 29199a2dd95SBruce Richardson * support is not available for shared shapers. 29299a2dd95SBruce Richardson */ 29399a2dd95SBruce Richardson uint32_t shaper_shared_dual_rate_n_max; 29499a2dd95SBruce Richardson 29599a2dd95SBruce Richardson /** Minimum committed/peak rate (bytes per second) for any shared 29699a2dd95SBruce Richardson * shaper. Only valid when shared shapers are supported. 29799a2dd95SBruce Richardson */ 29899a2dd95SBruce Richardson uint64_t shaper_shared_rate_min; 29999a2dd95SBruce Richardson 30099a2dd95SBruce Richardson /** Maximum committed/peak rate (bytes per second) for any shared 30199a2dd95SBruce Richardson * shaper. Only valid when shared shapers are supported. 30299a2dd95SBruce Richardson */ 30399a2dd95SBruce Richardson uint64_t shaper_shared_rate_max; 30499a2dd95SBruce Richardson 30599a2dd95SBruce Richardson /** Shaper shared packet mode supported. When non-zero, this parameter 30699a2dd95SBruce Richardson * indicates a shared shaper can be configured with packet mode. 30799a2dd95SBruce Richardson * When shared shaper is configured in packet mode, committed/peak rate 30899a2dd95SBruce Richardson * provided is interpreted in packets per second. 30999a2dd95SBruce Richardson */ 31099a2dd95SBruce Richardson int shaper_shared_packet_mode_supported; 31199a2dd95SBruce Richardson 31299a2dd95SBruce Richardson /** Shaper shared byte mode supported. When non-zero, this parameter 31399a2dd95SBruce Richardson * indicates that a shared shaper can be configured with byte mode. 31499a2dd95SBruce Richardson * When shared shaper is configured in byte mode, committed/peak rate 31599a2dd95SBruce Richardson * provided is interpreted in bytes per second. 31699a2dd95SBruce Richardson */ 31799a2dd95SBruce Richardson int shaper_shared_byte_mode_supported; 31899a2dd95SBruce Richardson 31999a2dd95SBruce Richardson 32099a2dd95SBruce Richardson /** Minimum value allowed for packet length adjustment for any private 32199a2dd95SBruce Richardson * or shared shaper. 32299a2dd95SBruce Richardson */ 32399a2dd95SBruce Richardson int shaper_pkt_length_adjust_min; 32499a2dd95SBruce Richardson 32599a2dd95SBruce Richardson /** Maximum value allowed for packet length adjustment for any private 32699a2dd95SBruce Richardson * or shared shaper. 32799a2dd95SBruce Richardson */ 32899a2dd95SBruce Richardson int shaper_pkt_length_adjust_max; 32999a2dd95SBruce Richardson 33099a2dd95SBruce Richardson /** Maximum number of children nodes. This parameter indicates that 33199a2dd95SBruce Richardson * there is at least one non-leaf node that can be configured with this 33299a2dd95SBruce Richardson * many children nodes, which might not be true for all the non-leaf 33399a2dd95SBruce Richardson * nodes. 33499a2dd95SBruce Richardson */ 33599a2dd95SBruce Richardson uint32_t sched_n_children_max; 33699a2dd95SBruce Richardson 33799a2dd95SBruce Richardson /** Maximum number of supported priority levels. This parameter 33899a2dd95SBruce Richardson * indicates that there is at least one non-leaf node that can be 33999a2dd95SBruce Richardson * configured with this many priority levels for managing its children 34099a2dd95SBruce Richardson * nodes, which might not be true for all the non-leaf nodes. The value 34199a2dd95SBruce Richardson * of zero is invalid. The value of 1 indicates that only priority 0 is 34299a2dd95SBruce Richardson * supported, which essentially means that Strict Priority (SP) 34399a2dd95SBruce Richardson * algorithm is not supported. 34499a2dd95SBruce Richardson */ 34599a2dd95SBruce Richardson uint32_t sched_sp_n_priorities_max; 34699a2dd95SBruce Richardson 34799a2dd95SBruce Richardson /** Maximum number of sibling nodes that can have the same priority at 34899a2dd95SBruce Richardson * any given time, i.e. maximum size of the WFQ sibling node group. This 34999a2dd95SBruce Richardson * parameter indicates there is at least one non-leaf node that meets 35099a2dd95SBruce Richardson * this condition, which might not be true for all the non-leaf nodes. 35199a2dd95SBruce Richardson * The value of zero is invalid. The value of 1 indicates that WFQ 35299a2dd95SBruce Richardson * algorithm is not supported. The maximum value is 35399a2dd95SBruce Richardson * *sched_n_children_max*. 35499a2dd95SBruce Richardson */ 35599a2dd95SBruce Richardson uint32_t sched_wfq_n_children_per_group_max; 35699a2dd95SBruce Richardson 35799a2dd95SBruce Richardson /** Maximum number of priority levels that can have more than one child 35899a2dd95SBruce Richardson * node at any given time, i.e. maximum number of WFQ sibling node 35999a2dd95SBruce Richardson * groups that have two or more members. This parameter indicates there 36099a2dd95SBruce Richardson * is at least one non-leaf node that meets this condition, which might 36199a2dd95SBruce Richardson * not be true for all the non-leaf nodes. The value of zero states that 36299a2dd95SBruce Richardson * WFQ algorithm is not supported. The value of 1 indicates that 36399a2dd95SBruce Richardson * (*sched_sp_n_priorities_max* - 1) priority levels have at most one 36499a2dd95SBruce Richardson * child node, so there can be only one priority level with two or 36599a2dd95SBruce Richardson * more sibling nodes making up a WFQ group. The maximum value is: 36699a2dd95SBruce Richardson * min(floor(*sched_n_children_max* / 2), *sched_sp_n_priorities_max*). 36799a2dd95SBruce Richardson */ 36899a2dd95SBruce Richardson uint32_t sched_wfq_n_groups_max; 36999a2dd95SBruce Richardson 37099a2dd95SBruce Richardson /** Maximum WFQ weight. The value of 1 indicates that all sibling nodes 37199a2dd95SBruce Richardson * with same priority have the same WFQ weight, so WFQ is reduced to FQ. 37299a2dd95SBruce Richardson */ 37399a2dd95SBruce Richardson uint32_t sched_wfq_weight_max; 37499a2dd95SBruce Richardson 37599a2dd95SBruce Richardson /** WFQ packet mode supported. When non-zero, this parameter indicates 37699a2dd95SBruce Richardson * that there is at least one non-leaf node that supports packet mode 37799a2dd95SBruce Richardson * for WFQ among its children. WFQ weights will be applied against 37899a2dd95SBruce Richardson * packet count for scheduling children when a non-leaf node 37999a2dd95SBruce Richardson * is configured appropriately. 38099a2dd95SBruce Richardson */ 38199a2dd95SBruce Richardson int sched_wfq_packet_mode_supported; 38299a2dd95SBruce Richardson 38399a2dd95SBruce Richardson /** WFQ byte mode supported. When non-zero, this parameter indicates 38499a2dd95SBruce Richardson * that there is at least one non-leaf node that supports byte mode 38599a2dd95SBruce Richardson * for WFQ among its children. WFQ weights will be applied against 38699a2dd95SBruce Richardson * bytes for scheduling children when a non-leaf node is configured 38799a2dd95SBruce Richardson * appropriately. 38899a2dd95SBruce Richardson */ 38999a2dd95SBruce Richardson int sched_wfq_byte_mode_supported; 39099a2dd95SBruce Richardson 39199a2dd95SBruce Richardson /** WRED packet mode support. When non-zero, this parameter indicates 39299a2dd95SBruce Richardson * that there is at least one leaf node that supports the WRED packet 39399a2dd95SBruce Richardson * mode, which might not be true for all the leaf nodes. In packet 39499a2dd95SBruce Richardson * mode, the WRED thresholds specify the queue length in packets, as 39599a2dd95SBruce Richardson * opposed to bytes. 39699a2dd95SBruce Richardson */ 39799a2dd95SBruce Richardson int cman_wred_packet_mode_supported; 39899a2dd95SBruce Richardson 39999a2dd95SBruce Richardson /** WRED byte mode support. When non-zero, this parameter indicates that 40099a2dd95SBruce Richardson * there is at least one leaf node that supports the WRED byte mode, 40199a2dd95SBruce Richardson * which might not be true for all the leaf nodes. In byte mode, the 40299a2dd95SBruce Richardson * WRED thresholds specify the queue length in bytes, as opposed to 40399a2dd95SBruce Richardson * packets. 40499a2dd95SBruce Richardson */ 40599a2dd95SBruce Richardson int cman_wred_byte_mode_supported; 40699a2dd95SBruce Richardson 40799a2dd95SBruce Richardson /** Head drop algorithm support. When non-zero, this parameter 40899a2dd95SBruce Richardson * indicates that there is at least one leaf node that supports the head 40999a2dd95SBruce Richardson * drop algorithm, which might not be true for all the leaf nodes. 41099a2dd95SBruce Richardson */ 41199a2dd95SBruce Richardson int cman_head_drop_supported; 41299a2dd95SBruce Richardson 41399a2dd95SBruce Richardson /** Maximum number of WRED contexts, either private or shared. In case 41499a2dd95SBruce Richardson * the implementation does not share any resources between private and 41599a2dd95SBruce Richardson * shared WRED contexts, it is typically equal to the sum of 41699a2dd95SBruce Richardson * *cman_wred_context_private_n_max* and 41799a2dd95SBruce Richardson * *cman_wred_context_shared_n_max*. The value of zero indicates that 41899a2dd95SBruce Richardson * WRED is not supported. 41999a2dd95SBruce Richardson */ 42099a2dd95SBruce Richardson uint32_t cman_wred_context_n_max; 42199a2dd95SBruce Richardson 42299a2dd95SBruce Richardson /** Maximum number of private WRED contexts. Indicates the maximum 42399a2dd95SBruce Richardson * number of leaf nodes that can concurrently have their private WRED 42499a2dd95SBruce Richardson * context enabled. The value of zero indicates that private WRED 42599a2dd95SBruce Richardson * contexts are not supported. 42699a2dd95SBruce Richardson */ 42799a2dd95SBruce Richardson uint32_t cman_wred_context_private_n_max; 42899a2dd95SBruce Richardson 42999a2dd95SBruce Richardson /** Maximum number of shared WRED contexts. The value of zero 43099a2dd95SBruce Richardson * indicates that shared WRED contexts are not supported. 43199a2dd95SBruce Richardson */ 43299a2dd95SBruce Richardson uint32_t cman_wred_context_shared_n_max; 43399a2dd95SBruce Richardson 43499a2dd95SBruce Richardson /** Maximum number of leaf nodes that can share the same WRED context. 43599a2dd95SBruce Richardson * Only valid when shared WRED contexts are supported. 43699a2dd95SBruce Richardson */ 43799a2dd95SBruce Richardson uint32_t cman_wred_context_shared_n_nodes_per_context_max; 43899a2dd95SBruce Richardson 43999a2dd95SBruce Richardson /** Maximum number of shared WRED contexts a leaf node can be part of. 44099a2dd95SBruce Richardson * This parameter indicates that there is at least one leaf node that 44199a2dd95SBruce Richardson * can be configured with this many shared WRED contexts, which might 44299a2dd95SBruce Richardson * not be true for all the leaf nodes. Only valid when shared WRED 44399a2dd95SBruce Richardson * contexts are supported, in which case it ranges from 1 to 44499a2dd95SBruce Richardson * *cman_wred_context_shared_n_max*. 44599a2dd95SBruce Richardson */ 44699a2dd95SBruce Richardson uint32_t cman_wred_context_shared_n_contexts_per_node_max; 44799a2dd95SBruce Richardson 44899a2dd95SBruce Richardson /** Support for VLAN DEI packet marking (per color). */ 44999a2dd95SBruce Richardson int mark_vlan_dei_supported[RTE_COLORS]; 45099a2dd95SBruce Richardson 45199a2dd95SBruce Richardson /** Support for IPv4/IPv6 ECN marking of TCP packets (per color). */ 45299a2dd95SBruce Richardson int mark_ip_ecn_tcp_supported[RTE_COLORS]; 45399a2dd95SBruce Richardson 45499a2dd95SBruce Richardson /** Support for IPv4/IPv6 ECN marking of SCTP packets (per color). */ 45599a2dd95SBruce Richardson int mark_ip_ecn_sctp_supported[RTE_COLORS]; 45699a2dd95SBruce Richardson 45799a2dd95SBruce Richardson /** Support for IPv4/IPv6 DSCP packet marking (per color). */ 45899a2dd95SBruce Richardson int mark_ip_dscp_supported[RTE_COLORS]; 45999a2dd95SBruce Richardson 46099a2dd95SBruce Richardson /** Set of supported dynamic update operations. 46199a2dd95SBruce Richardson * @see enum rte_tm_dynamic_update_type 46299a2dd95SBruce Richardson */ 46399a2dd95SBruce Richardson uint64_t dynamic_update_mask; 46499a2dd95SBruce Richardson 46599a2dd95SBruce Richardson /** Set of supported statistics counter types. 46699a2dd95SBruce Richardson * @see enum rte_tm_stats_type 46799a2dd95SBruce Richardson */ 46899a2dd95SBruce Richardson uint64_t stats_mask; 46999a2dd95SBruce Richardson }; 47099a2dd95SBruce Richardson 47199a2dd95SBruce Richardson /** 47299a2dd95SBruce Richardson * Traffic manager level capabilities 47399a2dd95SBruce Richardson */ 47499a2dd95SBruce Richardson struct rte_tm_level_capabilities { 47599a2dd95SBruce Richardson /** Maximum number of nodes for the current hierarchy level. */ 47699a2dd95SBruce Richardson uint32_t n_nodes_max; 47799a2dd95SBruce Richardson 47899a2dd95SBruce Richardson /** Maximum number of non-leaf nodes for the current hierarchy level. 47999a2dd95SBruce Richardson * The value of 0 indicates that current level only supports leaf 48099a2dd95SBruce Richardson * nodes. The maximum value is *n_nodes_max*. 48199a2dd95SBruce Richardson */ 48299a2dd95SBruce Richardson uint32_t n_nodes_nonleaf_max; 48399a2dd95SBruce Richardson 48499a2dd95SBruce Richardson /** Maximum number of leaf nodes for the current hierarchy level. The 48599a2dd95SBruce Richardson * value of 0 indicates that current level only supports non-leaf 48699a2dd95SBruce Richardson * nodes. The maximum value is *n_nodes_max*. 48799a2dd95SBruce Richardson */ 48899a2dd95SBruce Richardson uint32_t n_nodes_leaf_max; 48999a2dd95SBruce Richardson 49099a2dd95SBruce Richardson /** When non-zero, this flag indicates that all the non-leaf nodes on 49199a2dd95SBruce Richardson * this level have identical capability set. Valid only when 49299a2dd95SBruce Richardson * *n_nodes_nonleaf_max* is non-zero. 49399a2dd95SBruce Richardson */ 49499a2dd95SBruce Richardson int non_leaf_nodes_identical; 49599a2dd95SBruce Richardson 49699a2dd95SBruce Richardson /** When non-zero, this flag indicates that all the leaf nodes on this 49799a2dd95SBruce Richardson * level have identical capability set. Valid only when 49899a2dd95SBruce Richardson * *n_nodes_leaf_max* is non-zero. 49999a2dd95SBruce Richardson */ 50099a2dd95SBruce Richardson int leaf_nodes_identical; 50199a2dd95SBruce Richardson 50299a2dd95SBruce Richardson RTE_STD_C11 50399a2dd95SBruce Richardson union { 50499a2dd95SBruce Richardson /** Items valid only for the non-leaf nodes on this level. */ 50599a2dd95SBruce Richardson struct { 50699a2dd95SBruce Richardson /** Private shaper support. When non-zero, it indicates 50799a2dd95SBruce Richardson * there is at least one non-leaf node on this level 50899a2dd95SBruce Richardson * with private shaper support, which may not be the 50999a2dd95SBruce Richardson * case for all the non-leaf nodes on this level. 51099a2dd95SBruce Richardson */ 51199a2dd95SBruce Richardson int shaper_private_supported; 51299a2dd95SBruce Richardson 51399a2dd95SBruce Richardson /** Dual rate support for private shaper. Valid only 51499a2dd95SBruce Richardson * when private shaper is supported for the non-leaf 51599a2dd95SBruce Richardson * nodes on the current level. When non-zero, it 51699a2dd95SBruce Richardson * indicates there is at least one non-leaf node on this 51799a2dd95SBruce Richardson * level with dual rate private shaper support, which 51899a2dd95SBruce Richardson * may not be the case for all the non-leaf nodes on 51999a2dd95SBruce Richardson * this level. 52099a2dd95SBruce Richardson */ 52199a2dd95SBruce Richardson int shaper_private_dual_rate_supported; 52299a2dd95SBruce Richardson 52399a2dd95SBruce Richardson /** Minimum committed/peak rate (bytes per second) for 52499a2dd95SBruce Richardson * private shapers of the non-leaf nodes of this level. 52599a2dd95SBruce Richardson * Valid only when private shaper is supported on this 52699a2dd95SBruce Richardson * level. 52799a2dd95SBruce Richardson */ 52899a2dd95SBruce Richardson uint64_t shaper_private_rate_min; 52999a2dd95SBruce Richardson 53099a2dd95SBruce Richardson /** Maximum committed/peak rate (bytes per second) for 53199a2dd95SBruce Richardson * private shapers of the non-leaf nodes on this level. 53299a2dd95SBruce Richardson * Valid only when private shaper is supported on this 53399a2dd95SBruce Richardson * level. 53499a2dd95SBruce Richardson */ 53599a2dd95SBruce Richardson uint64_t shaper_private_rate_max; 53699a2dd95SBruce Richardson 53799a2dd95SBruce Richardson /** Shaper private packet mode supported. When non-zero, 53899a2dd95SBruce Richardson * this parameter indicates there is at least one 53999a2dd95SBruce Richardson * non-leaf node at this level that can be configured 54099a2dd95SBruce Richardson * with packet mode in its private shaper. When private 54199a2dd95SBruce Richardson * shaper is configured in packet mode, committed/peak 54299a2dd95SBruce Richardson * rate provided is interpreted in packets per second. 54399a2dd95SBruce Richardson */ 54499a2dd95SBruce Richardson int shaper_private_packet_mode_supported; 54599a2dd95SBruce Richardson 54699a2dd95SBruce Richardson /** Shaper private byte mode supported. When non-zero, 54799a2dd95SBruce Richardson * this parameter indicates there is at least one 54899a2dd95SBruce Richardson * non-leaf node at this level that can be configured 54999a2dd95SBruce Richardson * with byte mode in its private shaper. When private 55099a2dd95SBruce Richardson * shaper is configured in byte mode, committed/peak 55199a2dd95SBruce Richardson * rate provided is interpreted in bytes per second. 55299a2dd95SBruce Richardson */ 55399a2dd95SBruce Richardson int shaper_private_byte_mode_supported; 55499a2dd95SBruce Richardson 55599a2dd95SBruce Richardson /** Maximum number of shared shapers that any non-leaf 55699a2dd95SBruce Richardson * node on this level can be part of. The value of zero 55799a2dd95SBruce Richardson * indicates that shared shapers are not supported by 55899a2dd95SBruce Richardson * the non-leaf nodes on this level. When non-zero, it 55999a2dd95SBruce Richardson * indicates there is at least one non-leaf node on this 56099a2dd95SBruce Richardson * level that meets this condition, which may not be the 56199a2dd95SBruce Richardson * case for all the non-leaf nodes on this level. 56299a2dd95SBruce Richardson */ 56399a2dd95SBruce Richardson uint32_t shaper_shared_n_max; 56499a2dd95SBruce Richardson 56599a2dd95SBruce Richardson /** Shaper shared packet mode supported. When non-zero, 56699a2dd95SBruce Richardson * this parameter indicates that there is at least one 56799a2dd95SBruce Richardson * non-leaf node on this level that can be part of 56899a2dd95SBruce Richardson * shared shapers which work in packet mode. 56999a2dd95SBruce Richardson */ 57099a2dd95SBruce Richardson int shaper_shared_packet_mode_supported; 57199a2dd95SBruce Richardson 57299a2dd95SBruce Richardson /** Shaper shared byte mode supported. When non-zero, 57399a2dd95SBruce Richardson * this parameter indicates that there is at least one 57499a2dd95SBruce Richardson * non-leaf node on this level that can be part of 57599a2dd95SBruce Richardson * shared shapers which work in byte mode. 57699a2dd95SBruce Richardson */ 57799a2dd95SBruce Richardson int shaper_shared_byte_mode_supported; 57899a2dd95SBruce Richardson 57999a2dd95SBruce Richardson /** Maximum number of children nodes. This parameter 58099a2dd95SBruce Richardson * indicates that there is at least one non-leaf node on 58199a2dd95SBruce Richardson * this level that can be configured with this many 58299a2dd95SBruce Richardson * children nodes, which might not be true for all the 58399a2dd95SBruce Richardson * non-leaf nodes on this level. 58499a2dd95SBruce Richardson */ 58599a2dd95SBruce Richardson uint32_t sched_n_children_max; 58699a2dd95SBruce Richardson 58799a2dd95SBruce Richardson /** Maximum number of supported priority levels. This 58899a2dd95SBruce Richardson * parameter indicates that there is at least one 58999a2dd95SBruce Richardson * non-leaf node on this level that can be configured 59099a2dd95SBruce Richardson * with this many priority levels for managing its 59199a2dd95SBruce Richardson * children nodes, which might not be true for all the 59299a2dd95SBruce Richardson * non-leaf nodes on this level. The value of zero is 59399a2dd95SBruce Richardson * invalid. The value of 1 indicates that only priority 59499a2dd95SBruce Richardson * 0 is supported, which essentially means that Strict 59599a2dd95SBruce Richardson * Priority (SP) algorithm is not supported on this 59699a2dd95SBruce Richardson * level. 59799a2dd95SBruce Richardson */ 59899a2dd95SBruce Richardson uint32_t sched_sp_n_priorities_max; 59999a2dd95SBruce Richardson 60099a2dd95SBruce Richardson /** Maximum number of sibling nodes that can have the 60199a2dd95SBruce Richardson * same priority at any given time, i.e. maximum size of 60299a2dd95SBruce Richardson * the WFQ sibling node group. This parameter indicates 60399a2dd95SBruce Richardson * there is at least one non-leaf node on this level 60499a2dd95SBruce Richardson * that meets this condition, which may not be true for 60599a2dd95SBruce Richardson * all the non-leaf nodes on this level. The value of 60699a2dd95SBruce Richardson * zero is invalid. The value of 1 indicates that WFQ 60799a2dd95SBruce Richardson * algorithm is not supported on this level. The maximum 60899a2dd95SBruce Richardson * value is *sched_n_children_max*. 60999a2dd95SBruce Richardson */ 61099a2dd95SBruce Richardson uint32_t sched_wfq_n_children_per_group_max; 61199a2dd95SBruce Richardson 61299a2dd95SBruce Richardson /** Maximum number of priority levels that can have 61399a2dd95SBruce Richardson * more than one child node at any given time, i.e. 61499a2dd95SBruce Richardson * maximum number of WFQ sibling node groups that 61599a2dd95SBruce Richardson * have two or more members. This parameter indicates 61699a2dd95SBruce Richardson * there is at least one non-leaf node on this level 61799a2dd95SBruce Richardson * that meets this condition, which might not be true 61899a2dd95SBruce Richardson * for all the non-leaf nodes. The value of zero states 61999a2dd95SBruce Richardson * that WFQ algorithm is not supported on this level. 62099a2dd95SBruce Richardson * The value of 1 indicates that 62199a2dd95SBruce Richardson * (*sched_sp_n_priorities_max* - 1) priority levels on 62299a2dd95SBruce Richardson * this level have at most one child node, so there can 62399a2dd95SBruce Richardson * be only one priority level with two or more sibling 62499a2dd95SBruce Richardson * nodes making up a WFQ group on this level. The 62599a2dd95SBruce Richardson * maximum value is: 62699a2dd95SBruce Richardson * min(floor(*sched_n_children_max* / 2), 62799a2dd95SBruce Richardson * *sched_sp_n_priorities_max*). 62899a2dd95SBruce Richardson */ 62999a2dd95SBruce Richardson uint32_t sched_wfq_n_groups_max; 63099a2dd95SBruce Richardson 63199a2dd95SBruce Richardson /** Maximum WFQ weight. The value of 1 indicates that 63299a2dd95SBruce Richardson * all sibling nodes on this level with same priority 63399a2dd95SBruce Richardson * have the same WFQ weight, so on this level WFQ is 63499a2dd95SBruce Richardson * reduced to FQ. 63599a2dd95SBruce Richardson */ 63699a2dd95SBruce Richardson uint32_t sched_wfq_weight_max; 63799a2dd95SBruce Richardson 63899a2dd95SBruce Richardson /** WFQ packet mode supported. When non-zero, this 63999a2dd95SBruce Richardson * parameter indicates that there is at least one 64099a2dd95SBruce Richardson * non-leaf node at this level that supports packet 64199a2dd95SBruce Richardson * mode for WFQ among its children. WFQ weights will 64299a2dd95SBruce Richardson * be applied against packet count for scheduling 64399a2dd95SBruce Richardson * children when a non-leaf node is configured 64499a2dd95SBruce Richardson * appropriately. 64599a2dd95SBruce Richardson */ 64699a2dd95SBruce Richardson int sched_wfq_packet_mode_supported; 64799a2dd95SBruce Richardson 64899a2dd95SBruce Richardson /** WFQ byte mode supported. When non-zero, this 64999a2dd95SBruce Richardson * parameter indicates that there is at least one 65099a2dd95SBruce Richardson * non-leaf node at this level that supports byte 65199a2dd95SBruce Richardson * mode for WFQ among its children. WFQ weights will 65299a2dd95SBruce Richardson * be applied against bytes for scheduling children 65399a2dd95SBruce Richardson * when a non-leaf node is configured appropriately. 65499a2dd95SBruce Richardson */ 65599a2dd95SBruce Richardson int sched_wfq_byte_mode_supported; 65699a2dd95SBruce Richardson 65799a2dd95SBruce Richardson /** Mask of statistics counter types supported by the 65899a2dd95SBruce Richardson * non-leaf nodes on this level. Every supported 65999a2dd95SBruce Richardson * statistics counter type is supported by at least one 66099a2dd95SBruce Richardson * non-leaf node on this level, which may not be true 66199a2dd95SBruce Richardson * for all the non-leaf nodes on this level. 66299a2dd95SBruce Richardson * @see enum rte_tm_stats_type 66399a2dd95SBruce Richardson */ 66499a2dd95SBruce Richardson uint64_t stats_mask; 66599a2dd95SBruce Richardson } nonleaf; 66699a2dd95SBruce Richardson 66799a2dd95SBruce Richardson /** Items valid only for the leaf nodes on this level. */ 66899a2dd95SBruce Richardson struct { 66999a2dd95SBruce Richardson /** Private shaper support. When non-zero, it indicates 67099a2dd95SBruce Richardson * there is at least one leaf node on this level with 67199a2dd95SBruce Richardson * private shaper support, which may not be the case for 67299a2dd95SBruce Richardson * all the leaf nodes on this level. 67399a2dd95SBruce Richardson */ 67499a2dd95SBruce Richardson int shaper_private_supported; 67599a2dd95SBruce Richardson 67699a2dd95SBruce Richardson /** Dual rate support for private shaper. Valid only 67799a2dd95SBruce Richardson * when private shaper is supported for the leaf nodes 67899a2dd95SBruce Richardson * on this level. When non-zero, it indicates there is 67999a2dd95SBruce Richardson * at least one leaf node on this level with dual rate 68099a2dd95SBruce Richardson * private shaper support, which may not be the case for 68199a2dd95SBruce Richardson * all the leaf nodes on this level. 68299a2dd95SBruce Richardson */ 68399a2dd95SBruce Richardson int shaper_private_dual_rate_supported; 68499a2dd95SBruce Richardson 68599a2dd95SBruce Richardson /** Minimum committed/peak rate (bytes per second) for 68699a2dd95SBruce Richardson * private shapers of the leaf nodes of this level. 68799a2dd95SBruce Richardson * Valid only when private shaper is supported for the 68899a2dd95SBruce Richardson * leaf nodes on this level. 68999a2dd95SBruce Richardson */ 69099a2dd95SBruce Richardson uint64_t shaper_private_rate_min; 69199a2dd95SBruce Richardson 69299a2dd95SBruce Richardson /** Maximum committed/peak rate (bytes per second) for 69399a2dd95SBruce Richardson * private shapers of the leaf nodes on this level. 69499a2dd95SBruce Richardson * Valid only when private shaper is supported for the 69599a2dd95SBruce Richardson * leaf nodes on this level. 69699a2dd95SBruce Richardson */ 69799a2dd95SBruce Richardson uint64_t shaper_private_rate_max; 69899a2dd95SBruce Richardson 69999a2dd95SBruce Richardson /** Shaper private packet mode supported. When non-zero, 70099a2dd95SBruce Richardson * this parameter indicates there is at least one leaf 70199a2dd95SBruce Richardson * node at this level that can be configured with 70299a2dd95SBruce Richardson * packet mode in its private shaper. When private 70399a2dd95SBruce Richardson * shaper is configured in packet mode, committed/peak 70499a2dd95SBruce Richardson * rate provided is interpreted in packets per second. 70599a2dd95SBruce Richardson */ 70699a2dd95SBruce Richardson int shaper_private_packet_mode_supported; 70799a2dd95SBruce Richardson 70899a2dd95SBruce Richardson /** Shaper private byte mode supported. When non-zero, 70999a2dd95SBruce Richardson * this parameter indicates there is at least one leaf 71099a2dd95SBruce Richardson * node at this level that can be configured with 71199a2dd95SBruce Richardson * byte mode in its private shaper. When private shaper 71299a2dd95SBruce Richardson * is configured in byte mode, committed/peak rate 71399a2dd95SBruce Richardson * provided is interpreted in bytes per second. 71499a2dd95SBruce Richardson */ 71599a2dd95SBruce Richardson int shaper_private_byte_mode_supported; 71699a2dd95SBruce Richardson 71799a2dd95SBruce Richardson /** Maximum number of shared shapers that any leaf node 71899a2dd95SBruce Richardson * on this level can be part of. The value of zero 71999a2dd95SBruce Richardson * indicates that shared shapers are not supported by 72099a2dd95SBruce Richardson * the leaf nodes on this level. When non-zero, it 72199a2dd95SBruce Richardson * indicates there is at least one leaf node on this 72299a2dd95SBruce Richardson * level that meets this condition, which may not be the 72399a2dd95SBruce Richardson * case for all the leaf nodes on this level. 72499a2dd95SBruce Richardson */ 72599a2dd95SBruce Richardson uint32_t shaper_shared_n_max; 72699a2dd95SBruce Richardson 72799a2dd95SBruce Richardson /** Shaper shared packet mode supported. When non-zero, 72899a2dd95SBruce Richardson * this parameter indicates that there is at least one 72999a2dd95SBruce Richardson * leaf node on this level that can be part of 73099a2dd95SBruce Richardson * shared shapers which work in packet mode. 73199a2dd95SBruce Richardson */ 73299a2dd95SBruce Richardson int shaper_shared_packet_mode_supported; 73399a2dd95SBruce Richardson 73499a2dd95SBruce Richardson /** Shaper shared byte mode supported. When non-zero, 73599a2dd95SBruce Richardson * this parameter indicates that there is at least one 73699a2dd95SBruce Richardson * leaf node on this level that can be part of 73799a2dd95SBruce Richardson * shared shapers which work in byte mode. 73899a2dd95SBruce Richardson */ 73999a2dd95SBruce Richardson int shaper_shared_byte_mode_supported; 74099a2dd95SBruce Richardson 74199a2dd95SBruce Richardson /** WRED packet mode support. When non-zero, this 74299a2dd95SBruce Richardson * parameter indicates that there is at least one leaf 74399a2dd95SBruce Richardson * node on this level that supports the WRED packet 74499a2dd95SBruce Richardson * mode, which might not be true for all the leaf 74599a2dd95SBruce Richardson * nodes. In packet mode, the WRED thresholds specify 74699a2dd95SBruce Richardson * the queue length in packets, as opposed to bytes. 74799a2dd95SBruce Richardson */ 74899a2dd95SBruce Richardson int cman_wred_packet_mode_supported; 74999a2dd95SBruce Richardson 75099a2dd95SBruce Richardson /** WRED byte mode support. When non-zero, this 75199a2dd95SBruce Richardson * parameter indicates that there is at least one leaf 75299a2dd95SBruce Richardson * node on this level that supports the WRED byte mode, 75399a2dd95SBruce Richardson * which might not be true for all the leaf nodes. In 75499a2dd95SBruce Richardson * byte mode, the WRED thresholds specify the queue 75599a2dd95SBruce Richardson * length in bytes, as opposed to packets. 75699a2dd95SBruce Richardson */ 75799a2dd95SBruce Richardson int cman_wred_byte_mode_supported; 75899a2dd95SBruce Richardson 75999a2dd95SBruce Richardson /** Head drop algorithm support. When non-zero, this 76099a2dd95SBruce Richardson * parameter indicates that there is at least one leaf 76199a2dd95SBruce Richardson * node on this level that supports the head drop 76299a2dd95SBruce Richardson * algorithm, which might not be true for all the leaf 76399a2dd95SBruce Richardson * nodes on this level. 76499a2dd95SBruce Richardson */ 76599a2dd95SBruce Richardson int cman_head_drop_supported; 76699a2dd95SBruce Richardson 76799a2dd95SBruce Richardson /** Private WRED context support. When non-zero, it 76899a2dd95SBruce Richardson * indicates there is at least one node on this level 76999a2dd95SBruce Richardson * with private WRED context support, which may not be 77099a2dd95SBruce Richardson * true for all the leaf nodes on this level. 77199a2dd95SBruce Richardson */ 77299a2dd95SBruce Richardson int cman_wred_context_private_supported; 77399a2dd95SBruce Richardson 77499a2dd95SBruce Richardson /** Maximum number of shared WRED contexts that any 77599a2dd95SBruce Richardson * leaf node on this level can be part of. The value of 77699a2dd95SBruce Richardson * zero indicates that shared WRED contexts are not 77799a2dd95SBruce Richardson * supported by the leaf nodes on this level. When 77899a2dd95SBruce Richardson * non-zero, it indicates there is at least one leaf 77999a2dd95SBruce Richardson * node on this level that meets this condition, which 78099a2dd95SBruce Richardson * may not be the case for all the leaf nodes on this 78199a2dd95SBruce Richardson * level. 78299a2dd95SBruce Richardson */ 78399a2dd95SBruce Richardson uint32_t cman_wred_context_shared_n_max; 78499a2dd95SBruce Richardson 78599a2dd95SBruce Richardson /** Mask of statistics counter types supported by the 78699a2dd95SBruce Richardson * leaf nodes on this level. Every supported statistics 78799a2dd95SBruce Richardson * counter type is supported by at least one leaf node 78899a2dd95SBruce Richardson * on this level, which may not be true for all the leaf 78999a2dd95SBruce Richardson * nodes on this level. 79099a2dd95SBruce Richardson * @see enum rte_tm_stats_type 79199a2dd95SBruce Richardson */ 79299a2dd95SBruce Richardson uint64_t stats_mask; 79399a2dd95SBruce Richardson } leaf; 79499a2dd95SBruce Richardson }; 79599a2dd95SBruce Richardson }; 79699a2dd95SBruce Richardson 79799a2dd95SBruce Richardson /** 79899a2dd95SBruce Richardson * Traffic manager node capabilities 79999a2dd95SBruce Richardson */ 80099a2dd95SBruce Richardson struct rte_tm_node_capabilities { 80199a2dd95SBruce Richardson /** Private shaper support for the current node. */ 80299a2dd95SBruce Richardson int shaper_private_supported; 80399a2dd95SBruce Richardson 80499a2dd95SBruce Richardson /** Dual rate shaping support for private shaper of current node. 80599a2dd95SBruce Richardson * Valid only when private shaper is supported by the current node. 80699a2dd95SBruce Richardson */ 80799a2dd95SBruce Richardson int shaper_private_dual_rate_supported; 80899a2dd95SBruce Richardson 80999a2dd95SBruce Richardson /** Minimum committed/peak rate (bytes per second) for private 81099a2dd95SBruce Richardson * shaper of current node. Valid only when private shaper is supported 81199a2dd95SBruce Richardson * by the current node. 81299a2dd95SBruce Richardson */ 81399a2dd95SBruce Richardson uint64_t shaper_private_rate_min; 81499a2dd95SBruce Richardson 81599a2dd95SBruce Richardson /** Maximum committed/peak rate (bytes per second) for private 81699a2dd95SBruce Richardson * shaper of current node. Valid only when private shaper is supported 81799a2dd95SBruce Richardson * by the current node. 81899a2dd95SBruce Richardson */ 81999a2dd95SBruce Richardson uint64_t shaper_private_rate_max; 82099a2dd95SBruce Richardson 82199a2dd95SBruce Richardson /** Shaper private packet mode supported. When non-zero, this parameter 82299a2dd95SBruce Richardson * indicates private shaper of current node can be configured with 82399a2dd95SBruce Richardson * packet mode. When configured in packet mode, committed/peak rate 82499a2dd95SBruce Richardson * provided is interpreted in packets per second. 82599a2dd95SBruce Richardson */ 82699a2dd95SBruce Richardson int shaper_private_packet_mode_supported; 82799a2dd95SBruce Richardson 82899a2dd95SBruce Richardson /** Shaper private byte mode supported. When non-zero, this parameter 82999a2dd95SBruce Richardson * indicates private shaper of current node can be configured with 83099a2dd95SBruce Richardson * byte mode. When configured in byte mode, committed/peak rate 83199a2dd95SBruce Richardson * provided is interpreted in bytes per second. 83299a2dd95SBruce Richardson */ 83399a2dd95SBruce Richardson int shaper_private_byte_mode_supported; 83499a2dd95SBruce Richardson 83599a2dd95SBruce Richardson /** Maximum number of shared shapers the current node can be part of. 83699a2dd95SBruce Richardson * The value of zero indicates that shared shapers are not supported by 83799a2dd95SBruce Richardson * the current node. 83899a2dd95SBruce Richardson */ 83999a2dd95SBruce Richardson uint32_t shaper_shared_n_max; 84099a2dd95SBruce Richardson 84199a2dd95SBruce Richardson /** Shaper shared packet mode supported. When non-zero, 84299a2dd95SBruce Richardson * this parameter indicates that current node can be part of 84399a2dd95SBruce Richardson * shared shapers which work in packet mode. 84499a2dd95SBruce Richardson */ 84599a2dd95SBruce Richardson int shaper_shared_packet_mode_supported; 84699a2dd95SBruce Richardson 84799a2dd95SBruce Richardson /** Shaper shared byte mode supported. When non-zero, 84899a2dd95SBruce Richardson * this parameter indicates that current node can be part of 84999a2dd95SBruce Richardson * shared shapers which work in byte mode. 85099a2dd95SBruce Richardson */ 85199a2dd95SBruce Richardson int shaper_shared_byte_mode_supported; 85299a2dd95SBruce Richardson 85399a2dd95SBruce Richardson RTE_STD_C11 85499a2dd95SBruce Richardson union { 85599a2dd95SBruce Richardson /** Items valid only for non-leaf nodes. */ 85699a2dd95SBruce Richardson struct { 85799a2dd95SBruce Richardson /** Maximum number of children nodes. */ 85899a2dd95SBruce Richardson uint32_t sched_n_children_max; 85999a2dd95SBruce Richardson 86099a2dd95SBruce Richardson /** Maximum number of supported priority levels. The 86199a2dd95SBruce Richardson * value of zero is invalid. The value of 1 indicates 86299a2dd95SBruce Richardson * that only priority 0 is supported, which essentially 86399a2dd95SBruce Richardson * means that Strict Priority (SP) algorithm is not 86499a2dd95SBruce Richardson * supported. 86599a2dd95SBruce Richardson */ 86699a2dd95SBruce Richardson uint32_t sched_sp_n_priorities_max; 86799a2dd95SBruce Richardson 86899a2dd95SBruce Richardson /** Maximum number of sibling nodes that can have the 86999a2dd95SBruce Richardson * same priority at any given time, i.e. maximum size 87099a2dd95SBruce Richardson * of the WFQ sibling node group. The value of zero 87199a2dd95SBruce Richardson * is invalid. The value of 1 indicates that WFQ 87299a2dd95SBruce Richardson * algorithm is not supported. The maximum value is 87399a2dd95SBruce Richardson * *sched_n_children_max*. 87499a2dd95SBruce Richardson */ 87599a2dd95SBruce Richardson uint32_t sched_wfq_n_children_per_group_max; 87699a2dd95SBruce Richardson 87799a2dd95SBruce Richardson /** Maximum number of priority levels that can have 87899a2dd95SBruce Richardson * more than one child node at any given time, i.e. 87999a2dd95SBruce Richardson * maximum number of WFQ sibling node groups that have 88099a2dd95SBruce Richardson * two or more members. The value of zero states that 88199a2dd95SBruce Richardson * WFQ algorithm is not supported. The value of 1 88299a2dd95SBruce Richardson * indicates that (*sched_sp_n_priorities_max* - 1) 88399a2dd95SBruce Richardson * priority levels have at most one child node, so there 88499a2dd95SBruce Richardson * can be only one priority level with two or more 88599a2dd95SBruce Richardson * sibling nodes making up a WFQ group. The maximum 88699a2dd95SBruce Richardson * value is: min(floor(*sched_n_children_max* / 2), 88799a2dd95SBruce Richardson * *sched_sp_n_priorities_max*). 88899a2dd95SBruce Richardson */ 88999a2dd95SBruce Richardson uint32_t sched_wfq_n_groups_max; 89099a2dd95SBruce Richardson 89199a2dd95SBruce Richardson /** Maximum WFQ weight. The value of 1 indicates that 89299a2dd95SBruce Richardson * all sibling nodes with same priority have the same 89399a2dd95SBruce Richardson * WFQ weight, so WFQ is reduced to FQ. 89499a2dd95SBruce Richardson */ 89599a2dd95SBruce Richardson uint32_t sched_wfq_weight_max; 89699a2dd95SBruce Richardson 89799a2dd95SBruce Richardson /** WFQ packet mode supported. When non-zero, this 89899a2dd95SBruce Richardson * parameter indicates that current node supports packet 89999a2dd95SBruce Richardson * mode for WFQ among its children. WFQ weights will be 90099a2dd95SBruce Richardson * applied against packet count for scheduling children 90199a2dd95SBruce Richardson * when configured appropriately. 90299a2dd95SBruce Richardson */ 90399a2dd95SBruce Richardson int sched_wfq_packet_mode_supported; 90499a2dd95SBruce Richardson 90599a2dd95SBruce Richardson /** WFQ byte mode supported. When non-zero, this 90699a2dd95SBruce Richardson * parameter indicates that current node supports byte 90799a2dd95SBruce Richardson * mode for WFQ among its children. WFQ weights will be 90899a2dd95SBruce Richardson * applied against bytes for scheduling children when 90999a2dd95SBruce Richardson * configured appropriately. 91099a2dd95SBruce Richardson */ 91199a2dd95SBruce Richardson int sched_wfq_byte_mode_supported; 91299a2dd95SBruce Richardson 91399a2dd95SBruce Richardson } nonleaf; 91499a2dd95SBruce Richardson 91599a2dd95SBruce Richardson /** Items valid only for leaf nodes. */ 91699a2dd95SBruce Richardson struct { 91799a2dd95SBruce Richardson /** WRED packet mode support for current node. */ 91899a2dd95SBruce Richardson int cman_wred_packet_mode_supported; 91999a2dd95SBruce Richardson 92099a2dd95SBruce Richardson /** WRED byte mode support for current node. */ 92199a2dd95SBruce Richardson int cman_wred_byte_mode_supported; 92299a2dd95SBruce Richardson 92399a2dd95SBruce Richardson /** Head drop algorithm support for current node. */ 92499a2dd95SBruce Richardson int cman_head_drop_supported; 92599a2dd95SBruce Richardson 92699a2dd95SBruce Richardson /** Private WRED context support for current node. */ 92799a2dd95SBruce Richardson int cman_wred_context_private_supported; 92899a2dd95SBruce Richardson 92999a2dd95SBruce Richardson /** Maximum number of shared WRED contexts the current 93099a2dd95SBruce Richardson * node can be part of. The value of zero indicates that 93199a2dd95SBruce Richardson * shared WRED contexts are not supported by the current 93299a2dd95SBruce Richardson * node. 93399a2dd95SBruce Richardson */ 93499a2dd95SBruce Richardson uint32_t cman_wred_context_shared_n_max; 93599a2dd95SBruce Richardson } leaf; 93699a2dd95SBruce Richardson }; 93799a2dd95SBruce Richardson 93899a2dd95SBruce Richardson /** Mask of statistics counter types supported by the current node. 93999a2dd95SBruce Richardson * @see enum rte_tm_stats_type 94099a2dd95SBruce Richardson */ 94199a2dd95SBruce Richardson uint64_t stats_mask; 94299a2dd95SBruce Richardson }; 94399a2dd95SBruce Richardson 94499a2dd95SBruce Richardson /** 94599a2dd95SBruce Richardson * Congestion management (CMAN) mode 94699a2dd95SBruce Richardson * 94799a2dd95SBruce Richardson * This is used for controlling the admission of packets into a packet queue or 94899a2dd95SBruce Richardson * group of packet queues on congestion. On request of writing a new packet 94999a2dd95SBruce Richardson * into the current queue while the queue is full, the *tail drop* algorithm 95099a2dd95SBruce Richardson * drops the new packet while leaving the queue unmodified, as opposed to *head 95199a2dd95SBruce Richardson * drop* algorithm, which drops the packet at the head of the queue (the oldest 95299a2dd95SBruce Richardson * packet waiting in the queue) and admits the new packet at the tail of the 95399a2dd95SBruce Richardson * queue. 95499a2dd95SBruce Richardson * 95599a2dd95SBruce Richardson * The *Random Early Detection (RED)* algorithm works by proactively dropping 95699a2dd95SBruce Richardson * more and more input packets as the queue occupancy builds up. When the queue 95799a2dd95SBruce Richardson * is full or almost full, RED effectively works as *tail drop*. The *Weighted 95899a2dd95SBruce Richardson * RED* algorithm uses a separate set of RED thresholds for each packet color. 95999a2dd95SBruce Richardson */ 96099a2dd95SBruce Richardson enum rte_tm_cman_mode { 96199a2dd95SBruce Richardson RTE_TM_CMAN_TAIL_DROP = 0, /**< Tail drop */ 96299a2dd95SBruce Richardson RTE_TM_CMAN_HEAD_DROP, /**< Head drop */ 96399a2dd95SBruce Richardson RTE_TM_CMAN_WRED, /**< Weighted Random Early Detection (WRED) */ 96499a2dd95SBruce Richardson }; 96599a2dd95SBruce Richardson 96699a2dd95SBruce Richardson /** 96799a2dd95SBruce Richardson * Random Early Detection (RED) profile 96899a2dd95SBruce Richardson */ 96999a2dd95SBruce Richardson struct rte_tm_red_params { 97099a2dd95SBruce Richardson /** Minimum queue threshold */ 97199a2dd95SBruce Richardson uint64_t min_th; 97299a2dd95SBruce Richardson 97399a2dd95SBruce Richardson /** Maximum queue threshold */ 97499a2dd95SBruce Richardson uint64_t max_th; 97599a2dd95SBruce Richardson 97699a2dd95SBruce Richardson /** Inverse of packet marking probability maximum value (maxp), i.e. 97799a2dd95SBruce Richardson * maxp_inv = 1 / maxp 97899a2dd95SBruce Richardson */ 97999a2dd95SBruce Richardson uint16_t maxp_inv; 98099a2dd95SBruce Richardson 98199a2dd95SBruce Richardson /** Negated log2 of queue weight (wq), i.e. wq = 1 / (2 ^ wq_log2) */ 98299a2dd95SBruce Richardson uint16_t wq_log2; 98399a2dd95SBruce Richardson }; 98499a2dd95SBruce Richardson 98599a2dd95SBruce Richardson /** 98699a2dd95SBruce Richardson * Weighted RED (WRED) profile 98799a2dd95SBruce Richardson * 98899a2dd95SBruce Richardson * Multiple WRED contexts can share the same WRED profile. Each leaf node with 98999a2dd95SBruce Richardson * WRED enabled as its congestion management mode has zero or one private WRED 99099a2dd95SBruce Richardson * context (only one leaf node using it) and/or zero, one or several shared 99199a2dd95SBruce Richardson * WRED contexts (multiple leaf nodes use the same WRED context). A private 99299a2dd95SBruce Richardson * WRED context is used to perform congestion management for a single leaf 99399a2dd95SBruce Richardson * node, while a shared WRED context is used to perform congestion management 99499a2dd95SBruce Richardson * for a group of leaf nodes. 99599a2dd95SBruce Richardson * 99699a2dd95SBruce Richardson * @see struct rte_tm_capabilities::cman_wred_packet_mode_supported 99799a2dd95SBruce Richardson * @see struct rte_tm_capabilities::cman_wred_byte_mode_supported 99899a2dd95SBruce Richardson */ 99999a2dd95SBruce Richardson struct rte_tm_wred_params { 100099a2dd95SBruce Richardson /** One set of RED parameters per packet color */ 100199a2dd95SBruce Richardson struct rte_tm_red_params red_params[RTE_COLORS]; 100299a2dd95SBruce Richardson 100399a2dd95SBruce Richardson /** When non-zero, the *min_th* and *max_th* thresholds are specified 100499a2dd95SBruce Richardson * in packets (WRED packet mode). When zero, the *min_th* and *max_th* 100599a2dd95SBruce Richardson * thresholds are specified in bytes (WRED byte mode) 100699a2dd95SBruce Richardson */ 100799a2dd95SBruce Richardson int packet_mode; 100899a2dd95SBruce Richardson }; 100999a2dd95SBruce Richardson 101099a2dd95SBruce Richardson /** 101199a2dd95SBruce Richardson * Token bucket 101299a2dd95SBruce Richardson */ 101399a2dd95SBruce Richardson struct rte_tm_token_bucket { 101499a2dd95SBruce Richardson /** Token bucket rate (bytes per second or packets per second) */ 101599a2dd95SBruce Richardson uint64_t rate; 101699a2dd95SBruce Richardson 101799a2dd95SBruce Richardson /** Token bucket size (bytes or packets), a.k.a. max burst size */ 101899a2dd95SBruce Richardson uint64_t size; 101999a2dd95SBruce Richardson }; 102099a2dd95SBruce Richardson 102199a2dd95SBruce Richardson /** 102299a2dd95SBruce Richardson * Shaper (rate limiter) profile 102399a2dd95SBruce Richardson * 102499a2dd95SBruce Richardson * Multiple shaper instances can share the same shaper profile. Each node has 102599a2dd95SBruce Richardson * zero or one private shaper (only one node using it) and/or zero, one or 102699a2dd95SBruce Richardson * several shared shapers (multiple nodes use the same shaper instance). 102799a2dd95SBruce Richardson * A private shaper is used to perform traffic shaping for a single node, while 102899a2dd95SBruce Richardson * a shared shaper is used to perform traffic shaping for a group of nodes. 102999a2dd95SBruce Richardson * 103099a2dd95SBruce Richardson * Single rate shapers use a single token bucket. A single rate shaper can be 103199a2dd95SBruce Richardson * configured by setting the rate of the committed bucket to zero, which 103299a2dd95SBruce Richardson * effectively disables this bucket. The peak bucket is used to limit the rate 103399a2dd95SBruce Richardson * and the burst size for the current shaper. 103499a2dd95SBruce Richardson * 103599a2dd95SBruce Richardson * Dual rate shapers use both the committed and the peak token buckets. The 103699a2dd95SBruce Richardson * rate of the peak bucket has to be bigger than zero, as well as greater than 103799a2dd95SBruce Richardson * or equal to the rate of the committed bucket. 103899a2dd95SBruce Richardson * 103999a2dd95SBruce Richardson * @see struct rte_tm_capabilities::shaper_private_packet_mode_supported 104099a2dd95SBruce Richardson * @see struct rte_tm_capabilities::shaper_private_byte_mode_supported 104199a2dd95SBruce Richardson * @see struct rte_tm_capabilities::shaper_shared_packet_mode_supported 104299a2dd95SBruce Richardson * @see struct rte_tm_capabilities::shaper_shared_byte_mode_supported 104399a2dd95SBruce Richardson */ 104499a2dd95SBruce Richardson struct rte_tm_shaper_params { 104599a2dd95SBruce Richardson /** Committed token bucket */ 104699a2dd95SBruce Richardson struct rte_tm_token_bucket committed; 104799a2dd95SBruce Richardson 104899a2dd95SBruce Richardson /** Peak token bucket */ 104999a2dd95SBruce Richardson struct rte_tm_token_bucket peak; 105099a2dd95SBruce Richardson 105199a2dd95SBruce Richardson /** Signed value to be added to the length of each packet for the 105299a2dd95SBruce Richardson * purpose of shaping. Can be used to correct the packet length with 105399a2dd95SBruce Richardson * the framing overhead bytes that are also consumed on the wire (e.g. 105499a2dd95SBruce Richardson * RTE_TM_ETH_FRAMING_OVERHEAD_FCS). 105599a2dd95SBruce Richardson * This field is ignored when the profile enables packet mode. 105699a2dd95SBruce Richardson */ 105799a2dd95SBruce Richardson int32_t pkt_length_adjust; 105899a2dd95SBruce Richardson 105999a2dd95SBruce Richardson /** When zero, the byte mode is enabled for the current profile, so the 106099a2dd95SBruce Richardson * *rate* and *size* fields in both the committed and peak token buckets 106199a2dd95SBruce Richardson * are specified in bytes per second and bytes, respectively. 106299a2dd95SBruce Richardson * When non-zero, the packet mode is enabled for the current profile, 106399a2dd95SBruce Richardson * so the *rate* and *size* fields in both the committed and peak token 106499a2dd95SBruce Richardson * buckets are specified in packets per second and packets, 106599a2dd95SBruce Richardson * respectively. 106699a2dd95SBruce Richardson */ 106799a2dd95SBruce Richardson int packet_mode; 106899a2dd95SBruce Richardson }; 106999a2dd95SBruce Richardson 107099a2dd95SBruce Richardson /** 107199a2dd95SBruce Richardson * Node parameters 107299a2dd95SBruce Richardson * 107399a2dd95SBruce Richardson * Each non-leaf node has multiple inputs (its children nodes) and single output 107499a2dd95SBruce Richardson * (which is input to its parent node). It arbitrates its inputs using Strict 107599a2dd95SBruce Richardson * Priority (SP) and Weighted Fair Queuing (WFQ) algorithms to schedule input 107699a2dd95SBruce Richardson * packets to its output while observing its shaping (rate limiting) 107799a2dd95SBruce Richardson * constraints. 107899a2dd95SBruce Richardson * 107999a2dd95SBruce Richardson * Algorithms such as Weighted Round Robin (WRR), Byte-level WRR, Deficit WRR 108099a2dd95SBruce Richardson * (DWRR), etc. are considered approximations of the WFQ ideal and are 108199a2dd95SBruce Richardson * assimilated to WFQ, although an associated implementation-dependent trade-off 108299a2dd95SBruce Richardson * on accuracy, performance and resource usage might exist. 108399a2dd95SBruce Richardson * 108499a2dd95SBruce Richardson * Children nodes with different priorities are scheduled using the SP algorithm 108599a2dd95SBruce Richardson * based on their priority, with zero (0) as the highest priority. Children with 108699a2dd95SBruce Richardson * the same priority are scheduled using the WFQ algorithm according to their 108799a2dd95SBruce Richardson * weights. The WFQ weight of a given child node is relative to the sum of the 108899a2dd95SBruce Richardson * weights of all its sibling nodes that have the same priority, with one (1) as 108999a2dd95SBruce Richardson * the lowest weight. For each SP priority, the WFQ weight mode can be set as 109099a2dd95SBruce Richardson * either byte-based or packet-based. 109199a2dd95SBruce Richardson * 1092*09fd4227SAndrew Rybchenko * Each leaf node sits on top of a Tx queue of the current Ethernet port. Hence, 109399a2dd95SBruce Richardson * the leaf nodes are predefined, with their node IDs set to 0 .. (N-1), where N 1094*09fd4227SAndrew Rybchenko * is the number of Tx queues configured for the current Ethernet port. The 109599a2dd95SBruce Richardson * non-leaf nodes have their IDs generated by the application. 109699a2dd95SBruce Richardson */ 109799a2dd95SBruce Richardson struct rte_tm_node_params { 109899a2dd95SBruce Richardson /** Shaper profile for the private shaper. The absence of the private 109999a2dd95SBruce Richardson * shaper for the current node is indicated by setting this parameter 110099a2dd95SBruce Richardson * to RTE_TM_SHAPER_PROFILE_ID_NONE. 110199a2dd95SBruce Richardson */ 110299a2dd95SBruce Richardson uint32_t shaper_profile_id; 110399a2dd95SBruce Richardson 110499a2dd95SBruce Richardson /** User allocated array of valid shared shaper IDs. */ 110599a2dd95SBruce Richardson uint32_t *shared_shaper_id; 110699a2dd95SBruce Richardson 110799a2dd95SBruce Richardson /** Number of shared shaper IDs in the *shared_shaper_id* array. */ 110899a2dd95SBruce Richardson uint32_t n_shared_shapers; 110999a2dd95SBruce Richardson 111099a2dd95SBruce Richardson RTE_STD_C11 111199a2dd95SBruce Richardson union { 111299a2dd95SBruce Richardson /** Parameters only valid for non-leaf nodes. */ 111399a2dd95SBruce Richardson struct { 111499a2dd95SBruce Richardson /** WFQ weight mode for each SP priority. When NULL, it 111599a2dd95SBruce Richardson * indicates that WFQ is to be used for all priorities. 111699a2dd95SBruce Richardson * When non-NULL, it points to a pre-allocated array of 111799a2dd95SBruce Richardson * *n_sp_priorities* values, with non-zero value for 111899a2dd95SBruce Richardson * byte-mode and zero for packet-mode. 111999a2dd95SBruce Richardson * @see struct rte_tm_node_capabilities::sched_wfq_packet_mode_supported 112099a2dd95SBruce Richardson * @see struct rte_tm_node_capabilities::sched_wfq_byte_mode_supported 112199a2dd95SBruce Richardson */ 112299a2dd95SBruce Richardson int *wfq_weight_mode; 112399a2dd95SBruce Richardson 112499a2dd95SBruce Richardson /** Number of SP priorities. */ 112599a2dd95SBruce Richardson uint32_t n_sp_priorities; 112699a2dd95SBruce Richardson } nonleaf; 112799a2dd95SBruce Richardson 112899a2dd95SBruce Richardson /** Parameters only valid for leaf nodes. */ 112999a2dd95SBruce Richardson struct { 113099a2dd95SBruce Richardson /** Congestion management mode */ 113199a2dd95SBruce Richardson enum rte_tm_cman_mode cman; 113299a2dd95SBruce Richardson 113399a2dd95SBruce Richardson /** WRED parameters (only valid when *cman* is set to 113499a2dd95SBruce Richardson * WRED). 113599a2dd95SBruce Richardson */ 113699a2dd95SBruce Richardson struct { 113799a2dd95SBruce Richardson /** WRED profile for private WRED context. The 113899a2dd95SBruce Richardson * absence of a private WRED context for the 113999a2dd95SBruce Richardson * current leaf node is indicated by value 114099a2dd95SBruce Richardson * RTE_TM_WRED_PROFILE_ID_NONE. 114199a2dd95SBruce Richardson */ 114299a2dd95SBruce Richardson uint32_t wred_profile_id; 114399a2dd95SBruce Richardson 114499a2dd95SBruce Richardson /** User allocated array of shared WRED context 114599a2dd95SBruce Richardson * IDs. When set to NULL, it indicates that the 114699a2dd95SBruce Richardson * current leaf node should not currently be 114799a2dd95SBruce Richardson * part of any shared WRED contexts. 114899a2dd95SBruce Richardson */ 114999a2dd95SBruce Richardson uint32_t *shared_wred_context_id; 115099a2dd95SBruce Richardson 115199a2dd95SBruce Richardson /** Number of elements in the 115299a2dd95SBruce Richardson * *shared_wred_context_id* array. Only valid 115399a2dd95SBruce Richardson * when *shared_wred_context_id* is non-NULL, 115499a2dd95SBruce Richardson * in which case it should be non-zero. 115599a2dd95SBruce Richardson */ 115699a2dd95SBruce Richardson uint32_t n_shared_wred_contexts; 115799a2dd95SBruce Richardson } wred; 115899a2dd95SBruce Richardson } leaf; 115999a2dd95SBruce Richardson }; 116099a2dd95SBruce Richardson 116199a2dd95SBruce Richardson /** Mask of statistics counter types to be enabled for this node. This 116299a2dd95SBruce Richardson * needs to be a subset of the statistics counter types available for 116399a2dd95SBruce Richardson * the current node. Any statistics counter type not included in this 116499a2dd95SBruce Richardson * set is to be disabled for the current node. 116599a2dd95SBruce Richardson * @see enum rte_tm_stats_type 116699a2dd95SBruce Richardson */ 116799a2dd95SBruce Richardson uint64_t stats_mask; 116899a2dd95SBruce Richardson }; 116999a2dd95SBruce Richardson 117099a2dd95SBruce Richardson /** 117199a2dd95SBruce Richardson * Verbose error types. 117299a2dd95SBruce Richardson * 117399a2dd95SBruce Richardson * Most of them provide the type of the object referenced by struct 117499a2dd95SBruce Richardson * rte_tm_error::cause. 117599a2dd95SBruce Richardson */ 117699a2dd95SBruce Richardson enum rte_tm_error_type { 117799a2dd95SBruce Richardson RTE_TM_ERROR_TYPE_NONE, /**< No error. */ 117899a2dd95SBruce Richardson RTE_TM_ERROR_TYPE_UNSPECIFIED, /**< Cause unspecified. */ 117999a2dd95SBruce Richardson RTE_TM_ERROR_TYPE_CAPABILITIES, 118099a2dd95SBruce Richardson RTE_TM_ERROR_TYPE_LEVEL_ID, 118199a2dd95SBruce Richardson RTE_TM_ERROR_TYPE_WRED_PROFILE, 118299a2dd95SBruce Richardson RTE_TM_ERROR_TYPE_WRED_PROFILE_GREEN, 118399a2dd95SBruce Richardson RTE_TM_ERROR_TYPE_WRED_PROFILE_YELLOW, 118499a2dd95SBruce Richardson RTE_TM_ERROR_TYPE_WRED_PROFILE_RED, 118599a2dd95SBruce Richardson RTE_TM_ERROR_TYPE_WRED_PROFILE_ID, 118699a2dd95SBruce Richardson RTE_TM_ERROR_TYPE_SHARED_WRED_CONTEXT_ID, 118799a2dd95SBruce Richardson RTE_TM_ERROR_TYPE_SHAPER_PROFILE, 118899a2dd95SBruce Richardson RTE_TM_ERROR_TYPE_SHAPER_PROFILE_COMMITTED_RATE, 118999a2dd95SBruce Richardson RTE_TM_ERROR_TYPE_SHAPER_PROFILE_COMMITTED_SIZE, 119099a2dd95SBruce Richardson RTE_TM_ERROR_TYPE_SHAPER_PROFILE_PEAK_RATE, 119199a2dd95SBruce Richardson RTE_TM_ERROR_TYPE_SHAPER_PROFILE_PEAK_SIZE, 119299a2dd95SBruce Richardson RTE_TM_ERROR_TYPE_SHAPER_PROFILE_PKT_ADJUST_LEN, 119399a2dd95SBruce Richardson RTE_TM_ERROR_TYPE_SHAPER_PROFILE_PACKET_MODE, 119499a2dd95SBruce Richardson RTE_TM_ERROR_TYPE_SHAPER_PROFILE_ID, 119599a2dd95SBruce Richardson RTE_TM_ERROR_TYPE_SHARED_SHAPER_ID, 119699a2dd95SBruce Richardson RTE_TM_ERROR_TYPE_NODE_PARENT_NODE_ID, 119799a2dd95SBruce Richardson RTE_TM_ERROR_TYPE_NODE_PRIORITY, 119899a2dd95SBruce Richardson RTE_TM_ERROR_TYPE_NODE_WEIGHT, 119999a2dd95SBruce Richardson RTE_TM_ERROR_TYPE_NODE_PARAMS, 120099a2dd95SBruce Richardson RTE_TM_ERROR_TYPE_NODE_PARAMS_SHAPER_PROFILE_ID, 120199a2dd95SBruce Richardson RTE_TM_ERROR_TYPE_NODE_PARAMS_SHARED_SHAPER_ID, 120299a2dd95SBruce Richardson RTE_TM_ERROR_TYPE_NODE_PARAMS_N_SHARED_SHAPERS, 120399a2dd95SBruce Richardson RTE_TM_ERROR_TYPE_NODE_PARAMS_WFQ_WEIGHT_MODE, 120499a2dd95SBruce Richardson RTE_TM_ERROR_TYPE_NODE_PARAMS_N_SP_PRIORITIES, 120599a2dd95SBruce Richardson RTE_TM_ERROR_TYPE_NODE_PARAMS_CMAN, 120699a2dd95SBruce Richardson RTE_TM_ERROR_TYPE_NODE_PARAMS_WRED_PROFILE_ID, 120799a2dd95SBruce Richardson RTE_TM_ERROR_TYPE_NODE_PARAMS_SHARED_WRED_CONTEXT_ID, 120899a2dd95SBruce Richardson RTE_TM_ERROR_TYPE_NODE_PARAMS_N_SHARED_WRED_CONTEXTS, 120999a2dd95SBruce Richardson RTE_TM_ERROR_TYPE_NODE_PARAMS_STATS, 121099a2dd95SBruce Richardson RTE_TM_ERROR_TYPE_NODE_ID, 121199a2dd95SBruce Richardson }; 121299a2dd95SBruce Richardson 121399a2dd95SBruce Richardson /** 121499a2dd95SBruce Richardson * Verbose error structure definition. 121599a2dd95SBruce Richardson * 121699a2dd95SBruce Richardson * This object is normally allocated by applications and set by PMDs, the 121799a2dd95SBruce Richardson * message points to a constant string which does not need to be freed by 121899a2dd95SBruce Richardson * the application, however its pointer can be considered valid only as long 121999a2dd95SBruce Richardson * as its associated DPDK port remains configured. Closing the underlying 122099a2dd95SBruce Richardson * device or unloading the PMD invalidates it. 122199a2dd95SBruce Richardson * 122299a2dd95SBruce Richardson * Both cause and message may be NULL regardless of the error type. 122399a2dd95SBruce Richardson */ 122499a2dd95SBruce Richardson struct rte_tm_error { 122599a2dd95SBruce Richardson enum rte_tm_error_type type; /**< Cause field and error type. */ 122699a2dd95SBruce Richardson const void *cause; /**< Object responsible for the error. */ 122799a2dd95SBruce Richardson const char *message; /**< Human-readable error message. */ 122899a2dd95SBruce Richardson }; 122999a2dd95SBruce Richardson 123099a2dd95SBruce Richardson /** 123199a2dd95SBruce Richardson * Traffic manager get number of leaf nodes 123299a2dd95SBruce Richardson * 1233*09fd4227SAndrew Rybchenko * Each leaf node sits on top of a Tx queue of the current Ethernet port. 123499a2dd95SBruce Richardson * Therefore, the set of leaf nodes is predefined, their number is always equal 1235*09fd4227SAndrew Rybchenko * to N (where N is the number of Tx queues configured for the current port) 123699a2dd95SBruce Richardson * and their IDs are 0 .. (N-1). 123799a2dd95SBruce Richardson * 123899a2dd95SBruce Richardson * @param[in] port_id 123999a2dd95SBruce Richardson * The port identifier of the Ethernet device. 124099a2dd95SBruce Richardson * @param[out] n_leaf_nodes 124199a2dd95SBruce Richardson * Number of leaf nodes for the current port. 124299a2dd95SBruce Richardson * @param[out] error 124399a2dd95SBruce Richardson * Error details. Filled in only on error, when not NULL. 124499a2dd95SBruce Richardson * @return 124599a2dd95SBruce Richardson * 0 on success, non-zero error code otherwise. 124699a2dd95SBruce Richardson */ 124799a2dd95SBruce Richardson __rte_experimental 124899a2dd95SBruce Richardson int 124999a2dd95SBruce Richardson rte_tm_get_number_of_leaf_nodes(uint16_t port_id, 125099a2dd95SBruce Richardson uint32_t *n_leaf_nodes, 125199a2dd95SBruce Richardson struct rte_tm_error *error); 125299a2dd95SBruce Richardson 125399a2dd95SBruce Richardson /** 125499a2dd95SBruce Richardson * Traffic manager node ID validate and type (i.e. leaf or non-leaf) get 125599a2dd95SBruce Richardson * 125699a2dd95SBruce Richardson * The leaf nodes have predefined IDs in the range of 0 .. (N-1), where N is 1257*09fd4227SAndrew Rybchenko * the number of Tx queues of the current Ethernet port. The non-leaf nodes 125899a2dd95SBruce Richardson * have their IDs generated by the application outside of the above range, 125999a2dd95SBruce Richardson * which is reserved for leaf nodes. 126099a2dd95SBruce Richardson * 126199a2dd95SBruce Richardson * @param[in] port_id 126299a2dd95SBruce Richardson * The port identifier of the Ethernet device. 126399a2dd95SBruce Richardson * @param[in] node_id 126499a2dd95SBruce Richardson * Node ID value. Needs to be valid. 126599a2dd95SBruce Richardson * @param[out] is_leaf 126699a2dd95SBruce Richardson * Set to non-zero value when node is leaf and to zero otherwise (non-leaf). 126799a2dd95SBruce Richardson * @param[out] error 126899a2dd95SBruce Richardson * Error details. Filled in only on error, when not NULL. 126999a2dd95SBruce Richardson * @return 127099a2dd95SBruce Richardson * 0 on success, non-zero error code otherwise. 127199a2dd95SBruce Richardson */ 127299a2dd95SBruce Richardson __rte_experimental 127399a2dd95SBruce Richardson int 127499a2dd95SBruce Richardson rte_tm_node_type_get(uint16_t port_id, 127599a2dd95SBruce Richardson uint32_t node_id, 127699a2dd95SBruce Richardson int *is_leaf, 127799a2dd95SBruce Richardson struct rte_tm_error *error); 127899a2dd95SBruce Richardson 127999a2dd95SBruce Richardson /** 128099a2dd95SBruce Richardson * Traffic manager capabilities get 128199a2dd95SBruce Richardson * 128299a2dd95SBruce Richardson * @param[in] port_id 128399a2dd95SBruce Richardson * The port identifier of the Ethernet device. 128499a2dd95SBruce Richardson * @param[out] cap 128599a2dd95SBruce Richardson * Traffic manager capabilities. Needs to be pre-allocated and valid. 128699a2dd95SBruce Richardson * @param[out] error 128799a2dd95SBruce Richardson * Error details. Filled in only on error, when not NULL. 128899a2dd95SBruce Richardson * @return 128999a2dd95SBruce Richardson * 0 on success, non-zero error code otherwise. 129099a2dd95SBruce Richardson */ 129199a2dd95SBruce Richardson __rte_experimental 129299a2dd95SBruce Richardson int 129399a2dd95SBruce Richardson rte_tm_capabilities_get(uint16_t port_id, 129499a2dd95SBruce Richardson struct rte_tm_capabilities *cap, 129599a2dd95SBruce Richardson struct rte_tm_error *error); 129699a2dd95SBruce Richardson 129799a2dd95SBruce Richardson /** 129899a2dd95SBruce Richardson * Traffic manager level capabilities get 129999a2dd95SBruce Richardson * 130099a2dd95SBruce Richardson * @param[in] port_id 130199a2dd95SBruce Richardson * The port identifier of the Ethernet device. 130299a2dd95SBruce Richardson * @param[in] level_id 130399a2dd95SBruce Richardson * The hierarchy level identifier. The value of 0 identifies the level of the 130499a2dd95SBruce Richardson * root node. 130599a2dd95SBruce Richardson * @param[out] cap 130699a2dd95SBruce Richardson * Traffic manager level capabilities. Needs to be pre-allocated and valid. 130799a2dd95SBruce Richardson * @param[out] error 130899a2dd95SBruce Richardson * Error details. Filled in only on error, when not NULL. 130999a2dd95SBruce Richardson * @return 131099a2dd95SBruce Richardson * 0 on success, non-zero error code otherwise. 131199a2dd95SBruce Richardson */ 131299a2dd95SBruce Richardson __rte_experimental 131399a2dd95SBruce Richardson int 131499a2dd95SBruce Richardson rte_tm_level_capabilities_get(uint16_t port_id, 131599a2dd95SBruce Richardson uint32_t level_id, 131699a2dd95SBruce Richardson struct rte_tm_level_capabilities *cap, 131799a2dd95SBruce Richardson struct rte_tm_error *error); 131899a2dd95SBruce Richardson 131999a2dd95SBruce Richardson /** 132099a2dd95SBruce Richardson * Traffic manager node capabilities get 132199a2dd95SBruce Richardson * 132299a2dd95SBruce Richardson * @param[in] port_id 132399a2dd95SBruce Richardson * The port identifier of the Ethernet device. 132499a2dd95SBruce Richardson * @param[in] node_id 132599a2dd95SBruce Richardson * Node ID. Needs to be valid. 132699a2dd95SBruce Richardson * @param[out] cap 132799a2dd95SBruce Richardson * Traffic manager node capabilities. Needs to be pre-allocated and valid. 132899a2dd95SBruce Richardson * @param[out] error 132999a2dd95SBruce Richardson * Error details. Filled in only on error, when not NULL. 133099a2dd95SBruce Richardson * @return 133199a2dd95SBruce Richardson * 0 on success, non-zero error code otherwise. 133299a2dd95SBruce Richardson */ 133399a2dd95SBruce Richardson __rte_experimental 133499a2dd95SBruce Richardson int 133599a2dd95SBruce Richardson rte_tm_node_capabilities_get(uint16_t port_id, 133699a2dd95SBruce Richardson uint32_t node_id, 133799a2dd95SBruce Richardson struct rte_tm_node_capabilities *cap, 133899a2dd95SBruce Richardson struct rte_tm_error *error); 133999a2dd95SBruce Richardson 134099a2dd95SBruce Richardson /** 134199a2dd95SBruce Richardson * Traffic manager WRED profile add 134299a2dd95SBruce Richardson * 134399a2dd95SBruce Richardson * Create a new WRED profile with ID set to *wred_profile_id*. The new profile 134499a2dd95SBruce Richardson * is used to create one or several WRED contexts. 134599a2dd95SBruce Richardson * 134699a2dd95SBruce Richardson * @param[in] port_id 134799a2dd95SBruce Richardson * The port identifier of the Ethernet device. 134899a2dd95SBruce Richardson * @param[in] wred_profile_id 134999a2dd95SBruce Richardson * WRED profile ID for the new profile. Needs to be unused. 135099a2dd95SBruce Richardson * @param[in] profile 135199a2dd95SBruce Richardson * WRED profile parameters. Needs to be pre-allocated and valid. 135299a2dd95SBruce Richardson * @param[out] error 135399a2dd95SBruce Richardson * Error details. Filled in only on error, when not NULL. 135499a2dd95SBruce Richardson * @return 135599a2dd95SBruce Richardson * 0 on success, non-zero error code otherwise. 135699a2dd95SBruce Richardson * 135799a2dd95SBruce Richardson * @see struct rte_tm_capabilities::cman_wred_context_n_max 135899a2dd95SBruce Richardson */ 135999a2dd95SBruce Richardson __rte_experimental 136099a2dd95SBruce Richardson int 136199a2dd95SBruce Richardson rte_tm_wred_profile_add(uint16_t port_id, 136299a2dd95SBruce Richardson uint32_t wred_profile_id, 136399a2dd95SBruce Richardson struct rte_tm_wred_params *profile, 136499a2dd95SBruce Richardson struct rte_tm_error *error); 136599a2dd95SBruce Richardson 136699a2dd95SBruce Richardson /** 136799a2dd95SBruce Richardson * Traffic manager WRED profile delete 136899a2dd95SBruce Richardson * 136999a2dd95SBruce Richardson * Delete an existing WRED profile. This operation fails when there is 137099a2dd95SBruce Richardson * currently at least one user (i.e. WRED context) of this WRED profile. 137199a2dd95SBruce Richardson * 137299a2dd95SBruce Richardson * @param[in] port_id 137399a2dd95SBruce Richardson * The port identifier of the Ethernet device. 137499a2dd95SBruce Richardson * @param[in] wred_profile_id 137599a2dd95SBruce Richardson * WRED profile ID. Needs to be the valid. 137699a2dd95SBruce Richardson * @param[out] error 137799a2dd95SBruce Richardson * Error details. Filled in only on error, when not NULL. 137899a2dd95SBruce Richardson * @return 137999a2dd95SBruce Richardson * 0 on success, non-zero error code otherwise. 138099a2dd95SBruce Richardson * 138199a2dd95SBruce Richardson * @see struct rte_tm_capabilities::cman_wred_context_n_max 138299a2dd95SBruce Richardson */ 138399a2dd95SBruce Richardson __rte_experimental 138499a2dd95SBruce Richardson int 138599a2dd95SBruce Richardson rte_tm_wred_profile_delete(uint16_t port_id, 138699a2dd95SBruce Richardson uint32_t wred_profile_id, 138799a2dd95SBruce Richardson struct rte_tm_error *error); 138899a2dd95SBruce Richardson 138999a2dd95SBruce Richardson /** 139099a2dd95SBruce Richardson * Traffic manager shared WRED context add or update 139199a2dd95SBruce Richardson * 139299a2dd95SBruce Richardson * When *shared_wred_context_id* is invalid, a new WRED context with this ID is 139399a2dd95SBruce Richardson * created by using the WRED profile identified by *wred_profile_id*. 139499a2dd95SBruce Richardson * 139599a2dd95SBruce Richardson * When *shared_wred_context_id* is valid, this WRED context is no longer using 139699a2dd95SBruce Richardson * the profile previously assigned to it and is updated to use the profile 139799a2dd95SBruce Richardson * identified by *wred_profile_id*. 139899a2dd95SBruce Richardson * 139999a2dd95SBruce Richardson * A valid shared WRED context can be assigned to several hierarchy leaf nodes 140099a2dd95SBruce Richardson * configured to use WRED as the congestion management mode. 140199a2dd95SBruce Richardson * 140299a2dd95SBruce Richardson * @param[in] port_id 140399a2dd95SBruce Richardson * The port identifier of the Ethernet device. 140499a2dd95SBruce Richardson * @param[in] shared_wred_context_id 140599a2dd95SBruce Richardson * Shared WRED context ID 140699a2dd95SBruce Richardson * @param[in] wred_profile_id 140799a2dd95SBruce Richardson * WRED profile ID. Needs to be the valid. 140899a2dd95SBruce Richardson * @param[out] error 140999a2dd95SBruce Richardson * Error details. Filled in only on error, when not NULL. 141099a2dd95SBruce Richardson * @return 141199a2dd95SBruce Richardson * 0 on success, non-zero error code otherwise. 141299a2dd95SBruce Richardson * 141399a2dd95SBruce Richardson * @see struct rte_tm_capabilities::cman_wred_context_shared_n_max 141499a2dd95SBruce Richardson */ 141599a2dd95SBruce Richardson __rte_experimental 141699a2dd95SBruce Richardson int 141799a2dd95SBruce Richardson rte_tm_shared_wred_context_add_update(uint16_t port_id, 141899a2dd95SBruce Richardson uint32_t shared_wred_context_id, 141999a2dd95SBruce Richardson uint32_t wred_profile_id, 142099a2dd95SBruce Richardson struct rte_tm_error *error); 142199a2dd95SBruce Richardson 142299a2dd95SBruce Richardson /** 142399a2dd95SBruce Richardson * Traffic manager shared WRED context delete 142499a2dd95SBruce Richardson * 142599a2dd95SBruce Richardson * Delete an existing shared WRED context. This operation fails when there is 142699a2dd95SBruce Richardson * currently at least one user (i.e. hierarchy leaf node) of this shared WRED 142799a2dd95SBruce Richardson * context. 142899a2dd95SBruce Richardson * 142999a2dd95SBruce Richardson * @param[in] port_id 143099a2dd95SBruce Richardson * The port identifier of the Ethernet device. 143199a2dd95SBruce Richardson * @param[in] shared_wred_context_id 143299a2dd95SBruce Richardson * Shared WRED context ID. Needs to be the valid. 143399a2dd95SBruce Richardson * @param[out] error 143499a2dd95SBruce Richardson * Error details. Filled in only on error, when not NULL. 143599a2dd95SBruce Richardson * @return 143699a2dd95SBruce Richardson * 0 on success, non-zero error code otherwise. 143799a2dd95SBruce Richardson * 143899a2dd95SBruce Richardson * @see struct rte_tm_capabilities::cman_wred_context_shared_n_max 143999a2dd95SBruce Richardson */ 144099a2dd95SBruce Richardson __rte_experimental 144199a2dd95SBruce Richardson int 144299a2dd95SBruce Richardson rte_tm_shared_wred_context_delete(uint16_t port_id, 144399a2dd95SBruce Richardson uint32_t shared_wred_context_id, 144499a2dd95SBruce Richardson struct rte_tm_error *error); 144599a2dd95SBruce Richardson 144699a2dd95SBruce Richardson /** 144799a2dd95SBruce Richardson * Traffic manager shaper profile add 144899a2dd95SBruce Richardson * 144999a2dd95SBruce Richardson * Create a new shaper profile with ID set to *shaper_profile_id*. The new 145099a2dd95SBruce Richardson * shaper profile is used to create one or several shapers. 145199a2dd95SBruce Richardson * 145299a2dd95SBruce Richardson * @param[in] port_id 145399a2dd95SBruce Richardson * The port identifier of the Ethernet device. 145499a2dd95SBruce Richardson * @param[in] shaper_profile_id 145599a2dd95SBruce Richardson * Shaper profile ID for the new profile. Needs to be unused. 145699a2dd95SBruce Richardson * @param[in] profile 145799a2dd95SBruce Richardson * Shaper profile parameters. Needs to be pre-allocated and valid. 145899a2dd95SBruce Richardson * @param[out] error 145999a2dd95SBruce Richardson * Error details. Filled in only on error, when not NULL. 146099a2dd95SBruce Richardson * @return 146199a2dd95SBruce Richardson * 0 on success, non-zero error code otherwise. 146299a2dd95SBruce Richardson * 146399a2dd95SBruce Richardson * @see struct rte_tm_capabilities::shaper_n_max 146499a2dd95SBruce Richardson */ 146599a2dd95SBruce Richardson __rte_experimental 146699a2dd95SBruce Richardson int 146799a2dd95SBruce Richardson rte_tm_shaper_profile_add(uint16_t port_id, 146899a2dd95SBruce Richardson uint32_t shaper_profile_id, 146999a2dd95SBruce Richardson struct rte_tm_shaper_params *profile, 147099a2dd95SBruce Richardson struct rte_tm_error *error); 147199a2dd95SBruce Richardson 147299a2dd95SBruce Richardson /** 147399a2dd95SBruce Richardson * Traffic manager shaper profile delete 147499a2dd95SBruce Richardson * 147599a2dd95SBruce Richardson * Delete an existing shaper profile. This operation fails when there is 147699a2dd95SBruce Richardson * currently at least one user (i.e. shaper) of this shaper profile. 147799a2dd95SBruce Richardson * 147899a2dd95SBruce Richardson * @param[in] port_id 147999a2dd95SBruce Richardson * The port identifier of the Ethernet device. 148099a2dd95SBruce Richardson * @param[in] shaper_profile_id 148199a2dd95SBruce Richardson * Shaper profile ID. Needs to be the valid. 148299a2dd95SBruce Richardson * @param[out] error 148399a2dd95SBruce Richardson * Error details. Filled in only on error, when not NULL. 148499a2dd95SBruce Richardson * @return 148599a2dd95SBruce Richardson * 0 on success, non-zero error code otherwise. 148699a2dd95SBruce Richardson * 148799a2dd95SBruce Richardson * @see struct rte_tm_capabilities::shaper_n_max 148899a2dd95SBruce Richardson */ 148999a2dd95SBruce Richardson __rte_experimental 149099a2dd95SBruce Richardson int 149199a2dd95SBruce Richardson rte_tm_shaper_profile_delete(uint16_t port_id, 149299a2dd95SBruce Richardson uint32_t shaper_profile_id, 149399a2dd95SBruce Richardson struct rte_tm_error *error); 149499a2dd95SBruce Richardson 149599a2dd95SBruce Richardson /** 149699a2dd95SBruce Richardson * Traffic manager shared shaper add or update 149799a2dd95SBruce Richardson * 149899a2dd95SBruce Richardson * When *shared_shaper_id* is not a valid shared shaper ID, a new shared shaper 149999a2dd95SBruce Richardson * with this ID is created using the shaper profile identified by 150099a2dd95SBruce Richardson * *shaper_profile_id*. 150199a2dd95SBruce Richardson * 150299a2dd95SBruce Richardson * When *shared_shaper_id* is a valid shared shaper ID, this shared shaper is 150399a2dd95SBruce Richardson * no longer using the shaper profile previously assigned to it and is updated 150499a2dd95SBruce Richardson * to use the shaper profile identified by *shaper_profile_id*. 150599a2dd95SBruce Richardson * 150699a2dd95SBruce Richardson * @param[in] port_id 150799a2dd95SBruce Richardson * The port identifier of the Ethernet device. 150899a2dd95SBruce Richardson * @param[in] shared_shaper_id 150999a2dd95SBruce Richardson * Shared shaper ID 151099a2dd95SBruce Richardson * @param[in] shaper_profile_id 151199a2dd95SBruce Richardson * Shaper profile ID. Needs to be the valid. 151299a2dd95SBruce Richardson * @param[out] error 151399a2dd95SBruce Richardson * Error details. Filled in only on error, when not NULL. 151499a2dd95SBruce Richardson * @return 151599a2dd95SBruce Richardson * 0 on success, non-zero error code otherwise. 151699a2dd95SBruce Richardson * 151799a2dd95SBruce Richardson * @see struct rte_tm_capabilities::shaper_shared_n_max 151899a2dd95SBruce Richardson */ 151999a2dd95SBruce Richardson __rte_experimental 152099a2dd95SBruce Richardson int 152199a2dd95SBruce Richardson rte_tm_shared_shaper_add_update(uint16_t port_id, 152299a2dd95SBruce Richardson uint32_t shared_shaper_id, 152399a2dd95SBruce Richardson uint32_t shaper_profile_id, 152499a2dd95SBruce Richardson struct rte_tm_error *error); 152599a2dd95SBruce Richardson 152699a2dd95SBruce Richardson /** 152799a2dd95SBruce Richardson * Traffic manager shared shaper delete 152899a2dd95SBruce Richardson * 152999a2dd95SBruce Richardson * Delete an existing shared shaper. This operation fails when there is 153099a2dd95SBruce Richardson * currently at least one user (i.e. hierarchy node) of this shared shaper. 153199a2dd95SBruce Richardson * 153299a2dd95SBruce Richardson * @param[in] port_id 153399a2dd95SBruce Richardson * The port identifier of the Ethernet device. 153499a2dd95SBruce Richardson * @param[in] shared_shaper_id 153599a2dd95SBruce Richardson * Shared shaper ID. Needs to be the valid. 153699a2dd95SBruce Richardson * @param[out] error 153799a2dd95SBruce Richardson * Error details. Filled in only on error, when not NULL. 153899a2dd95SBruce Richardson * @return 153999a2dd95SBruce Richardson * 0 on success, non-zero error code otherwise. 154099a2dd95SBruce Richardson * 154199a2dd95SBruce Richardson * @see struct rte_tm_capabilities::shaper_shared_n_max 154299a2dd95SBruce Richardson */ 154399a2dd95SBruce Richardson __rte_experimental 154499a2dd95SBruce Richardson int 154599a2dd95SBruce Richardson rte_tm_shared_shaper_delete(uint16_t port_id, 154699a2dd95SBruce Richardson uint32_t shared_shaper_id, 154799a2dd95SBruce Richardson struct rte_tm_error *error); 154899a2dd95SBruce Richardson 154999a2dd95SBruce Richardson /** 155099a2dd95SBruce Richardson * Traffic manager node add 155199a2dd95SBruce Richardson * 155299a2dd95SBruce Richardson * Create new node and connect it as child of an existing node. The new node is 155399a2dd95SBruce Richardson * further identified by *node_id*, which needs to be unused by any of the 155499a2dd95SBruce Richardson * existing nodes. The parent node is identified by *parent_node_id*, which 155599a2dd95SBruce Richardson * needs to be the valid ID of an existing non-leaf node. The parent node is 155699a2dd95SBruce Richardson * going to use the provided SP *priority* and WFQ *weight* to schedule its new 155799a2dd95SBruce Richardson * child node. 155899a2dd95SBruce Richardson * 155999a2dd95SBruce Richardson * This function has to be called for both leaf and non-leaf nodes. In the case 156099a2dd95SBruce Richardson * of leaf nodes (i.e. *node_id* is within the range of 0 .. (N-1), with N as 1561*09fd4227SAndrew Rybchenko * the number of configured Tx queues of the current port), the leaf node is 156299a2dd95SBruce Richardson * configured rather than created (as the set of leaf nodes is predefined) and 156399a2dd95SBruce Richardson * it is also connected as child of an existing node. 156499a2dd95SBruce Richardson * 156599a2dd95SBruce Richardson * The first node that is added becomes the root node and all the nodes that 156699a2dd95SBruce Richardson * are subsequently added have to be added as descendants of the root node. The 156799a2dd95SBruce Richardson * parent of the root node has to be specified as RTE_TM_NODE_ID_NULL and there 156899a2dd95SBruce Richardson * can only be one node with this parent ID (i.e. the root node). Further 156999a2dd95SBruce Richardson * restrictions for root node: needs to be non-leaf, its private shaper profile 157099a2dd95SBruce Richardson * needs to be valid and single rate, cannot use any shared shapers. 157199a2dd95SBruce Richardson * 157299a2dd95SBruce Richardson * When called before rte_tm_hierarchy_commit() invocation, this function is 157399a2dd95SBruce Richardson * typically used to define the initial start-up hierarchy for the port. 157499a2dd95SBruce Richardson * Provided that dynamic hierarchy updates are supported by the current port (as 157599a2dd95SBruce Richardson * advertised in the port capability set), this function can be also called 157699a2dd95SBruce Richardson * after the rte_tm_hierarchy_commit() invocation. 157799a2dd95SBruce Richardson * 157899a2dd95SBruce Richardson * @param[in] port_id 157999a2dd95SBruce Richardson * The port identifier of the Ethernet device. 158099a2dd95SBruce Richardson * @param[in] node_id 158199a2dd95SBruce Richardson * Node ID. Needs to be unused by any of the existing nodes. 158299a2dd95SBruce Richardson * @param[in] parent_node_id 158399a2dd95SBruce Richardson * Parent node ID. Needs to be the valid. 158499a2dd95SBruce Richardson * @param[in] priority 158599a2dd95SBruce Richardson * Node priority. The highest node priority is zero. Used by the SP algorithm 158699a2dd95SBruce Richardson * running on the parent of the current node for scheduling this child node. 158799a2dd95SBruce Richardson * @param[in] weight 158899a2dd95SBruce Richardson * Node weight. The node weight is relative to the weight sum of all siblings 158999a2dd95SBruce Richardson * that have the same priority. The lowest weight is one. Used by the WFQ 159099a2dd95SBruce Richardson * algorithm running on the parent of the current node for scheduling this 159199a2dd95SBruce Richardson * child node. 159299a2dd95SBruce Richardson * @param[in] level_id 159399a2dd95SBruce Richardson * Level ID that should be met by this node. The hierarchy level of the 159499a2dd95SBruce Richardson * current node is already fully specified through its parent node (i.e. the 159599a2dd95SBruce Richardson * level of this node is equal to the level of its parent node plus one), 159699a2dd95SBruce Richardson * therefore the reason for providing this parameter is to enable the 159799a2dd95SBruce Richardson * application to perform step-by-step checking of the node level during 159899a2dd95SBruce Richardson * successive invocations of this function. When not desired, this check can 159999a2dd95SBruce Richardson * be disabled by assigning value RTE_TM_NODE_LEVEL_ID_ANY to this parameter. 160099a2dd95SBruce Richardson * @param[in] params 160199a2dd95SBruce Richardson * Node parameters. Needs to be pre-allocated and valid. 160299a2dd95SBruce Richardson * @param[out] error 160399a2dd95SBruce Richardson * Error details. Filled in only on error, when not NULL. 160499a2dd95SBruce Richardson * @return 160599a2dd95SBruce Richardson * 0 on success, non-zero error code otherwise. 160699a2dd95SBruce Richardson * 160799a2dd95SBruce Richardson * @see rte_tm_hierarchy_commit() 160899a2dd95SBruce Richardson * @see RTE_TM_UPDATE_NODE_ADD_DELETE 160999a2dd95SBruce Richardson * @see RTE_TM_NODE_LEVEL_ID_ANY 161099a2dd95SBruce Richardson * @see struct rte_tm_capabilities 161199a2dd95SBruce Richardson */ 161299a2dd95SBruce Richardson __rte_experimental 161399a2dd95SBruce Richardson int 161499a2dd95SBruce Richardson rte_tm_node_add(uint16_t port_id, 161599a2dd95SBruce Richardson uint32_t node_id, 161699a2dd95SBruce Richardson uint32_t parent_node_id, 161799a2dd95SBruce Richardson uint32_t priority, 161899a2dd95SBruce Richardson uint32_t weight, 161999a2dd95SBruce Richardson uint32_t level_id, 162099a2dd95SBruce Richardson struct rte_tm_node_params *params, 162199a2dd95SBruce Richardson struct rte_tm_error *error); 162299a2dd95SBruce Richardson 162399a2dd95SBruce Richardson /** 162499a2dd95SBruce Richardson * Traffic manager node delete 162599a2dd95SBruce Richardson * 162699a2dd95SBruce Richardson * Delete an existing node. This operation fails when this node currently has 162799a2dd95SBruce Richardson * at least one user (i.e. child node). 162899a2dd95SBruce Richardson * 162999a2dd95SBruce Richardson * When called before rte_tm_hierarchy_commit() invocation, this function is 163099a2dd95SBruce Richardson * typically used to define the initial start-up hierarchy for the port. 163199a2dd95SBruce Richardson * Provided that dynamic hierarchy updates are supported by the current port (as 163299a2dd95SBruce Richardson * advertised in the port capability set), this function can be also called 163399a2dd95SBruce Richardson * after the rte_tm_hierarchy_commit() invocation. 163499a2dd95SBruce Richardson * 163599a2dd95SBruce Richardson * @param[in] port_id 163699a2dd95SBruce Richardson * The port identifier of the Ethernet device. 163799a2dd95SBruce Richardson * @param[in] node_id 163899a2dd95SBruce Richardson * Node ID. Needs to be valid. 163999a2dd95SBruce Richardson * @param[out] error 164099a2dd95SBruce Richardson * Error details. Filled in only on error, when not NULL. 164199a2dd95SBruce Richardson * @return 164299a2dd95SBruce Richardson * 0 on success, non-zero error code otherwise. 164399a2dd95SBruce Richardson * 164499a2dd95SBruce Richardson * @see RTE_TM_UPDATE_NODE_ADD_DELETE 164599a2dd95SBruce Richardson */ 164699a2dd95SBruce Richardson __rte_experimental 164799a2dd95SBruce Richardson int 164899a2dd95SBruce Richardson rte_tm_node_delete(uint16_t port_id, 164999a2dd95SBruce Richardson uint32_t node_id, 165099a2dd95SBruce Richardson struct rte_tm_error *error); 165199a2dd95SBruce Richardson 165299a2dd95SBruce Richardson /** 165399a2dd95SBruce Richardson * Traffic manager node suspend 165499a2dd95SBruce Richardson * 165599a2dd95SBruce Richardson * Suspend an existing node. While the node is in suspended state, no packet is 165699a2dd95SBruce Richardson * scheduled from this node and its descendants. The node exits the suspended 165799a2dd95SBruce Richardson * state through the node resume operation. 165899a2dd95SBruce Richardson * 165999a2dd95SBruce Richardson * @param[in] port_id 166099a2dd95SBruce Richardson * The port identifier of the Ethernet device. 166199a2dd95SBruce Richardson * @param[in] node_id 166299a2dd95SBruce Richardson * Node ID. Needs to be valid. 166399a2dd95SBruce Richardson * @param[out] error 166499a2dd95SBruce Richardson * Error details. Filled in only on error, when not NULL. 166599a2dd95SBruce Richardson * @return 166699a2dd95SBruce Richardson * 0 on success, non-zero error code otherwise. 166799a2dd95SBruce Richardson * 166899a2dd95SBruce Richardson * @see rte_tm_node_resume() 166999a2dd95SBruce Richardson * @see RTE_TM_UPDATE_NODE_SUSPEND_RESUME 167099a2dd95SBruce Richardson */ 167199a2dd95SBruce Richardson __rte_experimental 167299a2dd95SBruce Richardson int 167399a2dd95SBruce Richardson rte_tm_node_suspend(uint16_t port_id, 167499a2dd95SBruce Richardson uint32_t node_id, 167599a2dd95SBruce Richardson struct rte_tm_error *error); 167699a2dd95SBruce Richardson 167799a2dd95SBruce Richardson /** 167899a2dd95SBruce Richardson * Traffic manager node resume 167999a2dd95SBruce Richardson * 168099a2dd95SBruce Richardson * Resume an existing node that is currently in suspended state. The node 168199a2dd95SBruce Richardson * entered the suspended state as result of a previous node suspend operation. 168299a2dd95SBruce Richardson * 168399a2dd95SBruce Richardson * @param[in] port_id 168499a2dd95SBruce Richardson * The port identifier of the Ethernet device. 168599a2dd95SBruce Richardson * @param[in] node_id 168699a2dd95SBruce Richardson * Node ID. Needs to be valid. 168799a2dd95SBruce Richardson * @param[out] error 168899a2dd95SBruce Richardson * Error details. Filled in only on error, when not NULL. 168999a2dd95SBruce Richardson * @return 169099a2dd95SBruce Richardson * 0 on success, non-zero error code otherwise. 169199a2dd95SBruce Richardson * 169299a2dd95SBruce Richardson * @see rte_tm_node_suspend() 169399a2dd95SBruce Richardson * @see RTE_TM_UPDATE_NODE_SUSPEND_RESUME 169499a2dd95SBruce Richardson */ 169599a2dd95SBruce Richardson __rte_experimental 169699a2dd95SBruce Richardson int 169799a2dd95SBruce Richardson rte_tm_node_resume(uint16_t port_id, 169899a2dd95SBruce Richardson uint32_t node_id, 169999a2dd95SBruce Richardson struct rte_tm_error *error); 170099a2dd95SBruce Richardson 170199a2dd95SBruce Richardson /** 170299a2dd95SBruce Richardson * Traffic manager hierarchy commit 170399a2dd95SBruce Richardson * 170499a2dd95SBruce Richardson * This function is called during the port initialization phase (before the 170599a2dd95SBruce Richardson * Ethernet port is started) to freeze the start-up hierarchy. 170699a2dd95SBruce Richardson * 170799a2dd95SBruce Richardson * This function typically performs the following steps: 170899a2dd95SBruce Richardson * a) It validates the start-up hierarchy that was previously defined for the 170999a2dd95SBruce Richardson * current port through successive rte_tm_node_add() invocations; 171099a2dd95SBruce Richardson * b) Assuming successful validation, it performs all the necessary port 171199a2dd95SBruce Richardson * specific configuration operations to install the specified hierarchy on 171299a2dd95SBruce Richardson * the current port, with immediate effect once the port is started. 171399a2dd95SBruce Richardson * 171499a2dd95SBruce Richardson * This function fails when the currently configured hierarchy is not supported 171599a2dd95SBruce Richardson * by the Ethernet port, in which case the user can abort or try out another 171699a2dd95SBruce Richardson * hierarchy configuration (e.g. a hierarchy with less leaf nodes), which can be 171799a2dd95SBruce Richardson * build from scratch (when *clear_on_fail* is enabled) or by modifying the 171899a2dd95SBruce Richardson * existing hierarchy configuration (when *clear_on_fail* is disabled). 171999a2dd95SBruce Richardson * 172099a2dd95SBruce Richardson * Note that this function can still fail due to other causes (e.g. not enough 172199a2dd95SBruce Richardson * memory available in the system, etc), even though the specified hierarchy is 172299a2dd95SBruce Richardson * supported in principle by the current port. 172399a2dd95SBruce Richardson * 172499a2dd95SBruce Richardson * @param[in] port_id 172599a2dd95SBruce Richardson * The port identifier of the Ethernet device. 172699a2dd95SBruce Richardson * @param[in] clear_on_fail 172799a2dd95SBruce Richardson * On function call failure, hierarchy is cleared when this parameter is 172899a2dd95SBruce Richardson * non-zero and preserved when this parameter is equal to zero. 172999a2dd95SBruce Richardson * @param[out] error 173099a2dd95SBruce Richardson * Error details. Filled in only on error, when not NULL. 173199a2dd95SBruce Richardson * @return 173299a2dd95SBruce Richardson * 0 on success, non-zero error code otherwise. 173399a2dd95SBruce Richardson * 173499a2dd95SBruce Richardson * @see rte_tm_node_add() 173599a2dd95SBruce Richardson * @see rte_tm_node_delete() 173699a2dd95SBruce Richardson */ 173799a2dd95SBruce Richardson __rte_experimental 173899a2dd95SBruce Richardson int 173999a2dd95SBruce Richardson rte_tm_hierarchy_commit(uint16_t port_id, 174099a2dd95SBruce Richardson int clear_on_fail, 174199a2dd95SBruce Richardson struct rte_tm_error *error); 174299a2dd95SBruce Richardson 174399a2dd95SBruce Richardson /** 174499a2dd95SBruce Richardson * Traffic manager node parent update 174599a2dd95SBruce Richardson * 174699a2dd95SBruce Richardson * This function may be used to move a node and its children to a different 174799a2dd95SBruce Richardson * parent. Additionally, if the new parent is the same as the current parent, 174899a2dd95SBruce Richardson * this function will update the priority/weight of an existing node. 174999a2dd95SBruce Richardson * 175099a2dd95SBruce Richardson * Restriction for root node: its parent cannot be changed. 175199a2dd95SBruce Richardson * 175299a2dd95SBruce Richardson * This function can only be called after the rte_tm_hierarchy_commit() 175399a2dd95SBruce Richardson * invocation. Its success depends on the port support for this operation, as 175499a2dd95SBruce Richardson * advertised through the port capability set. 175599a2dd95SBruce Richardson * 175699a2dd95SBruce Richardson * @param[in] port_id 175799a2dd95SBruce Richardson * The port identifier of the Ethernet device. 175899a2dd95SBruce Richardson * @param[in] node_id 175999a2dd95SBruce Richardson * Node ID. Needs to be valid. 176099a2dd95SBruce Richardson * @param[in] parent_node_id 176199a2dd95SBruce Richardson * Node ID for the new parent. Needs to be valid. 176299a2dd95SBruce Richardson * @param[in] priority 176399a2dd95SBruce Richardson * Node priority. The highest node priority is zero. Used by the SP algorithm 176499a2dd95SBruce Richardson * running on the parent of the current node for scheduling this child node. 176599a2dd95SBruce Richardson * @param[in] weight 176699a2dd95SBruce Richardson * Node weight. The node weight is relative to the weight sum of all siblings 176799a2dd95SBruce Richardson * that have the same priority. The lowest weight is zero. Used by the WFQ 176899a2dd95SBruce Richardson * algorithm running on the parent of the current node for scheduling this 176999a2dd95SBruce Richardson * child node. 177099a2dd95SBruce Richardson * @param[out] error 177199a2dd95SBruce Richardson * Error details. Filled in only on error, when not NULL. 177299a2dd95SBruce Richardson * @return 177399a2dd95SBruce Richardson * 0 on success, non-zero error code otherwise. 177499a2dd95SBruce Richardson * 177599a2dd95SBruce Richardson * @see RTE_TM_UPDATE_NODE_PARENT_KEEP_LEVEL 177699a2dd95SBruce Richardson * @see RTE_TM_UPDATE_NODE_PARENT_CHANGE_LEVEL 177799a2dd95SBruce Richardson */ 177899a2dd95SBruce Richardson __rte_experimental 177999a2dd95SBruce Richardson int 178099a2dd95SBruce Richardson rte_tm_node_parent_update(uint16_t port_id, 178199a2dd95SBruce Richardson uint32_t node_id, 178299a2dd95SBruce Richardson uint32_t parent_node_id, 178399a2dd95SBruce Richardson uint32_t priority, 178499a2dd95SBruce Richardson uint32_t weight, 178599a2dd95SBruce Richardson struct rte_tm_error *error); 178699a2dd95SBruce Richardson 178799a2dd95SBruce Richardson /** 178899a2dd95SBruce Richardson * Traffic manager node private shaper update 178999a2dd95SBruce Richardson * 179099a2dd95SBruce Richardson * Restriction for the root node: its private shaper profile needs to be valid 179199a2dd95SBruce Richardson * and single rate. 179299a2dd95SBruce Richardson * 179399a2dd95SBruce Richardson * @param[in] port_id 179499a2dd95SBruce Richardson * The port identifier of the Ethernet device. 179599a2dd95SBruce Richardson * @param[in] node_id 179699a2dd95SBruce Richardson * Node ID. Needs to be valid. 179799a2dd95SBruce Richardson * @param[in] shaper_profile_id 179899a2dd95SBruce Richardson * Shaper profile ID for the private shaper of the current node. Needs to be 179999a2dd95SBruce Richardson * either valid shaper profile ID or RTE_TM_SHAPER_PROFILE_ID_NONE, with 180099a2dd95SBruce Richardson * the latter disabling the private shaper of the current node. 180199a2dd95SBruce Richardson * @param[out] error 180299a2dd95SBruce Richardson * Error details. Filled in only on error, when not NULL. 180399a2dd95SBruce Richardson * @return 180499a2dd95SBruce Richardson * 0 on success, non-zero error code otherwise. 180599a2dd95SBruce Richardson * 180699a2dd95SBruce Richardson * @see struct rte_tm_capabilities::shaper_private_n_max 180799a2dd95SBruce Richardson */ 180899a2dd95SBruce Richardson __rte_experimental 180999a2dd95SBruce Richardson int 181099a2dd95SBruce Richardson rte_tm_node_shaper_update(uint16_t port_id, 181199a2dd95SBruce Richardson uint32_t node_id, 181299a2dd95SBruce Richardson uint32_t shaper_profile_id, 181399a2dd95SBruce Richardson struct rte_tm_error *error); 181499a2dd95SBruce Richardson 181599a2dd95SBruce Richardson /** 181699a2dd95SBruce Richardson * Traffic manager node shared shapers update 181799a2dd95SBruce Richardson * 181899a2dd95SBruce Richardson * Restriction for root node: cannot use any shared rate shapers. 181999a2dd95SBruce Richardson * 182099a2dd95SBruce Richardson * @param[in] port_id 182199a2dd95SBruce Richardson * The port identifier of the Ethernet device. 182299a2dd95SBruce Richardson * @param[in] node_id 182399a2dd95SBruce Richardson * Node ID. Needs to be valid. 182499a2dd95SBruce Richardson * @param[in] shared_shaper_id 182599a2dd95SBruce Richardson * Shared shaper ID. Needs to be valid. 182699a2dd95SBruce Richardson * @param[in] add 182799a2dd95SBruce Richardson * Set to non-zero value to add this shared shaper to current node or to zero 182899a2dd95SBruce Richardson * to delete this shared shaper from current node. 182999a2dd95SBruce Richardson * @param[out] error 183099a2dd95SBruce Richardson * Error details. Filled in only on error, when not NULL. 183199a2dd95SBruce Richardson * @return 183299a2dd95SBruce Richardson * 0 on success, non-zero error code otherwise. 183399a2dd95SBruce Richardson * 183499a2dd95SBruce Richardson * @see struct rte_tm_capabilities::shaper_shared_n_max 183599a2dd95SBruce Richardson */ 183699a2dd95SBruce Richardson __rte_experimental 183799a2dd95SBruce Richardson int 183899a2dd95SBruce Richardson rte_tm_node_shared_shaper_update(uint16_t port_id, 183999a2dd95SBruce Richardson uint32_t node_id, 184099a2dd95SBruce Richardson uint32_t shared_shaper_id, 184199a2dd95SBruce Richardson int add, 184299a2dd95SBruce Richardson struct rte_tm_error *error); 184399a2dd95SBruce Richardson 184499a2dd95SBruce Richardson /** 184599a2dd95SBruce Richardson * Traffic manager node enabled statistics counters update 184699a2dd95SBruce Richardson * 184799a2dd95SBruce Richardson * @param[in] port_id 184899a2dd95SBruce Richardson * The port identifier of the Ethernet device. 184999a2dd95SBruce Richardson * @param[in] node_id 185099a2dd95SBruce Richardson * Node ID. Needs to be valid. 185199a2dd95SBruce Richardson * @param[in] stats_mask 185299a2dd95SBruce Richardson * Mask of statistics counter types to be enabled for the current node. This 185399a2dd95SBruce Richardson * needs to be a subset of the statistics counter types available for the 185499a2dd95SBruce Richardson * current node. Any statistics counter type not included in this set is to 185599a2dd95SBruce Richardson * be disabled for the current node. 185699a2dd95SBruce Richardson * @param[out] error 185799a2dd95SBruce Richardson * Error details. Filled in only on error, when not NULL. 185899a2dd95SBruce Richardson * @return 185999a2dd95SBruce Richardson * 0 on success, non-zero error code otherwise. 186099a2dd95SBruce Richardson * 186199a2dd95SBruce Richardson * @see enum rte_tm_stats_type 186299a2dd95SBruce Richardson * @see RTE_TM_UPDATE_NODE_STATS 186399a2dd95SBruce Richardson */ 186499a2dd95SBruce Richardson __rte_experimental 186599a2dd95SBruce Richardson int 186699a2dd95SBruce Richardson rte_tm_node_stats_update(uint16_t port_id, 186799a2dd95SBruce Richardson uint32_t node_id, 186899a2dd95SBruce Richardson uint64_t stats_mask, 186999a2dd95SBruce Richardson struct rte_tm_error *error); 187099a2dd95SBruce Richardson 187199a2dd95SBruce Richardson /** 187299a2dd95SBruce Richardson * Traffic manager node WFQ weight mode update 187399a2dd95SBruce Richardson * 187499a2dd95SBruce Richardson * @param[in] port_id 187599a2dd95SBruce Richardson * The port identifier of the Ethernet device. 187699a2dd95SBruce Richardson * @param[in] node_id 187799a2dd95SBruce Richardson * Node ID. Needs to be valid non-leaf node ID. 187899a2dd95SBruce Richardson * @param[in] wfq_weight_mode 187999a2dd95SBruce Richardson * WFQ weight mode for each SP priority. When NULL, it indicates that WFQ is 188099a2dd95SBruce Richardson * to be used for all priorities. When non-NULL, it points to a pre-allocated 188199a2dd95SBruce Richardson * array of *n_sp_priorities* values, with non-zero value for byte-mode and 188299a2dd95SBruce Richardson * zero for packet-mode. 188399a2dd95SBruce Richardson * @param[in] n_sp_priorities 188499a2dd95SBruce Richardson * Number of SP priorities. 188599a2dd95SBruce Richardson * @param[out] error 188699a2dd95SBruce Richardson * Error details. Filled in only on error, when not NULL. 188799a2dd95SBruce Richardson * @return 188899a2dd95SBruce Richardson * 0 on success, non-zero error code otherwise. 188999a2dd95SBruce Richardson * 189099a2dd95SBruce Richardson * @see RTE_TM_UPDATE_NODE_WFQ_WEIGHT_MODE 189199a2dd95SBruce Richardson * @see RTE_TM_UPDATE_NODE_N_SP_PRIORITIES 189299a2dd95SBruce Richardson */ 189399a2dd95SBruce Richardson __rte_experimental 189499a2dd95SBruce Richardson int 189599a2dd95SBruce Richardson rte_tm_node_wfq_weight_mode_update(uint16_t port_id, 189699a2dd95SBruce Richardson uint32_t node_id, 189799a2dd95SBruce Richardson int *wfq_weight_mode, 189899a2dd95SBruce Richardson uint32_t n_sp_priorities, 189999a2dd95SBruce Richardson struct rte_tm_error *error); 190099a2dd95SBruce Richardson 190199a2dd95SBruce Richardson /** 190299a2dd95SBruce Richardson * Traffic manager node congestion management mode update 190399a2dd95SBruce Richardson * 190499a2dd95SBruce Richardson * @param[in] port_id 190599a2dd95SBruce Richardson * The port identifier of the Ethernet device. 190699a2dd95SBruce Richardson * @param[in] node_id 190799a2dd95SBruce Richardson * Node ID. Needs to be valid leaf node ID. 190899a2dd95SBruce Richardson * @param[in] cman 190999a2dd95SBruce Richardson * Congestion management mode. 191099a2dd95SBruce Richardson * @param[out] error 191199a2dd95SBruce Richardson * Error details. Filled in only on error, when not NULL. 191299a2dd95SBruce Richardson * @return 191399a2dd95SBruce Richardson * 0 on success, non-zero error code otherwise. 191499a2dd95SBruce Richardson * 191599a2dd95SBruce Richardson * @see RTE_TM_UPDATE_NODE_CMAN 191699a2dd95SBruce Richardson */ 191799a2dd95SBruce Richardson __rte_experimental 191899a2dd95SBruce Richardson int 191999a2dd95SBruce Richardson rte_tm_node_cman_update(uint16_t port_id, 192099a2dd95SBruce Richardson uint32_t node_id, 192199a2dd95SBruce Richardson enum rte_tm_cman_mode cman, 192299a2dd95SBruce Richardson struct rte_tm_error *error); 192399a2dd95SBruce Richardson 192499a2dd95SBruce Richardson /** 192599a2dd95SBruce Richardson * Traffic manager node private WRED context update 192699a2dd95SBruce Richardson * 192799a2dd95SBruce Richardson * @param[in] port_id 192899a2dd95SBruce Richardson * The port identifier of the Ethernet device. 192999a2dd95SBruce Richardson * @param[in] node_id 193099a2dd95SBruce Richardson * Node ID. Needs to be valid leaf node ID. 193199a2dd95SBruce Richardson * @param[in] wred_profile_id 193299a2dd95SBruce Richardson * WRED profile ID for the private WRED context of the current node. Needs to 193399a2dd95SBruce Richardson * be either valid WRED profile ID or RTE_TM_WRED_PROFILE_ID_NONE, with the 193499a2dd95SBruce Richardson * latter disabling the private WRED context of the current node. 193599a2dd95SBruce Richardson * @param[out] error 193699a2dd95SBruce Richardson * Error details. Filled in only on error, when not NULL. 193799a2dd95SBruce Richardson * @return 193899a2dd95SBruce Richardson * 0 on success, non-zero error code otherwise. 193999a2dd95SBruce Richardson * 194099a2dd95SBruce Richardson * @see struct rte_tm_capabilities::cman_wred_context_private_n_max 194199a2dd95SBruce Richardson */ 194299a2dd95SBruce Richardson __rte_experimental 194399a2dd95SBruce Richardson int 194499a2dd95SBruce Richardson rte_tm_node_wred_context_update(uint16_t port_id, 194599a2dd95SBruce Richardson uint32_t node_id, 194699a2dd95SBruce Richardson uint32_t wred_profile_id, 194799a2dd95SBruce Richardson struct rte_tm_error *error); 194899a2dd95SBruce Richardson 194999a2dd95SBruce Richardson /** 195099a2dd95SBruce Richardson * Traffic manager node shared WRED context update 195199a2dd95SBruce Richardson * 195299a2dd95SBruce Richardson * @param[in] port_id 195399a2dd95SBruce Richardson * The port identifier of the Ethernet device. 195499a2dd95SBruce Richardson * @param[in] node_id 195599a2dd95SBruce Richardson * Node ID. Needs to be valid leaf node ID. 195699a2dd95SBruce Richardson * @param[in] shared_wred_context_id 195799a2dd95SBruce Richardson * Shared WRED context ID. Needs to be valid. 195899a2dd95SBruce Richardson * @param[in] add 195999a2dd95SBruce Richardson * Set to non-zero value to add this shared WRED context to current node or 196099a2dd95SBruce Richardson * to zero to delete this shared WRED context from current node. 196199a2dd95SBruce Richardson * @param[out] error 196299a2dd95SBruce Richardson * Error details. Filled in only on error, when not NULL. 196399a2dd95SBruce Richardson * @return 196499a2dd95SBruce Richardson * 0 on success, non-zero error code otherwise. 196599a2dd95SBruce Richardson * 196699a2dd95SBruce Richardson * @see struct rte_tm_capabilities::cman_wred_context_shared_n_max 196799a2dd95SBruce Richardson */ 196899a2dd95SBruce Richardson __rte_experimental 196999a2dd95SBruce Richardson int 197099a2dd95SBruce Richardson rte_tm_node_shared_wred_context_update(uint16_t port_id, 197199a2dd95SBruce Richardson uint32_t node_id, 197299a2dd95SBruce Richardson uint32_t shared_wred_context_id, 197399a2dd95SBruce Richardson int add, 197499a2dd95SBruce Richardson struct rte_tm_error *error); 197599a2dd95SBruce Richardson 197699a2dd95SBruce Richardson /** 197799a2dd95SBruce Richardson * Traffic manager node statistics counters read 197899a2dd95SBruce Richardson * 197999a2dd95SBruce Richardson * @param[in] port_id 198099a2dd95SBruce Richardson * The port identifier of the Ethernet device. 198199a2dd95SBruce Richardson * @param[in] node_id 198299a2dd95SBruce Richardson * Node ID. Needs to be valid. 198399a2dd95SBruce Richardson * @param[out] stats 198499a2dd95SBruce Richardson * When non-NULL, it contains the current value for the statistics counters 198599a2dd95SBruce Richardson * enabled for the current node. 198699a2dd95SBruce Richardson * @param[out] stats_mask 198799a2dd95SBruce Richardson * When non-NULL, it contains the mask of statistics counter types that are 198899a2dd95SBruce Richardson * currently enabled for this node, indicating which of the counters 198999a2dd95SBruce Richardson * retrieved with the *stats* structure are valid. 199099a2dd95SBruce Richardson * @param[in] clear 199199a2dd95SBruce Richardson * When this parameter has a non-zero value, the statistics counters are 199299a2dd95SBruce Richardson * cleared (i.e. set to zero) immediately after they have been read, 199399a2dd95SBruce Richardson * otherwise the statistics counters are left untouched. 199499a2dd95SBruce Richardson * @param[out] error 199599a2dd95SBruce Richardson * Error details. Filled in only on error, when not NULL. 199699a2dd95SBruce Richardson * @return 199799a2dd95SBruce Richardson * 0 on success, non-zero error code otherwise. 199899a2dd95SBruce Richardson * 199999a2dd95SBruce Richardson * @see enum rte_tm_stats_type 200099a2dd95SBruce Richardson */ 200199a2dd95SBruce Richardson __rte_experimental 200299a2dd95SBruce Richardson int 200399a2dd95SBruce Richardson rte_tm_node_stats_read(uint16_t port_id, 200499a2dd95SBruce Richardson uint32_t node_id, 200599a2dd95SBruce Richardson struct rte_tm_node_stats *stats, 200699a2dd95SBruce Richardson uint64_t *stats_mask, 200799a2dd95SBruce Richardson int clear, 200899a2dd95SBruce Richardson struct rte_tm_error *error); 200999a2dd95SBruce Richardson 201099a2dd95SBruce Richardson /** 201199a2dd95SBruce Richardson * Traffic manager packet marking - VLAN DEI (IEEE 802.1Q) 201299a2dd95SBruce Richardson * 201399a2dd95SBruce Richardson * IEEE 802.1p maps the traffic class to the VLAN Priority Code Point (PCP) 201499a2dd95SBruce Richardson * field (3 bits), while IEEE 802.1q maps the drop priority to the VLAN Drop 201599a2dd95SBruce Richardson * Eligible Indicator (DEI) field (1 bit), which was previously named Canonical 201699a2dd95SBruce Richardson * Format Indicator (CFI). 201799a2dd95SBruce Richardson * 201899a2dd95SBruce Richardson * All VLAN frames of a given color get their DEI bit set if marking is enabled 201999a2dd95SBruce Richardson * for this color; otherwise, their DEI bit is left as is (either set or not). 202099a2dd95SBruce Richardson * 202199a2dd95SBruce Richardson * @param[in] port_id 202299a2dd95SBruce Richardson * The port identifier of the Ethernet device. 202399a2dd95SBruce Richardson * @param[in] mark_green 202499a2dd95SBruce Richardson * Set to non-zero value to enable marking of green packets and to zero to 202599a2dd95SBruce Richardson * disable it. 202699a2dd95SBruce Richardson * @param[in] mark_yellow 202799a2dd95SBruce Richardson * Set to non-zero value to enable marking of yellow packets and to zero to 202899a2dd95SBruce Richardson * disable it. 202999a2dd95SBruce Richardson * @param[in] mark_red 203099a2dd95SBruce Richardson * Set to non-zero value to enable marking of red packets and to zero to 203199a2dd95SBruce Richardson * disable it. 203299a2dd95SBruce Richardson * @param[out] error 203399a2dd95SBruce Richardson * Error details. Filled in only on error, when not NULL. 203499a2dd95SBruce Richardson * @return 203599a2dd95SBruce Richardson * 0 on success, non-zero error code otherwise. 203699a2dd95SBruce Richardson * 203799a2dd95SBruce Richardson * @see struct rte_tm_capabilities::mark_vlan_dei_supported 203899a2dd95SBruce Richardson */ 203999a2dd95SBruce Richardson __rte_experimental 204099a2dd95SBruce Richardson int 204199a2dd95SBruce Richardson rte_tm_mark_vlan_dei(uint16_t port_id, 204299a2dd95SBruce Richardson int mark_green, 204399a2dd95SBruce Richardson int mark_yellow, 204499a2dd95SBruce Richardson int mark_red, 204599a2dd95SBruce Richardson struct rte_tm_error *error); 204699a2dd95SBruce Richardson 204799a2dd95SBruce Richardson /** 204899a2dd95SBruce Richardson * Traffic manager packet marking - IPv4 / IPv6 ECN (IETF RFC 3168) 204999a2dd95SBruce Richardson * 205099a2dd95SBruce Richardson * IETF RFCs 2474 and 3168 reorganize the IPv4 Type of Service (TOS) field 205199a2dd95SBruce Richardson * (8 bits) and the IPv6 Traffic Class (TC) field (8 bits) into Differentiated 205299a2dd95SBruce Richardson * Services Codepoint (DSCP) field (6 bits) and Explicit Congestion 205399a2dd95SBruce Richardson * Notification (ECN) field (2 bits). The DSCP field is typically used to 205499a2dd95SBruce Richardson * encode the traffic class and/or drop priority (RFC 2597), while the ECN 205599a2dd95SBruce Richardson * field is used by RFC 3168 to implement a congestion notification mechanism 205699a2dd95SBruce Richardson * to be leveraged by transport layer protocols such as TCP and SCTP that have 205799a2dd95SBruce Richardson * congestion control mechanisms. 205899a2dd95SBruce Richardson * 205999a2dd95SBruce Richardson * When congestion is experienced, as alternative to dropping the packet, 206099a2dd95SBruce Richardson * routers can change the ECN field of input packets from 2'b01 or 2'b10 206199a2dd95SBruce Richardson * (values indicating that source endpoint is ECN-capable) to 2'b11 (meaning 206299a2dd95SBruce Richardson * that congestion is experienced). The destination endpoint can use the 206399a2dd95SBruce Richardson * ECN-Echo (ECE) TCP flag to relay the congestion indication back to the 206499a2dd95SBruce Richardson * source endpoint, which acknowledges it back to the destination endpoint with 206599a2dd95SBruce Richardson * the Congestion Window Reduced (CWR) TCP flag. 206699a2dd95SBruce Richardson * 206799a2dd95SBruce Richardson * All IPv4/IPv6 packets of a given color with ECN set to 2’b01 or 2’b10 206899a2dd95SBruce Richardson * carrying TCP or SCTP have their ECN set to 2’b11 if the marking feature is 206999a2dd95SBruce Richardson * enabled for the current color, otherwise the ECN field is left as is. 207099a2dd95SBruce Richardson * 207199a2dd95SBruce Richardson * @param[in] port_id 207299a2dd95SBruce Richardson * The port identifier of the Ethernet device. 207399a2dd95SBruce Richardson * @param[in] mark_green 207499a2dd95SBruce Richardson * Set to non-zero value to enable marking of green packets and to zero to 207599a2dd95SBruce Richardson * disable it. 207699a2dd95SBruce Richardson * @param[in] mark_yellow 207799a2dd95SBruce Richardson * Set to non-zero value to enable marking of yellow packets and to zero to 207899a2dd95SBruce Richardson * disable it. 207999a2dd95SBruce Richardson * @param[in] mark_red 208099a2dd95SBruce Richardson * Set to non-zero value to enable marking of red packets and to zero to 208199a2dd95SBruce Richardson * disable it. 208299a2dd95SBruce Richardson * @param[out] error 208399a2dd95SBruce Richardson * Error details. Filled in only on error, when not NULL. 208499a2dd95SBruce Richardson * @return 208599a2dd95SBruce Richardson * 0 on success, non-zero error code otherwise. 208699a2dd95SBruce Richardson * 208799a2dd95SBruce Richardson * @see struct rte_tm_capabilities::mark_ip_ecn_tcp_supported 208899a2dd95SBruce Richardson * @see struct rte_tm_capabilities::mark_ip_ecn_sctp_supported 208999a2dd95SBruce Richardson */ 209099a2dd95SBruce Richardson __rte_experimental 209199a2dd95SBruce Richardson int 209299a2dd95SBruce Richardson rte_tm_mark_ip_ecn(uint16_t port_id, 209399a2dd95SBruce Richardson int mark_green, 209499a2dd95SBruce Richardson int mark_yellow, 209599a2dd95SBruce Richardson int mark_red, 209699a2dd95SBruce Richardson struct rte_tm_error *error); 209799a2dd95SBruce Richardson 209899a2dd95SBruce Richardson /** 209999a2dd95SBruce Richardson * Traffic manager packet marking - IPv4 / IPv6 DSCP (IETF RFC 2597) 210099a2dd95SBruce Richardson * 210199a2dd95SBruce Richardson * IETF RFC 2597 maps the traffic class and the drop priority to the IPv4/IPv6 210299a2dd95SBruce Richardson * Differentiated Services Codepoint (DSCP) field (6 bits). Here are the DSCP 210399a2dd95SBruce Richardson * values proposed by this RFC: 210499a2dd95SBruce Richardson * 210599a2dd95SBruce Richardson * <pre> Class 1 Class 2 Class 3 Class 4 </pre> 210699a2dd95SBruce Richardson * <pre> +----------+----------+----------+----------+</pre> 210799a2dd95SBruce Richardson * <pre>Low Drop Prec | 001010 | 010010 | 011010 | 100010 |</pre> 210899a2dd95SBruce Richardson * <pre>Medium Drop Prec | 001100 | 010100 | 011100 | 100100 |</pre> 210999a2dd95SBruce Richardson * <pre>High Drop Prec | 001110 | 010110 | 011110 | 100110 |</pre> 211099a2dd95SBruce Richardson * <pre> +----------+----------+----------+----------+</pre> 211199a2dd95SBruce Richardson * 211299a2dd95SBruce Richardson * There are 4 traffic classes (classes 1 .. 4) encoded by DSCP bits 1 and 2, 211399a2dd95SBruce Richardson * as well as 3 drop priorities (low/medium/high) encoded by DSCP bits 3 and 4. 211499a2dd95SBruce Richardson * 211599a2dd95SBruce Richardson * All IPv4/IPv6 packets have their color marked into DSCP bits 3 and 4 as 211699a2dd95SBruce Richardson * follows: green mapped to Low Drop Precedence (2’b01), yellow to Medium 211799a2dd95SBruce Richardson * (2’b10) and red to High (2’b11). Marking needs to be explicitly enabled 211899a2dd95SBruce Richardson * for each color; when not enabled for a given color, the DSCP field of all 211999a2dd95SBruce Richardson * packets with that color is left as is. 212099a2dd95SBruce Richardson * 212199a2dd95SBruce Richardson * @param[in] port_id 212299a2dd95SBruce Richardson * The port identifier of the Ethernet device. 212399a2dd95SBruce Richardson * @param[in] mark_green 212499a2dd95SBruce Richardson * Set to non-zero value to enable marking of green packets and to zero to 212599a2dd95SBruce Richardson * disable it. 212699a2dd95SBruce Richardson * @param[in] mark_yellow 212799a2dd95SBruce Richardson * Set to non-zero value to enable marking of yellow packets and to zero to 212899a2dd95SBruce Richardson * disable it. 212999a2dd95SBruce Richardson * @param[in] mark_red 213099a2dd95SBruce Richardson * Set to non-zero value to enable marking of red packets and to zero to 213199a2dd95SBruce Richardson * disable it. 213299a2dd95SBruce Richardson * @param[out] error 213399a2dd95SBruce Richardson * Error details. Filled in only on error, when not NULL. 213499a2dd95SBruce Richardson * @return 213599a2dd95SBruce Richardson * 0 on success, non-zero error code otherwise. 213699a2dd95SBruce Richardson * 213799a2dd95SBruce Richardson * @see struct rte_tm_capabilities::mark_ip_dscp_supported 213899a2dd95SBruce Richardson */ 213999a2dd95SBruce Richardson __rte_experimental 214099a2dd95SBruce Richardson int 214199a2dd95SBruce Richardson rte_tm_mark_ip_dscp(uint16_t port_id, 214299a2dd95SBruce Richardson int mark_green, 214399a2dd95SBruce Richardson int mark_yellow, 214499a2dd95SBruce Richardson int mark_red, 214599a2dd95SBruce Richardson struct rte_tm_error *error); 214699a2dd95SBruce Richardson 214799a2dd95SBruce Richardson #ifdef __cplusplus 214899a2dd95SBruce Richardson } 214999a2dd95SBruce Richardson #endif 215099a2dd95SBruce Richardson 215199a2dd95SBruce Richardson #endif /* __INCLUDE_RTE_TM_H__ */ 2152