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.h (48307B)


      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-2019 Broadcom Inc. All rights reserved.
      7  */
      8 
      9 #ifndef __BCM_INT_OAM_H__
     10 #define __BCM_INT_OAM_H__
     11 
     12 #include <bcm/oam.h>
     13 
     14 #if defined(BCM_TRIUMPH3_SUPPORT) || defined(BCM_HURRICANE2_SUPPORT) || \
     15     defined(BCM_KATANA2_SUPPORT)
     16 #include <shared/idxres_fl.h>
     17 #include <shared/idxres_afl.h>
     18 #include <shared/hash_tbl.h>
     19 #include <soc/mem.h>
     20 #include <soc/profile_mem.h>
     21 #endif
     22 
     23 #if defined(BCM_ENDURO_SUPPORT) || defined(BCM_TRIUMPH3_SUPPORT) || \
     24     defined(BCM_HURRICANE2_SUPPORT) || defined(BCM_KATANA2_SUPPORT)
     25 #include <bcm/field.h>
     26 #include <bcm_int/esw/trunk.h>
     27 #endif
     28 
     29 #include <soc/shared/bhh_msg.h>
     30 
     31 
     32 extern int bcm_esw_oam_lock(int unit);
     33 extern int bcm_esw_oam_unlock(int unit);
     34 #ifdef BCM_WARM_BOOT_SUPPORT
     35 extern int _bcm_esw_oam_sync(int unit);
     36 #endif
     37 #ifdef BCM_WARM_BOOT_SUPPORT_SW_DUMP
     38 extern void _bcm_oam_sw_dump(int unit);
     39 #endif /* BCM_WARM_BOOT_SUPPORT_SW_DUMP */
     40 #define _BCM_OAM_ENDPOINT_CCM_PERIOD_UNDEFINED 0xFFFFFFFF
     41 
     42 #define _BCM_OAM_MAC_DA_UPPER_32 0x0180C200
     43 #define _BCM_OAM_MAC_DA_LOWER_13 0x0030 /* To be >> 3 before use */
     44 
     45 #define _BCM_OAM_INVALID_INDEX (-1) /* Invalid Index */
     46 
     47 #if defined(INCLUDE_BHH)
     48 #define _BCM_OAM_BHH_MEL_MAX 0x07
     49 /*TR3 needs 26624 endpoints. So leave 4K endpoints and start from 30720 for BHH*/
     50 #define _BCM_OAM_BHH_ENDPOINT_OFFSET  30720
     51 #ifdef BCM_KATANA2_SUPPORT
     52 #define _BCM_OAM_BHH_SB2_ENDPOINT_OFFSET(oc) \
     53     ((oc->ep_count) - (oc->bhh_endpoint_count))
     54 #define _BCM_OAM_BHH_KT2_ENDPOINT_OFFSET     22528 
     55 #endif
     56 #endif /* BHH */
     57 
     58 /* MEPID range 1-8191 */
     59 #define _BCM_OAM_EP_NAME_MIN 1
     60 #define _BCM_OAM_EP_NAME_MAX 8191
     61 
     62 #ifdef BCM_KATANA2_SUPPORT
     63 #define _BCM_OAM_DOMAIN_PORT                 0x0
     64 #define _BCM_OAM_DOMAIN_CVLAN                0x01
     65 #define _BCM_OAM_DOMAIN_SVLAN                0x02
     66 #define _BCM_OAM_DOMAIN_S_PLUS_CVLAN         0x03
     67 #define _BCM_OAM_DOMAIN_VP                   0x04
     68 #define _BCM_OAM_DOMAIN_BHH                  0x05
     69 
     70 #ifdef BCM_SABER2_SUPPORT
     71 #define _BCM_SB2_OAM_DOMAIN_MPLS_LMDM_PW                   0x05
     72 #define _BCM_SB2_OAM_DOMAIN_ING_MPLS_LMDM_LSP              0x06
     73 #define _BCM_SB2_OAM_DOMAIN_BHH                            0x06
     74 #define _BCM_SB2_OAM_DOMAIN_EGR_MPLS_LMDM_LSP              0x07
     75 #define _BCM_SB2_OAM_DOMAIN_MPLS_SECTION                   0x08
     76 #define _BCM_SB2_OAM_DOMAIN_MPLS_SECTION_CVLAN             0x09
     77 #define _BCM_SB2_OAM_DOMAIN_MPLS_SECTION_SVLAN             0xA
     78 #define _BCM_SB2_OAM_DOMAIN_MPLS_SECTION_S_PLUS_CVLAN      0xB
     79 
     80 /* 3 counter pools in Saber2 */
     81 #define _BCM_MAX_OAM_COUNTER_POOLS                     3
     82 
     83 #else
     84 
     85 /* 2 counter pools in Katana2 */
     86 #define _BCM_MAX_OAM_COUNTER_POOLS           2
     87 
     88 #endif
     89 #define _BCM_OAM_KATANA2_ENDPOINT_MAX        32768
     90 /* Maximum of 11k endpoints in Saber2
     91  * But hash table creation expects a nearest power
     92  * of 2. So keeping it 16k
     93  */
     94 #define _BCM_OAM_SABER2_ENDPOINT_MAX         16384
     95 #define _BCM_OAM_METROLITE_ENDPOINT_MAX       8192
     96 #endif
     97 
     98 #define _BCM_OAM_TRIUMPH3_ENDPOINT_MAX     32768
     99 #define _BCM_OAM_HURRICANE2_ENDPOINT_MAX   8192
    100 #define SOC_MEM_KEY_L3_ENTRY_LMEP            4
    101 #define SOC_MEM_KEY_L3_ENTRY_RMEP            5
    102 
    103 /* MIN/MAX macro definition */
    104 #ifndef MAX
    105 #define MAX(a,b) ((a) > (b) ? (a) : (b))
    106 #endif
    107 
    108 #ifndef MIN
    109 #define MIN(a,b) ((a) < (b) ? (a) : (b))
    110 #endif
    111 
    112 /*
    113  * Typedef:
    114  *      _bcm_oam_group_t
    115  * Purpose:
    116  *      Group information.
    117  */
    118 struct _bcm_oam_group_s
    119 {
    120     int     in_use;                          /* Group status.   */
    121     uint8   name[BCM_OAM_GROUP_NAME_LENGTH]; /* Group name.     */
    122     bcm_oam_group_fault_alarm_defect_priority_t lowest_alarm_priority; /*Alarms
    123                     are generated for priority greater than or equal to this */
    124 };
    125 typedef struct _bcm_oam_group_s _bcm_oam_group_t;
    126 
    127 /*
    128  * Typedef:
    129  *      _bcm_oam_endpoint_t
    130  * Purpose:
    131  *      Endpoint information.
    132  *      One structure for each endpoint created on device.
    133  */
    134 struct _bcm_oam_endpoint_s
    135 {
    136     bcm_oam_endpoint_type_t type;           /* Type */
    137     int                 in_use;             /* Endpoint status.             */
    138     int                 is_remote;          /* Local or Remote MEP.         */
    139     bcm_oam_group_t     group_index;        /* Group ID.                    */
    140     uint16              name;               /* Endpoint name.               */
    141     int                 level;              /* Maintenance domain level.    */
    142     bcm_vlan_t          vlan;               /* Vlan membership.             */
    143     uint32              glp;                /* Generic local port number.   */
    144     int                 local_tx_enabled;   /* CCM Tx enabled.              */
    145     int                 local_rx_enabled;   /* CCM Rx enabled.              */
    146     uint32              period;             /* CCM interval encoding.       */
    147     int                 remote_index;       /* RMEP entry hardware index.   */
    148     int                 local_tx_index;     /* LMEP Tx endpoint Hw index.   */
    149     int                 local_rx_index;     /* LMEP Rx endpoint Hw index.   */
    150     uint8               trunk_index;        /* Trunk index */
    151 #if defined(BCM_ENDURO_SUPPORT)
    152     uint32              vp;                 /* Virtual Port.                */
    153     uint32              flags;              /* Endpoint flags.              */
    154     int                 lm_counter_index;   /* LM counter index.            */
    155     int                 pri_map_index;      /* LM Priority Map Index.       */
    156     bcm_field_entry_t   vfp_entry;          /* Field Lookup stage entry ID. */
    157     bcm_field_entry_t   fp_entry_tx;        /* FP LM Tx entry ID.           */
    158     bcm_field_entry_t   fp_entry_rx;        /* FP LM Rx entry ID.           */
    159     bcm_field_entry_t   fp_entry_trunk[BCM_SWITCH_TRUNK_MAX_PORTCNT];
    160                                             /* FP trunk entry ID            */
    161 #endif
    162 #if defined(BCM_KATANA_SUPPORT)
    163     int                 opcode_profile_index; /* Opcode profile table index.*/
    164     uint32              opcode_flags;       /* Endpoint opcode flags.       */
    165 #if defined(INCLUDE_BHH)
    166     bcm_gport_t         gport;              /* gport identifier */
    167     bcm_if_t            egress_if;          /* egress interface */
    168     uint8               vlan_pri;           /* VLAN tag priority */
    169     uint8               inner_vlan_pri;           /* Inner VLAN tag priority */
    170     bcm_mpls_label_t    label;              /* incoming inner label */
    171     uint8               cpu_qid;            /* CPU queue for BHH */
    172     bcm_oam_vccv_type_t vccv_type;          /* VCCV pseudowire type */
    173     int                 bhh_endpoint_index;
    174     bcm_vpn_t           vpn;
    175     bcm_mpls_label_t    egr_label;
    176     uint8               egr_label_exp;
    177     uint8               egr_label_ttl;
    178 #endif /* INCLUDE_BHH */
    179 #endif /* BCM_KATANA_SUPPORT */
    180 };
    181 typedef struct _bcm_oam_endpoint_s _bcm_oam_endpoint_t;
    182 
    183 
    184 /*
    185  * Typedef:
    186  *      _bcm_oam_event_handler_t
    187  * Purpose:
    188  *      Event handler information.
    189  */
    190 struct _bcm_oam_event_handler_s
    191 {
    192     bcm_oam_event_types_t           event_types; /* Type of event detected. */
    193     bcm_oam_event_cb                cb;          /* Registered callback
    194                                                     routine. */
    195     void                            *user_data;  /* Application supplied
    196                                                     data. */
    197     struct _bcm_oam_event_handler_s *next_p;     /* Pointer to next event. */
    198 };
    199 /*
    200  * Typedef:
    201  *      _bcm_oam_pm_event_handler_t
    202  * Purpose:
    203  *      PM Event handler information.
    204  */
    205 struct _bcm_oam_pm_event_handler_s
    206 {
    207     bcm_oam_event_types_t           event_types; /* Type of event detected. */
    208     bcm_oam_pm_event_cb             cb;          /* Registered callback
    209                                                     routine. */
    210     void                            *user_data;  /* Application supplied
    211                                                     data. */
    212     struct _bcm_oam_pm_event_handler_s *next_p;     /* Pointer to next event. */
    213 };
    214 
    215 typedef struct _bcm_oam_event_handler_s _bcm_oam_event_handler_t;
    216 typedef struct _bcm_oam_pm_event_handler_s _bcm_oam_pm_event_handler_t;
    217 
    218 
    219 /*
    220  * Typedef:
    221  *      _bcm_oam_info_t
    222  * Purpose:
    223  *      One structure for each StrataSwitch Device that holds the global
    224  *      OAM metadata for one device.
    225  */
    226 struct _bcm_oam_info_s
    227 {
    228     int                 initialized;            /* TRUE if oam module has 
    229                                                    been been initialized.   */
    230     int                 group_count;            /* No. of oam groups supported
    231                                                    on this device.          */
    232     _bcm_oam_group_t    *groups;                /* Pointer to oam group name 
    233                                                    and group status.        */
    234     int                 local_rx_endpoint_count; /* Total RX LMEP indices
    235                                                     supported on device.    */
    236     int                 local_tx_endpoint_count; /* Total TX LMEP indices
    237                                                     supported on device.    */
    238     int                 remote_endpoint_count;   /* Total RMEP indices
    239                                                     supported on device.    */
    240     int                 endpoint_count;          /* Total no. of endpoints
    241                                                     supported on device.
    242                                                     (local_rx + local_tx
    243                                                     remote).                */
    244 #if defined(BCM_ENDURO_SUPPORT)
    245     bcm_field_qset_t    vfp_qs;                  /* Vlan and Mac match qset.*/
    246     bcm_field_qset_t    fp_vp_qs;                /* Virtual port qset.      */
    247     bcm_field_qset_t    fp_glp_qs;               /* Physical port qset.     */
    248     bcm_field_group_t   vfp_group;               /* VFP Group ID            */
    249     bcm_field_group_t   fp_vp_group;             /* IFP Group ID for Logical
    250                                                     ports                   */
    251     bcm_field_group_t   fp_glp_group;            /* IFP Group ID for Physical
    252                                                     Ports*/
    253     int                 vfp_entry_count;         /* VFP group entries used. */
    254     int                 fp_vp_entry_count;       /* IFP group entries used. */
    255     int                 fp_glp_entry_count;      /* IFP group entries used. */
    256     int                 lm_counter_count;        /* Total Loss Measurement
    257                                                     counters supported on
    258                                                     device                  */
    259     SHR_BITDCL          *lm_counter_in_use;      /* Loss Measurement counters
    260                                                     used.                   */
    261 #endif
    262     SHR_BITDCL          *local_tx_endpoints_in_use; /* TX LMEP indices that
    263                                                        are in use.          */
    264     SHR_BITDCL          *local_rx_endpoints_in_use; /* RX LMEP indices that
    265                                                        are in use.          */
    266     SHR_BITDCL          *remote_endpoints_in_use;   /* RMEP indices that are
    267                                                        in use.              */
    268     bcm_oam_endpoint_t  *remote_endpoints;          /* Endpoint ID/Index.   */
    269     _bcm_oam_endpoint_t *endpoints;                 /* Endpoint information.*/
    270     _bcm_oam_event_handler_t *event_handler_list_p; /* Event handlers
    271                                                        callbacks.           */
    272     int                 event_handler_count[bcmOAMEventCount]; /* Events
    273                                                                   occurrance
    274                                                                   count.    */
    275 #if defined(INCLUDE_BHH)
    276     int                 unit;                   /* Used for callback thread */
    277     bcm_cos_queue_t cpu_cosq;   /* CPU cos queue for RX BHH packets */
    278     int cpu_cosq_ach_error_index;   /* CPU cos queue map index for error packets */
    279     int cpu_cosq_invalid_error_index;   /* CPU cos queue map index for error packets */
    280     int rx_channel;             /* Local RX DMA channel for BHH packets */
    281     int uc_num;                 /* uController number running BHH appl */
    282     int dma_buffer_len;         /* DMA max buffer size */
    283     uint8* dma_buffer;          /* DMA buffer */
    284     uint8* dmabuf_reply;        /* DMA reply buffer */
    285     int    bhh_endpoint_count;
    286     sal_thread_t event_thread_id;            /* Event handler thread id */
    287     uint32 event_mask;                       /* Events registered with uKernel */
    288     int ukernel_not_ready;
    289     uint16 bhh_max_encap_length;
    290 #endif
    291 };
    292 
    293 typedef struct _bcm_oam_info_s _bcm_oam_info_t;
    294 
    295 
    296 /*
    297  * Typedef:
    298  *      _bcm_oam_fault_t
    299  * Purpose:
    300  *      OAM group defects information structure.
    301  */
    302 struct _bcm_oam_fault_s
    303 {
    304     int     current_field;      /* Defects field.            */
    305     int     sticky_field;       /* Defects sticky field.     */
    306     uint32  mask;               /* Defects mask bits.        */
    307     uint32  clear_sticky_mask;  /* Sticky defects mask bits. */
    308 };
    309 
    310 typedef struct _bcm_oam_fault_s _bcm_oam_fault_t;
    311 
    312 
    313 /*
    314  * Typedef:
    315  *      _bcm_oam_interrupt_t
    316  * Purpose:
    317  *      OAM group interrupt information structure.
    318  */
    319 struct _bcm_oam_interrupt_s
    320 {
    321     soc_reg_t            status_register;      /* Interrupt status register.*/
    322     soc_field_t          endpoint_index_field; /* Remote endpoint index.    */
    323     soc_field_t          group_index_field;    /* Group index.              */
    324     soc_field_t          status_field;         /* Interrupt status field.   */
    325     bcm_oam_event_type_t event_type;           /* Event type.               */
    326 };
    327 
    328 typedef  struct _bcm_oam_interrupt_s _bcm_oam_interrupt_t;
    329 
    330 
    331 /*
    332  * Typedef:
    333  *      oam_hdr_t
    334  * Purpose:
    335  *      OAM PDU header information structure.
    336  *      Used in OAM application diagnostics code.
    337  */
    338 struct oam_hdr_s {
    339     uint8 mdl_ver;          /* Maintenance domain level + Version.  */
    340     uint8 opcode;           /* Identifies OAM packet type.          */
    341     uint8 flags;            /* Infomation depends on OAM PDU type.  */
    342     uint8 first_tlvoffset;  /* Offset to first TLV.                 */
    343 };
    344 
    345 typedef struct oam_hdr_s oam_hdr_t;
    346 
    347 
    348 /*
    349  * Typedef:
    350  *      oam_lm_pkt_t
    351  * Purpose:
    352  *      OAM Loss Measurement counter information.
    353  */
    354 struct oam_lm_pkt_s {
    355     uint32 txfcf; /* Value of local counter TxFCl. */
    356     uint32 rxfcf; /* Value of local counter RxFCl. */
    357     uint32 txfcb; /* Value of TxFCf in the last received CCM frame from peer
    358                      MEP. */
    359 };
    360 
    361 typedef struct oam_lm_pkt_s oam_lm_pkt_t;
    362 
    363 
    364 /*
    365  * Typedef:
    366  *      oam_dm_pkt_t
    367  * Purpose:
    368  *      OAM Delay Measurement time stamp information.
    369  */
    370 struct oam_dm_pkt_s {
    371     uint32 txtsf_upper; /* Timestamp at the transmission time of DMM frame.  */
    372     uint32 txtsf;
    373     uint32 rxtsf_upper; /* Timestamp at the time of receiving the DMM frame. */
    374     uint32 rxtsf;
    375     uint32 txtsb_upper; /* Timestamp at the transmission time of DMR frame.  */
    376     uint32 txtsb;
    377     uint32 rxtsb_upper; /* Timestamp at the time of receiving the DMR frame. */
    378     uint32 rxtsb;
    379 };
    380 
    381 typedef struct oam_dm_pkt_s oam_dm_pkt_t;
    382 
    383 #if defined(BCM_TRIUMPH3_SUPPORT)  ||  \
    384     defined(BCM_HURRICANE2_SUPPORT) || \
    385     defined(BCM_KATANA2_SUPPORT)
    386       /* BCM_TRIUMPH3_SUPPORT /BCM_HURRICANE2_SUPPORT/BCM_KATANA2_SUPPORT */
    387 
    388 #define _BCM_OAM_ESW_EP_INVALID_FLAGS_MASK              \
    389             ((BCM_OAM_ENDPOINT_PORT_STATE_TX)           \
    390              | (BCM_OAM_ENDPOINT_INTERFACE_STATE_TX))
    391 
    392 #define _BCM_OAM_REMOTE_EP_INVALID_FLAGS_MASK           \
    393             ((BCM_OAM_ENDPOINT_CCM_RX)                  \
    394              | (BCM_OAM_ENDPOINT_LOOPBACK)              \
    395              | (BCM_OAM_ENDPOINT_DELAY_MEASUREMENT)     \
    396              | (BCM_OAM_ENDPOINT_LINKTRACE)             \
    397              | (BCM_OAM_ENDPOINT_LOSS_MEASUREMENT)      \
    398              | (_BCM_OAM_ESW_EP_INVALID_FLAGS_MASK))
    399 
    400 #define _BCM_OAM_EP_RX_ENABLE                      \
    401             ((BCM_OAM_ENDPOINT_CCM_RX)             \
    402             | (BCM_OAM_ENDPOINT_LOOPBACK)          \
    403             | (BCM_OAM_ENDPOINT_DELAY_MEASUREMENT) \
    404             | (BCM_OAM_ENDPOINT_LOSS_MEASUREMENT)  \
    405             | (BCM_OAM_ENDPOINT_LINKTRACE))
    406 
    407 #define _BCM_OAM_EP_LEVEL_BIT_COUNT (3)
    408 
    409 /* Endpoint port TLV mask. */
    410 #define _BCM_OAM_PORT_TLV_MASK      (0x3)
    411 
    412 /* Endpoint interface TLV mask. */
    413 #define _BCM_OAM_INTERFACE_TLV_MASK (0x7)
    414 
    415 /* Endpoint opcode values mask. */
    416 #define _BCM_TR3_OAM_OPCODE_MASK (0x1ffff)
    417 
    418 #ifdef BCM_SABER2_SUPPORT
    419 /* Endpoint opcode values mask. */
    420 #define _BCM_SB2_OAM_OPCODE_MASK       (0x3ffffff)
    421 #define _BCM_SB2_OAM_OTHER_OPCODE_MASK (0x3ff)
    422 #define _BCM_SB2_MAX_PP_PORT           170
    423 
    424 /*Pool1: 2k/1k entries on 56460/56260 */
    425 #define _BCM_SB2_MAX_OAM_LM_CTRS_POOL_0(unit) soc_mem_index_count(unit, ING_OAM_LM_COUNTERS_0m)
    426 /*Pool2: 1k/0.5k entries on 56460/56260 */
    427 #define _BCM_SB2_MAX_OAM_LM_CTRS_POOL_1(unit) soc_mem_index_count(unit, ING_OAM_LM_COUNTERS_1m)
    428 /*Pool3: 1k/0.5k entries on 56460/56260 */
    429 #define _BCM_SB2_MAX_OAM_LM_CTRS_POOL_2(unit) soc_mem_index_count(unit, ING_OAM_LM_COUNTERS_2m)
    430 
    431 #endif /* BCM_SABER2_SUPPORT */
    432 
    433 #ifdef BCM_KATANA2_SUPPORT
    434 /* Endpoint opcode values mask. */
    435 #define _BCM_KT2_OAM_OPCODE_MASK       (0x3ffffff)
    436 #define _BCM_KT2_OAM_OTHER_OPCODE_MASK (0x3ff)
    437 #define _BCM_KT2_MAX_PP_PORT           170
    438 #endif /* BCM_KATANA2_SUPPORT */
    439 
    440 #define _BCM_OAM_EP_GLP_VALID           (1 << 0)
    441 #define _BCM_OAM_EP_REPLACE             (1 << 1)
    442 #define _BCM_OAM_EP_RX_IDX_MDL_UPDATE   (1 << 2)
    443 
    444 #define _BCM_OAM_LM_COUNTER_IDX_INVALID  (-1)
    445 #if defined(BCM_TRIUMPH3_SUPPORT)
    446 #define _BCM_OAM_LM_COUNTER_TX_OFFSET   (1 << 13)
    447 #endif
    448 
    449 #define _BCM_OAM_MAX_MDL 0x07
    450 #define _BCM_OAM_ETHER_TYPE 0x8902
    451 
    452 /* Internal flags - used in hash_data->int_flags */
    453 #define _BCM_OAM_ENDPOINT_IS_VP_BASED         0x0001
    454 #define _BCM_OAM_ENDPOINT_BHH_PROACTIVE_LM    0x0002
    455 
    456 /*
    457  * Macro: _OAM_HASH_KEY_SIZE
    458  *
    459  * Purpose:
    460  *      OAM endpoint hash table key size.
    461  */
    462 
    463 /* Group ID + Endpoint Name + Level + Direction + Gport + 
    464                                                   VID/Label(inner and outer) */
    465 #define _OAM_HASH_KEY_SIZE (4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4)
    466 typedef uint8 _bcm_oam_hash_key_t[_OAM_HASH_KEY_SIZE];
    467 
    468 typedef struct _bcm_oam_endpoint_egress_interface_list_s {
    469     bcm_if_t egress_if;
    470     bcm_gport_t gport;
    471     struct _bcm_oam_endpoint_egress_interface_list_s *prev;
    472     struct _bcm_oam_endpoint_egress_interface_list_s *next;   
    473 } _bcm_oam_endpoint_egress_interface_list_t;
    474 
    475 /*
    476  * Typedef:
    477  *     _bcm_oam_hash_data_t
    478  * Purpose:
    479  *     Endpoint hash table data structure.
    480  */
    481 struct _bcm_oam_hash_data_s {
    482     bcm_oam_endpoint_type_t type;           /* Type */
    483     int                 in_use;             /* Endpoint status.              */
    484     bcm_oam_endpoint_t  ep_id;              /* Endpoint ID                   */
    485     uint8               is_remote;          /* Local or Remote MEP.          */
    486     uint16              name;               /* Endpoint name.                */
    487     int               level;                /* Maintenance domain level.     */
    488     bcm_vlan_t          vlan;               /* Vlan membership.              */
    489     bcm_vlan_t          inner_vlan;         /* C Vlan membership -when double
    490                                                                        tagged*/
    491     bcm_gport_t         gport;              /* Sw Generic Port.              */
    492     uint32              sglp;               /* Hw Src GLP CCM Rx port/trunk. */
    493     uint32              dglp;               /* Hw Dest GLP for CCM Tx.       */
    494     uint8               local_tx_enabled;   /* CCM Tx enabled.               */
    495     uint8               local_rx_enabled;   /* CCM Rx enabled.               */
    496     bcm_oam_group_t     group_index;        /* Group ID.                     */
    497     int                 remote_index;       /* RMEP entry hardware index.    */
    498     int                 lm_counter_index;   /* LM counter index.             */
    499     int                 pri_map_index;      /* LM Priority Map Index.        */
    500     int                 profile_index;      /* Opcode profile table index.   */
    501     int                 local_tx_index;     /* LMEP Tx endpoint Hw index.    */
    502     int                 local_rx_index;     /* LMEP Rx endpoint Hw index.    */
    503     uint32              vp;                 /* Virtual Port.                 */
    504     uint32              flags;              /* Endpoint flags.               */
    505     uint32              flags2;             /* Endpoint flags2.              */
    506     bcm_field_entry_t   vfp_entry;          /* Field Lookup stage entry ID.  */
    507     bcm_field_entry_t   fp_entry_tx;        /* FP LM Tx entry ID.            */
    508     bcm_field_entry_t   fp_entry_rx;        /* FP LM Rx entry ID.            */
    509     bcm_field_entry_t   fp_entry_trunk[BCM_SWITCH_TRUNK_MAX_PORTCNT];
    510                                             /* FP trunk entry ID             */
    511     uint32              period;             /* CCM interval encoding.        */
    512     uint32              opcode_flags;       /* Endpoint opcode flags.        */
    513     bcm_oam_timestamp_format_t ts_format;   /* Timestamp format: ntp/ptp     */
    514     bcm_mpls_label_t    label;              /* incoming inner label for
    515                                                either LSP or PW      */
    516     uint8               vlan_pri;           /* VLAN tag priority             */                                               
    517     bcm_if_t            egress_if;          /* egress interface              */
    518     _bcm_oam_endpoint_egress_interface_list_t *egress_if_list; /* List of egress 
    519                                       interfaces associated with LSP endpoint */
    520     bcm_cos_t           int_pri;            /* internal priority for outgoing
    521                                                CCM packets and BHH     */
    522     int                 trunk_index;        /* The trunk port index for this
    523                                                endpoint */
    524 #if defined(INCLUDE_BHH)
    525     uint8               cpu_qid;            /* CPU queue for BHH             */
    526     int                 bhh_endpoint_index;
    527     bcm_field_entry_t   bhh_dm_entry_rx;    /* FP entry for DM msg.          */
    528     bcm_field_entry_t   bhh_entry_pkt_rx;   /* pkt. count entry in RX direction*/
    529     bcm_field_entry_t   bhh_entry_pkt_tx;   /* pkt. count entry in TX direction*/
    530     bcm_field_entry_t   bhh_lm_entry_rx;    /* FP entry for LM msg.          */
    531 #endif /* INCLUDE_BHH */
    532 #if defined(BCM_KATANA2_SUPPORT)
    533     uint8               oam_domain;         /* Endpoint OAM domain           */
    534     int                 egr_pri_map_index;  /* LM Priority Map Index.     */
    535     int                 rx_ctr;             /* Base counter index            */
    536     int                 tx_ctr;             /* Base counter index            */
    537     uint32              src_pp_port;        /* Hw PP port                    */
    538     uint32              dst_pp_port;        /* Hw PP port                    */
    539     uint32              dglp1;              /* DGLP to redirect              */
    540     uint32              dglp2;              /* DGLP to redirect              */
    541     int                 dglp1_profile_index;/* DGLP profile table index.     */
    542     int                 dglp2_profile_index;/* DGLP profile table index.     */
    543     int                 outer_tpid;         /* Outer TPID value              */
    544     int                 inner_tpid;         /* Inner TPID value              */
    545     int                 subport_tpid;       /* subport TPID value            */
    546     int                 outer_tpid_profile_index;/* Outer TPID profile index. */
    547     int                 inner_tpid_profile_index;/* Inner TPID profile index. */
    548     int                 subport_tpid_profile_index;/* Subport TPID profile index.*/
    549     int                 ma_base_index;       /* Base Index of the MA entry for 
    550                                                this maintenance domain       */
    551     bcm_trunk_t         trunk_id;            /* Trunk ID of the gport        */
    552     uint8               active_mdl_bitmap;   /* Active MDL bitmap for MA     */ 
    553     uint32              int_flags;           /* Internal flags required for
    554                                                 indicating special cases */
    555 #endif /* BCM_KATANA2_SUPPORT */
    556 #if defined(INCLUDE_ETH_LM_DM)
    557     uint32              eth_l2_encap_length;
    558 #endif /* INCLUDE_ETH_LM_DM */
    559 #if defined(INCLUDE_BHH) || defined(INCLUDE_ETH_LM_DM) || defined(INCLUDE_MPLS_LM_DM)
    560     bcm_mac_t           src_mac_address;    /* The source MAC address associated
    561                                                with this endpoint */
    562     bcm_mac_t           dst_mac_address;    /* The destination MAC address
    563                                                associated with this endpoint */
    564     uint8               inner_vlan_pri;     /* Inner VLAN tag priority       */ 
    565 #endif
    566 #if defined(INCLUDE_MPLS_LM_DM) || defined(INCLUDE_ETH_LM_DM)
    567     uint32              lm_dm_int_flag; /* InternaL FLAG FOR ETH/MPLS LM_DM  */
    568     uint32              lm_dm_uc_session_id; /* Session Id on UC for this EP */
    569 #endif
    570 #if defined(INCLUDE_MPLS_LM_DM) || defined(INCLUDE_BHH)
    571     bcm_mpls_label_t    egr_label;          /* Outgoing label for MPLS OAM */
    572     uint8               egr_label_exp;      /* Outgoing exp for MPLS Label */
    573     uint8               egr_label_ttl;      /* Outgoing ttl for MPLS Label */
    574 #endif /* INCLUDE_MPLS_LM_DM || INCLUDE_BHH */
    575     bcm_oam_vccv_type_t vccv_type;          /* VCCV pseudowire type          */
    576     bcm_vpn_t           vpn;
    577     bcm_oam_pm_profile_t pm_profile_attached;
    578     int                 ctr_field_id;       /* Ctr index within MP_GROUP for
    579                                                this endpoint */
    580     int                 egr_ctr_field_id;   /* Ctr index within EGR_MP_GROUP for
    581                                                this endpoint */
    582     bcm_gport_t         resolved_trunk_gport;/* Resolved Trunk SW Generic Port*/
    583 #if defined(BCM_METROLITE_SUPPORT)
    584     uint8               lm_count_profile;   /* LM count profile for counting 
    585                                              * opcodes */
    586 #endif
    587     bcm_gport_t         tx_gport;
    588 };
    589 typedef struct _bcm_oam_hash_data_s _bcm_oam_hash_data_t;
    590 
    591 /*
    592  * Typedef:
    593  *     _bcm_oam_ep_list_t
    594  * Purpose:
    595  *     Doubly Link List of endpoint data. This list is created and maintained
    596  *     for each group.
    597  */
    598 struct _bcm_oam_ep_list_s {
    599     _bcm_oam_hash_data_t *ep_data_p;
    600     struct _bcm_oam_ep_list_s *next;
    601     struct _bcm_oam_ep_list_s *prev;
    602 };
    603 typedef struct _bcm_oam_ep_list_s _bcm_oam_ep_list_t;
    604 
    605 /*
    606  * Typedef:
    607  *     _bcm_oam_group_data_t
    608  * Purpose:
    609  *     Group information.
    610  */
    611 struct _bcm_oam_group_data_s
    612 {
    613     int                in_use;                          /* Group status.   */
    614     uint8              name[BCM_OAM_GROUP_NAME_LENGTH]; /* Group name.     */
    615     bcm_oam_group_fault_alarm_defect_priority_t lowest_alarm_priority; /*Alarms
    616                     are generated for priority greater than or equal to this */
    617     
    618     _bcm_oam_ep_list_t **ep_list;                       /* Group endpoints */
    619                                                         /* list.           */
    620     
    621 };
    622 typedef struct _bcm_oam_group_data_s _bcm_oam_group_data_t;
    623 
    624 #define _BCM_MPLS_OAM_NUM_SESSIONS_INVALID 4294967295u /* (2 ^ 32) - 1 */
    625 
    626 typedef enum _bcm_oam_ma_idx_alloc_scheme_e {
    627     _BCM_OAM_MA_IDX_ALLOC_COMBINED_POOL, /* Older scheme */
    628     _BCM_OAM_MA_IDX_ALLOC_SEPARATE_POOL  /* Newer scheme */
    629 }_bcm_oam_ma_idx_alloc_scheme_t;
    630 
    631 /* Older MA INDEX allocation scheme */
    632 #define MA_INDEX_ALLOC_SCHEME_COMBINED_POOL \
    633      (oc->ma_idx_alloc_scheme == _BCM_OAM_MA_IDX_ALLOC_COMBINED_POOL)
    634 /* Newer MA INDEX allocation scheme */
    635 #define MA_INDEX_ALLOC_SCHEME_SEPARATE_POOL \
    636      (oc->ma_idx_alloc_scheme == _BCM_OAM_MA_IDX_ALLOC_SEPARATE_POOL)
    637 
    638 #define _BCM_ETH_OAM_NUM_SESSIONS (oc->eth_oam_num_sessions)
    639 #define _BCM_MPLS_OAM_NUM_SESSIONS (oc->mpls_oam_num_sessions)
    640 
    641 /*
    642  * Typedef:
    643  *     _bcm_oam_control_t
    644  * Purpose:
    645  *     OAM module control structure. One structure for each XGS device.
    646  */
    647 struct _bcm_oam_control_s {
    648     int                         init;           /* TRUE if OAM module has    */
    649                                                 /* been initialized.         */
    650     sal_mutex_t                 oc_lock;        /* Protection mutex          */
    651     uint32                      ma_idx_count;   /* Max number of Rx          */
    652                                                 /* endpoints supported.      */
    653     uint32                      egr_ma_idx_count;   /* Max number of Rx      */
    654                                                 /* endpoints supported.      */
    655     uint32                      rmep_count;     /* Max number of remote      */
    656                                                 /* endpoints supported.      */
    657     uint32                      lmep_count;     /* Max number of local       */
    658                                                 /* endpoints supported.      */
    659     uint32                      ep_count;       /* Total number of           */
    660                                                 /* endpoints supported.      */
    661     uint32                      group_count;    /* Total groups count.       */
    662     _bcm_oam_group_data_t       *group_info;    /* MA Group information.     */
    663     shr_idxres_list_handle_t    lmep_pool;      /* Local endpoint indices    */
    664                                                 /* pool.                     */
    665     shr_idxres_list_handle_t    rmep_pool;      /* Remote endpoint indices   */
    666                                                 /* pool.                     */
    667     shr_idxres_list_handle_t    ma_idx_pool;    /* Rx endpoint indices pool. */
    668     /* KT2 OAM */
    669 #ifdef BCM_KATANA2_SUPPORT
    670     shr_idxres_list_handle_t    egr_ma_idx_pool;/* Egress Rx endpoint indices
    671                                                    pool - used for UpMEP */
    672     shr_idxres_list_handle_t    mpls_oam_ma_idx_pool; /* Rx endpoint indices pool for
    673                                                          BHH and MPLS LM/DM endpoints */
    674 #endif
    675     shr_idxres_list_handle_t    mep_pool;       /* Endpoint indices pool.    */
    676     shr_idxres_list_handle_t    group_pool;     /* Group indices pool.       */
    677     shr_htb_hash_table_t        ma_mep_htbl;    /* Endpoint hash table.      */
    678     _bcm_oam_hash_data_t        *oam_hash_data; /* Pointer to endpoint hash  */
    679                                                 /* data memory.              */
    680     soc_profile_mem_t           ing_service_pri_map;
    681                                                 /* Ingress service priority map
    682                                                  * profile tables. 3 in number
    683                                                  * for Saber2 
    684                                                  */
    685     soc_profile_mem_t           oam_opcode_control_profile; /* OAM Opcode    */
    686                                                 /* control profile table.    */
    687     _bcm_oam_event_handler_t    *event_handler_list_p; /* Event handlers     */
    688                                                 /* linked list.              */
    689     int                         event_handler_cnt[bcmOAMEventCount];
    690                                                 /* No. of registered         */
    691                                                 /* handlers per event.       */
    692     bcm_field_qset_t            vfp_qs;         /* Vlan and Mac match qset.  */
    693     bcm_field_qset_t            fp_vp_qs;       /* Virtual port qset.        */
    694     bcm_field_qset_t            fp_glp_qs;      /* Physical port qset.       */
    695     bcm_field_group_t           vfp_group;      /* VFP Group ID.             */
    696     bcm_field_group_t           fp_vp_group;    /* IFP Group ID for Logical  */
    697                                                 /* ports.                    */
    698     bcm_field_group_t           fp_glp_group;   /* IFP Group ID for physical */
    699                                                 /* Ports. */
    700     int                         vfp_entry_cnt;  /* VFP group entries used.   */
    701     int                         fp_vp_entry_cnt; /* IFP group entries used.  */
    702     int                         fp_glp_entry_cnt; /* IFP group entries used. */
    703     int                         lm_counter_cnt;  /* Total Loss Measurement.  */
    704     shr_idxres_list_handle_t    lm_counter_pool;  /* LM counter pool.        */
    705     bcm_oam_endpoint_t          *remote_endpoints; /* Mapping for remote EP Hw
    706                                                      index and logical index */
    707     int                         unit;            /* Used for callback thread */
    708 #if defined(INCLUDE_BHH)
    709     shr_idxres_list_handle_t    bhh_pool;        /* BHH endpoint indices pool. */
    710     bcm_cos_queue_t             cpu_cosq;        /* CPU cos queue for RX     */
    711                                                  /*              BHH packets */
    712     int                         cpu_cosq_ach_error_index; /* CPU cos queue map*/ 
    713                                                  /* index for error packets   */
    714     int                         bhh_lb_index;    /* CPU cos queue map*/ 
    715                                                  /* index for LB packets   */
    716     int                         cpu_cosq_invalid_error_index; /* CPU cos queue*/
    717                                                 /*map index for error packets */
    718     int                         rx_channel;     /* Local RX DMA channel for   */
    719                                                 /*                BHH packets */
    720     int                         uc_num;         /* uController number running */
    721                                                 /*                   BHH appl */
    722     int                         dma_buffer_len; /* DMA max buffer size        */
    723     uint8*                      dma_buffer;     /* DMA buffer                 */
    724     uint8*                      dmabuf_reply;   /* DMA reply buffer           */
    725     int                         bhh_endpoint_count;  
    726     sal_thread_t                event_thread_id;/* Event handler thread id    */
    727     uint32                      event_mask;     /*Events registered with uKernel*/
    728 #if defined (BCM_TRIUMPH3_SUPPORT)
    729     int                         bhh_label_qual_id; /* FP qual id for label */
    730     int                         bhh_ach_qual_id;  /* FP qual id for ACH */
    731     int                         bhh_opcode_qual_id; /* FP qual id for opcode */
    732     bcm_field_data_packet_format_t bhh_field_pkt_fmt; /* Field pkt format */
    733     bcm_udf_id_t                bhh_label_udf_id;  /* UDF entry id for label */
    734     bcm_udf_id_t                bhh_ach_udf_id;  /* UDF entry id for ACH */
    735     bcm_udf_id_t                bhh_opcode_udf_id; /* UDF entry id for opcode */
    736     bcm_udf_pkt_format_id_t     bhh_udf_pkt_fmt_id;  /* UDF pkt format id */
    737     int                         bhh_lmdm_entry_count;/* FP group lmdm entries used*/
    738     bcm_field_qset_t            bhh_lmdm_qset;   /* FP qset                    */
    739     bcm_field_group_t           bhh_lmdm_group;   /* FP Group ID for bhh       */
    740     short                       bhh_lm_dm_enable; /* BHH LM/DM is enabled or not */
    741     short                       bhh_udf_mode; /* Configure UDF entry through */
    742                                               /* bcm_udf_xxx or bcm_field_xxx */
    743 #endif
    744     int                         ukernel_not_ready;/* UKERNEL ready or not     */
    745     SHR_BITDCL *                bhh_ma_index_in_use;
    746     short*                      bhh_ep_grp_id;
    747     short*                      bhh_ep_vpn;
    748     uint16                      bhh_max_encap_length;
    749 #endif /* INCLUDE_BHH */
    750 
    751 #if defined(INCLUDE_ETH_LM_DM)
    752 
    753     bcm_cos_queue_t             eth_lm_dm_cpu_cosq;        /* CPU cos queue for RX     */
    754     /*              ETH_LM_DM packets */
    755     /*map index for error packets */
    756     shr_idxres_list_handle_t    eth_lm_dm_pool;      /* ETH_LM_DM session-Id pool */
    757     int                         eth_lm_dm_rx_channel;     /* Local RX DMA channel for   */
    758     /*                ETH_LM_DM packets */
    759     int                         eth_lm_dm_uc_num;         /* uController number running */
    760     /*                   ETH_LM_DM appl */
    761     int                         eth_lm_dm_dma_buffer_len; /* DMA max buffer size        */
    762     uint8*                      eth_lm_dm_dma_buffer;	/* DMA buffer                 */
    763     uint8*                      eth_lm_dm_dmabuf_reply;   /* DMA reply buffer           */
    764     int                         eth_lm_dm_sess_count; /*eth_lm_dm_endpoint_count */
    765     int                         eth_lm_dm_cosq_index; /*COSQ map index */
    766     uint8                       eth_lm_dm_ukernel_not_ready;
    767     uint32*                     eth_lm_dm_sess_id_ep_id; /* Ep Id from session Id */
    768 
    769 #endif
    770 #if defined(INCLUDE_MPLS_LM_DM)
    771     bcm_cos_queue_t             mpls_lm_dm_cpu_cosq;/* CPU cos queue for RX */
    772     shr_idxres_list_handle_t    mpls_lm_dm_pool;/* MPLS_LM_DM session-Id pool */
    773 
    774     int                         mpls_lm_dm_rx_channel;/* Local RX DMA channel 
    775                                                        for MPLS_LM_DM packets */
    776     int                         mpls_lm_dm_uc_num;      /* UC num running 
    777                                                            MPLS_LM_DM Appl */
    778     int                         mpls_lm_dm_dma_buffer_len;/* DMA max buf size */
    779     uint8*                      mpls_lm_dm_dma_buffer;  /* DMA buffer */ 
    780     uint8*                      mpls_lm_dm_dmabuf_reply;/* DMA reply buffer */
    781     int                         mpls_lm_dm_sess_count;  /* MAX Session count */
    782     int                         mpls_lm_dm_cosq_index;/* Index of CPU COS MAP */
    783     uint8                       mpls_lm_dm_ukernel_ready; /* UC state */
    784     uint32*                     mpls_lm_dm_sess_id_ep_id; /* Ep Id from session Id */
    785 #endif
    786 
    787     /* KT2 OAM */
    788 #ifdef BCM_KATANA2_SUPPORT
    789     soc_profile_mem_t           egr_service_pri_map; /* Egress service      */
    790                                                 /* priority map profile TAB  */
    791     soc_profile_mem_t           egr_oam_opcode_control_profile; /*egr OAM    */
    792                                                 /* Opcode control profile tbl */
    793     soc_profile_mem_t           ing_oam_dglp_profile; /* Ingress oam dglp    */
    794                                                       /*profile  */
    795     soc_profile_mem_t           egr_oam_dglp_profile; /* Egress oam dglp      */
    796                                                       /* profile */
    797     shr_aidxres_list_handle_t   ing_lm_ctr_pool[_BCM_MAX_OAM_COUNTER_POOLS];/* Ingress LM counter indices
    798                                                                        pool */
    799     uint32                      opcode_grp_bmp[8];/* default Bitmap of
    800                                                          non CFM opcodes  */
    801     uint32                      opcode_grp_1_bmp[8];/* Bitmap of non CFM opcodes
    802                                                        in group 1 */
    803     uint32                      opcode_grp_2_bmp[8]; /* Bitmap of non CFM opcodes
    804                                                         in group 2 */
    805    /* No of endpoints using OAM key1 */
    806     uint16                      oam_key1_ref_count[_BCM_KT2_MAX_PP_PORT];  
    807  /* No of endpoints using OAM key2 */
    808     uint16                      oam_key2_ref_count[_BCM_KT2_MAX_PP_PORT];
    809    /* No of endpoints using OAM key1 */
    810     uint16                      egr_oam_key1_ref_count[_BCM_KT2_MAX_PP_PORT];  
    811  /* No of endpoints using OAM key2 */
    812     uint16                      egr_oam_key2_ref_count[_BCM_KT2_MAX_PP_PORT];
    813 #if defined (INCLUDE_BHH)
    814     shr_aidxres_list_handle_t   ing_lm_sec_mep_ctr_pool; /*LM counter pool
    815                                                            for section meps*/
    816 #endif
    817 #endif
    818 #if defined (BCM_KATANA2_SUPPORT)
    819     sal_thread_t                eth_lm_dm_pm_event_thread_id;/* Event handler thread id    */
    820     sal_thread_t                mpls_lm_dm_pm_event_thread_id;/* Event handler thread id    */
    821     _bcm_oam_pm_event_handler_t *pm_event_handler_list_p;
    822     int                         pm_event_handler_cnt[bcmOAMEventCount];
    823     int                         pm_read_done_index[3];/* BHH, MPLS LM/DM, ETH LM/DM */ 
    824     int                         pm_write_done_index[3];/* BHH, MPLS LM/DM, ETH LM/DM */ 
    825     int                         pm_num_free_raw_data_buffers[3];/* BHH, MPLS LM/DM, ETH LM/DM */ 
    826 #if defined (INCLUDE_BHH)
    827     /* Data collection mode - Processed or Raw data */
    828     uint32                      pm_bhh_lmdm_data_collection_mode;
    829     uint32                      pm_bhh_raw_data_num_buffers;/* Num of raw data buffers */
    830     int                         pm_bhh_dma_buffer_len; /* DMA max buffer size        */
    831     uint8*                      pm_bhh_dma_buffer;     /* DMA buffer                 */
    832     bcm_oam_pm_raw_data_t       pm_bhh_raw_data_info;
    833 #endif
    834 #if defined (INCLUDE_ETH_LM_DM)
    835     /* Data collection mode - Processed or Raw data */
    836     uint32                      pm_eth_lmdm_data_collection_mode;
    837     uint32                      pm_eth_lm_dm_raw_data_num_buffers;/* Num of raw data buffers */
    838     int                         pm_eth_lm_dm_dma_buffer_len; /* DMA max buffer size        */
    839     uint8*                      pm_eth_lm_dm_dma_buffer;     /* DMA buffer                 */
    840     bcm_oam_pm_raw_data_t       pm_eth_lm_dm_raw_data_info;
    841 #endif
    842 #if defined (INCLUDE_MPLS_LM_DM)
    843     /* Data collection mode - Processed or Raw data */
    844     uint32                      pm_mpls_lmdm_data_collection_mode;
    845     uint32                      pm_mpls_lm_dm_raw_data_num_buffers; /* Num of raw data buffers */
    846     int                         pm_mpls_lm_dm_dma_buffer_len; /* DMA max buffer size        */
    847     uint8*                      pm_mpls_lm_dm_dma_buffer;     /* DMA buffer                 */
    848     bcm_oam_pm_raw_data_t       pm_mpls_lm_dm_raw_data_info;
    849 #endif
    850     int                         default_pri_map_id; /* The map id of the default 
    851                                                        ING/EGR_SERVICE_PRI_MAP
    852                                                        priority map profile. */
    853 #endif
    854     _bcm_oam_ma_idx_alloc_scheme_t ma_idx_alloc_scheme; /* Old or new allocation scheme */
    855     uint32                         eth_oam_num_sessions; /* No. of Eth OAM sessions including
    856                                                             firmware and any customer specific
    857                                                             OLP */
    858     uint32                         mpls_oam_num_sessions; /* No. of MPLS LM/DM and BHH sessions
    859                                                              including firmware and any customer
    860                                                              specific OLP */
    861 #if defined (BCM_METROLITE_SUPPORT)
    862     soc_profile_mem_t           ing_lm_counter_control_profile; /*ING_LM_COUNTER_CONTROL profile 
    863                                                                  * table */
    864     soc_profile_mem_t           egr_lm_counter_control_profile; /*EGR_LM_COUNTER_CONTROL profile 
    865                                                                  * table */
    866 #endif
    867 #if defined (BCM_KATANA2_SUPPORT)
    868     uint8               eth_oam_mp_group_vlan_key; /* MP_GROUP vlan key scheme */
    869 #endif /* BCM_KATANA2_SUPPORT */
    870     bcm_oam_endpoint_t  *_bcm_oam_ma_idx_to_ep_id_map;
    871 
    872 };
    873 typedef struct _bcm_oam_control_s _bcm_oam_control_t;
    874 #endif /* !BCM_TRIUMPH3_SUPPORT */
    875 
    876 #ifdef BCM_KATANA2_SUPPORT
    877 /* MEP LM counter related fields */
    878 typedef struct mep_ctr_info_s {
    879     soc_field_t  ctr_valid;
    880     soc_field_t  ctr_base_ptr;
    881     soc_field_t  ctr_mep_type;
    882     soc_field_t  ctr_mep_mdl;
    883     soc_field_t  ctr_profile;
    884 } mep_ctr_info_t;
    885 #ifdef BCM_SABER2_SUPPORT
    886 /* MEP LM counter related fields */
    887 typedef struct _sb2_mep_ctr_info_s {
    888     soc_field_t  ctr_valid;
    889     soc_field_t  ctr_base_ptr;
    890     soc_field_t  ctr_mep_type;
    891     soc_field_t  ctr_mep_mdl;
    892     soc_field_t  ctr_profile;
    893     soc_field_t  ctr_pri_mode;
    894     soc_field_t  ctr_lm_payload_offset;
    895     soc_field_t  ctr_lm_cos_offset;
    896     soc_field_t  ctr_pool_id;
    897 } sb2_mep_ctr_info_t;
    898 #endif
    899 #endif /* BCM_KATANA2_SUPPORT */
    900 
    901 
    902 #if defined(INCLUDE_BHH)
    903 #include <soc/shared/bhh_msg.h>
    904 typedef shr_bhh_msg_ctrl_stat_reply_t bcm_bhh_stats_t ;
    905 extern int bcm_en_oam_endpoint_stat_get(
    906     int unit, 
    907     bcm_oam_endpoint_t endpoint, 
    908     bcm_bhh_stats_t *stats);
    909 #define BHH_CCM_EVENT_SET_OR_CLEAR_MASK 0x80000000 /* EVENT set/clear indication: 1 for set 0 for clear */
    910 extern int _bcm_oam_bhh_appl_callback(int unit,
    911                                     int uC,
    912                                     soc_cmic_uc_shutdown_stage_t stage,
    913                                     void *user_data);
    914 extern int _bcm_sb2_oam_bhh_appl_callback(int unit,
    915                                     int uC,
    916                                     soc_cmic_uc_shutdown_stage_t stage,
    917                                     void *user_data);
    918 extern int _bcm_kt2_oam_bhh_appl_callback(int unit,
    919                                     int uC,
    920                                     soc_cmic_uc_shutdown_stage_t stage,
    921                                     void *user_data);
    922 extern int _bcm_tr3_oam_bhh_appl_callback(int unit,
    923                                     int uC,
    924                                     soc_cmic_uc_shutdown_stage_t stage,
    925                                     void *user_data);
    926 extern int _bcm_en_oam_bhh_appl_callback(int unit,
    927                                     int uC,
    928                                     soc_cmic_uc_shutdown_stage_t stage,
    929                                     void *user_data);
    930 extern int _bcm_fp_oam_bhh_appl_callback(int unit,
    931                                     int uC,
    932                                     soc_cmic_uc_shutdown_stage_t stage,
    933                                     void *user_data);
    934 #endif
    935 
    936 #if defined(INCLUDE_ETH_LM_DM)
    937 extern int _bcm_oam_eth_lm_dm_appl_callback(int unit,
    938                                     int uC,
    939                                     soc_cmic_uc_shutdown_stage_t stage,
    940                                     void *user_data);
    941 
    942 extern int _bcm_sb2_oam_eth_lm_dm_appl_callback(int unit,
    943                                     int uC,
    944                                     soc_cmic_uc_shutdown_stage_t stage,
    945                                     void *user_data);
    946 
    947 #endif
    948 
    949 #if defined(INCLUDE_MPLS_LM_DM)
    950 extern int _bcm_oam_mpls_lm_dm_appl_callback(int unit,
    951                                     int uC,
    952                                     soc_cmic_uc_shutdown_stage_t stage,
    953                                     void *user_data);
    954 
    955 extern int _bcm_sb2_oam_mpls_lm_dm_appl_callback(int unit,
    956                                     int uC,
    957                                     soc_cmic_uc_shutdown_stage_t stage,
    958                                     void *user_data);
    959 
    960 extern int _bcm_fp_oam_mpls_lm_dm_appl_callback(int unit,
    961                                     int uC,
    962                                     soc_cmic_uc_shutdown_stage_t stage,
    963                                     void *user_data);
    964 #endif
    965 
    966 /* Max 4 PM profiles are allowed to be configured. */
    967 #define _BCM_OAM_MAX_PM_PROFILES 4
    968 
    969 /* PM Collection modes */
    970 #define _BCM_OAM_PM_COLLECTION_MODE_NONE            0
    971 #define _BCM_OAM_PM_COLLECTION_MODE_PROCESSED_STATS 1
    972 #define _BCM_OAM_PM_COLLECTION_MODE_RAW_DATA        2
    973 
    974 extern int
    975 _bcm_oam_olp_fp_hw_index_get(
    976         int unit,
    977         bcm_field_olp_header_type_t olp_hdr_type,
    978         int *hwindex);
    979 
    980 extern int
    981 _bcm_oam_olp_hw_index_olp_type_get(
    982         int unit,
    983         int hwindex,
    984         bcm_field_olp_header_type_t *olp_hdr_type );
    985 
    986 extern int
    987 _bcm_oam_drop_control_fp_encode (int unit,
    988                                  bcm_field_oam_drop_mep_type_t mep_type,
    989                                  uint8 *data,
    990                                  uint8 *mask);
    991 extern int
    992 _bcm_esw_oam_lmep_tx_trunk_config_recover(int unit, 
    993         bcm_trunk_t             trunk_id, 
    994         bcm_port_t              port_id,
    995         int                     *trunk_index);
    996 #endif /* !__BCM_INT_OAM_H__ */