rx_trap_map.h (11089B)
1 /** 2 * \file bcm_int/dnx/rx/rx_trap_map.h 3 * 4 * 5 * Internal DNX RX APIs 6 * 7 * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file. 8 * 9 * Copyright 2007-2020 Broadcom Inc. All rights reserved. 10 */ 11 12 #ifndef RX_TRAP_MAP_H_INCLUDED 13 /* { */ 14 #define RX_TRAP_MAP_H_INCLUDED 15 16 #ifndef BCM_DNX_SUPPORT 17 #error "This file is for use by DNX (JR2) family only!" 18 #endif 19 20 #include <include/bcm_int/dnx/rx/rx.h> 21 #include <include/bcm_int/dnx/rx/rx_trap.h> 22 23 #define DNX_RX_TRAP_MAP_MAX_NOF_DEFAULT_TRAPS 3 24 /** 25 * Taken and renamed from src/bcm/dnx/oam/oam_punt_and_protection.c -> DNX_OAMP_PUNT_MSB. 26 */ 27 #define DNX_RX_OAMP_TRAPS_LOWER_RANGE 0x400 28 29 /* 30 * Types 31 * { 32 */ 33 34 /** 35 * \brief struct containing mapping info for trap_type. 36 */ 37 typedef struct 38 { 39 int valid; 40 uint32 trap_id; 41 dnx_rx_trap_block_e trap_block; 42 dnx_rx_trap_class_e trap_class; 43 char trap_name[DBAL_MAX_STRING_LENGTH]; 44 uint32 flags; 45 uint8 is_strengthless; 46 } dnx_rx_trap_map_type_t; 47 48 /** 49 * \brief struct containing user-defined traps information. 50 */ 51 typedef struct 52 { 53 /** User-defined trap ids range is [lower_bound_trap_id, upper_bound_trap_id] */ 54 int lower_bound_trap_id; 55 int upper_bound_trap_id; 56 char block_name[DBAL_MAX_STRING_LENGTH]; 57 int default_trap_id_list[DNX_RX_TRAP_MAP_MAX_NOF_DEFAULT_TRAPS]; 58 } dnx_rx_trap_map_ud_t; 59 60 /** 61 * \brief struct containing Ingress user-defined traps mapping. 62 */ 63 typedef struct 64 { 65 int valid; 66 int alloc_index; 67 } dnx_rx_trap_map_ingress_ud_t; 68 69 /** 70 * \brief struct containing ETPP profile dbal fields. 71 */ 72 typedef struct 73 { 74 /** recycle packet priority field */ 75 dbal_fields_e cfg_rcy_prio; 76 77 /** recycle packet crop field */ 78 dbal_fields_e cfg_rcy_crop; 79 80 /** recycle packet append orifinal FTMH field */ 81 dbal_fields_e cfg_rcy_append_orig; 82 83 /** recycle command field */ 84 dbal_fields_e cfg_rcy_cmd; 85 86 /** CPU trap code field */ 87 dbal_fields_e cfg_cpu_trap_code; 88 89 /** PP drop reason field */ 90 dbal_fields_e cfg_pp_drop_reason; 91 92 /** Drop forward copy field */ 93 dbal_fields_e cfg_drop_fwd_copy; 94 95 /** Generate recycle copy field */ 96 dbal_fields_e cfg_gen_recycle_copy; 97 } dnx_rx_trap_map_etpp_profile_dbal_fields_t; 98 99 /** 100 * \brief struct containing statistical object overwrite dbal fields. 101 */ 102 typedef struct 103 { 104 /** overwrite field */ 105 dbal_fields_e overwrite; 106 107 /** index to overwrite field */ 108 dbal_fields_e index; 109 110 /** value field */ 111 dbal_fields_e value; 112 113 /** offset by qualifier field */ 114 dbal_fields_e offset_by_qual; 115 116 /** type field */ 117 dbal_fields_e type; 118 119 /** is meter field */ 120 dbal_fields_e is_meter; 121 } dnx_rx_trap_map_stat_obj_dbal_fields_t; 122 123 typedef struct 124 { 125 /** Trap-ID range per block, for verify */ 126 int lower_bound_trap_id; 127 int upper_bound_trap_id; 128 } dnx_rx_trap_map_ranges_t; 129 130 /* 131 * } Types 132 */ 133 134 /* 135 * Globals 136 * { 137 */ 138 139 extern const dnx_rx_trap_map_type_t dnx_rx_trap_type_map[bcmRxTrapCount]; 140 extern const dnx_rx_trap_map_type_t dnx_rx_app_trap_type_map[bcmRxTrapCount]; 141 extern const dnx_rx_trap_map_ud_t dnx_rx_ud_trap_map[DNX_RX_TRAP_BLOCK_NUM_OF]; 142 extern const dnx_rx_trap_map_etpp_profile_dbal_fields_t 143 dnx_rx_trap_map_etpp_ud_profile[DNX_RX_TRAP_ETPP_FWD_ACT_NOF_PROFILES]; 144 extern const dnx_rx_trap_map_etpp_profile_dbal_fields_t 145 dnx_rx_trap_map_etpp_oam_profile[DNX_RX_TRAP_ETPP_OAM_NOF_TRAPS]; 146 extern const dnx_rx_trap_map_stat_obj_dbal_fields_t dnx_rx_trap_map_stat_obj[DNX_RX_TRAP_NOF_STAT_OBJS_TO_OW]; 147 extern const dnx_rx_trap_map_ingress_ud_t dnx_rx_trap_map_ingress_ud[DBAL_NOF_ENUM_INGRESS_TRAP_ID_VALUES]; 148 extern const dbal_enum_value_field_ingress_trap_id_e 149 dnx_rx_trap_map_ingress_ud_alloc[DBAL_NOF_ENUM_INGRESS_TRAP_ID_VALUES]; 150 extern const dnx_rx_trap_map_ranges_t dnx_rx_range_trap_map[DNX_RX_TRAP_BLOCK_NUM_OF]; 151 extern const char *dnx_rx_trap_type_description[bcmRxTrapCount]; 152 153 /** 154 * \brief - check if ingress trap is user defined 155 */ 156 #define DNX_RX_TRAP_IS_INGRESS_USER_DEFINED(trap_id) (dnx_rx_trap_map_ingress_ud[trap_id].valid) 157 158 /** 159 * \brief - check if ERPP trap is user defined 160 */ 161 #define DNX_RX_TRAP_IS_ERPP_USER_DEFINED(trap_id) ((trap_id >= dnx_rx_ud_trap_map[DNX_RX_TRAP_BLOCK_ERPP].lower_bound_trap_id) && (trap_id <= dnx_rx_ud_trap_map[DNX_RX_TRAP_BLOCK_ERPP].upper_bound_trap_id)) 162 163 /** 164 * \brief - check if ETPP trap is user defined 165 */ 166 #define DNX_RX_TRAP_IS_ETPP_USER_DEFINED(trap_id) ((trap_id >= dnx_rx_ud_trap_map[DNX_RX_TRAP_BLOCK_ETPP].lower_bound_trap_id) && (trap_id <= dnx_rx_ud_trap_map[DNX_RX_TRAP_BLOCK_ETPP].upper_bound_trap_id)) 167 168 /* 169 * } Globals 170 */ 171 172 /** 173 * \brief 174 * Retrun list of trap map info for supported per block and class 175 * \param [in] unit - Device ID 176 * \param [in] trap_block - Stage to get trap ID for 177 * \param [in] trap_class - Trap class to get Id of 178 * \param [out] trap_descriptions - List of trap descriptions 179 * \param [out] trap_map_list_p - List of trap map info 180 * \param [out] nof_traps_p - number of traps in the list 181 * \return 182 * shr_error_e - Error Type 183 * \remark 184 * * None 185 * \see 186 * * None 187 */ 188 shr_error_e dnx_rx_trap_map_list( 189 int unit, 190 dnx_rx_trap_block_e trap_block, 191 dnx_rx_trap_class_e trap_class, 192 char **trap_descriptions, 193 dnx_rx_trap_map_type_t ** trap_map_list_p, 194 int *nof_traps_p); 195 196 /** 197 * \brief 198 * Retrun list of application trap map info for supported per block 199 * \param [in] unit - Device ID 200 * \param [in] trap_block - Stage to get trap ID for 201 * \param [out] trap_descriptions - List of trap descriptions 202 * \param [out] trap_map_list_p - List of trap map info 203 * \param [out] nof_traps_p - number of traps in the list 204 * \return 205 * shr_error_e - Error Type 206 * \remark 207 * * None 208 * \see 209 * * None 210 */ 211 shr_error_e dnx_rx_trap_app_map_list( 212 int unit, 213 dnx_rx_trap_block_e trap_block, 214 char **trap_descriptions, 215 dnx_rx_trap_map_type_t ** trap_map_list_p, 216 int *nof_traps_p); 217 218 /** 219 * \brief 220 * Retrun trap type of application trap 221 * \param [in] unit - Device ID 222 * \param [in] trap_block - trap block 223 * \param [in] trap_id - trap_id 224 * \param [out] trap_type_p - bcmRxTrap type 225 * \return 226 * shr_error_e - Error Type 227 * \remark 228 * * None 229 * \see 230 * * None 231 */ 232 shr_error_e dnx_rx_trap_app_type_from_id_get( 233 int unit, 234 dnx_rx_trap_block_e trap_block, 235 uint32 trap_id, 236 bcm_rx_trap_t * trap_type_p); 237 238 /** 239 * \brief 240 * Retrun the map information for the requested trap type. 241 * \param [in] unit - Device ID 242 * \param [in] trap_type - trap type 243 * \param [out] predefined_trap_info_p - Predefined trap info 244 * \return 245 * shr_error_e - Error Type 246 * \remark 247 * * None 248 * \see 249 * * None 250 */ 251 shr_error_e dnx_rx_trap_predefined_map_info_get( 252 int unit, 253 bcm_rx_trap_t trap_type, 254 dnx_rx_trap_map_type_t * predefined_trap_info_p); 255 256 /** 257 * \brief 258 * Retrun the map information for the requested ingress User Defined trap ID. 259 * \param [in] unit - Device ID 260 * \param [in] trap_id - Trap ID 261 * \param [out] ingress_ud_info_p - UserDefined info 262 * \return 263 * shr_error_e - Error Type 264 * \remark 265 * * None 266 * \see 267 * * None 268 */ 269 shr_error_e dnx_rx_trap_ingress_ud_map_info_get( 270 int unit, 271 int trap_id, 272 dnx_rx_trap_map_ingress_ud_t * ingress_ud_info_p); 273 274 /** 275 * \brief 276 * Retrun the ID range map information for the requested trap block. 277 * \param [in] unit - Device ID 278 * \param [in] trap_block - Trap Block 279 * \param [out] trap_id_range_info_p - Trap id range info 280 * \return 281 * shr_error_e - Error Type 282 * \remark 283 * * None 284 * \see 285 * * None 286 */ 287 shr_error_e dnx_rx_trap_id_boundry_ranges_map_info_get( 288 int unit, 289 dnx_rx_trap_block_e trap_block, 290 dnx_rx_trap_map_ranges_t * trap_id_range_info_p); 291 292 /** 293 * \brief 294 * Retrun the map information for the requested trap type. 295 * \param [in] unit - Device ID 296 * \param [in] trap_type - Trap Type 297 * \param [out] appl_trap_info_p - Trap type info 298 * \return 299 * shr_error_e - Error Type 300 * \remark 301 * * None 302 * \see 303 * * None 304 */ 305 shr_error_e dnx_rx_trap_appl_trap_map_info_get( 306 int unit, 307 bcm_rx_trap_t trap_type, 308 dnx_rx_trap_map_type_t * appl_trap_info_p); 309 310 /** 311 * \brief 312 * Retrun the UserDefined trap information for the requested trap block. 313 * \param [in] unit - Device ID 314 * \param [in] trap_block - Trap Block 315 * \param [out] ud_block_info_p - UserDefined traps info 316 * \return 317 * shr_error_e - Error Type 318 * \remark 319 * * None 320 * \see 321 * * None 322 */ 323 shr_error_e dnx_rx_trap_user_defined_block_map_info_get( 324 int unit, 325 dnx_rx_trap_block_e trap_block, 326 dnx_rx_trap_map_ud_t * ud_block_info_p); 327 328 /** 329 * \brief 330 * Retrun the UserDefined trap information for the requested fwd action profile. 331 * \param [in] unit - Device ID 332 * \param [in] fwd_action_profile - ETPP Action Profile 333 * \param [out] ud_profile_info_p - Action Profile info 334 * \return 335 * shr_error_e - Error Type 336 * \remark 337 * * None 338 * \see 339 * * None 340 */ 341 shr_error_e dnx_rx_trap_etpp_ud_profile_map_info_get( 342 int unit, 343 dnx_rx_trap_etpp_fwd_act_profiles_e fwd_action_profile, 344 dnx_rx_trap_map_etpp_profile_dbal_fields_t * ud_profile_info_p); 345 346 /** 347 * \brief 348 * Retrun the OAM trap information for the requested fwd action profile. 349 * \param [in] unit - Device ID 350 * \param [in] oam_action_profile - ETPP OAM Action Profile 351 * \param [out] oam_profile_info_p - OAM Action Profile info 352 * \return 353 * shr_error_e - Error Type 354 * \remark 355 * * None 356 * \see 357 * * None 358 */ 359 shr_error_e dnx_rx_trap_etpp_oam_profile_map_info_get( 360 int unit, 361 dnx_rx_trap_etpp_oam_types_e oam_action_profile, 362 dnx_rx_trap_map_etpp_profile_dbal_fields_t * oam_profile_info_p); 363 364 /** 365 * \brief 366 * Retrun the Statistical object info for the requested profile. 367 * \param [in] unit - Device ID 368 * \param [in] stat_obj_profile - Stat Object profile 369 * \param [out] stat_obj_info_p - Stat Object profile info 370 * \return 371 * shr_error_e - Error Type 372 * \remark 373 * * None 374 * \see 375 * * None 376 */ 377 shr_error_e dnx_rx_trap_stat_obj_map_info_get( 378 int unit, 379 uint32 stat_obj_profile, 380 dnx_rx_trap_map_stat_obj_dbal_fields_t * stat_obj_info_p); 381 382 /** 383 * \brief 384 * Retrun the description of a bcmRxTrap... 385 * \param [in] unit - Device ID 386 * \param [in] trap_type - Trap Type 387 * \param [out] description - Trap type info 388 * \return 389 * shr_error_e - Error Type 390 * \remark 391 * * None 392 * \see 393 * * None 394 */ 395 shr_error_e dnx_rx_trap_type_description_map_info_get( 396 int unit, 397 bcm_rx_trap_t trap_type, 398 char **description); 399 400 /** 401 * \brief 402 * Return an error of trap is valid and no description is found. 403 * \param [in] unit - Device ID 404 * \return 405 * shr_error_e - Error Type 406 * \remark 407 * * None 408 * \see 409 * * None 410 */ 411 shr_error_e dnx_rx_trap_description_init_check( 412 int unit); 413 414 #endif/*_RX_TRAP_MAP_API_INCLUDED__*/