ecn.h (12217B)
1 /* 2 * 3 * 4 * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file. 5 * 6 * Copyright 2007-2020 Broadcom Inc. All rights reserved. 7 * 8 * DO NOT EDIT THIS FILE! 9 * This file is auto-generated. 10 * Edits to this file will be lost when it is regenerated. 11 */ 12 13 #ifndef __BCM_ECN_H__ 14 #define __BCM_ECN_H__ 15 16 #include <bcm/types.h> 17 18 /* ECN traffic map flag. */ 19 #define BCM_ECN_TRAFFIC_MAP_RESPONSIVE (1 << 0) /* 1: Responsive, 0: 20 Non-responsive. */ 21 22 /* ECN traffic map info. */ 23 typedef struct bcm_ecn_traffic_map_info_s { 24 uint32 flags; /* BCM_ECN_TRAFFIC_MAP_XXX flag definitions. */ 25 uint8 ecn; /* ECN value of packet's IP header. */ 26 int int_cn; /* Mapped internal congestion notification(int_cn) value. */ 27 } bcm_ecn_traffic_map_info_t; 28 29 /* ECN traffic action types */ 30 #define BCM_ECN_TRAFFIC_ACTION_TYPE_ENQUEUE (0x1) /* Action of enqueue 31 stage. */ 32 #define BCM_ECN_TRAFFIC_ACTION_TYPE_DEQUEUE (0x2) /* Action of dequeue 33 stage. */ 34 #define BCM_ECN_TRAFFIC_ACTION_TYPE_EGRESS (0x3) /* Action of egress 35 stage. */ 36 37 /* ECN traffic action flags */ 38 #define BCM_ECN_TRAFFIC_ACTION_NONE (0x0) /* Action none */ 39 #define BCM_ECN_TRAFFIC_ACTION_ENQUEUE_WRED_RESPONSIVE (1 << 0) /* If set, enabled WRED 40 responsive dropping. 41 Otherwise, enables 42 WRED non-responsive 43 dropping. */ 44 #define BCM_ECN_TRAFFIC_ACTION_ENQUEUE_MARK_ELIGIBLE (1 << 1) /* If set, avoids WRED 45 dropping when ECN 46 marking is enabled. */ 47 #define BCM_ECN_TRAFFIC_ACTION_DEQUEUE_CONGESTION_INT_CN_UPDATE (1 << 2) /* If set, updates the 48 value of int_cn when 49 congestion is 50 experienced. */ 51 #define BCM_ECN_TRAFFIC_ACTION_DEQUEUE_NON_CONGESTION_INT_CN_UPDATE (1 << 3) /* If set, updates the 52 value of int_cn when 53 congestion is not 54 experienced. */ 55 #define BCM_ECN_TRAFFIC_ACTION_EGRESS_ECN_MARKING (1 << 4) /* If set, indicates that 56 the packet's ECN bits 57 need to be updated. */ 58 #define BCM_ECN_TRAFFIC_ACTION_EGRESS_DROP (1 << 5) /* If set, indicates to 59 drop packet in egress. */ 60 #define BCM_ECN_TRAFFIC_ACTION_INGRESS_DROP (1 << 6) /* If set, indicates to 61 drop packet in 62 ingress. */ 63 #define BCM_ECN_TRAFFIC_ACTION_EGRESS_EXP_MARKING (1 << 7) /* If set, indicates to 64 update EXP. */ 65 #define BCM_ECN_TRAFFIC_ACTION_INGRESS_ECN_MARKING (1 << 8) /* If set, indicates to 66 update ECN. */ 67 #define BCM_ECN_TRAFFIC_ACTION_RESPONSIVE (1 << 9) /* If set, indicates to 68 set configurations for 69 ecn responsive 70 traffic. */ 71 72 /* 73 * ECN traffic action configuration. 74 * 75 * Contains information required for assigning the actions of ECN 76 * traffic. 77 */ 78 typedef struct bcm_ecn_traffic_action_config_s { 79 uint32 action_type; /* See BCM_ECN_TRAFFIC_ACTION_TYPE_XXX flag 80 definitions. */ 81 uint32 action_flags; /* See BCM_ECN_TRAFFIC_ACTION_XXX flag 82 definitions. */ 83 int int_cn; /* Internal congestion notification. */ 84 bcm_color_t color; /* Packet color. */ 85 uint8 ecn; /* ECN value of packet;s IP header. */ 86 uint8 new_ecn; /* New ECN value for remarking. */ 87 int congested_int_cn; /* New int_cn to be updated when the congestion 88 is experienced. */ 89 int non_congested_int_cn; /* New int_cn to be updated when the congestion 90 is not experienced. */ 91 int responsive; /* New responsive value to be used in the egress 92 pipeline. */ 93 } bcm_ecn_traffic_action_config_t; 94 95 #ifndef BCM_HIDE_DISPATCHABLE 96 97 /* 98 * To get the value of responsive indication that associated with a 99 * packet based on the IP protocol value. It indicates if the transport 100 * protocol of the packet's IP header is responsive or non-responsive for 101 * the packet drop when congestion is experienced. 102 */ 103 extern int bcm_ecn_responsive_protocol_get( 104 int unit, 105 uint8 ip_proto, 106 int *responsive); 107 108 /* 109 * To configure the value of responsive indication that associated with a 110 * packet based on the IP protocol value. It indicates if the transport 111 * protocol of the packet's IP header is responsive or non-responsive for 112 * the packet drop when congestion is experienced. 113 */ 114 extern int bcm_ecn_responsive_protocol_set( 115 int unit, 116 uint8 ip_proto, 117 int responsive); 118 119 /* 120 * To get the mapped internal congestion notification (int_cn) value 121 * based on the ECN value of packet's IP header and the value of 122 * responsive indication. 123 */ 124 extern int bcm_ecn_traffic_map_get( 125 int unit, 126 bcm_ecn_traffic_map_info_t *map); 127 128 /* 129 * To set the mapped internal congestion notification (int_cn) value 130 * based on the ECN value of packet's IP header and the value of 131 * responsive indication. 132 */ 133 extern int bcm_ecn_traffic_map_set( 134 int unit, 135 bcm_ecn_traffic_map_info_t *map); 136 137 /* 138 * Get the actions of the specified ECN traffic. The ECN traffic is 139 * mapped by the packet's ECN value and internal congestion 140 * notification(int_cn) value. 141 */ 142 extern int bcm_ecn_traffic_action_config_get( 143 int unit, 144 bcm_ecn_traffic_action_config_t *ecn_config); 145 146 /* 147 * Assign the actions to the specified ECN traffic. The ECN traffic is 148 * mapped by the packet's ECN value and internal congestion 149 * notification(int_cn) value. 150 */ 151 extern int bcm_ecn_traffic_action_config_set( 152 int unit, 153 bcm_ecn_traffic_action_config_t *ecn_config); 154 155 #endif /* BCM_HIDE_DISPATCHABLE */ 156 157 /* Initialize an ECN traffic map information structure. */ 158 extern void bcm_ecn_traffic_map_info_t_init( 159 bcm_ecn_traffic_map_info_t *ecn_map); 160 161 /* Initialize an ECN traffic action config structure. */ 162 extern void bcm_ecn_traffic_action_config_t_init( 163 bcm_ecn_traffic_action_config_t *ecn_action); 164 165 /* ECN map flags. */ 166 #define BCM_ECN_MAP_WITH_ID 0x00000001 /* ECN map ID is specified by 167 users */ 168 #define BCM_ECN_MAP_INGRESS 0x00000002 /* create an ingress map used 169 in conjunction with map 170 type */ 171 #define BCM_ECN_MAP_EGRESS 0x00000004 /* create an egress map used 172 in conjunction with map 173 type */ 174 #define BCM_ECN_MAP_MPLS 0x00000008 /* create an MPLS type of map */ 175 #define BCM_ECN_MAP_MPLS_INT_CN_TO_EXP 0x00000010 /* create an INT_CN to EXP 176 map */ 177 #define BCM_ECN_MAP_TUNNEL_TERM 0x00000020 /* create a tunnel term ecn 178 map */ 179 180 #if defined(INCLUDE_L3) 181 /* MPLS ECN Map Structure. */ 182 typedef struct bcm_ecn_map_s { 183 uint32 action_flags; /* action flags for ECN map. */ 184 int int_cn; /* Internal congestion. */ 185 uint8 inner_ecn; /* IP ECN value in payload. */ 186 uint8 ecn; /* IP ECN value. */ 187 uint8 exp; /* Mpls EXP value. */ 188 uint8 new_ecn; /* New ECN value. */ 189 uint8 new_exp; /* New EXP value. */ 190 uint32 nonip_action_flags; /* action flags for Non-ip ECN map. */ 191 } bcm_ecn_map_t; 192 #endif 193 194 #ifndef BCM_HIDE_DISPATCHABLE 195 196 #if defined(INCLUDE_L3) 197 /* Create an MPLS ECN map instance. */ 198 extern int bcm_ecn_map_create( 199 int unit, 200 uint32 flags, 201 int *ecn_map_id); 202 #endif 203 204 #if defined(INCLUDE_L3) 205 /* Destroy an MPLS ECN map instance. */ 206 extern int bcm_ecn_map_destroy( 207 int unit, 208 int ecn_map_id); 209 #endif 210 211 #if defined(INCLUDE_L3) 212 /* Set ECN mapping relationship in the specified ECN map. */ 213 extern int bcm_ecn_map_set( 214 int unit, 215 uint32 options, 216 int ecn_map_id, 217 bcm_ecn_map_t *ecn_map); 218 #endif 219 220 #if defined(INCLUDE_L3) 221 /* Get ECN mapping relationship in the specified ECN map. */ 222 extern int bcm_ecn_map_get( 223 int unit, 224 int ecn_map_id, 225 bcm_ecn_map_t *ecn_map); 226 #endif 227 228 #endif /* BCM_HIDE_DISPATCHABLE */ 229 230 #if defined(INCLUDE_L3) 231 /* Initialize a MPLS ECN map structure. */ 232 extern void bcm_ecn_map_t_init( 233 bcm_ecn_map_t *ecn_map); 234 #endif 235 236 /* ECN port map flags. */ 237 #define BCM_ECN_EGRESS_PORT_ECN_TO_EXP_MAP 0x00000001 /* Indicate an ECN_TO_EXP 238 map */ 239 #define BCM_ECN_EGRESS_PORT_INT_CN_TO_EXP_MAP 0x00000002 /* Indicate an 240 INT_CN_TO_EXP map */ 241 #define BCM_ECN_INGRESS_PORT_TUNNEL_TERM_MAP 0x00000004 /* Indicate a tunnel term 242 ECN map */ 243 244 #if defined(INCLUDE_L3) 245 /* MPLS ecn port Map Structure. */ 246 typedef struct bcm_ecn_port_map_s { 247 uint32 flags; /* flags for ECN port map. */ 248 int ecn_map_id; /* Ecn map id. */ 249 } bcm_ecn_port_map_t; 250 #endif 251 252 #if defined(INCLUDE_L3) 253 /* Initialize a MPLS ECN port map structure. */ 254 extern void bcm_ecn_port_map_t_init( 255 bcm_ecn_port_map_t *ecn_map); 256 #endif 257 258 #ifndef BCM_HIDE_DISPATCHABLE 259 260 #if defined(INCLUDE_L3) 261 /* Get ECN mapping id in the specified gport. */ 262 extern int bcm_ecn_port_map_get( 263 int unit, 264 bcm_gport_t port, 265 bcm_ecn_port_map_t *ecn_map); 266 #endif 267 268 #if defined(INCLUDE_L3) 269 /* Set ECN mapping id in the specified gport. */ 270 extern int bcm_ecn_port_map_set( 271 int unit, 272 bcm_gport_t port, 273 bcm_ecn_port_map_t *ecn_map); 274 #endif 275 276 #endif /* BCM_HIDE_DISPATCHABLE */ 277 278 #if defined(INCLUDE_L3) 279 /* ecn dscp map mode */ 280 typedef enum bcm_ecn_dscp_map_mode_e { 281 bcmEcnDscpMapModeDraft = 0, /* Draft mode */ 282 bcmEcnDscpMapModeRfc3168 = 1, /* Mode defined in RFC3168 */ 283 bcmEcnDscpMapModeCount = 2 /* End of list */ 284 } bcm_ecn_dscp_map_mode_t; 285 #endif 286 287 #if defined(INCLUDE_L3) 288 /* ecn map mode information */ 289 typedef struct bcm_ecn_map_mode_s { 290 int dscp; /* value of -1 to change all entries */ 291 bcm_ecn_dscp_map_mode_t dscp_map_mode; /* ecn map mode setting. */ 292 } bcm_ecn_map_mode_t; 293 #endif 294 295 #if defined(INCLUDE_L3) 296 /* Initialize a bcm_ecn_map_mode_t structure. */ 297 extern void bcm_ecn_map_mode_t_init( 298 bcm_ecn_map_mode_t *ecn_map_mode); 299 #endif 300 301 #ifndef BCM_HIDE_DISPATCHABLE 302 303 #if defined(INCLUDE_L3) 304 /* Set the ECN mapping mode for the specific DSCP. */ 305 extern int bcm_ecn_map_mode_set( 306 int unit, 307 bcm_ecn_map_mode_t *ecn_map_mode); 308 #endif 309 310 #if defined(INCLUDE_L3) 311 /* Get the ECN mapping mode for the specific DSCP. */ 312 extern int bcm_ecn_map_mode_get( 313 int unit, 314 bcm_ecn_map_mode_t *ecn_map_mode); 315 #endif 316 317 #endif /* BCM_HIDE_DISPATCHABLE */ 318 319 #endif /* __BCM_ECN_H__ */