openbcm

Git mirror of https://github.com/Broadcom-Network-Switching-Software/OpenBCM
git clone git://git.finwo.net/mirror/broadcom/openbcm
Log | Files | Refs | README

oam_dissect.h (9482B)


      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 input analysis and validation internal header
      8  */
      9 
     10 #ifndef _BCM_INT_DPP_OAM_DISSECT_H_
     11 #define _BCM_INT_DPP_OAM_DISSECT_H_
     12 
     13 #include <sal/types.h>
     14 #include <bcm/types.h>
     15 #include <bcm/oam.h>
     16 #include <bcm/bfd.h>
     17 #include <shared/hash_tbl.h>
     18 #include <shared/swstate/sw_state_hash_tbl.h>
     19 
     20 #include <soc/dpp/PPD/ppd_api_oam.h>
     21 #include <soc/dpp/PPC/ppc_api_oam.h>
     22 #include <soc/dpp/PPD/ppd_api_trap_mgmt.h>
     23 #include <soc/dpp/ARAD/ARAD_PP/arad_pp_dbal.h>
     24 #include <soc/dpp/ARAD/ARAD_PP/arad_pp_oam.h>
     25 
     26 /*
     27  * Defines and macros
     28  */
     29 
     30 /* Trap code used for snooping to the CPU while keeping the original system-headers */
     31 #define _BCM_OAM_TRAP_CODE_CPU_KEEP_ORIG_HEADERS(_trap_code) ((_trap_code)==SOC_PPC_TRAP_CODE_OAM_CPU_SNOOP_UP)
     32 
     33 #define _BCM_OAM_IS_SERVER_CLIENT(endpoint_info) (endpoint_info->tx_gport==BCM_GPORT_INVALID && endpoint_info->remote_gport !=BCM_GPORT_INVALID)
     34 #define _BCM_OAM_IS_SERVER_SERVER(endpoint_info) (endpoint_info->tx_gport!=BCM_GPORT_INVALID && endpoint_info->remote_gport !=BCM_GPORT_INVALID)
     35 
     36 #define _BCM_OAM_IS_ENDPOINT_RFC6374(p_endpoint_info) \
     37                           (((p_endpoint_info)->type == bcmOAMEndpointTypeMplsLmDmPw) || \
     38                            ((p_endpoint_info)->type == bcmOAMEndpointTypeMplsLmDmLsp) || \
     39                            ((p_endpoint_info)->type == bcmOAMEndpointTypeMplsLmDmSection))
     40 
     41 #define _BCM_OAM_IS_MEP_ID_DEFAULT(_unit, _epid)                                \
     42                (SOC_IS_ARAD_B1_AND_BELOW(_unit)                                 \
     43                   ? ((_epid) == -1)                                             \
     44                   : ((!SOC_IS_JERICHO_B0_AND_ABOVE(_unit))  \
     45                       ? (((_epid) == BCM_OAM_ENDPOINT_DEFAULT_INGRESS0)         \
     46                          ||((_epid) == BCM_OAM_ENDPOINT_DEFAULT_INGRESS1)       \
     47                          ||((_epid) == BCM_OAM_ENDPOINT_DEFAULT_INGRESS2)       \
     48                          ||((_epid) == BCM_OAM_ENDPOINT_DEFAULT_INGRESS3)       \
     49                          ||((_epid) == BCM_OAM_ENDPOINT_DEFAULT_EGRESS0))       \
     50 /*QAX and above*/     : (((_epid) == BCM_OAM_ENDPOINT_DEFAULT_INGRESS0)         \
     51                           ||((_epid) == BCM_OAM_ENDPOINT_DEFAULT_INGRESS1)      \
     52                           ||((_epid) == BCM_OAM_ENDPOINT_DEFAULT_INGRESS2)      \
     53                           ||((_epid) == BCM_OAM_ENDPOINT_DEFAULT_INGRESS3)      \
     54                           ||((_epid) == BCM_OAM_ENDPOINT_DEFAULT_EGRESS0)       \
     55                           ||((_epid) == BCM_OAM_ENDPOINT_DEFAULT_EGRESS1)       \
     56                           ||((_epid) == BCM_OAM_ENDPOINT_DEFAULT_EGRESS2)       \
     57                           ||((_epid) == BCM_OAM_ENDPOINT_DEFAULT_EGRESS3))))
     58 
     59 #define _BCM_OAM_IS_MEP_ID_EGRESS_UNSUPPORTED_DEFAULT(_unit, _epid)                                \
     60                       ((SOC_IS_JERICHO_B0_AND_ABOVE(_unit)) &&  \
     61                          (((_epid) == BCM_OAM_ENDPOINT_DEFAULT_EGRESS1)       \
     62                           ||((_epid) == BCM_OAM_ENDPOINT_DEFAULT_EGRESS2)       \
     63                           ||((_epid) == BCM_OAM_ENDPOINT_DEFAULT_EGRESS3)))
     64 
     65 /* Is endpoint_info struct represents an accelerated endpoint */
     66 #define _BCM_OAM_DISSECT_IS_ENDPOINT_ACCELERATED(p_endpoint_info) \
     67                           (((p_endpoint_info)->opcode_flags & BCM_OAM_OPCODE_CCM_IN_HW) == BCM_OAM_OPCODE_CCM_IN_HW)
     68 
     69 /* Is endpoint_info struct represents an up-MEP */
     70 #define _BCM_OAM_DISSECT_IS_ENDPOINT_UPMEP(p_endpoint_info) \
     71                           (((p_endpoint_info)->flags & BCM_OAM_ENDPOINT_UP_FACING) == BCM_OAM_ENDPOINT_UP_FACING)
     72 
     73 /* Is endpoint_info struct represents a MIP */
     74 #define _BCM_OAM_DISSECT_IS_ENDPOINT_MIP(p_endpoint_info) \
     75                           (((p_endpoint_info)->flags & BCM_OAM_ENDPOINT_INTERMEDIATE) == BCM_OAM_ENDPOINT_INTERMEDIATE)
     76 
     77 /* Is classifier struct represents an accelerated endpoint */
     78 #define _BCM_OAM_DISSECT_IS_CLASSIFIER_MEP_ACCELERATED(p_classifier_mep_entry) \
     79                           (((p_classifier_mep_entry)->flags & SOC_PPC_OAM_CLASSIFIER_MEP_ENTRY_FLAG_ACCELERATED) == SOC_PPC_OAM_CLASSIFIER_MEP_ENTRY_FLAG_ACCELERATED)
     80 
     81 /* Is classifier struct represents an up-MEP */
     82 #define _BCM_OAM_DISSECT_IS_CLASSIFIER_MEP_UPMEP(p_classifier_mep_entry) \
     83                           (((p_classifier_mep_entry)->flags & SOC_PPC_OAM_CLASSIFIER_MEP_ENTRY_FLAG_UPMEP) == SOC_PPC_OAM_CLASSIFIER_MEP_ENTRY_FLAG_UPMEP)
     84 
     85 /* Is classifier struct represents a MIP */
     86 #define _BCM_OAM_DISSECT_IS_CLASSIFIER_MIP(p_classifier_mep_entry) \
     87                           (((p_classifier_mep_entry)->flags & SOC_PPC_OAM_CLASSIFIER_MEP_ENTRY_FLAG_ENDPOINT) == 0)
     88 
     89 /* Is classifier struct Down MEP injection endpoint */
     90 #define _BCM_OAM_DISSECT_IS_CLASSIFIER_DOWN_MEP_INJECTION(p_classifier_mep_entry) \
     91                           (((p_classifier_mep_entry)->flags & SOC_PPC_OAM_CLASSIFIER_MEP_ENTRY_FLAG_DOWN_MEP_INJECTION) == SOC_PPC_OAM_CLASSIFIER_MEP_ENTRY_FLAG_DOWN_MEP_INJECTION)
     92 
     93 
     94 
     95 #define _BCM_OAM_DISSECT_IS_DEFAULT_ENDPOINT_UPMEP(endpoint) \
     96                          ((endpoint)->id == BCM_OAM_ENDPOINT_DEFAULT_EGRESS0 || (endpoint)->id <= BCM_OAM_ENDPOINT_DEFAULT_EGRESS1 \
     97                                       || (endpoint)->id <= BCM_OAM_ENDPOINT_DEFAULT_EGRESS2 || (endpoint)->id <= BCM_OAM_ENDPOINT_DEFAULT_EGRESS3 )
     98 
     99 
    100 /* Classification is done through the IHB_OAMB table in the following cases:
    101    1. Accelerated endpoint
    102    2. "Multiple endpoint on LIF" (Arad+), Endpoint only
    103    3. Server on the client side*/
    104 #define _BCM_OAM_DISSECT_CLASSIFICATION_BY_OAM2(unit, p_classifier_mep_entry, endpoint_id)\
    105            (_BCM_OAM_DISSECT_IS_CLASSIFIER_MEP_ACCELERATED(p_classifier_mep_entry) ||  _BCM_OAM_MEP_INDEX_IS_SERVER_CLIENT_SIDE(endpoint_id) \
    106            || (SOC_PPD_OAM_IS_CLASSIFIER_ADVANCED_MULTIPLE_MEPS_ON_LIF_MODE(unit) && !_BCM_OAM_DISSECT_IS_CLASSIFIER_MIP(p_classifier_mep_entry)) )
    107 
    108 /* Check valid channel_type range - Channel type field is 16 bit */
    109 #define _BCM_OAM_DISSECT_MPLS_TP_CHANNEL_TYPE_IN_VALID_RANGE(channel_type)\
    110                         (channel_type >= 0 && channel_type < (1 << 16))
    111 
    112 /*
    113  * Function declaration
    114  */
    115 
    116 /* Validity checks used by default and non default endpoints alike. */
    117 int _bcm_oam_endpoint_validity_checks_all(int unit, bcm_oam_endpoint_info_t *endpoint_info);
    118 
    119 /* Validity checks for all types of non-default endpoints */
    120 int _bcm_oam_generic_endpoint_validity_checks(int unit, const bcm_oam_endpoint_info_t *endpoint_info);
    121 
    122 /* Validity checks for OAMoETH endpoints */
    123 int _bcm_oam_ethernet_endpoint_validity_checks(int unit, const bcm_oam_endpoint_info_t *endpoint_info);
    124 
    125 /* Validity checks for OAMoMPLS/PWE endpoints */
    126 int _bcm_oam_mpls_pwe_endpoint_validity_checks(int unit, bcm_oam_endpoint_info_t *endpoint_info);
    127 
    128 /* Validity checks for RFC6374 endpoints */
    129 int _bcm_oam_rfc6374_endpoint_validity_checks(int unit, const bcm_oam_endpoint_info_t *endpoint_info);
    130 
    131 /* perform endpoint create validity check for default endpoint. */
    132 int _bcm_oam_default_endpoint_validity_checks(int unit, const bcm_oam_endpoint_info_t *endpoint_info);
    133 
    134 /* Validity checks before replacing a local MEP */
    135 int _bcm_oam_endpoint_local_replace_validity_check(int unit, bcm_oam_endpoint_info_t *endpoint_info_lcl,
    136                                                    bcm_oam_endpoint_info_t *existing_endpoint_info,
    137                                                    SOC_PPC_OAM_CLASSIFIER_MEP_ENTRY *classifier_mep_entry);
    138 
    139 /* Validity checks before adding a loopback object to an endpoint (Arad+ only) */
    140 int _bcm_oam_loopback_validity_check(int unit, bcm_oam_loopback_t *loopback_ptr,
    141                                      SOC_PPC_OAM_CLASSIFIER_MEP_ENTRY *classifier_mep_entry);
    142 
    143 /* Validity checks before adding an action_set */
    144 int _bcm_oam_endpoint_action_set_validity_check(int unit, bcm_oam_endpoint_t id, bcm_oam_endpoint_action_t *action);
    145 
    146 /* Validity checks before adding/updating LM/DM entries pointed by MEP
    147    (QAX style) */
    148 int _bcm_oam_lm_dm_pointed_add_shared_verify(int unit, SOC_PPC_OAM_OAMP_LM_DM_MEP_DB_ENTRY *lm_dm_mep_db_entry,
    149                                              SOC_PPC_OAM_OAMP_MEP_DB_ENTRY *mep_entry);
    150 
    151 /* Validity checks before adding delay entry. */
    152 int _bcm_oam_delay_validity_checks(int unit, const bcm_oam_delay_t *delay_ptr, const SOC_PPC_OAM_CLASSIFIER_MEP_ENTRY* classifier_mep_entry);
    153 
    154 /* Validity checks for Y.1711 LM info */
    155 int _bcm_oam_y1711_lm_validity_checks(int unit, const bcm_oam_endpoint_info_t *endpoint_info);
    156 
    157 
    158 /* 
    159  * This function contains all the sanity 
    160  * checks required when creating or 
    161  * renaming maintenance endpoint groups 
    162  * (MEGs) 
    163 */ 
    164 int _bcm_oam_group_create_verify(int unit, bcm_oam_group_info_t *group_info);
    165 
    166 /* 
    167  * This function contains all the sanity 
    168  * checks required for the channel type values 
    169  * variable in channel_type_rx_set
    170  * function.
    171  */ 
    172 int _bcm_oam_mpls_tp_rx_channel_type_values_validity_check (int unit, int num_channel_types, int *list_of_channel_types);
    173 
    174 /* 
    175  * This function contains all the sanity 
    176  * checks required for the channel type value
    177  * variable in channel_type_tx_set
    178  * function.
    179  */ 
    180 int _bcm_oam_mpls_tp_tx_channel_type_value_validity_check (int unit, int channel_type);
    181 
    182 #endif /* _BCM_INT_DPP_OAM_DISSECT_H_ */