oam.h (23402B)
1 /* 2 * 3 * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file. 4 * 5 * Copyright 2007-2020 Broadcom Inc. All rights reserved. 6 * 7 * IPMC Internal header 8 */ 9 10 #ifndef _BCM_INT_DPP_OAM_H_ 11 #define _BCM_INT_DPP_OAM_H_ 12 13 #include <sal/types.h> 14 #include <bcm/types.h> 15 #include <bcm/oam.h> 16 #include <bcm/bfd.h> 17 #include <bcm/sat.h> 18 #include <shared/hash_tbl.h> 19 20 21 #include <soc/dpp/PPD/ppd_api_oam.h> 22 #include <soc/dpp/PPC/ppc_api_oam.h> 23 #include <soc/dpp/PPC/ppc_api_llp_mirror.h> 24 #include <soc/dpp/PPD/ppd_api_trap_mgmt.h> 25 #include <soc/dpp/ARAD/ARAD_PP/arad_pp_dbal.h> 26 #include <soc/dpp/ARAD/ARAD_PP/arad_pp_oam.h> 27 #include <soc/dpp/ARAD/ARAD_PP/arad_pp_oamp_pe.h> 28 #include <shared/swstate/sw_state_hash_tbl.h> 29 /* 30 * Global defines 31 */ 32 33 /** 34 * Snoop commands used for advanced egress snooping. 35 */ 36 #define _BCM_OAM_MIP_SNOOP_CMND_DOWN 1 37 #define _BCM_OAM_MIP_SNOOP_CMND_UP 2 38 39 /*OAM statistics*/ 40 #define ARAD_PP_CFM_ETHER_TYPE (0x8902) 41 42 /* Max number of words in an event data (as read by the interrupt handler) */ 43 #define _BCM_OAM_EVENT_DATA_WORDS_MAX 2 44 45 #define _BCM_OAM_ILLEGAL_DESTINATION 0xffff 46 47 /*_BCM_OAM_MAX_L3_INTF needs to match EEP of mep_db*/ 48 #define _BCM_OAM_MAX_L3_INTF (SOC_IS_JERICHO(unit) ? ((1<<18) -1) : ((SOC_IS_ARAD_B0_AND_ABOVE(unit) ? ((1<<15) -1) : ((1<<17) -1)))) 49 50 #define OAM_ACCESS sw_state_access[unit].dpp.bcm.oam 51 52 53 54 #ifdef BCM_ARAD_SUPPORT 55 #define _BCM_OAM_ENABLED_GET(oam_is_init) \ 56 do { \ 57 if (!SOC_DPP_PP_ENABLE(unit)) { \ 58 oam_is_init = 0; \ 59 } else { \ 60 rv = sw_state_access[unit].dpp.soc.arad.pp.oper_mode.oam_enable.get(unit, &oam_is_init);\ 61 BCMDNX_IF_ERR_EXIT(rv); \ 62 } \ 63 } while (0) 64 65 #define _BCM_OAM_ENABLED_SET(oam_is_init) \ 66 do { \ 67 rv = sw_state_access[unit].dpp.soc.arad.pp.oper_mode.oam_enable.set(unit, oam_is_init);\ 68 BCMDNX_IF_ERR_EXIT(rv); \ 69 } while (0) 70 71 #define _BCM_BFD_ENABLED_GET(is_bfd_init) \ 72 do { \ 73 if (!SOC_DPP_PP_ENABLE(unit)) { \ 74 is_bfd_init = 0; \ 75 } else { \ 76 rv = sw_state_access[unit].dpp.soc.arad.pp.oper_mode.bfd_enable.get(unit, &is_bfd_init);\ 77 BCMDNX_IF_ERR_EXIT(rv); \ 78 } \ 79 } while (0) 80 81 #define _BCM_BFD_ENABLED_SET(is_bfd_init) \ 82 do { \ 83 rv = sw_state_access[unit].dpp.soc.arad.pp.oper_mode.bfd_enable.set(unit, is_bfd_init);\ 84 BCMDNX_IF_ERR_EXIT(rv); \ 85 } while (0) 86 87 #else 88 #define _BCM_OAM_ENABLED_GET(oam_is_init) \ 89 BCMDNX_ERR_EXIT_MSG(BCM_E_UNAVAIL, (_BSL_BCM_MSG("Error: Unsupported device. Support only ARAD.\n"))); 90 91 #define _BCM_BFD_ENABLED_GET(is_bfd_init) \ 92 BCMDNX_ERR_EXIT_MSG(BCM_E_UNAVAIL, (_BSL_BCM_MSG("Error: Unsupported device. Support only ARAD.\n"))); 93 94 #define _BCM_OAM_ENABLED_SET(oam_is_init) \ 95 BCMDNX_ERR_EXIT_MSG(BCM_E_UNAVAIL, (_BSL_BCM_MSG("Error: Unsupported device. Support only ARAD.\n"))); 96 97 #define _BCM_BFD_ENABLED_SET(is_bfd_init) \ 98 BCMDNX_ERR_EXIT_MSG(BCM_E_UNAVAIL, (_BSL_BCM_MSG("Error: Unsupported device. Support only ARAD.\n"))); 99 #endif /*BCM_ARAD_SUPPORT*/ 100 101 #define _BCM_OAM_REMOTE_MEP_INDEX_BIT 25 102 #define _BCM_OAM_BFD_MEP_INDEX_BIT 26 103 #define _BCM_OAM_UNACCELERATED_MEP_UPMEP_INDEX_BIT 27 104 #define _BCM_OAM_UNACCELERATED_MEP_MDL_INDEX_BIT 28 /* Uses 3 bits*/ 105 #define _BCM_OAM_SERVER_CLIENT_SIDE_BIT SOC_PPD_OAM_SERVER_CLIENT_SIDE_BIT 106 #define _BCM_BFD_UC_MEP_INDEX_BIT 23 107 #define _BCM_OAM_DOWN_MEP_LEVEL_0_NON_ACC_BIT 22 108 #define _BCM_OAM_BFD_SERVER_MEP_INDEX_BIT 21 109 110 /* Jericho only. For now only one bit is used*/ 111 #define _BCM_OAM_NUMBER_OF_BITS_USED_BY_OUTLIF_PCP SOC_PPC_OAM_NUMBER_OF_OUTLIF_BITS_USED_BY_PCP 112 #define _BCM_OAM_OUTLIF_PROFILE_FOR_PCP_MAX_VALUE (_BCM_OAM_NUMBER_OF_BITS_USED_BY_OUTLIF_PCP? ((1 << _BCM_OAM_NUMBER_OF_BITS_USED_BY_OUTLIF_PCP) -1) : 0) 113 114 115 #define _BCM_OAM_MEP_ID_MASK (SOC_PPC_OAM_MAX_NUMBER_OF_LOCAL_MEPS(unit) -1) 116 117 /* unaccelerated mep index calculation */ 118 #define _BCM_OAM_UNACCELERATED_MEP_INDEX_GET(lif, mdl, is_up) \ 119 (lif + (mdl << _BCM_OAM_UNACCELERATED_MEP_MDL_INDEX_BIT) + (is_up << _BCM_OAM_UNACCELERATED_MEP_UPMEP_INDEX_BIT) + \ 120 ((!is_up && !mdl) << _BCM_OAM_DOWN_MEP_LEVEL_0_NON_ACC_BIT) ) 121 122 /* unaccelerated mep index calculation */ 123 #define _BCM_BFD_UNACCELERATED_MEP_INDEX_GET(lif) \ 124 (lif + (1 << _BCM_OAM_BFD_MEP_INDEX_BIT)) 125 126 /* client classifier of bfd server mep index calculation */ 127 #define _BCM_BFD_SERVER_CLASSIFICATION_MEP_INDEX_GET(lif) \ 128 (lif + (1 << _BCM_OAM_BFD_SERVER_MEP_INDEX_BIT)) 129 130 #define _BCM_BFD_IS_SERVER_CLASSIFICATION_MEP(endpoint) \ 131 ((endpoint & (1 << _BCM_OAM_BFD_SERVER_MEP_INDEX_BIT)) >> _BCM_OAM_BFD_SERVER_MEP_INDEX_BIT) 132 133 #define _BCM_OAM_REMOTE_MEP_INDEX_FROM_INTERNAL(rmep_id_internal, endpoint) \ 134 (endpoint = rmep_id_internal + (1 << _BCM_OAM_REMOTE_MEP_INDEX_BIT)) 135 136 #define _BCM_OAM_REMOTE_MEP_INDEX_TO_INTERNAL(rmep_id_internal, endpoint) \ 137 (rmep_id_internal = endpoint & 0xFFFFFF) 138 139 #define _BCM_OAM_MEP_INDEX_IS_REMOTE(endpoint) \ 140 (((endpoint >> _BCM_OAM_REMOTE_MEP_INDEX_BIT) & 1) == 1) 141 142 143 #define _BCM_BFD_UC_MEP_INDEX_FROM_INTERNAL(mep_id_internal, endpoint) \ 144 (endpoint = mep_id_internal + (1 << _BCM_BFD_UC_MEP_INDEX_BIT)) 145 146 #define _BCM_BFD_UC_MEP_INDEX_TO_INTERNAL(mep_id_internal, endpoint) \ 147 (mep_id_internal = endpoint & ((1<<_BCM_BFD_UC_MEP_INDEX_BIT)-1) ) 148 149 #define _BCM_BFD_MEP_INDEX_IS_UC(endpoint) \ 150 (((endpoint >> _BCM_BFD_UC_MEP_INDEX_BIT) & 1) == 1) 151 152 #define _BCM_OAM_SET_MEP_INDEX_FOR_SERVER_CLIENT_SIDE(endpoint_id, server_endpoint_id) \ 153 endpoint_id = (server_endpoint_id & _BCM_OAM_MEP_ID_MASK) + (1 << _BCM_OAM_SERVER_CLIENT_SIDE_BIT) 154 155 #define _BCM_OAM_GET_MEP_INDEX_FOR_SERVER_CLIENT_SIDE(endpoint_id) (endpoint_id & _BCM_OAM_MEP_ID_MASK) 156 157 #define _BCM_OAM_MEP_INDEX_IS_SERVER_CLIENT_SIDE SOC_PPD_OAM_MEP_INDEX_IS_SERVER_CLIENT_SIDE 158 159 #define _BCM_OAM_TRAP_FWD_OFFSET_INDEX bcmRxTrapForwardingHeaderOamBfdPdu 160 #define _BCM_OAM_INVALID_LIF ((uint32)-1) 161 #define _BCM_OAM_INVALID_DISABLE_COUNTER_ID (0) 162 163 #define _BCM_OAM_NUM_OAMP_PORTS(unit) (SOC_IS_JERICHO(unit)?2:1) 164 165 #define _BCM_OAM_BFD_DEFAULT_SNP_STRENGTH_GET(_unit) soc_property_get((_unit), spn_DEFAULT_SNOOP_STRENGTH, 3) 166 167 #define _BCM_OAM_MA_NAME_WITHOUT_HEADERS 13 168 #define _BCM_OAM_MA_NAME_48 48 169 170 #define _BCM_OAM_RMEP_ID_MAX ((1<<13)-1) /* rmep id is 13 bits */ 171 #define _BCM_OAM_MEP_PER_MA_MAX_NUM 256 172 173 #define _BCM_OAM_PASSIVE_PROFILE 3 174 175 /* Macros for custom_feature_oamp_flexible_da */ 176 #define _BCM_OAM_IS_CUSTOM_FEATURE_OAMP_FLEXIBLE_DA_SET(unit) ((SOC_IS_QAX(unit)) && (SOC_DPP_CONFIG(unit)->pp.oamp_flexible_da != 0)) 177 #define _BCM_OAM_IS_JUMBO_TLV_DM_ENABLE(unit) ((SOC_IS_JERICHO_AND_BELOW(unit))&& (soc_property_suffix_num_get(unit, -1, spn_CUSTOM_FEATURE, "dm_jumbo_tlv", 0))) 178 #define _BCM_OAM_OAMP_FLEX_DA_FEATURE_VALID_EP_RANGE_MIN (0) 179 #define _BCM_OAM_OAMP_FLEX_DA_FEATURE_VALID_EP_RANGE_MAX (2047) /* Max 2k endpoints allowed. */ 180 #define _BCM_OAM_OAMP_FLEX_DA_FEATURE_VALID_EP_RANGE_CHECK(ep_id) (ep_id >= _BCM_OAM_OAMP_FLEX_DA_FEATURE_VALID_EP_RANGE_MIN && \ 181 ep_id <= _BCM_OAM_OAMP_FLEX_DA_FEATURE_VALID_EP_RANGE_MAX) 182 183 #define _BCM_OAM_CUST_FEAT_OAMP_FLEX_DA_NUM_ENTRIES_PER_EP 8 /* 8 OAMP gen mem entries per endpoint */ 184 185 #define _BCM_OAM_CUST_FEAT_OAMP_FLEX_DA_DATA1_OFFSET 0 /* Offset 0 for DATA1 typically outlif. */ 186 #define _BCM_OAM_CUST_FEAT_OAMP_FLEX_DA_DATA2_OFFSET 1 /* Offset 0 for DATA2 typically VSI. */ 187 #define _BCM_OAM_CUST_FEAT_OAMP_FLEX_DA_MAC_OFFSET 2 /* Offset 2 for DA */ 188 189 typedef enum _bcm_oam_ma_name_type_e{ 190 _BCM_OAM_MA_NAME_TYPE_ICC = 0, 191 _BCM_OAM_MA_NAME_TYPE_SHORT, 192 _BCM_OAM_MA_NAME_TYPE_STRING_11_BYTES, 193 _BCM_OAM_MA_NAME_TYPE_STRING_48_BYTE, 194 195 _BCM_OAM_MA_NAME_TYPE_NOF 196 } _bcm_oam_ma_name_type_t; 197 198 199 typedef struct _bcm_oam_ma_name_s { 200 _bcm_oam_ma_name_type_t name_type; 201 uint8 name[_BCM_OAM_MA_NAME_48]; 202 int index; /* oamp_pe_gen_mem pointer for flexible maid 48 byte */ 203 } _bcm_oam_ma_name_t; 204 205 206 typedef struct _bcm_dpp_oam_bfd_sw_db_lock_s { 207 sal_mutex_t lock; 208 int is_init; 209 } _bcm_dpp_oam_bfd_sw_db_lock_t; 210 211 /* 212 * Struct used to wrap callback for group together with its parameter. 213 * Used in bcm_petra_oam_group_traverse( ) 214 */ 215 typedef struct bcm_oam_group_traverse_cb_w_param_s { 216 bcm_oam_group_traverse_cb cb; 217 void* user_data; 218 }bcm_oam_group_traverse_cb_w_param_t; 219 220 /* 221 * Struct used to wrap callback for endpoint together with its parameter. 222 * Used in bcm_petra_oam_endpoint_traverse( ) 223 */ 224 typedef struct bcm_oam_endpoint_traverse_cb_w_param_s { 225 bcm_oam_endpoint_traverse_cb cb; 226 bcm_oam_group_t group; 227 void* user_data; 228 }bcm_oam_endpoint_traverse_cb_w_param_t; 229 230 /* 231 * Struct used to wrap callback for endpoint together with its parameter. 232 * Used in bcm_petra_oam_endpoint_create( ) 233 */ 234 typedef struct bcm_oam_endpoint_traverse_cb_profile_info { 235 uint32 lif; 236 uint32 first_endpoint_id; /* first endpoint id of given lif which we meet during traverse */ 237 uint8 is_ingress; 238 uint8 is_alloced; /* profile was allocated during the traverse */ 239 uint8 is_last; /* profile was freed during the traverse */ 240 uint8 cb_rv; /* Function may fail inside the traverse API but not return an error. Handle errors through this field.*/ 241 uint8 is_passive_profile_allocated; 242 SOC_PPC_OAM_LIF_PROFILE_DATA * profile_data; 243 }bcm_oam_endpoint_traverse_cb_profile_info_t; 244 245 /*struct should not exceed size 4 (in bytes). 246 Used to store data on all events. from the FIFO.*/ 247 typedef struct { 248 uint16 mep_or_rmep_indx ; /* index in the (R)MEP DB (not the actual (R)MEP ID)*/ 249 uint8 is_oam; 250 uint8 event_number ; /* number from the bcm_bfd/oam_event_type_t enum*/ 251 uint32 event_data[_BCM_OAM_EVENT_DATA_WORDS_MAX]; /* Extra data in the event */ 252 } _bcm_oam_event_and_rmep_info; 253 254 /* 255 * Endpoint linked list 256 * { 257 */ 258 /* 259 * Maximal number of endpoint list member entries to assign at init. 260 * See bcm_dpp_endp_lst_init(), _bcm_dpp_oam_endpoint_list_member_add() 261 */ 262 #define MAX_NOF_ENDP_LST_MS SOC_PPC_OAM_MAX_NUMBER_OF_REMOTE_MEPS(unit) 263 /* 264 * Maximal number of endpoint list entries to assign at init. 265 * See bcm_dpp_endp_lst_init(), _bcm_dpp_oam_endpoint_list_init() 266 */ 267 #define MAX_NOF_ENDP_LSTS SOC_PPC_OAM_MAX_NUMBER_OF_REMOTE_MEPS(unit) 268 /* 269 * Verify specific endpoint list index is marked as 'occupied'. If not, software goes to 270 * exit with error code. 271 * 272 * Notes: 273 * 'unit' is assumed to be defined in the caller's scope. 274 * '_rv' is assumed to be defined in the caller's scope. 275 * 'exit' is assumed to be defined in the caller's scope. 276 */ 277 #define BCM_DPP_ENDP_LST_VERIFY_ENDPLST_IS_ACTIVE(_endp_lst_index) \ 278 { \ 279 uint8 bit_val ; \ 280 int res ; \ 281 uint32 max_nof_endp_lsts ; \ 282 res = ENDP_LST_ACCESS.max_nof_endp_lsts.get(unit, &max_nof_endp_lsts) ; \ 283 BCMDNX_IF_ERR_EXIT(res) ; \ 284 if (_endp_lst_index >= max_nof_endp_lsts) \ 285 { \ 286 /* \ 287 * If endplst handle is out of range then quit with error. \ 288 */ \ 289 BCMDNX_ERR_EXIT_MSG(BCM_E_MEMORY,(_BSL_BCM_MSG("Error: Endp list %d is out of range (max: %d)"),_endp_lst_index,max_nof_endp_lsts)); \ 290 } \ 291 else \ 292 { \ 293 res = ENDP_LST_ACCESS.occupied_endp_lsts.bit_get(unit, (int)_endp_lst_index, &bit_val) ; \ 294 BCMDNX_IF_ERR_EXIT(res) ; \ 295 } \ 296 if (bit_val == 0) \ 297 { \ 298 /* \ 299 * If endplst structure is not indicated as 'occupied' then quit \ 300 * with error. \ 301 */ \ 302 BCMDNX_ERR_EXIT_MSG(BCM_E_MEMORY,(_BSL_BCM_MSG("Error: Endp list %d is not occupied"),_endp_lst_index)); \ 303 } \ 304 } 305 /* 306 * Verify specified unit has a legal value. If not, software goes to 307 * exit with error code. 308 * 309 * Notes: 310 * '_rv' is assumed to be defined in the caller's scope. 311 * 'exit' is assumed to be defined in the caller's scope. 312 */ 313 #define BCM_DPP_ENDP_LST_VERIFY_UNIT_IS_LEGAL(unit) \ 314 if ((unit < 0) || (unit >= SOC_MAX_NUM_DEVICES)) \ 315 { \ 316 /* \ 317 * If this is an illegal unit identifier, quit \ 318 * with error. \ 319 */ \ 320 int res ; \ 321 res = BCM_E_UNIT ; \ 322 BCMDNX_IF_ERR_EXIT(res) ; \ 323 } 324 /* 325 * Convert input endpoint list handle to index in 'occupied_endp_lsts' array. 326 * Convert input index in 'occupied_endp_lsts' array to endpoint list handle. 327 * Indices go from 0 -> (occupied_endp_lsts - 1) 328 * Handles go from 1 -> occupied_endp_lsts 329 */ 330 #define BCM_DPP_ENDP_LST_CONVERT_HANDLE_TO_ENDPLST_INDEX(_endp_lst_index,_handle) (_endp_lst_index = _handle - 1) 331 #define BCM_DPP_ENDP_LST_CONVERT_ENDPLST_INDEX_TO_HANDLE(_handle,_endp_lst_index) (_handle = _endp_lst_index + 1) 332 /* 333 * Verify specific endpoint list member index is marked as 'occupied'. If not, software goes to 334 * exit with error code. 335 * 336 * Notes: 337 * 'unit' is assumed to be defined in the caller's scope. 338 * '_rv' is assumed to be defined in the caller's scope. 339 * 'exit' is assumed to be defined in the caller's scope. 340 */ 341 #define BCM_DPP_ENDP_LST_M_VERIFY_ENDPLSTM_IS_ACTIVE(_endp_lst_m_index) \ 342 { \ 343 uint8 bit_val ; \ 344 int res ; \ 345 uint32 max_nof_endp_lst_ms ; \ 346 res = ENDP_LST_M_ACCESS.max_nof_endp_lst_ms.get(unit, &max_nof_endp_lst_ms) ; \ 347 BCMDNX_IF_ERR_EXIT(res) ; \ 348 if (_endp_lst_m_index >= max_nof_endp_lst_ms) \ 349 { \ 350 /* \ 351 * If ENDPLSTM handle is out of range then quit with error. \ 352 */ \ 353 BCMDNX_ERR_EXIT_MSG(BCM_E_MEMORY,(_BSL_BCM_MSG("Error: Endp member %d is out of range (max: %d)"),_endp_lst_m_index,max_nof_endp_lst_ms)); \ 354 } \ 355 else \ 356 { \ 357 res = ENDP_LST_M_ACCESS.occupied_endp_lst_ms.bit_get(unit, (int)_endp_lst_m_index, &bit_val) ; \ 358 BCMDNX_IF_ERR_EXIT(res) ; \ 359 } \ 360 if (bit_val == 0) \ 361 { \ 362 /* \ 363 * If ENDPLSTM structure is not indicated as 'occupied' then quit \ 364 * with error. \ 365 */ \ 366 BCMDNX_ERR_EXIT_MSG(BCM_E_MEMORY,(_BSL_BCM_MSG("Error: Endp member %d is not occupied"),_endp_lst_m_index)); \ 367 } \ 368 } 369 /* 370 * Verify specified unit has a legal value. If not, software goes to 371 * exit with error code. 372 * 373 * Notes: 374 * '_rv' is assumed to be defined in the caller's scope. 375 * 'exit' is assumed to be defined in the caller's scope. 376 */ 377 #define BCM_DPP_ENDP_LST_M_VERIFY_UNIT_IS_LEGAL(unit) \ 378 if ((unit < 0) || (unit >= SOC_MAX_NUM_DEVICES)) \ 379 { \ 380 /* \ 381 * If this is an illegal unit identifier, quit \ 382 * with error. \ 383 */ \ 384 int res ; \ 385 res = BCM_E_UNIT ; \ 386 BCMDNX_IF_ERR_EXIT(res) ; \ 387 } 388 /* 389 * Convert input endpoint list member handle to index in 'occupied_endp_lst_ms' array. 390 * Convert input index in 'occupied_endp_lst_ms' array to endpoint list member handle. 391 * Indices go from 0 -> (occupied_endp_lst_ms - 1) 392 * Handles go from 1 -> occupied_endp_lst_ms 393 */ 394 #define BCM_DPP_ENDP_LST_M_CONVERT_HANDLE_TO_ENDPLSTM_INDEX(_endp_lst_m_index,_handle) (_endp_lst_m_index = _handle - 1) 395 #define BCM_DPP_ENDP_LST_M_CONVERT_ENDPLSTM_INDEX_TO_HANDLE(_handle,_endp_lst_m_index) (_handle = _endp_lst_m_index + 1) 396 /* 397 * This is an identifier of an element of type endpoint_list_member_t 398 * 399 * Replace: endpoint_list_member_t (struct endpoint_list_member_s *) 400 * because the new software state does not use pointers, only handles. 401 * So now, ENDPOINT_LIST_MEMBER_PTR is just a handle to the 'endpoint list member' 402 * structure (actually, index into 'endp_lst_ms_array' {of pointers}) 403 * 404 * Note that the name is selected so as to minimize changes in current code. 405 */ 406 typedef uint32 ENDPOINT_LIST_MEMBER_PTR ; 407 /* 408 * This is an identifier of an element of type endpoint_list_t 409 * 410 * Replace: endpoint_list_t * 411 * because the new software state does not use pointers, only handles. 412 * So now, ENDPOINT_LIST_PTR is just a handle to the 'endpoint list' 413 * structure (actually, index into 'endp_lsts_array' {of pointers}) 414 * 415 * Note that the name is selected so as to minimize changes in current code. 416 */ 417 typedef uint32 ENDPOINT_LIST_PTR ; 418 /* 419 * Endpoint list structs 420 */ 421 typedef struct endpoint_list_member_s { 422 uint32 index; 423 ENDPOINT_LIST_MEMBER_PTR next; 424 } endpoint_list_member_t ; 425 426 typedef struct endpoint_list_s { 427 ENDPOINT_LIST_MEMBER_PTR first_member; 428 uint32 size; 429 } endpoint_list_t ; 430 /* 431 * Control Structure for all created endpoint lists. Each endpoint list 432 * is pointed by endp_lsts_array. See bcm_dpp_endp_lst_init() 433 */ 434 typedef struct bcm_dpp_sw_state_endp_lst_s 435 { 436 uint32 max_nof_endp_lsts ; 437 uint32 in_use ; 438 PARSER_HINT_ARR_PTR endpoint_list_t **endp_lsts_array ; 439 PARSER_HINT_ARR SHR_BITDCL *occupied_endp_lsts ; 440 } bcm_dpp_sw_state_endp_lst_t ; 441 /* 442 * Control Structure for all created endpoint list members. Each member 443 * is pointed by endp_lst_ms_array. See bcm_dpp_endp_lst_init() 444 */ 445 typedef struct bcm_dpp_sw_state_endp_lst_m_s 446 { 447 uint32 max_nof_endp_lst_ms ; 448 uint32 in_use ; 449 PARSER_HINT_ARR_PTR endpoint_list_member_t **endp_lst_ms_array ; 450 PARSER_HINT_ARR SHR_BITDCL *occupied_endp_lst_ms ; 451 } bcm_dpp_sw_state_endp_lst_m_t ; 452 /* 453 * All hash tables used by OAM 454 */ 455 typedef struct bcm_dpp_sw_state_oam_hashs_s 456 { 457 /* 458 * hash tables 459 */ 460 sw_state_htb_hash_table_t _bcm_dpp_oam_ma_index_to_name_db ; 461 sw_state_htb_hash_table_t _bcm_dpp_oam_ma_to_mep_db ; 462 sw_state_htb_hash_table_t _bcm_dpp_oam_rmep_info_db ; 463 sw_state_htb_hash_table_t _bcm_dpp_oam_bfd_mep_info_db ; 464 sw_state_htb_hash_table_t _bcm_dpp_oam_bfd_mep_to_rmep_db ; 465 /* 466 * Used in Jericho only 467 */ 468 sw_state_htb_hash_table_t _bcm_dpp_oam_mep_to_ais_id ; 469 sw_state_htb_hash_table_t _bcm_dpp_oam_mep_sat_gtf_info_db ; 470 sw_state_htb_hash_table_t _bcm_dpp_oam_mep_sat_ctf_info_db ; 471 } bcm_dpp_sw_state_oam_hashs_t ; 472 473 typedef struct bcm_dpp_oam_info_s{ 474 uint32 acc_ref_counter; 475 uint8 y1731_opcode_to_intenal_opcode_map[SOC_PPC_OAM_ETHERNET_PDU_OPCODE_COUNT]; 476 uint32 error_type_to_trap_id_map[SOC_PPC_OAM_OAMP_TRAP_TYPE_COUNT]; 477 uint32 oamp_rx_trap_code_ref_count[SOC_PPC_OAM_MEP_TYPE_COUNT][SOC_PPC_NOF_TRAP_CODES]; 478 SOC_PPC_OAM_INIT_TRAP_INFO trap_info; 479 uint8 is_internally_allocated_mirror[DPP_MIRROR_ACTION_NDX_MAX]; /* by action_set */ 480 uint8 cpu_trap_code_to_mirror_profile_map[SOC_PPC_NOF_TRAP_CODES]; 481 int prog_used[ARAD_PP_OAMP_PE_PROGS_NOF_PROGS]; /* prog ID in HW (program profile), -1 if not used */ 482 uint32 mep_pe_profile[ARAD_PP_OAMP_PE_PROGS_NOF_PROGS]; 483 int instruction_func_is_valid[ARAD_PP_OAMP_PE_PROGS_NOF_PROGS]; 484 /* 485 * Linked list heads 486 */ 487 PARSER_HINT_PTR bcm_dpp_sw_state_endp_lst_t *endp_lst ; 488 /* 489 * Linked list members 490 */ 491 PARSER_HINT_PTR bcm_dpp_sw_state_endp_lst_m_t *endp_lst_m ; 492 /* 493 * hash tables 494 */ 495 bcm_dpp_sw_state_oam_hashs_t oam_hashs ; 496 /* loopback object details*/ 497 int loopback_object_int_pri; 498 uint8 loopback_object_pkt_pri; 499 uint8 loopback_object_inner_pkt_pri; 500 uint32 no_of_slm_endpoints; /*Number of SLM enabled EPs - used on JR and below devices where SLM is global, not per EP*/ 501 uint32 no_of_dlm_endpoints; /* Number of RFC-6374 DLM endpoints */ 502 } bcm_dpp_oam_info_t; 503 504 typedef struct bcm_dpp_oam_crps_counters_s { 505 int crps_ingress_engine; 506 int crps_egress_engine; 507 uint32 crps_ingress_counter[8]; 508 uint32 crps_egress_counter[8]; 509 } bcm_dpp_oam_crps_counters_t; 510 511 uint32 512 bcm_dpp_endp_lst_get_endp_lst_ptr_from_handle( 513 int unit, 514 ENDPOINT_LIST_PTR endpoint_list, 515 endpoint_list_t **endp_lst_ptr_ptr 516 ) ; 517 uint32 518 bcm_dpp_endp_lst_get_endp_lst_m_ptr_from_handle( 519 int unit, 520 ENDPOINT_LIST_MEMBER_PTR endpoint_list_member, 521 endpoint_list_member_t **endp_lst_m_ptr_ptr 522 ) ; 523 uint32 524 bcm_dpp_endp_lst_init( 525 SOC_SAND_IN int unit, 526 SOC_SAND_IN uint32 max_nof_endp_lsts 527 ) ; 528 uint32 529 bcm_dpp_endp_lst_m_init( 530 SOC_SAND_IN int unit, 531 SOC_SAND_IN uint32 max_nof_endp_lst_ms 532 ) ; 533 /* 534 * } 535 */ 536 537 int _bcm_dpp_oam_bfd_mep_info_construct_bfd_mep_list_cb(int unit, sw_state_htb_key_t key, sw_state_htb_data_t data); 538 539 540 int _bcm_dpp_oamp_interrupts_init(int unit, uint8 enable_interrupts); 541 542 int _bcm_dpp_oam_bfd_tx_gport_to_sys_port(int unit, bcm_gport_t gport, uint32 * sys_port); 543 int _bcm_dpp_oam_bfd_sys_port_to_tx_gport(int unit, bcm_gport_t * tx_gport, uint32 sys_port) ; 544 545 /*diagnostics functions*/ 546 int _bcm_dpp_oam_bfd_diagnostics_endpoints(int unit); 547 int _bcm_dpp_oam_bfd_diagnostics_endpoint_by_id(int unit, int endpoint_id); 548 int _bcm_dpp_oam_bfd_diagnostics_LM_counters(int unit, int endpoint_id); 549 int _bcm_dpp_oam_diag_print_hier_counters(int unit, SOC_PPC_OAM_CLASSIFIER_OEM1_ENTRY_KEY *oem1_key); 550 551 int _bcm_dpp_oam_fifo_interrupt_handler(int unit, SOC_PPC_OAM_DMA_EVENT_TYPE event_type, SOC_PPC_OAM_INTERRUPT_GLOBAL_DATA * global_data); 552 553 int _bcm_petra_bfd_event_register(int unit, bcm_bfd_event_types_t event_types, bcm_bfd_event_cb cb, void *user_data); 554 int _bcm_petra_bfd_event_unregister( int unit, bcm_bfd_event_types_t event_types, bcm_bfd_event_cb cb); 555 int _bcm_jer_sat_event_register(int unit, bcm_sat_event_type_t event_type, bcm_sat_event_cb cb, void *user_data); 556 int _bcm_jer_sat_event_unregister(int unit, bcm_sat_event_type_t event_type, bcm_sat_event_cb cb); 557 558 559 int bcm_petra_oam_endpoint_action_set_internal( 560 int unit, 561 bcm_oam_endpoint_t id, 562 bcm_oam_endpoint_action_t *action, 563 int is_piggy_backed /* 0 - set to 0, 1 - set to 1, 2 - keep original */, 564 int is_sat_loopback /* 0 - set to 0, 1 - set to 1, 2 - keep original */); 565 566 /* 567 * Based on LIF and direction extract all endpoints of existing on different mdl 568 * Update action set profile for all MEP's and MIP's. 569 */ 570 uint32 bcm_petra_oam_endpoint_on_lif_and_direction( int unit, 571 SOC_PPC_LIF_ID lif, 572 SOC_PPC_LIF_ID passive_side_lif, 573 int is_upmep, 574 uint8 is_passive, 575 uint8 is_mip, 576 bcm_oam_endpoint_traverse_cb cb, 577 void *user_data); 578 579 #endif /* _BCM_INT_DPP_OAM_H_ */