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

feature.h (7118B)


      1 /*! \file feature.h
      2  *
      3  * LTSW feature header file.
      4  * This file contains the definitions of feature.
      5  */
      6 /*
      7  * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file.
      8  * 
      9  * Copyright 2007-2020 Broadcom Inc. All rights reserved.
     10  */
     11 
     12 #ifndef BCMI_LTSW_FEATURE_H
     13 #define BCMI_LTSW_FEATURE_H
     14 
     15 #include <sal/sal_types.h>
     16 
     17 /*!
     18  * \brief Device features which are shared across all device families.
     19  *
     20  * This data structure is used to define enums of the form ltsw_feature_t,
     21  * and a corresponding list of string name. New additions should be made
     22  * in the following section between the zero and count entries.
     23  */
     24 #define LTSW_FEAT_ENUM_BEGIN(etype)  typedef enum etype##e {
     25 #define LTSW_FEAT_ENUM_END(etype)    } etype##t
     26 #define LTSW_FEAT_ENTRY(e)           LTSW_FEAT_MAKE_STR(e)
     27 #define LTSW_FEAT_MAKE_ENUM(e)       \
     28         LTSW_FEAT_ENUM_BEGIN(e)      \
     29         LTSW_FEAT_ENTRIES(dont_care) \
     30         LTSW_FEAT_ENUM_END(e)
     31 
     32 #define LTSW_FEAT_ENTRIES(DONT_CARE)                                           \
     33 LTSW_FEAT_ENTRY(ZERO),              /*! ALWAYS FIRST PLEASE (DO NOT CHANGE) */ \
     34 LTSW_FEAT_ENTRY(L3),                /*! L3 feature. */                         \
     35 LTSW_FEAT_ENTRY(L3_FIB),            /*! L3 FIB lookup feature. */              \
     36 LTSW_FEAT_ENTRY(MPLS),              /*! MPLS feature. */                       \
     37 LTSW_FEAT_ENTRY(MPLS_VLAN_DOMAIN),  /*! Use vlan as MPLS forwarding domain. */ \
     38 LTSW_FEAT_ENTRY(MPLS_SPECIAL_LABEL),/*! Special label control. */ \
     39 LTSW_FEAT_ENTRY(RATE),              /*! Rate feature. */                       \
     40 LTSW_FEAT_ENTRY(FLEX_FLOW),         /*! Flex flow feature. */                  \
     41 LTSW_FEAT_ENTRY(FLEXCTR_GEN2),      /*! Flex counter gen2.0 feature. */        \
     42 LTSW_FEAT_ENTRY(ASY_DUAL_MODID),    /*! Asymmetric dual module ID support. */   \
     43 LTSW_FEAT_ENTRY(DLB),               /*! Dynamic Load Balance feature. */        \
     44 LTSW_FEAT_ENTRY(DLB_DGM),           /*! Dynamic Group Multipath feature. */        \
     45 LTSW_FEAT_ENTRY(IPMC),              /*! IP multicast routing feature. */       \
     46 LTSW_FEAT_ENTRY(PIM_BIDIR),         /*! Bidirectional PIM feature. */          \
     47 LTSW_FEAT_ENTRY(NAT),               /*! Network Adress Translation feature. */ \
     48 LTSW_FEAT_ENTRY(L2_USER_ENTRY),     /*! L2 Caching of BPDU MAC addresses feature. */ \
     49 LTSW_FEAT_ENTRY(OOB_FC),            /*! Out-of-band Flow Control feature.  */ \
     50 LTSW_FEAT_ENTRY(FLEXDIGEST),        /*! Flex Digest.  */ \
     51 LTSW_FEAT_ENTRY(SBR),               /*! SBR feature. */ \
     52 LTSW_FEAT_ENTRY(STK),               /*! Stack feature. */ \
     53 LTSW_FEAT_ENTRY(TIME),              /*! Time and SyncE feature. */ \
     54 LTSW_FEAT_ENTRY(URPF),              /*! URPF.  */ \
     55 LTSW_FEAT_ENTRY(HASH_OUTPUT_SELECTION_PROFILE), /*! Hash ouput selection profile.  */ \
     56 LTSW_FEAT_ENTRY(TELEMETRY),         /*! Telemetry feature.  */ \
     57 LTSW_FEAT_ENTRY(L3_EGRESS_DEFAULT_UNDERLAY), /*! Default layer for single level L3 egress objects.  */ \
     58 LTSW_FEAT_ENTRY(VPLAG),             /*! Virtual Port Link Aggregation Group feature.  */ \
     59 LTSW_FEAT_ENTRY(TRACE_DOP),         /*! Dop based packet trace.  */ \
     60 LTSW_FEAT_ENTRY(FLEXSTATE),         /*! Flex state feature. */        \
     61 LTSW_FEAT_ENTRY(TNL_SEQ_NUM_PRF),   /*! Tunnel sequence number profile. */        \
     62 LTSW_FEAT_ENTRY(NO_HOST),           /*! No host table. */ \
     63 LTSW_FEAT_ENTRY(NO_L2_MPLS),        /*! Not support VPLS and VPWS. */ \
     64 LTSW_FEAT_ENTRY(MPLS_CONTROL_PKT),  /*! Support MPLS control packet policy. */ \
     65 LTSW_FEAT_ENTRY(L2_TUNNEL_SINGLE_POINTER), /*! Feature WAR for specific handling in L2 tunnel single-pointer model. */ \
     66 LTSW_FEAT_ENTRY(ECN_WRED),          /*! ECN WRED feature. */       \
     67 LTSW_FEAT_ENTRY(FLEX_FLOW_VLAN_DOMAIN), /*! Use vlan as FLEX FLOW forwarding domain. */ \
     68 LTSW_FEAT_ENTRY(L3_HIER),           /*! Hierarchical L3 feature. */       \
     69 LTSW_FEAT_ENTRY(LB_HASH),           /*! Load balance hash. */       \
     70 LTSW_FEAT_ENTRY(FLEXCTR_L2_HITBIT),   /*! Flexctr based L2 hit bit. */       \
     71 LTSW_FEAT_ENTRY(FLEXCTR_IPMC_HITBIT), /*! Flexctr based IPMC hit bit. */       \
     72 LTSW_FEAT_ENTRY(LDH),               /*! Latency distributuib histogram (latency monitor) */ \
     73 LTSW_FEAT_ENTRY(MPLS_FLEXCTR_ACTION_PROFILE), /*! MPLS flex counter action profile support. */       \
     74 LTSW_FEAT_ENTRY(IFA),               /*! Inband Flow Analyzer. */       \
     75 LTSW_FEAT_ENTRY(L3_AACL),           /*! L3 AACL feature. */ \
     76 LTSW_FEAT_ENTRY(FLEXCTR_EVICTION),  /*! Flex counter eviction. */       \
     77 LTSW_FEAT_ENTRY(FLEXCTR_QUANT_32BIT), /*! Flex counter quantization 32-bit mode support. */ \
     78 LTSW_FEAT_ENTRY(INT_IFA),           /*! Inband Flow Analyzer based on  INT module. */       \
     79 LTSW_FEAT_ENTRY(INT_IOAM),          /*! In-site Operations, Administration, and Maintenance based on INT module. */       \
     80 LTSW_FEAT_ENTRY(INT_DP),            /*! In-band Network Telemetry Data-plane Probe based on  INT module. */       \
     81 LTSW_FEAT_ENTRY(VFI),               /*! VFI feature. */       \
     82 LTSW_FEAT_ENTRY(L3_FIB_SINGLE_POINTER), /*! L3 forward with single-pointer model. */ \
     83 LTSW_FEAT_ENTRY(TNL_TERM_FLEXCTR),  /*! Tunnel terminator flex counter. */ \
     84 LTSW_FEAT_ENTRY(XFLOW_MACSEC), /*! XFLOW_MACSEC feature. */ \
     85 LTSW_FEAT_ENTRY(NO_LPM_ROUTE), /*! No LPM route. */ \
     86 LTSW_FEAT_ENTRY(PAYLOAD_TPID),      /*! PAYLOAD TPID. */ \
     87 LTSW_FEAT_ENTRY(DEST_SYSPORT_TO_UL_NH), /*! Derive underlay nexthop from dest system port. */ \
     88 LTSW_FEAT_ENTRY(NO_ROUTE_DATA_TYPE),      /*! No route data type. */ \
     89 LTSW_FEAT_ENTRY(MMU_MOD_MC_COS_ONLY),      /*! MMU MOD enqueued into only multicast queue. */ \
     90 LTSW_FEAT_ENTRY(COUNT)              /*! ALWAYS LAST PLEASE (DO NOT CHANGE)  */
     91 
     92 /*! Make the enums for device features */
     93 #undef  LTSW_FEAT_MAKE_STR
     94 #define LTSW_FEAT_MAKE_STR_CONCAT(e, a)  e##a
     95 #define LTSW_FEAT_MAKE_STR(a) LTSW_FEAT_MAKE_STR_CONCAT(LTSW_FT_, a)
     96 
     97 LTSW_FEAT_MAKE_ENUM(ltsw_feature_);
     98 
     99 #undef  LTSW_FEAT_MAKE_STR
    100 #define LTSW_FEAT_MAKE_STR(a)        #a
    101 #define LTSW_FEAT_NAME_BEGIN(etype)  {
    102 #define LTSW_FEAT_NAME_END(etype)    }
    103 
    104 #define LTSW_FEAT_NAME_LIST             \
    105         LTSW_FEAT_NAME_BEGIN(dont_care) \
    106         LTSW_FEAT_ENTRIES(dont_care)    \
    107         LTSW_FEAT_NAME_END(dont_care)
    108 
    109 /*!
    110  * \brief Initialize features to be supported.
    111  *
    112  * \param [in] unit     Unit number.
    113  *
    114  * \retval SHR_E_NONE   No errors.
    115  * \retval !SHR_E_NONE  Failure.
    116  */
    117 extern int
    118 bcmi_ltsw_feature_init(int unit);
    119 
    120 /*!
    121  * \brief De-initialize the supported features.
    122  *
    123  * \param [in]  unit               Unit Number.
    124  *
    125  * \retval None.
    126  */
    127 extern void
    128 bcmi_ltsw_feature_detach(int unit);
    129 
    130 /*!
    131  * \brief Enable the specific feature.
    132  *
    133  * \param [in] unit Unit number.
    134  *
    135  * \retval SHR_E_NONE No errors.
    136  * \retval SHR_E_UNIT Invalid unit.
    137  */
    138 extern void
    139 ltsw_feature_enable(int unit, ltsw_feature_t feature);
    140 
    141 /*!
    142  * \brief Check if the feature is enabled.
    143  *
    144  * \param [in] unit Unit number.
    145  *
    146  * \retval TRUE  Feature is enabled.
    147  * \retval FALSE Feature is disabled.
    148  */
    149 extern bool
    150 ltsw_feature(int unit, ltsw_feature_t feature);
    151 
    152 #endif  /* BCMI_LTSW_FEATURE_H */