oam_resource.h (4441B)
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 * OAM Resources module (traps, profiles, IDs, ...) 8 */ 9 #ifndef _BCM_INT_DPP_OAM_RESOURCE_H_ 10 #define _BCM_INT_DPP_OAM_RESOURCE_H_ 11 12 #include <sal/types.h> 13 #include <bcm/types.h> 14 #include <bcm/oam.h> 15 #include <bcm/bfd.h> 16 #include <shared/hash_tbl.h> 17 #include <shared/swstate/sw_state_hash_tbl.h> 18 19 #include <soc/dpp/PPD/ppd_api_oam.h> 20 #include <soc/dpp/PPC/ppc_api_oam.h> 21 #include <soc/dpp/PPD/ppd_api_trap_mgmt.h> 22 #include <soc/dpp/ARAD/ARAD_PP/arad_pp_dbal.h> 23 #include <soc/dpp/ARAD/ARAD_PP/arad_pp_oam.h> 24 25 26 /* Setting Invalid value as 32 bit max. */ 27 #define _BCM_DPP_OAM_ERROR_TRAP_ID_INVALID 0xffffffff 28 29 int _bcm_dpp_oam_error_trap_init(int unit); 30 int _bcm_dpp_bfd_mep_id_alloc(int unit, uint32 flags, uint32 *mep_index); 31 /* 32 * Function: 33 * _bcm_dpp_oam_mep_id_alloc 34 * 35 * Purpose: 36 * Allocate an index in the MEP-DB 37 * 38 * Parameters: 39 * unit - (IN) SOC unit number. 40 * flags - (IN) SW_STATE_RES_ALLOC_WITH_ID or 0 41 * is_short - (IN) 1 indicates MAID uses short MA format 42 * is_maid_48 - (IN) 1 indicates MAID uses 48B MA format. used only for Jericho\Arad+ in order to allocate 43 * specifec MEP ID which is valid for 48B maid(every 8th MEP) 44 * type - (IN) BCM_DPP_AM_OAM_MEP_DB_ENTRY_TYPE_MEP or 0. Indicates if this is MEP entry or a LM/DM entry 45 * mep_index - (IN/OUT) Index in the MEP-DB 46 * 47 * Returns: 48 * BCM_E_XXX 49 * 50 * Notes: 51 * When WITH_ID flag is set, is_short parameter is ignored 52 */ 53 int _bcm_dpp_oam_mep_id_alloc(int unit, uint32 flags, uint8 is_short, uint8 is_maid_48, uint8 type, uint32 *mep_index); 54 int _bcm_dpp_oam_bfd_mep_id_is_alloced(int unit, uint32 mep_id); 55 int _bcm_dpp_oam_bfd_mep_id_dealloc(int unit, uint32 mep_id); 56 57 int _bcm_dpp_oam_mirror_data_free(int unit, uint32 trap_code); 58 59 int _bcm_dpp_oam_free_mirror_profile_find(int unit, uint32 * free_mirror_profile, uint32 cpu_trap_code, uint8 *found_match); 60 61 int _bcm_oam_trap_and_mirror_profile_set(int unit, 62 SOC_PPC_OAM_TRAP_ID trap_index, 63 SOC_PPC_OAM_UPMEP_TRAP_ID upmep_trap_index, 64 bcm_rx_trap_config_t * trap_config, 65 uint32 trap_code, 66 uint32 trap_code_upmep, 67 SOC_PPC_OAM_MIRROR_ID mirror_ndx, 68 uint8 set_upmep); 69 70 int _bcm_oam_trap_and_mirror_profile_up_lbm_set(int unit, bcm_rx_trap_config_t * trap_config); 71 72 int _bcm_oam_default_profile_get(int unit, 73 SOC_PPC_OAM_LIF_PROFILE_DATA *profile_data, 74 SOC_PPC_OAM_CLASSIFIER_MEP_ENTRY *classifier_mep_entry, 75 uint8 is_accelerated, 76 uint8 is_default, 77 uint8 is_upmep); 78 79 /* Configure default accelerated/non-accelerated profile for RFC6374 endpoints */ 80 int _bcm_oam_rfc6374_default_profile_get(int unit, 81 SOC_PPC_OAM_LIF_PROFILE_DATA *profile_data, 82 SOC_PPC_OAM_CLASSIFIER_MEP_ENTRY *classifier_mep_entry, 83 uint8 is_accelerated); 84 85 /* Gets the trap codes and trap strength from the destination gports, Sets mirror profile if required, Handles advanced egress snooping, 86 Sets OAMP RX trap if required 87 IN: unit, id, action, is_rfc6374_lm, is_rfc6374_dm 88 OUT: trap_code, trap_code2, trap_strength(taken from 'destination' gport similar to trap_code) */ 89 int _bcm_dpp_oam_bfd_trap_code_get_and_prepare_for_action(int unit, SOC_PPC_OAM_CLASSIFIER_MEP_ENTRY* classifier_mep_entry, 90 uint8 is_rfc6374_lm, uint8 is_rfc6374_dm, 91 bcm_gport_t destination, bcm_gport_t destination2, 92 uint32* trap_code, uint32* trap_code2); 93 94 /* OAMP errors trap allocation */ 95 int _bcm_dpp_oam_error_trap_allocate(int unit, bcm_rx_trap_t trap_type, uint32 oamp_error_trap_id); 96 int _bcm_dpp_oam_error_trap_destroy(int unit, uint32 oamp_error_trap_id); 97 int _bcm_dpp_oam_error_trap_set(int unit, uint32 oamp_error_trap_id, bcm_gport_t dest_port); 98 int _bcm_dpp_oam_error_trap_get(int unit, uint32 oamp_error_trap_id, bcm_gport_t * dest_port); 99 100 #endif /* _BCM_INT_DPP_OAM_RESOURCE_H_ */