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

bfd.h (30227B)


      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_BFD_H__
     14 #define __BCM_BFD_H__
     15 
     16 #if defined(INCLUDE_BFD)
     17 
     18 #include <shared/bfd.h>
     19 #include <bcm/mpls.h>
     20 
     21 /* Miscellaneous BFD defines. */
     22 #define BCM_BFD_ENDPOINT_INVALID            -1         /* Invalid BFD endpoint
     23                                                           ID. */
     24 #define BCM_BFD_ENDPOINT_DEFAULT0           -3         /* BFD default endpoint. */
     25 #define BCM_BFD_ENDPOINT_DEFAULT1           -4         /* BFD default endpoint. */
     26 #define BCM_BFD_ENDPOINT_DEFAULT2           -5         /* BFD default endpoint. */
     27 #define BCM_BFD_ENDPOINT_DEFAULT3           -6         /* BFD default endpoint. */
     28 #define BCM_BFD_INTPRI_MAX                  16         /* Internal priority max
     29                                                           value. */
     30 #define BCM_BFD_ENDPOINT_MAX_MEP_ID_LENGTH  _SHR_BFD_ENDPOINT_MAX_MEP_ID_LENGTH /* MPLS-TP MEP_ID maximum
     31                                                           length. */
     32 
     33 /* BFD endpoint flags. */
     34 #define BCM_BFD_ENDPOINT_UPDATE             0x0001     /* Update an existing BFD
     35                                                           endpoint. */
     36 #define BCM_BFD_ENDPOINT_WITH_ID            0x0002     /* Use the specified
     37                                                           endpoint ID. */
     38 #define BCM_BFD_ENDPOINT_PASSIVE            0x0004     /* Specifies endpoint
     39                                                           takes passive role. */
     40 #define BCM_BFD_ENDPOINT_DEMAND             0x0008     /* Specifies local
     41                                                           endpoint is in demand
     42                                                           mode. */
     43 #define BCM_BFD_ENDPOINT_ENCAP_SET          0x0010     /* Update encapsulation
     44                                                           on existing BFD
     45                                                           endpoint. */
     46 #define BCM_BFD_ENDPOINT_PWE_RAW            0x0020     /* Use MPLS PWE RAW mode.
     47                                                           Valid only for PWE
     48                                                           Tunnel types. */
     49 #define BCM_BFD_ENDPOINT_PWE_ACH            0x0040     /* Use MPLS Associated
     50                                                           Channel Header.  Valid
     51                                                           only for PWE Tunnel
     52                                                           types. */
     53 #define BCM_BFD_ENDPOINT_IPV6               0x0080     /* Use IPv6
     54                                                           encapsulation. */
     55 #define BCM_BFD_ENDPOINT_MULTIHOP           0x0100     /* BFD IP/UDP multihop
     56                                                           endpoint. */
     57 #define BCM_BFD_ENDPOINT_MPLS_TP_AIS_LDI    0x0200     /* Set MPLS-TP AIS LDI. 
     58                                                           Valid only for MPLS-TP
     59                                                           Tunnel types. */
     60 #define BCM_BFD_ENDPOINT_MPLS_TP_LKR        0x0400     /* MPLS-TP Locked Report
     61                                                           (LKR). Valid only for
     62                                                           MPLS-TP Tunnel types. */
     63 #define BCM_BFD_ENDPOINT_KEY_TYPE_USE_YOUR_DISC 0x0800     /* Resolve BFD session ID
     64                                                           from your
     65                                                           discriminator.(Instead
     66                                                           of MPLS label) */
     67 #define BCM_BFD_ENDPOINT_MPLS_IP_DEST_RANDOM 0x1000     /* Randomize outgoing IP
     68                                                           dest addr. Valid only
     69                                                           for MPLS/PWE Tunnel
     70                                                           types. */
     71 #define BCM_BFD_ENDPOINT_MPLS_TP_POLL_SEQUENCE_ENABLE 0x2000     /* Enable poll sequence
     72                                                           for MPLS-TP
     73                                                           encapsulations.  Valid
     74                                                           only for MPLS-TP
     75                                                           Tunnel types. */
     76 #define BCM_BFD_ENDPOINT_SHA1_SEQUENCE_INCR 0x4000     /* Increment sequence
     77                                                           number.  Valid for
     78                                                           SHA1 authentication
     79                                                           only. */
     80 #define BCM_BFD_ENDPOINT_IN_HW              0x8000     /* Process the endpint in
     81                                                           HW. */
     82 #define BCM_BFD_ENDPOINT_STACK              0x10000    /* Endpoint is managed by
     83                                                           other unit in the
     84                                                           stack. */
     85 #define BCM_BFD_ENDPOINT_REMOTE_EVENT_DISABLE 0x20000    /* Do not generate
     86                                                           events. */
     87 #define BCM_BFD_ENDPOINT_RDI_AUTO_UPDATE    0x40000    /* Auto update defect
     88                                                           state on timeout event */
     89 #define BCM_BFD_ENDPOINT_RX_REMOTE_EVENT_DISABLE 0x80000    /* Do not generate events
     90                                                           for RX packets. */
     91 #define BCM_BFD_ENDPOINT_RX_RDI_AUTO_UPDATE 0x100000   /* Auto update defect
     92                                                           state on timeout event
     93                                                           for RX packets */
     94 #define BCM_BFD_ENDPOINT_RDI_ON_LOC         0x200000   /* MEP RDI update LOC
     95                                                           enable - update local
     96                                                           MEP RDI in case of
     97                                                           LOC. */
     98 #define BCM_BFD_ENDPOINT_RDI_CLEAR_ON_LOC_CLEAR 0x400000   /* MEP RDI update LOC
     99                                                           clean enable - update
    100                                                           local MEP RDI in case
    101                                                           of LOC clear (time-in)
    102                                                           event detected. */
    103 #define BCM_BFD_ENDPOINT_REMOTE_WITH_ID     0x800000   /* Use the specified
    104                                                           remote endpoint ID. */
    105 #define BCM_BFD_ENDPOINT_REMOTE_UPDATE_STATE_DISABLE 0x1000000  /* Disable updating RMEP
    106                                                           DB. */
    107 #define BCM_BFD_ENDPOINT_HW_ACCELERATION_SET 0x2000000  /* Configure only HW
    108                                                           accelerator
    109                                                           properties. */
    110 #define BCM_BFD_ECHO                        0x4000000  /* Create BFD echo
    111                                                           session. */
    112 #define BCM_BFD_ENDPOINT_EXPLICIT_DETECTION_TIME 0x8000000  /* BFD Detection Time is
    113                                                           set explicitly. */
    114 #define BCM_BFD_ENDPOINT_USE_PKT_VLAN_ID    0x10000000 /* Use to configure the
    115                                                           User provided Vlan ID. */
    116 #define BCM_BFD_ENDPOINT_MICRO_BFD          0x20000000 /* Use to configure micro
    117                                                           BFD session. */
    118 #define BCM_BFD_ENDPOINT_ADMIN_DOWN_PKT_ON_ENDPOINT_DEL 0x40000000 /* Trasmit ADMIN_DOWN
    119                                                           packet on session
    120                                                           deletion. */
    121 #define BCM_BFD_ENDPOINT_STANDBY_SSO_UPDATE 0x80000000 /* Standby endpoint
    122                                                           update for Statefull
    123                                                           Switchover. */
    124 
    125 /* Additional BFD endpoint flags. */
    126 #define BCM_BFD_ENDPOINT_FLAGS2_SEAMLESS_BFD_INITIATOR (1<<0)     /* Create/update Seamless
    127                                                           BFD initiator
    128                                                           endpoint. */
    129 #define BCM_BFD_ENDPOINT_FLAGS2_SEAMLESS_BFD_REFLECTOR (1<<1)     /* Create/update Seamless
    130                                                           BFD initiator
    131                                                           endpoint. */
    132 #define BCM_BFD_ENDPOINT_FLAGS2_USE_MY_DIP_DESTINATION (1<<2)     /* Verify DIP through
    133                                                           my-DIP-Destination. */
    134 #define BCM_BFD_ENDPOINT_FLAGS2_TX_STATISTICS (1<<3)     /* Enable OAMP Tx
    135                                                           statistics. */
    136 #define BCM_BFD_ENDPOINT_FLAGS2_RX_STATISTICS (1<<4)     /* Enable OAMP Rx
    137                                                           statistics. */
    138 
    139 /* Remote status flags. */
    140 #define BCM_BFD_ENDPOINT_REMOTE_DEMAND      0x0001     /* Remote endpoint is in
    141                                                           demand mode. */
    142 #define BCM_BFD_ENDPOINT_REMOTE_RX_AUTH_SEQ_KNOWN 0x002      /* Rx Authentication
    143                                                           Sequence ID is known. 
    144                                                           Valid for SHA1
    145                                                           authentication only. */
    146 
    147 /* BFD packet statistic options. */
    148 #define BCM_BFD_ENDPOINT_STAT_CLEAR 0x0001     /* Clear statistics. */
    149 #define BCM_BFD_ENDPOINT_STAT_64BIT 0x0002     /* Get 64bit statistics. */
    150 
    151 /* Simple Password authentication data. */
    152 #define BCM_BFD_SIMPLE_PASSWORD_KEY_LENGTH_MAX _SHR_BFD_AUTH_SIMPLE_PASSWORD_KEY_LENGTH 
    153 
    154 /* BFD endpoint local control flags. */
    155 #define BCM_BFD_ENDPOINT_LOCAL_FLAGS_M  0x00000001 /* Multipoint control flag. */
    156 #define BCM_BFD_ENDPOINT_LOCAL_FLAGS_D  0x00000002 /* Demand Control Flag. */
    157 #define BCM_BFD_ENDPOINT_LOCAL_FLAGS_A  0x00000004 /* Authentication Control
    158                                                       Flag. */
    159 #define BCM_BFD_ENDPOINT_LOCAL_FLAGS_C  0x00000008 /* Control Plane Independent
    160                                                       Control Flag. */
    161 #define BCM_BFD_ENDPOINT_LOCAL_FLAGS_F  0x00000010 /* Final Bit Control Flag. */
    162 #define BCM_BFD_ENDPOINT_LOCAL_FLAGS_P  0x00000020 /* Poll Bit Control Flag. */
    163 
    164 /* BFD Status flags. */
    165 #define BCM_BFD_STATUS_LOCAL_ADMIN_DOWN     0x00000001 /* BFD Local State Admin. */
    166 #define BCM_BFD_STATUS_LOCAL_DOWN           0x00000002 /* BFD Local State Down. */
    167 #define BCM_BFD_STATUS_LOCAL_INIT           0x00000004 /* BFD Local State Init. */
    168 #define BCM_BFD_STATUS_LOCAL_UP             0x00000008 /* BFD Local State Up. */
    169 #define BCM_BFD_STATUS_REMOTE_ADMIN_DOWN    0x00000010 /* BFD Remote State
    170                                                           Admin. */
    171 #define BCM_BFD_STATUS_REMOTE_DOWN          0x00000020 /* BFD Remote State Down. */
    172 #define BCM_BFD_STATUS_REMOTE_INIT          0x00000040 /* BFD Remote State Init. */
    173 #define BCM_BFD_STATUS_REMOTE_UP            0x00000080 /* BFD Remote State Up. */
    174 #define BCM_BFD_STATUS_LOCAL_DIAG_CODE_NONE 0x00000100 /* BFD Local Diag None. */
    175 #define BCM_BFD_STATUS_LOCAL_DIAG_CODE_CTRL_DETECT_TIME_EXPIRED 0x00000200 /* BFD Local Diag Detect
    176                                                           Time Expired. */
    177 #define BCM_BFD_STATUS_LOCAL_DIAG_CODE_ECHO_FAILED 0x00000400 /* BFD Local Diag Echo
    178                                                           Failed. */
    179 #define BCM_BFD_STATUS_LOCAL_DIAG_CODE_NEIGHBOR_SIGNALED_SESSION_DOWN 0x00000800 /* BFD Neighbor Signaled
    180                                                           Session Down. */
    181 #define BCM_BFD_STATUS_LOCAL_DIAG_CODE_FORWARDING_PLANE_RESET 0x00001000 /* Local diag Forwarding
    182                                                           Plane Reset. */
    183 #define BCM_BFD_STATUS_LOCAL_DIAG_CODE_PATH_DOWN 0x00002000 /* Local diag Path Down. */
    184 #define BCM_BFD_STATUS_LOCAL_DIAG_CODE_CONCATENATED_PATH_DOWN 0x00004000 /* Local Diag
    185                                                           Concatenated Path
    186                                                           Down. */
    187 #define BCM_BFD_STATUS_LOCAL_DIAG_CODE_ADMIN_DOWN 0x00008000 /* Local Diag
    188                                                           Administratively Down. */
    189 #define BCM_BFD_STATUS_LOCAL_DIAG_CODE_REVERSE_CONCATENATED_PATH_DOWN 0x00010000 /* Local Diag Reverse
    190                                                           Concatenated Path
    191                                                           Down. */
    192 #define BCM_BFD_STATUS_LOCAL_DIAG_CODE_MIS_CONNECTIVITY_DEFECT 0x00020000 /* Local Diag Mis conn
    193                                                           Defect. */
    194 
    195 /* BFD fault flags. */
    196 #define BCM_BFD_ENDPOINT_REMOTE_LOC 0x00000001 /* BFD endpoint time out */
    197 
    198 typedef struct bcm_bfd_auth_simple_password_s {
    199     uint8 length; 
    200     uint8 password[BCM_BFD_SIMPLE_PASSWORD_KEY_LENGTH_MAX]; 
    201 } bcm_bfd_auth_simple_password_t;
    202 
    203 /* SHA1 authentication data. */
    204 #define BCM_BFD_AUTH_SHA1_KEY_LENGTH    _SHR_BFD_AUTH_SHA1_KEY_LENGTH 
    205 
    206 typedef struct bcm_bfd_auth_sha1_s {
    207     uint8 enable; 
    208     uint32 sequence; 
    209     uint8 key[BCM_BFD_AUTH_SHA1_KEY_LENGTH]; 
    210 } bcm_bfd_auth_sha1_t;
    211 
    212 /* BFD Session States. */
    213 typedef enum bcm_bfd_state_e {
    214     bcmBFDStateAdminDown = _SHR_BFD_SESSION_STATE_ADMIN_DOWN, 
    215     bcmBFDStateDown = _SHR_BFD_SESSION_STATE_DOWN, 
    216     bcmBFDStateInit = _SHR_BFD_SESSION_STATE_INIT, 
    217     bcmBFDStateUp = _SHR_BFD_SESSION_STATE_UP, 
    218     bcmBFDStateCount = _SHR_BFD_SESSION_STATE_COUNT 
    219 } bcm_bfd_state_t;
    220 
    221 /* BFD Diagnostic Codes. */
    222 typedef enum bcm_bfd_diag_code_e {
    223     bcmBFDDiagCodeNone = _SHR_BFD_DIAG_CODE_NONE, 
    224     bcmBFDDiagCodeCtrlDetectTimeExpired = _SHR_BFD_DIAG_CODE_CTRL_DETECT_TIME_EXPIRED, 
    225     bcmBFDDiagCodeEchoFailed = _SHR_BFD_DIAG_CODE_ECHO_FAILED, 
    226     bcmBFDDiagCodeNeighbourSignalledDown = _SHR_BFD_DIAG_CODE_NEIGHBOR_SIGNALED_SESSION_DOWN, 
    227     bcmBFDDiagCodeForwardingPlaneReset = _SHR_BFD_DIAG_CODE_FORWARDING_PLANE_RESET, 
    228     bcmBFDDiagCodePathDown = _SHR_BFD_DIAG_CODE_PATH_DOWN, 
    229     bcmBFDDiagCodeConcatPathDown = _SHR_BFD_DIAG_CODE_CONCATENATED_PATH_DOWN, 
    230     bcmBFDDiagCodeAdminDown = _SHR_BFD_DIAG_CODE_ADMIN_DOWN, 
    231     bcmBFDDiagCodeRevConcatPathDown = _SHR_BFD_DIAG_CODE_REVERSE_CONCATENATED_PATH_DOWN, 
    232     bcmBFDDiagCodeMisConnectivityDefect = _SHR_BFD_DIAG_CODE_MIS_CONNECTIVITY_DEFECT, 
    233     bcmBFDDiagCodeCount = _SHR_BFD_DIAG_CODE_COUNT 
    234 } bcm_bfd_diag_code_t;
    235 
    236 /* BFD Authentication Types. */
    237 typedef enum bcm_bfd_auth_type_e {
    238     bcmBFDAuthTypeNone = _SHR_BFD_AUTH_TYPE_NONE, 
    239     bcmBFDAuthTypeSimplePassword = _SHR_BFD_AUTH_TYPE_SIMPLE_PASSWORD, 
    240     bcmBFDAuthTypeKeyedMD5 = _SHR_BFD_AUTH_TYPE_KEYED_MD5, 
    241     bcmBFDAuthTypeMeticulousKeyedMD5 = _SHR_BFD_AUTH_TYPE_METICULOUS_KEYED_MD5, 
    242     bcmBFDAuthTypeKeyedSHA1 = _SHR_BFD_AUTH_TYPE_KEYED_SHA1, 
    243     bcmBFDAuthTypeMeticulousKeyedSHA1 = _SHR_BFD_AUTH_TYPE_METICULOUS_KEYED_SHA1, 
    244     bcmBFDAuthTypeCount = _SHR_BFD_AUTH_TYPE_COUNT 
    245 } bcm_bfd_auth_type_t;
    246 
    247 /* BFD tunnel types. */
    248 typedef enum bcm_bfd_tunnel_type_e {
    249     bcmBFDTunnelTypeUdp = 0,            /* BFD over IPv4/v6. */
    250     bcmBFDTunnelTypeIp4in4 = 1,         /* BFD over IPv4-in-IPv4 tunnel. */
    251     bcmBFDTunnelTypeIp6in4 = 2,         /* BFD over IPv6-in-IPv4 tunnel. */
    252     bcmBFDTunnelTypeIp4in6 = 3,         /* BFD over IPv4-in-IPv6 tunnel. */
    253     bcmBFDTunnelTypeIp6in6 = 4,         /* BFD over IPv6-in-IPv6 tunnel. */
    254     bcmBFDTunnelTypeGRE = 5,            /* BFD over GRE IPv4-in-IPv4 tunnel. */
    255     bcmBFDTunnelTypeGre4In4 = bcmBFDTunnelTypeGRE, /* BFD over GRE IPv4-in-IPv4 tunnel. */
    256     bcmBFDTunnelTypeMpls = 6,           /* BFD over MPLS LSP. */
    257     bcmBFDTunnelTypePweControlWord = 7, /* BFD over PW with CW. */
    258     bcmBFDTunnelTypePweRouterAlert = 8, /* BFD over PW with Router Alert. */
    259     bcmBFDTunnelTypePweTtl = 9,         /* BFD over PW with TTL=1. */
    260     bcmBFDTunnelTypeMplsTpCc = 10,      /* BFD for MPLS-TP proactive CC. */
    261     bcmBFDTunnelTypeMplsTpCcCv = 11,    /* BFD for MPLS-TP proactive CC&CV. */
    262     bcmBFDTunnelTypeGre6In4 = 12,       /* BFD over GRE IPv6-in-IPv4 tunnel. */
    263     bcmBFDTunnelTypeGre4In6 = 13,       /* BFD over GRE IPv4-in-IPv6 tunnel. */
    264     bcmBFDTunnelTypeGre6In6 = 14,       /* BFD over GRE IPv6-in-IPv6 tunnel. */
    265     bcmBFDTunnelTypePweGal = 15,        /* BFD over PW with GAL, GACH. */
    266     bcmBFDTunnelTypeMplsPhp = 16,       /* BFD over MPLS LSP and PHP. */
    267     bcmBFDTunnelTypeCount = 17 
    268 } bcm_bfd_tunnel_type_t;
    269 
    270 /* BFD endpoint ID type. */
    271 typedef int bcm_bfd_endpoint_t;
    272 
    273 /* BFD endpoint object. */
    274 typedef struct bcm_bfd_endpoint_info_s {
    275     uint32 flags;                       /* Control flags. */
    276     bcm_bfd_endpoint_t id;              /* Endpoint identifier. */
    277     bcm_bfd_endpoint_t remote_id;       /* Remote endpoint identifier. */
    278     bcm_bfd_tunnel_type_t type;         /* Type of BFD encapsulation. */
    279     bcm_gport_t gport;                  /* Gport identifier. */
    280     bcm_gport_t tx_gport;               /* TX gport associated with this
    281                                            endpoint. */
    282     bcm_gport_t remote_gport;           /* Gport identifier of trapping
    283                                            destination: OAMP or CPU, local or
    284                                            remote. */
    285     int bfd_period;                     /* For local endpoints, this is the BFD
    286                                            transmission period in ms. */
    287     bcm_vpn_t vpn;                      /* VPN. */
    288     uint8 vlan_pri;                     /* VLAN tag priority. */
    289     uint8 inner_vlan_pri;               /* Inner VLAN tag priority. */
    290     bcm_vrf_t vrf_id;                   /* Vrf identifier. */
    291     bcm_ip_t dst_ip_addr;               /* Destination IPv4 address. */
    292     bcm_ip6_t dst_ip6_addr;             /* Destination IPv6 address. */
    293     bcm_ip_t src_ip_addr;               /* Source IPv4 address. */
    294     bcm_ip6_t src_ip6_addr;             /* Source IPv6 address. */
    295     uint8 ip_tos;                       /* IPv4 Tos / IPv6 Traffic Class. */
    296     uint8 ip_ttl;                       /* IPv4 TTL / IPv6 Hop Count. */
    297     bcm_ip_t inner_dst_ip_addr;         /* Inner destination IPv4 address. */
    298     bcm_ip6_t inner_dst_ip6_addr;       /* Inner destination IPv6 address. */
    299     bcm_ip_t inner_src_ip_addr;         /* Inner source IPv4 address. */
    300     bcm_ip6_t inner_src_ip6_addr;       /* Inner source IPv6 address. */
    301     uint8 inner_ip_tos;                 /* Inner IPv4 Tos / IPv6 Traffic Class. */
    302     uint8 inner_ip_ttl;                 /* Inner IPv4 TTL / IPv6 Hop Count. */
    303     uint32 udp_src_port;                /* UDP source port for Ipv4, Ipv6. */
    304     bcm_mpls_label_t label;             /* Incoming inner label. */
    305     bcm_mpls_egress_label_t egress_label; /* The MPLS outgoing label information. */
    306     bcm_if_t egress_if;                 /* Egress interface. */
    307     uint8 mep_id[BCM_BFD_ENDPOINT_MAX_MEP_ID_LENGTH]; /* MPLS-TP CC/CV TLV and Source MEP ID. */
    308     uint8 mep_id_length;                /* Length of MPLS-TP CC/CV TLV and
    309                                            MEP-ID. */
    310     bcm_cos_t int_pri;                  /* Egress queuing for outgoing BFD to
    311                                            remote. */
    312     uint8 cpu_qid;                      /* CPU queue for BFD. */
    313     bcm_bfd_state_t local_state;        /* Local session state. */
    314     uint32 local_discr;                 /* Local discriminator. */
    315     bcm_bfd_diag_code_t local_diag;     /* Local diagnostic code. */
    316     uint32 local_flags;                 /* Flags combination on outgoing frames. */
    317     uint32 local_min_tx;                /* Desired local min tx interval. */
    318     uint32 local_min_rx;                /* Required local rx interval. */
    319     uint32 local_min_echo;              /* Local minimum echo interval. */
    320     uint8 local_detect_mult;            /* Local detection interval multiplier. */
    321     bcm_bfd_auth_type_t auth;           /* Authentication type. */
    322     uint32 auth_index;                  /* Authentication index. */
    323     uint32 tx_auth_seq;                 /* Tx authentication sequence id. */
    324     uint32 rx_auth_seq;                 /* Rx authentication sequence id. */
    325     uint32 remote_flags;                /* Remote flags. */
    326     bcm_bfd_state_t remote_state;       /* Remote session state. */
    327     uint32 remote_discr;                /* Remote discriminator. */
    328     bcm_bfd_diag_code_t remote_diag;    /* Remote diagnostic code. */
    329     uint32 remote_min_tx;               /* Desired remote min tx interval. */
    330     uint32 remote_min_rx;               /* Required remote rx interval. */
    331     uint32 remote_min_echo;             /* Remote minimum echo interval. */
    332     uint8 remote_detect_mult;           /* Remote detection interval multiplier. */
    333     int sampling_ratio;                 /* 0 - No packets sampled to the CPU.
    334                                            1-8 - Count of packets (with events)
    335                                            that need to arrive before one is
    336                                            sampled to the CPU. */
    337     uint8 loc_clear_threshold;          /* Number of packets required to reset
    338                                            the Loss-of-Continuity status per
    339                                            endpoint. */
    340     uint32 ip_subnet_length;            /* The subnet length for incoming packet
    341                                            validity check. Value 0 indicates no
    342                                            check is performed, positive values
    343                                            indicate the amount of MSBs to be
    344                                            compared. */
    345     uint8 remote_mep_id[BCM_BFD_ENDPOINT_MAX_MEP_ID_LENGTH]; /* MPLS-TP CC/CV TLV and Remote MEP ID. */
    346     uint8 remote_mep_id_length;         /* Length of MPLS-TP CC/CV TLV and
    347                                            REMOTE MEP-ID. */
    348     uint8 mis_conn_mep_id[BCM_BFD_ENDPOINT_MAX_MEP_ID_LENGTH]; /* MPLS-TP CC/CV TLV and Mis
    349                                            connectivity MEP ID. */
    350     uint8 mis_conn_mep_id_length;       /* Length of MPLS-TP CC/CV TLV and Mis
    351                                            connectivity MEP-ID. */
    352     uint32 bfd_detection_time;          /* Optional: BFD Detection Time, in
    353                                            microseconds. */
    354     bcm_vlan_t pkt_vlan_id;             /* TX Packet Vlan Id. */
    355     bcm_vlan_t rx_pkt_vlan_id;          /* RX Packet Vlan Id. */
    356     bcm_mpls_label_t gal_label;         /* MPLS GAL label. */
    357     uint32 faults;                      /* Fault flags. */
    358     uint32 flags2;                      /* Second set of control flags. */
    359     int ipv6_extra_data_index;          /* Pointer to first extended data entry */
    360 } bcm_bfd_endpoint_info_t;
    361 
    362 /* BFD event types. */
    363 typedef enum bcm_bfd_event_type_e {
    364     bcmBFDEventStateChange = 0, 
    365     bcmBFDEventRemoteStateDiag = 1, 
    366     bcmBFDEventSessionDiscriminatorChange = 2, 
    367     bcmBFDEventAuthenticationChange = 3, 
    368     bcmBFDEventParameterChange = 4, 
    369     bcmBFDEventSessionError = 5, 
    370     bcmBFDEventEndpointRemote = 6, 
    371     bcmBFDEventEndpointRemoteUp = 7, 
    372     bcmBFDEventEndpointTimeout = 8, 
    373     bcmBFDEventEndpointTimein = 9, 
    374     bcmBFDEventEndpointTimeoutEarly = 10, 
    375     bcmBFDEventEndpointFlagsChange = 11, 
    376     bcmBFDEventEndpointRemotePollBitSet = 12, 
    377     bcmBFDEventEndpointRemoteFinalBitSet = 13, 
    378     bcmBFDEventEndpointLocalSessionStateAdminDown = 14, 
    379     bcmBFDEventEndpointLocalSessionStateDown = 15, 
    380     bcmBFDEventEndpointLocalSessionStateInit = 16, 
    381     bcmBFDEventEndpointLocalSessionStateUp = 17, 
    382     bcmBFDEventEndpointMisConnectivityDefect = 18, /* Misconnectivity Defect Detected */
    383     bcmBFDEventEndpointMisConnectivityDefectClear = 19, /* Misconnectivity Defect Cleared */
    384     bcmBFDEventEndpoinUnExpectedMeg = 20, /* UnExpectedMeg Defect Detected */
    385     bcmBFDEventEndpoinUnExpectedMegClear = 21, /* UnExpectedMeg Defect Cleared */
    386     bcmBFDEventCount = 22 
    387 } bcm_bfd_event_type_t;
    388 
    389 typedef struct bcm_bfd_event_types_s {
    390     SHR_BITDCL w[_SHR_BITDCLSIZE(bcmBFDEventCount)]; 
    391 } bcm_bfd_event_types_t;
    392 
    393 #define BCM_BFD_EVENT_TYPE_SET(_event_types, _event_type)  SHR_BITSET((_event_types).w, (_event_type)) 
    394 
    395 #define BCM_BFD_EVENT_TYPE_GET(_event_types, _event_type)  SHR_BITGET((_event_types).w, (_event_type)) 
    396 
    397 #define BCM_BFD_EVENT_TYPE_CLEAR(_event_types, _event_type)  SHR_BITCLR((_event_types).w, (_event_type)) 
    398 
    399 #define BCM_BFD_EVENT_TYPE_SET_ALL(_event_types)  SHR_BITSET_RANGE((_event_types).w, 0, bcmBFDEventCount) 
    400 
    401 #define BCM_BFD_EVENT_TYPE_CLEAR_ALL(_event_types)  SHR_BITCLR_RANGE((_event_types).w, 0, bcmBFDEventCount) 
    402 
    403 /* BFD endpoint statistics. */
    404 typedef struct bcm_bfd_endpoint_stat_s {
    405     uint32 packets_in;              /* Total packets in. */
    406     uint32 packets_out;             /* Total packets out. */
    407     uint32 packets_drop;            /* Total packets drop. */
    408     uint32 packets_auth_drop;       /* Packets drop due to authentication
    409                                        failure. */
    410     uint64 packets_in_64;           /* Total packets in 64bit count. */
    411     uint64 packets_out_64;          /* Total packets out 64bit count. */
    412     uint64 packets_drop_64;         /* Total packets drop 64bit count. */
    413     uint64 packets_auth_drop_64;    /* Packets drop due to authentication
    414                                        failure 64bit count. */
    415     uint64 packets_echo_reply;      /* Total number of echo reply packets
    416                                        processed. */
    417 } bcm_bfd_endpoint_stat_t;
    418 
    419 /* BFD Session and Diag status of each endpoint along with endpoint id. */
    420 typedef struct bcm_bfd_status_s {
    421     bcm_bfd_endpoint_t endpoint_id; /* Endpoint identifier. */
    422     uint32 session_status;          /* Session State and diag flags. */
    423 } bcm_bfd_status_t;
    424 
    425 /* Incoming bfd packets discarded statistics. */
    426 typedef struct bcm_bfd_discard_stat_s {
    427     uint32 bfd_ver_err;             /* Invalid BFD Version. */
    428     uint32 bfd_len_err;             /* BFD Length Error. */
    429     uint32 bfd_detect_mult;         /* BFD detect multiplier Zero. */
    430     uint32 bfd_my_disc;             /* BFD My discriminator Zero. */
    431     uint32 bfd_p_f_bit;             /* BFD poll and final bits set. */
    432     uint32 bfd_m_bit;               /* BFD M bit not equal to zero. */
    433     uint32 bfd_auth_type_mismatch;  /* BFD auth type mismatch. */
    434     uint32 bfd_auth_simple_err;     /* BFD auth simple password Error. */
    435     uint32 bfd_auth_m_sha1_err;     /* BFD auth SHA1 error. */
    436     uint32 bfd_sess_mismatch;       /* BFD Session mismatch. */
    437 } bcm_bfd_discard_stat_t;
    438 
    439 #ifndef BCM_HIDE_DISPATCHABLE
    440 
    441 /* Get BFD endpoint statistics. */
    442 extern int bcm_bfd_endpoint_stat_get(
    443     int unit, 
    444     bcm_bfd_endpoint_t endpoint, 
    445     bcm_bfd_endpoint_stat_t *ctr_info, 
    446     uint32 options);
    447 
    448 /* Retrieve all required Session status for valid BFD end points. */
    449 extern int bcm_bfd_status_multi_get(
    450     int unit, 
    451     int max_endpoints, 
    452     bcm_bfd_status_t *status_arr, 
    453     int *count);
    454 
    455 #endif /* BCM_HIDE_DISPATCHABLE */
    456 
    457 /* Callback function type for BFD event handling. */
    458 typedef int (*bcm_bfd_event_cb)(
    459     int unit, 
    460     uint32 flags, 
    461     bcm_bfd_event_types_t events, 
    462     bcm_bfd_endpoint_t endpoint, 
    463     void *user_data);
    464 
    465 #ifndef BCM_HIDE_DISPATCHABLE
    466 
    467 /* Initialize the BFD subsystem. */
    468 extern int bcm_bfd_init(
    469     int unit);
    470 
    471 /* Shut down the BFD subsystem. */
    472 extern int bcm_bfd_detach(
    473     int unit);
    474 
    475 #endif /* BCM_HIDE_DISPATCHABLE */
    476 
    477 /* Initialize an BFD endpoint info structure. */
    478 extern void bcm_bfd_endpoint_info_t_init(
    479     bcm_bfd_endpoint_info_t *endpoint_info);
    480 
    481 #ifndef BCM_HIDE_DISPATCHABLE
    482 
    483 /* Create or replace an BFD endpoint object. */
    484 extern int bcm_bfd_endpoint_create(
    485     int unit, 
    486     bcm_bfd_endpoint_info_t *endpoint_info);
    487 
    488 /* Get an BFD endpoint object. */
    489 extern int bcm_bfd_endpoint_get(
    490     int unit, 
    491     bcm_bfd_endpoint_t endpoint, 
    492     bcm_bfd_endpoint_info_t *endpoint_info);
    493 
    494 /* Start Transmission of BFD PDUs. */
    495 extern int bcm_bfd_tx_start(
    496     int unit);
    497 
    498 /* Stop Transmission of BFD PDUs. */
    499 extern int bcm_bfd_tx_stop(
    500     int unit);
    501 
    502 /* Destroy an BFD endpoint object. */
    503 extern int bcm_bfd_endpoint_destroy(
    504     int unit, 
    505     bcm_bfd_endpoint_t endpoint);
    506 
    507 /* Destroy all BFD endpoint objects. */
    508 extern int bcm_bfd_endpoint_destroy_all(
    509     int unit);
    510 
    511 /* Register a callback for handling BFD events. */
    512 extern int bcm_bfd_event_register(
    513     int unit, 
    514     bcm_bfd_event_types_t event_types, 
    515     bcm_bfd_event_cb cb, 
    516     void *user_data);
    517 
    518 /* Unregister a callback for handling BFD events. */
    519 extern int bcm_bfd_event_unregister(
    520     int unit, 
    521     bcm_bfd_event_types_t event_types, 
    522     bcm_bfd_event_cb cb);
    523 
    524 /* 
    525  * Poll an BFD endpoint object.  Valid only for BFD sessions in Demand
    526  * Mode.
    527  */
    528 extern int bcm_bfd_endpoint_poll(
    529     int unit, 
    530     bcm_bfd_endpoint_t endpoint);
    531 
    532 /* Set SHA1 authentication entry. */
    533 extern int bcm_bfd_auth_sha1_set(
    534     int unit, 
    535     int index, 
    536     bcm_bfd_auth_sha1_t *sha1);
    537 
    538 /* Get SHA1 authentication entry. */
    539 extern int bcm_bfd_auth_sha1_get(
    540     int unit, 
    541     int index, 
    542     bcm_bfd_auth_sha1_t *sha1);
    543 
    544 /* Set Simple Password authentication entry. */
    545 extern int bcm_bfd_auth_simple_password_set(
    546     int unit, 
    547     int index, 
    548     bcm_bfd_auth_simple_password_t *sp);
    549 
    550 /* Get Simple Password authentication entry. */
    551 extern int bcm_bfd_auth_simple_password_get(
    552     int unit, 
    553     int index, 
    554     bcm_bfd_auth_simple_password_t *sp);
    555 
    556 /* Clear the bfd discarded statistics in FW. */
    557 extern int bcm_bfd_discard_stat_set(
    558     int unit, 
    559     bcm_bfd_discard_stat_t *discarded_info);
    560 
    561 /* Get the bfd discarded statistics from FW. */
    562 extern int bcm_bfd_discard_stat_get(
    563     int unit, 
    564     bcm_bfd_discard_stat_t *discarded_info);
    565 
    566 #endif /* defined(INCLUDE_BFD) */
    567 
    568 #endif /* BCM_HIDE_DISPATCHABLE */
    569 
    570 #endif /* __BCM_BFD_H__ */