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

eth_lm_dm.h (4274B)


      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:    eth_lm_dm.h
      8  * Purpose: ETH_LM_DM definitions common to SDK and uKernel
      9  */
     10 
     11 #ifndef _SOC_SHARED_ETH_LM_DM_H
     12 #define _SOC_SHARED_ETH_LM_DM_H
     13 
     14 #ifdef BCM_UKERNEL
     15   /* Build for uKernel not SDK */
     16   #include "sdk_typedefs.h"
     17 #else
     18   #include <sal/types.h>
     19 #endif
     20 
     21 
     22 
     23 /*****************************************
     24  * ETH_LM_DM uController Error codes
     25  */
     26 typedef enum shr_eth_lm_dm_uc_error_e {
     27     SHR_ETH_LM_DM_UC_E_NONE = 0,
     28     SHR_ETH_LM_DM_UC_E_INTERNAL,
     29     SHR_ETH_LM_DM_UC_E_MEMORY,
     30     SHR_ETH_LM_DM_UC_E_PARAM,
     31     SHR_ETH_LM_DM_UC_E_RESOURCE,
     32     SHR_ETH_LM_DM_UC_E_EXISTS,
     33     SHR_ETH_LM_DM_UC_E_NOT_FOUND,
     34     SHR_ETH_LM_DM_UC_E_UNAVAIL,
     35     SHR_ETH_LM_DM_UC_E_VERSION,
     36     SHR_ETH_LM_DM_UC_E_INIT
     37 } shr_eth_lm_dm_uc_error_t;
     38 
     39 #define SHR_ETH_LM_DM_UC_SUCCESS(rv)              ((rv) == SHR_ETH_LM_DM_UC_E_NONE)
     40 #define SHR_ETH_LM_DM_UC_FAILURE(rv)              ((rv) != SHR_ETH_LM_DM_UC_E_NONE)
     41 
     42 /*
     43  * Macro:
     44  *      SHR_ETH_LM_DM_IF_ERROR_RETURN
     45  * Purpose:
     46  *      Evaluate _op as an expression, and if an error, return.
     47  * Notes:
     48  *      This macro uses a do-while construct to maintain expected
     49  *      "C" blocking, and evaluates "op" ONLY ONCE so it may be
     50  *      a function call that has side affects.
     51  */
     52 
     53 #define SHR_ETH_LM_DM_IF_ERROR_RETURN(op)                                     \
     54     do {                                                                \
     55         int __rv__;                                                     \
     56         if ((__rv__ = (op)) != SHR_ETH_LM_DM_UC_E_NONE) {                     \
     57             return(__rv__);                                             \
     58         }                                                               \
     59     } while(0)
     60 
     61 /*
     62  * ETH_LM_DM Session Set flags
     63  */
     64 #define SHR_ETH_LM_DM_SESS_SET_F_CREATE               0x00000001
     65 #define SHR_ETH_LM_DM_SESS_SET_F_PERIOD               0x00000002
     66 #define SHR_ETH_LM_DM_SESS_SET_F_LM                   0x00000004
     67 #define SHR_ETH_LM_DM_SESS_SET_F_DM                   0x00000008
     68 #define SHR_ETH_LM_DM_SESS_SET_F_PASSIVE              0x00000010
     69 #define SHR_ETH_LM_DM_SESS_SET_F_SLM                  0x00000020
     70 
     71 
     72 /*
     73  * ETH_LM_DM Encapsulation types
     74  */
     75 #define SHR_ETH_LM_DM_ENCAP_TYPE_RAW      0
     76 
     77 /*
     78  * Op Codes
     79  */
     80 
     81 #define SHR_ETH_LM_DM_OPCODE_LMM 43
     82 #define SHR_ETH_LM_DM_OPCODE_LMR 42
     83 #define SHR_ETH_LM_DM_OPCODE_1DM 45
     84 #define SHR_ETH_LM_DM_OPCODE_DMM 47
     85 #define SHR_ETH_LM_DM_OPCODE_DMR 46
     86 #define SHR_ETH_LM_DM_OPCODE_SLM 55
     87 #define SHR_ETH_LM_DM_OPCODE_SLR 54
     88 #define SHR_ETH_LM_DM_OPCODE_CFS XX
     89 
     90 /*
     91  * Flags
     92  */
     93 #define BCM_ETH_INC_REQUESTING_MEP_TLV         0x00000001
     94 #define BCM_ETH_LM_SLM			               0x00000002
     95 #define BCM_ETH_LM_SINGLE_ENDED                0x00000004
     96 #define BCM_ETH_DM_ONE_WAY                     0x00000008
     97 #define BCM_ETH_LM_TX_ENABLE                   0x00000010
     98 #define BCM_ETH_DM_TX_ENABLE                   0x00000020
     99 #define BCM_ETH_LM_UPDATE					   0x00000040
    100 #define BCM_ETH_DM_UPDATE					   0x00000080
    101 
    102 
    103 
    104  /*
    105   * Replacement type in OLP Tx header
    106   */
    107 /* OAM Replacement types */
    108 #define BCM_ETH_LM_DM_RPL_TYPE_NONE        0 
    109 #define BCM_ETH_LM_DM_RPL_TYPE_PTP_DM      1 
    110 #define BCM_ETH_LM_DM_RPL_TYPE_NTP_DM      2 
    111 #define BCM_ETH_LM_DM_RPL_TYPE_LM          3 
    112 
    113 
    114 /*
    115  * Macro:
    116  *      SHR_ETH_LM_DM_IF_ERROR_RETURN
    117  * Purpose:
    118  *      Evaluate _op as an expression, and if an error, return.
    119  * Notes:
    120  *      This macro uses a do-while construct to maintain expected
    121  *      "C" blocking, and evaluates "op" ONLY ONCE so it may be
    122  *      a function call that has side affects.
    123  */
    124 
    125 #define SHR_ETH_LM_DM_IF_ERROR_RETURN(op)                                     \
    126     do {                                                                \
    127         int __rv__;                                                     \
    128         if ((__rv__ = (op)) != SHR_ETH_LM_DM_UC_E_NONE) {                     \
    129             return(__rv__);                                             \
    130         }                                                               \
    131     } while(0)
    132 
    133 #endif /* _SOC_SHARED_ETH_LM_DM_H */