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 (153366B)


      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-2020 Broadcom Inc. All rights reserved.
      7  * 
      8  * DO NOT EDIT THIS FILE!
      9  * This file is auto-generated.
     10  * Edits to this file will be lost when it is regenerated.
     11  */
     12 
     13 #ifndef __BCM_OAM_H__
     14 #define __BCM_OAM_H__
     15 
     16 #include <bcm/mpls.h>
     17 
     18 /* Miscellaneous OAM defines */
     19 #define BCM_OAM_GROUP_NAME_LENGTH           48         /* Group name length in
     20                                                           bytes */
     21 #define BCM_OAM_GROUP_INVALID               -1         /* Invalid OAM group ID */
     22 #define BCM_OAM_ENDPOINT_INVALID            -2         /* Invalid OAM endpoint
     23                                                           ID. */
     24 #define BCM_OAM_ENDPOINT_DEFAULT_INGRESS0   -3         /* OAM default endpoint,
     25                                                           ingress. */
     26 #define BCM_OAM_ENDPOINT_DEFAULT_INGRESS1   -4         /* OAM default endpoint,
     27                                                           ingress. */
     28 #define BCM_OAM_ENDPOINT_DEFAULT_INGRESS2   -5         /* OAM default endpoint,
     29                                                           ingress. */
     30 #define BCM_OAM_ENDPOINT_DEFAULT_INGRESS3   -6         /* OAM default endpoint,
     31                                                           ingress. */
     32 #define BCM_OAM_ENDPOINT_DEFAULT_EGRESS0    -11        /* OAM default endpoint,
     33                                                           egress. */
     34 #define BCM_OAM_ENDPOINT_DEFAULT_EGRESS1    -12        /* OAM default endpoint,
     35                                                           egress. */
     36 #define BCM_OAM_ENDPOINT_DEFAULT_EGRESS2    -13        /* OAM default endpoint,
     37                                                           egress. */
     38 #define BCM_OAM_ENDPOINT_DEFAULT_EGRESS3    -14        /* OAM default endpoint,
     39                                                           egress. */
     40 #define BCM_OAM_INTPRI_MAX                  16         /* Internal priority max
     41                                                           value */
     42 #define BCM_OAM_CARRIER_CODE_MAX            6          /* ITU-T Carrier code
     43                                                           length */
     44 #define BCM_OAM_LM_COUNTER_MAX              3          /* Maximum number of Loss
     45                                                           Measurement counters
     46                                                           that can be touched by
     47                                                           an LM packet Tx
     48                                                           (Sample 1, Increment2) */
     49 #define BCM_OAM_MAX_NUM_TLVS_FOR_LBM        2          /* The max TLVS numbers
     50                                                           of LBM */
     51 #define BCM_OAM_MAX_NUM_SLINDING_WINDOWS    256        /* The max TLVS numbers
     52                                                           of LBM */
     53 #define BCM_OAM_MAX_NUM_TLVS_FOR_DM         1          /* The max TLVS numbers
     54                                                           of DM */
     55 
     56 /* OAM group flags */
     57 #define BCM_OAM_GROUP_REPLACE               0x01       /* Replace an existing
     58                                                           OAM group */
     59 #define BCM_OAM_GROUP_WITH_ID               0x02       /* Use the specified
     60                                                           group ID */
     61 #define BCM_OAM_GROUP_REMOTE_DEFECT_TX      0x04       /* Set the remote defect
     62                                                           indicator in outgoing
     63                                                           CCMs for this group */
     64 #define BCM_OAM_GROUP_COPY_ERRORS_TO_CPU    0x08       /* Copy mismatched MAID
     65                                                           packets to CPU */
     66 #define BCM_OAM_GROUP_COPY_TO_CPU           0x10       /* Copy the received CCM
     67                                                           packet to the CPU */
     68 #define BCM_OAM_GROUP_GET_FAULTS_ONLY       0x20       /* oam_group_get API gets
     69                                                           only fault status of
     70                                                           the group */
     71 #define BCM_OAM_GROUP_TYPE_BHH              0x40       /*  Indicating that this
     72                                                           group belongs to BHH
     73                                                           endpoint */
     74 #define BCM_OAM_GROUP_FLEXIBLE_MAID_48_BYTE 0x80       /* fully flexible 48B
     75                                                           MAID format */
     76 #define BCM_OAM_GROUP_RX_NAME               0x100      /* This group has two
     77                                                           MAIDs, one for packets
     78                                                           transmitted and
     79                                                           another for packets
     80                                                           received. The MAID for
     81                                                           packets transmitted is
     82                                                           specified in the
     83                                                           'name' field, and the
     84                                                           MAID for packets
     85                                                           received is specified
     86                                                           in the 'rx_name' field */
     87 
     88 /* OAM group fault flags */
     89 #define BCM_OAM_GROUP_FAULT_REMOTE      0x01       /* A remote defect indicator
     90                                                       is set in this group */
     91 #define BCM_OAM_GROUP_FAULT_CCM_TIMEOUT 0x02       /* A CCM timeout has occurred
     92                                                       in this group */
     93 #define BCM_OAM_GROUP_FAULT_CCM_ERROR   0x04       /* A CCM error has occurred
     94                                                       in this group */
     95 #define BCM_OAM_GROUP_FAULT_CCM_XCON    0x08       /* A CCM xcon has occurred in
     96                                                       this group */
     97 #define BCM_OAM_GROUP_FAULT_CCM_MAC     0x10       /* A CCM Mac defect has
     98                                                       occurred in this group */
     99 #define BCM_OAM_GROUP_RDI_TX            BCM_OAM_GROUP_REMOTE_DEFECT_TX /* Set the remote defect
    100                                                       indicator in outgoing CCMs
    101                                                       for this group. */
    102 
    103 /* OAM endpoint flags and flags2 */
    104 #define BCM_OAM_ENDPOINT_REPLACE            0x0001     /* Replace an existing
    105                                                           OAM endpoint */
    106 #define BCM_OAM_ENDPOINT_WITH_ID            0x0002     /* Use the specified
    107                                                           endpoint ID */
    108 #define BCM_OAM_ENDPOINT_REMOTE             0x0004     /* Specifies that this is
    109                                                           a remote endpoint */
    110 #define BCM_OAM_ENDPOINT_UP_FACING          0x0008     /* Specifies that this
    111                                                           endpoint faces the
    112                                                           switching logic */
    113 #define BCM_OAM_ENDPOINT_CCM_RX             0x0010     /* Enables CCM reception.
    114                                                            This is only valid
    115                                                           for local endpoints. */
    116 #define BCM_OAM_ENDPOINT_LOOPBACK           0x0020     /* Enables loopback
    117                                                           response.  This is
    118                                                           only valid for local
    119                                                           endpoints. */
    120 #define BCM_OAM_ENDPOINT_DELAY_MEASUREMENT  0x0040     /* Enables reception and
    121                                                           timestamping of delay
    122                                                           measurement messages. 
    123                                                           This is only valid for
    124                                                           local endpoints. */
    125 #define BCM_OAM_ENDPOINT_LINKTRACE          0x0080     /* Enables reception of
    126                                                           linktrace messages. 
    127                                                           This is only valid for
    128                                                           local endpoints. */
    129 #define BCM_OAM_ENDPOINT_PORT_STATE_TX      0x0100     /* Enables the
    130                                                           transmission of port
    131                                                           state in outgoing
    132                                                           CCMs.  This is only
    133                                                           valid for local
    134                                                           endpoints. */
    135 #define BCM_OAM_ENDPOINT_INTERFACE_STATE_TX 0x0200     /* Enables the
    136                                                           transmission of
    137                                                           interface state in
    138                                                           outgoing CCMs.  This
    139                                                           is only valid for
    140                                                           local endpoints. */
    141 #define BCM_OAM_ENDPOINT_LOSS_MEASUREMENT   0x0400     /* Enables the processing
    142                                                           of loss measurement
    143                                                           messages.  This is
    144                                                           only valid for local
    145                                                           endpoints. */
    146 #define BCM_OAM_ENDPOINT_INTERMEDIATE       0x0800     /* Configures this as a
    147                                                           MIP. */
    148 #define BCM_OAM_ENDPOINT_PBB_TE             0x1000     /* Specifies that this is
    149                                                           a PBB-TE endpoint. */
    150 #define BCM_OAM_ENDPOINT_CCM_COPYTOCPU      0x2000     /* Copy received CCM to
    151                                                           CPU. This is only
    152                                                           valid for local
    153                                                           endpoints. */
    154 #define BCM_OAM_ENDPOINT_CCM_DROP           0x4000     /* Drop received CCM.
    155                                                           This is only valid for
    156                                                           local endpoints. */
    157 #define BCM_OAM_ENDPOINT_DM_COPYTOCPU       0x8000     /* Copy received delay
    158                                                           measurement messages
    159                                                           to CPU. This is only
    160                                                           valid for local
    161                                                           endpoints. */
    162 #define BCM_OAM_ENDPOINT_DM_DROP            0x10000    /* Drop received delay
    163                                                           measurement messages.
    164                                                           This is only valid for
    165                                                           local endpoints. */
    166 #define BCM_OAM_ENDPOINT_LB_COPYTOCPU       0x20000    /* Copy received loopback
    167                                                           messages to CPU. This
    168                                                           is only valid for
    169                                                           local endpoints. */
    170 #define BCM_OAM_ENDPOINT_LB_DROP            0x40000    /* Drop received loopback
    171                                                           messages. This is only
    172                                                           valid for local
    173                                                           endpoints. */
    174 #define BCM_OAM_ENDPOINT_LT_COPYTOCPU       0x80000    /* Copy received loopback
    175                                                           messages to CPU. This
    176                                                           is only valid for
    177                                                           local endpoints. */
    178 #define BCM_OAM_ENDPOINT_LT_DROP            0x100000   /* Drop received loopback
    179                                                           messages. This is only
    180                                                           valid for local
    181                                                           endpoints. */
    182 #define BCM_OAM_ENDPOINT_USE_QOS_MAP        0x200000   /* Use QoS map profile
    183                                                           specified on endpoint */
    184 #define BCM_OAM_ENDPOINT_MATCH_INNER_VLAN   0x400000   /* Selection of up MIP on
    185                                                           CEP (C-comp) rather
    186                                                           than on PEP (S-comp).
    187                                                           For doubly tagged
    188                                                           MEPs, count based on
    189                                                           C-comp rather than
    190                                                           S-comp */
    191 #define BCM_OAM_ENDPOINT_REMOTE_DEFECT_TX   0x800000   /* Set the remote defect
    192                                                           indicator in outgoing
    193                                                           CCMs for this
    194                                                           endpoint. */
    195 #define BCM_OAM_ENDPOINT_CCM_COPYFIRSTTOCPU 0x1000000  /* Copy only the first
    196                                                           (next) received CCM to
    197                                                           CPU. This is only
    198                                                           valid for local
    199                                                           endpoints. */
    200 #define BCM_OAM_ENDPOINT_PORT_STATE_UPDATE  0x2000000  /* Update port state. 
    201                                                           This is only valid for
    202                                                           local endpoints. */
    203 #define BCM_OAM_ENDPOINT_INTERFACE_STATE_UPDATE 0x4000000  /* Update interface
    204                                                           state.  This is only
    205                                                           valid for local
    206                                                           endpoints. */
    207 #define BCM_OAM_ENDPOINT_PRI_TAG            0x8000000  /* Messages generated
    208                                                           from this endpoint
    209                                                           should include a Pri
    210                                                           Tag. */
    211 #define BCM_OAM_ENDPOINT_REMOTE_EVENT_DISABLE 0x10000000 /* Do not generate
    212                                                           events. */
    213 #define BCM_OAM_ENDPOINT_REMOTE_DEFECT_AUTO_UPDATE 0x20000000 /* Auto update defect
    214                                                           state on timeout
    215                                                           event. */
    216 #define BCM_OAM_ENDPOINT_MATCH_OUTER_AND_INNER_VLAN 0x40000000 /* Selection of MEP based
    217                                                           on S and C VLAN */
    218 #define BCM_OAM_ENDPOINT_LMEP_PKT_FWD       0x80000000 /* Local endpoint CCMs
    219                                                           must be forwarded to a
    220                                                           remote unit for
    221                                                           processing. */
    222 #define BCM_OAM_ENDPOINT_RDI_TX             BCM_OAM_ENDPOINT_REMOTE_DEFECT_TX /* Set the remote defect
    223                                                           indicator in outgoing
    224                                                           CCMs for this
    225                                                           endpoint. */
    226 #define BCM_OAM_ENDPOINT_RDI_AUTO_UPDATE    BCM_OAM_ENDPOINT_REMOTE_DEFECT_AUTO_UPDATE /* Auto update defect
    227                                                           event. */
    228 #define BCM_OAM_ENDPOINT2_RDI_FROM_RX_DISABLE 0x1        /* RDI bit on outgoing
    229                                                           packets may be taken
    230                                                           from RDI indication on
    231                                                           received packets. */
    232 #define BCM_OAM_ENDPOINT2_RDI_FROM_LOC_DISABLE 0x2        /* RDI bit on outgoing
    233                                                           packets may be taken
    234                                                           from LOC indication of
    235                                                           peer endpoint. */
    236 #define BCM_OAM_ENDPOINT2_RDI_ON_LOC        0x4        /* MEP RDI update LOC
    237                                                           enable - update local
    238                                                           MEP RDI in case of
    239                                                           LOC. */
    240 #define BCM_OAM_ENDPOINT2_RDI_CLEAR_ON_LOC_CLEAR 0x8        /* MEP RDI update LOC
    241                                                           clean enable - update
    242                                                           local MEP RDI in case
    243                                                           of LOC clear (time-in)
    244                                                           event detected. */
    245 #define BCM_OAM_ENDPOINT2_RDI_ON_RX_RDI     0x10       /* MEP RDI update RX
    246                                                           enable - Update local
    247                                                           MEP RDI by copying the
    248                                                           RDI indication from
    249                                                           the last valid CCM
    250                                                           packet received. */
    251 #define BCM_OAM_ENDPOINT2_REMOTE_UPDATE_STATE_DISABLE 0x20       /* Disable updating RMEP
    252                                                           DB. */
    253 #define BCM_OAM_ENDPOINT2_RX_REMOTE_DEFECT_AUTO_UPDATE 0x40       /* Auto update defect
    254                                                           state on timeout event
    255                                                           for RX packets */
    256 #define BCM_OAM_ENDPOINT2_RX_REMOTE_EVENT_DISABLE 0x80       /* Do not generate events
    257                                                           for RX packets. */
    258 #define BCM_OAM_ENDPOINT2_HW_ACCELERATION_SET 0x100      /* Configure only HW
    259                                                           accelerator
    260                                                           properties. */
    261 #define BCM_OAM_ENDPOINT2_REDIRECT_TO_CPU   0x200      /* Used to send BHH
    262                                                           packets to CPU instead
    263                                                           of BTE */
    264 #define BCM_OAM_ENDPOINT2_GET_FAULTS_ONLY   0x200      /* oam_endpoint_get API
    265                                                           gets only fault status
    266                                                           of endpoint */
    267 #define BCM_OAM_ENDPOINT2_MPLS_INGRESS_ONLY 0x800      /* Endpoint with only an
    268                                                           ingress entry.
    269                                                           Applicable only for
    270                                                           endpoints of type
    271                                                           bcmOAMEndpointTypeBHHMPLS,
    272                                                           bcmOAMEndpointTypeBHHPWE */
    273 #define BCM_OAM_ENDPOINT2_UPDATE_COUNTER_ACTION 0x1000     /* Use along with
    274                                                           BCM_OAM_ENDPOINT_REPLACE
    275                                                           to update just the LM
    276                                                           parameters including
    277                                                           counters
    278                                                           incremented/sampled by
    279                                                           Tx CCM PDUs */
    280 #define BCM_OAM_ENDPOINT2_MPLS_EGRESS_ONLY  0x2000     /* Endpoint with only an
    281                                                           egress entry.
    282                                                           Applicable only for
    283                                                           endpoints of type
    284                                                           bcmOAMEndpointTypeBHHMPLS,
    285                                                           bcmOAMEndpointTypeBHHPWE */
    286 #define BCM_OAM_ENDPOINT_FLAGS2_MATCH_SINGLE_TAGGED_OUTER_VLAN 0x4000     /* Selection of MEP
    287                                                           look-up based on
    288                                                           Single outer tagged
    289                                                           packets only */
    290 #define BCM_OAM_ENDPOINT_FLAGS2_RDI_FROM_RX_DISABLE BCM_OAM_ENDPOINT2_RDI_FROM_RX_DISABLE /* RDI bit on outgoing
    291                                                           packets may be taken
    292                                                           from RDI indication on
    293                                                           received packets. */
    294 #define BCM_OAM_ENDPOINT_FLAGS2_RDI_FROM_LOC_DISABLE BCM_OAM_ENDPOINT2_RDI_FROM_LOC_DISABLE /* RDI bit on outgoing
    295                                                           packets may be taken
    296                                                           from LOC indication of
    297                                                           peer endpoint. */
    298 #define BCM_OAM_ENDPOINT_FLAGS2_RDI_ON_LOC  BCM_OAM_ENDPOINT2_RDI_ON_LOC /* MEP RDI update LOC
    299                                                           enable - update local
    300                                                           MEP RDI in case of
    301                                                           LOC. */
    302 #define BCM_OAM_ENDPOINT_FLAGS2_RDI_CLEAR_ON_LOC_CLEAR BCM_OAM_ENDPOINT2_RDI_CLEAR_ON_LOC_CLEAR /* MEP RDI update LOC
    303                                                           clean enable - update
    304                                                           local MEP RDI in case
    305                                                           of LOC clear (time-in)
    306                                                           event detected. */
    307 #define BCM_OAM_ENDPOINT_FLAGS2_RDI_ON_RX_RDI BCM_OAM_ENDPOINT2_RDI_ON_RX_RDI /* MEP RDI update RX
    308                                                           enable - Update local
    309                                                           MEP RDI by copying the
    310                                                           RDI indication from
    311                                                           the last valid CCM
    312                                                           packet received. */
    313 #define BCM_OAM_ENDPOINT_FLAGS2_REMOTE_UPDATE_STATE_DISABLE BCM_OAM_ENDPOINT2_REMOTE_UPDATE_STATE_DISABLE /* Disable updating RMEP
    314                                                           DB. */
    315 #define BCM_OAM_ENDPOINT_FLAGS2_RX_REMOTE_DEFECT_AUTO_UPDATE BCM_OAM_ENDPOINT2_RX_REMOTE_DEFECT_AUTO_UPDATE /* Auto update defect
    316                                                           state on timeout event
    317                                                           for RX packets */
    318 #define BCM_OAM_ENDPOINT_FLAGS2_RX_REMOTE_EVENT_DISABLE BCM_OAM_ENDPOINT2_RX_REMOTE_EVENT_DISABLE /* Do not generate events
    319                                                           for RX packets. */
    320 #define BCM_OAM_ENDPOINT_FLAGS2_HW_ACCELERATION_SET BCM_OAM_ENDPOINT2_HW_ACCELERATION_SET /* Configure only HW
    321                                                           accelerator
    322                                                           properties. */
    323 #define BCM_OAM_ENDPOINT_FLAGS2_REDIRECT_TO_CPU BCM_OAM_ENDPOINT2_REDIRECT_TO_CPU /* Used to send BHH
    324                                                           packets to CPU instead
    325                                                           of BTE */
    326 #define BCM_OAM_ENDPOINT_FLAGS2_GET_FAULTS_ONLY BCM_OAM_ENDPOINT2_GET_FAULTS_ONLY /* oam_endpoint_get API
    327                                                           gets only fault status
    328                                                           of endpoint */
    329 #define BCM_OAM_ENDPOINT_FLAGS2_MPLS_INGRESS_ONLY BCM_OAM_ENDPOINT2_MPLS_INGRESS_ONLY /* Endpoint with only an
    330                                                           ingress entry.
    331                                                           Applicable only for
    332                                                           endpoints of type
    333                                                           bcmOAMEndpointTypeBHHMPLS,
    334                                                           bcmOAMEndpointTypeBHHPWE */
    335 #define BCM_OAM_ENDPOINT_FLAGS2_UPDATE_COUNTER_ACTION BCM_OAM_ENDPOINT2_UPDATE_COUNTER_ACTION /* Use along with
    336                                                           BCM_OAM_ENDPOINT_REPLACE
    337                                                           to update just the LM
    338                                                           counters updated by Tx
    339                                                           CCM packets */
    340 #define BCM_OAM_ENDPOINT_FLAGS2_MPLS_EGRESS_ONLY BCM_OAM_ENDPOINT2_MPLS_EGRESS_ONLY /* Endpoint with only an
    341                                                           egress entry.
    342                                                           Applicable only for
    343                                                           endpoints of type
    344                                                           bcmOAMEndpointTypeBHHMPLS,
    345                                                           bcmOAMEndpointTypeBHHPWE */
    346 #define BCM_OAM_ENDPOINT_FLAGS2_USE_DOUBLE_OUTLIF_INJ 0x8000     /* double outlif for OAM
    347                                                           over PWE injection */
    348 #define BCM_OAM_ENDPOINT_FLAGS2_VLAN_VP_UP_MEP_IN_HW 0x10000    /*  Endpoint is Vlan
    349                                                           based VP UP MEP in HW
    350                                                           engine and use
    351                                                           tx_gport to honor the
    352                                                           vlan translation for
    353                                                           UP MEP TXed packed
    354                                                           from HW CCM engine */
    355 #define BCM_OAM_ENDPOINT_FLAGS2_EGRESS_INJECTION_DOWN 0x20000    /* Create egress
    356                                                           injection down
    357                                                           endpoint */
    358 #define BCM_OAM_ENDPOINT_FLAGS2_TX_STATISTICS 0x40000    /* Enable OAMP Tx Opcode
    359                                                           statistics */
    360 #define BCM_OAM_ENDPOINT_FLAGS2_RX_STATISTICS 0x80000    /* Enable OAMP Rx Opcode
    361                                                           statistics */
    362 #define BCM_OAM_ENDPOINT_FLAGS2_PER_OPCODE_STATISTICS 0x100000   /* Enable OAMP Tx/Rx Per
    363                                                           Opcode statistics,
    364                                                           count each opcode in
    365                                                           separate counter */
    366 
    367 /* OAM loss measurment flags */
    368 #define BCM_OAM_LM_PCP          0x0001     /* Use different counters for
    369                                               different vlan tag packet priority
    370                                               codes */
    371 
    372 /* OAM opcode flags */
    373 #define BCM_OAM_OPCODE_CCM_IN_HW            0x0001     /* Process CCMs in
    374                                                           Hardware */
    375 #define BCM_OAM_OPCODE_CCM_COPY_TO_CPU      0x0002     /* Copy CCMs to CPU */
    376 #define BCM_OAM_OPCODE_CCM_DROP             0x0004     /* Drop CCMs */
    377 #define BCM_OAM_OPCODE_LBM_IN_HW            0x0008     /* Process Loopback
    378                                                           Messages in Hardware */
    379 #define BCM_OAM_OPCODE_LBM_UC_COPY_TO_CPU   0x0010     /* Copy Unicast Loopback
    380                                                           Messages to CPU */
    381 #define BCM_OAM_OPCODE_LBM_UC_DROP          0x0020     /* Drop Unicast Loopback
    382                                                           Messages */
    383 #define BCM_OAM_OPCODE_LBM_MC_COPY_TO_CPU   0x0040     /* Copy Multicast
    384                                                           Loopback Messages to
    385                                                           CPU */
    386 #define BCM_OAM_OPCODE_LBM_MC_DROP          0x0080     /* Drop Multicast
    387                                                           Loopback Messages */
    388 #define BCM_OAM_OPCODE_LBR_COPY_TO_CPU      0x0100     /* Copy Loopback Reply to
    389                                                           CPU */
    390 #define BCM_OAM_OPCODE_LBR_DROP             0x0200     /* Drop Loopback Reply */
    391 #define BCM_OAM_OPCODE_LTM_COPY_TO_CPU      0x0400     /* Copy Linktrace
    392                                                           Messages to CPU */
    393 #define BCM_OAM_OPCODE_LTM_DROP             0x0800     /* Drop Linktrace
    394                                                           Messages */
    395 #define BCM_OAM_OPCODE_LTR_COPY_TO_CPU      0x1000     /* Copy Linktrace Reply
    396                                                           to CPU */
    397 #define BCM_OAM_OPCODE_LTR_DROP             0x2000     /* Drop Linktrace Reply */
    398 #define BCM_OAM_OPCODE_LMEP_PKT_FWD         0x4000     /* Forward CCMs to remote
    399                                                           device */
    400 #define BCM_OAM_OPCODE_OTHER_COPY_TO_CPU    0x8000     /* Copy other OAM opcode
    401                                                           to CPU */
    402 #define BCM_OAM_OPCODE_OTHER_DROP           0x10000    /* Drop other OAM opcode
    403                                                           to CPU */
    404 
    405 /* OAM endpoint fault flags */
    406 #define BCM_OAM_ENDPOINT_FAULT_CCM_TIMEOUT  0x01       /* Indicates a CCM
    407                                                           timeout.  This is only
    408                                                           valid for remote
    409                                                           endpoints. */
    410 #define BCM_OAM_ENDPOINT_FAULT_REMOTE       0x02       /* Indicates that a
    411                                                           remote defect was
    412                                                           indicated in the last
    413                                                           CCM received from this
    414                                                           endpoint.  This is
    415                                                           only valid for remote
    416                                                           endpoints and is
    417                                                           read-only. */
    418 #define BCM_OAM_ENDPOINT_FAULT_PORT_DOWN    0x04       /* Indicates that the
    419                                                           port on which the
    420                                                           endpoint resides is
    421                                                           down.  This is valid
    422                                                           for both local and
    423                                                           remote endpoints but
    424                                                           is read-only for
    425                                                           remote endpoints. */
    426 #define BCM_OAM_ENDPOINT_FAULT_INTERFACE_DOWN 0x08       /* Indicates that the
    427                                                           interface on which teh
    428                                                           endpoint resides is
    429                                                           down.  This is valid
    430                                                           for both local and
    431                                                           remote endpoints but
    432                                                           is read-only for
    433                                                           remote endpoints. */
    434 
    435 /* Constants for CCM periods defined by 802.1ag */
    436 #define BCM_OAM_ENDPOINT_CCM_PERIOD_DISABLED 0          
    437 #define BCM_OAM_ENDPOINT_CCM_PERIOD_3MS     3          
    438 #define BCM_OAM_ENDPOINT_CCM_PERIOD_10MS    10         
    439 #define BCM_OAM_ENDPOINT_CCM_PERIOD_100MS   100        
    440 #define BCM_OAM_ENDPOINT_CCM_PERIOD_1S      1000       
    441 #define BCM_OAM_ENDPOINT_CCM_PERIOD_10S     10000      
    442 #define BCM_OAM_ENDPOINT_CCM_PERIOD_1M      60000      
    443 #define BCM_OAM_ENDPOINT_CCM_PERIOD_10M     600000     
    444 
    445 /* OAM loss flags */
    446 #define BCM_OAM_LOSS_TX_ENABLE              0x0001     /* Enable Loss Packet
    447                                                           Transmission */
    448 #define BCM_OAM_LOSS_SINGLE_ENDED           0x0002     /* PDU used for ETH-LM
    449                                                           information is LMM/R */
    450 #define BCM_OAM_LOSS_FIRST_RX_COPY_TO_CPU   0x0004     /* Copy First received
    451                                                           Loss Measurement
    452                                                           Packet to CPU */
    453 #define BCM_OAM_LOSS_ALL_RX_COPY_TO_CPU     0x0008     /* Copy all received Loss
    454                                                           Measurement Packet to
    455                                                           CPU */
    456 #define BCM_OAM_LOSS_WITH_ID                0x0010     /* Use the specified loss
    457                                                           id */
    458 #define BCM_OAM_LOSS_PRI_INTERNAL           0x0020     /* Selects counting based
    459                                                           on internal COS rather
    460                                                           than packet priority */
    461 #define BCM_OAM_LOSS_DP_INTERNAL            0x0040     /* Selects counting based
    462                                                           on internal DP rather
    463                                                           than packet CFI */
    464 #define BCM_OAM_LOSS_COUNT_POST_TRAFFIC_CONDITIONING 0x0080     /* Specifies that OEM
    465                                                           loss measuements are
    466                                                           taken on the wire side
    467                                                           (pre traffic
    468                                                           conditioning) or on
    469                                                           the switching side
    470                                                           (post traffic
    471                                                           conditioning) of a
    472                                                           forwarding function */
    473 #define BCM_OAM_LOSS_COUNT_GREEN_AND_YELLOW 0x0100     /* Specifies whether the
    474                                                           OEM loss measurements
    475                                                           includes green only
    476                                                           frames or green and
    477                                                           yellow frames */
    478 #define BCM_OAM_LOSS_COUNT_CPU_RX_PKT       0x0200     /* Specifies that RX LM
    479                                                           counter needs to be
    480                                                           updated for packet
    481                                                           received from CPU */
    482 #define BCM_OAM_LOSS_COUNT_CPU_TX_PKT       0x0400     /* Specifies that TX LM
    483                                                           counter needs to be
    484                                                           updated for packet
    485                                                           received from CPU */
    486 #define BCM_OAM_LOSS_STATISTICS_EXTENDED    0x800      /* Specifies that
    487                                                           extended statistics
    488                                                           are to be maintained */
    489 #define BCM_OAM_LOSS_UPDATE                 0x1000     /* Update LM settings for
    490                                                           given endpoint (leaves
    491                                                           statistics unchanged). */
    492 #define BCM_OAM_LOSS_SLM                    0x2000     /* Transmit SLM/Rs (as
    493                                                           opposed to LMM/Rs). */
    494 #define BCM_OAM_LOSS_REPORT_MODE            0x4000     /* Enable report mode. */
    495 #define BCM_OAM_COMBINED_LOSS_DELAY         0x8000     /* Enable Combined Loss
    496                                                           and Delay mode for
    497                                                           MPLS LM/DM (RFC 6374),
    498                                                           both loss and delay
    499                                                           add should be called
    500                                                           with this flag for the
    501                                                           same endpoint Id */
    502 
    503 /* OAM delay flags */
    504 #define BCM_OAM_DELAY_TX_ENABLE             0x0001     /* Enable Delay Packet
    505                                                           Transmission */
    506 #define BCM_OAM_DELAY_ONE_WAY               0x0002     /* One Way Mode */
    507 #define BCM_OAM_DELAY_FIRST_RX_COPY_TO_CPU  0x0004     /* Copy First received
    508                                                           Delay Measurement
    509                                                           Packet to CPU */
    510 #define BCM_OAM_DELAY_ALL_RX_COPY_TO_CPU    0x0008     /* Copy all received
    511                                                           Delay Measurement
    512                                                           Packet to CPU */
    513 #define BCM_OAM_DELAY_WITH_ID               0x0010     /* Use the specified
    514                                                           delay id */
    515 #define BCM_OAM_DELAY_UPDATE                0x20       /* Update DM settings for
    516                                                           given endpoint (leaves
    517                                                           statistics unchanged). */
    518 #define BCM_OAM_DELAY_REPORT_MODE           0x40       /* Enable report mode. */
    519 #define BCM_OAM_COMBINED_LOSS_DELAY_RSVD    0x8000     /* Enable Combined Loss
    520                                                           and Delay mode for
    521                                                           MPLS LM/DM (RFC 6374),
    522                                                           both loss and delay
    523                                                           add should be called
    524                                                           with this flag for the
    525                                                           same endpoint Id */
    526 
    527 /* OAM endpoint action flags */
    528 #define BCM_OAM_ENDPOINT_ACTION_DISABLE 0x00000001 /* Reset the endpoint
    529                                                       action(s) */
    530 
    531 /* Counter action vaues for loss add API */
    532 typedef enum bcm_oam_lm_counter_action_e {
    533     bcmOamCounterActionNone = 0,        /* No action */
    534     bcmOamCounterActionIncrement = 1,   /* Increment Counter */
    535     bcmOamCounterActionSample = 2       /* Sample Counter */
    536 } bcm_oam_lm_counter_action_t;
    537 
    538 /* OAM AIS flags */
    539 #define BCM_OAM_AIS_UPDATE          0x0001     /* Update AIS settings for given
    540                                                   endpoint. */
    541 #define BCM_OAM_AIS_MULTICAST       0x0002     /* Transmit AIS frames with
    542                                                   multicast DA address. */
    543 #define BCM_OAM_AIS_WITH_AIS_ID     0x0004     /* Use given ais_id */
    544 #define BCM_OAM_AIS_TRANSMIT_START  0x0008     /* Enable AIS transmission for
    545                                                   given local MEP */
    546 #define BCM_OAM_AIS_TRANSMIT_STOP   0x0010     /* Disable AIS transmission for
    547                                                   given local MEP */
    548 
    549 /* BHH Loopback flags, used to set flags field of bcm_oam_loopback_t */
    550 #define BCM_OAM_BHH_INC_REQUESTING_MEP_TLV  0x00000001 /* Include requesting MEP
    551                                                           ID TLV in message */
    552 #define BCM_OAM_BHH_SET_TTL                 0x00000002 /* Set TLL field in LBM */
    553 #define BCM_OAM_BHH_LBM_INGRESS_DISCOVERY_MEP_TLV 0x00000010 /* Use ingress discovery
    554                                                           MEP ID TLV in LBM */
    555 #define BCM_OAM_BHH_LBM_EGRESS_DISCOVERY_MEP_TLV 0x00000020 /* Use egress discovery
    556                                                           MEP ID TLV in LBM */
    557 #define BCM_OAM_BHH_LBM_ICC_MEP_TLV         0x00000040 /* Use ICC based MEP ID
    558                                                           TLV in LBM */
    559 #define BCM_OAM_BHH_LBM_ICC_MIP_TLV         0x00000080 /* Use ICC based MIP ID
    560                                                           TLV in LBM */
    561 #define BCM_OAM_BHH_LBR_ICC_MEP_TLV         0x00000100 /* Use ICC based MEP ID
    562                                                           TLV in LBR */
    563 #define BCM_OAM_BHH_LBR_ICC_MIP_TLV         0x00000200 /* Use ICC based MIP ID
    564                                                           TLV in LBR */
    565 
    566 /* OAM loopback flags, used to set flags field in bcm_oam_loopback_t */
    567 #define BCM_OAM_LOOPBACK_UPDATE         0x1        /* Update Loopback settings
    568                                                       (leaves statistics
    569                                                       unchanged). */
    570 #define BCM_OAM_LOOPBACK_WITH_CTF_ID    0x2        
    571 #define BCM_OAM_LOOPBACK_WITH_GTF_ID    0x4        
    572 #define BCM_OAM_LOOPBACK_PERIOD_IN_PPS  0x8        /* Default is milliseconds.
    573                                                       flag may be used for
    574                                                       packet per second. */
    575 #define BCM_OAM_LOOPBACK_TX_ENABLE      0x400      /* Enable Loopback Packet
    576                                                       Transmission */
    577 
    578 /* OAM TST flags */
    579 #define BCM_OAM_TST_TX_UPDATE   0x1        /* Update Loopback settings (leaves
    580                                               statistics unchanged). */
    581 #define BCM_OAM_TST_RX_UPDATE   0x2        
    582 #define BCM_OAM_TST_TX_WITH_ID  0x4        
    583 #define BCM_OAM_TST_RX_WITH_ID  0x8        
    584 
    585 /* OAM PSC flags */
    586 #define BCM_OAM_PSC_TX_BURST                0x0001     /* Trigger PSC Burst
    587                                                           Transmission */
    588 #define BCM_OAM_PSC_TX_ENABLE               0x0002     /* Enable PSC slow-rate
    589                                                           Transmission */
    590 #define BCM_OAM_PSC_REVERTIVE               0x0004     /* Enable Revertive mode */
    591 #define BCM_OAM_PSC_FIRST_RX_COPY_TO_CPU    0x0008     /* Copy First received
    592                                                           PSC message to CPU */
    593 #define BCM_OAM_PSC_ALL_RX_COPY_TO_CPU      0x0010     /* Copy all received PSC
    594                                                           message to CPU */
    595 
    596 /* OAM PW Status flags */
    597 #define BCM_OAM_PW_STATUS_TX_BURST          0x0001     /* Trigger PW Status
    598                                                           Burst Transmission */
    599 #define BCM_OAM_PW_STATUS_TX_ENABLE         0x0002     /* Enable PW Status
    600                                                           Packet Transmission */
    601 #define BCM_OAM_PW_STATUS_FIRST_RX_COPY_TO_CPU 0x0004     /* Copy First received PW
    602                                                           Status message to CPU */
    603 #define BCM_OAM_PW_STATUS_ALL_RX_COPY_TO_CPU 0x0008     /* Copy all received PW
    604                                                           Status message to CPU */
    605 
    606 /* 
    607  * Constants for FFD frequency defined by Y.1711, which will reuse ccm
    608  * period field in endpoint objects
    609  */
    610 #define BCM_OAM_ENDPOINT_FFD_FREQUENCY_10MS 10         
    611 #define BCM_OAM_ENDPOINT_FFD_FREQUENCY_20MS 20         
    612 #define BCM_OAM_ENDPOINT_FFD_FREQUENCY_50MS 50         
    613 #define BCM_OAM_ENDPOINT_FFD_FREQUENCY_100MS 100        
    614 #define BCM_OAM_ENDPOINT_FFD_FREQUENCY_200MS 200        
    615 #define BCM_OAM_ENDPOINT_FFD_FREQUENCY_500MS 500        
    616 
    617 /* OAM SD/SF flags */
    618 #define BCM_OAM_SD_SF_FLAGS_ALERT_METHOD    0x1        /* if set, issue event on
    619                                                           signal degradation /
    620                                                           signal fault set,
    621                                                           otherwise issue alert
    622                                                           on state change */
    623 #define BCM_OAM_SD_SF_FLAGS_ALERT_SUPRESS   0x2        /* Suppress alert event
    624                                                           generation */
    625 
    626 /* OAM Y.1711 ALARM flags */
    627 #define BCM_OAM_Y_1711_FLAGS_ALERT_METHOD   0x1        /* if alert_method 1,
    628                                                           issue event on
    629                                                           mismerge, mismatch or
    630                                                           excess indication set,
    631                                                           otherwise issue event
    632                                                           on state change */
    633 
    634 /* OAM Y.1711 ALARM flags */
    635 #define BCM_OAM_Y_1711_FLAGS_THRESHOLD  0x2        /* Use to configure 1711
    636                                                       threshold globally */
    637 
    638 /* OAM CSF flags */
    639 #define BCM_OAM_CSF_UPDATE      0x0001     /* Update CSF settings for given
    640                                               endpoint. */
    641 
    642 /* CSF Type */
    643 #define BCM_OAM_CSF_LOS         0x0        /* Loss of Signal. */
    644 #define BCM_OAM_CSF_FDI         0x1        /* Forward Defect Indication. */
    645 #define BCM_OAM_CSF_RDI         0x2        /* Reverse Defect Indication. */
    646 #define BCM_OAM_CSF_DCI         0x3        /* Defect Clear Indication. */
    647 
    648 /* OAM endpoint types */
    649 typedef enum bcm_oam_endpoint_type_e {
    650     bcmOAMEndpointTypeEthernet = 0,     /* Ethernet endpoint */
    651     bcmOAMEndpointTypeMPLSPerformance = 1, /* MPLS performance monitoring endpoint */
    652     bcmOAMEndpointTypePSC = 2,          /* Protection coordination state
    653                                            protocol endpoint */
    654     bcmOAMEndpointTypeBHHMPLS = 3,      /* BHH for MPLS-TP */
    655     bcmOAMEndpointTypeBHHMPLSVccv = 4,  /* BHH for MPLS-TP Psuedowire Virtual
    656                                            Circuit Connectivity Verification */
    657     bcmOAMEndpointTypeBHHPwe = 5,       /* BHH for PWE */
    658     bcmOAMEndpointTypePwStatus = 6,     /* Protection coordination state
    659                                            protocol endpoint */
    660     bcmOAMEndpointTypeMplsLmDmSectionPort = 7, /* RFC 6374 Section loss/delay
    661                                            measurement based on Port */
    662     bcmOAMEndpointTypeMplsLmDmSectionInnervlan = 8, /* RFC 6374 Section loss/delay
    663                                            measurement based on Port and Inner
    664                                            vlan */
    665     bcmOAMEndpointTypeMplsLmDmSectionOuterVlan = 9, /* RFC 6374 Section loss/delay
    666                                            measurement based on Port and Outer
    667                                            vlan */
    668     bcmOAMEndpointTypeMplsLmDmSectionOuterPlusInnerVlan = 10, /* RFC 6374 Section loss/delay
    669                                            measurement based on Port and Outer
    670                                            vlan and Inner vlan */
    671     bcmOAMEndpointTypeMplsLmDmPw = 11,  /* RFC 6374 Section loss/delay
    672                                            measurement based on Pseudowire */
    673     bcmOAMEndpointTypeMplsLmDmLsp = 12, /* RFC 6374 Section loss/delay
    674                                            measurement based on LSP */
    675     bcmOAMEndpointTypeBhhSection = 13,  /* BHH Section based on Port */
    676     bcmOAMEndpointTypeBhhSectionInnervlan = 14, /* BHH section based on Port and Inner
    677                                            vlan */
    678     bcmOAMEndpointTypeBhhSectionOuterVlan = 15, /* BHH section based on Port and Outer
    679                                            vlan */
    680     bcmOAMEndpointTypeBhhSectionOuterPlusInnerVlan = 16, /* BHH section based on Port and Outer
    681                                            vlan and Inner vlan */
    682     bcmOAMEndpointTypeMPLSNetwork = 17, /*  MPLS networks monitoring endpoint
    683                                            for ITU-T Y.1711 */
    684     bcmOAMEndpointTypeBHHPweGAL = 18,   /* BHH for PWE over GAL */
    685     bcmOAMEndpointTypeCount = 19        /* Always the last. Not an usable value. */
    686 } bcm_oam_endpoint_type_t;
    687 
    688 /* VCCV Control Channel Type */
    689 typedef enum bcm_oam_vccv_type_e {
    690     bcmOamBhhVccvChannelAch = 0,    /* Channel ACH */
    691     bcmOamBhhVccvRouterAlert = 1,   /* Router Alert */
    692     bcmOamBhhVccvTtl = 2,           /* TTL */
    693     bcmOamBhhVccvGal13 = 3          /* GAL 13 */
    694 } bcm_oam_vccv_type_t;
    695 
    696 /* OAM event types */
    697 typedef enum bcm_oam_event_type_e {
    698     bcmOAMEventEndpointPortDown = 0, 
    699     bcmOAMEventEndpointPortUp = 1, 
    700     bcmOAMEventEndpointInterfaceDown = 2, 
    701     bcmOAMEventEndpointInterfaceUp = 3, 
    702     bcmOAMEventEndpointInterfaceTestingToUp = 4, 
    703     bcmOAMEventEndpointInterfaceUnknownToUp = 5, 
    704     bcmOAMEventEndpointInterfaceDormantToUp = 6, 
    705     bcmOAMEventEndpointInterfaceNotPresentToUp = 7, 
    706     bcmOAMEventEndpointInterfaceLLDownToUp = 8, 
    707     bcmOAMEventEndpointInterfaceTesting = 9, 
    708     bcmOAMEventEndpointInterfaceUnkonwn = 10, 
    709     bcmOAMEventEndpointInterfaceDormant = 11, 
    710     bcmOAMEventEndpointInterfaceNotPresent = 12, 
    711     bcmOAMEventEndpointInterfaceLLDown = 13, 
    712     bcmOAMEventGroupCCMxcon = 14, 
    713     bcmOAMEventGroupCCMError = 15, 
    714     bcmOAMEventGroupRemote = 16, 
    715     bcmOAMEventGroupCCMTimeout = 17, 
    716     bcmOAMEventBHHLBTimeout = 18, 
    717     bcmOAMEventBHHLBDiscoveryUpdate = 19, 
    718     bcmOAMEventBHHCCMTimeout = 20, 
    719     bcmOAMEventBHHCCMState = 21, 
    720     bcmOAMEventEndpointCCMTimeout = 22, 
    721     bcmOAMEventEndpointCCMTimein = 23, 
    722     bcmOAMEventEndpointCCMTimeoutEarly = 24, 
    723     bcmOAMEventEndpointRemote = 25, 
    724     bcmOAMEventEndpointRemoteUp = 26, 
    725     bcmOAMEventEndpointDmStatistics = 27, 
    726     bcmOAMEventEndpointLmStatistics = 28, 
    727     bcmOAMEventBHHCCMRdi = 29, 
    728     bcmOAMEventBHHCCMUnknownMegLevel = 30, 
    729     bcmOAMEventBHHCCMUnknownMegId = 31, 
    730     bcmOAMEventBHHCCMUnknownMepId = 32, 
    731     bcmOAMEventBHHCCMUnknownPeriod = 33, 
    732     bcmOAMEventBHHCCMUnknownPriority = 34, 
    733     bcmOAMEventBHHCCMRdiClear = 35, 
    734     bcmOAMEventBHHCCMUnknownMegLevelClear = 36, 
    735     bcmOAMEventBHHCCMUnknownMegIdClear = 37, 
    736     bcmOAMEventBHHCCMUnknownMepIdClear = 38, 
    737     bcmOAMEventBHHCCMUnknownPeriodClear = 39, 
    738     bcmOAMEventBHHCCMUnknownPriorityClear = 40, 
    739     bcmOAMEventBHHRawData = 41, 
    740     bcmOAMEventEthLmDmRawData = 42, 
    741     bcmOAMEventMplsLmDmRawData = 43, 
    742     bcmOAMEventGroupMACStatus = 44, 
    743     bcmOAMEventGroupCCMxconClear = 45, 
    744     bcmOAMEventGroupCCMErrorClear = 46, 
    745     bcmOAMEventGroupRemoteClear = 47, 
    746     bcmOAMEventGroupCCMTimeoutClear = 48, 
    747     bcmOAMEventGroupMACStatusClear = 49, 
    748     bcmOAMEventBHHCCMTimeoutClear = 50, 
    749     bcmOAMEventBhhPmCounterRollover = 51, 
    750     bcmOAMEventEthLmDmPmCounterRollover = 52, 
    751     bcmOAMEventMplsLmDmPmCounterRollover = 53, 
    752     bcmOAMEventCsfLos = 54, 
    753     bcmOAMEventCsfFdi = 55, 
    754     bcmOAMEventCsfRdi = 56, 
    755     bcmOAMEventCsfDci = 57, 
    756     bcmOAMEventEndpointSdSet = 58,      /* Signal degradation set. For Y1731 or
    757                                            MPLS networks endpoints */
    758     bcmOAMEventEndpointSdClear = 59,    /* Signal degradation clear. For Y1731
    759                                            or MPLS networks endpoints */
    760     bcmOAMEventEndpointSfSet = 60,      /* Signal failure set. For Y1731 or MPLS
    761                                            networks endpoints */
    762     bcmOAMEventEndpointSfClear = 61,    /* Signal failure clear. For Y1731 or
    763                                            MPLS networks endpoints */
    764     bcmOAMEventEndpointDExcessSet = 62, /* DExcess detect. For MPLS networks
    765                                            endpoints */
    766     bcmOAMEventEndpointDMissmatch = 63, /* DMissmatch detect. For MPLS networks
    767                                            endpoints */
    768     bcmOAMEventEndpointDMissmerge = 64, /* DMissmerge detect. For MPLS networks
    769                                            endpoints */
    770     bcmOAMEventEndpointDAllClear = 65,  /* DAllClear. For MPLS networks
    771                                            endpoints */
    772     bcmOAMEventCount = 66 
    773 } bcm_oam_event_type_t;
    774 
    775 /* OAM Group Fault Alarm Defects and Priorities */
    776 typedef enum bcm_oam_group_fault_alarm_defect_priority_e {
    777     bcmOAMGroupFaultAlarmPriorityDefectsAll = 0, /* Generate fault alarm for all defects */
    778     bcmOAMGroupFaultAlarmPriorityDefectRDICCM = 1, /* Generate fault alarm when CCM
    779                                            received by this Maintenance Endpoint
    780                                            from some remote Maintenance Endpoint
    781                                            contained RDI bit */
    782     bcmOAMGroupFaultAlarmPriorityDefectMACStatus = 2, /* Generate fault alarm when the last
    783                                            CCM received by this MEP from some
    784                                            remote MEP indicated that the
    785                                            Transmitting Maintenance Endpoint's
    786                                            associated MAC is reporting an error
    787                                            status */
    788     bcmOAMGroupFaultAlarmPriorityDefectRemoteCCM = 3, /* Generate fault alarm when Maintenance
    789                                            Endpoint is not receiving CCMs from
    790                                            some other Maintenance Endpoint in
    791                                            its configured list */
    792     bcmOAMGroupFaultAlarmPriorityDefectErrorCCM = 4, /* Generate fault alarm when Maintenance
    793                                            Endpoint is receiving Invalid CCMs */
    794     bcmOAMGroupFaultAlarmPriorityDefectXconCCM = 5, /* Generate fault alarm when Maintenance
    795                                            Endpoint is receiving CCMs that could
    796                                            be from some other MA */
    797     bcmOAMGroupFaultAlarmPriorityDefectsNone = 6, /* No Defects are reported */
    798     bcmOAMGroupFaultAlarmPriorityCount = 7 
    799 } bcm_oam_group_fault_alarm_defect_priority_t;
    800 
    801 /* OAM Timestamp Formats */
    802 typedef enum bcm_oam_timestamp_format_e {
    803     bcmOAMTimestampFormatNTP = 0,       /* Network Time Protocol version 4
    804                                            64-bit timestamp format [RFC5905] */
    805     bcmOAMTimestampFormatIEEE1588v1 = 1 /* Low-order 64 bits of the IEEE
    806                                            1588-2008 (1588v2) Precision Time
    807                                            Protocol timestamp format [IEEE1588] */
    808 } bcm_oam_timestamp_format_t;
    809 
    810 /* OAM action types */
    811 typedef enum bcm_oam_action_type_e {
    812     bcmOAMActionCountEnable = 0,        /* Enable counting. */
    813     bcmOAMActionMeterEnable = 1,        /* Enable metering. */
    814     bcmOAMActionDrop = 2,               /* Drop the packet. */
    815     bcmOAMActionCopyToCpu = 3,          /* Send the packet to CPU. */
    816     bcmOAMActionFwdAsData = 4,          /* Forward the packet as normal data
    817                                            packet. */
    818     bcmOAMActionFwd = 5,                /* Forward the packet to a specified
    819                                            destination. */
    820     bcmOAMActionUcDrop = 6,             /* Drop UC OAM packet. */
    821     bcmOAMActionUcCopyToCpu = 7,        /* Send UC OAM packet to CPU. */
    822     bcmOAMActionUcFwdAsData = 8,        /* Forward UC OAM packet as normal data
    823                                            packet. */
    824     bcmOAMActionUcFwd = 9,              /* Forward UC OAM packet to a specified
    825                                            destination. */
    826     bcmOAMActionMcDrop = 10,            /* Drop MC OAM packet. */
    827     bcmOAMActionMcCopyToCpu = 11,       /* Send MC OAM packet to CPU. */
    828     bcmOAMActionMcFwdAsData = 12,       /* Forward MC OAM packet as normal data
    829                                            packet. */
    830     bcmOAMActionMcFwd = 13,             /* Forward MC OAM packet to a specified
    831                                            destination. */
    832     bcmOAMActionLowMdlDrop = 14,        /* Drop low MDL packet. */
    833     bcmOAMActionLowMdlCopyToCpu = 15,   /* copy low MDL packets to CPU. */
    834     bcmOAMActionLowMdlFwdAsData = 16,   /* Forward low MDL packets as normal
    835                                            data packets. */
    836     bcmOAMActionLowMdlFwd = 17,         /* Forward low MDL packets to a
    837                                            specified destination. */
    838     bcmOAMActionMyStationMissCopyToCpu = 18, /* Forward MY_STATION_MISS packets to
    839                                            CPU. */
    840     bcmOAMActionMyStationMissDrop = 19, /* DROP MY_STATION_MISS packets. */
    841     bcmOAMActionMyStationMissFwdAsData = 20, /* Forward MY_STATION_MISS packets as
    842                                            normal data packets. */
    843     bcmOAMActionMyStationMissFwd = 21,  /* Forward MY_STATION_MISS packets to a
    844                                            specified destination. */
    845     bcmOAMActionProcessInHw = 22,       /* Process in internal OAM/CCM engine. */
    846     bcmOAMActionLowMdlCcmFwdAsRegularCcm = 23, /* Use same action as that of normal
    847                                            CCM. */
    848     bcmOAMActionSLMEnable = 24,         /* Count SLM packets, disable of data
    849                                            packets counting. */
    850     bcmOAMActionLowMdlProcessInInternalOamEngine = 25, /* Process Low MDL packets in internal
    851                                            OAM/CCM engine. */
    852     bcmOAMActionL2StationMissProcessInInternalOamEngine = 26, /* Process l2 station miss packets in
    853                                            internal CCM engine. */
    854     bcmOAMActionL2StationHitProcessInInternalOamEngine = 27, /* Process L2 station hit packets in
    855                                            internal CCM engine. */
    856     bcmOAMActionMCProcessInInternalOamEngine = 28, /* Process Multicast OAM packets in
    857                                            internal OAM engine. */
    858     bcmOAMActionSampleTimeStamp = 29,   /* Sample the time stamp value to DM
    859                                            packet. */
    860     bcmOAMActionSampleLmCounter = 30,   /* Sample the counter value to LM
    861                                            packet. */
    862     bcmOAMActionCount = 31              /* Always Last. Not a usable value. */
    863 } bcm_oam_action_type_t;
    864 
    865 /* OAM Control types */
    866 typedef enum bcm_oam_control_type_e {
    867     bcmOamControlFlexibleDropPort = 0,  /* Flexible drop control for Ingress
    868                                            port-domain OAM */
    869     bcmOamControlFlexibleDropCVlan = 1, /* Flexible drop control for Ingress
    870                                            C-VLAN domain OAM */
    871     bcmOamControlFlexibleDropSVlan = 2, /* Flexible drop control for Ingress
    872                                            S-VLAN domain OAM */
    873     bcmOamControlFlexibleDropCPlusSVlan = 3, /* Flexible drop control for Ingress
    874                                            C+S-VLAN domain OAM */
    875     bcmOamControlFlexibleDropVP = 4,    /* Flexible drop control for Ingress VP
    876                                            based(PBB-TE) OAM domain */
    877     bcmOamControlFlexibleDropEgressPort = 5, /* Flexible drop control for egress
    878                                            port-domain OAM */
    879     bcmOamControlFlexibleDropEgressCVlan = 6, /* Flexible drop control for egress
    880                                            C-VLAN domain OAM */
    881     bcmOamControlFlexibleDropEgressSVlan = 7, /* Flexible drop control for egress
    882                                            S-VLAN domain OAM */
    883     bcmOamControlFlexibleDropEgressCPlusSVlan = 8, /* Flexible drop control for egress
    884                                            C+S-VLAN domain OAM */
    885     bcmOamControlFlexibleDropEgressVP = 9, /* Flexible drop control for egress VP
    886                                            based(PBB-TE)OAM domain */
    887     bcmOamControlFlexibleDropPasssiveSap = 10, /* Flexible drop control for S-VLAN
    888                                            domain Passive OAM filtering */
    889     bcmOamControlFlexibleDropEgressPasssiveSap = 11, /* Flexible drop control for egress
    890                                            S-VLAN domain Passive OAM filtering */
    891     bcmOamControlReportMode = 12,       /* Accepts of one of the
    892                                            bcm_oam_report_mode_type_t as the
    893                                            arg. */
    894     bcmOamControlUnknownAchCount = 13,  /* Count unknown ACH or Any VCCV packet
    895                                            with or without ACH. */
    896     bcmOamControlNtpToD = 14,           /* Set the NTP Time of Day used for DM. */
    897     bcmOamControl1588ToD = 15,          /* Set the 1588 Time of Day used for DM. */
    898     bcmOamControlSrcMacLsbReserve = 16, /* Reserve Src-Mac LSB value to be used
    899                                            for OAM endpoints (resource shared
    900                                            with BFD endpoints) */
    901     bcmOamControlSrcMacLsbUnReserve = 17, /* Unreserve Src-Mac LSB value (resource
    902                                            shared with BFD endpoints) */
    903     bcmOamControlLmPcpCounterRangeMax = 18, /* lm_counter_base_ids between Max and
    904                                            Min will count by priority */
    905     bcmOamControlLmPcpCounterRangeMin = 19, /* lm_counter_base_ids between Max and
    906                                            Min will count by priority */
    907     bcmOamControlOampPuntPacketIntPri = 20, /* Bits [1:0] of given value determine
    908                                            the color (DP), bits [4:2] determine
    909                                            the Traffic Class */
    910     bcmOamControlOampCCMWeight = 21,    /* Given may be between 0 and 6 */
    911     bcmOamControlOampSATWeight = 22,    /* Given may be between 0 and 6 */
    912     bcmOamControlOampResponseWeight = 23, /* Given may be between 0 and 6 */
    913     bcmOamControlOampStatsTxOpcode = 24, /* Enable/Disable counting of specific
    914                                            opcode in Tx, may be used in
    915                                            bcm_oam_control_indexed_set/get. The
    916                                            Index is the OpCode (CCM OpCode also
    917                                            controls counting BFD PDUs) */
    918     bcmOamControlOampStatsRxOpcode = 25, /* Enable/Disable counting of specific
    919                                            opcode in Rx, may be used in
    920                                            bcm_oam_control_indexed_set/get. The
    921                                            Index is the OpCode (CCM OpCode also
    922                                            controls counting BFD PDUs) */
    923     bcmOamControlOampStatsShift = 26,   /* Used for building counter pointer for
    924                                            OAMP Tx/Rx statistics */
    925     bcmOAMControlCount = 27             /* Always Last. Not a usable value. */
    926 } bcm_oam_control_type_t;
    927 
    928 /* Drop conditions that need to be ignored */
    929 typedef enum bcm_oam_condition_e {
    930     bcmOamConditionPFCDrop = 0,         /* PFC frames marked for drop */
    931     bcmOamConditionFlowControlDrop = 1, /* VOQ Flow control packet marked for
    932                                            drop */
    933     bcmOamConditionMacsaEqualsMacdaDrop = 2, /* Packet marked for drop by the DoS
    934                                            prevention logic due to MAC SA = MAC
    935                                            DA condition set via
    936                                            bcmSwitchDosAttackMACSAEqualMACDA */
    937     bcmOamConditionAutoMulticastTunnelControlPacketDrop = 3, /* AMT(Auto Multicast Tunnel) control
    938                                            packet marked for drop due to AMT
    939                                            tunnel configuration being set to not
    940                                            to send AMT control packet to CPU */
    941     bcmOamConditionUnknownSubportErrorDrop = 4, /* Packet marked for drop for coming
    942                                            from an unknown subtending port */
    943     bcmOamConditionSubportPktTagDrop = 5, /* Packet with link layer tag marked for
    944                                            drop. This happens when
    945                                            bcmPortControlSubportPktTagDrop
    946                                            control is set to drop packets with
    947                                            LLTAG(TR101) */
    948     bcmOamConditionNoSubportPktTagDrop = 6, /* Packet without link layer tag marked
    949                                            for drop. This happens when
    950                                            bcmPortControlNoSubportPktTagDrop
    951                                            control is set to drop packets with
    952                                            link layer tag(TR101) */
    953     bcmOamConditionIngressFilterDrop = 7, /* Packet marked for drop due to port
    954                                            not being a member of VLAN. This
    955                                            happens when VLAN filtering is
    956                                            enabled by passing
    957                                            BCM_PORT_VLAN_MEMBER_INGRESS flags to
    958                                            bcm_port_vlan_member_set API */
    959     bcmOamConditionEgressFilterDrop = 8, /* Packet marked for drop due to port
    960                                            not being a member of VLAN. This
    961                                            happens when VLAN filtering is
    962                                            enabled by passing
    963                                            BCM_PORT_VLAN_MEMBER_EGRESS flags to
    964                                            bcm_port_vlan_member_set API */
    965     bcmOamConditionInvalidTpidDrop = 9, /* Packet marked for drop due to
    966                                            mismatch between packet VLAN TPID and
    967                                            configured VLAN TPID value (in VLAN
    968                                            profile) */
    969     bcmOamConditionOamMetadataHeaderErrorDrop = 10, /* Packet marked for drop due to OLP
    970                                            (OAM metadata) header error */
    971     bcmOamConditionFieldLookupDrop = 11, /* Packet marked for drop due to VFP
    972                                            action */
    973     bcmOamConditionSATDrop = 12,        /* Packet marked for drop by SAT */
    974     bcmOamConditionVlanTranslateIngressMissDrop = 13, /* Packet marked for drop due to vlan
    975                                            translate miss. This drop is
    976                                            configured via VLAN control
    977                                            bcmVlanTranslateIngressMissDrop */
    978     bcmOamConditionVlanTranslateEgressMissDrop = 14, /* Packet marked for drop due to vlan
    979                                            translate miss. This drop is
    980                                            configured via VLAN control
    981                                            bcmVlanTranslateEgressMissDrop */
    982     bcmOamConditionMplsLabelLookupMissDrop = 15, /* Packet marked for drop due to MPLS
    983                                            label lookup miss */
    984     bcmOamConditionMplsInvalidActionDrop = 16, /* Packet marked for drop due to MPLS
    985                                            lookup result configured with invalid
    986                                            action */
    987     bcmOamConditionMplsInvalidPayloadDrop = 17, /* Packet marked for drop by MPLS
    988                                            processing due to invalid payload */
    989     bcmOamConditionMplsTtlErrorDrop = 18, /* Packet marked for drop due to MPLS
    990                                            TTL check fail */
    991     bcmOamConditionStgNotInForwardDrop = 19, /* Packet marked for drop due to
    992                                            Spanning tree not being in
    993                                            FORWARDING_STATE */
    994     bcmOamConditionEgressTtlErrorDrop = 20, /* Packet marked for drop due to TTL
    995                                            error */
    996     bcmOamConditionEgressStgBlockedDrop = 21, /* Packet marked for drop due to
    997                                            Spanning tree in blocking state */
    998     bcmOamConditionEgressStgDisabledDrop = 22, /* Packet marked for drop due to
    999                                            Spanning tree in disable state */
   1000     bcmOamConditionEgressIPMCSameVlanPruneDrop = 23, /* IPMC packet marked for drop due to
   1001                                            bcmSwitchIpmcSameVlanPruning setting.
   1002                                            When this is set, trying to do L2
   1003                                            switching for an IPMC packet results
   1004                                            in packet drop */
   1005     bcmOamConditionEgressMMUErrorDrop = 24, /* Packet marked for drop due to MMU
   1006                                            error - purge/age */
   1007     bcmOamConditionEgressBadTdipDrop = 25, /* Packet marked for drop due to bad
   1008                                            tunnel destination IP in case of 6to4
   1009                                            tunnels and ISATAP tunnels - possible
   1010                                            reasons are incorrect prefix for IPv6
   1011                                            DIP, IPv4 DIP/SIP is
   1012                                            BC/Zero/loopback/Class-D , IPv4 SIP =
   1013                                            DIP */
   1014     bcmOamConditionEgressUnknownVlanDrop = 26, /* Packet marked for drop due to unknown
   1015                                            VLAN. This happens when
   1016                                            bcmVlanDropUnknown vlan control is
   1017                                            used to set dropping of unknown VLAN
   1018                                            packets */
   1019     bcmOamConditionEgressCompositeErrorDrop = 27, /* Packet marked for drop due to parity
   1020                                            error from memories or ISM lookup
   1021                                            fail */
   1022     bcmOamConditionEgressSplitHorizonDrop = 28, /* Packet marked for drop due to split
   1023                                            horizon check. This is done by
   1024                                            enabling pruning for DVP network
   1025                                            group via
   1026                                            bcm_switch_network_group_config_set
   1027                                            with
   1028                                            BCM_SWITCH_NETWORK_GROUP_EGRESS_PRUNE_ENABLE */
   1029     bcmOamConditionEgressSVPRemovalDrop = 29, /* Packet marked for drop due to virtual
   1030                                            port pruning - SVP = DVP and VP based
   1031                                            pruning is enabled
   1032                                            (DISABLE_VP_PRUNING is set to 0 in
   1033                                            Source VP table) */
   1034     bcmOamConditionEgressNonUCPruneDrop = 30, /* Non-unicast packet marked for drop
   1035                                            due to drop condition set in egress
   1036                                            next hop via bcm_mpls_port_add API
   1037                                            with BCM_MPLS_PORT_DROP flag */
   1038     bcmOamConditionCount = 31           /* Always Last. Not a usable value. */
   1039 } bcm_oam_condition_t;
   1040 
   1041 /* OAM lookup types */
   1042 typedef enum bcm_oam_lookup_type_e {
   1043     bcmOamLookupTypePort = 0,           /* Port based Ethernet OAM */
   1044     bcmOamLookupTypeInnerVlan = 1,      /* Inner Vlan based Ethernet OAM */
   1045     bcmOamLookupTypeOuterVlan = 2,      /* Outer Vlan based Ethernet OAM */
   1046     bcmOamLookupTypeOuterPlusInnerVlan = 3, /* Outer+inner vlan based Ethernet OAM */
   1047     bcmOamLookupTypeVirtualPort = 4,    /* VP based Ethernet OAM */
   1048     bcmOamLookupTypeOuterVlanPassive = 5, /* Outer Vlan based passive Ethernet OAM */
   1049     bcmOamLookupTypeMplsSection = 6,    /* MPLS section OAM */
   1050     bcmOamLookupTypeMplsLsp = 7,        /* MPLS LSP OAM */
   1051     bcmOamLookupTypeMplsPw = 8,         /* MPLS Pseudo-wire OAM */
   1052     bcmOamLookupTypeEgressPort = 9,     /* Egress Port based Ethernet OAM */
   1053     bcmOamLookupTypeEgressInnerVlan = 10, /* Egress inner VLAN based Ethernet OAM */
   1054     bcmOamLookupTypeEgressOuterVlan = 11, /* Egress Outer Vlan based Ethernet OAM */
   1055     bcmOamLookupTypeEgressOuterPlusInnerVlan = 12, /* Egress outer+inner VLAN based Eth-oam */
   1056     bcmOamLookupTypeEgressVirtualPort = 13, /* Egress VP based Ethernet OAM */
   1057     bcmOamLookupTypeEgressOuterVlanPassive = 14, /* Egress outer Vlan based passive
   1058                                            Eth-OAM */
   1059     bcmOamLookupTypeEgressMplsSection = 15, /* Egress MPLS section OAM */
   1060     bcmOamLookupTypeEgressMplsLsp = 16, /* Egress MPLS LSP OAM */
   1061     bcmOamLookupTypeEgressMplsPw = 17,  /* Egress MPLS Pseudo-wire OAM */
   1062     bcmOamLookupTypeCount = 18          /* Always Last. Not a usable value. */
   1063 } bcm_oam_lookup_type_t;
   1064 
   1065 /* MPLS LM DM (RFC 6374) opcode types */
   1066 typedef enum bcm_oam_mpls_lm_dm_opcode_type_e {
   1067     bcmOamMplsLmDmOpcodeTypeLm = 0,     /* RFC 6374 Loss Measurement packet */
   1068     bcmOamMplsLmDmOpcodeTypeDm = 1,     /* RFC6374 Delay Measurement Packet */
   1069     bcmOamMplsLmDmOpcodeTypeIlm = 2,    /* RFC6374 Inferred Loss Measurement
   1070                                            Packet */
   1071     bcmOamMplsLmDmOpcodeTypeLmPlusDm = 3, /* RFC 6374 LM+DM packet */
   1072     bcmOamMplsLmDmOpcodeTypeIlmPlusDm = 4, /* RFC 6374 ILM+DM packet */
   1073     bcmOamMplsLmDmOpcodeTypeMax = 5     /* Max number of opcodes. Not an usable
   1074                                            value. */
   1075 } bcm_oam_mpls_lm_dm_opcode_type_t;
   1076 
   1077 /* MPLS LM DM (RFC 6374) counter types */
   1078 typedef enum bcm_oam_lm_counter_type_e {
   1079     bcmOamLmCounterTypePkt = 0,     /* Counts packets */
   1080     bcmOamLmCounterTypeByte = 1,    /* Counts bytes */
   1081     bcmOamLmCounterTypeCount = 2    /* Always the last value. Not usable. */
   1082 } bcm_oam_lm_counter_type_t;
   1083 
   1084 /* MPLS LM DM (RFC 6374) counter sizes */
   1085 typedef enum bcm_oam_lm_counter_size_e {
   1086     bcmOamLmCounterSize32Bit = 0,   /* Counter size is 32 bit */
   1087     bcmOamLmCounterSize64Bit = 1,   /* Counter size is 64 bit */
   1088     bcmOamLmCounterSizeCount = 2    /* Always the last value. Not usable. */
   1089 } bcm_oam_lm_counter_size_t;
   1090 
   1091 /* OAM TLV pattern type */
   1092 typedef enum bcm_oam_tlv_pattern_type_e {
   1093     bcmOamTlvTypeNone = 0,              /* No TLV */
   1094     bcmOamTlvTypeData = 1,              /* Type = Data (3) */
   1095     bcmOamTlvTypeTestPrbsWithCRC = 2,   /* Type = Test (32), pattern type is
   1096                                            PRBS with CRC */
   1097     bcmOamTlvTypeTestPrbsWithoutCRC = 3, /* Type = Test (32), pattern type is
   1098                                            PRBS without CRC */
   1099     bcmOamTlvTypeTestNullWithCRC = 4,   /* Type = Test (32), pattern type is
   1100                                            NULL with CRC */
   1101     bcmOamTlvTypeTestNullWithoutCRC = 5, /* Type = Test (32), pattern type is
   1102                                            NULL without CRC */
   1103     bcmOamTlvTypeCount = 6 
   1104 } bcm_oam_tlv_pattern_type_t;
   1105 
   1106 /* OAM event callback flags */
   1107 #define BCM_OAM_EVENT_FLAGS_MULTIPLE    0x01       /* Indicates that more than
   1108                                                       one event of the given
   1109                                                       type has occurred. */
   1110 
   1111 typedef struct bcm_oam_event_types_s {
   1112     SHR_BITDCL w[_SHR_BITDCLSIZE(bcmOAMEventCount)]; 
   1113 } bcm_oam_event_types_t;
   1114 
   1115 typedef struct bcm_oam_conditions_s {
   1116     SHR_BITDCL cbits[_SHR_BITDCLSIZE(bcmOamConditionCount)]; 
   1117 } bcm_oam_conditions_t;
   1118 
   1119 typedef struct bcm_oam_lookup_types_s {
   1120     SHR_BITDCL tbits[_SHR_BITDCLSIZE(bcmOamLookupTypeCount)]; 
   1121 } bcm_oam_lookup_types_t;
   1122 
   1123 #define BCM_OAM_EVENT_TYPE_SET(_event_types, _event_type)  SHR_BITSET(((_event_types).w), (_event_type)) 
   1124 
   1125 #define BCM_OAM_EVENT_TYPE_GET(_event_types, _event_type)  SHR_BITGET(((_event_types).w), (_event_type)) 
   1126 
   1127 #define BCM_OAM_EVENT_TYPE_CLEAR(_event_types, _event_type)  SHR_BITCLR(((_event_types).w), (_event_type)) 
   1128 
   1129 #define BCM_OAM_EVENT_TYPE_SET_ALL(_event_types)  SHR_BITSET_RANGE(((_event_types).w), 0, bcmOAMEventCount) 
   1130 
   1131 #define BCM_OAM_EVENT_TYPE_CLEAR_ALL(_event_types)  SHR_BITCLR_RANGE(((_event_types).w), 0, bcmOAMEventCount) 
   1132 
   1133 /* OAM Port Status TLV values */
   1134 #define BCM_OAM_PORT_TLV_BLOCKED    0x1        /* Port is blocked */
   1135 #define BCM_OAM_PORT_TLV_UP         0x2        /* Port is ready to pass data */
   1136 
   1137 /* OAM Interface Status TLV Values */
   1138 #define BCM_OAM_INTERFACE_TLV_UP            0x1        /* Interface is ready to
   1139                                                           pass packets */
   1140 #define BCM_OAM_INTERFACE_TLV_DOWN          0x2        /* Interface is down */
   1141 #define BCM_OAM_INTERFACE_TLV_TESTING       0x3        /* Interface is in some
   1142                                                           test mode */
   1143 #define BCM_OAM_INTERFACE_TLV_UNKNOWN       0x4        /* Interface is in an
   1144                                                           unknown state */
   1145 #define BCM_OAM_INTERFACE_TLV_DORMANT       0x5        /* Interface is in a
   1146                                                           pending state */
   1147 #define BCM_OAM_INTERFACE_TLV_NOTPRESENT    0x6        /* Interface is down
   1148                                                           because of hardware
   1149                                                           component */
   1150 #define BCM_OAM_INTERFACE_TLV_LLDOWN        0x7        /* Interface is down due
   1151                                                           to state of
   1152                                                           lower-layer interfaces */
   1153 
   1154 /* OAM group ID type */
   1155 typedef int bcm_oam_group_t;
   1156 
   1157 /* 
   1158  * OAM group object.  This is equivalent to an 802.1ag Maintenance
   1159  * Association (MA).
   1160  */
   1161 typedef struct bcm_oam_group_info_s {
   1162     uint32 flags; 
   1163     bcm_oam_group_t id; 
   1164     uint8 name[BCM_OAM_GROUP_NAME_LENGTH]; /* This is equivalent to the Maintenance
   1165                                            Association ID (MAID) in 802.1ag. 
   1166                                            Note that this is not a
   1167                                            null-terminated string but an array
   1168                                            of bytes.  To avoid memory
   1169                                            corruption, do not use string copy to
   1170                                            populate this field. */
   1171     uint8 rx_name[BCM_OAM_GROUP_NAME_LENGTH]; /* Additional MAID used for received OAM
   1172                                            packets. It is used when the flag
   1173                                            BCM_OAM_GROUP_RX_NAME is set.  When
   1174                                            used, the received MAID values are
   1175                                            compared to this MAID instead of the
   1176                                            'name' field. */
   1177     uint32 faults;                      /* Fault flags */
   1178     uint32 persistent_faults;           /* Persistent fault flags */
   1179     uint32 clear_persistent_faults;     /* Persistent fault flags to clear on a
   1180                                            'get' */
   1181     bcm_oam_group_fault_alarm_defect_priority_t lowest_alarm_priority; /* Generate fault alarm for this
   1182                                            maintenance endpoint when defects of
   1183                                            greater than or equal to this
   1184                                            priority value are detected on this
   1185                                            maintenance endpoint */
   1186     int group_name_index;               /* Pointer to first extended data entry */
   1187 } bcm_oam_group_info_t;
   1188 
   1189 /* OAM endpoint ID type */
   1190 typedef int bcm_oam_endpoint_t;
   1191 
   1192 /*  OAM additional data for mpls network */
   1193 typedef struct bcm_oam_mpls_network_info_s {
   1194     uint8 function_type;    /* FFD:0x07 or CV:0x01 */
   1195     bcm_ip6_t lsr_id; 
   1196     uint32 lsp_id; 
   1197 } bcm_oam_mpls_network_info_t;
   1198 
   1199 /* OAM action profile encoding according type */
   1200 typedef int bcm_oam_profile_t;
   1201 
   1202 /* 
   1203  * Type of default memory that should be allocated for endpoint
   1204  * SelfContained - Full entry in endpoint area, LmDmOffloaded - Full
   1205  * entry in extra data area, ShortEntry - Short entry in endpoint area.
   1206  */
   1207 typedef enum bcm_oam_endpoint_memory_type_e {
   1208     bcmOamEndpointMemoryTypeSelfContained = 0, 
   1209     bcmOamEndpointMemoryTypeLmDmOffloadedEntry = 1, 
   1210     bcmOamEndpointMemoryTypeShortEntry = 2 
   1211 } bcm_oam_endpoint_memory_type_t;
   1212 
   1213 /* 
   1214  * OAM endpoint object.  This is equivalent to an 802.1ag Maintenance
   1215  * Endpoint (MEP).
   1216  */
   1217 typedef struct bcm_oam_endpoint_info_s {
   1218     uint32 flags; 
   1219     uint32 flags2; 
   1220     uint32 opcode_flags;                /* OAM opcode flags */
   1221     uint32 lm_flags;                    /* OAM loss measurment flags */
   1222     bcm_oam_endpoint_t id; 
   1223     bcm_oam_endpoint_type_t type; 
   1224     bcm_oam_group_t group;              /* The ID of the group to which this
   1225                                            endpoint belongs */
   1226     uint16 name;                        /* A unique identifier of the endpoint
   1227                                            within the group.  This is equivalent
   1228                                            to the MEPID in 802.1ag. */
   1229     bcm_oam_endpoint_t local_id;        /* Used by remote endpoints only. */
   1230     int level;                          /* This is equivalent to the Maintenance
   1231                                            Domain Level (MDL) in 802.1ag. */
   1232     int ccm_period;                     /* For local endpoints, this is the CCM
   1233                                            transmission period in ms.  For
   1234                                            remote endpoints, this is the period
   1235                                            on which CCM timeout is based. */
   1236     bcm_vlan_t vlan;                    /* The VLAN associated with this
   1237                                            endpoint */
   1238     bcm_vlan_t inner_vlan;              /* Configure with CVID for two-tag
   1239                                            operation or set to 0 for one-tag */
   1240     bcm_gport_t gport;                  /* The gport associated with this
   1241                                            endpoint */
   1242     bcm_gport_t tx_gport;               /* TX gport associated with this
   1243                                            endpoint */
   1244     int trunk_index;                    /* The trunk port index for this
   1245                                            endpoint */
   1246     bcm_if_t intf_id;                   /* Interface Identifier */
   1247     bcm_mpls_label_t mpls_label;        /* The MPLS label associated with
   1248                                            packets received from the Peer
   1249                                            Endpoint */
   1250     bcm_mpls_egress_label_t egress_label; /* The MPLS outgoing label information
   1251                                            for the Local Endpoint */
   1252     bcm_oam_mpls_network_info_t mpls_network_info; /* MPLS networks information */
   1253     bcm_mac_t dst_mac_address;          /* The destination MAC address
   1254                                            associated with this endpoint */
   1255     bcm_mac_t src_mac_address;          /* The source MAC address associated
   1256                                            with this endpoint */
   1257     uint8 pkt_pri;                      /* Egress marking for outgoing CCMs */
   1258     uint8 inner_pkt_pri;                /* Packet priority of inner encpsulated
   1259                                            packet */
   1260     uint16 inner_tpid;                  /* Tpid of inner encpsulated packet */
   1261     uint16 outer_tpid;                  /* Tpid of outer encpsulated packet */
   1262     bcm_cos_t int_pri;                  /* Egress queuing for outgoing CCMs. For
   1263                                            DownMEPs, this represents the index
   1264                                            from the base queue. For UpMEPs, this
   1265                                            represents the internal priority
   1266                                            itself. */
   1267     uint8 cpu_qid;                      /* CPU queue for CCMs */
   1268     uint8 pri_map[BCM_OAM_INTPRI_MAX];  /* Priority mapping for LM counter table */
   1269     uint32 faults;                      /* Fault flags */
   1270     uint32 persistent_faults;           /* Persistent fault flags */
   1271     uint32 clear_persistent_faults;     /* Persistent fault flags to clear on a
   1272                                            'get' */
   1273     int ing_map;                        /* Ingress QoS map profile */
   1274     int egr_map;                        /* Egress QoS map profile */
   1275     uint8 ms_pw_ttl;                    /* TTL used for multi-segment pseudowire */
   1276     uint8 port_state;                   /* Endpoint port status */
   1277     uint8 interface_state;              /* Endpoint interface status */
   1278     bcm_oam_vccv_type_t vccv_type;      /* VCCV pseudowire type */
   1279     bcm_vpn_t vpn;                      /* VPN id */
   1280     int lm_counter_base_id;             /* Counter id associated with the mep */
   1281     uint8 lm_counter_if;                /* Counter interface associated with the
   1282                                            mep */
   1283     uint8 loc_clear_threshold;          /* Number of packets required to reset
   1284                                            the Loss-of-Continuity status per end
   1285                                            point */
   1286     bcm_oam_timestamp_format_t timestamp_format; /* DM time stamp format -
   1287                                            NTP/IEEE1588(PTP) */
   1288     uint16 subport_tpid;                /* Tpid of subport Vlan in case of
   1289                                            triple vlan encapsulation */
   1290     bcm_gport_t remote_gport;           /* Local endpoint CCMs are forwarded to
   1291                                            this remote unit for processing. */
   1292     bcm_gport_t mpls_out_gport;         /* Out gport used for TX counting by BHH
   1293                                            endpoints. */
   1294     int sampling_ratio;                 /* 0 - No packets sampled to the CPU.
   1295                                            1-8 - Count of packets (with events)
   1296                                            that need to arrive before one is
   1297                                            sampled to the CPU. */
   1298     uint32 lm_payload_offset;           /* Offset in bytes from TOP of the MPLS
   1299                                            label stack from where the payload
   1300                                            starts for byte count computation. */
   1301     uint32 lm_cos_offset;               /* Offset of the Label from top of the
   1302                                            stack which gives the EXP value for
   1303                                            deriving the COS value - valid values
   1304                                            are 0/1/2. */
   1305     bcm_oam_lm_counter_type_t lm_ctr_type; /* BYTE/PACKET. */
   1306     bcm_oam_lm_counter_size_t lm_ctr_sample_size; /* Valid values are 32/64. */
   1307     uint32 pri_map_id;                  /* OAM priority map id. */
   1308     int lm_ctr_pool_id;                 /* The loss measurement counter pool id
   1309                                            from which the counters should be
   1310                                            allocated. Valid values are 0/1/2. */
   1311     uint32 ccm_tx_update_lm_counter_base_id[BCM_OAM_LM_COUNTER_MAX]; /* The base index of the LM counter to
   1312                                            be updated by Tx CCM packets */
   1313     uint32 ccm_tx_update_lm_counter_offset[BCM_OAM_LM_COUNTER_MAX]; /* Offset to the Base LM counter Id to
   1314                                            be incremented by Tx CCM packets */
   1315     uint8 ccm_tx_update_lm_counter_action[BCM_OAM_LM_COUNTER_MAX]; /* LM Counter action (type
   1316                                            bcm_oam_lm_counter_action_t) to be
   1317                                            used by TX CCM packets */
   1318     uint8 ccm_tx_update_lm_counter_size; /* Number of LM counters to be
   1319                                            incremented by Tx CCM packets */
   1320     uint32 session_id;                  /* OAM session id for packet processing
   1321                                            in BTE. In FP based OAM - This will
   1322                                            indicate flex counter base ID */
   1323     uint8 session_num_entries;          /* Number of entries that can result in
   1324                                            same session ID. In FP based OAM -
   1325                                            This will indicate number of flex
   1326                                            counter entries corresponding to same
   1327                                            OAM session */
   1328     uint8 lm_count_profile;             /* LM count profile for this endpoint.
   1329                                            It will be 1 or 0 for selecting one
   1330                                            of the two OAM LM count profiles. */
   1331     uint8 mpls_exp;                     /* EXP on which BHH will be running */
   1332     bcm_oam_endpoint_t action_reference_id; /* Reference endpoint id whose actions
   1333                                            will be used on the new created
   1334                                            endpoint. Default value:
   1335                                            BCM_OAM_ENDPOINT_INVALID. API call
   1336                                            will set the parameter to
   1337                                            BCM_OAM_ENDPOINT_INVALID */
   1338     bcm_oam_profile_t acc_profile_id;   /* Used by accelerated endpoints. */
   1339     bcm_oam_endpoint_memory_type_t endpoint_memory_type; /* Type of default endpoint memory */
   1340 } bcm_oam_endpoint_info_t;
   1341 
   1342 /* OAM loss object. */
   1343 typedef struct bcm_oam_loss_s {
   1344     uint32 flags; 
   1345     int loss_id;                        /* Oam Loss ID. */
   1346     bcm_oam_endpoint_t id;              /* Endpoint ID of Local MEP. */
   1347     bcm_oam_endpoint_t remote_id;       /* Endpoint ID of Remote MEP. */
   1348     int period;                         /* Frequency of loss tx period in
   1349                                            milliseconds. */
   1350     int loss_threshold;                 /* Loss ratio (expressed in 100th of
   1351                                            percent) which if exceeded will
   1352                                            declare the period degraded with a
   1353                                            Loss Measurement packet exception.  A
   1354                                            value of -1 for Loss Measurement
   1355                                            exception on all received packets. */
   1356     int loss_nearend;                   /* Nearend loss (expressed in 100th of
   1357                                            percent). A value os -1 if not
   1358                                            available. */
   1359     int loss_farend;                    /* Farend loss (expressed in 100th of
   1360                                            percent). A value os -1 if not
   1361                                            available. */
   1362     uint32 loss_nearend_byte;           /* Nearend loss in bytes. */
   1363     uint32 loss_farend_byte;            /* Farend loss in bytes. */
   1364     uint32 loss_nearend_byte_upper;     /* Nearend loss in bytes (Upper 32 bits
   1365                                            in 64 bit byte count mode). */
   1366     uint32 loss_farend_byte_upper;      /* Farend loss in bytes (Upper 32 bits
   1367                                            in 64 bit byte count mode). */
   1368     int loss_nearend_max;               /* Nearend maximal loss. A value os -1
   1369                                            if not available. Reset when read. */
   1370     int loss_nearend_acc;               /* Nearend accumulated loss. A value os
   1371                                            -1 if not available. Reset when read. */
   1372     int loss_farend_max;                /* Farend maximal loss. A value os -1 if
   1373                                            not available. Reset when read. */
   1374     int loss_farend_acc;                /* Farend accumulated loss. A value os
   1375                                            -1 if not available. Reset when read. */
   1376     uint32 tx_nearend;                  /* Last local transmit frame count
   1377                                            recorded at time of LMR */
   1378     uint32 rx_nearend;                  /* Last local receive frame count
   1379                                            recorded at time of LMR */
   1380     uint32 tx_farend;                   /* Last peer transmit frame count
   1381                                            recorded at time of LMR */
   1382     uint32 rx_farend;                   /* Last peer receive frame count
   1383                                            recorded at time of LMR */
   1384     uint32 tx_nearend_byte;             /* Local transmit byte count */
   1385     uint32 rx_nearend_byte;             /* Local receive byte count */
   1386     uint32 tx_farend_byte;              /* Peer transmit byte count */
   1387     uint32 rx_farend_byte;              /* Peer receive byte count */
   1388     uint32 tx_nearend_byte_upper;       /* Local transmit byte count (Upper 32
   1389                                            bits in 64 bit byte count mode). */
   1390     uint32 rx_nearend_byte_upper;       /* Local receive byte count (Upper 32
   1391                                            bits in 64 bit byte count mode). */
   1392     uint32 tx_farend_byte_upper;        /* Peer transmit byte count (Upper 32
   1393                                            bits in 64 bit byte count mode). */
   1394     uint32 rx_farend_byte_upper;        /* Peer receive byte count (Upper 32
   1395                                            bits in 64 bit byte count mode). */
   1396     uint8 pkt_pri_bitmap;               /* Bitmap of packet priorities which
   1397                                            should be counted for LM.  A value of
   1398                                            zero is the equivalent of all ones. */
   1399     uint8 pkt_dp_bitmap;                /* Bitmap of packet color or DP which
   1400                                            should be counted for LM.  A value of
   1401                                            zero is the equivalent of all ones. */
   1402     uint8 pkt_pri;                      /* Egress marking for outgoing LM
   1403                                            messages */
   1404     bcm_cos_t int_pri;                  /* Egress queuing for outgoing LM
   1405                                            messages */
   1406     bcm_gport_t gport;                  /* For CEP only; may return a diverged
   1407                                            LP */
   1408     uint32 rx_oam_packets;              /* Count of OAM packets received by this
   1409                                            endpoint */
   1410     uint32 tx_oam_packets;              /* Count of OAM packets transmitted by
   1411                                            this endpoint */
   1412     bcm_mac_t peer_da_mac_address;      /* MAC DA in LMM injection in case peer
   1413                                            endpoint is not configured in
   1414                                            remote_id */
   1415     uint32 lm_counter_base_id[BCM_OAM_LM_COUNTER_MAX]; /* Base index of LM Counter group
   1416                                            (returned during endpoint create) of
   1417                                            the counter to be stamped or
   1418                                            incremented */
   1419     uint32 lm_counter_offset[BCM_OAM_LM_COUNTER_MAX]; /* LM Counter offset from the base */
   1420     int lm_counter_action[BCM_OAM_LM_COUNTER_MAX]; /* LM Counter action (type
   1421                                            bcm_oam_lm_counter_action_t) */
   1422     uint32 lm_counter_byte_offset[BCM_OAM_LM_COUNTER_MAX]; /* LM Counter byte offset for increment */
   1423     uint32 lm_counter_size;             /* Valid index count in LM Counter array */
   1424     uint32 pm_id;                       /* Performance measurement ID in BTE */
   1425 } bcm_oam_loss_t;
   1426 
   1427 /* OAM TLV object. */
   1428 typedef struct bcm_oam_tlv_s {
   1429     bcm_oam_tlv_pattern_type_t tlv_type; 
   1430     int tlv_length;                     /* Length of the value field */
   1431     uint32 four_byte_repeatable_pattern; /* used when Type = Data (3) */
   1432 } bcm_oam_tlv_t;
   1433 
   1434 /* OAM delay object. */
   1435 typedef struct bcm_oam_delay_s {
   1436     uint32 flags; 
   1437     int delay_id;                       /* Oam Delay ID. */
   1438     bcm_oam_endpoint_t id;              /* Endpoint ID of Local MEP. */
   1439     bcm_oam_endpoint_t remote_id;       /* Endpoint ID of Remote MEP. */
   1440     int period;                         /* Frequency of delay tx period in
   1441                                            milliseconds. Zero indicates single
   1442                                            shot, -1 indicates disabling delay
   1443                                            packets transmission */
   1444     bcm_time_spec_t delay_min;          /* Minimal recorded delay to remote
   1445                                            peer. Reset when read. */
   1446     bcm_time_spec_t delay_max;          /* Maximul recorded delay to remote
   1447                                            peer. Reset when read. */
   1448     bcm_time_spec_t delay;              /* Last recorded delay to remote peer. */
   1449     bcm_time_spec_t txf;                /* Time of transmit in forward
   1450                                            direction. */
   1451     bcm_time_spec_t rxf;                /* Time of reception in forward
   1452                                            direction. */
   1453     bcm_time_spec_t txb;                /* Time of transmit in backward
   1454                                            direction. */
   1455     bcm_time_spec_t rxb;                /* Time of reception in backward
   1456                                            direction. */
   1457     uint8 pkt_pri;                      /* Egress marking for outgoing DM
   1458                                            messages */
   1459     uint8 pkt_pri_bitmap;               /* Bitmap of packet priorities which
   1460                                            should be measured for DM. A value of
   1461                                            zero is the equivalent of all ones. */
   1462     bcm_cos_t int_pri;                  /* Egress queuing for outgoing DM
   1463                                            messages */
   1464     uint32 rx_oam_packets;              /* Count of OAM packets received by this
   1465                                            endpoint */
   1466     uint32 tx_oam_packets;              /* Count of OAM packets transmitted by
   1467                                            this endpoint */
   1468     bcm_oam_timestamp_format_t timestamp_format; /* OAM timestamp type */
   1469     bcm_mac_t peer_da_mac_address;      /* MAC DA in DMM injection in case peer
   1470                                            endpoint is not configured in
   1471                                            remote_id */
   1472     uint32 pm_id;                       /* Performance measurement ID in BTE */
   1473     uint32 dm_tx_update_lm_counter_base_id[BCM_OAM_LM_COUNTER_MAX]; /* The base index of the LM counter to
   1474                                            be updated by Tx DM packets */
   1475     uint32 dm_tx_update_lm_counter_offset[BCM_OAM_LM_COUNTER_MAX]; /* Offset to the Base LM counter Id to
   1476                                            be incremented by Tx DM packets */
   1477     uint32 dm_tx_update_lm_counter_byte_offset[BCM_OAM_LM_COUNTER_MAX]; /* Byte offset in the Tx DM packet from
   1478                                            which to increment the LM byte
   1479                                            counter */
   1480     uint8 dm_tx_update_lm_counter_size; /* Number of LM counters to be
   1481                                            incremented by Tx DM packets */
   1482     bcm_oam_tlv_t tlvs[BCM_OAM_MAX_NUM_TLVS_FOR_DM]; /* TLV contents of DM */
   1483 } bcm_oam_delay_t;
   1484 
   1485 /* OAM AIS (alarm indication signal) object. */
   1486 typedef struct bcm_oam_ais_s {
   1487     uint32 flags; 
   1488     int ais_id;                     /* OAM AIS ID. */
   1489     bcm_oam_endpoint_t id;          /* Endpoint ID of Local MEP. */
   1490     int period;                     /* Frequency of AIS tx period in
   1491                                        milliseconds. */
   1492     int level;                      /* MD level on outgoing frames. */
   1493     bcm_mac_t peer_da_mac_address;  /* MAC DA in AIS injection. */
   1494     uint8 pkt_pri;                  /* Egress marking for outgoing AIS messages. */
   1495     uint8 drop_eligible;            /* Drop Eligibility for AIS. */
   1496     bcm_vlan_t outer_vlan;          /* Outer vlan id for the AIS frame. */
   1497     uint8 outer_pkt_pri;            /* Outer vlan packet prio for the AIS frame. */
   1498     uint16 outer_tpid;              /* TPID of outer vlan for the AIS frame. */
   1499     bcm_vlan_t inner_vlan;          /* Inner vlan id for the AIS frame. */
   1500     uint8 inner_pkt_pri;            /* Inner vlan packet prio for the AIS frame. */
   1501     uint16 inner_tpid;              /* TPID of inner vlan for the AIS frame. */
   1502 } bcm_oam_ais_t;
   1503 
   1504 /* OAM TST TX object. */
   1505 typedef struct bcm_oam_tst_tx_s {
   1506     bcm_oam_endpoint_t endpoint_id; /* Endpoint ID of Local MEP. */
   1507     int gtf_id; 
   1508     uint32 flags; 
   1509     bcm_mac_t peer_da_mac_address;  /* MAC DA in TST injection. */
   1510     bcm_oam_tlv_t tlv; 
   1511 } bcm_oam_tst_tx_t;
   1512 
   1513 /* OAM TST RX object. */
   1514 typedef struct bcm_oam_tst_rx_s {
   1515     bcm_oam_endpoint_t endpoint_id; /* Endpoint ID of Local MEP. */
   1516     int ctf_id; 
   1517     uint32 flags; 
   1518     bcm_oam_tlv_t expected_tlv; 
   1519     uint64 rx_count; 
   1520     uint64 invalid_tlv_count;       /* Count of invalid packets received
   1521                                        (incorrect TLV) */
   1522     uint64 out_of_sequence;         /* Count of out of sequence packets */
   1523 } bcm_oam_tst_rx_t;
   1524 
   1525 /* OAM Signal Degradation/Signal Fault  object. */
   1526 typedef struct bcm_oam_sd_sf_detection_s {
   1527     bcm_oam_endpoint_t mep_id;          /* Endpoint ID of Local MEP. */
   1528     bcm_oam_endpoint_t rmep_id;         /* Endpoint ID of Remote MEP. */
   1529     uint16 sd_set_threshold;            /* threshold of signal degradation
   1530                                            indication */
   1531     uint16 sf_set_threshold;            /* threshold of signal fault indication */
   1532     uint16 sd_clear_threshold;          /* threshold of signal degradation clear */
   1533     uint16 sf_clear_threshold;          /* threshold of signal fault clear */
   1534     uint8 flags;                        /* flags use to set alert method,
   1535                                            suppress and others */
   1536     uint8 sd_indication;                /* signal degradation indication */
   1537     uint8 sf_indication;                /* signal fault indication */
   1538     uint16 sliding_window_length;       /* size of the sliding window (1-256) */
   1539     uint16 sliding_window_cnt[BCM_OAM_MAX_NUM_SLINDING_WINDOWS]; /* 256 counters of per-period packets
   1540                                            received */
   1541     uint16 sum_cnt;                     /* Sum of the sliding window packets
   1542                                            (read-only) */
   1543 } bcm_oam_sd_sf_detection_t;
   1544 
   1545 /* OAM Y.1711 alarm object. */
   1546 typedef struct bcm_oam_y_1711_alarm_s {
   1547     bcm_oam_endpoint_t mep_id;      /* Endpoint ID of Local MEP. */
   1548     bcm_oam_endpoint_t rmep_id;     /* Endpoint ID of Remote MEP. */
   1549     uint8 d_excess_threshold;       /* used for Y.1711 defects */
   1550     uint8 indicator_low_threshold;  /* Y.1711 indicator control low threshold */
   1551     uint8 indicator_high_threshold; /* Y.1711 indicator control high threshold */
   1552     uint8 flags;                    /* flags use to set alert mothod and others */
   1553     uint8 d_excess;                 /* excess detect */
   1554     uint8 d_mismatch;               /* mismatch detect */
   1555     uint8 d_mismerge;               /* mismerge detect */
   1556 } bcm_oam_y_1711_alarm_t;
   1557 
   1558 /* OAM loopback discovery record. */
   1559 typedef struct bcm_oam_loopback_discovery_record_s {
   1560     uint32 flags; 
   1561     bcm_oam_endpoint_t id;  /* Endpoint ID of discovered MEP/MIP. */
   1562     int ttl;                /* TTL value to used to discover MEP/MIP. */
   1563     uint16 name;            /* Discovered MEP ID */
   1564 } bcm_oam_loopback_discovery_record_t;
   1565 
   1566 /* OAM loopback object. */
   1567 typedef struct bcm_oam_loopback_s {
   1568     uint32 flags; 
   1569     bcm_oam_endpoint_t id;              /* Endpoint ID of Local MEP. */
   1570     bcm_oam_endpoint_t remote_id;       /* Endpoint ID of Remote MEP. */
   1571     int period;                         /* Frequency of loopback tx period in
   1572                                            milliseconds or pps (packets/sec)
   1573                                            depending on flags. Zero indicates
   1574                                            single shot, -1 indicates disabling
   1575                                            loopback packets transmission */
   1576     int ttl;                            /* TTL value to use in loopback message. */
   1577     bcm_oam_loopback_discovery_record_t discovered_me; /* Last ME discovered using loopback
   1578                                            discovery. */
   1579     uint32 rx_count;                    /* Count of received packets since
   1580                                            loopback add or last get. */
   1581     uint32 tx_count;                    /* Count of transmitted packets since
   1582                                            loopback add or last get. */
   1583     uint32 drop_count;                  /* Count of dropped packets since
   1584                                            loopback add or last get. */
   1585     uint32 unexpected_response;         /* Count of unexpected response packets
   1586                                            since loopback add or last get. */
   1587     uint32 out_of_sequence;             /* Count of out of sequence packets. */
   1588     uint32 local_mipid_missmatch;       /* Count of local mipid missmatch
   1589                                            packets since loopback add or last
   1590                                            get. */
   1591     uint32 remote_mipid_missmatch;      /* Count of remote mipid missmatch
   1592                                            packets since loopback add or last
   1593                                            get. */
   1594     uint32 invalid_target_mep_tlv;      /* Count of invalid target mep TLV
   1595                                            packets since loopback add or last
   1596                                            get. */
   1597     uint32 invalid_mep_tlv_subtype;     /* Count of invalid mep TLV subtype
   1598                                            packets since loopback add or last
   1599                                            get. */
   1600     uint32 invalid_tlv_offset;          /* Count of invalid TLV offset packets
   1601                                            since loopback add or last get. */
   1602     bcm_mac_t peer_da_mac_address;      /* MAC DA in loopback injection in case
   1603                                            remote_id is not specified */
   1604     int num_tlvs;                       /* Number of TLV */
   1605     int invalid_tlv_count;              /* Count of invalid packets received
   1606                                            (incorrect TLV) */
   1607     int ctf_id;                         /* Ctf id number */
   1608     int gtf_id;                         /* Gtf id number */
   1609     bcm_oam_tlv_t tlvs[BCM_OAM_MAX_NUM_TLVS_FOR_LBM]; /* TLV contents of LBM */
   1610     uint32 lb_tx_update_lm_counter_base_id[BCM_OAM_LM_COUNTER_MAX]; /* The base index of the LM counter to
   1611                                            be updated by Tx LB packets */
   1612     uint32 lb_tx_update_lm_counter_offset[BCM_OAM_LM_COUNTER_MAX]; /* Offset to the Base LM counter Id to
   1613                                            be incremented by Tx LB packets */
   1614     uint8 lb_tx_update_lm_counter_size; /* Number of LM counters to be
   1615                                            incremented by Tx LB packets */
   1616     bcm_cos_t int_pri;                  /* Optional: priority fields on ITMH
   1617                                            header */
   1618     uint8 pkt_pri;                      /* Optional: priority fields on outer
   1619                                            VLAN (PCP + DEI). -1 will ignore this
   1620                                            field */
   1621     uint8 inner_pkt_pri;                /* Optional: priority fields on inner
   1622                                            VLAN (PCP + DEI) , when applicable.
   1623                                            -1 will ignore this field */
   1624 } bcm_oam_loopback_t;
   1625 
   1626 /* OAM PSC object. */
   1627 typedef struct bcm_oam_psc_s {
   1628     uint32 flags; 
   1629     bcm_oam_endpoint_t id;          /* Endpoint ID of Local MEP. */
   1630     bcm_oam_endpoint_t remote_id;   /* Endpoint ID of Remote MEP. */
   1631     int version;                    /* Version number of message. */
   1632     int request;                    /* Request field. */
   1633     int pt;                         /* Protection type. */
   1634     uint8 fpath;                    /* The path reporting failure. */
   1635     uint8 path;                     /* The currently active path. */
   1636     int burst_rate;                 /* Burst interval in ms (suggested 3 ms). */
   1637     int slow_rate;                  /* Slow or normal interval in ms (suggested
   1638                                        5000 ms). */
   1639     int tlv_length;                 /* Length of optional TLV. */
   1640     uint8 tlv;                      /* Optional TLV(s) of tlv_length. */
   1641 } bcm_oam_psc_t;
   1642 
   1643 /* OAM PW Status object. */
   1644 typedef struct bcm_oam_pw_status_s {
   1645     uint32 flags; 
   1646     bcm_oam_endpoint_t id;          /* Endpoint ID of Local MEP. */
   1647     bcm_oam_endpoint_t remote_id;   /* Endpoint ID of Remote MEP. */
   1648     int burst_rate;                 /* Burst interval in ms. */
   1649     int refresh;                    /* Refresh timer is copied into message and
   1650                                        sets the local transmit interval in
   1651                                        seconds. */
   1652     int ack;                        /* Copied into A field. */
   1653     uint8 tlv_length;               /* Length of optional TLV. */
   1654     uint8 tlv;                      /* Optional TLV(s) of tlv_length. */
   1655 } bcm_oam_pw_status_t;
   1656 
   1657 /* OAM CSF (alarm indication signal) object. */
   1658 typedef struct bcm_oam_csf_s {
   1659     uint32 flags;                       /* CSF flags. */
   1660     uint32 type;                        /* CSF Type value in PDU. */
   1661     bcm_oam_endpoint_t id;              /* Endpoint ID of Local MEP. */
   1662     int period;                         /* CSF Tx period in milliseconds.
   1663                                            Supported values are 1000 and 60000 */
   1664     uint8 pkt_pri;                      /* Egress marking for outgoing CSF
   1665                                            messages. */
   1666     bcm_cos_t int_pri;                  /* Egress queuing for outgoing CSF
   1667                                            messages */
   1668     uint32 csf_tx_update_lm_counter_base_id[BCM_OAM_LM_COUNTER_MAX]; /* The base index of the LM counter to
   1669                                            be updated by Tx CSF packets */
   1670     uint32 csf_tx_update_lm_counter_offset[BCM_OAM_LM_COUNTER_MAX]; /* Offset to the Base LM counter Id to
   1671                                            be incremented by Tx CSF packets */
   1672     uint8 csf_tx_update_lm_counter_size; /* Number of LM counters to be
   1673                                            incremented by Tx CSF packets */
   1674 } bcm_oam_csf_t;
   1675 
   1676 typedef struct bcm_oam_endpoint_action_s {
   1677     uint32 flags; 
   1678     SHR_BITDCL opcode_bmp[_SHR_BITDCLSIZE(256)]; 
   1679     SHR_BITDCL opcode_actions[_SHR_BITDCLSIZE(bcmOAMActionCount)]; 
   1680     bcm_gport_t destination;            /* For remote handling. Can also be drop */
   1681     bcm_gport_t destination2;           /* Another destination when required for
   1682                                            example: MIP requires 2 destination
   1683                                            traps, one for each direction */
   1684 } bcm_oam_endpoint_action_t;
   1685 
   1686 #define BCM_OAM_ACTION_SET(_action, _action_type)  SHR_BITSET(((_action).opcode_actions), (_action_type)) 
   1687 
   1688 #define BCM_OAM_ACTION_GET(_action, _action_type)  SHR_BITGET(((_action).opcode_actions), (_action_type)) 
   1689 
   1690 #define BCM_OAM_ACTION_CLEAR(_action, _action_type)  SHR_BITCLR(((_action).opcode_actions), (_action_type)) 
   1691 
   1692 #define BCM_OAM_ACTION_CLEAR_ALL(_action)  SHR_BITCLR_RANGE(((_action).opcode_actions), 0, bcmOAMActionCount) 
   1693 
   1694 #define BCM_OAM_OPCODE_SET(_action, _opcode)  SHR_BITSET(((_action).opcode_bmp), (_opcode)) 
   1695 
   1696 #define BCM_OAM_OPCODE_GET(_action, _opcode)  SHR_BITGET(((_action).opcode_bmp), (_opcode)) 
   1697 
   1698 #define BCM_OAM_OPCODE_CLEAR(_action, _opcode)  SHR_BITCLR(((_action).opcode_bmp), (_opcode)) 
   1699 
   1700 #define BCM_OAM_OPCODE_CLEAR_ALL(_action)  SHR_BITCLR_RANGE(((_action).opcode_bmp), 0, 256) 
   1701 
   1702 #define BCM_OAM_LOOKUP_TYPE_SET(_type, _lookup_type)  SHR_BITSET(((_type).tbits), _lookup_type) 
   1703 
   1704 #define BCM_OAM_LOOKUP_TYPE_GET(_type, _lookup_type)  SHR_BITGET(((_type).tbits), _lookup_type) 
   1705 
   1706 #define BCM_OAM_LOOKUP_TYPE_CLEAR(_type, _lookup_type)  SHR_BITCLR(((_type).tbits), _lookup_type) 
   1707 
   1708 #define BCM_OAM_LOOKUP_TYPE_CLEAR_ALL(_type)  SHR_BITCLR_RANGE(((_type).tbits), 0, bcmOamLookupTypeCount) 
   1709 
   1710 #define BCM_OAM_CONDITION_SET(_condition, _drop)  SHR_BITSET(((_condition).cbits), _drop) 
   1711 
   1712 #define BCM_OAM_CONDITION_GET(_condition, _drop)  SHR_BITGET(((_condition).cbits), _drop) 
   1713 
   1714 #define BCM_OAM_CONDITION_CLEAR(_condition, _drop)  SHR_BITCLR(((_condition).cbits), _drop) 
   1715 
   1716 #define BCM_OAM_CONDITION_CLEAR_ALL(_condition)  SHR_BITCLR_RANGE(((_condition).cbits), 0, bcmOamConditionCount) 
   1717 
   1718 /* Callback function type for OAM group traversal */
   1719 typedef int (*bcm_oam_group_traverse_cb)(
   1720     int unit, 
   1721     bcm_oam_group_info_t *group_info, 
   1722     void *user_data);
   1723 
   1724 /* Callback function type for OAM endpoint traversal */
   1725 typedef int (*bcm_oam_endpoint_traverse_cb)(
   1726     int unit, 
   1727     bcm_oam_endpoint_info_t *endpoint_info, 
   1728     void *user_data);
   1729 
   1730 /* Callback function type for OAM event handling */
   1731 typedef int (*bcm_oam_event_cb)(
   1732     int unit, 
   1733     uint32 flags, 
   1734     bcm_oam_event_type_t event_type, 
   1735     bcm_oam_group_t group, 
   1736     bcm_oam_endpoint_t endpoint, 
   1737     void *user_data);
   1738 
   1739 typedef struct bcm_oam_performance_event_data_s {
   1740     uint32 delta_FCB;   /* TXFcb - RXFcb. Used for performance events of type
   1741                            bcmOAMEventEndpointLMStatistics. */
   1742     uint32 delta_FCf;   /* TXFcf - RXFcb. Used for performance events of type
   1743                            bcmOAMEventEndpointLMStatistics. */
   1744     uint64 last_delay;  /* Used for performance events of type
   1745                            bcmOAMEventEndpointDMStatistics. */
   1746 } bcm_oam_performance_event_data_t;
   1747 
   1748 /* Initialize an performance event data structure */
   1749 extern void bcm_oam_performance_event_data_t_init(
   1750     bcm_oam_performance_event_data_t *performance_event_data_ptr);
   1751 
   1752 /* Callback function type for OAM performance event handling */
   1753 typedef int (*bcm_oam_performance_event_cb)(
   1754     int unit, 
   1755     bcm_oam_event_type_t event_type, 
   1756     bcm_oam_group_t group, 
   1757     bcm_oam_endpoint_t endpoint, 
   1758     bcm_oam_performance_event_data_t *event_data, 
   1759     void *user_data);
   1760 
   1761 #ifndef BCM_HIDE_DISPATCHABLE
   1762 
   1763 /* Initialize the OAM subsystem */
   1764 extern int bcm_oam_init(
   1765     int unit);
   1766 
   1767 /* Shut down the OAM subsystem */
   1768 extern int bcm_oam_detach(
   1769     int unit);
   1770 
   1771 #endif /* BCM_HIDE_DISPATCHABLE */
   1772 
   1773 /* Initialize an OAM group info structure */
   1774 extern void bcm_oam_group_info_t_init(
   1775     bcm_oam_group_info_t *group_info);
   1776 
   1777 #ifndef BCM_HIDE_DISPATCHABLE
   1778 
   1779 /* Create or replace an OAM group object */
   1780 extern int bcm_oam_group_create(
   1781     int unit, 
   1782     bcm_oam_group_info_t *group_info);
   1783 
   1784 /* Get an OAM group object */
   1785 extern int bcm_oam_group_get(
   1786     int unit, 
   1787     bcm_oam_group_t group, 
   1788     bcm_oam_group_info_t *group_info);
   1789 
   1790 /* 
   1791  * Destroy an OAM group object.  All OAM endpoints associated with the
   1792  * group will also be destroyed.
   1793  */
   1794 extern int bcm_oam_group_destroy(
   1795     int unit, 
   1796     bcm_oam_group_t group);
   1797 
   1798 /* 
   1799  * Destroy all OAM group objects.  All OAM endpoints will also be
   1800  * destroyed.
   1801  */
   1802 extern int bcm_oam_group_destroy_all(
   1803     int unit);
   1804 
   1805 /* 
   1806  * Traverse the entire set of OAM groups, calling a specified callback
   1807  * for each one
   1808  */
   1809 extern int bcm_oam_group_traverse(
   1810     int unit, 
   1811     bcm_oam_group_traverse_cb cb, 
   1812     void *user_data);
   1813 
   1814 #endif /* BCM_HIDE_DISPATCHABLE */
   1815 
   1816 /* Initialize an OAM endpoint info structure */
   1817 extern void bcm_oam_endpoint_info_t_init(
   1818     bcm_oam_endpoint_info_t *endpoint_info);
   1819 
   1820 #ifndef BCM_HIDE_DISPATCHABLE
   1821 
   1822 /* Create or replace an OAM endpoint object */
   1823 extern int bcm_oam_endpoint_create(
   1824     int unit, 
   1825     bcm_oam_endpoint_info_t *endpoint_info);
   1826 
   1827 /* Get an OAM endpoint object */
   1828 extern int bcm_oam_endpoint_get(
   1829     int unit, 
   1830     bcm_oam_endpoint_t endpoint, 
   1831     bcm_oam_endpoint_info_t *endpoint_info);
   1832 
   1833 /* Destroy an OAM endpoint object */
   1834 extern int bcm_oam_endpoint_destroy(
   1835     int unit, 
   1836     bcm_oam_endpoint_t endpoint);
   1837 
   1838 /* Destroy all OAM endpoint objects associated with a given OAM group */
   1839 extern int bcm_oam_endpoint_destroy_all(
   1840     int unit, 
   1841     bcm_oam_group_t group);
   1842 
   1843 /* 
   1844  * Traverse the set of OAM endpoints associated with the specified group,
   1845  * calling a specified callback for each one
   1846  */
   1847 extern int bcm_oam_endpoint_traverse(
   1848     int unit, 
   1849     bcm_oam_group_t group, 
   1850     bcm_oam_endpoint_traverse_cb cb, 
   1851     void *user_data);
   1852 
   1853 #endif /* BCM_HIDE_DISPATCHABLE */
   1854 
   1855 /* Initialize an OAM loss structure */
   1856 extern void bcm_oam_loss_t_init(
   1857     bcm_oam_loss_t *loss_ptr);
   1858 
   1859 #ifndef BCM_HIDE_DISPATCHABLE
   1860 
   1861 /* Add an OAM loss object */
   1862 extern int bcm_oam_loss_add(
   1863     int unit, 
   1864     bcm_oam_loss_t *loss_ptr);
   1865 
   1866 /* Get an OAM loss object */
   1867 extern int bcm_oam_loss_get(
   1868     int unit, 
   1869     bcm_oam_loss_t *loss_ptr);
   1870 
   1871 /* Delete an OAM loss object */
   1872 extern int bcm_oam_loss_delete(
   1873     int unit, 
   1874     bcm_oam_loss_t *loss_ptr);
   1875 
   1876 #endif /* BCM_HIDE_DISPATCHABLE */
   1877 
   1878 /* Initialize an OAM delay structure */
   1879 extern void bcm_oam_delay_t_init(
   1880     bcm_oam_delay_t *delay_ptr);
   1881 
   1882 #ifndef BCM_HIDE_DISPATCHABLE
   1883 
   1884 /* Add an OAM delay object */
   1885 extern int bcm_oam_delay_add(
   1886     int unit, 
   1887     bcm_oam_delay_t *delay_ptr);
   1888 
   1889 /* Get an OAM delay object */
   1890 extern int bcm_oam_delay_get(
   1891     int unit, 
   1892     bcm_oam_delay_t *delay_ptr);
   1893 
   1894 /* Delete an OAM delay object */
   1895 extern int bcm_oam_delay_delete(
   1896     int unit, 
   1897     bcm_oam_delay_t *delay_ptr);
   1898 
   1899 #endif /* BCM_HIDE_DISPATCHABLE */
   1900 
   1901 /* Initialize an OAM AIS (alarm indication signal) structure */
   1902 extern void bcm_oam_ais_t_init(
   1903     bcm_oam_ais_t *ais_ptr);
   1904 
   1905 /* Initialize an OAM OPCODE ACTION structure */
   1906 extern void bcm_oam_endpoint_action_t_init(
   1907     bcm_oam_endpoint_action_t *action_ptr);
   1908 
   1909 #ifndef BCM_HIDE_DISPATCHABLE
   1910 
   1911 /* Add an OAM AIS (alarm indication signal) object */
   1912 extern int bcm_oam_ais_add(
   1913     int unit, 
   1914     bcm_oam_ais_t *ais_ptr);
   1915 
   1916 /* Get an OAM AIS (alarm indication signal) object */
   1917 extern int bcm_oam_ais_get(
   1918     int unit, 
   1919     bcm_oam_ais_t *ais_ptr);
   1920 
   1921 /* Delete an OAM AIS (alarm indication signal) object */
   1922 extern int bcm_oam_ais_delete(
   1923     int unit, 
   1924     bcm_oam_ais_t *ais_ptr);
   1925 
   1926 #endif /* BCM_HIDE_DISPATCHABLE */
   1927 
   1928 /* Initialize a TST RX structure */
   1929 extern void bcm_oam_tst_rx_t_init(
   1930     bcm_oam_tst_rx_t *tst_rx_info);
   1931 
   1932 #ifndef BCM_HIDE_DISPATCHABLE
   1933 
   1934 /* Add an OAM TST RX object */
   1935 extern int bcm_oam_tst_rx_add(
   1936     int unit, 
   1937     bcm_oam_tst_rx_t *tst_ptr);
   1938 
   1939 /* Get an OAM TST RX object */
   1940 extern int bcm_oam_tst_rx_get(
   1941     int unit, 
   1942     bcm_oam_tst_rx_t *tst_ptr);
   1943 
   1944 /* Delete an OAM TST RX object */
   1945 extern int bcm_oam_tst_rx_delete(
   1946     int unit, 
   1947     bcm_oam_tst_rx_t *tst_ptr);
   1948 
   1949 #endif /* BCM_HIDE_DISPATCHABLE */
   1950 
   1951 /* Initialize a TST TX structure */
   1952 extern void bcm_oam_tst_tx_t_init(
   1953     bcm_oam_tst_tx_t *tst_tx_info);
   1954 
   1955 #ifndef BCM_HIDE_DISPATCHABLE
   1956 
   1957 /* Add an OAM TST TX object */
   1958 extern int bcm_oam_tst_tx_add(
   1959     int unit, 
   1960     bcm_oam_tst_tx_t *tst_ptr);
   1961 
   1962 /* Get an OAM TST TX object */
   1963 extern int bcm_oam_tst_tx_get(
   1964     int unit, 
   1965     bcm_oam_tst_tx_t *tst_ptr);
   1966 
   1967 /* Delete an OAM TST TX object */
   1968 extern int bcm_oam_tst_tx_delete(
   1969     int unit, 
   1970     bcm_oam_tst_tx_t *tst_ptr);
   1971 
   1972 #endif /* BCM_HIDE_DISPATCHABLE */
   1973 
   1974 /* Initialize a signal degradation/ signal fault detection structure */
   1975 extern void bcm_oam_sd_sf_detection_t_init(
   1976     bcm_oam_sd_sf_detection_t *sd_sf_ptr);
   1977 
   1978 #ifndef BCM_HIDE_DISPATCHABLE
   1979 
   1980 /* Add an OAM signal degradation/ signal fault object */
   1981 extern int bcm_oam_sd_sf_detection_add(
   1982     int unit, 
   1983     bcm_oam_sd_sf_detection_t *sd_sf_ptr);
   1984 
   1985 /* Get an OAM signal degradation/ signal fault object */
   1986 extern int bcm_oam_sd_sf_detection_get(
   1987     int unit, 
   1988     bcm_oam_sd_sf_detection_t *sd_sf_ptr);
   1989 
   1990 /* Delete an OAM signal degradation/ signal fault object */
   1991 extern int bcm_oam_sd_sf_detection_delete(
   1992     int unit, 
   1993     bcm_oam_sd_sf_detection_t *sd_sf_ptr);
   1994 
   1995 #endif /* BCM_HIDE_DISPATCHABLE */
   1996 
   1997 /* Initialize a Y.1711 Alarm structure */
   1998 extern void bcm_oam_y_1711_alarm_t_init(
   1999     bcm_oam_y_1711_alarm_t *alarm_ptr);
   2000 
   2001 #ifndef BCM_HIDE_DISPATCHABLE
   2002 
   2003 /* Add an OAM Y.1711 alarm  object */
   2004 extern int bcm_oam_y_1711_alarm_add(
   2005     int unit, 
   2006     bcm_oam_y_1711_alarm_t *alarm_ptr);
   2007 
   2008 /* Get an OAM Y.1711 alarm object */
   2009 extern int bcm_oam_y_1711_alarm_get(
   2010     int unit, 
   2011     bcm_oam_y_1711_alarm_t *alarm_ptr);
   2012 
   2013 /* Delete an OAM Y.1711 alarm object */
   2014 extern int bcm_oam_y_1711_alarm_delete(
   2015     int unit, 
   2016     bcm_oam_y_1711_alarm_t *alarm_ptr);
   2017 
   2018 #endif /* BCM_HIDE_DISPATCHABLE */
   2019 
   2020 /* Initialize an OAM PSC structure */
   2021 extern void bcm_oam_psc_t_init(
   2022     bcm_oam_psc_t *psc_ptr);
   2023 
   2024 #ifndef BCM_HIDE_DISPATCHABLE
   2025 
   2026 /* Add an OAM PSC object */
   2027 extern int bcm_oam_psc_add(
   2028     int unit, 
   2029     bcm_oam_psc_t *psc_ptr);
   2030 
   2031 /* Get an OAM PSC object */
   2032 extern int bcm_oam_psc_get(
   2033     int unit, 
   2034     bcm_oam_psc_t *psc_ptr);
   2035 
   2036 /* Delete an OAM PSC object */
   2037 extern int bcm_oam_psc_delete(
   2038     int unit, 
   2039     bcm_oam_psc_t *psc_ptr);
   2040 
   2041 #endif /* BCM_HIDE_DISPATCHABLE */
   2042 
   2043 /* Initialize an OAM PW Status structure */
   2044 extern void bcm_oam_pw_status_t_init(
   2045     bcm_oam_pw_status_t *pw_status_ptr);
   2046 
   2047 #ifndef BCM_HIDE_DISPATCHABLE
   2048 
   2049 /* Add an OAM PW Status object */
   2050 extern int bcm_oam_pw_status_add(
   2051     int unit, 
   2052     bcm_oam_pw_status_t *pw_status_ptr);
   2053 
   2054 /* Get an OAM PW Status object */
   2055 extern int bcm_oam_pw_status_get(
   2056     int unit, 
   2057     bcm_oam_pw_status_t *pw_status_ptr);
   2058 
   2059 /* Delete an OAM PW Status object */
   2060 extern int bcm_oam_pw_status_delete(
   2061     int unit, 
   2062     bcm_oam_pw_status_t *pw_status_ptr);
   2063 
   2064 #endif /* BCM_HIDE_DISPATCHABLE */
   2065 
   2066 /* Initialize an OAM csf structure */
   2067 extern void bcm_oam_csf_t_init(
   2068     bcm_oam_csf_t *csf_ptr);
   2069 
   2070 #ifndef BCM_HIDE_DISPATCHABLE
   2071 
   2072 /* Add an OAM CSF (Client Signal Failure) object */
   2073 extern int bcm_oam_csf_add(
   2074     int unit, 
   2075     bcm_oam_csf_t *csf_ptr);
   2076 
   2077 /* Get an OAM CSF (Client Signal Failure) object */
   2078 extern int bcm_oam_csf_get(
   2079     int unit, 
   2080     bcm_oam_csf_t *csf_ptr);
   2081 
   2082 /* Delete an OAM CSF (alarm indication signal) object */
   2083 extern int bcm_oam_csf_delete(
   2084     int unit, 
   2085     bcm_oam_csf_t *csf_ptr);
   2086 
   2087 /* Register a callback for handling OAM events */
   2088 extern int bcm_oam_event_register(
   2089     int unit, 
   2090     bcm_oam_event_types_t event_types, 
   2091     bcm_oam_event_cb cb, 
   2092     void *user_data);
   2093 
   2094 /* Unregister a callback for handling OAM events */
   2095 extern int bcm_oam_event_unregister(
   2096     int unit, 
   2097     bcm_oam_event_types_t event_types, 
   2098     bcm_oam_event_cb cb);
   2099 
   2100 /* Register a callback for handling OAM events */
   2101 extern int bcm_oam_performance_event_register(
   2102     int unit, 
   2103     bcm_oam_event_types_t event_types, 
   2104     bcm_oam_performance_event_cb cb, 
   2105     void *user_data);
   2106 
   2107 /* Unregister a callback for handling OAM performance events */
   2108 extern int bcm_oam_performance_event_unregister(
   2109     int unit, 
   2110     bcm_oam_event_types_t event_types, 
   2111     bcm_oam_performance_event_cb cb);
   2112 
   2113 #endif /* BCM_HIDE_DISPATCHABLE */
   2114 
   2115 /* Initialize an OAM loopback structure */
   2116 extern void bcm_oam_loopback_t_init(
   2117     bcm_oam_loopback_t *loopback_ptr);
   2118 
   2119 #ifndef BCM_HIDE_DISPATCHABLE
   2120 
   2121 /* Add an OAM loopback object */
   2122 extern int bcm_oam_loopback_add(
   2123     int unit, 
   2124     bcm_oam_loopback_t *loopback_ptr);
   2125 
   2126 /* Get an OAM loopback object */
   2127 extern int bcm_oam_loopback_get(
   2128     int unit, 
   2129     bcm_oam_loopback_t *loopback_ptr);
   2130 
   2131 /* Delete an OAM loopback object */
   2132 extern int bcm_oam_loopback_delete(
   2133     int unit, 
   2134     bcm_oam_loopback_t *loopback_ptr);
   2135 
   2136 /* Set OAM endpoint opcode actions */
   2137 extern int bcm_oam_endpoint_action_set(
   2138     int unit, 
   2139     bcm_oam_endpoint_t id, 
   2140     bcm_oam_endpoint_action_t *action);
   2141 
   2142 /* Configure device-wide OAM controls */
   2143 extern int bcm_oam_control_set(
   2144     int unit, 
   2145     bcm_oam_control_type_t type, 
   2146     uint64 arg);
   2147 
   2148 /* Query device-wide OAM controls */
   2149 extern int bcm_oam_control_get(
   2150     int unit, 
   2151     bcm_oam_control_type_t type, 
   2152     uint64 *arg);
   2153 
   2154 /* Set Ethernet Y1731 opcode profile mapping. */
   2155 extern int bcm_oam_opcode_map_set(
   2156     int unit, 
   2157     int opcode, 
   2158     int profile);
   2159 
   2160 /* Get Ethernet Y1731 opcode profile mapping */
   2161 extern int bcm_oam_opcode_map_get(
   2162     int unit, 
   2163     int opcode, 
   2164     int *profile);
   2165 
   2166 /* Enable/Disable a drop condition for an OAM lookup type */
   2167 extern int bcm_oam_lookup_enable_set(
   2168     int unit, 
   2169     bcm_oam_lookup_type_t type, 
   2170     bcm_oam_condition_t condition, 
   2171     int enable);
   2172 
   2173 /* Enable/Disable drop conditions for OAM lookup types */
   2174 extern int bcm_oam_lookup_enable_multi_set(
   2175     int unit, 
   2176     bcm_oam_lookup_types_t types, 
   2177     bcm_oam_conditions_t conditions, 
   2178     int enable);
   2179 
   2180 /* Get the drop condition that is ignored for an OAM lookup type */
   2181 extern int bcm_oam_lookup_enable_get(
   2182     int unit, 
   2183     bcm_oam_lookup_type_t type, 
   2184     bcm_oam_conditions_t *condition);
   2185 
   2186 #endif /* BCM_HIDE_DISPATCHABLE */
   2187 
   2188 /* 
   2189  * OAM report mode types. To be used as the arg parameter when calling
   2190  * bcm_oam_control_set/get() with the type parameter set to
   2191  * bcmOamControlReportMode.
   2192  */
   2193 typedef enum bcm_oam_report_mode_type_e {
   2194     bcmOamReportModeTypeNormal = 0,     /* Default report mode. */
   2195     bcmOamReportModeTypeCompact = 1, 
   2196     bcmOamReportModeTypeRaw = 2,        /* Report mode events will be disabled
   2197                                            when report mode is set to raw. */
   2198     bcmOamReportModeTypeCount = 3 
   2199 } bcm_oam_report_mode_type_t;
   2200 
   2201 #define BCM_OAM_MAX_PM_PROFILE_BIN_EDGES    7          /* Maximum number of bin
   2202                                                           edges in each PM
   2203                                                           profile */
   2204 
   2205 /* PM profile creation flags */
   2206 #define BCM_OAM_PM_PROFILE_REPLACE  0x0001     /* Replace an existing OAM PM
   2207                                                   profile */
   2208 #define BCM_OAM_PM_PROFILE_WITH_ID  0x0002     /* Use the specified PM profile
   2209                                                   ID */
   2210 
   2211 /* OAM PM profile ID type */
   2212 typedef int bcm_oam_pm_profile_t;
   2213 
   2214 /* PM profile info structure */
   2215 typedef struct bcm_oam_pm_profile_info_s {
   2216     bcm_oam_pm_profile_t id; 
   2217     uint32 flags; 
   2218     uint32 bin_edges[BCM_OAM_MAX_PM_PROFILE_BIN_EDGES]; /* Bin edges */
   2219 } bcm_oam_pm_profile_info_t;
   2220 
   2221 #ifndef BCM_HIDE_DISPATCHABLE
   2222 
   2223 /* Create PM profile. */
   2224 extern int bcm_oam_pm_profile_create(
   2225     int unit, 
   2226     bcm_oam_pm_profile_info_t *profile_info);
   2227 
   2228 /* Delete PM profile. */
   2229 extern int bcm_oam_pm_profile_delete(
   2230     int unit, 
   2231     bcm_oam_pm_profile_t profile_id);
   2232 
   2233 /* Delete all the PM profiles */
   2234 extern int bcm_oam_pm_profile_delete_all(
   2235     int unit);
   2236 
   2237 /* Get PM profile. */
   2238 extern int bcm_oam_pm_profile_get(
   2239     int unit, 
   2240     bcm_oam_pm_profile_info_t *profile_info);
   2241 
   2242 /* Attach a PM profile to an endpoint. */
   2243 extern int bcm_oam_pm_profile_attach(
   2244     int unit, 
   2245     bcm_oam_endpoint_t endpoint_id, 
   2246     int profile_id);
   2247 
   2248 /* Detach a PM profile from an endpoint. */
   2249 extern int bcm_oam_pm_profile_detach(
   2250     int unit, 
   2251     bcm_oam_endpoint_t endpoint_id, 
   2252     int profile_id);
   2253 
   2254 /* Get the PM profile attached to this endpoint. */
   2255 extern int bcm_oam_pm_profile_attach_get(
   2256     int unit, 
   2257     bcm_oam_endpoint_t endpoint_id, 
   2258     int *profile_id);
   2259 
   2260 #endif /* BCM_HIDE_DISPATCHABLE */
   2261 
   2262 /* Callback function type for PM profiles traversal */
   2263 typedef int (*bcm_oam_pm_profile_traverse_cb)(
   2264     int unit, 
   2265     bcm_oam_pm_profile_info_t *profile_info, 
   2266     void *user_data);
   2267 
   2268 #ifndef BCM_HIDE_DISPATCHABLE
   2269 
   2270 /* Traverse the list of pm profiles using the callback function */
   2271 extern int bcm_oam_pm_profile_traverse(
   2272     int unit, 
   2273     bcm_oam_pm_profile_traverse_cb cb, 
   2274     void *user_data);
   2275 
   2276 #endif /* BCM_HIDE_DISPATCHABLE */
   2277 
   2278 /* PM stats structure */
   2279 typedef struct bcm_oam_pm_stats_s {
   2280     uint32 far_loss_min;                /* Minimum Frame loss at far-end */
   2281     uint32 far_tx_min;                  /* Minimum Frame transmitted at far-end */
   2282     uint32 far_loss_max;                /* Maximum Frame loss at far-end */
   2283     uint32 far_tx_max;                  /* Maximum Frame transmitted at far-end */
   2284     uint32 far_loss;                    /* Total far loss at far-end */
   2285     uint32 near_loss_min;               /* Minimum Frame loss at near-end */
   2286     uint32 near_tx_min;                 /* Minimum Frame transmitted at near-end */
   2287     uint32 near_loss_max;               /* Maximum Frame loss at near-end */
   2288     uint32 near_tx_max;                 /* Maximum Frame transmitted at near-end */
   2289     uint32 near_loss;                   /* Total near loss at near-end */
   2290     uint32 lm_tx_count;                 /* Count of LM packets transmitted from
   2291                                            local node during sampling interval */
   2292     uint32 DM_min;                      /* Minimum Frame delay */
   2293     uint32 DM_max;                      /* Maximum Frame delay */
   2294     uint32 DM_avg;                      /* Frame delay */
   2295     uint32 dm_tx_count;                 /* Count of DM packets transmitted from
   2296                                            local node during sampling interval */
   2297     uint8 profile_id;                   /* Profile number associated with this
   2298                                            session to measure the DM frames */
   2299     uint32 bin_counters[BCM_OAM_MAX_PM_PROFILE_BIN_EDGES+1]; /* Bins Count of associated profile */
   2300     uint32 lm_rx_count;                 /* Count of LM packets received in local
   2301                                            node during sampling interval */
   2302     uint32 dm_rx_count;                 /* Count of DM packets received in local
   2303                                            node during sampling interval */
   2304     uint32 far_total_tx_pkt_count;      /* Total Tx data packets at far-end */
   2305     uint32 near_total_tx_pkt_count;     /* Total Tx data packets at near-end */
   2306     uint32 flags;                       /* Flags related to PM processed stats */
   2307 } bcm_oam_pm_stats_t;
   2308 
   2309 #ifndef BCM_HIDE_DISPATCHABLE
   2310 
   2311 /* Get PM stats for a given endpoint. */
   2312 extern int bcm_oam_pm_stats_get(
   2313     int unit, 
   2314     bcm_oam_endpoint_t endpoint_id, 
   2315     bcm_oam_pm_stats_t *stats_ptr);
   2316 
   2317 #endif /* BCM_HIDE_DISPATCHABLE */
   2318 
   2319 #define BCM_OAM_PM_RAW_DATA_MAX_SAMPLES 10         /* Maximum number of samples
   2320                                                       in each buffer in Raw
   2321                                                       sampling mode */
   2322 
   2323 /* PM raw counters structure. */
   2324 typedef struct bcm_oam_pm_raw_counter_s {
   2325     uint32 tx_fcf;  /* Count of packets transmitted by local node */
   2326     uint32 rx_fcf;  /* Count of packets received by remote node */
   2327     uint32 tx_fcb;  /* Count of packets transmitted by remote node */
   2328     uint32 rx_fcb;  /* Count of packets received by local node */
   2329 } bcm_oam_pm_raw_counter_t;
   2330 
   2331 /* PM raw timestamp structure. */
   2332 typedef struct bcm_oam_pm_raw_timestamp_s {
   2333     uint32 tx_tsf_secs;     /* Time stamp upper of DM packets transmitted by
   2334                                local node */
   2335     uint32 tx_tsf_nsecs;    /* Time stamp lower of DM packets transmitted by
   2336                                local node */
   2337     uint32 rx_tsf_secs;     /* Time stamp upper of DM packets received by remote
   2338                                node */
   2339     uint32 rx_tsf_nsecs;    /* Time stamp lower of DM packets received by remote
   2340                                node */
   2341     uint32 tx_tsb_secs;     /* Time stamp upper of DM packets transmitted by
   2342                                remote node */
   2343     uint32 tx_tsb_nsecs;    /* Time stamp lower of DM packets transmitted by
   2344                                remote node */
   2345     uint32 rx_tsb_secs;     /* Time stamp upper of DM packets received by local
   2346                                node */
   2347     uint32 rx_tsb_nsecs;    /* Time stamp lower of DM packets received by local
   2348                                node */
   2349 } bcm_oam_pm_raw_timestamp_t;
   2350 
   2351 /* PM raw samples structure. */
   2352 typedef struct bcm_oam_pm_raw_samples_s {
   2353     int pm_id;                          /* Performance measurement ID in BTE */
   2354     uint32 lm_count;                    /* Number of LM samples collected as
   2355                                            part of this buffer */
   2356     uint32 dm_count;                    /* Number of DM samples collected as
   2357                                            part of this buffer */
   2358     bcm_oam_pm_raw_counter_t raw_counter[BCM_OAM_PM_RAW_DATA_MAX_SAMPLES]; /* LM counters collected as part of this
   2359                                            buffer */
   2360     bcm_oam_pm_raw_timestamp_t raw_timestamp[BCM_OAM_PM_RAW_DATA_MAX_SAMPLES]; /* DM Timestamps collected as part of
   2361                                            this buffer */
   2362 } bcm_oam_pm_raw_samples_t;
   2363 
   2364 #define BCM_OAM_MAX_PM_ENDPOINTS    256        /* Maximum number of endpoints
   2365                                                   allowed in Raw sampling mode */
   2366 
   2367 /* PM raw buffer structure. */
   2368 typedef struct bcm_oam_pm_raw_buffer_s {
   2369     uint32 seq_num;                     /* Seq No. of the data buffer */
   2370     bcm_oam_pm_raw_samples_t raw_sample[BCM_OAM_MAX_PM_ENDPOINTS]; /* Raw data buffer */
   2371 } bcm_oam_pm_raw_buffer_t;
   2372 
   2373 #define BCM_OAM_MAX_PM_BUFFERS  8          /* Maximum number of buffers allowed
   2374                                               in Raw sampling mode */
   2375 
   2376 /* PM raw data structure. */
   2377 typedef struct bcm_oam_pm_raw_data_s {
   2378     uint32 pm_endpoint_count;           /* Active PM endpoints configured */
   2379     uint8 read_index;                   /* Application read index */
   2380     uint8 write_index;                  /* BTE write index */
   2381     bcm_oam_pm_raw_buffer_t raw_buffer[BCM_OAM_MAX_PM_BUFFERS]; /* Raw data buffer */
   2382 } bcm_oam_pm_raw_data_t;
   2383 
   2384 /* Callback function type for OAM event handling */
   2385 typedef int (*bcm_oam_pm_event_cb)(
   2386     int unit, 
   2387     bcm_oam_event_type_t event_type, 
   2388     bcm_oam_pm_raw_data_t *raw_data, 
   2389     void *user_data);
   2390 
   2391 #ifndef BCM_HIDE_DISPATCHABLE
   2392 
   2393 /* Register a callback for handling OAM PM events */
   2394 extern int bcm_oam_pm_event_register(
   2395     int unit, 
   2396     bcm_oam_event_types_t event_types, 
   2397     bcm_oam_pm_event_cb cb, 
   2398     void *user_data);
   2399 
   2400 /* Register a callback for handling OAM PM events */
   2401 extern int bcm_oam_pm_event_unregister(
   2402     int unit, 
   2403     bcm_oam_event_types_t event_types, 
   2404     bcm_oam_pm_event_cb cb);
   2405 
   2406 /* Indicate SDK that the application has read buffer upto the read_index. */
   2407 extern int bcm_oam_pm_raw_data_read_done(
   2408     int unit, 
   2409     bcm_oam_event_types_t event_types, 
   2410     uint32 read_index);
   2411 
   2412 #endif /* BCM_HIDE_DISPATCHABLE */
   2413 
   2414 /* Types of OAM protocols */
   2415 typedef enum bcm_oam_protocol_type_e {
   2416     bcmOamProtocolEth = 0,      /* ETH-OAM Protocol */
   2417     bcmOamProtocolBhh = 1,      /* BHH-OAM Protocol */
   2418     bcmOamProtocolMplsLmDm = 2, /* MPLS LM/DM Protocol */
   2419     bcmOamProtocolMax = 3       /* Max No. of Protcols.Not an usable
   2420                                    value.Always at the end */
   2421 } bcm_oam_protocol_type_t;
   2422 
   2423 /* Types of OAM protocols */
   2424 typedef enum bcm_oam_opcode_e {
   2425     bcmOamOpcodeCCM = 1,        /* Opcode for CCM */
   2426     bcmOamOpcodeLBR = 2,        /* Opcode for LBR */
   2427     bcmOamOpcodeLBM = 3,        /* Opcode for LBM */
   2428     bcmOamOpcodeLTR = 4,        /* Opcode for LTR */
   2429     bcmOamOpcodeLTM = 5,        /* Opcode for LTM */
   2430     bcmOamOpcodeAIS = 33,       /* Opcode for AIS */
   2431     bcmOamOpcodeLCK = 35,       /* Opcode for LCK */
   2432     bcmOamOpcodeTST = 37,       /* Opcode for TST */
   2433     bcmOamOpcodeLinearAPS = 39, /* Opcode for Linear APS */
   2434     bcmOamOpcodeRingAPS = 40,   /* Opcode for Ring APS */
   2435     bcmOamOpcodeMCC = 41,       /* Opcode for MCC */
   2436     bcmOamOpcodeLMR = 42,       /* Opcode for LMR */
   2437     bcmOamOpcodeLMM = 43,       /* Opcode for LMM */
   2438     bcmOamOpcode1DM = 45,       /* Opcode for 1DM */
   2439     bcmOamOpcodeDMR = 46,       /* Opcode for DMR */
   2440     bcmOamOpcodeDMM = 47,       /* Opcode for DMM */
   2441     bcmOamOpcodeEXR = 48,       /* Opcode for EXR */
   2442     bcmOamOpcodeEXM = 49,       /* Opcode for EXM */
   2443     bcmOamOpcodeVSR = 50,       /* Opcode for VSR */
   2444     bcmOamOpcodeVSM = 51,       /* Opcode for VSM */
   2445     bcmOamOpcodeCSF = 52,       /* Opcode for MCC */
   2446     bcmOamOpcode1SL = 53,       /* Opcode for 1SL */
   2447     bcmOamOpcodeSLR = 54,       /* Opcode for SLR */
   2448     bcmOamOpcodeSLM = 55,       /* Opcode for 1DM */
   2449     bcmOamOpcodeMax = 256       /* Max. Opcodes.Not an usable value.Always last */
   2450 } bcm_oam_opcode_t;
   2451 
   2452 /* Struture to set the Opcodes bitmap */
   2453 typedef struct bcm_oam_opcodes_s {
   2454     SHR_BITDCL opcode_bmp[_SHR_BITDCLSIZE(256)]; /* Opcodes bitmap vector */
   2455 } bcm_oam_opcodes_t;
   2456 
   2457 #define BCM_OAM_OPCODES_BITMAP_SET(_opcodes_bitmap, _opcode_)  SHR_BITSET(((_opcodes_bitmap).opcode_bmp), (_opcode_)) 
   2458 
   2459 #define BCM_OAM_OPCODES_BITMAP_GET(_opcodes_bitmap, _opcode_)  SHR_BITGET(((_opcodes_bitmap).opcode_bmp), (_opcode_)) 
   2460 
   2461 #define BCM_OAM_OPCODES_BITMAP_CLEAR(_opcodes_bitmap, _opcode_)  SHR_BITCLR(((_opcodes_bitmap).opcode_bmp), (_opcode_)) 
   2462 
   2463 #define BCM_OAM_OPCODES_BITMAP_SET_ALL(_opcodes_bitmap)  SHR_BITSET_RANGE(((_opcodes_bitmap).opcode_bmp), 0, bcmOamOpcodeMax) 
   2464 
   2465 #define BCM_OAM_OPCODES_BITMAP_CLEAR_ALL(_opcodes_bitmap)  SHR_BITCLR_RANGE(((_opcodes_bitmap).opcode_bmp), 0, bcmOamOpcodeMax) 
   2466 
   2467 #ifndef BCM_HIDE_DISPATCHABLE
   2468 
   2469 /* Set the Group for the specified opcodes of the Protocols */
   2470 extern int bcm_oam_opcode_group_set(
   2471     int unit, 
   2472     bcm_oam_protocol_type_t protocol, 
   2473     bcm_oam_opcodes_t opcodes, 
   2474     uint8 opcode_group);
   2475 
   2476 /* Get the opcode group for each opcode of each protocol */
   2477 extern int bcm_oam_opcode_group_get(
   2478     int unit, 
   2479     bcm_oam_protocol_type_t protocol, 
   2480     bcm_oam_opcode_t opcode, 
   2481     uint8 *opcode_group);
   2482 
   2483 #endif /* BCM_HIDE_DISPATCHABLE */
   2484 
   2485 /* OAM BHH endpoint/group fault flags */
   2486 #define BCM_OAM_BHH_FAULT_CCM_TIMEOUT       0x01       /* A BHH CCM time out
   2487                                                           alarm */
   2488 #define BCM_OAM_BHH_FAULT_CCM_RDI           0x02       /* A BHH CCM with RDI
   2489                                                           alarm */
   2490 #define BCM_OAM_BHH_FAULT_CCM_UNKNOWN_MEG_LEVEL 0x04       /* A BHH CCM with unknown
   2491                                                           MEG level alarm */
   2492 #define BCM_OAM_BHH_FAULT_CCM_UNKNOWN_MEG_ID 0x08       /* A BHH CCM with unknown
   2493                                                           MEG ID alarm */
   2494 #define BCM_OAM_BHH_FAULT_CCM_UNKNOWN_MEP_ID 0x10       /* A BHH CCM with unknown
   2495                                                           MEP ID alarm */
   2496 #define BCM_OAM_BHH_FAULT_CCM_UNKNOWN_PERIOD 0x20       /* A BHH CCM with unknown
   2497                                                           period alarm */
   2498 #define BCM_OAM_BHH_FAULT_CCM_UNKNOWN_PRIORITY 0x40       /* A BHH CCM with unknown
   2499                                                           priority alarm */
   2500 #define BCM_OAM_ENDPOINT_BHH_FAULT_CSF_LOS  0x80       /* CSF Loss of Signal */
   2501 #define BCM_OAM_ENDPOINT_BHH_FAULT_CSF_FDI  0x100      /* CSF Forward Defect
   2502                                                           Indication */
   2503 #define BCM_OAM_ENDPOINT_BHH_FAULT_CSF_RDI  0x200      /* CSF Reverse Defect
   2504                                                           Indication */
   2505 
   2506 /* Flags will be sent back as bitmap in processed stats structure */
   2507 #define BCM_OAM_PM_STATS_PROCESSED_COUNTER_ROLLOVER 0x0001     /* Flag bit in flags
   2508                                                           field of PM stats
   2509                                                           structure to indicate
   2510                                                           counter roll-over */
   2511 
   2512 #ifndef BCM_HIDE_DISPATCHABLE
   2513 
   2514 /* Attach an egress MPLS gport to a MPLS LSP endpoint */
   2515 extern int bcm_oam_endpoint_gport_egress_attach(
   2516     int unit, 
   2517     bcm_oam_endpoint_t endpoint, 
   2518     bcm_gport_t gport);
   2519 
   2520 /* Detach an egress MPLS gport from a MPLS LSP endpoint */
   2521 extern int bcm_oam_endpoint_gport_egress_detach(
   2522     int unit, 
   2523     bcm_oam_endpoint_t endpoint, 
   2524     bcm_gport_t gport);
   2525 
   2526 /* Get the list of MPLS gports attached to a MPLS LSP endpoint */
   2527 extern int bcm_oam_endpoint_gport_egress_attach_get(
   2528     int unit, 
   2529     bcm_oam_endpoint_t endpoint, 
   2530     int max_count, 
   2531     bcm_gport_t *gport, 
   2532     int *count);
   2533 
   2534 /* Attach Egress object pointed by egress_intf to a MPLS LSP endpoint */
   2535 extern int bcm_oam_endpoint_egress_intf_egress_attach(
   2536     int unit, 
   2537     bcm_oam_endpoint_t endpoint_id, 
   2538     bcm_if_t egress_intf);
   2539 
   2540 /* Detach Egress object pointed by egress_intf from MPLS LSP endpoint */
   2541 extern int bcm_oam_endpoint_egress_intf_egress_detach(
   2542     int unit, 
   2543     bcm_oam_endpoint_t endpoint_id, 
   2544     bcm_if_t egress_intf);
   2545 
   2546 /* Get the list of Egress interfaces attached to MPLS LSP endpoint */
   2547 extern int bcm_oam_endpoint_egress_intf_egress_attach_get(
   2548     int unit, 
   2549     bcm_oam_endpoint_t endpoint_id, 
   2550     int max_count, 
   2551     bcm_if_t *egress_intf, 
   2552     int *count);
   2553 
   2554 #endif /* BCM_HIDE_DISPATCHABLE */
   2555 
   2556 /* Fault status of each endpoint alongwith endpoint id */
   2557 typedef struct bcm_oam_endpoint_fault_s {
   2558     bcm_oam_endpoint_t endpoint_id; /* Endpoint id assocaietd with the faults
   2559                                        bitmap */
   2560     uint32 faults;                  /* Faults bitmap for the endpoint */
   2561 } bcm_oam_endpoint_fault_t;
   2562 
   2563 #ifndef BCM_HIDE_DISPATCHABLE
   2564 
   2565 /* 
   2566  * Retrieve all faults for all valid end points up to a maximum of
   2567  * max_endpoints for a given protocol
   2568  */
   2569 extern int bcm_oam_endpoint_faults_multi_get(
   2570     int unit, 
   2571     uint32 flags, 
   2572     bcm_oam_protocol_type_t endpoint_protocol, 
   2573     uint32 max_endpoints, 
   2574     bcm_oam_endpoint_fault_t *faults, 
   2575     uint32 *endpoint_count);
   2576 
   2577 /* Set the packet header on the protection packets injected by the OAMP */
   2578 extern int bcm_oam_protection_packet_header_set(
   2579     int unit, 
   2580     bcm_pkt_blk_t *packet_header);
   2581 
   2582 /* Get the packet header of the protection packets injected by the OAMP */
   2583 extern int bcm_oam_protection_packet_header_get(
   2584     int unit, 
   2585     bcm_pkt_blk_t *packet_header);
   2586 
   2587 /* 
   2588  * Create a new LM count profile for opcodes with all opcodes having
   2589  * counting disabled. The id of the profile created is returned in
   2590  * lm_count_profile variable.
   2591  */
   2592 extern int bcm_oam_opcodes_count_profile_create(
   2593     int unit, 
   2594     uint8 *lm_count_profile);
   2595 
   2596 /* 
   2597  * Enable/disable counting for the opcodes in the opcodes_bitmap in the
   2598  * profile pointed by lm_count_profile variable.
   2599  */
   2600 extern int bcm_oam_opcodes_count_profile_set(
   2601     int unit, 
   2602     uint8 lm_count_profile, 
   2603     uint8 count_enable, 
   2604     bcm_oam_opcodes_t *opcodes_bitmap);
   2605 
   2606 /* 
   2607  * Get the opocdes in opcodes_bitmap for given count enable  as part of
   2608  * lm_count_profile.
   2609  */
   2610 extern int bcm_oam_opcodes_count_profile_get(
   2611     int unit, 
   2612     uint8 lm_count_profile, 
   2613     uint8 count_enable, 
   2614     bcm_oam_opcodes_t *opcodes_bitmap);
   2615 
   2616 /* 
   2617  *  Delete the count profile with the id lm_count_profile.The counting
   2618  * for all opocdes will be destroyed in the profile.
   2619  */
   2620 extern int bcm_oam_opcodes_count_profile_delete(
   2621     int unit, 
   2622     uint8 lm_count_profile);
   2623 
   2624 /* 
   2625  * Add ports (specified by port_arr) to trunk (specified by trunk_gport)
   2626  * mapping to port-trunk database in OAM
   2627  */
   2628 extern int bcm_oam_trunk_ports_add(
   2629     int unit, 
   2630     bcm_gport_t trunk_gport, 
   2631     int max_ports, 
   2632     bcm_gport_t *port_arr);
   2633 
   2634 /* 
   2635  * Delete ports (specified by port_arr) to trunk (specified by
   2636  * trunk_gport) mapping from port-trunk database in OAM
   2637  */
   2638 extern int bcm_oam_trunk_ports_delete(
   2639     int unit, 
   2640     bcm_gport_t trunk_gport, 
   2641     int max_ports, 
   2642     bcm_gport_t *port_arr);
   2643 
   2644 /* 
   2645  * Get ports (into port_arr) that are mapped to trunk (specified by
   2646  * trunk_gport) from port-trunk database in OAM
   2647  */
   2648 extern int bcm_oam_trunk_ports_get(
   2649     int unit, 
   2650     bcm_gport_t trunk_gport, 
   2651     int max_ports, 
   2652     bcm_gport_t *port_arr, 
   2653     int *port_count);
   2654 
   2655 #endif /* BCM_HIDE_DISPATCHABLE */
   2656 
   2657 /* MPLS OAM/BFD channel types */
   2658 typedef enum bcm_oam_mpls_tp_channel_type_e {
   2659     bcmOamMplsTpChannelPweBfd = 0,      /* BFD control Channel type */
   2660     bcmOamMplsTpChannelPweonoam = 1,    /* PWE OAM channel type - significant
   2661                                            only in TX direction, use
   2662                                            bcmOamMplsTpChannelY1731 in RX
   2663                                            direction */
   2664     bcmOamMplsTpChannelY1731 = 2,       /* Y1731 OAM channel type */
   2665     bcmOamMplsTpChannelTypeCount = 3    /* Always Last. Not a usable value. */
   2666 } bcm_oam_mpls_tp_channel_type_t;
   2667 
   2668 #ifndef BCM_HIDE_DISPATCHABLE
   2669 
   2670 /* 
   2671  * Set a list of values for MPLS TP OAM/BFD channel types that can be
   2672  * received in a packet
   2673  */
   2674 extern int bcm_oam_mpls_tp_channel_type_rx_set(
   2675     int unit, 
   2676     bcm_oam_mpls_tp_channel_type_t  channel_type, 
   2677     int num_values, 
   2678     int *list_of_values);
   2679 
   2680 /* 
   2681  * Get the list of values for MPLS TP OAM/BFD channel types that can be
   2682  * received in a packet
   2683  */
   2684 extern int bcm_oam_mpls_tp_channel_type_rx_get(
   2685     int unit, 
   2686     bcm_oam_mpls_tp_channel_type_t  channel_type, 
   2687     int num_values, 
   2688     int *list_of_values, 
   2689     int *value_count);
   2690 
   2691 /* 
   2692  * Set a value for MPLS TP OAM/BFD channel types that would be
   2693  * transmitted in a packet generated by OAMP
   2694  */
   2695 extern int bcm_oam_mpls_tp_channel_type_tx_set(
   2696     int unit, 
   2697     bcm_oam_mpls_tp_channel_type_t  channel_type, 
   2698     int value);
   2699 
   2700 /* 
   2701  * Get the value for MPLS TP OAM/BFD channel types that would be
   2702  * transmitted in a packet generated by OAMP
   2703  */
   2704 extern int bcm_oam_mpls_tp_channel_type_tx_get(
   2705     int unit, 
   2706     bcm_oam_mpls_tp_channel_type_t  channel_type, 
   2707     int *value);
   2708 
   2709 /* 
   2710  * Delete a list of values for MPLS TP OAM/BFD channel types that can be
   2711  * received in a packet
   2712  */
   2713 extern int bcm_oam_mpls_tp_channel_type_rx_delete(
   2714     int unit, 
   2715     bcm_oam_mpls_tp_channel_type_t  channel_type, 
   2716     int num_values, 
   2717     int *list_of_values);
   2718 
   2719 /* 
   2720  * Delete a value for MPLS TP OAM/BFD channel types that would be
   2721  * transmitted in a packet generated by OAMP
   2722  */
   2723 extern int bcm_oam_mpls_tp_channel_type_tx_delete(
   2724     int unit, 
   2725     bcm_oam_mpls_tp_channel_type_t  channel_type, 
   2726     int value);
   2727 
   2728 #endif /* BCM_HIDE_DISPATCHABLE */
   2729 
   2730 /* Used for Invalid OAM action profile indication. */
   2731 #define BCM_OAM_PROFILE_INVALID -1         
   2732 
   2733 /* Flags for action profile. */
   2734 #define BCM_OAM_PROFILE_WITH_ID             0x1        /* Used by oam action
   2735                                                           profile create profile
   2736                                                           create with id. */
   2737 #define BCM_OAM_PROFILE_LM_TYPE_DUAL_ENDED  0x2        /* When LM is done via
   2738                                                           CCM PDU. */
   2739 #define BCM_OAM_PROFILE_LM_TYPE_SLM         0x4        /* When LM is done via
   2740                                                           SLM/SLR PDU. */
   2741 #define BCM_OAM_PROFILE_DM_TYPE_NTP         0x8        /* Use NTP format for DM. */
   2742 #define BCM_OAM_PROFILE_LM_TYPE_NONE        0x10       /* Disable counter
   2743                                                           stamping on LMM/LMR
   2744                                                           SLM/SLR packets. */
   2745 
   2746 /* bcm_oam_profile_type_t will represent the oam action profile type. */
   2747 typedef enum bcm_oam_profile_type_e {
   2748     bcmOAMProfileIngressLIF = 0, 
   2749     bcmOAMProfileEgressLIF = 1, 
   2750     bcmOAMProfileIngressAcceleratedEndpoint = 2, 
   2751     bcmOAMProfileEgressAcceleratedEndpoint = 3, 
   2752     bcmOAMProfileCount = 4 
   2753 } bcm_oam_profile_type_t;
   2754 
   2755 /* MAC types for OAM packets. Used for action profile configuration. */
   2756 typedef enum bcm_oam_dest_mac_type_e {
   2757     bcmOAMDestMacTypeMcast = 0, 
   2758     bcmOAMDestMacTypeMyCfmMac = 1, 
   2759     bcmOAMDestMacTypeUknownUcast = 2, 
   2760     bcmOAMDestMacTypeCount = 3 
   2761 } bcm_oam_dest_mac_type_t;
   2762 
   2763 /* Endpoint type used for action profile configuration */
   2764 typedef enum bcm_oam_match_type_e {
   2765     bcmOAMMatchTypeMIP = 0, 
   2766     bcmOAMMatchTypeMEP = 1, 
   2767     bcmOAMMatchTypePassive = 2, 
   2768     bcmOAMMatchTypeLowMDL = 3, 
   2769     bcmOAMMatchTypeCount = 4 
   2770 } bcm_oam_match_type_t;
   2771 
   2772 /* OAM action key. */
   2773 typedef struct bcm_oam_action_key_s {
   2774     uint32 flags; 
   2775     bcm_oam_opcode_t opcode; 
   2776     bcm_oam_dest_mac_type_t dest_mac_type; 
   2777     bcm_oam_match_type_t endpoint_type; 
   2778     uint8 inject; 
   2779 } bcm_oam_action_key_t;
   2780 
   2781 /* OAM action result. */
   2782 typedef struct bcm_oam_action_result_s {
   2783     uint32 flags; 
   2784     uint8 counter_increment; 
   2785     uint8 meter_enable; 
   2786     bcm_gport_t destination; 
   2787 } bcm_oam_action_result_t;
   2788 
   2789 #ifndef BCM_HIDE_DISPATCHABLE
   2790 
   2791 /* Function allocate oam profile. */
   2792 extern int bcm_oam_profile_create(
   2793     int unit, 
   2794     uint32 flags, 
   2795     bcm_oam_profile_type_t oam_profile_type, 
   2796     bcm_oam_profile_t *profile_id);
   2797 
   2798 /* Function release oam profile. */
   2799 extern int bcm_oam_profile_delete(
   2800     int unit, 
   2801     uint32 flags, 
   2802     bcm_oam_profile_t profile_id);
   2803 
   2804 /* Function return oam lif profile according lif. */
   2805 extern int bcm_oam_lif_profile_get(
   2806     int unit, 
   2807     uint32 flags, 
   2808     bcm_gport_t gport, 
   2809     bcm_oam_profile_t *ingress_oam_profile, 
   2810     bcm_oam_profile_t *egress_oam_profile);
   2811 
   2812 /* 
   2813  * Function return oam lif profile according lif. If some end point
   2814  * already exist on given LIF, profile will be updated in OAM-LIF-DB
   2815  * table and stored in sw state.If no endpoint yet defined on given LIF,
   2816  * profile will be stored in sw state.
   2817  */
   2818 extern int bcm_oam_lif_profile_set(
   2819     int unit, 
   2820     uint32 flags, 
   2821     bcm_gport_t gport, 
   2822     bcm_oam_profile_t ingress_oam_profile, 
   2823     bcm_oam_profile_t egress_oam_profile);
   2824 
   2825 /* Function return action. */
   2826 extern int bcm_oam_profile_action_get(
   2827     int unit, 
   2828     uint32 flags, 
   2829     bcm_oam_profile_t profile_id, 
   2830     bcm_oam_action_key_t *oam_action_key, 
   2831     bcm_oam_action_result_t *oam_action_result);
   2832 
   2833 /* Function return action. */
   2834 extern int bcm_oam_profile_action_set(
   2835     int unit, 
   2836     uint32 flags, 
   2837     bcm_oam_profile_t profile_id, 
   2838     bcm_oam_action_key_t *oam_action_key, 
   2839     bcm_oam_action_result_t *oam_action_result);
   2840 
   2841 #endif /* BCM_HIDE_DISPATCHABLE */
   2842 
   2843 /* OAM UP MEP PDU Type */
   2844 typedef enum bcm_oam_upmep_pdu_type_e {
   2845     bcmOamUpmepPduTypeCcm = 0,      /* Used to set the CPU queue for UP MEP CCM
   2846                                        packets */
   2847     bcmOamUpmepPduTypeLmDm = 1,     /* Used to set the CPU queue for UP MEP
   2848                                        LM/DM packets */
   2849     bcmOamUpmepPduTypeSlowpath = 2, /* Used to set the CPU queue for UP MEP
   2850                                        slowpath packets */
   2851     bcmOamUpmepPduTypeCount = 3     /* Must be last.  Not a usable value. */
   2852 } bcm_oam_upmep_pdu_type_t;
   2853 
   2854 /* OAM Leap Second Control Modes */
   2855 typedef enum bcm_oam_leap_sec_control_mode_e {
   2856     bcmOamLeapUpperSecIncr = 1, /* Increment IEEE1588_TIME_SEC_UPPER counter, Do
   2857                                    not increment IEEE1588_TIME_1_SEC counter */
   2858     bcmOamLeap1SecIncr = 2      /* Do not increment IEEE1588_TIME_SEC_UPPER,
   2859                                    Increment IEEE1588_TIME_1_SEC counter */
   2860 } bcm_oam_leap_sec_control_mode_t;
   2861 
   2862 #ifndef BCM_HIDE_DISPATCHABLE
   2863 
   2864 /* Configure device-wide UP MEP PDU type CPU queue */
   2865 extern int bcm_oam_upmep_cosq_set(
   2866     int unit, 
   2867     bcm_oam_upmep_pdu_type_t upmep_pdu_type, 
   2868     bcm_cos_queue_t cosq);
   2869 
   2870 /* Query device-wide UP MEP PDU type CPU queue */
   2871 extern int bcm_oam_upmep_cosq_get(
   2872     int unit, 
   2873     bcm_oam_upmep_pdu_type_t upmep_pdu_type, 
   2874     bcm_cos_queue_t *cosq);
   2875 
   2876 #endif /* BCM_HIDE_DISPATCHABLE */
   2877 
   2878 /* Initialize an OAM ACTION key structure */
   2879 extern void bcm_oam_action_key_t_init(
   2880     bcm_oam_action_key_t *action_key_ptr);
   2881 
   2882 /* Initialize an OAM ACTION result structure */
   2883 extern void bcm_oam_action_result_t_init(
   2884     bcm_oam_action_result_t *action_result_ptr);
   2885 
   2886 /* OAM reflector encap flags */
   2887 #define BCM_OAM_REFELCTOR_ENCAP_WITH_ID 0x1        /* Allocate the specified
   2888                                                       encap id for OAM reflector */
   2889 
   2890 #ifndef BCM_HIDE_DISPATCHABLE
   2891 
   2892 /* Create encap_id for OAM reflector. */
   2893 extern int bcm_oam_reflector_encap_create(
   2894     int unit, 
   2895     uint32 flags, 
   2896     bcm_if_t *encap_id);
   2897 
   2898 /* Destroy OAM reflector encap_id. */
   2899 extern int bcm_oam_reflector_encap_destroy(
   2900     int unit, 
   2901     uint32 flags, 
   2902     bcm_if_t encap_id);
   2903 
   2904 /* 
   2905  * Function Get encoded oam profile id and associated flags from raw OAM
   2906  * profile id and OAM profile type.
   2907  */
   2908 extern int bcm_oam_profile_id_get_by_type(
   2909     int unit, 
   2910     uint8 profile_id, 
   2911     bcm_oam_profile_type_t oam_profile_type, 
   2912     uint32 *flags, 
   2913     bcm_oam_profile_t *enc_profile_id);
   2914 
   2915 #endif /* BCM_HIDE_DISPATCHABLE */
   2916 
   2917 typedef struct bcm_oam_control_key_s {
   2918     bcm_oam_control_type_t type;    /* OAM control type */
   2919     int index;                      /* OAM control index */
   2920 } bcm_oam_control_key_t;
   2921 
   2922 #ifndef BCM_HIDE_DISPATCHABLE
   2923 
   2924 /* Configure indexed OAM controls */
   2925 extern int bcm_oam_control_indexed_set(
   2926     int unit, 
   2927     bcm_oam_control_key_t key, 
   2928     uint64 arg);
   2929 
   2930 /* Query indexed OAM controls */
   2931 extern int bcm_oam_control_indexed_get(
   2932     int unit, 
   2933     bcm_oam_control_key_t key, 
   2934     uint64 *arg);
   2935 
   2936 #endif /* BCM_HIDE_DISPATCHABLE */
   2937 
   2938 typedef struct bcm_oam_tod_leap_control_s {
   2939     uint8 leap_ctrl_enable;             /* Flag to enable/disable Leap Second
   2940                                            Control */
   2941     bcm_oam_leap_sec_control_mode_t leap_sec_control; /* Leap Second control mode */
   2942 } bcm_oam_tod_leap_control_t;
   2943 
   2944 #ifndef BCM_HIDE_DISPATCHABLE
   2945 
   2946 /* Configure TOD Leap Second Control */
   2947 extern int bcm_oam_tod_leap_control_set(
   2948     int unit, 
   2949     bcm_oam_timestamp_format_t ts_format, 
   2950     bcm_oam_tod_leap_control_t leap_info);
   2951 
   2952 /* Query TOD Leap Second Control */
   2953 extern int bcm_oam_tod_leap_control_get(
   2954     int unit, 
   2955     bcm_oam_timestamp_format_t ts_format, 
   2956     bcm_oam_tod_leap_control_t *leap_info);
   2957 
   2958 #endif /* BCM_HIDE_DISPATCHABLE */
   2959 
   2960 #endif /* __BCM_OAM_H__ */