14418919fSjohnjiang /* SPDX-License-Identifier: BSD-3-Clause 2d30ea906Sjfb8856606 * Copyright(c) 2017 Intel Corporation. 3d30ea906Sjfb8856606 * Copyright(c) 2017 Cavium. 4d30ea906Sjfb8856606 * Copyright(c) 2017 NXP. 5d30ea906Sjfb8856606 */ 6d30ea906Sjfb8856606 7d30ea906Sjfb8856606 #ifndef __INCLUDE_RTE_TM_H__ 8d30ea906Sjfb8856606 #define __INCLUDE_RTE_TM_H__ 9d30ea906Sjfb8856606 10d30ea906Sjfb8856606 /** 11d30ea906Sjfb8856606 * @file 12d30ea906Sjfb8856606 * RTE Generic Traffic Manager API 13d30ea906Sjfb8856606 * 14d30ea906Sjfb8856606 * This interface provides the ability to configure the traffic manager in a 15d30ea906Sjfb8856606 * generic way. It includes features such as: hierarchical scheduling, 16d30ea906Sjfb8856606 * traffic shaping, congestion management, packet marking, etc. 17d30ea906Sjfb8856606 * 18d30ea906Sjfb8856606 * @warning 19*2d9fd380Sjfb8856606 * @b EXPERIMENTAL: 20*2d9fd380Sjfb8856606 * All functions in this file may be changed or removed without prior notice. 21d30ea906Sjfb8856606 */ 22d30ea906Sjfb8856606 23d30ea906Sjfb8856606 #include <stdint.h> 24d30ea906Sjfb8856606 25d30ea906Sjfb8856606 #include <rte_common.h> 264418919fSjohnjiang #include <rte_meter.h> 27d30ea906Sjfb8856606 28d30ea906Sjfb8856606 #ifdef __cplusplus 29d30ea906Sjfb8856606 extern "C" { 30d30ea906Sjfb8856606 #endif 31d30ea906Sjfb8856606 32d30ea906Sjfb8856606 /** 33d30ea906Sjfb8856606 * Ethernet framing overhead. 34d30ea906Sjfb8856606 * 35d30ea906Sjfb8856606 * Overhead fields per Ethernet frame: 36d30ea906Sjfb8856606 * 1. Preamble: 7 bytes; 37d30ea906Sjfb8856606 * 2. Start of Frame Delimiter (SFD): 1 byte; 38d30ea906Sjfb8856606 * 3. Inter-Frame Gap (IFG): 12 bytes. 39d30ea906Sjfb8856606 * 40d30ea906Sjfb8856606 * One of the typical values for the *pkt_length_adjust* field of the shaper 41d30ea906Sjfb8856606 * profile. 42d30ea906Sjfb8856606 * 43d30ea906Sjfb8856606 * @see struct rte_tm_shaper_params 44d30ea906Sjfb8856606 */ 45d30ea906Sjfb8856606 #define RTE_TM_ETH_FRAMING_OVERHEAD 20 46d30ea906Sjfb8856606 47d30ea906Sjfb8856606 /** 48d30ea906Sjfb8856606 * Ethernet framing overhead including the Frame Check Sequence (FCS) field. 49d30ea906Sjfb8856606 * Useful when FCS is generated and added at the end of the Ethernet frame on 50d30ea906Sjfb8856606 * TX side without any SW intervention. 51d30ea906Sjfb8856606 * 52d30ea906Sjfb8856606 * One of the typical values for the pkt_length_adjust field of the shaper 53d30ea906Sjfb8856606 * profile. 54d30ea906Sjfb8856606 * 55d30ea906Sjfb8856606 * @see struct rte_tm_shaper_params 56d30ea906Sjfb8856606 */ 57d30ea906Sjfb8856606 #define RTE_TM_ETH_FRAMING_OVERHEAD_FCS 24 58d30ea906Sjfb8856606 59d30ea906Sjfb8856606 /** 60d30ea906Sjfb8856606 * Invalid WRED profile ID. 61d30ea906Sjfb8856606 * 62d30ea906Sjfb8856606 * @see struct rte_tm_node_params 63d30ea906Sjfb8856606 * @see rte_tm_node_add() 64d30ea906Sjfb8856606 * @see rte_tm_node_wred_context_update() 65d30ea906Sjfb8856606 */ 66d30ea906Sjfb8856606 #define RTE_TM_WRED_PROFILE_ID_NONE UINT32_MAX 67d30ea906Sjfb8856606 68d30ea906Sjfb8856606 /** 69d30ea906Sjfb8856606 *Invalid shaper profile ID. 70d30ea906Sjfb8856606 * 71d30ea906Sjfb8856606 * @see struct rte_tm_node_params 72d30ea906Sjfb8856606 * @see rte_tm_node_add() 73d30ea906Sjfb8856606 * @see rte_tm_node_shaper_update() 74d30ea906Sjfb8856606 */ 75d30ea906Sjfb8856606 #define RTE_TM_SHAPER_PROFILE_ID_NONE UINT32_MAX 76d30ea906Sjfb8856606 77d30ea906Sjfb8856606 /** 78d30ea906Sjfb8856606 * Node ID for the parent of the root node. 79d30ea906Sjfb8856606 * 80d30ea906Sjfb8856606 * @see rte_tm_node_add() 81d30ea906Sjfb8856606 */ 82d30ea906Sjfb8856606 #define RTE_TM_NODE_ID_NULL UINT32_MAX 83d30ea906Sjfb8856606 84d30ea906Sjfb8856606 /** 85d30ea906Sjfb8856606 * Node level ID used to disable level ID checking. 86d30ea906Sjfb8856606 * 87d30ea906Sjfb8856606 * @see rte_tm_node_add() 88d30ea906Sjfb8856606 */ 89d30ea906Sjfb8856606 #define RTE_TM_NODE_LEVEL_ID_ANY UINT32_MAX 90d30ea906Sjfb8856606 91d30ea906Sjfb8856606 /** 92d30ea906Sjfb8856606 * Node statistics counter type 93d30ea906Sjfb8856606 */ 94d30ea906Sjfb8856606 enum rte_tm_stats_type { 95d30ea906Sjfb8856606 /** Number of packets scheduled from current node. */ 96d30ea906Sjfb8856606 RTE_TM_STATS_N_PKTS = 1 << 0, 97d30ea906Sjfb8856606 98d30ea906Sjfb8856606 /** Number of bytes scheduled from current node. */ 99d30ea906Sjfb8856606 RTE_TM_STATS_N_BYTES = 1 << 1, 100d30ea906Sjfb8856606 101d30ea906Sjfb8856606 /** Number of green packets dropped by current leaf node. */ 102d30ea906Sjfb8856606 RTE_TM_STATS_N_PKTS_GREEN_DROPPED = 1 << 2, 103d30ea906Sjfb8856606 104d30ea906Sjfb8856606 /** Number of yellow packets dropped by current leaf node. */ 105d30ea906Sjfb8856606 RTE_TM_STATS_N_PKTS_YELLOW_DROPPED = 1 << 3, 106d30ea906Sjfb8856606 107d30ea906Sjfb8856606 /** Number of red packets dropped by current leaf node. */ 108d30ea906Sjfb8856606 RTE_TM_STATS_N_PKTS_RED_DROPPED = 1 << 4, 109d30ea906Sjfb8856606 110d30ea906Sjfb8856606 /** Number of green bytes dropped by current leaf node. */ 111d30ea906Sjfb8856606 RTE_TM_STATS_N_BYTES_GREEN_DROPPED = 1 << 5, 112d30ea906Sjfb8856606 113d30ea906Sjfb8856606 /** Number of yellow bytes dropped by current leaf node. */ 114d30ea906Sjfb8856606 RTE_TM_STATS_N_BYTES_YELLOW_DROPPED = 1 << 6, 115d30ea906Sjfb8856606 116d30ea906Sjfb8856606 /** Number of red bytes dropped by current leaf node. */ 117d30ea906Sjfb8856606 RTE_TM_STATS_N_BYTES_RED_DROPPED = 1 << 7, 118d30ea906Sjfb8856606 119d30ea906Sjfb8856606 /** Number of packets currently waiting in the packet queue of current 120d30ea906Sjfb8856606 * leaf node. 121d30ea906Sjfb8856606 */ 122d30ea906Sjfb8856606 RTE_TM_STATS_N_PKTS_QUEUED = 1 << 8, 123d30ea906Sjfb8856606 124d30ea906Sjfb8856606 /** Number of bytes currently waiting in the packet queue of current 125d30ea906Sjfb8856606 * leaf node. 126d30ea906Sjfb8856606 */ 127d30ea906Sjfb8856606 RTE_TM_STATS_N_BYTES_QUEUED = 1 << 9, 128d30ea906Sjfb8856606 }; 129d30ea906Sjfb8856606 130d30ea906Sjfb8856606 /** 131d30ea906Sjfb8856606 * Node statistics counters 132d30ea906Sjfb8856606 */ 133d30ea906Sjfb8856606 struct rte_tm_node_stats { 134d30ea906Sjfb8856606 /** Number of packets scheduled from current node. */ 135d30ea906Sjfb8856606 uint64_t n_pkts; 136d30ea906Sjfb8856606 137d30ea906Sjfb8856606 /** Number of bytes scheduled from current node. */ 138d30ea906Sjfb8856606 uint64_t n_bytes; 139d30ea906Sjfb8856606 140d30ea906Sjfb8856606 /** Statistics counters for leaf nodes only. */ 141d30ea906Sjfb8856606 struct { 142d30ea906Sjfb8856606 /** Number of packets dropped by current leaf node per each 143d30ea906Sjfb8856606 * color. 144d30ea906Sjfb8856606 */ 1454418919fSjohnjiang uint64_t n_pkts_dropped[RTE_COLORS]; 146d30ea906Sjfb8856606 147d30ea906Sjfb8856606 /** Number of bytes dropped by current leaf node per each 148d30ea906Sjfb8856606 * color. 149d30ea906Sjfb8856606 */ 1504418919fSjohnjiang uint64_t n_bytes_dropped[RTE_COLORS]; 151d30ea906Sjfb8856606 152d30ea906Sjfb8856606 /** Number of packets currently waiting in the packet queue of 153d30ea906Sjfb8856606 * current leaf node. 154d30ea906Sjfb8856606 */ 155d30ea906Sjfb8856606 uint64_t n_pkts_queued; 156d30ea906Sjfb8856606 157d30ea906Sjfb8856606 /** Number of bytes currently waiting in the packet queue of 158d30ea906Sjfb8856606 * current leaf node. 159d30ea906Sjfb8856606 */ 160d30ea906Sjfb8856606 uint64_t n_bytes_queued; 161d30ea906Sjfb8856606 } leaf; 162d30ea906Sjfb8856606 }; 163d30ea906Sjfb8856606 164d30ea906Sjfb8856606 /** 165d30ea906Sjfb8856606 * Traffic manager dynamic updates 166d30ea906Sjfb8856606 */ 167d30ea906Sjfb8856606 enum rte_tm_dynamic_update_type { 168d30ea906Sjfb8856606 /** Dynamic parent node update. The new parent node is located on same 169d30ea906Sjfb8856606 * hierarchy level as the former parent node. Consequently, the node 170d30ea906Sjfb8856606 * whose parent is changed preserves its hierarchy level. 171d30ea906Sjfb8856606 */ 172d30ea906Sjfb8856606 RTE_TM_UPDATE_NODE_PARENT_KEEP_LEVEL = 1 << 0, 173d30ea906Sjfb8856606 174d30ea906Sjfb8856606 /** Dynamic parent node update. The new parent node is located on 175d30ea906Sjfb8856606 * different hierarchy level than the former parent node. Consequently, 176d30ea906Sjfb8856606 * the node whose parent is changed also changes its hierarchy level. 177d30ea906Sjfb8856606 */ 178d30ea906Sjfb8856606 RTE_TM_UPDATE_NODE_PARENT_CHANGE_LEVEL = 1 << 1, 179d30ea906Sjfb8856606 180d30ea906Sjfb8856606 /** Dynamic node add/delete. */ 181d30ea906Sjfb8856606 RTE_TM_UPDATE_NODE_ADD_DELETE = 1 << 2, 182d30ea906Sjfb8856606 183d30ea906Sjfb8856606 /** Suspend/resume nodes. */ 184d30ea906Sjfb8856606 RTE_TM_UPDATE_NODE_SUSPEND_RESUME = 1 << 3, 185d30ea906Sjfb8856606 186d30ea906Sjfb8856606 /** Dynamic switch between byte-based and packet-based WFQ weights. */ 187d30ea906Sjfb8856606 RTE_TM_UPDATE_NODE_WFQ_WEIGHT_MODE = 1 << 4, 188d30ea906Sjfb8856606 189d30ea906Sjfb8856606 /** Dynamic update on number of SP priorities. */ 190d30ea906Sjfb8856606 RTE_TM_UPDATE_NODE_N_SP_PRIORITIES = 1 << 5, 191d30ea906Sjfb8856606 192d30ea906Sjfb8856606 /** Dynamic update of congestion management mode for leaf nodes. */ 193d30ea906Sjfb8856606 RTE_TM_UPDATE_NODE_CMAN = 1 << 6, 194d30ea906Sjfb8856606 195d30ea906Sjfb8856606 /** Dynamic update of the set of enabled stats counter types. */ 196d30ea906Sjfb8856606 RTE_TM_UPDATE_NODE_STATS = 1 << 7, 197d30ea906Sjfb8856606 }; 198d30ea906Sjfb8856606 199d30ea906Sjfb8856606 /** 200d30ea906Sjfb8856606 * Traffic manager capabilities 201d30ea906Sjfb8856606 */ 202d30ea906Sjfb8856606 struct rte_tm_capabilities { 203d30ea906Sjfb8856606 /** Maximum number of nodes. */ 204d30ea906Sjfb8856606 uint32_t n_nodes_max; 205d30ea906Sjfb8856606 206d30ea906Sjfb8856606 /** Maximum number of levels (i.e. number of nodes connecting the root 207d30ea906Sjfb8856606 * node with any leaf node, including the root and the leaf). 208d30ea906Sjfb8856606 */ 209d30ea906Sjfb8856606 uint32_t n_levels_max; 210d30ea906Sjfb8856606 211d30ea906Sjfb8856606 /** When non-zero, this flag indicates that all the non-leaf nodes 212d30ea906Sjfb8856606 * (with the exception of the root node) have identical capability set. 213d30ea906Sjfb8856606 */ 214d30ea906Sjfb8856606 int non_leaf_nodes_identical; 215d30ea906Sjfb8856606 216d30ea906Sjfb8856606 /** When non-zero, this flag indicates that all the leaf nodes have 217d30ea906Sjfb8856606 * identical capability set. 218d30ea906Sjfb8856606 */ 219d30ea906Sjfb8856606 int leaf_nodes_identical; 220d30ea906Sjfb8856606 221d30ea906Sjfb8856606 /** Maximum number of shapers, either private or shared. In case the 222d30ea906Sjfb8856606 * implementation does not share any resources between private and 223d30ea906Sjfb8856606 * shared shapers, it is typically equal to the sum of 224d30ea906Sjfb8856606 * *shaper_private_n_max* and *shaper_shared_n_max*. The 225d30ea906Sjfb8856606 * value of zero indicates that traffic shaping is not supported. 226d30ea906Sjfb8856606 */ 227d30ea906Sjfb8856606 uint32_t shaper_n_max; 228d30ea906Sjfb8856606 229d30ea906Sjfb8856606 /** Maximum number of private shapers. Indicates the maximum number of 230d30ea906Sjfb8856606 * nodes that can concurrently have their private shaper enabled. The 231d30ea906Sjfb8856606 * value of zero indicates that private shapers are not supported. 232d30ea906Sjfb8856606 */ 233d30ea906Sjfb8856606 uint32_t shaper_private_n_max; 234d30ea906Sjfb8856606 235d30ea906Sjfb8856606 /** Maximum number of private shapers that support dual rate shaping. 236d30ea906Sjfb8856606 * Indicates the maximum number of nodes that can concurrently have 237d30ea906Sjfb8856606 * their private shaper enabled with dual rate support. Only valid when 238d30ea906Sjfb8856606 * private shapers are supported. The value of zero indicates that dual 239d30ea906Sjfb8856606 * rate shaping is not available for private shapers. The maximum value 240d30ea906Sjfb8856606 * is *shaper_private_n_max*. 241d30ea906Sjfb8856606 */ 242d30ea906Sjfb8856606 int shaper_private_dual_rate_n_max; 243d30ea906Sjfb8856606 244d30ea906Sjfb8856606 /** Minimum committed/peak rate (bytes per second) for any private 245d30ea906Sjfb8856606 * shaper. Valid only when private shapers are supported. 246d30ea906Sjfb8856606 */ 247d30ea906Sjfb8856606 uint64_t shaper_private_rate_min; 248d30ea906Sjfb8856606 249d30ea906Sjfb8856606 /** Maximum committed/peak rate (bytes per second) for any private 250d30ea906Sjfb8856606 * shaper. Valid only when private shapers are supported. 251d30ea906Sjfb8856606 */ 252d30ea906Sjfb8856606 uint64_t shaper_private_rate_max; 253d30ea906Sjfb8856606 254*2d9fd380Sjfb8856606 /** Shaper private packet mode supported. When non-zero, this parameter 255*2d9fd380Sjfb8856606 * indicates that there is at least one node that can be configured 256*2d9fd380Sjfb8856606 * with packet mode in its private shaper. When shaper is configured 257*2d9fd380Sjfb8856606 * in packet mode, committed/peak rate provided is interpreted 258*2d9fd380Sjfb8856606 * in packets per second. 259*2d9fd380Sjfb8856606 */ 260*2d9fd380Sjfb8856606 int shaper_private_packet_mode_supported; 261*2d9fd380Sjfb8856606 262*2d9fd380Sjfb8856606 /** Shaper private byte mode supported. When non-zero, this parameter 263*2d9fd380Sjfb8856606 * indicates that there is at least one node that can be configured 264*2d9fd380Sjfb8856606 * with byte mode in its private shaper. When shaper is configured 265*2d9fd380Sjfb8856606 * in byte mode, committed/peak rate provided is interpreted in 266*2d9fd380Sjfb8856606 * bytes per second. 267*2d9fd380Sjfb8856606 */ 268*2d9fd380Sjfb8856606 int shaper_private_byte_mode_supported; 269*2d9fd380Sjfb8856606 270*2d9fd380Sjfb8856606 271d30ea906Sjfb8856606 /** Maximum number of shared shapers. The value of zero indicates that 272d30ea906Sjfb8856606 * shared shapers are not supported. 273d30ea906Sjfb8856606 */ 274d30ea906Sjfb8856606 uint32_t shaper_shared_n_max; 275d30ea906Sjfb8856606 276d30ea906Sjfb8856606 /** Maximum number of nodes that can share the same shared shaper. 277d30ea906Sjfb8856606 * Only valid when shared shapers are supported. 278d30ea906Sjfb8856606 */ 279d30ea906Sjfb8856606 uint32_t shaper_shared_n_nodes_per_shaper_max; 280d30ea906Sjfb8856606 281d30ea906Sjfb8856606 /** Maximum number of shared shapers a node can be part of. This 282d30ea906Sjfb8856606 * parameter indicates that there is at least one node that can be 283d30ea906Sjfb8856606 * configured with this many shared shapers, which might not be true for 284d30ea906Sjfb8856606 * all the nodes. Only valid when shared shapers are supported, in which 285d30ea906Sjfb8856606 * case it ranges from 1 to *shaper_shared_n_max*. 286d30ea906Sjfb8856606 */ 287d30ea906Sjfb8856606 uint32_t shaper_shared_n_shapers_per_node_max; 288d30ea906Sjfb8856606 289d30ea906Sjfb8856606 /** Maximum number of shared shapers that can be configured with dual 290d30ea906Sjfb8856606 * rate shaping. The value of zero indicates that dual rate shaping 291d30ea906Sjfb8856606 * support is not available for shared shapers. 292d30ea906Sjfb8856606 */ 293d30ea906Sjfb8856606 uint32_t shaper_shared_dual_rate_n_max; 294d30ea906Sjfb8856606 295d30ea906Sjfb8856606 /** Minimum committed/peak rate (bytes per second) for any shared 296d30ea906Sjfb8856606 * shaper. Only valid when shared shapers are supported. 297d30ea906Sjfb8856606 */ 298d30ea906Sjfb8856606 uint64_t shaper_shared_rate_min; 299d30ea906Sjfb8856606 300d30ea906Sjfb8856606 /** Maximum committed/peak rate (bytes per second) for any shared 301d30ea906Sjfb8856606 * shaper. Only valid when shared shapers are supported. 302d30ea906Sjfb8856606 */ 303d30ea906Sjfb8856606 uint64_t shaper_shared_rate_max; 304d30ea906Sjfb8856606 305*2d9fd380Sjfb8856606 /** Shaper shared packet mode supported. When non-zero, this parameter 306*2d9fd380Sjfb8856606 * indicates a shared shaper can be configured with packet mode. 307*2d9fd380Sjfb8856606 * When shared shaper is configured in packet mode, committed/peak rate 308*2d9fd380Sjfb8856606 * provided is interpreted in packets per second. 309*2d9fd380Sjfb8856606 */ 310*2d9fd380Sjfb8856606 int shaper_shared_packet_mode_supported; 311*2d9fd380Sjfb8856606 312*2d9fd380Sjfb8856606 /** Shaper shared byte mode supported. When non-zero, this parameter 313*2d9fd380Sjfb8856606 * indicates that a shared shaper can be configured with byte mode. 314*2d9fd380Sjfb8856606 * When shared shaper is configured in byte mode, committed/peak rate 315*2d9fd380Sjfb8856606 * provided is interpreted in bytes per second. 316*2d9fd380Sjfb8856606 */ 317*2d9fd380Sjfb8856606 int shaper_shared_byte_mode_supported; 318*2d9fd380Sjfb8856606 319*2d9fd380Sjfb8856606 320d30ea906Sjfb8856606 /** Minimum value allowed for packet length adjustment for any private 321d30ea906Sjfb8856606 * or shared shaper. 322d30ea906Sjfb8856606 */ 323d30ea906Sjfb8856606 int shaper_pkt_length_adjust_min; 324d30ea906Sjfb8856606 325d30ea906Sjfb8856606 /** Maximum value allowed for packet length adjustment for any private 326d30ea906Sjfb8856606 * or shared shaper. 327d30ea906Sjfb8856606 */ 328d30ea906Sjfb8856606 int shaper_pkt_length_adjust_max; 329d30ea906Sjfb8856606 330d30ea906Sjfb8856606 /** Maximum number of children nodes. This parameter indicates that 331d30ea906Sjfb8856606 * there is at least one non-leaf node that can be configured with this 332d30ea906Sjfb8856606 * many children nodes, which might not be true for all the non-leaf 333d30ea906Sjfb8856606 * nodes. 334d30ea906Sjfb8856606 */ 335d30ea906Sjfb8856606 uint32_t sched_n_children_max; 336d30ea906Sjfb8856606 337d30ea906Sjfb8856606 /** Maximum number of supported priority levels. This parameter 338d30ea906Sjfb8856606 * indicates that there is at least one non-leaf node that can be 339d30ea906Sjfb8856606 * configured with this many priority levels for managing its children 340d30ea906Sjfb8856606 * nodes, which might not be true for all the non-leaf nodes. The value 341d30ea906Sjfb8856606 * of zero is invalid. The value of 1 indicates that only priority 0 is 342d30ea906Sjfb8856606 * supported, which essentially means that Strict Priority (SP) 343d30ea906Sjfb8856606 * algorithm is not supported. 344d30ea906Sjfb8856606 */ 345d30ea906Sjfb8856606 uint32_t sched_sp_n_priorities_max; 346d30ea906Sjfb8856606 347d30ea906Sjfb8856606 /** Maximum number of sibling nodes that can have the same priority at 348d30ea906Sjfb8856606 * any given time, i.e. maximum size of the WFQ sibling node group. This 349d30ea906Sjfb8856606 * parameter indicates there is at least one non-leaf node that meets 350d30ea906Sjfb8856606 * this condition, which might not be true for all the non-leaf nodes. 351d30ea906Sjfb8856606 * The value of zero is invalid. The value of 1 indicates that WFQ 352d30ea906Sjfb8856606 * algorithm is not supported. The maximum value is 353d30ea906Sjfb8856606 * *sched_n_children_max*. 354d30ea906Sjfb8856606 */ 355d30ea906Sjfb8856606 uint32_t sched_wfq_n_children_per_group_max; 356d30ea906Sjfb8856606 357d30ea906Sjfb8856606 /** Maximum number of priority levels that can have more than one child 358d30ea906Sjfb8856606 * node at any given time, i.e. maximum number of WFQ sibling node 359d30ea906Sjfb8856606 * groups that have two or more members. This parameter indicates there 360d30ea906Sjfb8856606 * is at least one non-leaf node that meets this condition, which might 361d30ea906Sjfb8856606 * not be true for all the non-leaf nodes. The value of zero states that 362d30ea906Sjfb8856606 * WFQ algorithm is not supported. The value of 1 indicates that 363d30ea906Sjfb8856606 * (*sched_sp_n_priorities_max* - 1) priority levels have at most one 364d30ea906Sjfb8856606 * child node, so there can be only one priority level with two or 365d30ea906Sjfb8856606 * more sibling nodes making up a WFQ group. The maximum value is: 366d30ea906Sjfb8856606 * min(floor(*sched_n_children_max* / 2), *sched_sp_n_priorities_max*). 367d30ea906Sjfb8856606 */ 368d30ea906Sjfb8856606 uint32_t sched_wfq_n_groups_max; 369d30ea906Sjfb8856606 370d30ea906Sjfb8856606 /** Maximum WFQ weight. The value of 1 indicates that all sibling nodes 371d30ea906Sjfb8856606 * with same priority have the same WFQ weight, so WFQ is reduced to FQ. 372d30ea906Sjfb8856606 */ 373d30ea906Sjfb8856606 uint32_t sched_wfq_weight_max; 374d30ea906Sjfb8856606 375*2d9fd380Sjfb8856606 /** WFQ packet mode supported. When non-zero, this parameter indicates 376*2d9fd380Sjfb8856606 * that there is at least one non-leaf node that supports packet mode 377*2d9fd380Sjfb8856606 * for WFQ among its children. WFQ weights will be applied against 378*2d9fd380Sjfb8856606 * packet count for scheduling children when a non-leaf node 379*2d9fd380Sjfb8856606 * is configured appropriately. 380*2d9fd380Sjfb8856606 */ 381*2d9fd380Sjfb8856606 int sched_wfq_packet_mode_supported; 382*2d9fd380Sjfb8856606 383*2d9fd380Sjfb8856606 /** WFQ byte mode supported. When non-zero, this parameter indicates 384*2d9fd380Sjfb8856606 * that there is at least one non-leaf node that supports byte mode 385*2d9fd380Sjfb8856606 * for WFQ among its children. WFQ weights will be applied against 386*2d9fd380Sjfb8856606 * bytes for scheduling children when a non-leaf node is configured 387*2d9fd380Sjfb8856606 * appropriately. 388*2d9fd380Sjfb8856606 */ 389*2d9fd380Sjfb8856606 int sched_wfq_byte_mode_supported; 390*2d9fd380Sjfb8856606 391d30ea906Sjfb8856606 /** WRED packet mode support. When non-zero, this parameter indicates 392d30ea906Sjfb8856606 * that there is at least one leaf node that supports the WRED packet 393d30ea906Sjfb8856606 * mode, which might not be true for all the leaf nodes. In packet 394d30ea906Sjfb8856606 * mode, the WRED thresholds specify the queue length in packets, as 395d30ea906Sjfb8856606 * opposed to bytes. 396d30ea906Sjfb8856606 */ 397d30ea906Sjfb8856606 int cman_wred_packet_mode_supported; 398d30ea906Sjfb8856606 399d30ea906Sjfb8856606 /** WRED byte mode support. When non-zero, this parameter indicates that 400d30ea906Sjfb8856606 * there is at least one leaf node that supports the WRED byte mode, 401d30ea906Sjfb8856606 * which might not be true for all the leaf nodes. In byte mode, the 402d30ea906Sjfb8856606 * WRED thresholds specify the queue length in bytes, as opposed to 403d30ea906Sjfb8856606 * packets. 404d30ea906Sjfb8856606 */ 405d30ea906Sjfb8856606 int cman_wred_byte_mode_supported; 406d30ea906Sjfb8856606 407d30ea906Sjfb8856606 /** Head drop algorithm support. When non-zero, this parameter 408d30ea906Sjfb8856606 * indicates that there is at least one leaf node that supports the head 409d30ea906Sjfb8856606 * drop algorithm, which might not be true for all the leaf nodes. 410d30ea906Sjfb8856606 */ 411d30ea906Sjfb8856606 int cman_head_drop_supported; 412d30ea906Sjfb8856606 413d30ea906Sjfb8856606 /** Maximum number of WRED contexts, either private or shared. In case 414d30ea906Sjfb8856606 * the implementation does not share any resources between private and 415d30ea906Sjfb8856606 * shared WRED contexts, it is typically equal to the sum of 416d30ea906Sjfb8856606 * *cman_wred_context_private_n_max* and 417d30ea906Sjfb8856606 * *cman_wred_context_shared_n_max*. The value of zero indicates that 418d30ea906Sjfb8856606 * WRED is not supported. 419d30ea906Sjfb8856606 */ 420d30ea906Sjfb8856606 uint32_t cman_wred_context_n_max; 421d30ea906Sjfb8856606 422d30ea906Sjfb8856606 /** Maximum number of private WRED contexts. Indicates the maximum 423d30ea906Sjfb8856606 * number of leaf nodes that can concurrently have their private WRED 424d30ea906Sjfb8856606 * context enabled. The value of zero indicates that private WRED 425d30ea906Sjfb8856606 * contexts are not supported. 426d30ea906Sjfb8856606 */ 427d30ea906Sjfb8856606 uint32_t cman_wred_context_private_n_max; 428d30ea906Sjfb8856606 429d30ea906Sjfb8856606 /** Maximum number of shared WRED contexts. The value of zero 430d30ea906Sjfb8856606 * indicates that shared WRED contexts are not supported. 431d30ea906Sjfb8856606 */ 432d30ea906Sjfb8856606 uint32_t cman_wred_context_shared_n_max; 433d30ea906Sjfb8856606 434d30ea906Sjfb8856606 /** Maximum number of leaf nodes that can share the same WRED context. 435d30ea906Sjfb8856606 * Only valid when shared WRED contexts are supported. 436d30ea906Sjfb8856606 */ 437d30ea906Sjfb8856606 uint32_t cman_wred_context_shared_n_nodes_per_context_max; 438d30ea906Sjfb8856606 439d30ea906Sjfb8856606 /** Maximum number of shared WRED contexts a leaf node can be part of. 440d30ea906Sjfb8856606 * This parameter indicates that there is at least one leaf node that 441d30ea906Sjfb8856606 * can be configured with this many shared WRED contexts, which might 442d30ea906Sjfb8856606 * not be true for all the leaf nodes. Only valid when shared WRED 443d30ea906Sjfb8856606 * contexts are supported, in which case it ranges from 1 to 444d30ea906Sjfb8856606 * *cman_wred_context_shared_n_max*. 445d30ea906Sjfb8856606 */ 446d30ea906Sjfb8856606 uint32_t cman_wred_context_shared_n_contexts_per_node_max; 447d30ea906Sjfb8856606 448d30ea906Sjfb8856606 /** Support for VLAN DEI packet marking (per color). */ 4494418919fSjohnjiang int mark_vlan_dei_supported[RTE_COLORS]; 450d30ea906Sjfb8856606 451d30ea906Sjfb8856606 /** Support for IPv4/IPv6 ECN marking of TCP packets (per color). */ 4524418919fSjohnjiang int mark_ip_ecn_tcp_supported[RTE_COLORS]; 453d30ea906Sjfb8856606 454d30ea906Sjfb8856606 /** Support for IPv4/IPv6 ECN marking of SCTP packets (per color). */ 4554418919fSjohnjiang int mark_ip_ecn_sctp_supported[RTE_COLORS]; 456d30ea906Sjfb8856606 457d30ea906Sjfb8856606 /** Support for IPv4/IPv6 DSCP packet marking (per color). */ 4584418919fSjohnjiang int mark_ip_dscp_supported[RTE_COLORS]; 459d30ea906Sjfb8856606 460d30ea906Sjfb8856606 /** Set of supported dynamic update operations. 461d30ea906Sjfb8856606 * @see enum rte_tm_dynamic_update_type 462d30ea906Sjfb8856606 */ 463d30ea906Sjfb8856606 uint64_t dynamic_update_mask; 464d30ea906Sjfb8856606 465d30ea906Sjfb8856606 /** Set of supported statistics counter types. 466d30ea906Sjfb8856606 * @see enum rte_tm_stats_type 467d30ea906Sjfb8856606 */ 468d30ea906Sjfb8856606 uint64_t stats_mask; 469d30ea906Sjfb8856606 }; 470d30ea906Sjfb8856606 471d30ea906Sjfb8856606 /** 472d30ea906Sjfb8856606 * Traffic manager level capabilities 473d30ea906Sjfb8856606 */ 474d30ea906Sjfb8856606 struct rte_tm_level_capabilities { 475d30ea906Sjfb8856606 /** Maximum number of nodes for the current hierarchy level. */ 476d30ea906Sjfb8856606 uint32_t n_nodes_max; 477d30ea906Sjfb8856606 478d30ea906Sjfb8856606 /** Maximum number of non-leaf nodes for the current hierarchy level. 479d30ea906Sjfb8856606 * The value of 0 indicates that current level only supports leaf 480d30ea906Sjfb8856606 * nodes. The maximum value is *n_nodes_max*. 481d30ea906Sjfb8856606 */ 482d30ea906Sjfb8856606 uint32_t n_nodes_nonleaf_max; 483d30ea906Sjfb8856606 484d30ea906Sjfb8856606 /** Maximum number of leaf nodes for the current hierarchy level. The 485d30ea906Sjfb8856606 * value of 0 indicates that current level only supports non-leaf 486d30ea906Sjfb8856606 * nodes. The maximum value is *n_nodes_max*. 487d30ea906Sjfb8856606 */ 488d30ea906Sjfb8856606 uint32_t n_nodes_leaf_max; 489d30ea906Sjfb8856606 490d30ea906Sjfb8856606 /** When non-zero, this flag indicates that all the non-leaf nodes on 491d30ea906Sjfb8856606 * this level have identical capability set. Valid only when 492d30ea906Sjfb8856606 * *n_nodes_nonleaf_max* is non-zero. 493d30ea906Sjfb8856606 */ 494d30ea906Sjfb8856606 int non_leaf_nodes_identical; 495d30ea906Sjfb8856606 496d30ea906Sjfb8856606 /** When non-zero, this flag indicates that all the leaf nodes on this 497d30ea906Sjfb8856606 * level have identical capability set. Valid only when 498d30ea906Sjfb8856606 * *n_nodes_leaf_max* is non-zero. 499d30ea906Sjfb8856606 */ 500d30ea906Sjfb8856606 int leaf_nodes_identical; 501d30ea906Sjfb8856606 502d30ea906Sjfb8856606 RTE_STD_C11 503d30ea906Sjfb8856606 union { 504d30ea906Sjfb8856606 /** Items valid only for the non-leaf nodes on this level. */ 505d30ea906Sjfb8856606 struct { 506d30ea906Sjfb8856606 /** Private shaper support. When non-zero, it indicates 507d30ea906Sjfb8856606 * there is at least one non-leaf node on this level 508d30ea906Sjfb8856606 * with private shaper support, which may not be the 509d30ea906Sjfb8856606 * case for all the non-leaf nodes on this level. 510d30ea906Sjfb8856606 */ 511d30ea906Sjfb8856606 int shaper_private_supported; 512d30ea906Sjfb8856606 513d30ea906Sjfb8856606 /** Dual rate support for private shaper. Valid only 514d30ea906Sjfb8856606 * when private shaper is supported for the non-leaf 515d30ea906Sjfb8856606 * nodes on the current level. When non-zero, it 516d30ea906Sjfb8856606 * indicates there is at least one non-leaf node on this 517d30ea906Sjfb8856606 * level with dual rate private shaper support, which 518d30ea906Sjfb8856606 * may not be the case for all the non-leaf nodes on 519d30ea906Sjfb8856606 * this level. 520d30ea906Sjfb8856606 */ 521d30ea906Sjfb8856606 int shaper_private_dual_rate_supported; 522d30ea906Sjfb8856606 523d30ea906Sjfb8856606 /** Minimum committed/peak rate (bytes per second) for 524d30ea906Sjfb8856606 * private shapers of the non-leaf nodes of this level. 525d30ea906Sjfb8856606 * Valid only when private shaper is supported on this 526d30ea906Sjfb8856606 * level. 527d30ea906Sjfb8856606 */ 528d30ea906Sjfb8856606 uint64_t shaper_private_rate_min; 529d30ea906Sjfb8856606 530d30ea906Sjfb8856606 /** Maximum committed/peak rate (bytes per second) for 531d30ea906Sjfb8856606 * private shapers of the non-leaf nodes on this level. 532d30ea906Sjfb8856606 * Valid only when private shaper is supported on this 533d30ea906Sjfb8856606 * level. 534d30ea906Sjfb8856606 */ 535d30ea906Sjfb8856606 uint64_t shaper_private_rate_max; 536d30ea906Sjfb8856606 537*2d9fd380Sjfb8856606 /** Shaper private packet mode supported. When non-zero, 538*2d9fd380Sjfb8856606 * this parameter indicates there is at least one 539*2d9fd380Sjfb8856606 * non-leaf node at this level that can be configured 540*2d9fd380Sjfb8856606 * with packet mode in its private shaper. When private 541*2d9fd380Sjfb8856606 * shaper is configured in packet mode, committed/peak 542*2d9fd380Sjfb8856606 * rate provided is interpreted in packets per second. 543*2d9fd380Sjfb8856606 */ 544*2d9fd380Sjfb8856606 int shaper_private_packet_mode_supported; 545*2d9fd380Sjfb8856606 546*2d9fd380Sjfb8856606 /** Shaper private byte mode supported. When non-zero, 547*2d9fd380Sjfb8856606 * this parameter indicates there is at least one 548*2d9fd380Sjfb8856606 * non-leaf node at this level that can be configured 549*2d9fd380Sjfb8856606 * with byte mode in its private shaper. When private 550*2d9fd380Sjfb8856606 * shaper is configured in byte mode, committed/peak 551*2d9fd380Sjfb8856606 * rate provided is interpreted in bytes per second. 552*2d9fd380Sjfb8856606 */ 553*2d9fd380Sjfb8856606 int shaper_private_byte_mode_supported; 554*2d9fd380Sjfb8856606 555d30ea906Sjfb8856606 /** Maximum number of shared shapers that any non-leaf 556d30ea906Sjfb8856606 * node on this level can be part of. The value of zero 557d30ea906Sjfb8856606 * indicates that shared shapers are not supported by 558d30ea906Sjfb8856606 * the non-leaf nodes on this level. When non-zero, it 559d30ea906Sjfb8856606 * indicates there is at least one non-leaf node on this 560d30ea906Sjfb8856606 * level that meets this condition, which may not be the 561d30ea906Sjfb8856606 * case for all the non-leaf nodes on this level. 562d30ea906Sjfb8856606 */ 563d30ea906Sjfb8856606 uint32_t shaper_shared_n_max; 564d30ea906Sjfb8856606 565*2d9fd380Sjfb8856606 /** Shaper shared packet mode supported. When non-zero, 566*2d9fd380Sjfb8856606 * this parameter indicates that there is at least one 567*2d9fd380Sjfb8856606 * non-leaf node on this level that can be part of 568*2d9fd380Sjfb8856606 * shared shapers which work in packet mode. 569*2d9fd380Sjfb8856606 */ 570*2d9fd380Sjfb8856606 int shaper_shared_packet_mode_supported; 571*2d9fd380Sjfb8856606 572*2d9fd380Sjfb8856606 /** Shaper shared byte mode supported. When non-zero, 573*2d9fd380Sjfb8856606 * this parameter indicates that there is at least one 574*2d9fd380Sjfb8856606 * non-leaf node on this level that can be part of 575*2d9fd380Sjfb8856606 * shared shapers which work in byte mode. 576*2d9fd380Sjfb8856606 */ 577*2d9fd380Sjfb8856606 int shaper_shared_byte_mode_supported; 578*2d9fd380Sjfb8856606 579d30ea906Sjfb8856606 /** Maximum number of children nodes. This parameter 580d30ea906Sjfb8856606 * indicates that there is at least one non-leaf node on 581d30ea906Sjfb8856606 * this level that can be configured with this many 582d30ea906Sjfb8856606 * children nodes, which might not be true for all the 583d30ea906Sjfb8856606 * non-leaf nodes on this level. 584d30ea906Sjfb8856606 */ 585d30ea906Sjfb8856606 uint32_t sched_n_children_max; 586d30ea906Sjfb8856606 587d30ea906Sjfb8856606 /** Maximum number of supported priority levels. This 588d30ea906Sjfb8856606 * parameter indicates that there is at least one 589d30ea906Sjfb8856606 * non-leaf node on this level that can be configured 590d30ea906Sjfb8856606 * with this many priority levels for managing its 591d30ea906Sjfb8856606 * children nodes, which might not be true for all the 592d30ea906Sjfb8856606 * non-leaf nodes on this level. The value of zero is 593d30ea906Sjfb8856606 * invalid. The value of 1 indicates that only priority 594d30ea906Sjfb8856606 * 0 is supported, which essentially means that Strict 595d30ea906Sjfb8856606 * Priority (SP) algorithm is not supported on this 596d30ea906Sjfb8856606 * level. 597d30ea906Sjfb8856606 */ 598d30ea906Sjfb8856606 uint32_t sched_sp_n_priorities_max; 599d30ea906Sjfb8856606 600d30ea906Sjfb8856606 /** Maximum number of sibling nodes that can have the 601d30ea906Sjfb8856606 * same priority at any given time, i.e. maximum size of 602d30ea906Sjfb8856606 * the WFQ sibling node group. This parameter indicates 603d30ea906Sjfb8856606 * there is at least one non-leaf node on this level 604d30ea906Sjfb8856606 * that meets this condition, which may not be true for 605d30ea906Sjfb8856606 * all the non-leaf nodes on this level. The value of 606d30ea906Sjfb8856606 * zero is invalid. The value of 1 indicates that WFQ 607d30ea906Sjfb8856606 * algorithm is not supported on this level. The maximum 608d30ea906Sjfb8856606 * value is *sched_n_children_max*. 609d30ea906Sjfb8856606 */ 610d30ea906Sjfb8856606 uint32_t sched_wfq_n_children_per_group_max; 611d30ea906Sjfb8856606 612d30ea906Sjfb8856606 /** Maximum number of priority levels that can have 613d30ea906Sjfb8856606 * more than one child node at any given time, i.e. 614d30ea906Sjfb8856606 * maximum number of WFQ sibling node groups that 615d30ea906Sjfb8856606 * have two or more members. This parameter indicates 616d30ea906Sjfb8856606 * there is at least one non-leaf node on this level 617d30ea906Sjfb8856606 * that meets this condition, which might not be true 618d30ea906Sjfb8856606 * for all the non-leaf nodes. The value of zero states 619d30ea906Sjfb8856606 * that WFQ algorithm is not supported on this level. 620d30ea906Sjfb8856606 * The value of 1 indicates that 621d30ea906Sjfb8856606 * (*sched_sp_n_priorities_max* - 1) priority levels on 622d30ea906Sjfb8856606 * this level have at most one child node, so there can 623d30ea906Sjfb8856606 * be only one priority level with two or more sibling 624d30ea906Sjfb8856606 * nodes making up a WFQ group on this level. The 625d30ea906Sjfb8856606 * maximum value is: 626d30ea906Sjfb8856606 * min(floor(*sched_n_children_max* / 2), 627d30ea906Sjfb8856606 * *sched_sp_n_priorities_max*). 628d30ea906Sjfb8856606 */ 629d30ea906Sjfb8856606 uint32_t sched_wfq_n_groups_max; 630d30ea906Sjfb8856606 631d30ea906Sjfb8856606 /** Maximum WFQ weight. The value of 1 indicates that 632d30ea906Sjfb8856606 * all sibling nodes on this level with same priority 633d30ea906Sjfb8856606 * have the same WFQ weight, so on this level WFQ is 634d30ea906Sjfb8856606 * reduced to FQ. 635d30ea906Sjfb8856606 */ 636d30ea906Sjfb8856606 uint32_t sched_wfq_weight_max; 637d30ea906Sjfb8856606 638*2d9fd380Sjfb8856606 /** WFQ packet mode supported. When non-zero, this 639*2d9fd380Sjfb8856606 * parameter indicates that there is at least one 640*2d9fd380Sjfb8856606 * non-leaf node at this level that supports packet 641*2d9fd380Sjfb8856606 * mode for WFQ among its children. WFQ weights will 642*2d9fd380Sjfb8856606 * be applied against packet count for scheduling 643*2d9fd380Sjfb8856606 * children when a non-leaf node is configured 644*2d9fd380Sjfb8856606 * appropriately. 645*2d9fd380Sjfb8856606 */ 646*2d9fd380Sjfb8856606 int sched_wfq_packet_mode_supported; 647*2d9fd380Sjfb8856606 648*2d9fd380Sjfb8856606 /** WFQ byte mode supported. When non-zero, this 649*2d9fd380Sjfb8856606 * parameter indicates that there is at least one 650*2d9fd380Sjfb8856606 * non-leaf node at this level that supports byte 651*2d9fd380Sjfb8856606 * mode for WFQ among its children. WFQ weights will 652*2d9fd380Sjfb8856606 * be applied against bytes for scheduling children 653*2d9fd380Sjfb8856606 * when a non-leaf node is configured appropriately. 654*2d9fd380Sjfb8856606 */ 655*2d9fd380Sjfb8856606 int sched_wfq_byte_mode_supported; 656*2d9fd380Sjfb8856606 657d30ea906Sjfb8856606 /** Mask of statistics counter types supported by the 658d30ea906Sjfb8856606 * non-leaf nodes on this level. Every supported 659d30ea906Sjfb8856606 * statistics counter type is supported by at least one 660d30ea906Sjfb8856606 * non-leaf node on this level, which may not be true 661d30ea906Sjfb8856606 * for all the non-leaf nodes on this level. 662d30ea906Sjfb8856606 * @see enum rte_tm_stats_type 663d30ea906Sjfb8856606 */ 664d30ea906Sjfb8856606 uint64_t stats_mask; 665d30ea906Sjfb8856606 } nonleaf; 666d30ea906Sjfb8856606 667d30ea906Sjfb8856606 /** Items valid only for the leaf nodes on this level. */ 668d30ea906Sjfb8856606 struct { 669d30ea906Sjfb8856606 /** Private shaper support. When non-zero, it indicates 670d30ea906Sjfb8856606 * there is at least one leaf node on this level with 671d30ea906Sjfb8856606 * private shaper support, which may not be the case for 672d30ea906Sjfb8856606 * all the leaf nodes on this level. 673d30ea906Sjfb8856606 */ 674d30ea906Sjfb8856606 int shaper_private_supported; 675d30ea906Sjfb8856606 676d30ea906Sjfb8856606 /** Dual rate support for private shaper. Valid only 677d30ea906Sjfb8856606 * when private shaper is supported for the leaf nodes 678d30ea906Sjfb8856606 * on this level. When non-zero, it indicates there is 679d30ea906Sjfb8856606 * at least one leaf node on this level with dual rate 680d30ea906Sjfb8856606 * private shaper support, which may not be the case for 681d30ea906Sjfb8856606 * all the leaf nodes on this level. 682d30ea906Sjfb8856606 */ 683d30ea906Sjfb8856606 int shaper_private_dual_rate_supported; 684d30ea906Sjfb8856606 685d30ea906Sjfb8856606 /** Minimum committed/peak rate (bytes per second) for 686d30ea906Sjfb8856606 * private shapers of the leaf nodes of this level. 687d30ea906Sjfb8856606 * Valid only when private shaper is supported for the 688d30ea906Sjfb8856606 * leaf nodes on this level. 689d30ea906Sjfb8856606 */ 690d30ea906Sjfb8856606 uint64_t shaper_private_rate_min; 691d30ea906Sjfb8856606 692d30ea906Sjfb8856606 /** Maximum committed/peak rate (bytes per second) for 693d30ea906Sjfb8856606 * private shapers of the leaf nodes on this level. 694d30ea906Sjfb8856606 * Valid only when private shaper is supported for the 695d30ea906Sjfb8856606 * leaf nodes on this level. 696d30ea906Sjfb8856606 */ 697d30ea906Sjfb8856606 uint64_t shaper_private_rate_max; 698d30ea906Sjfb8856606 699*2d9fd380Sjfb8856606 /** Shaper private packet mode supported. When non-zero, 700*2d9fd380Sjfb8856606 * this parameter indicates there is at least one leaf 701*2d9fd380Sjfb8856606 * node at this level that can be configured with 702*2d9fd380Sjfb8856606 * packet mode in its private shaper. When private 703*2d9fd380Sjfb8856606 * shaper is configured in packet mode, committed/peak 704*2d9fd380Sjfb8856606 * rate provided is interpreted in packets per second. 705*2d9fd380Sjfb8856606 */ 706*2d9fd380Sjfb8856606 int shaper_private_packet_mode_supported; 707*2d9fd380Sjfb8856606 708*2d9fd380Sjfb8856606 /** Shaper private byte mode supported. When non-zero, 709*2d9fd380Sjfb8856606 * this parameter indicates there is at least one leaf 710*2d9fd380Sjfb8856606 * node at this level that can be configured with 711*2d9fd380Sjfb8856606 * byte mode in its private shaper. When private shaper 712*2d9fd380Sjfb8856606 * is configured in byte mode, committed/peak rate 713*2d9fd380Sjfb8856606 * provided is interpreted in bytes per second. 714*2d9fd380Sjfb8856606 */ 715*2d9fd380Sjfb8856606 int shaper_private_byte_mode_supported; 716*2d9fd380Sjfb8856606 717d30ea906Sjfb8856606 /** Maximum number of shared shapers that any leaf node 718d30ea906Sjfb8856606 * on this level can be part of. The value of zero 719d30ea906Sjfb8856606 * indicates that shared shapers are not supported by 720d30ea906Sjfb8856606 * the leaf nodes on this level. When non-zero, it 721d30ea906Sjfb8856606 * indicates there is at least one leaf node on this 722d30ea906Sjfb8856606 * level that meets this condition, which may not be the 723d30ea906Sjfb8856606 * case for all the leaf nodes on this level. 724d30ea906Sjfb8856606 */ 725d30ea906Sjfb8856606 uint32_t shaper_shared_n_max; 726d30ea906Sjfb8856606 727*2d9fd380Sjfb8856606 /** Shaper shared packet mode supported. When non-zero, 728*2d9fd380Sjfb8856606 * this parameter indicates that there is at least one 729*2d9fd380Sjfb8856606 * leaf node on this level that can be part of 730*2d9fd380Sjfb8856606 * shared shapers which work in packet mode. 731*2d9fd380Sjfb8856606 */ 732*2d9fd380Sjfb8856606 int shaper_shared_packet_mode_supported; 733*2d9fd380Sjfb8856606 734*2d9fd380Sjfb8856606 /** Shaper shared byte mode supported. When non-zero, 735*2d9fd380Sjfb8856606 * this parameter indicates that there is at least one 736*2d9fd380Sjfb8856606 * leaf node on this level that can be part of 737*2d9fd380Sjfb8856606 * shared shapers which work in byte mode. 738*2d9fd380Sjfb8856606 */ 739*2d9fd380Sjfb8856606 int shaper_shared_byte_mode_supported; 740*2d9fd380Sjfb8856606 741d30ea906Sjfb8856606 /** WRED packet mode support. When non-zero, this 742d30ea906Sjfb8856606 * parameter indicates that there is at least one leaf 743d30ea906Sjfb8856606 * node on this level that supports the WRED packet 744d30ea906Sjfb8856606 * mode, which might not be true for all the leaf 745d30ea906Sjfb8856606 * nodes. In packet mode, the WRED thresholds specify 746d30ea906Sjfb8856606 * the queue length in packets, as opposed to bytes. 747d30ea906Sjfb8856606 */ 748d30ea906Sjfb8856606 int cman_wred_packet_mode_supported; 749d30ea906Sjfb8856606 750d30ea906Sjfb8856606 /** WRED byte mode support. When non-zero, this 751d30ea906Sjfb8856606 * parameter indicates that there is at least one leaf 752d30ea906Sjfb8856606 * node on this level that supports the WRED byte mode, 753d30ea906Sjfb8856606 * which might not be true for all the leaf nodes. In 754d30ea906Sjfb8856606 * byte mode, the WRED thresholds specify the queue 755d30ea906Sjfb8856606 * length in bytes, as opposed to packets. 756d30ea906Sjfb8856606 */ 757d30ea906Sjfb8856606 int cman_wred_byte_mode_supported; 758d30ea906Sjfb8856606 759d30ea906Sjfb8856606 /** Head drop algorithm support. When non-zero, this 760d30ea906Sjfb8856606 * parameter indicates that there is at least one leaf 761d30ea906Sjfb8856606 * node on this level that supports the head drop 762d30ea906Sjfb8856606 * algorithm, which might not be true for all the leaf 763d30ea906Sjfb8856606 * nodes on this level. 764d30ea906Sjfb8856606 */ 765d30ea906Sjfb8856606 int cman_head_drop_supported; 766d30ea906Sjfb8856606 767d30ea906Sjfb8856606 /** Private WRED context support. When non-zero, it 768d30ea906Sjfb8856606 * indicates there is at least one node on this level 769d30ea906Sjfb8856606 * with private WRED context support, which may not be 770d30ea906Sjfb8856606 * true for all the leaf nodes on this level. 771d30ea906Sjfb8856606 */ 772d30ea906Sjfb8856606 int cman_wred_context_private_supported; 773d30ea906Sjfb8856606 774d30ea906Sjfb8856606 /** Maximum number of shared WRED contexts that any 775d30ea906Sjfb8856606 * leaf node on this level can be part of. The value of 776d30ea906Sjfb8856606 * zero indicates that shared WRED contexts are not 777d30ea906Sjfb8856606 * supported by the leaf nodes on this level. When 778d30ea906Sjfb8856606 * non-zero, it indicates there is at least one leaf 779d30ea906Sjfb8856606 * node on this level that meets this condition, which 780d30ea906Sjfb8856606 * may not be the case for all the leaf nodes on this 781d30ea906Sjfb8856606 * level. 782d30ea906Sjfb8856606 */ 783d30ea906Sjfb8856606 uint32_t cman_wred_context_shared_n_max; 784d30ea906Sjfb8856606 785d30ea906Sjfb8856606 /** Mask of statistics counter types supported by the 786d30ea906Sjfb8856606 * leaf nodes on this level. Every supported statistics 787d30ea906Sjfb8856606 * counter type is supported by at least one leaf node 788d30ea906Sjfb8856606 * on this level, which may not be true for all the leaf 789d30ea906Sjfb8856606 * nodes on this level. 790d30ea906Sjfb8856606 * @see enum rte_tm_stats_type 791d30ea906Sjfb8856606 */ 792d30ea906Sjfb8856606 uint64_t stats_mask; 793d30ea906Sjfb8856606 } leaf; 794d30ea906Sjfb8856606 }; 795d30ea906Sjfb8856606 }; 796d30ea906Sjfb8856606 797d30ea906Sjfb8856606 /** 798d30ea906Sjfb8856606 * Traffic manager node capabilities 799d30ea906Sjfb8856606 */ 800d30ea906Sjfb8856606 struct rte_tm_node_capabilities { 801d30ea906Sjfb8856606 /** Private shaper support for the current node. */ 802d30ea906Sjfb8856606 int shaper_private_supported; 803d30ea906Sjfb8856606 804d30ea906Sjfb8856606 /** Dual rate shaping support for private shaper of current node. 805d30ea906Sjfb8856606 * Valid only when private shaper is supported by the current node. 806d30ea906Sjfb8856606 */ 807d30ea906Sjfb8856606 int shaper_private_dual_rate_supported; 808d30ea906Sjfb8856606 809d30ea906Sjfb8856606 /** Minimum committed/peak rate (bytes per second) for private 810d30ea906Sjfb8856606 * shaper of current node. Valid only when private shaper is supported 811d30ea906Sjfb8856606 * by the current node. 812d30ea906Sjfb8856606 */ 813d30ea906Sjfb8856606 uint64_t shaper_private_rate_min; 814d30ea906Sjfb8856606 815d30ea906Sjfb8856606 /** Maximum committed/peak rate (bytes per second) for private 816d30ea906Sjfb8856606 * shaper of current node. Valid only when private shaper is supported 817d30ea906Sjfb8856606 * by the current node. 818d30ea906Sjfb8856606 */ 819d30ea906Sjfb8856606 uint64_t shaper_private_rate_max; 820d30ea906Sjfb8856606 821*2d9fd380Sjfb8856606 /** Shaper private packet mode supported. When non-zero, this parameter 822*2d9fd380Sjfb8856606 * indicates private shaper of current node can be configured with 823*2d9fd380Sjfb8856606 * packet mode. When configured in packet mode, committed/peak rate 824*2d9fd380Sjfb8856606 * provided is interpreted in packets per second. 825*2d9fd380Sjfb8856606 */ 826*2d9fd380Sjfb8856606 int shaper_private_packet_mode_supported; 827*2d9fd380Sjfb8856606 828*2d9fd380Sjfb8856606 /** Shaper private byte mode supported. When non-zero, this parameter 829*2d9fd380Sjfb8856606 * indicates private shaper of current node can be configured with 830*2d9fd380Sjfb8856606 * byte mode. When configured in byte mode, committed/peak rate 831*2d9fd380Sjfb8856606 * provided is interpreted in bytes per second. 832*2d9fd380Sjfb8856606 */ 833*2d9fd380Sjfb8856606 int shaper_private_byte_mode_supported; 834*2d9fd380Sjfb8856606 835d30ea906Sjfb8856606 /** Maximum number of shared shapers the current node can be part of. 836d30ea906Sjfb8856606 * The value of zero indicates that shared shapers are not supported by 837d30ea906Sjfb8856606 * the current node. 838d30ea906Sjfb8856606 */ 839d30ea906Sjfb8856606 uint32_t shaper_shared_n_max; 840d30ea906Sjfb8856606 841*2d9fd380Sjfb8856606 /** Shaper shared packet mode supported. When non-zero, 842*2d9fd380Sjfb8856606 * this parameter indicates that current node can be part of 843*2d9fd380Sjfb8856606 * shared shapers which work in packet mode. 844*2d9fd380Sjfb8856606 */ 845*2d9fd380Sjfb8856606 int shaper_shared_packet_mode_supported; 846*2d9fd380Sjfb8856606 847*2d9fd380Sjfb8856606 /** Shaper shared byte mode supported. When non-zero, 848*2d9fd380Sjfb8856606 * this parameter indicates that current node can be part of 849*2d9fd380Sjfb8856606 * shared shapers which work in byte mode. 850*2d9fd380Sjfb8856606 */ 851*2d9fd380Sjfb8856606 int shaper_shared_byte_mode_supported; 852*2d9fd380Sjfb8856606 853d30ea906Sjfb8856606 RTE_STD_C11 854d30ea906Sjfb8856606 union { 855d30ea906Sjfb8856606 /** Items valid only for non-leaf nodes. */ 856d30ea906Sjfb8856606 struct { 857d30ea906Sjfb8856606 /** Maximum number of children nodes. */ 858d30ea906Sjfb8856606 uint32_t sched_n_children_max; 859d30ea906Sjfb8856606 860d30ea906Sjfb8856606 /** Maximum number of supported priority levels. The 861d30ea906Sjfb8856606 * value of zero is invalid. The value of 1 indicates 862d30ea906Sjfb8856606 * that only priority 0 is supported, which essentially 863d30ea906Sjfb8856606 * means that Strict Priority (SP) algorithm is not 864d30ea906Sjfb8856606 * supported. 865d30ea906Sjfb8856606 */ 866d30ea906Sjfb8856606 uint32_t sched_sp_n_priorities_max; 867d30ea906Sjfb8856606 868d30ea906Sjfb8856606 /** Maximum number of sibling nodes that can have the 869d30ea906Sjfb8856606 * same priority at any given time, i.e. maximum size 870d30ea906Sjfb8856606 * of the WFQ sibling node group. The value of zero 871d30ea906Sjfb8856606 * is invalid. The value of 1 indicates that WFQ 872d30ea906Sjfb8856606 * algorithm is not supported. The maximum value is 873d30ea906Sjfb8856606 * *sched_n_children_max*. 874d30ea906Sjfb8856606 */ 875d30ea906Sjfb8856606 uint32_t sched_wfq_n_children_per_group_max; 876d30ea906Sjfb8856606 877d30ea906Sjfb8856606 /** Maximum number of priority levels that can have 878d30ea906Sjfb8856606 * more than one child node at any given time, i.e. 879d30ea906Sjfb8856606 * maximum number of WFQ sibling node groups that have 880d30ea906Sjfb8856606 * two or more members. The value of zero states that 881d30ea906Sjfb8856606 * WFQ algorithm is not supported. The value of 1 882d30ea906Sjfb8856606 * indicates that (*sched_sp_n_priorities_max* - 1) 883d30ea906Sjfb8856606 * priority levels have at most one child node, so there 884d30ea906Sjfb8856606 * can be only one priority level with two or more 885d30ea906Sjfb8856606 * sibling nodes making up a WFQ group. The maximum 886d30ea906Sjfb8856606 * value is: min(floor(*sched_n_children_max* / 2), 887d30ea906Sjfb8856606 * *sched_sp_n_priorities_max*). 888d30ea906Sjfb8856606 */ 889d30ea906Sjfb8856606 uint32_t sched_wfq_n_groups_max; 890d30ea906Sjfb8856606 891d30ea906Sjfb8856606 /** Maximum WFQ weight. The value of 1 indicates that 892d30ea906Sjfb8856606 * all sibling nodes with same priority have the same 893d30ea906Sjfb8856606 * WFQ weight, so WFQ is reduced to FQ. 894d30ea906Sjfb8856606 */ 895d30ea906Sjfb8856606 uint32_t sched_wfq_weight_max; 896*2d9fd380Sjfb8856606 897*2d9fd380Sjfb8856606 /** WFQ packet mode supported. When non-zero, this 898*2d9fd380Sjfb8856606 * parameter indicates that current node supports packet 899*2d9fd380Sjfb8856606 * mode for WFQ among its children. WFQ weights will be 900*2d9fd380Sjfb8856606 * applied against packet count for scheduling children 901*2d9fd380Sjfb8856606 * when configured appropriately. 902*2d9fd380Sjfb8856606 */ 903*2d9fd380Sjfb8856606 int sched_wfq_packet_mode_supported; 904*2d9fd380Sjfb8856606 905*2d9fd380Sjfb8856606 /** WFQ byte mode supported. When non-zero, this 906*2d9fd380Sjfb8856606 * parameter indicates that current node supports byte 907*2d9fd380Sjfb8856606 * mode for WFQ among its children. WFQ weights will be 908*2d9fd380Sjfb8856606 * applied against bytes for scheduling children when 909*2d9fd380Sjfb8856606 * configured appropriately. 910*2d9fd380Sjfb8856606 */ 911*2d9fd380Sjfb8856606 int sched_wfq_byte_mode_supported; 912*2d9fd380Sjfb8856606 913d30ea906Sjfb8856606 } nonleaf; 914d30ea906Sjfb8856606 915d30ea906Sjfb8856606 /** Items valid only for leaf nodes. */ 916d30ea906Sjfb8856606 struct { 917d30ea906Sjfb8856606 /** WRED packet mode support for current node. */ 918d30ea906Sjfb8856606 int cman_wred_packet_mode_supported; 919d30ea906Sjfb8856606 920d30ea906Sjfb8856606 /** WRED byte mode support for current node. */ 921d30ea906Sjfb8856606 int cman_wred_byte_mode_supported; 922d30ea906Sjfb8856606 923d30ea906Sjfb8856606 /** Head drop algorithm support for current node. */ 924d30ea906Sjfb8856606 int cman_head_drop_supported; 925d30ea906Sjfb8856606 926d30ea906Sjfb8856606 /** Private WRED context support for current node. */ 927d30ea906Sjfb8856606 int cman_wred_context_private_supported; 928d30ea906Sjfb8856606 929d30ea906Sjfb8856606 /** Maximum number of shared WRED contexts the current 930d30ea906Sjfb8856606 * node can be part of. The value of zero indicates that 931d30ea906Sjfb8856606 * shared WRED contexts are not supported by the current 932d30ea906Sjfb8856606 * node. 933d30ea906Sjfb8856606 */ 934d30ea906Sjfb8856606 uint32_t cman_wred_context_shared_n_max; 935d30ea906Sjfb8856606 } leaf; 936d30ea906Sjfb8856606 }; 937d30ea906Sjfb8856606 938d30ea906Sjfb8856606 /** Mask of statistics counter types supported by the current node. 939d30ea906Sjfb8856606 * @see enum rte_tm_stats_type 940d30ea906Sjfb8856606 */ 941d30ea906Sjfb8856606 uint64_t stats_mask; 942d30ea906Sjfb8856606 }; 943d30ea906Sjfb8856606 944d30ea906Sjfb8856606 /** 945d30ea906Sjfb8856606 * Congestion management (CMAN) mode 946d30ea906Sjfb8856606 * 947d30ea906Sjfb8856606 * This is used for controlling the admission of packets into a packet queue or 948d30ea906Sjfb8856606 * group of packet queues on congestion. On request of writing a new packet 949d30ea906Sjfb8856606 * into the current queue while the queue is full, the *tail drop* algorithm 950d30ea906Sjfb8856606 * drops the new packet while leaving the queue unmodified, as opposed to *head 951d30ea906Sjfb8856606 * drop* algorithm, which drops the packet at the head of the queue (the oldest 952d30ea906Sjfb8856606 * packet waiting in the queue) and admits the new packet at the tail of the 953d30ea906Sjfb8856606 * queue. 954d30ea906Sjfb8856606 * 955d30ea906Sjfb8856606 * The *Random Early Detection (RED)* algorithm works by proactively dropping 956d30ea906Sjfb8856606 * more and more input packets as the queue occupancy builds up. When the queue 957d30ea906Sjfb8856606 * is full or almost full, RED effectively works as *tail drop*. The *Weighted 958d30ea906Sjfb8856606 * RED* algorithm uses a separate set of RED thresholds for each packet color. 959d30ea906Sjfb8856606 */ 960d30ea906Sjfb8856606 enum rte_tm_cman_mode { 961d30ea906Sjfb8856606 RTE_TM_CMAN_TAIL_DROP = 0, /**< Tail drop */ 962d30ea906Sjfb8856606 RTE_TM_CMAN_HEAD_DROP, /**< Head drop */ 963d30ea906Sjfb8856606 RTE_TM_CMAN_WRED, /**< Weighted Random Early Detection (WRED) */ 964d30ea906Sjfb8856606 }; 965d30ea906Sjfb8856606 966d30ea906Sjfb8856606 /** 967d30ea906Sjfb8856606 * Random Early Detection (RED) profile 968d30ea906Sjfb8856606 */ 969d30ea906Sjfb8856606 struct rte_tm_red_params { 970d30ea906Sjfb8856606 /** Minimum queue threshold */ 971d30ea906Sjfb8856606 uint64_t min_th; 972d30ea906Sjfb8856606 973d30ea906Sjfb8856606 /** Maximum queue threshold */ 974d30ea906Sjfb8856606 uint64_t max_th; 975d30ea906Sjfb8856606 976d30ea906Sjfb8856606 /** Inverse of packet marking probability maximum value (maxp), i.e. 977d30ea906Sjfb8856606 * maxp_inv = 1 / maxp 978d30ea906Sjfb8856606 */ 979d30ea906Sjfb8856606 uint16_t maxp_inv; 980d30ea906Sjfb8856606 981d30ea906Sjfb8856606 /** Negated log2 of queue weight (wq), i.e. wq = 1 / (2 ^ wq_log2) */ 982d30ea906Sjfb8856606 uint16_t wq_log2; 983d30ea906Sjfb8856606 }; 984d30ea906Sjfb8856606 985d30ea906Sjfb8856606 /** 986d30ea906Sjfb8856606 * Weighted RED (WRED) profile 987d30ea906Sjfb8856606 * 988d30ea906Sjfb8856606 * Multiple WRED contexts can share the same WRED profile. Each leaf node with 989d30ea906Sjfb8856606 * WRED enabled as its congestion management mode has zero or one private WRED 990d30ea906Sjfb8856606 * context (only one leaf node using it) and/or zero, one or several shared 991d30ea906Sjfb8856606 * WRED contexts (multiple leaf nodes use the same WRED context). A private 992d30ea906Sjfb8856606 * WRED context is used to perform congestion management for a single leaf 993d30ea906Sjfb8856606 * node, while a shared WRED context is used to perform congestion management 994d30ea906Sjfb8856606 * for a group of leaf nodes. 995d30ea906Sjfb8856606 * 996d30ea906Sjfb8856606 * @see struct rte_tm_capabilities::cman_wred_packet_mode_supported 997d30ea906Sjfb8856606 * @see struct rte_tm_capabilities::cman_wred_byte_mode_supported 998d30ea906Sjfb8856606 */ 999d30ea906Sjfb8856606 struct rte_tm_wred_params { 1000d30ea906Sjfb8856606 /** One set of RED parameters per packet color */ 10014418919fSjohnjiang struct rte_tm_red_params red_params[RTE_COLORS]; 1002d30ea906Sjfb8856606 1003d30ea906Sjfb8856606 /** When non-zero, the *min_th* and *max_th* thresholds are specified 1004d30ea906Sjfb8856606 * in packets (WRED packet mode). When zero, the *min_th* and *max_th* 1005d30ea906Sjfb8856606 * thresholds are specified in bytes (WRED byte mode) 1006d30ea906Sjfb8856606 */ 1007d30ea906Sjfb8856606 int packet_mode; 1008d30ea906Sjfb8856606 }; 1009d30ea906Sjfb8856606 1010d30ea906Sjfb8856606 /** 1011d30ea906Sjfb8856606 * Token bucket 1012d30ea906Sjfb8856606 */ 1013d30ea906Sjfb8856606 struct rte_tm_token_bucket { 1014*2d9fd380Sjfb8856606 /** Token bucket rate (bytes per second or packets per second) */ 1015d30ea906Sjfb8856606 uint64_t rate; 1016d30ea906Sjfb8856606 1017*2d9fd380Sjfb8856606 /** Token bucket size (bytes or packets), a.k.a. max burst size */ 1018d30ea906Sjfb8856606 uint64_t size; 1019d30ea906Sjfb8856606 }; 1020d30ea906Sjfb8856606 1021d30ea906Sjfb8856606 /** 1022d30ea906Sjfb8856606 * Shaper (rate limiter) profile 1023d30ea906Sjfb8856606 * 1024d30ea906Sjfb8856606 * Multiple shaper instances can share the same shaper profile. Each node has 1025d30ea906Sjfb8856606 * zero or one private shaper (only one node using it) and/or zero, one or 1026d30ea906Sjfb8856606 * several shared shapers (multiple nodes use the same shaper instance). 1027d30ea906Sjfb8856606 * A private shaper is used to perform traffic shaping for a single node, while 1028d30ea906Sjfb8856606 * a shared shaper is used to perform traffic shaping for a group of nodes. 1029d30ea906Sjfb8856606 * 1030d30ea906Sjfb8856606 * Single rate shapers use a single token bucket. A single rate shaper can be 1031d30ea906Sjfb8856606 * configured by setting the rate of the committed bucket to zero, which 1032d30ea906Sjfb8856606 * effectively disables this bucket. The peak bucket is used to limit the rate 1033d30ea906Sjfb8856606 * and the burst size for the current shaper. 1034d30ea906Sjfb8856606 * 1035d30ea906Sjfb8856606 * Dual rate shapers use both the committed and the peak token buckets. The 1036d30ea906Sjfb8856606 * rate of the peak bucket has to be bigger than zero, as well as greater than 1037d30ea906Sjfb8856606 * or equal to the rate of the committed bucket. 1038*2d9fd380Sjfb8856606 * 1039*2d9fd380Sjfb8856606 * @see struct rte_tm_capabilities::shaper_private_packet_mode_supported 1040*2d9fd380Sjfb8856606 * @see struct rte_tm_capabilities::shaper_private_byte_mode_supported 1041*2d9fd380Sjfb8856606 * @see struct rte_tm_capabilities::shaper_shared_packet_mode_supported 1042*2d9fd380Sjfb8856606 * @see struct rte_tm_capabilities::shaper_shared_byte_mode_supported 1043d30ea906Sjfb8856606 */ 1044d30ea906Sjfb8856606 struct rte_tm_shaper_params { 1045d30ea906Sjfb8856606 /** Committed token bucket */ 1046d30ea906Sjfb8856606 struct rte_tm_token_bucket committed; 1047d30ea906Sjfb8856606 1048d30ea906Sjfb8856606 /** Peak token bucket */ 1049d30ea906Sjfb8856606 struct rte_tm_token_bucket peak; 1050d30ea906Sjfb8856606 1051d30ea906Sjfb8856606 /** Signed value to be added to the length of each packet for the 1052d30ea906Sjfb8856606 * purpose of shaping. Can be used to correct the packet length with 1053d30ea906Sjfb8856606 * the framing overhead bytes that are also consumed on the wire (e.g. 1054d30ea906Sjfb8856606 * RTE_TM_ETH_FRAMING_OVERHEAD_FCS). 1055*2d9fd380Sjfb8856606 * This field is ignored when the profile enables packet mode. 1056d30ea906Sjfb8856606 */ 1057d30ea906Sjfb8856606 int32_t pkt_length_adjust; 1058*2d9fd380Sjfb8856606 1059*2d9fd380Sjfb8856606 /** When zero, the byte mode is enabled for the current profile, so the 1060*2d9fd380Sjfb8856606 * *rate* and *size* fields in both the committed and peak token buckets 1061*2d9fd380Sjfb8856606 * are specified in bytes per second and bytes, respectively. 1062*2d9fd380Sjfb8856606 * When non-zero, the packet mode is enabled for the current profile, 1063*2d9fd380Sjfb8856606 * so the *rate* and *size* fields in both the committed and peak token 1064*2d9fd380Sjfb8856606 * buckets are specified in packets per second and packets, 1065*2d9fd380Sjfb8856606 * respectively. 1066*2d9fd380Sjfb8856606 */ 1067*2d9fd380Sjfb8856606 int packet_mode; 1068d30ea906Sjfb8856606 }; 1069d30ea906Sjfb8856606 1070d30ea906Sjfb8856606 /** 1071d30ea906Sjfb8856606 * Node parameters 1072d30ea906Sjfb8856606 * 1073d30ea906Sjfb8856606 * Each non-leaf node has multiple inputs (its children nodes) and single output 1074d30ea906Sjfb8856606 * (which is input to its parent node). It arbitrates its inputs using Strict 1075d30ea906Sjfb8856606 * Priority (SP) and Weighted Fair Queuing (WFQ) algorithms to schedule input 1076d30ea906Sjfb8856606 * packets to its output while observing its shaping (rate limiting) 1077d30ea906Sjfb8856606 * constraints. 1078d30ea906Sjfb8856606 * 1079d30ea906Sjfb8856606 * Algorithms such as Weighted Round Robin (WRR), Byte-level WRR, Deficit WRR 1080d30ea906Sjfb8856606 * (DWRR), etc. are considered approximations of the WFQ ideal and are 1081d30ea906Sjfb8856606 * assimilated to WFQ, although an associated implementation-dependent trade-off 1082d30ea906Sjfb8856606 * on accuracy, performance and resource usage might exist. 1083d30ea906Sjfb8856606 * 1084d30ea906Sjfb8856606 * Children nodes with different priorities are scheduled using the SP algorithm 1085d30ea906Sjfb8856606 * based on their priority, with zero (0) as the highest priority. Children with 1086d30ea906Sjfb8856606 * the same priority are scheduled using the WFQ algorithm according to their 1087d30ea906Sjfb8856606 * weights. The WFQ weight of a given child node is relative to the sum of the 1088d30ea906Sjfb8856606 * weights of all its sibling nodes that have the same priority, with one (1) as 1089d30ea906Sjfb8856606 * the lowest weight. For each SP priority, the WFQ weight mode can be set as 1090d30ea906Sjfb8856606 * either byte-based or packet-based. 1091d30ea906Sjfb8856606 * 1092d30ea906Sjfb8856606 * Each leaf node sits on top of a TX queue of the current Ethernet port. Hence, 1093d30ea906Sjfb8856606 * the leaf nodes are predefined, with their node IDs set to 0 .. (N-1), where N 1094d30ea906Sjfb8856606 * is the number of TX queues configured for the current Ethernet port. The 1095d30ea906Sjfb8856606 * non-leaf nodes have their IDs generated by the application. 1096d30ea906Sjfb8856606 */ 1097d30ea906Sjfb8856606 struct rte_tm_node_params { 1098d30ea906Sjfb8856606 /** Shaper profile for the private shaper. The absence of the private 1099d30ea906Sjfb8856606 * shaper for the current node is indicated by setting this parameter 1100d30ea906Sjfb8856606 * to RTE_TM_SHAPER_PROFILE_ID_NONE. 1101d30ea906Sjfb8856606 */ 1102d30ea906Sjfb8856606 uint32_t shaper_profile_id; 1103d30ea906Sjfb8856606 1104d30ea906Sjfb8856606 /** User allocated array of valid shared shaper IDs. */ 1105d30ea906Sjfb8856606 uint32_t *shared_shaper_id; 1106d30ea906Sjfb8856606 1107d30ea906Sjfb8856606 /** Number of shared shaper IDs in the *shared_shaper_id* array. */ 1108d30ea906Sjfb8856606 uint32_t n_shared_shapers; 1109d30ea906Sjfb8856606 1110d30ea906Sjfb8856606 RTE_STD_C11 1111d30ea906Sjfb8856606 union { 1112d30ea906Sjfb8856606 /** Parameters only valid for non-leaf nodes. */ 1113d30ea906Sjfb8856606 struct { 1114d30ea906Sjfb8856606 /** WFQ weight mode for each SP priority. When NULL, it 1115d30ea906Sjfb8856606 * indicates that WFQ is to be used for all priorities. 1116d30ea906Sjfb8856606 * When non-NULL, it points to a pre-allocated array of 1117d30ea906Sjfb8856606 * *n_sp_priorities* values, with non-zero value for 1118d30ea906Sjfb8856606 * byte-mode and zero for packet-mode. 1119*2d9fd380Sjfb8856606 * @see struct rte_tm_node_capabilities::sched_wfq_packet_mode_supported 1120*2d9fd380Sjfb8856606 * @see struct rte_tm_node_capabilities::sched_wfq_byte_mode_supported 1121d30ea906Sjfb8856606 */ 1122d30ea906Sjfb8856606 int *wfq_weight_mode; 1123d30ea906Sjfb8856606 1124d30ea906Sjfb8856606 /** Number of SP priorities. */ 1125d30ea906Sjfb8856606 uint32_t n_sp_priorities; 1126d30ea906Sjfb8856606 } nonleaf; 1127d30ea906Sjfb8856606 1128d30ea906Sjfb8856606 /** Parameters only valid for leaf nodes. */ 1129d30ea906Sjfb8856606 struct { 1130d30ea906Sjfb8856606 /** Congestion management mode */ 1131d30ea906Sjfb8856606 enum rte_tm_cman_mode cman; 1132d30ea906Sjfb8856606 1133d30ea906Sjfb8856606 /** WRED parameters (only valid when *cman* is set to 1134d30ea906Sjfb8856606 * WRED). 1135d30ea906Sjfb8856606 */ 1136d30ea906Sjfb8856606 struct { 1137d30ea906Sjfb8856606 /** WRED profile for private WRED context. The 1138d30ea906Sjfb8856606 * absence of a private WRED context for the 1139d30ea906Sjfb8856606 * current leaf node is indicated by value 1140d30ea906Sjfb8856606 * RTE_TM_WRED_PROFILE_ID_NONE. 1141d30ea906Sjfb8856606 */ 1142d30ea906Sjfb8856606 uint32_t wred_profile_id; 1143d30ea906Sjfb8856606 1144d30ea906Sjfb8856606 /** User allocated array of shared WRED context 1145d30ea906Sjfb8856606 * IDs. When set to NULL, it indicates that the 1146d30ea906Sjfb8856606 * current leaf node should not currently be 1147d30ea906Sjfb8856606 * part of any shared WRED contexts. 1148d30ea906Sjfb8856606 */ 1149d30ea906Sjfb8856606 uint32_t *shared_wred_context_id; 1150d30ea906Sjfb8856606 1151d30ea906Sjfb8856606 /** Number of elements in the 1152d30ea906Sjfb8856606 * *shared_wred_context_id* array. Only valid 1153d30ea906Sjfb8856606 * when *shared_wred_context_id* is non-NULL, 1154d30ea906Sjfb8856606 * in which case it should be non-zero. 1155d30ea906Sjfb8856606 */ 1156d30ea906Sjfb8856606 uint32_t n_shared_wred_contexts; 1157d30ea906Sjfb8856606 } wred; 1158d30ea906Sjfb8856606 } leaf; 1159d30ea906Sjfb8856606 }; 1160d30ea906Sjfb8856606 1161d30ea906Sjfb8856606 /** Mask of statistics counter types to be enabled for this node. This 1162d30ea906Sjfb8856606 * needs to be a subset of the statistics counter types available for 1163d30ea906Sjfb8856606 * the current node. Any statistics counter type not included in this 1164d30ea906Sjfb8856606 * set is to be disabled for the current node. 1165d30ea906Sjfb8856606 * @see enum rte_tm_stats_type 1166d30ea906Sjfb8856606 */ 1167d30ea906Sjfb8856606 uint64_t stats_mask; 1168d30ea906Sjfb8856606 }; 1169d30ea906Sjfb8856606 1170d30ea906Sjfb8856606 /** 1171d30ea906Sjfb8856606 * Verbose error types. 1172d30ea906Sjfb8856606 * 1173d30ea906Sjfb8856606 * Most of them provide the type of the object referenced by struct 1174d30ea906Sjfb8856606 * rte_tm_error::cause. 1175d30ea906Sjfb8856606 */ 1176d30ea906Sjfb8856606 enum rte_tm_error_type { 1177d30ea906Sjfb8856606 RTE_TM_ERROR_TYPE_NONE, /**< No error. */ 1178d30ea906Sjfb8856606 RTE_TM_ERROR_TYPE_UNSPECIFIED, /**< Cause unspecified. */ 1179d30ea906Sjfb8856606 RTE_TM_ERROR_TYPE_CAPABILITIES, 1180d30ea906Sjfb8856606 RTE_TM_ERROR_TYPE_LEVEL_ID, 1181d30ea906Sjfb8856606 RTE_TM_ERROR_TYPE_WRED_PROFILE, 1182d30ea906Sjfb8856606 RTE_TM_ERROR_TYPE_WRED_PROFILE_GREEN, 1183d30ea906Sjfb8856606 RTE_TM_ERROR_TYPE_WRED_PROFILE_YELLOW, 1184d30ea906Sjfb8856606 RTE_TM_ERROR_TYPE_WRED_PROFILE_RED, 1185d30ea906Sjfb8856606 RTE_TM_ERROR_TYPE_WRED_PROFILE_ID, 1186d30ea906Sjfb8856606 RTE_TM_ERROR_TYPE_SHARED_WRED_CONTEXT_ID, 1187d30ea906Sjfb8856606 RTE_TM_ERROR_TYPE_SHAPER_PROFILE, 1188d30ea906Sjfb8856606 RTE_TM_ERROR_TYPE_SHAPER_PROFILE_COMMITTED_RATE, 1189d30ea906Sjfb8856606 RTE_TM_ERROR_TYPE_SHAPER_PROFILE_COMMITTED_SIZE, 1190d30ea906Sjfb8856606 RTE_TM_ERROR_TYPE_SHAPER_PROFILE_PEAK_RATE, 1191d30ea906Sjfb8856606 RTE_TM_ERROR_TYPE_SHAPER_PROFILE_PEAK_SIZE, 1192d30ea906Sjfb8856606 RTE_TM_ERROR_TYPE_SHAPER_PROFILE_PKT_ADJUST_LEN, 1193*2d9fd380Sjfb8856606 RTE_TM_ERROR_TYPE_SHAPER_PROFILE_PACKET_MODE, 1194d30ea906Sjfb8856606 RTE_TM_ERROR_TYPE_SHAPER_PROFILE_ID, 1195d30ea906Sjfb8856606 RTE_TM_ERROR_TYPE_SHARED_SHAPER_ID, 1196d30ea906Sjfb8856606 RTE_TM_ERROR_TYPE_NODE_PARENT_NODE_ID, 1197d30ea906Sjfb8856606 RTE_TM_ERROR_TYPE_NODE_PRIORITY, 1198d30ea906Sjfb8856606 RTE_TM_ERROR_TYPE_NODE_WEIGHT, 1199d30ea906Sjfb8856606 RTE_TM_ERROR_TYPE_NODE_PARAMS, 1200d30ea906Sjfb8856606 RTE_TM_ERROR_TYPE_NODE_PARAMS_SHAPER_PROFILE_ID, 1201d30ea906Sjfb8856606 RTE_TM_ERROR_TYPE_NODE_PARAMS_SHARED_SHAPER_ID, 1202d30ea906Sjfb8856606 RTE_TM_ERROR_TYPE_NODE_PARAMS_N_SHARED_SHAPERS, 1203d30ea906Sjfb8856606 RTE_TM_ERROR_TYPE_NODE_PARAMS_WFQ_WEIGHT_MODE, 1204d30ea906Sjfb8856606 RTE_TM_ERROR_TYPE_NODE_PARAMS_N_SP_PRIORITIES, 1205d30ea906Sjfb8856606 RTE_TM_ERROR_TYPE_NODE_PARAMS_CMAN, 1206d30ea906Sjfb8856606 RTE_TM_ERROR_TYPE_NODE_PARAMS_WRED_PROFILE_ID, 1207d30ea906Sjfb8856606 RTE_TM_ERROR_TYPE_NODE_PARAMS_SHARED_WRED_CONTEXT_ID, 1208d30ea906Sjfb8856606 RTE_TM_ERROR_TYPE_NODE_PARAMS_N_SHARED_WRED_CONTEXTS, 1209d30ea906Sjfb8856606 RTE_TM_ERROR_TYPE_NODE_PARAMS_STATS, 1210d30ea906Sjfb8856606 RTE_TM_ERROR_TYPE_NODE_ID, 1211d30ea906Sjfb8856606 }; 1212d30ea906Sjfb8856606 1213d30ea906Sjfb8856606 /** 1214d30ea906Sjfb8856606 * Verbose error structure definition. 1215d30ea906Sjfb8856606 * 1216d30ea906Sjfb8856606 * This object is normally allocated by applications and set by PMDs, the 1217d30ea906Sjfb8856606 * message points to a constant string which does not need to be freed by 1218d30ea906Sjfb8856606 * the application, however its pointer can be considered valid only as long 1219d30ea906Sjfb8856606 * as its associated DPDK port remains configured. Closing the underlying 1220d30ea906Sjfb8856606 * device or unloading the PMD invalidates it. 1221d30ea906Sjfb8856606 * 1222d30ea906Sjfb8856606 * Both cause and message may be NULL regardless of the error type. 1223d30ea906Sjfb8856606 */ 1224d30ea906Sjfb8856606 struct rte_tm_error { 1225d30ea906Sjfb8856606 enum rte_tm_error_type type; /**< Cause field and error type. */ 1226d30ea906Sjfb8856606 const void *cause; /**< Object responsible for the error. */ 1227d30ea906Sjfb8856606 const char *message; /**< Human-readable error message. */ 1228d30ea906Sjfb8856606 }; 1229d30ea906Sjfb8856606 1230d30ea906Sjfb8856606 /** 1231d30ea906Sjfb8856606 * Traffic manager get number of leaf nodes 1232d30ea906Sjfb8856606 * 1233d30ea906Sjfb8856606 * Each leaf node sits on on top of a TX queue of the current Ethernet port. 1234d30ea906Sjfb8856606 * Therefore, the set of leaf nodes is predefined, their number is always equal 1235d30ea906Sjfb8856606 * to N (where N is the number of TX queues configured for the current port) 1236d30ea906Sjfb8856606 * and their IDs are 0 .. (N-1). 1237d30ea906Sjfb8856606 * 1238d30ea906Sjfb8856606 * @param[in] port_id 1239d30ea906Sjfb8856606 * The port identifier of the Ethernet device. 1240d30ea906Sjfb8856606 * @param[out] n_leaf_nodes 1241d30ea906Sjfb8856606 * Number of leaf nodes for the current port. 1242d30ea906Sjfb8856606 * @param[out] error 1243d30ea906Sjfb8856606 * Error details. Filled in only on error, when not NULL. 1244d30ea906Sjfb8856606 * @return 1245d30ea906Sjfb8856606 * 0 on success, non-zero error code otherwise. 1246d30ea906Sjfb8856606 */ 1247*2d9fd380Sjfb8856606 __rte_experimental 1248d30ea906Sjfb8856606 int 1249d30ea906Sjfb8856606 rte_tm_get_number_of_leaf_nodes(uint16_t port_id, 1250d30ea906Sjfb8856606 uint32_t *n_leaf_nodes, 1251d30ea906Sjfb8856606 struct rte_tm_error *error); 1252d30ea906Sjfb8856606 1253d30ea906Sjfb8856606 /** 1254d30ea906Sjfb8856606 * Traffic manager node ID validate and type (i.e. leaf or non-leaf) get 1255d30ea906Sjfb8856606 * 1256d30ea906Sjfb8856606 * The leaf nodes have predefined IDs in the range of 0 .. (N-1), where N is 1257d30ea906Sjfb8856606 * the number of TX queues of the current Ethernet port. The non-leaf nodes 1258d30ea906Sjfb8856606 * have their IDs generated by the application outside of the above range, 1259d30ea906Sjfb8856606 * which is reserved for leaf nodes. 1260d30ea906Sjfb8856606 * 1261d30ea906Sjfb8856606 * @param[in] port_id 1262d30ea906Sjfb8856606 * The port identifier of the Ethernet device. 1263d30ea906Sjfb8856606 * @param[in] node_id 1264d30ea906Sjfb8856606 * Node ID value. Needs to be valid. 1265d30ea906Sjfb8856606 * @param[out] is_leaf 1266d30ea906Sjfb8856606 * Set to non-zero value when node is leaf and to zero otherwise (non-leaf). 1267d30ea906Sjfb8856606 * @param[out] error 1268d30ea906Sjfb8856606 * Error details. Filled in only on error, when not NULL. 1269d30ea906Sjfb8856606 * @return 1270d30ea906Sjfb8856606 * 0 on success, non-zero error code otherwise. 1271d30ea906Sjfb8856606 */ 1272*2d9fd380Sjfb8856606 __rte_experimental 1273d30ea906Sjfb8856606 int 1274d30ea906Sjfb8856606 rte_tm_node_type_get(uint16_t port_id, 1275d30ea906Sjfb8856606 uint32_t node_id, 1276d30ea906Sjfb8856606 int *is_leaf, 1277d30ea906Sjfb8856606 struct rte_tm_error *error); 1278d30ea906Sjfb8856606 1279d30ea906Sjfb8856606 /** 1280d30ea906Sjfb8856606 * Traffic manager capabilities get 1281d30ea906Sjfb8856606 * 1282d30ea906Sjfb8856606 * @param[in] port_id 1283d30ea906Sjfb8856606 * The port identifier of the Ethernet device. 1284d30ea906Sjfb8856606 * @param[out] cap 1285d30ea906Sjfb8856606 * Traffic manager capabilities. Needs to be pre-allocated and valid. 1286d30ea906Sjfb8856606 * @param[out] error 1287d30ea906Sjfb8856606 * Error details. Filled in only on error, when not NULL. 1288d30ea906Sjfb8856606 * @return 1289d30ea906Sjfb8856606 * 0 on success, non-zero error code otherwise. 1290d30ea906Sjfb8856606 */ 1291*2d9fd380Sjfb8856606 __rte_experimental 1292d30ea906Sjfb8856606 int 1293d30ea906Sjfb8856606 rte_tm_capabilities_get(uint16_t port_id, 1294d30ea906Sjfb8856606 struct rte_tm_capabilities *cap, 1295d30ea906Sjfb8856606 struct rte_tm_error *error); 1296d30ea906Sjfb8856606 1297d30ea906Sjfb8856606 /** 1298d30ea906Sjfb8856606 * Traffic manager level capabilities get 1299d30ea906Sjfb8856606 * 1300d30ea906Sjfb8856606 * @param[in] port_id 1301d30ea906Sjfb8856606 * The port identifier of the Ethernet device. 1302d30ea906Sjfb8856606 * @param[in] level_id 1303d30ea906Sjfb8856606 * The hierarchy level identifier. The value of 0 identifies the level of the 1304d30ea906Sjfb8856606 * root node. 1305d30ea906Sjfb8856606 * @param[out] cap 1306d30ea906Sjfb8856606 * Traffic manager level capabilities. Needs to be pre-allocated and valid. 1307d30ea906Sjfb8856606 * @param[out] error 1308d30ea906Sjfb8856606 * Error details. Filled in only on error, when not NULL. 1309d30ea906Sjfb8856606 * @return 1310d30ea906Sjfb8856606 * 0 on success, non-zero error code otherwise. 1311d30ea906Sjfb8856606 */ 1312*2d9fd380Sjfb8856606 __rte_experimental 1313d30ea906Sjfb8856606 int 1314d30ea906Sjfb8856606 rte_tm_level_capabilities_get(uint16_t port_id, 1315d30ea906Sjfb8856606 uint32_t level_id, 1316d30ea906Sjfb8856606 struct rte_tm_level_capabilities *cap, 1317d30ea906Sjfb8856606 struct rte_tm_error *error); 1318d30ea906Sjfb8856606 1319d30ea906Sjfb8856606 /** 1320d30ea906Sjfb8856606 * Traffic manager node capabilities get 1321d30ea906Sjfb8856606 * 1322d30ea906Sjfb8856606 * @param[in] port_id 1323d30ea906Sjfb8856606 * The port identifier of the Ethernet device. 1324d30ea906Sjfb8856606 * @param[in] node_id 1325d30ea906Sjfb8856606 * Node ID. Needs to be valid. 1326d30ea906Sjfb8856606 * @param[out] cap 1327d30ea906Sjfb8856606 * Traffic manager node capabilities. Needs to be pre-allocated and valid. 1328d30ea906Sjfb8856606 * @param[out] error 1329d30ea906Sjfb8856606 * Error details. Filled in only on error, when not NULL. 1330d30ea906Sjfb8856606 * @return 1331d30ea906Sjfb8856606 * 0 on success, non-zero error code otherwise. 1332d30ea906Sjfb8856606 */ 1333*2d9fd380Sjfb8856606 __rte_experimental 1334d30ea906Sjfb8856606 int 1335d30ea906Sjfb8856606 rte_tm_node_capabilities_get(uint16_t port_id, 1336d30ea906Sjfb8856606 uint32_t node_id, 1337d30ea906Sjfb8856606 struct rte_tm_node_capabilities *cap, 1338d30ea906Sjfb8856606 struct rte_tm_error *error); 1339d30ea906Sjfb8856606 1340d30ea906Sjfb8856606 /** 1341d30ea906Sjfb8856606 * Traffic manager WRED profile add 1342d30ea906Sjfb8856606 * 1343d30ea906Sjfb8856606 * Create a new WRED profile with ID set to *wred_profile_id*. The new profile 1344d30ea906Sjfb8856606 * is used to create one or several WRED contexts. 1345d30ea906Sjfb8856606 * 1346d30ea906Sjfb8856606 * @param[in] port_id 1347d30ea906Sjfb8856606 * The port identifier of the Ethernet device. 1348d30ea906Sjfb8856606 * @param[in] wred_profile_id 1349d30ea906Sjfb8856606 * WRED profile ID for the new profile. Needs to be unused. 1350d30ea906Sjfb8856606 * @param[in] profile 1351d30ea906Sjfb8856606 * WRED profile parameters. Needs to be pre-allocated and valid. 1352d30ea906Sjfb8856606 * @param[out] error 1353d30ea906Sjfb8856606 * Error details. Filled in only on error, when not NULL. 1354d30ea906Sjfb8856606 * @return 1355d30ea906Sjfb8856606 * 0 on success, non-zero error code otherwise. 1356d30ea906Sjfb8856606 * 1357d30ea906Sjfb8856606 * @see struct rte_tm_capabilities::cman_wred_context_n_max 1358d30ea906Sjfb8856606 */ 1359*2d9fd380Sjfb8856606 __rte_experimental 1360d30ea906Sjfb8856606 int 1361d30ea906Sjfb8856606 rte_tm_wred_profile_add(uint16_t port_id, 1362d30ea906Sjfb8856606 uint32_t wred_profile_id, 1363d30ea906Sjfb8856606 struct rte_tm_wred_params *profile, 1364d30ea906Sjfb8856606 struct rte_tm_error *error); 1365d30ea906Sjfb8856606 1366d30ea906Sjfb8856606 /** 1367d30ea906Sjfb8856606 * Traffic manager WRED profile delete 1368d30ea906Sjfb8856606 * 1369d30ea906Sjfb8856606 * Delete an existing WRED profile. This operation fails when there is 1370d30ea906Sjfb8856606 * currently at least one user (i.e. WRED context) of this WRED profile. 1371d30ea906Sjfb8856606 * 1372d30ea906Sjfb8856606 * @param[in] port_id 1373d30ea906Sjfb8856606 * The port identifier of the Ethernet device. 1374d30ea906Sjfb8856606 * @param[in] wred_profile_id 1375d30ea906Sjfb8856606 * WRED profile ID. Needs to be the valid. 1376d30ea906Sjfb8856606 * @param[out] error 1377d30ea906Sjfb8856606 * Error details. Filled in only on error, when not NULL. 1378d30ea906Sjfb8856606 * @return 1379d30ea906Sjfb8856606 * 0 on success, non-zero error code otherwise. 1380d30ea906Sjfb8856606 * 1381d30ea906Sjfb8856606 * @see struct rte_tm_capabilities::cman_wred_context_n_max 1382d30ea906Sjfb8856606 */ 1383*2d9fd380Sjfb8856606 __rte_experimental 1384d30ea906Sjfb8856606 int 1385d30ea906Sjfb8856606 rte_tm_wred_profile_delete(uint16_t port_id, 1386d30ea906Sjfb8856606 uint32_t wred_profile_id, 1387d30ea906Sjfb8856606 struct rte_tm_error *error); 1388d30ea906Sjfb8856606 1389d30ea906Sjfb8856606 /** 1390d30ea906Sjfb8856606 * Traffic manager shared WRED context add or update 1391d30ea906Sjfb8856606 * 1392d30ea906Sjfb8856606 * When *shared_wred_context_id* is invalid, a new WRED context with this ID is 1393d30ea906Sjfb8856606 * created by using the WRED profile identified by *wred_profile_id*. 1394d30ea906Sjfb8856606 * 1395d30ea906Sjfb8856606 * When *shared_wred_context_id* is valid, this WRED context is no longer using 1396d30ea906Sjfb8856606 * the profile previously assigned to it and is updated to use the profile 1397d30ea906Sjfb8856606 * identified by *wred_profile_id*. 1398d30ea906Sjfb8856606 * 1399d30ea906Sjfb8856606 * A valid shared WRED context can be assigned to several hierarchy leaf nodes 1400d30ea906Sjfb8856606 * configured to use WRED as the congestion management mode. 1401d30ea906Sjfb8856606 * 1402d30ea906Sjfb8856606 * @param[in] port_id 1403d30ea906Sjfb8856606 * The port identifier of the Ethernet device. 1404d30ea906Sjfb8856606 * @param[in] shared_wred_context_id 1405d30ea906Sjfb8856606 * Shared WRED context ID 1406d30ea906Sjfb8856606 * @param[in] wred_profile_id 1407d30ea906Sjfb8856606 * WRED profile ID. Needs to be the valid. 1408d30ea906Sjfb8856606 * @param[out] error 1409d30ea906Sjfb8856606 * Error details. Filled in only on error, when not NULL. 1410d30ea906Sjfb8856606 * @return 1411d30ea906Sjfb8856606 * 0 on success, non-zero error code otherwise. 1412d30ea906Sjfb8856606 * 1413d30ea906Sjfb8856606 * @see struct rte_tm_capabilities::cman_wred_context_shared_n_max 1414d30ea906Sjfb8856606 */ 1415*2d9fd380Sjfb8856606 __rte_experimental 1416d30ea906Sjfb8856606 int 1417d30ea906Sjfb8856606 rte_tm_shared_wred_context_add_update(uint16_t port_id, 1418d30ea906Sjfb8856606 uint32_t shared_wred_context_id, 1419d30ea906Sjfb8856606 uint32_t wred_profile_id, 1420d30ea906Sjfb8856606 struct rte_tm_error *error); 1421d30ea906Sjfb8856606 1422d30ea906Sjfb8856606 /** 1423d30ea906Sjfb8856606 * Traffic manager shared WRED context delete 1424d30ea906Sjfb8856606 * 1425d30ea906Sjfb8856606 * Delete an existing shared WRED context. This operation fails when there is 1426d30ea906Sjfb8856606 * currently at least one user (i.e. hierarchy leaf node) of this shared WRED 1427d30ea906Sjfb8856606 * context. 1428d30ea906Sjfb8856606 * 1429d30ea906Sjfb8856606 * @param[in] port_id 1430d30ea906Sjfb8856606 * The port identifier of the Ethernet device. 1431d30ea906Sjfb8856606 * @param[in] shared_wred_context_id 1432d30ea906Sjfb8856606 * Shared WRED context ID. Needs to be the valid. 1433d30ea906Sjfb8856606 * @param[out] error 1434d30ea906Sjfb8856606 * Error details. Filled in only on error, when not NULL. 1435d30ea906Sjfb8856606 * @return 1436d30ea906Sjfb8856606 * 0 on success, non-zero error code otherwise. 1437d30ea906Sjfb8856606 * 1438d30ea906Sjfb8856606 * @see struct rte_tm_capabilities::cman_wred_context_shared_n_max 1439d30ea906Sjfb8856606 */ 1440*2d9fd380Sjfb8856606 __rte_experimental 1441d30ea906Sjfb8856606 int 1442d30ea906Sjfb8856606 rte_tm_shared_wred_context_delete(uint16_t port_id, 1443d30ea906Sjfb8856606 uint32_t shared_wred_context_id, 1444d30ea906Sjfb8856606 struct rte_tm_error *error); 1445d30ea906Sjfb8856606 1446d30ea906Sjfb8856606 /** 1447d30ea906Sjfb8856606 * Traffic manager shaper profile add 1448d30ea906Sjfb8856606 * 1449d30ea906Sjfb8856606 * Create a new shaper profile with ID set to *shaper_profile_id*. The new 1450d30ea906Sjfb8856606 * shaper profile is used to create one or several shapers. 1451d30ea906Sjfb8856606 * 1452d30ea906Sjfb8856606 * @param[in] port_id 1453d30ea906Sjfb8856606 * The port identifier of the Ethernet device. 1454d30ea906Sjfb8856606 * @param[in] shaper_profile_id 1455d30ea906Sjfb8856606 * Shaper profile ID for the new profile. Needs to be unused. 1456d30ea906Sjfb8856606 * @param[in] profile 1457d30ea906Sjfb8856606 * Shaper profile parameters. Needs to be pre-allocated and valid. 1458d30ea906Sjfb8856606 * @param[out] error 1459d30ea906Sjfb8856606 * Error details. Filled in only on error, when not NULL. 1460d30ea906Sjfb8856606 * @return 1461d30ea906Sjfb8856606 * 0 on success, non-zero error code otherwise. 1462d30ea906Sjfb8856606 * 1463d30ea906Sjfb8856606 * @see struct rte_tm_capabilities::shaper_n_max 1464d30ea906Sjfb8856606 */ 1465*2d9fd380Sjfb8856606 __rte_experimental 1466d30ea906Sjfb8856606 int 1467d30ea906Sjfb8856606 rte_tm_shaper_profile_add(uint16_t port_id, 1468d30ea906Sjfb8856606 uint32_t shaper_profile_id, 1469d30ea906Sjfb8856606 struct rte_tm_shaper_params *profile, 1470d30ea906Sjfb8856606 struct rte_tm_error *error); 1471d30ea906Sjfb8856606 1472d30ea906Sjfb8856606 /** 1473d30ea906Sjfb8856606 * Traffic manager shaper profile delete 1474d30ea906Sjfb8856606 * 1475d30ea906Sjfb8856606 * Delete an existing shaper profile. This operation fails when there is 1476d30ea906Sjfb8856606 * currently at least one user (i.e. shaper) of this shaper profile. 1477d30ea906Sjfb8856606 * 1478d30ea906Sjfb8856606 * @param[in] port_id 1479d30ea906Sjfb8856606 * The port identifier of the Ethernet device. 1480d30ea906Sjfb8856606 * @param[in] shaper_profile_id 1481d30ea906Sjfb8856606 * Shaper profile ID. Needs to be the valid. 1482d30ea906Sjfb8856606 * @param[out] error 1483d30ea906Sjfb8856606 * Error details. Filled in only on error, when not NULL. 1484d30ea906Sjfb8856606 * @return 1485d30ea906Sjfb8856606 * 0 on success, non-zero error code otherwise. 1486d30ea906Sjfb8856606 * 1487d30ea906Sjfb8856606 * @see struct rte_tm_capabilities::shaper_n_max 1488d30ea906Sjfb8856606 */ 1489*2d9fd380Sjfb8856606 __rte_experimental 1490d30ea906Sjfb8856606 int 1491d30ea906Sjfb8856606 rte_tm_shaper_profile_delete(uint16_t port_id, 1492d30ea906Sjfb8856606 uint32_t shaper_profile_id, 1493d30ea906Sjfb8856606 struct rte_tm_error *error); 1494d30ea906Sjfb8856606 1495d30ea906Sjfb8856606 /** 1496d30ea906Sjfb8856606 * Traffic manager shared shaper add or update 1497d30ea906Sjfb8856606 * 1498d30ea906Sjfb8856606 * When *shared_shaper_id* is not a valid shared shaper ID, a new shared shaper 1499d30ea906Sjfb8856606 * with this ID is created using the shaper profile identified by 1500d30ea906Sjfb8856606 * *shaper_profile_id*. 1501d30ea906Sjfb8856606 * 1502d30ea906Sjfb8856606 * When *shared_shaper_id* is a valid shared shaper ID, this shared shaper is 1503d30ea906Sjfb8856606 * no longer using the shaper profile previously assigned to it and is updated 1504d30ea906Sjfb8856606 * to use the shaper profile identified by *shaper_profile_id*. 1505d30ea906Sjfb8856606 * 1506d30ea906Sjfb8856606 * @param[in] port_id 1507d30ea906Sjfb8856606 * The port identifier of the Ethernet device. 1508d30ea906Sjfb8856606 * @param[in] shared_shaper_id 1509d30ea906Sjfb8856606 * Shared shaper ID 1510d30ea906Sjfb8856606 * @param[in] shaper_profile_id 1511d30ea906Sjfb8856606 * Shaper profile ID. Needs to be the valid. 1512d30ea906Sjfb8856606 * @param[out] error 1513d30ea906Sjfb8856606 * Error details. Filled in only on error, when not NULL. 1514d30ea906Sjfb8856606 * @return 1515d30ea906Sjfb8856606 * 0 on success, non-zero error code otherwise. 1516d30ea906Sjfb8856606 * 1517d30ea906Sjfb8856606 * @see struct rte_tm_capabilities::shaper_shared_n_max 1518d30ea906Sjfb8856606 */ 1519*2d9fd380Sjfb8856606 __rte_experimental 1520d30ea906Sjfb8856606 int 1521d30ea906Sjfb8856606 rte_tm_shared_shaper_add_update(uint16_t port_id, 1522d30ea906Sjfb8856606 uint32_t shared_shaper_id, 1523d30ea906Sjfb8856606 uint32_t shaper_profile_id, 1524d30ea906Sjfb8856606 struct rte_tm_error *error); 1525d30ea906Sjfb8856606 1526d30ea906Sjfb8856606 /** 1527d30ea906Sjfb8856606 * Traffic manager shared shaper delete 1528d30ea906Sjfb8856606 * 1529d30ea906Sjfb8856606 * Delete an existing shared shaper. This operation fails when there is 1530d30ea906Sjfb8856606 * currently at least one user (i.e. hierarchy node) of this shared shaper. 1531d30ea906Sjfb8856606 * 1532d30ea906Sjfb8856606 * @param[in] port_id 1533d30ea906Sjfb8856606 * The port identifier of the Ethernet device. 1534d30ea906Sjfb8856606 * @param[in] shared_shaper_id 1535d30ea906Sjfb8856606 * Shared shaper ID. Needs to be the valid. 1536d30ea906Sjfb8856606 * @param[out] error 1537d30ea906Sjfb8856606 * Error details. Filled in only on error, when not NULL. 1538d30ea906Sjfb8856606 * @return 1539d30ea906Sjfb8856606 * 0 on success, non-zero error code otherwise. 1540d30ea906Sjfb8856606 * 1541d30ea906Sjfb8856606 * @see struct rte_tm_capabilities::shaper_shared_n_max 1542d30ea906Sjfb8856606 */ 1543*2d9fd380Sjfb8856606 __rte_experimental 1544d30ea906Sjfb8856606 int 1545d30ea906Sjfb8856606 rte_tm_shared_shaper_delete(uint16_t port_id, 1546d30ea906Sjfb8856606 uint32_t shared_shaper_id, 1547d30ea906Sjfb8856606 struct rte_tm_error *error); 1548d30ea906Sjfb8856606 1549d30ea906Sjfb8856606 /** 1550d30ea906Sjfb8856606 * Traffic manager node add 1551d30ea906Sjfb8856606 * 1552d30ea906Sjfb8856606 * Create new node and connect it as child of an existing node. The new node is 1553d30ea906Sjfb8856606 * further identified by *node_id*, which needs to be unused by any of the 1554d30ea906Sjfb8856606 * existing nodes. The parent node is identified by *parent_node_id*, which 1555d30ea906Sjfb8856606 * needs to be the valid ID of an existing non-leaf node. The parent node is 1556d30ea906Sjfb8856606 * going to use the provided SP *priority* and WFQ *weight* to schedule its new 1557d30ea906Sjfb8856606 * child node. 1558d30ea906Sjfb8856606 * 1559d30ea906Sjfb8856606 * This function has to be called for both leaf and non-leaf nodes. In the case 1560d30ea906Sjfb8856606 * of leaf nodes (i.e. *node_id* is within the range of 0 .. (N-1), with N as 1561d30ea906Sjfb8856606 * the number of configured TX queues of the current port), the leaf node is 1562d30ea906Sjfb8856606 * configured rather than created (as the set of leaf nodes is predefined) and 1563d30ea906Sjfb8856606 * it is also connected as child of an existing node. 1564d30ea906Sjfb8856606 * 1565d30ea906Sjfb8856606 * The first node that is added becomes the root node and all the nodes that 1566d30ea906Sjfb8856606 * are subsequently added have to be added as descendants of the root node. The 1567d30ea906Sjfb8856606 * parent of the root node has to be specified as RTE_TM_NODE_ID_NULL and there 1568d30ea906Sjfb8856606 * can only be one node with this parent ID (i.e. the root node). Further 1569d30ea906Sjfb8856606 * restrictions for root node: needs to be non-leaf, its private shaper profile 1570d30ea906Sjfb8856606 * needs to be valid and single rate, cannot use any shared shapers. 1571d30ea906Sjfb8856606 * 1572d30ea906Sjfb8856606 * When called before rte_tm_hierarchy_commit() invocation, this function is 1573d30ea906Sjfb8856606 * typically used to define the initial start-up hierarchy for the port. 1574d30ea906Sjfb8856606 * Provided that dynamic hierarchy updates are supported by the current port (as 1575d30ea906Sjfb8856606 * advertised in the port capability set), this function can be also called 1576d30ea906Sjfb8856606 * after the rte_tm_hierarchy_commit() invocation. 1577d30ea906Sjfb8856606 * 1578d30ea906Sjfb8856606 * @param[in] port_id 1579d30ea906Sjfb8856606 * The port identifier of the Ethernet device. 1580d30ea906Sjfb8856606 * @param[in] node_id 1581d30ea906Sjfb8856606 * Node ID. Needs to be unused by any of the existing nodes. 1582d30ea906Sjfb8856606 * @param[in] parent_node_id 1583d30ea906Sjfb8856606 * Parent node ID. Needs to be the valid. 1584d30ea906Sjfb8856606 * @param[in] priority 1585d30ea906Sjfb8856606 * Node priority. The highest node priority is zero. Used by the SP algorithm 1586d30ea906Sjfb8856606 * running on the parent of the current node for scheduling this child node. 1587d30ea906Sjfb8856606 * @param[in] weight 1588d30ea906Sjfb8856606 * Node weight. The node weight is relative to the weight sum of all siblings 1589d30ea906Sjfb8856606 * that have the same priority. The lowest weight is one. Used by the WFQ 1590d30ea906Sjfb8856606 * algorithm running on the parent of the current node for scheduling this 1591d30ea906Sjfb8856606 * child node. 1592d30ea906Sjfb8856606 * @param[in] level_id 1593d30ea906Sjfb8856606 * Level ID that should be met by this node. The hierarchy level of the 1594d30ea906Sjfb8856606 * current node is already fully specified through its parent node (i.e. the 1595d30ea906Sjfb8856606 * level of this node is equal to the level of its parent node plus one), 1596d30ea906Sjfb8856606 * therefore the reason for providing this parameter is to enable the 1597d30ea906Sjfb8856606 * application to perform step-by-step checking of the node level during 1598d30ea906Sjfb8856606 * successive invocations of this function. When not desired, this check can 1599d30ea906Sjfb8856606 * be disabled by assigning value RTE_TM_NODE_LEVEL_ID_ANY to this parameter. 1600d30ea906Sjfb8856606 * @param[in] params 1601d30ea906Sjfb8856606 * Node parameters. Needs to be pre-allocated and valid. 1602d30ea906Sjfb8856606 * @param[out] error 1603d30ea906Sjfb8856606 * Error details. Filled in only on error, when not NULL. 1604d30ea906Sjfb8856606 * @return 1605d30ea906Sjfb8856606 * 0 on success, non-zero error code otherwise. 1606d30ea906Sjfb8856606 * 1607d30ea906Sjfb8856606 * @see rte_tm_hierarchy_commit() 1608d30ea906Sjfb8856606 * @see RTE_TM_UPDATE_NODE_ADD_DELETE 1609d30ea906Sjfb8856606 * @see RTE_TM_NODE_LEVEL_ID_ANY 1610d30ea906Sjfb8856606 * @see struct rte_tm_capabilities 1611d30ea906Sjfb8856606 */ 1612*2d9fd380Sjfb8856606 __rte_experimental 1613d30ea906Sjfb8856606 int 1614d30ea906Sjfb8856606 rte_tm_node_add(uint16_t port_id, 1615d30ea906Sjfb8856606 uint32_t node_id, 1616d30ea906Sjfb8856606 uint32_t parent_node_id, 1617d30ea906Sjfb8856606 uint32_t priority, 1618d30ea906Sjfb8856606 uint32_t weight, 1619d30ea906Sjfb8856606 uint32_t level_id, 1620d30ea906Sjfb8856606 struct rte_tm_node_params *params, 1621d30ea906Sjfb8856606 struct rte_tm_error *error); 1622d30ea906Sjfb8856606 1623d30ea906Sjfb8856606 /** 1624d30ea906Sjfb8856606 * Traffic manager node delete 1625d30ea906Sjfb8856606 * 1626d30ea906Sjfb8856606 * Delete an existing node. This operation fails when this node currently has 1627d30ea906Sjfb8856606 * at least one user (i.e. child node). 1628d30ea906Sjfb8856606 * 1629d30ea906Sjfb8856606 * When called before rte_tm_hierarchy_commit() invocation, this function is 1630d30ea906Sjfb8856606 * typically used to define the initial start-up hierarchy for the port. 1631d30ea906Sjfb8856606 * Provided that dynamic hierarchy updates are supported by the current port (as 1632d30ea906Sjfb8856606 * advertised in the port capability set), this function can be also called 1633d30ea906Sjfb8856606 * after the rte_tm_hierarchy_commit() invocation. 1634d30ea906Sjfb8856606 * 1635d30ea906Sjfb8856606 * @param[in] port_id 1636d30ea906Sjfb8856606 * The port identifier of the Ethernet device. 1637d30ea906Sjfb8856606 * @param[in] node_id 1638d30ea906Sjfb8856606 * Node ID. Needs to be valid. 1639d30ea906Sjfb8856606 * @param[out] error 1640d30ea906Sjfb8856606 * Error details. Filled in only on error, when not NULL. 1641d30ea906Sjfb8856606 * @return 1642d30ea906Sjfb8856606 * 0 on success, non-zero error code otherwise. 1643d30ea906Sjfb8856606 * 1644d30ea906Sjfb8856606 * @see RTE_TM_UPDATE_NODE_ADD_DELETE 1645d30ea906Sjfb8856606 */ 1646*2d9fd380Sjfb8856606 __rte_experimental 1647d30ea906Sjfb8856606 int 1648d30ea906Sjfb8856606 rte_tm_node_delete(uint16_t port_id, 1649d30ea906Sjfb8856606 uint32_t node_id, 1650d30ea906Sjfb8856606 struct rte_tm_error *error); 1651d30ea906Sjfb8856606 1652d30ea906Sjfb8856606 /** 1653d30ea906Sjfb8856606 * Traffic manager node suspend 1654d30ea906Sjfb8856606 * 1655d30ea906Sjfb8856606 * Suspend an existing node. While the node is in suspended state, no packet is 1656d30ea906Sjfb8856606 * scheduled from this node and its descendants. The node exits the suspended 1657d30ea906Sjfb8856606 * state through the node resume operation. 1658d30ea906Sjfb8856606 * 1659d30ea906Sjfb8856606 * @param[in] port_id 1660d30ea906Sjfb8856606 * The port identifier of the Ethernet device. 1661d30ea906Sjfb8856606 * @param[in] node_id 1662d30ea906Sjfb8856606 * Node ID. Needs to be valid. 1663d30ea906Sjfb8856606 * @param[out] error 1664d30ea906Sjfb8856606 * Error details. Filled in only on error, when not NULL. 1665d30ea906Sjfb8856606 * @return 1666d30ea906Sjfb8856606 * 0 on success, non-zero error code otherwise. 1667d30ea906Sjfb8856606 * 1668d30ea906Sjfb8856606 * @see rte_tm_node_resume() 1669d30ea906Sjfb8856606 * @see RTE_TM_UPDATE_NODE_SUSPEND_RESUME 1670d30ea906Sjfb8856606 */ 1671*2d9fd380Sjfb8856606 __rte_experimental 1672d30ea906Sjfb8856606 int 1673d30ea906Sjfb8856606 rte_tm_node_suspend(uint16_t port_id, 1674d30ea906Sjfb8856606 uint32_t node_id, 1675d30ea906Sjfb8856606 struct rte_tm_error *error); 1676d30ea906Sjfb8856606 1677d30ea906Sjfb8856606 /** 1678d30ea906Sjfb8856606 * Traffic manager node resume 1679d30ea906Sjfb8856606 * 1680d30ea906Sjfb8856606 * Resume an existing node that is currently in suspended state. The node 1681d30ea906Sjfb8856606 * entered the suspended state as result of a previous node suspend operation. 1682d30ea906Sjfb8856606 * 1683d30ea906Sjfb8856606 * @param[in] port_id 1684d30ea906Sjfb8856606 * The port identifier of the Ethernet device. 1685d30ea906Sjfb8856606 * @param[in] node_id 1686d30ea906Sjfb8856606 * Node ID. Needs to be valid. 1687d30ea906Sjfb8856606 * @param[out] error 1688d30ea906Sjfb8856606 * Error details. Filled in only on error, when not NULL. 1689d30ea906Sjfb8856606 * @return 1690d30ea906Sjfb8856606 * 0 on success, non-zero error code otherwise. 1691d30ea906Sjfb8856606 * 1692d30ea906Sjfb8856606 * @see rte_tm_node_suspend() 1693d30ea906Sjfb8856606 * @see RTE_TM_UPDATE_NODE_SUSPEND_RESUME 1694d30ea906Sjfb8856606 */ 1695*2d9fd380Sjfb8856606 __rte_experimental 1696d30ea906Sjfb8856606 int 1697d30ea906Sjfb8856606 rte_tm_node_resume(uint16_t port_id, 1698d30ea906Sjfb8856606 uint32_t node_id, 1699d30ea906Sjfb8856606 struct rte_tm_error *error); 1700d30ea906Sjfb8856606 1701d30ea906Sjfb8856606 /** 1702d30ea906Sjfb8856606 * Traffic manager hierarchy commit 1703d30ea906Sjfb8856606 * 1704d30ea906Sjfb8856606 * This function is called during the port initialization phase (before the 1705d30ea906Sjfb8856606 * Ethernet port is started) to freeze the start-up hierarchy. 1706d30ea906Sjfb8856606 * 1707d30ea906Sjfb8856606 * This function typically performs the following steps: 1708d30ea906Sjfb8856606 * a) It validates the start-up hierarchy that was previously defined for the 1709d30ea906Sjfb8856606 * current port through successive rte_tm_node_add() invocations; 1710d30ea906Sjfb8856606 * b) Assuming successful validation, it performs all the necessary port 1711d30ea906Sjfb8856606 * specific configuration operations to install the specified hierarchy on 1712d30ea906Sjfb8856606 * the current port, with immediate effect once the port is started. 1713d30ea906Sjfb8856606 * 1714d30ea906Sjfb8856606 * This function fails when the currently configured hierarchy is not supported 1715d30ea906Sjfb8856606 * by the Ethernet port, in which case the user can abort or try out another 1716d30ea906Sjfb8856606 * hierarchy configuration (e.g. a hierarchy with less leaf nodes), which can be 1717d30ea906Sjfb8856606 * build from scratch (when *clear_on_fail* is enabled) or by modifying the 1718d30ea906Sjfb8856606 * existing hierarchy configuration (when *clear_on_fail* is disabled). 1719d30ea906Sjfb8856606 * 1720d30ea906Sjfb8856606 * Note that this function can still fail due to other causes (e.g. not enough 1721d30ea906Sjfb8856606 * memory available in the system, etc), even though the specified hierarchy is 1722d30ea906Sjfb8856606 * supported in principle by the current port. 1723d30ea906Sjfb8856606 * 1724d30ea906Sjfb8856606 * @param[in] port_id 1725d30ea906Sjfb8856606 * The port identifier of the Ethernet device. 1726d30ea906Sjfb8856606 * @param[in] clear_on_fail 1727d30ea906Sjfb8856606 * On function call failure, hierarchy is cleared when this parameter is 1728d30ea906Sjfb8856606 * non-zero and preserved when this parameter is equal to zero. 1729d30ea906Sjfb8856606 * @param[out] error 1730d30ea906Sjfb8856606 * Error details. Filled in only on error, when not NULL. 1731d30ea906Sjfb8856606 * @return 1732d30ea906Sjfb8856606 * 0 on success, non-zero error code otherwise. 1733d30ea906Sjfb8856606 * 1734d30ea906Sjfb8856606 * @see rte_tm_node_add() 1735d30ea906Sjfb8856606 * @see rte_tm_node_delete() 1736d30ea906Sjfb8856606 */ 1737*2d9fd380Sjfb8856606 __rte_experimental 1738d30ea906Sjfb8856606 int 1739d30ea906Sjfb8856606 rte_tm_hierarchy_commit(uint16_t port_id, 1740d30ea906Sjfb8856606 int clear_on_fail, 1741d30ea906Sjfb8856606 struct rte_tm_error *error); 1742d30ea906Sjfb8856606 1743d30ea906Sjfb8856606 /** 1744d30ea906Sjfb8856606 * Traffic manager node parent update 1745d30ea906Sjfb8856606 * 1746d30ea906Sjfb8856606 * This function may be used to move a node and its children to a different 1747d30ea906Sjfb8856606 * parent. Additionally, if the new parent is the same as the current parent, 1748d30ea906Sjfb8856606 * this function will update the priority/weight of an existing node. 1749d30ea906Sjfb8856606 * 1750d30ea906Sjfb8856606 * Restriction for root node: its parent cannot be changed. 1751d30ea906Sjfb8856606 * 1752d30ea906Sjfb8856606 * This function can only be called after the rte_tm_hierarchy_commit() 1753d30ea906Sjfb8856606 * invocation. Its success depends on the port support for this operation, as 1754d30ea906Sjfb8856606 * advertised through the port capability set. 1755d30ea906Sjfb8856606 * 1756d30ea906Sjfb8856606 * @param[in] port_id 1757d30ea906Sjfb8856606 * The port identifier of the Ethernet device. 1758d30ea906Sjfb8856606 * @param[in] node_id 1759d30ea906Sjfb8856606 * Node ID. Needs to be valid. 1760d30ea906Sjfb8856606 * @param[in] parent_node_id 1761d30ea906Sjfb8856606 * Node ID for the new parent. Needs to be valid. 1762d30ea906Sjfb8856606 * @param[in] priority 1763d30ea906Sjfb8856606 * Node priority. The highest node priority is zero. Used by the SP algorithm 1764d30ea906Sjfb8856606 * running on the parent of the current node for scheduling this child node. 1765d30ea906Sjfb8856606 * @param[in] weight 1766d30ea906Sjfb8856606 * Node weight. The node weight is relative to the weight sum of all siblings 1767d30ea906Sjfb8856606 * that have the same priority. The lowest weight is zero. Used by the WFQ 1768d30ea906Sjfb8856606 * algorithm running on the parent of the current node for scheduling this 1769d30ea906Sjfb8856606 * child node. 1770d30ea906Sjfb8856606 * @param[out] error 1771d30ea906Sjfb8856606 * Error details. Filled in only on error, when not NULL. 1772d30ea906Sjfb8856606 * @return 1773d30ea906Sjfb8856606 * 0 on success, non-zero error code otherwise. 1774d30ea906Sjfb8856606 * 1775d30ea906Sjfb8856606 * @see RTE_TM_UPDATE_NODE_PARENT_KEEP_LEVEL 1776d30ea906Sjfb8856606 * @see RTE_TM_UPDATE_NODE_PARENT_CHANGE_LEVEL 1777d30ea906Sjfb8856606 */ 1778*2d9fd380Sjfb8856606 __rte_experimental 1779d30ea906Sjfb8856606 int 1780d30ea906Sjfb8856606 rte_tm_node_parent_update(uint16_t port_id, 1781d30ea906Sjfb8856606 uint32_t node_id, 1782d30ea906Sjfb8856606 uint32_t parent_node_id, 1783d30ea906Sjfb8856606 uint32_t priority, 1784d30ea906Sjfb8856606 uint32_t weight, 1785d30ea906Sjfb8856606 struct rte_tm_error *error); 1786d30ea906Sjfb8856606 1787d30ea906Sjfb8856606 /** 1788d30ea906Sjfb8856606 * Traffic manager node private shaper update 1789d30ea906Sjfb8856606 * 1790d30ea906Sjfb8856606 * Restriction for the root node: its private shaper profile needs to be valid 1791d30ea906Sjfb8856606 * and single rate. 1792d30ea906Sjfb8856606 * 1793d30ea906Sjfb8856606 * @param[in] port_id 1794d30ea906Sjfb8856606 * The port identifier of the Ethernet device. 1795d30ea906Sjfb8856606 * @param[in] node_id 1796d30ea906Sjfb8856606 * Node ID. Needs to be valid. 1797d30ea906Sjfb8856606 * @param[in] shaper_profile_id 1798d30ea906Sjfb8856606 * Shaper profile ID for the private shaper of the current node. Needs to be 1799d30ea906Sjfb8856606 * either valid shaper profile ID or RTE_TM_SHAPER_PROFILE_ID_NONE, with 1800d30ea906Sjfb8856606 * the latter disabling the private shaper of the current node. 1801d30ea906Sjfb8856606 * @param[out] error 1802d30ea906Sjfb8856606 * Error details. Filled in only on error, when not NULL. 1803d30ea906Sjfb8856606 * @return 1804d30ea906Sjfb8856606 * 0 on success, non-zero error code otherwise. 1805d30ea906Sjfb8856606 * 1806d30ea906Sjfb8856606 * @see struct rte_tm_capabilities::shaper_private_n_max 1807d30ea906Sjfb8856606 */ 1808*2d9fd380Sjfb8856606 __rte_experimental 1809d30ea906Sjfb8856606 int 1810d30ea906Sjfb8856606 rte_tm_node_shaper_update(uint16_t port_id, 1811d30ea906Sjfb8856606 uint32_t node_id, 1812d30ea906Sjfb8856606 uint32_t shaper_profile_id, 1813d30ea906Sjfb8856606 struct rte_tm_error *error); 1814d30ea906Sjfb8856606 1815d30ea906Sjfb8856606 /** 1816d30ea906Sjfb8856606 * Traffic manager node shared shapers update 1817d30ea906Sjfb8856606 * 1818d30ea906Sjfb8856606 * Restriction for root node: cannot use any shared rate shapers. 1819d30ea906Sjfb8856606 * 1820d30ea906Sjfb8856606 * @param[in] port_id 1821d30ea906Sjfb8856606 * The port identifier of the Ethernet device. 1822d30ea906Sjfb8856606 * @param[in] node_id 1823d30ea906Sjfb8856606 * Node ID. Needs to be valid. 1824d30ea906Sjfb8856606 * @param[in] shared_shaper_id 1825d30ea906Sjfb8856606 * Shared shaper ID. Needs to be valid. 1826d30ea906Sjfb8856606 * @param[in] add 1827d30ea906Sjfb8856606 * Set to non-zero value to add this shared shaper to current node or to zero 1828d30ea906Sjfb8856606 * to delete this shared shaper from current node. 1829d30ea906Sjfb8856606 * @param[out] error 1830d30ea906Sjfb8856606 * Error details. Filled in only on error, when not NULL. 1831d30ea906Sjfb8856606 * @return 1832d30ea906Sjfb8856606 * 0 on success, non-zero error code otherwise. 1833d30ea906Sjfb8856606 * 1834d30ea906Sjfb8856606 * @see struct rte_tm_capabilities::shaper_shared_n_max 1835d30ea906Sjfb8856606 */ 1836*2d9fd380Sjfb8856606 __rte_experimental 1837d30ea906Sjfb8856606 int 1838d30ea906Sjfb8856606 rte_tm_node_shared_shaper_update(uint16_t port_id, 1839d30ea906Sjfb8856606 uint32_t node_id, 1840d30ea906Sjfb8856606 uint32_t shared_shaper_id, 1841d30ea906Sjfb8856606 int add, 1842d30ea906Sjfb8856606 struct rte_tm_error *error); 1843d30ea906Sjfb8856606 1844d30ea906Sjfb8856606 /** 1845d30ea906Sjfb8856606 * Traffic manager node enabled statistics counters update 1846d30ea906Sjfb8856606 * 1847d30ea906Sjfb8856606 * @param[in] port_id 1848d30ea906Sjfb8856606 * The port identifier of the Ethernet device. 1849d30ea906Sjfb8856606 * @param[in] node_id 1850d30ea906Sjfb8856606 * Node ID. Needs to be valid. 1851d30ea906Sjfb8856606 * @param[in] stats_mask 1852d30ea906Sjfb8856606 * Mask of statistics counter types to be enabled for the current node. This 1853d30ea906Sjfb8856606 * needs to be a subset of the statistics counter types available for the 1854d30ea906Sjfb8856606 * current node. Any statistics counter type not included in this set is to 1855d30ea906Sjfb8856606 * be disabled for the current node. 1856d30ea906Sjfb8856606 * @param[out] error 1857d30ea906Sjfb8856606 * Error details. Filled in only on error, when not NULL. 1858d30ea906Sjfb8856606 * @return 1859d30ea906Sjfb8856606 * 0 on success, non-zero error code otherwise. 1860d30ea906Sjfb8856606 * 1861d30ea906Sjfb8856606 * @see enum rte_tm_stats_type 1862d30ea906Sjfb8856606 * @see RTE_TM_UPDATE_NODE_STATS 1863d30ea906Sjfb8856606 */ 1864*2d9fd380Sjfb8856606 __rte_experimental 1865d30ea906Sjfb8856606 int 1866d30ea906Sjfb8856606 rte_tm_node_stats_update(uint16_t port_id, 1867d30ea906Sjfb8856606 uint32_t node_id, 1868d30ea906Sjfb8856606 uint64_t stats_mask, 1869d30ea906Sjfb8856606 struct rte_tm_error *error); 1870d30ea906Sjfb8856606 1871d30ea906Sjfb8856606 /** 1872d30ea906Sjfb8856606 * Traffic manager node WFQ weight mode update 1873d30ea906Sjfb8856606 * 1874d30ea906Sjfb8856606 * @param[in] port_id 1875d30ea906Sjfb8856606 * The port identifier of the Ethernet device. 1876d30ea906Sjfb8856606 * @param[in] node_id 1877d30ea906Sjfb8856606 * Node ID. Needs to be valid non-leaf node ID. 1878d30ea906Sjfb8856606 * @param[in] wfq_weight_mode 1879d30ea906Sjfb8856606 * WFQ weight mode for each SP priority. When NULL, it indicates that WFQ is 1880d30ea906Sjfb8856606 * to be used for all priorities. When non-NULL, it points to a pre-allocated 1881d30ea906Sjfb8856606 * array of *n_sp_priorities* values, with non-zero value for byte-mode and 1882d30ea906Sjfb8856606 * zero for packet-mode. 1883d30ea906Sjfb8856606 * @param[in] n_sp_priorities 1884d30ea906Sjfb8856606 * Number of SP priorities. 1885d30ea906Sjfb8856606 * @param[out] error 1886d30ea906Sjfb8856606 * Error details. Filled in only on error, when not NULL. 1887d30ea906Sjfb8856606 * @return 1888d30ea906Sjfb8856606 * 0 on success, non-zero error code otherwise. 1889d30ea906Sjfb8856606 * 1890d30ea906Sjfb8856606 * @see RTE_TM_UPDATE_NODE_WFQ_WEIGHT_MODE 1891d30ea906Sjfb8856606 * @see RTE_TM_UPDATE_NODE_N_SP_PRIORITIES 1892d30ea906Sjfb8856606 */ 1893*2d9fd380Sjfb8856606 __rte_experimental 1894d30ea906Sjfb8856606 int 1895d30ea906Sjfb8856606 rte_tm_node_wfq_weight_mode_update(uint16_t port_id, 1896d30ea906Sjfb8856606 uint32_t node_id, 1897d30ea906Sjfb8856606 int *wfq_weight_mode, 1898d30ea906Sjfb8856606 uint32_t n_sp_priorities, 1899d30ea906Sjfb8856606 struct rte_tm_error *error); 1900d30ea906Sjfb8856606 1901d30ea906Sjfb8856606 /** 1902d30ea906Sjfb8856606 * Traffic manager node congestion management mode update 1903d30ea906Sjfb8856606 * 1904d30ea906Sjfb8856606 * @param[in] port_id 1905d30ea906Sjfb8856606 * The port identifier of the Ethernet device. 1906d30ea906Sjfb8856606 * @param[in] node_id 1907d30ea906Sjfb8856606 * Node ID. Needs to be valid leaf node ID. 1908d30ea906Sjfb8856606 * @param[in] cman 1909d30ea906Sjfb8856606 * Congestion management mode. 1910d30ea906Sjfb8856606 * @param[out] error 1911d30ea906Sjfb8856606 * Error details. Filled in only on error, when not NULL. 1912d30ea906Sjfb8856606 * @return 1913d30ea906Sjfb8856606 * 0 on success, non-zero error code otherwise. 1914d30ea906Sjfb8856606 * 1915d30ea906Sjfb8856606 * @see RTE_TM_UPDATE_NODE_CMAN 1916d30ea906Sjfb8856606 */ 1917*2d9fd380Sjfb8856606 __rte_experimental 1918d30ea906Sjfb8856606 int 1919d30ea906Sjfb8856606 rte_tm_node_cman_update(uint16_t port_id, 1920d30ea906Sjfb8856606 uint32_t node_id, 1921d30ea906Sjfb8856606 enum rte_tm_cman_mode cman, 1922d30ea906Sjfb8856606 struct rte_tm_error *error); 1923d30ea906Sjfb8856606 1924d30ea906Sjfb8856606 /** 1925d30ea906Sjfb8856606 * Traffic manager node private WRED context update 1926d30ea906Sjfb8856606 * 1927d30ea906Sjfb8856606 * @param[in] port_id 1928d30ea906Sjfb8856606 * The port identifier of the Ethernet device. 1929d30ea906Sjfb8856606 * @param[in] node_id 1930d30ea906Sjfb8856606 * Node ID. Needs to be valid leaf node ID. 1931d30ea906Sjfb8856606 * @param[in] wred_profile_id 1932d30ea906Sjfb8856606 * WRED profile ID for the private WRED context of the current node. Needs to 1933d30ea906Sjfb8856606 * be either valid WRED profile ID or RTE_TM_WRED_PROFILE_ID_NONE, with the 1934d30ea906Sjfb8856606 * latter disabling the private WRED context of the current node. 1935d30ea906Sjfb8856606 * @param[out] error 1936d30ea906Sjfb8856606 * Error details. Filled in only on error, when not NULL. 1937d30ea906Sjfb8856606 * @return 1938d30ea906Sjfb8856606 * 0 on success, non-zero error code otherwise. 1939d30ea906Sjfb8856606 * 1940d30ea906Sjfb8856606 * @see struct rte_tm_capabilities::cman_wred_context_private_n_max 1941d30ea906Sjfb8856606 */ 1942*2d9fd380Sjfb8856606 __rte_experimental 1943d30ea906Sjfb8856606 int 1944d30ea906Sjfb8856606 rte_tm_node_wred_context_update(uint16_t port_id, 1945d30ea906Sjfb8856606 uint32_t node_id, 1946d30ea906Sjfb8856606 uint32_t wred_profile_id, 1947d30ea906Sjfb8856606 struct rte_tm_error *error); 1948d30ea906Sjfb8856606 1949d30ea906Sjfb8856606 /** 1950d30ea906Sjfb8856606 * Traffic manager node shared WRED context update 1951d30ea906Sjfb8856606 * 1952d30ea906Sjfb8856606 * @param[in] port_id 1953d30ea906Sjfb8856606 * The port identifier of the Ethernet device. 1954d30ea906Sjfb8856606 * @param[in] node_id 1955d30ea906Sjfb8856606 * Node ID. Needs to be valid leaf node ID. 1956d30ea906Sjfb8856606 * @param[in] shared_wred_context_id 1957d30ea906Sjfb8856606 * Shared WRED context ID. Needs to be valid. 1958d30ea906Sjfb8856606 * @param[in] add 1959d30ea906Sjfb8856606 * Set to non-zero value to add this shared WRED context to current node or 1960d30ea906Sjfb8856606 * to zero to delete this shared WRED context from current node. 1961d30ea906Sjfb8856606 * @param[out] error 1962d30ea906Sjfb8856606 * Error details. Filled in only on error, when not NULL. 1963d30ea906Sjfb8856606 * @return 1964d30ea906Sjfb8856606 * 0 on success, non-zero error code otherwise. 1965d30ea906Sjfb8856606 * 1966d30ea906Sjfb8856606 * @see struct rte_tm_capabilities::cman_wred_context_shared_n_max 1967d30ea906Sjfb8856606 */ 1968*2d9fd380Sjfb8856606 __rte_experimental 1969d30ea906Sjfb8856606 int 1970d30ea906Sjfb8856606 rte_tm_node_shared_wred_context_update(uint16_t port_id, 1971d30ea906Sjfb8856606 uint32_t node_id, 1972d30ea906Sjfb8856606 uint32_t shared_wred_context_id, 1973d30ea906Sjfb8856606 int add, 1974d30ea906Sjfb8856606 struct rte_tm_error *error); 1975d30ea906Sjfb8856606 1976d30ea906Sjfb8856606 /** 1977d30ea906Sjfb8856606 * Traffic manager node statistics counters read 1978d30ea906Sjfb8856606 * 1979d30ea906Sjfb8856606 * @param[in] port_id 1980d30ea906Sjfb8856606 * The port identifier of the Ethernet device. 1981d30ea906Sjfb8856606 * @param[in] node_id 1982d30ea906Sjfb8856606 * Node ID. Needs to be valid. 1983d30ea906Sjfb8856606 * @param[out] stats 1984d30ea906Sjfb8856606 * When non-NULL, it contains the current value for the statistics counters 1985d30ea906Sjfb8856606 * enabled for the current node. 1986d30ea906Sjfb8856606 * @param[out] stats_mask 1987d30ea906Sjfb8856606 * When non-NULL, it contains the mask of statistics counter types that are 1988d30ea906Sjfb8856606 * currently enabled for this node, indicating which of the counters 1989d30ea906Sjfb8856606 * retrieved with the *stats* structure are valid. 1990d30ea906Sjfb8856606 * @param[in] clear 1991d30ea906Sjfb8856606 * When this parameter has a non-zero value, the statistics counters are 1992d30ea906Sjfb8856606 * cleared (i.e. set to zero) immediately after they have been read, 1993d30ea906Sjfb8856606 * otherwise the statistics counters are left untouched. 1994d30ea906Sjfb8856606 * @param[out] error 1995d30ea906Sjfb8856606 * Error details. Filled in only on error, when not NULL. 1996d30ea906Sjfb8856606 * @return 1997d30ea906Sjfb8856606 * 0 on success, non-zero error code otherwise. 1998d30ea906Sjfb8856606 * 1999d30ea906Sjfb8856606 * @see enum rte_tm_stats_type 2000d30ea906Sjfb8856606 */ 2001*2d9fd380Sjfb8856606 __rte_experimental 2002d30ea906Sjfb8856606 int 2003d30ea906Sjfb8856606 rte_tm_node_stats_read(uint16_t port_id, 2004d30ea906Sjfb8856606 uint32_t node_id, 2005d30ea906Sjfb8856606 struct rte_tm_node_stats *stats, 2006d30ea906Sjfb8856606 uint64_t *stats_mask, 2007d30ea906Sjfb8856606 int clear, 2008d30ea906Sjfb8856606 struct rte_tm_error *error); 2009d30ea906Sjfb8856606 2010d30ea906Sjfb8856606 /** 2011d30ea906Sjfb8856606 * Traffic manager packet marking - VLAN DEI (IEEE 802.1Q) 2012d30ea906Sjfb8856606 * 2013d30ea906Sjfb8856606 * IEEE 802.1p maps the traffic class to the VLAN Priority Code Point (PCP) 2014d30ea906Sjfb8856606 * field (3 bits), while IEEE 802.1q maps the drop priority to the VLAN Drop 2015d30ea906Sjfb8856606 * Eligible Indicator (DEI) field (1 bit), which was previously named Canonical 2016d30ea906Sjfb8856606 * Format Indicator (CFI). 2017d30ea906Sjfb8856606 * 2018d30ea906Sjfb8856606 * All VLAN frames of a given color get their DEI bit set if marking is enabled 2019d30ea906Sjfb8856606 * for this color; otherwise, their DEI bit is left as is (either set or not). 2020d30ea906Sjfb8856606 * 2021d30ea906Sjfb8856606 * @param[in] port_id 2022d30ea906Sjfb8856606 * The port identifier of the Ethernet device. 2023d30ea906Sjfb8856606 * @param[in] mark_green 2024d30ea906Sjfb8856606 * Set to non-zero value to enable marking of green packets and to zero to 2025d30ea906Sjfb8856606 * disable it. 2026d30ea906Sjfb8856606 * @param[in] mark_yellow 2027d30ea906Sjfb8856606 * Set to non-zero value to enable marking of yellow packets and to zero to 2028d30ea906Sjfb8856606 * disable it. 2029d30ea906Sjfb8856606 * @param[in] mark_red 2030d30ea906Sjfb8856606 * Set to non-zero value to enable marking of red packets and to zero to 2031d30ea906Sjfb8856606 * disable it. 2032d30ea906Sjfb8856606 * @param[out] error 2033d30ea906Sjfb8856606 * Error details. Filled in only on error, when not NULL. 2034d30ea906Sjfb8856606 * @return 2035d30ea906Sjfb8856606 * 0 on success, non-zero error code otherwise. 2036d30ea906Sjfb8856606 * 2037d30ea906Sjfb8856606 * @see struct rte_tm_capabilities::mark_vlan_dei_supported 2038d30ea906Sjfb8856606 */ 2039*2d9fd380Sjfb8856606 __rte_experimental 2040d30ea906Sjfb8856606 int 2041d30ea906Sjfb8856606 rte_tm_mark_vlan_dei(uint16_t port_id, 2042d30ea906Sjfb8856606 int mark_green, 2043d30ea906Sjfb8856606 int mark_yellow, 2044d30ea906Sjfb8856606 int mark_red, 2045d30ea906Sjfb8856606 struct rte_tm_error *error); 2046d30ea906Sjfb8856606 2047d30ea906Sjfb8856606 /** 2048d30ea906Sjfb8856606 * Traffic manager packet marking - IPv4 / IPv6 ECN (IETF RFC 3168) 2049d30ea906Sjfb8856606 * 2050d30ea906Sjfb8856606 * IETF RFCs 2474 and 3168 reorganize the IPv4 Type of Service (TOS) field 2051d30ea906Sjfb8856606 * (8 bits) and the IPv6 Traffic Class (TC) field (8 bits) into Differentiated 2052d30ea906Sjfb8856606 * Services Codepoint (DSCP) field (6 bits) and Explicit Congestion 2053d30ea906Sjfb8856606 * Notification (ECN) field (2 bits). The DSCP field is typically used to 2054d30ea906Sjfb8856606 * encode the traffic class and/or drop priority (RFC 2597), while the ECN 2055d30ea906Sjfb8856606 * field is used by RFC 3168 to implement a congestion notification mechanism 2056d30ea906Sjfb8856606 * to be leveraged by transport layer protocols such as TCP and SCTP that have 2057d30ea906Sjfb8856606 * congestion control mechanisms. 2058d30ea906Sjfb8856606 * 2059d30ea906Sjfb8856606 * When congestion is experienced, as alternative to dropping the packet, 2060d30ea906Sjfb8856606 * routers can change the ECN field of input packets from 2'b01 or 2'b10 2061d30ea906Sjfb8856606 * (values indicating that source endpoint is ECN-capable) to 2'b11 (meaning 2062d30ea906Sjfb8856606 * that congestion is experienced). The destination endpoint can use the 2063d30ea906Sjfb8856606 * ECN-Echo (ECE) TCP flag to relay the congestion indication back to the 2064d30ea906Sjfb8856606 * source endpoint, which acknowledges it back to the destination endpoint with 2065d30ea906Sjfb8856606 * the Congestion Window Reduced (CWR) TCP flag. 2066d30ea906Sjfb8856606 * 2067d30ea906Sjfb8856606 * All IPv4/IPv6 packets of a given color with ECN set to 2’b01 or 2’b10 2068d30ea906Sjfb8856606 * carrying TCP or SCTP have their ECN set to 2’b11 if the marking feature is 2069d30ea906Sjfb8856606 * enabled for the current color, otherwise the ECN field is left as is. 2070d30ea906Sjfb8856606 * 2071d30ea906Sjfb8856606 * @param[in] port_id 2072d30ea906Sjfb8856606 * The port identifier of the Ethernet device. 2073d30ea906Sjfb8856606 * @param[in] mark_green 2074d30ea906Sjfb8856606 * Set to non-zero value to enable marking of green packets and to zero to 2075d30ea906Sjfb8856606 * disable it. 2076d30ea906Sjfb8856606 * @param[in] mark_yellow 2077d30ea906Sjfb8856606 * Set to non-zero value to enable marking of yellow packets and to zero to 2078d30ea906Sjfb8856606 * disable it. 2079d30ea906Sjfb8856606 * @param[in] mark_red 2080d30ea906Sjfb8856606 * Set to non-zero value to enable marking of red packets and to zero to 2081d30ea906Sjfb8856606 * disable it. 2082d30ea906Sjfb8856606 * @param[out] error 2083d30ea906Sjfb8856606 * Error details. Filled in only on error, when not NULL. 2084d30ea906Sjfb8856606 * @return 2085d30ea906Sjfb8856606 * 0 on success, non-zero error code otherwise. 2086d30ea906Sjfb8856606 * 2087d30ea906Sjfb8856606 * @see struct rte_tm_capabilities::mark_ip_ecn_tcp_supported 2088d30ea906Sjfb8856606 * @see struct rte_tm_capabilities::mark_ip_ecn_sctp_supported 2089d30ea906Sjfb8856606 */ 2090*2d9fd380Sjfb8856606 __rte_experimental 2091d30ea906Sjfb8856606 int 2092d30ea906Sjfb8856606 rte_tm_mark_ip_ecn(uint16_t port_id, 2093d30ea906Sjfb8856606 int mark_green, 2094d30ea906Sjfb8856606 int mark_yellow, 2095d30ea906Sjfb8856606 int mark_red, 2096d30ea906Sjfb8856606 struct rte_tm_error *error); 2097d30ea906Sjfb8856606 2098d30ea906Sjfb8856606 /** 2099d30ea906Sjfb8856606 * Traffic manager packet marking - IPv4 / IPv6 DSCP (IETF RFC 2597) 2100d30ea906Sjfb8856606 * 2101d30ea906Sjfb8856606 * IETF RFC 2597 maps the traffic class and the drop priority to the IPv4/IPv6 2102d30ea906Sjfb8856606 * Differentiated Services Codepoint (DSCP) field (6 bits). Here are the DSCP 2103d30ea906Sjfb8856606 * values proposed by this RFC: 2104d30ea906Sjfb8856606 * 2105d30ea906Sjfb8856606 * <pre> Class 1 Class 2 Class 3 Class 4 </pre> 2106d30ea906Sjfb8856606 * <pre> +----------+----------+----------+----------+</pre> 2107d30ea906Sjfb8856606 * <pre>Low Drop Prec | 001010 | 010010 | 011010 | 100010 |</pre> 2108d30ea906Sjfb8856606 * <pre>Medium Drop Prec | 001100 | 010100 | 011100 | 100100 |</pre> 2109d30ea906Sjfb8856606 * <pre>High Drop Prec | 001110 | 010110 | 011110 | 100110 |</pre> 2110d30ea906Sjfb8856606 * <pre> +----------+----------+----------+----------+</pre> 2111d30ea906Sjfb8856606 * 2112d30ea906Sjfb8856606 * There are 4 traffic classes (classes 1 .. 4) encoded by DSCP bits 1 and 2, 2113d30ea906Sjfb8856606 * as well as 3 drop priorities (low/medium/high) encoded by DSCP bits 3 and 4. 2114d30ea906Sjfb8856606 * 2115d30ea906Sjfb8856606 * All IPv4/IPv6 packets have their color marked into DSCP bits 3 and 4 as 2116d30ea906Sjfb8856606 * follows: green mapped to Low Drop Precedence (2’b01), yellow to Medium 2117d30ea906Sjfb8856606 * (2’b10) and red to High (2’b11). Marking needs to be explicitly enabled 2118d30ea906Sjfb8856606 * for each color; when not enabled for a given color, the DSCP field of all 2119d30ea906Sjfb8856606 * packets with that color is left as is. 2120d30ea906Sjfb8856606 * 2121d30ea906Sjfb8856606 * @param[in] port_id 2122d30ea906Sjfb8856606 * The port identifier of the Ethernet device. 2123d30ea906Sjfb8856606 * @param[in] mark_green 2124d30ea906Sjfb8856606 * Set to non-zero value to enable marking of green packets and to zero to 2125d30ea906Sjfb8856606 * disable it. 2126d30ea906Sjfb8856606 * @param[in] mark_yellow 2127d30ea906Sjfb8856606 * Set to non-zero value to enable marking of yellow packets and to zero to 2128d30ea906Sjfb8856606 * disable it. 2129d30ea906Sjfb8856606 * @param[in] mark_red 2130d30ea906Sjfb8856606 * Set to non-zero value to enable marking of red packets and to zero to 2131d30ea906Sjfb8856606 * disable it. 2132d30ea906Sjfb8856606 * @param[out] error 2133d30ea906Sjfb8856606 * Error details. Filled in only on error, when not NULL. 2134d30ea906Sjfb8856606 * @return 2135d30ea906Sjfb8856606 * 0 on success, non-zero error code otherwise. 2136d30ea906Sjfb8856606 * 2137d30ea906Sjfb8856606 * @see struct rte_tm_capabilities::mark_ip_dscp_supported 2138d30ea906Sjfb8856606 */ 2139*2d9fd380Sjfb8856606 __rte_experimental 2140d30ea906Sjfb8856606 int 2141d30ea906Sjfb8856606 rte_tm_mark_ip_dscp(uint16_t port_id, 2142d30ea906Sjfb8856606 int mark_green, 2143d30ea906Sjfb8856606 int mark_yellow, 2144d30ea906Sjfb8856606 int mark_red, 2145d30ea906Sjfb8856606 struct rte_tm_error *error); 2146d30ea906Sjfb8856606 2147d30ea906Sjfb8856606 #ifdef __cplusplus 2148d30ea906Sjfb8856606 } 2149d30ea906Sjfb8856606 #endif 2150d30ea906Sjfb8856606 2151d30ea906Sjfb8856606 #endif /* __INCLUDE_RTE_TM_H__ */ 2152