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


      1 /*
      2  * 
      3  * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file.
      4  * 
      5  * Copyright 2007-2019 Broadcom Inc. All rights reserved.
      6  *
      7  * File:    bhh.h
      8  * Purpose: BHH definitions common to SDK and uKernel
      9  *
     10  * Notes:   Definition changes should be avoided in order to
     11  *          maintain compatibility between SDK and uKernel since
     12  *          both images are built and loaded separately.
     13  */
     14 
     15 #ifndef _SOC_SHARED_BHH_H
     16 #define _SOC_SHARED_BHH_H
     17 
     18 #ifdef BCM_UKERNEL
     19   /* Build for uKernel not SDK */
     20   #include "sdk_typedefs.h"
     21 #else
     22   #include <sal/types.h>
     23 #endif
     24 
     25 
     26 
     27 /*****************************************
     28  * BHH uController Error codes
     29  */
     30 typedef enum shr_bhh_uc_error_e {
     31     SHR_BHH_UC_E_NONE      = 0,
     32     SHR_BHH_UC_E_INTERNAL  = 1,
     33     SHR_BHH_UC_E_MEMORY    = 2,
     34     SHR_BHH_UC_E_PARAM     = 3,
     35     SHR_BHH_UC_E_RESOURCE  = 4,
     36     SHR_BHH_UC_E_EXISTS    = 5,
     37     SHR_BHH_UC_E_NOT_FOUND = 6,
     38     SHR_BHH_UC_E_UNAVAIL   = 7,
     39     SHR_BHH_UC_E_VERSION   = 8,
     40     SHR_BHH_UC_E_INIT      = 9
     41 } shr_bhh_uc_error_t;
     42 
     43 /*
     44  * BHH message types
     45  */
     46 typedef enum shr_bhh_msg_type_e {
     47     BHH_CCM_MSG,
     48     BHH_LB_MSG,
     49     BHH_DM_MSG,
     50     BHH_LM_MSG,
     51     BHH_CSF_MSG,
     52     BHH_MAX_MSG_TYPE
     53 } shr_bhh_msg_type_t;
     54 
     55 /*
     56  * BHH endpoint types
     57  */
     58 typedef enum shr_bhh_endpoint_type_e {
     59     _SHR_BHH_EP_TYPE_PW_VCCV_1,
     60     _SHR_BHH_EP_TYPE_PW_VCCV_2,
     61     _SHR_BHH_EP_TYPE_PW_VCCV_3,
     62     _SHR_BHH_EP_TYPE_PW_VCCV_4,
     63     _SHR_BHH_EP_TYPE_LSP,
     64     _SHR_BHH_EP_TYPE_PORT_SECTION,
     65     _SHR_BHH_EP_TYPE_PORT_SECTION_OUTERVLAN,
     66     _SHR_BHH_EP_TYPE_PORT_SECTION_INNERVLAN,
     67     _SHR_BHH_EP_TYPE_PORT_SECTION_OUTER_PLUS_INNERVLAN,
     68     _SHR_BHH_EP_TYPE_MAX
     69 } shr_bhh_endpoint_type_t;
     70 
     71 #define SHR_BHH_UC_SUCCESS(rv)              ((rv) == SHR_BHH_UC_E_NONE)
     72 #define SHR_BHH_UC_FAILURE(rv)              ((rv) != SHR_BHH_UC_E_NONE)
     73 
     74 /*
     75  * Macro:
     76  *      SHR_BHH_IF_ERROR_RETURN
     77  * Purpose:
     78  *      Evaluate _op as an expression, and if an error, return.
     79  * Notes:
     80  *      This macro uses a do-while construct to maintain expected
     81  *      "C" blocking, and evaluates "op" ONLY ONCE so it may be
     82  *      a function call that has side affects.
     83  */
     84 
     85 #define SHR_BHH_IF_ERROR_RETURN(op)                                     \
     86     do {                                                                \
     87         int __rv__;                                                     \
     88         if ((__rv__ = (op)) != SHR_BHH_UC_E_NONE) {                     \
     89             return(__rv__);                                             \
     90         }                                                               \
     91     } while(0)
     92 
     93 /*
     94  * BHH Session Set flags
     95  */
     96 #define SHR_BHH_SESS_SET_F_CREATE               0x00000001
     97 #define SHR_BHH_SESS_SET_F_LOCAL_DISC           0x00000002
     98 #define SHR_BHH_SESS_SET_F_PERIOD               0x00000004
     99 #define SHR_BHH_SESS_SET_F_LOCAL_MIN_RX         0x00000008
    100 #define SHR_BHH_SESS_SET_F_LOCAL_MIN_ECHO_RX    0x00000010
    101 #define SHR_BHH_SESS_SET_F_LOCAL_DIAG           0x00000020
    102 #define SHR_BHH_SESS_SET_F_LOCAL_DEMAND         0x00000040
    103 #define SHR_BHH_SESS_SET_F_LOCAL_DETECT_MULT    0x00000080
    104 #define SHR_BHH_SESS_SET_F_SESSION_DESTROY      0x00000100
    105 #define SHR_BHH_SESS_SET_F_SHA1_XMT_SEQ_INCR    0x00000200
    106 #define SHR_BHH_SESS_SET_F_ENCAP                0x00000400
    107 #define SHR_BHH_SESS_SET_F_CCM                  0x00001000
    108 #define SHR_BHH_SESS_SET_F_LB                   0x00002000
    109 #define SHR_BHH_SESS_SET_F_LM                   0x00004000
    110 #define SHR_BHH_SESS_SET_F_DM                   0x00008000
    111 #define SHR_BHH_SESS_SET_F_MIP                  0x00010000
    112 #define SHR_BHH_SESS_SET_F_PASSIVE              0x00020000
    113 #define SHR_BHH_SESS_SET_F_RDI                  0x00040000
    114 
    115 /*
    116  * BHH Encapsulation types
    117  */
    118 #define SHR_BHH_ENCAP_TYPE_RAW      0
    119 
    120 /*
    121  * Op Codes
    122  */
    123 #define SHR_BHH_OPCODE_CCM 1
    124 #define SHR_BHH_OPCODE_LBM 3
    125 #define SHR_BHH_OPCODE_LBR 2
    126 #define SHR_BHH_OPCODE_AIS 33
    127 #define SHR_BHH_OPCODE_LCK 35
    128 #define SHR_BHH_OPCODE_LMM 43
    129 #define SHR_BHH_OPCODE_LMR 42
    130 #define SHR_BHH_OPCODE_1DM 45
    131 #define SHR_BHH_OPCODE_DMM 47
    132 #define SHR_BHH_OPCODE_DMR 46
    133 #define SHR_BHH_OPCODE_CSF 52
    134 #define SHR_BHH_OPCODE_SLM 55
    135 #define SHR_BHH_OPCODE_SLR 54
    136 
    137 /*
    138  * CSF type
    139  */
    140 #define SHR_CSF_TYPE_LOS 0
    141 #define SHR_CSF_TYPE_FDI 1
    142 #define SHR_CSF_TYPE_RDI 2
    143 #define SHR_CSF_TYPE_DCI 3
    144 
    145 /*
    146  * Flags
    147  */
    148 #define BCM_BHH_INC_REQUESTING_MEP_TLV         0x00000001
    149 #define BCM_BHH_LBM_INGRESS_DISCOVERY_MEP_TLV  0x00000010
    150 #define BCM_BHH_LBM_EGRESS_DISCOVERY_MEP_TLV   0x00000020
    151 #define BCM_BHH_LBM_ICC_MEP_TLV                0x00000040
    152 #define BCM_BHH_LBM_ICC_MIP_TLV                0x00000080
    153 #define BCM_BHH_LBR_ICC_MEP_TLV                0x00000100
    154 #define BCM_BHH_LBR_ICC_MIP_TLV                0x00000200
    155 #define BCM_BHH_LM_SINGLE_ENDED                0x00000400
    156 #define BCM_BHH_DM_ONE_WAY                     0x00000800
    157 #define BCM_BHH_LM_TX_ENABLE                   0x00001000
    158 #define BCM_BHH_DM_TX_ENABLE                   0x00002000
    159 #define BCM_BHH_LM_SLM                         0x00004000
    160 #define BCM_BHH_TX_ENABLE                      0x00008000
    161 
    162  /*
    163  */
    164 #define BCM_BHH_DM_TYPE_NTP                0
    165 #define BCM_BHH_DM_TYPE_PTP                1
    166 
    167 /*
    168  * Macro:
    169  *      SHR_BHH_IF_ERROR_RETURN
    170  * Purpose:
    171  *      Evaluate _op as an expression, and if an error, return.
    172  * Notes:
    173  *      This macro uses a do-while construct to maintain expected
    174  *      "C" blocking, and evaluates "op" ONLY ONCE so it may be
    175  *      a function call that has side affects.
    176  */
    177 
    178 #define SHR_BHH_IF_ERROR_RETURN(op)                                     \
    179     do {                                                                \
    180         int __rv__;                                                     \
    181         if ((__rv__ = (op)) != SHR_BHH_UC_E_NONE) {                     \
    182             return(__rv__);                                             \
    183         }                                                               \
    184     } while(0)
    185 
    186 #define SHR_BHH_SESSION_UPDATE_CCM_RDI               0x00000001
    187 #define SHR_BHH_SESSION_UPDATE_ENCAP                 0x00000002
    188 #define SHR_BHH_SESSION_UPDATE_PROACTIVE_LM_ENABLE   0x00000004
    189 #define SHR_BHH_SESSION_UPDATE_PROACTIVE_LM_DISABLE  0x00000008
    190 
    191 #endif /* _SOC_SHARED_BHH_H */