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

bhh.h (14001B)


      1 
      2 /*
      3  * 
      4  * 
      5  * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file.
      6  * 
      7  * Copyright 2007-2019 Broadcom Inc. All rights reserved.
      8  */
      9 #ifndef __BCM_INT_ESW_BHH_H__
     10 #define __BCM_INT_ESW_BHH_H__
     11 #if defined(INCLUDE_BHH)
     12 
     13 #include <soc/uc_msg.h>
     14 #include <soc/shared/mos_msg_common.h>
     15 #include <soc/shared/bhh.h>
     16 #include <soc/shared/bhh_pkt.h>
     17 #include <soc/shared/bhh_msg.h>
     18 #include <soc/shared/bhh_pack.h>
     19 
     20 #include <bcm_int/common/rx.h>
     21 #include <bcm/oam.h>
     22 
     23 #if defined(BCM_TRIUMPH_SUPPORT)
     24 #include <bcm_int/esw/triumph.h>
     25 #endif /* BCM_TRIUMPH_SUPPORT */
     26 
     27 /*
     28  * BHH Encapsulation Definitions
     29  *
     30  * Defines for building the BHH packet encapsulation
     31  */
     32 
     33 #define BHH_THREAD_PRI_DFLT     200
     34 #define BCM_KT_BHH_RX_CHANNEL    1 /* this rx dma channel is shared with BFD */
     35 #define BCM_BHH_ENDPOINT_MAX_MEP_ID_LENGTH 32
     36 
     37 /**************************************************************************************/
     38 #define _BHH_UC_MSG_TIMEOUT_USECS          5000000     /* 5 seconds for FW response */
     39 
     40 #define BCM_BHH_ENDPOINT_PASSIVE            0x0004     /* Specifies endpoint
     41                                                           takes passive role */
     42 #define BCM_BHH_ENDPOINT_DEMAND             0x0008     /* Specifies local*/
     43 #define BCM_BHH_ENDPOINT_ENCAP_SET          0x0010     /* Update encapsulation
     44                                                           on existing BFD
     45                                                           endpoint */
     46 /*
     47  * BHH Encapsulation Format Header flags
     48  *
     49  * Indicates the type of headers/labels present in a BHH packet.
     50  */
     51 #define _BHH_ENCAP_PKT_MPLS                    (1 << 0) 
     52 #define _BHH_ENCAP_PKT_MPLS_ROUTER_ALERT       (1 << 1) 
     53 #define _BHH_ENCAP_PKT_MPLS_BOTTOM             (1 << 2) 
     54 #define _BHH_ENCAP_PKT_PW                      (1 << 3) 
     55 #define _BHH_ENCAP_PKT_GAL                     (1 << 4) 
     56 #define _BHH_ENCAP_PKT_G_ACH                   (1 << 5) 
     57 #define _BHH_ENCAP_PKT_BHH                     (1 << 11)
     58 
     59 
     60 /*
     61  * Macros to pack uint8, uint16, uint32 in Network byte order
     62  */
     63 #define _BHH_ENCAP_PACK_U8(_buf, _var)   SHR_BHH_ENCAP_PACK_U8(_buf, _var)
     64 #define _BHH_ENCAP_PACK_U16(_buf, _var)  SHR_BHH_ENCAP_PACK_U16(_buf, _var)
     65 #define _BHH_ENCAP_PACK_U32(_buf, _var)  SHR_BHH_ENCAP_PACK_U32(_buf, _var)
     66 
     67 #define _BHH_MAC_ADDR_LENGTH    (sizeof(bcm_mac_t))
     68 #define _BHH_VLAN_MASK    0x00000FFF
     69 
     70 #define _BHH_MPLS_MAX_LABELS    4   /* Max MPLS labels in Katana */
     71 #define _BHH_FP_OAM_MPLS_MAX_LABELS    9   /* Max MPLS labels in Apache */
     72 
     73 #define _BHH_MPLS_DFLT_TTL      16
     74 
     75 /* Group ID + Endpoint Name + Level + Gport + VID(outer + inner) + MPLS label*/
     76 #define _BHH_FP_OAM_HASH_KEY_SIZE (sizeof(bcm_oam_group_t)         +   \
     77                                    sizeof(uint16)                  +   \
     78                                    sizeof(int)                     +   \
     79                                    sizeof(bcm_gport_t)             +   \
     80                                    sizeof(bcm_vlan_t)              +   \
     81                                    sizeof(bcm_vlan_t)              +   \
     82                                    sizeof(bcm_mpls_label_t))
     83 
     84 typedef uint8 _bhh_fp_oam_hash_key_t[_BHH_FP_OAM_HASH_KEY_SIZE];
     85 
     86 #define _BHH_FP_OAM_INVALID_LMEP_ID     (-1)
     87 
     88 #define _BCM_OAM_BHH_DEFAULT_ENCAP_LENGTH 76 /* OLP Tx(34)        + L2(22) +
     89                                                 4 MPLS labels(16) + ACH(4) */
     90 #define _BCM_OAM_BHH_MAX_ENCAP_LENGTH 96     /* OLP Tx(34)        + L2(22) +
     91                                                 9 MPLS labels(36) + ACH(4) */
     92 
     93 /*
     94  * Typedef:
     95  *     _bcm_oam_hash_data_t
     96  * Purpose:
     97  *     Endpoint hash table data structure.
     98  */
     99 typedef struct _bhh_fp_oam_ep_data_s {
    100     int in_use;                             /* Endpoint status */
    101     bcm_oam_endpoint_type_t type;           /* Endpoint Type */
    102     bcm_oam_endpoint_t  ep_id;              /* Endpoint ID                   */
    103     uint8               is_remote;          /* Local or Remote MEP.          */
    104     uint16              name;               /* Endpoint name.                */
    105     uint8               level;              /* Maintenance domain level.     */
    106     bcm_vlan_t          vlan;               /* Vlan membership.              */
    107     bcm_vlan_t          inner_vlan;         /* C Vlan membership -when double
    108                                                                        tagged*/
    109     bcm_gport_t         gport;              /* Sw Generic Port.              */
    110     uint32              sglp;               /* Hw Src GLP CCM Rx port/trunk. */
    111     uint32              dglp;               /* Hw Dest GLP for CCM Tx.       */
    112     bcm_oam_group_t     group_index;        /* Group ID.                     */
    113     int                 remote_index;       /* RMEP entry hardware index.    */
    114     int                 lm_counter_index;   /* LM counter index.             */
    115     uint32              vp;                 /* Virtual Port.                 */
    116     uint32              flags;              /* Endpoint flags.               */
    117     uint32              flags2;             /* Endpoint flags2.              */
    118     uint32              period;             /* CCM interval encoding.        */
    119     bcm_mpls_label_t    label;              /* incoming inner label for
    120                                                either LSP or PW      */
    121     uint8               vlan_pri;           /* VLAN tag priority             */ 
    122     bcm_if_t            egress_if;          /* egress interface              */
    123     bcm_cos_t           int_pri;            /* internal priority for
    124                                                outgoing CCM packets          */
    125     int                 trunk_index;        /* The trunk port index for this
    126                                                endpoint */
    127     int                 outer_tpid;         /* Outer TPID value              */
    128     int                 inner_tpid;         /* Inner TPID value              */
    129     bcm_trunk_t         trunk_id;            /* Trunk ID of the gport        */
    130     uint32              int_flags;           /* Internal flags required for
    131                                                 indicating special cases */
    132     bcm_mac_t           src_mac_address;    /* The source MAC address associated
    133                                                with this endpoint */
    134     bcm_mac_t           dst_mac_address;    /* The destination MAC address
    135                                                associated with this endpoint */
    136     uint8               inner_vlan_pri;     /* Inner VLAN tag priority       */
    137     uint32              uc_session_id;      /* Session Id on UC for this EP */
    138     bcm_mpls_label_t    egr_label;          /* Outgoing label for BHH */
    139     uint8               egr_label_exp;      /* Outgoing exp for MPLS Label */
    140     uint8               egr_label_ttl;      /* Outgoing ttl for MPLS Label */
    141     bcm_oam_vccv_type_t vccv_type;          /* VCCV pseudowire type          */
    142     bcm_vpn_t           vpn;
    143     bcm_oam_pm_profile_t pm_profile_attached;
    144     /*As FW will not store exact software counters passed during API calls 
    145       storing in SDK for get operations*/
    146     uint32 ccm_tx_update_lm_counter_base_id [BCM_OAM_LM_COUNTER_MAX]; 
    147                                             /* Base LM counter id to be */
    148                                             /*incremented by Tx CCM packets */
    149     uint32 ccm_tx_update_lm_counter_offset[BCM_OAM_LM_COUNTER_MAX]; 
    150                                             /* Offset to the Base LM counter */
    151                                             /*Id to be incremented by Tx */
    152                                             /*CCM packets */
    153     uint8 ccm_tx_counter_size;              /* Number of LM counters to be */
    154                                             /*incremented by Tx CCM packets */
    155     uint32 lm_counter_base_id [BCM_OAM_LM_COUNTER_MAX]; 
    156                                             /* Base LM counter id to be */
    157                                             /*incremented by Tx LM packets */
    158     uint32 lm_counter_offset[BCM_OAM_LM_COUNTER_MAX]; 
    159                                             /* Offset to the Base LM counter */
    160                                             /*Id to be incremented by Tx */
    161                                             /*LM packets */
    162     uint32 lm_counter_action[BCM_OAM_LM_COUNTER_MAX];/*Action assoiciated with 
    163                                                        each LM counter*/ 
    164     uint8 lm_counter_size;                  /* Number of LM counters to be */
    165                                             /*incremented by Tx LM packets */
    166     uint32 lb_tx_update_lm_counter_base_id [BCM_OAM_LM_COUNTER_MAX]; 
    167                                             /* Base LM counter id to be */
    168                                             /*incremented by Tx LB packets */
    169     uint32 lb_tx_update_lm_counter_offset[BCM_OAM_LM_COUNTER_MAX]; 
    170                                             /* Offset to the Base LM counter */
    171                                             /*Id to be incremented by Tx */
    172                                             /*LB packets */
    173     uint8 lb_tx_counter_size;              /* Number of LM counters to be */
    174                                             /*incremented by Tx LB packets */
    175     uint32 dm_tx_update_lm_counter_base_id [BCM_OAM_LM_COUNTER_MAX]; 
    176                                             /* Base LM counter id to be */
    177                                             /*incremented by Tx DM packets */
    178     uint32 dm_tx_update_lm_counter_offset[BCM_OAM_LM_COUNTER_MAX]; 
    179                                             /* Offset to the Base LM counter */
    180                                             /*Id to be incremented by Tx */
    181                                             /*DM packets */
    182     uint8 dm_tx_counter_size;              /* Number of LM counters to be */
    183                                             /*incremented by Tx DM packets */
    184     uint32 csf_tx_update_lm_counter_base_id [BCM_OAM_LM_COUNTER_MAX];
    185                                             /* Base LM counter id to be */
    186                                             /*incremented by Tx CSF packets */
    187     uint32 csf_tx_update_lm_counter_offset[BCM_OAM_LM_COUNTER_MAX];
    188                                             /* Offset to the Base LM counter */
    189                                             /*Id to be incremented by Tx */
    190                                             /*CSF packets */
    191     uint8 csf_tx_counter_size;              /* Number of LM counters to be */
    192                                             /*incremented by Tx CSF packets */
    193     uint32              hw_session_id;      /* HW provided Session Id */
    194     uint8               hw_session_num_entries; /* HW provided number of */
    195                                                 /* Session Ids */
    196     bcm_gport_t         resolved_trunk_gport;/* Resolved Trunk SW Generic Port*/
    197 }_bhh_fp_oam_ep_data_t;
    198 
    199 /* BHH Group data */
    200 typedef struct _bhh_fp_oam_group_data_s {
    201     int         in_use;                         /* Group status */
    202     uint32      flags;                          /* Group Flags */
    203     int         group_id;                       /* Group id */
    204     int         lmep_id;                        /* LMEP IDx */
    205     uint32      faults;                         /* Group Faults */
    206     uint8       name[BCM_OAM_GROUP_NAME_LENGTH];/* Group name */
    207 } _bhh_fp_oam_group_data_t;
    208 
    209 
    210 /* BHH LM/DM information */
    211 typedef struct  _bhh_oam_lm_dm_info_s {
    212     uint32 counter_base_id [BCM_OAM_LM_COUNTER_MAX]; 
    213                                             /* Base LM counter id to be */
    214                                             /*incremented by Tx packets */
    215     uint32 counter_offset[BCM_OAM_LM_COUNTER_MAX]; 
    216                                             /* Offset to the Base LM counter */
    217                                             /*Id to be incremented by Tx */
    218                                             /*packets */
    219     int    counter_action[BCM_OAM_LM_COUNTER_MAX];/* Counter action */
    220     uint32 byte_count_offset[BCM_OAM_LM_COUNTER_MAX]; /* Byte count offset*/
    221     uint8 counter_size;              /* Number of LM counters to be */
    222                                      /*incremented by Tx packets */
    223     uint8 ts_mode;   /* Timestamp mode */
    224     uint8 oam_replacement_offset;   /*Offset to placement of counter/timestamp*/
    225 } _bhh_oam_lm_dm_info_t;
    226 
    227 /* ACH TLV Header */
    228 typedef struct _ach_tlv_s {
    229     struct {
    230         uint16  length;      /* 16: Length (octets) of following TLVs */
    231         uint16  reserved;    /* 16: Reserved, must be 0 */
    232     } header;
    233     uint8 tlv[BCM_BHH_ENDPOINT_MAX_MEP_ID_LENGTH];
    234 } _ach_tlv_t;
    235 
    236 /* ACH - Associated Channel Header */
    237 typedef struct _ach_header_s {
    238     uint8   f_nibble;        /*  4: First nibble, must be 1 */
    239     uint8   version;         /*  4: Version */
    240     uint8   reserved;        /*  8: Reserved */
    241     uint16  channel_type;    /* 16: Channel Type */
    242 } _ach_header_t;
    243 
    244 /* MPLS - Multiprotocol Label Switching Label */
    245 typedef struct _mpls_label_s {
    246     uint32  label;    /* 20: Label */
    247     uint8   exp;      /*  3: Experimental, Traffic Class, ECN */
    248     uint8   s;        /*  1: Bottom of Stack */
    249     uint8   ttl;      /*  8: Time to Live */
    250 } _mpls_label_t;
    251 
    252 /* VLAN Tag - 802.1Q */
    253 typedef struct _vlan_tag_s {
    254     uint16      tpid;    /* 16: Tag Protocol Identifier */
    255     struct {
    256         uint8   prio;    /*  3: Priority Code Point */
    257         uint8   cfi;     /*  1: Canonical Format Indicator */
    258         uint16  vid;     /* 12: Vlan Identifier */
    259     } tci;               /* Tag Control Identifier */
    260 } _vlan_tag_t;
    261 
    262 /* L2 Header */
    263 typedef struct _l2_header_t {
    264     bcm_mac_t    dst_mac;        /* 48: Destination MAC */
    265     bcm_mac_t    src_mac;        /* 48: Source MAC */
    266     _vlan_tag_t  vlan_tag;       /* VLAN Tag */
    267     _vlan_tag_t  vlan_tag_inner; /* Inner VLAN Tag */
    268     uint16       etype;          /* 16: Ether Type */
    269 } _l2_header_t;
    270 
    271 
    272 #endif 
    273 #endif