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

algo_oam.h (12183B)


      1 /**
      2  * \file algo_oam.h Internal DNX L3 Managment APIs
      3 PIs This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file.
      4 PIs 
      5 PIs Copyright 2007-2020 Broadcom Inc. All rights reserved.
      6  */
      7 
      8 #ifndef ALGO_OAM_H_INCLUDED
      9 /*
     10  * {
     11  */
     12 #define ALGO_OAM_H_INCLUDED
     13 
     14 #include <shared/shrextend/shrextend_debug.h>
     15 
     16 #include <bcm_int/dnx/algo/template_mngr/template_manager_types.h>
     17 #include <bcm/types.h>
     18 
     19 #ifndef BCM_DNX_SUPPORT
     20 #error "This file is for use by DNX (JR2) family only!"
     21 #endif
     22 
     23  /**
     24  * Resource name defines for algo oam
     25  * \see
     26  * dnx_oam_init_templates
     27  * {
     28  */
     29 #define DNX_ALGO_OAM_GROUP_ID     "OAM_GROUP_ID"
     30 #define DNX_ALGO_OAM_GROUP_ICC_PROFILE  "OAM_GROUP_ICC_PROFILE"
     31 
     32 #define DNX_ALGO_OAM_PROFILE_ID_ING     "OAM_PROFILE_ID_ING"
     33 #define DNX_ALGO_OAM_PROFILE_ID_EG      "OAM_PROFILE_ID_EG"
     34 #define DNX_ALGO_OAM_PROFILE_ID_ING_ACC "OAM_PROFILE_ID_ING_ACC"
     35 #define DNX_ALGO_OAM_PROFILE_ID_EG_ACC  "OAM_PROFILE_ID_EG_ACC"
     36 
     37 /*
     38  */
     39 #define SW_STATE_ALGO_OAM_PROFILE_ID_ING     algo_oam_db.oam_profile_id_ing
     40 #define SW_STATE_ALGO_OAM_PROFILE_ID_EG      algo_oam_db.oam_profile_id_eg
     41 #define SW_STATE_ALGO_OAM_PROFILE_ID_ING_ACC algo_oam_db.oam_profile_id_ing_acc
     42 #define SW_STATE_ALGO_OAM_PROFILE_ID_EG_ACC  algo_oam_db.oam_profile_id_eg_acc
     43 
     44 #define DNX_ALGO_OAM_RMEP_ID_BELOW_THRESHOLD "OAM_RMEP_ID_BELOW_THRESHOLD"
     45 #define DNX_ALGO_OAM_RMEP_ID_ABOVE_THRESHOLD "OAM_RMEP_ID_ABOVE_THRESHOLD"
     46 #define DNX_OAM_TEMPLATE_ITMH_PRIORITY            "OAM ITMH PRIORITY PROFILE"
     47 #define DNX_OAM_TEMPLATE_MPLS_PWE_EXP_TTL_PROFILE "OAM MPLS/PWE EXP+TTL PROFILE"
     48 #define DNX_OAM_TEMPLATE_MEP_PROFILE "OAM MEP PROFILE"
     49 
     50 #define DNX_ALGO_OAMP_PUNT_EVENT_PROFILE_TEMPLATE "OAMP_PUNT_EVENT_PROF_TEMPLATE"
     51 
     52 #define DNX_ALGO_OAM_OAMP_SA_MAC_MSB_PROFILE_TEMPLATE "OAM_SA_MAC_MSB_PROFILE_TEMPLATE"
     53 #define DNX_ALGO_OAM_OAMP_DA_MAC_MSB_PROFILE_TEMPLATE "OAM_DA_MAC_MSB_PROFILE_TEMPLATE"
     54 #define DNX_ALGO_OAM_OAMP_DA_MAC_LSB_PROFILE_TEMPLATE "OAM_DA_MAC_LSB_PROFILE_TEMPLATE"
     55 #define DNX_ALGO_OAM_OAMP_TPID_PROFILE_TEMPLATE "ETH OAM TPID PROFILE"
     56 #define DNX_ALGO_OAM_DEFAULT_MEP_PROFILE "OAM DEFAULT MEP PROFILE"
     57 #define DNX_SLM_OAMP_TEMPLATE_TX_RATE "SLM OAMP TX Rate"
     58 #define DNX_ALGO_OAM_TRAP_CODE_TCAM_DATA "OAM TRAP CODE TCAM DATA"
     59 
     60 #define DNX_ALGO_PUNT_TABLE_START_ID 0
     61 #define DNX_ALGO_PUNT_TABLE_COUNT 16
     62 
     63 /** Flags used to indicate if oam oamp profile should be updated */
     64 #define DNX_OAM_OAMP_PROFILE_ITMH_PRIORITY_FLAG             (0x1)
     65 #define DNX_OAM_OAMP_PROFILE_OUTER_TPID_FLAG                (0x2)
     66 #define DNX_OAM_OAMP_PROFILE_INNER_TPID_FLAG                (0x4)
     67 #define DNX_OAM_OAMP_PROFILE_SA_MAC_MSB_FLAG                (0x8)
     68 #define DNX_OAM_OAMP_PROFILE_EXP_TTL_FLAG                   (0x10)
     69 #define DNX_OAM_OAMP_PROFILE_LOCL_PORT_TO_SYSTEM_PORT_FLAG  (0x20)
     70 #define DNX_OAM_OAMP_PROFILE_MEP_PROFILE_FLAG               (0x40)
     71 #define DNX_OAM_OAMP_PROFILE_TRAP_TCAM_FLAG                 (0x80)
     72 #define DNX_OAM_OAMP_PROFILE_MPLS_LM_DM_SET                 (0x100)
     73 
     74 /* oam_group_icc_profile_data_t  used to store OAM group ICC profiles as templates*/
     75 typedef uint8 dnx_oam_group_icc_profile_data_t[6];
     76 
     77 /**
     78  * \brief - Printing callback for the OAM group ICC templates,
     79  *        which are used to track OAM group ICC data.
     80  *
     81  * \param [in] unit - Number of hardware unit used.
     82  * \param [in] data - Pointer to template profile data.  The OAM
     83  *        group ICC profile structure dnx_oam_group_icc_profile_data_t is
     84  *        defined and described above.
     85  * \return
     86  * \remark
     87  *   * A print callback function is required to create a
     88  *     template.  It is later used for BCM shell diagnostics.
     89  * \see
     90  *   * None
     91  */
     92 
     93 void dnx_oam_group_icc_profile_print_cb(
     94     int unit,
     95     const void *data);
     96 
     97 /**
     98  *  Structure used to store profiles that contain "traffic
     99  *  class/drop precedence" profiles as template.  These values
    100  *  are used by the OAMP to construct the ITMH header of OAM/BFD
    101  *  packets for transmission.
    102  */
    103 typedef struct
    104 {
    105     uint8 tc;
    106     uint8 dp;
    107 } dnx_oam_itmh_priority_t;
    108 
    109 /**
    110  *  Structure used to store profiles that contain "MPLS/PWE
    111  *  push profiles" as template.  These values
    112  *  are used by the OAMP to construct the MPLS/PWE encapsulated
    113  *  OAM/BFD packets for transmission.
    114  */
    115 typedef struct
    116 {
    117     uint8 ttl;
    118     uint8 exp;
    119 } dnx_oam_ttl_exp_profile_t;
    120 
    121 /**
    122  *  Structure used to store profiles that contain "OAMP MEP profile"
    123  *  as template.  These values are used to update CCM/LM/DM packets
    124  *  constructed by OAMP for transmission.
    125  */
    126 typedef struct
    127 {
    128     /** Dual ended LM and SLM indications
    129      */
    130     uint8 piggy_back_lm;
    131     uint8 slm_lm;
    132 
    133     /** For Y.1731 OAM over MPLS-TP -
    134      *  disable verification of message
    135      *  by comparing MDL to field in MEP-DB entry
    136      */
    137     uint8 mdl_check_dis;
    138 
    139     /** For Flexible 48 byte MAID -
    140      *  disable verification of message
    141      *  by comparing MAID to field in MEP-DB entry
    142      */
    143     uint8 maid_check_dis;
    144 
    145     /** For BFD over IPv6 -
    146      *  disable verification of message
    147      *  by comparing IPv4 packet dip to IPv4 MEP sip in MEP-DB entry
    148      */
    149     uint8 src_ip_check_dis;
    150 
    151     /**
    152      * For seamless BFD:
    153      * disable verification of message
    154      * by comparing UDP SRC port to IP/MPLS fixed source ports
    155      */
    156     uint8 udp_src_port_check_dis;
    157 
    158     /** For BFD discriminator with MEP type -
    159      * disable verification of your-discriminator, since
    160      * for endpoints with MSB=1, this verification would fail
    161      */
    162     uint8 your_disc_check_dis;
    163 
    164     /** LM report mode:enable/disable
    165      */
    166     uint8 report_mode_lm;
    167 
    168     /** DM report mode:enable/disable
    169      */
    170     uint8 report_mode_dm;
    171 
    172     /** RDI generation from scanner and/or RX process
    173      */
    174     uint8 rdi_gen_method;
    175     /** LM/DM rates at which OAMP need to TX
    176      */
    177     int dmm_rate;
    178     int lmm_rate;
    179     /** Only opcode 0, 1 used at this stage (0-7 available)
    180      */
    181     int opcode_0_rate;
    182     int opcode_1_rate;
    183     /** LM/DM offsets used to update OAM-TS for stamping purpose.
    184      */
    185     uint8 lmm_offset;
    186     uint8 lmr_offset;
    187     uint8 dmm_offset;
    188     uint8 dmr_offset;
    189     /** Phase profile. Strictly speaking not part of MEP profile but uses the same pointer
    190      */
    191     uint32 ccm_count;
    192     uint32 dmm_count;
    193     uint32 lmm_count;
    194     uint32 opcode_0_count;
    195     uint32 opcode_1_count;
    196     /** DM measurement type and 1DM time stamp encodings if type is 1DM
    197      */
    198     uint8 dm_measurement_type;
    199     /** Opcodes to send from OAMP
    200      */
    201     uint8 opcode_bit_map;
    202 
    203     /*
    204      * LMM/DMM DA OUI(MSB 24 bits) profile
    205      */
    206     uint8 oamp_mac_da_oui_prof;
    207 
    208     /*
    209      * OAM Statistics, TX/RX counting
    210      */
    211     uint8 mep_id_shift;
    212     uint8 opcode_mask;
    213     uint8 opcode_tx_statistics_enable;
    214     uint8 opcode_rx_statistics_enable;
    215 
    216     /**
    217     * MEASUREMENT_PERIOD_PROFILE 3 bit profile will store the timer profile out of the 8 timer profiles.
    218     */
    219     uint8 slm_measurement_period_index;
    220 
    221     /*
    222      * For BFD: allows modifying transmission rates
    223      * for server EPs simultaneously.  Endpoints in
    224      * a cluster share a single Tx period profile and
    225      * a single MEP profile, which means they must all
    226      * be IPv4 or IPv6, and discriminator MSB must have
    227      * the same value for all EPs in a cluster.
    228      */
    229     uint8 cluster_id;
    230 } dnx_oam_mep_profile_t;
    231 
    232 /**
    233  *  Structure used to store profiles that contain OAMP trap TCAM
    234  *  table entries as a template.  These entries are part of the
    235  *  OAMP validation process for received packets: any packet
    236  *  that has a MEP type and trap ID pair not in this table will
    237  *  be punted
    238  */
    239 typedef struct
    240 {
    241     uint32 trap_code;
    242     dbal_enum_value_field_oamp_mep_type_e mep_type;
    243 } dnx_oam_oamp_trap_tcam_entry_t;
    244 
    245 /**
    246  *  This struct is used to store new allocated profiles data
    247  *  required for OAM endpoint during create/modify in order to be set
    248  *  after all successfully allocations
    249  */
    250 typedef struct
    251 {
    252     /** Flags to indicate:
    253      *   1. new profiles that should be set.
    254      *   2. profiles that should be updated.
    255      *   3. profiles that should be zeroed.
    256      *   See DNX_OAM_OAMP_PROFILE_XXX
    257  */
    258     uint32 flags;
    259 
    260     uint8 itmh_profile;
    261     dnx_oam_itmh_priority_t itmh_priority;
    262 
    263     /**
    264      * Data for writing system port profile
    265      * PP port and port core for CCM
    266      * ethernet up-MEP; PP port profile
    267      * for all other enddpoints
    268      */
    269     uint16 pp_port_profile;
    270     uint32 system_port;
    271 
    272     uint8 outer_tpid_index;
    273     uint16 outer_tpid;
    274 
    275     uint8 inner_tpid_index;
    276     uint16 inner_tpid;
    277 
    278     uint8 sa_mac_msb_profile;
    279     bcm_mac_t sa_mac_msb;
    280 
    281     uint8 mpls_pwe_exp_ttl_profile;
    282     dnx_oam_ttl_exp_profile_t ttl_exp;
    283 
    284     uint8 mep_profile_index;
    285     dnx_oam_mep_profile_t mep_profile;
    286 
    287     uint8 tcam_index;
    288     dnx_oam_oamp_trap_tcam_entry_t tcam_entry;
    289 } oam_oamp_profile_hw_data_t;
    290 
    291 /**
    292  * \brief - Printing callback for the MAC SA MSB templates,
    293  *
    294  * \param [in] unit - Number of hardware unit used.
    295  * \param [in] data - Pointer to template profile data.
    296  * \return
    297  * \remark
    298  *   * A print callback function is required to create a
    299  *     template.  It is later used for BCM shell diagnostics.
    300  * \see
    301  *   * None
    302  */
    303 void dnx_oam_oamp_sa_mac_msb_profile_print_cb(
    304     int unit,
    305     const void *data);
    306 
    307 /**
    308  * \brief - Printing callback for the MAC DA MSB templates,
    309  *
    310  * \param [in] unit - Number of hardware unit used.
    311  * \param [in] data - Pointer to template profile data.  T
    312  * \return
    313  * \remark
    314  *   * A print callback function is required to create a
    315  *     template.  It is later used for BCM shell diagnostics.
    316  * \see
    317  *   * None
    318  */
    319 void dnx_oam_oamp_da_mac_msb_profile_print_cb(
    320     int unit,
    321     const void *data);
    322 
    323 /**
    324  * \brief - Printing callback for the MAC DA LSB templates,
    325  *
    326  * \param [in] unit - Number of hardware unit used.
    327  * \param [in] data - Pointer to template profile data.  T
    328  * \return
    329  * \remark
    330  *   * A print callback function is required to create a
    331  *     template.  It is later used for BCM shell diagnostics.
    332  * \see
    333  *   * None
    334  */
    335 void dnx_oam_oamp_da_mac_lsb_profile_print_cb(
    336     int unit,
    337     const void *data);
    338 
    339 /**
    340  * \brief - Printing callback for the SLM measurement period
    341  *        template, which is used to configure packet
    342  *        transmissions for SLM packets.
    343  *
    344  * \param [in] unit - Number of hardware unit used.
    345  * \param [in] data - Pointer to template profile data.  The Tx
    346  *        rate is a 10-bit integer.
    347  * \return
    348  * \remark
    349  *   * A print callback function is required to create a
    350  *     template.  It is later used for BCM shell diagnostics.
    351  * \see
    352  *   * None
    353  */
    354 void dnx_slm_oamp_measurement_period_print_cb(
    355     int unit,
    356     const void *data);
    357 
    358 /**
    359  * \brief - Printing callback for the OAMP trap TCAM
    360  *        entry template, which is used to track entries
    361  *        in the OAMP trap TCAM table.
    362  *
    363  * \param [in] unit - Number of hardware unit used.
    364  * \param [in] data - Pointer to template profile data.
    365  * \return
    366  * \remark
    367  *   * A print callback function is required to create a
    368  *     template.  It is later used for BCM shell diagnostics.
    369  * \see
    370  *   * None
    371  */
    372 void dnx_oam_oamp_oamp_trap_tcam_print_cb(
    373     int unit,
    374     const void *data);
    375 
    376 /**
    377  * \brief - initialize templates for all oam profile types.
    378  *        Current oam  Templates:\n
    379  *  OAM group id - group ID for OAM groups\n
    380  *  OAM TC/DP - profile that contains TC and DP values for
    381  *  ITMH\n
    382  *  MPLS/PWE push profile - profile that contains TTL and EXP
    383  *  values
    384  *
    385  * \param [in] unit - Number of hardware unit used.
    386  *
    387  * \return
    388  *   shr_error_e
    389  *
    390  * \remark
    391  *   * None
    392  * \see
    393  *   * None
    394  */
    395 shr_error_e dnx_algo_oam_init(
    396     int unit);
    397 
    398 /**
    399  * \brief - Printing callback for the ETH OAM tpid profile template
    400  *
    401  * \param [in] unit - Number of hardware unit used.
    402  * \param [in] data - Pointer to template profile data(tpid).
    403  * \return
    404  * \remark
    405  *   * A print callback function is required to create a
    406  *     template.  It is later used for BCM shell diagnostics.
    407  * \see
    408  *   * None
    409  */
    410 
    411 void dnx_oam_oamp_tpid_profile_print_cb(
    412     int unit,
    413     const void *data);
    414 
    415 /*
    416  * }
    417  */
    418 #endif/*_ALGO_QOS_API_INCLUDED__*/