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

rx_trap.h (24924B)


      1 /**
      2  *  \file bcm_int/dnx/rx/rx_trap.h
      3  * 
      4  *
      5  * Internal DNX RX APIs
      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 RX_TRAP_H_INCLUDED
     13 /* { */
     14 #define RX_TRAP_H_INCLUDED
     15 
     16 #ifndef BCM_DNX_SUPPORT
     17 #error "This file is for use by DNX (JR2) family only!"
     18 #endif
     19 
     20 #include <include/bcm_int/dnx/rx/rx.h>
     21 #include <soc/dnx/dnx_data/auto_generated/dnx_data_snif.h>
     22 #include <soc/dnx/dnx_data/auto_generated/dnx_data_trap.h>
     23 
     24 /* } */
     25 
     26 /*
     27   * Define and MACROs
     28   * {
     29   */
     30 
     31 /**
     32  * Number of Ingress traps
     33  */
     34 #define DNX_RX_TRAP_IS_LEGAL_INGRESS_TRAP_ID(trap_id) \
     35 if(trap_id > DBAL_NOF_ENUM_INGRESS_TRAP_ID_VALUES || trap_id < 0) \
     36 { \
     37    SHR_ERR_EXIT(_SHR_E_PARAM, "The supplied Trap_ID(%d) is out of legal range 0 - %d \n", trap_id, DBAL_NOF_ENUM_INGRESS_TRAP_ID_VALUES); \
     38 } \
     39 
     40 /**
     41  * MTU Traps for PORT config, use hard-coded forwarding type 3'b1;
     42  */
     43 #define DNX_RX_MTU_PORT_COMPRESSED_LAYER_TYPE       (0x7)
     44 
     45 /**
     46  * MTU Default profile;
     47  */
     48 #define DNX_RX_TRAP_MTU_DEFAULT_PROFILE                 (0x0)
     49 
     50 /**
     51  * ERPP first configurable fwd action profile
     52  */
     53 #define DNX_RX_TRAP_ERPP_FWD_ACT_PROFILE_1ST_USER_TRAP    (1)
     54 
     55 /**
     56  * ERPP last configurable fwd action profile
     57  */
     58 #define DNX_RX_TRAP_ERPP_FWD_ACT_PROFILE_LAST_USER_TRAP   (7)
     59 
     60 /**
     61  * \brief - Trap BLOCK and CLASS are going to be encoded in trap_id
     62  *          Trap_class will be either UserDefined or OAM , 0/1 respectively.
     63  * (2b - trap_block | 1b -trap_class | 9b - trap_type) */
     64 #define DNX_RX_TRAP_BLOCK_SHIFT     (10)
     65 #define DNX_RX_TRAP_BLOCK_MASK      (0x3)
     66 
     67 #define DNX_RX_TRAP_CLASS_SHIFT        (9)
     68 #define DNX_RX_TRAP_CLASS_MASK      (0x1)
     69 
     70 #define DNX_RX_TRAP_TYPE_MASK       (0x1FF)
     71 
     72 #define DNX_RX_TRAP_ID_SET(trap_block, trap_class, trap_type)   ((trap_block << DNX_RX_TRAP_BLOCK_SHIFT)    \
     73                                                                | (trap_class << DNX_RX_TRAP_CLASS_SHIFT)    \
     74                                                                | (trap_type))
     75 
     76 #define DNX_RX_TRAP_ID_BLOCK_GET(trap_id)   ((trap_id >> DNX_RX_TRAP_BLOCK_SHIFT) & DNX_RX_TRAP_BLOCK_MASK)
     77 #define DNX_RX_TRAP_ID_CLASS_GET(trap_id)   ((trap_id >> DNX_RX_TRAP_CLASS_SHIFT) & DNX_RX_TRAP_CLASS_MASK)
     78 #define DNX_RX_TRAP_ID_TYPE_GET(trap_id)    (trap_id & DNX_RX_TRAP_TYPE_MASK)
     79 
     80 /**
     81  * \brief - Get trap_action_profile (3b) from egress trap_id
     82  */
     83 #define DNX_RX_TRAP_EGRESS_ACTION_PROFILE_MASK (0x7)
     84 
     85 #define DNX_RX_TRAP_EGRESS_ACTION_PROFILE_GET(trap_id)      (trap_id & DNX_RX_TRAP_EGRESS_ACTION_PROFILE_MASK)
     86 /**
     87  * \brief - Get snoop_action_profile (2b) from egress trap_id
     88  */
     89 #define DNX_RX_TRAP_EGRESS_SNOOP_PROFILE_MASK (0x3)
     90 
     91 #define DNX_RX_TRAP_EGRESS_SNOOP_PROFILE_GET(trap_id)      (trap_id & DNX_RX_TRAP_EGRESS_SNOOP_PROFILE_MASK)
     92 
     93 /**
     94  * \brief - Action Profile, and OAM Trap Type are going to be encoded in trap_type, which is then encoded into trap_id
     95  *          Currently the OAM trap_type is 3 bits, but we will reserve additional 3 for future use,
     96  *           which means that the 3 LSB hold the oam_trap_id, the following 3 are empty buffer for future use and
     97  *           3 MSB for action_profile.
     98  * (3b - action_profile | 6b - oam_trap_type(3b empty buffer | 3b oam_trap_id)) */
     99 
    100 #define DNX_RX_TRAP_ETPP_OAM_ACTION_PROFILE_SHIFT    (6)
    101 #define DNX_RX_TRAP_ETPP_OAM_ACTION_PROFILE_MASK     (0x7)
    102 
    103 #define DNX_RX_TRAP_ETPP_OAM_TRAP_TYPE_MASK          (0x3F)
    104 
    105 #define DNX_RX_TRAP_ETPP_OAM_TRAP_TYPE_SET(action_profile, oam_trap_type)     ((action_profile << DNX_RX_TRAP_ETPP_OAM_ACTION_PROFILE_SHIFT) \
    106                                                                             | (oam_trap_type))
    107 
    108 #define DNX_RX_TRAP_ETPP_OAM_TRAP_TYPE_GET(trap_type)         (trap_type & DNX_RX_TRAP_ETPP_OAM_TRAP_TYPE_MASK)
    109 #define DNX_RX_TRAP_ETPP_OAM_ACTION_PROFILE_GET(trap_type)    ((trap_type >> DNX_RX_TRAP_ETPP_OAM_ACTION_PROFILE_SHIFT) & DNX_RX_TRAP_ETPP_OAM_ACTION_PROFILE_MASK)
    110 
    111 #define DNX_RX_TRAP_ID_INVALID       (-1)
    112 
    113 /**
    114  * \brief - 3b strength is encoded in TM profile (2b) and forward strength (1b)
    115  * strength (3b) = (2b - TM profile | 1b - forward strength) */
    116 #define DNX_RX_TRAP_FWD_COMPRESSED_STRENGTH_SHIFT     (2)
    117 #define DNX_RX_TRAP_FWD_COMPRESSED_STRENGTH_MASK      (0x1)
    118 
    119 #define DNX_RX_TRAP_TM_PROFILE_MASK      (0x3)
    120 
    121 #define DNX_RX_TRAP_FWD_COMPRESSED_STRENGTH_GET(strength)   ((strength >> DNX_RX_TRAP_FWD_COMPRESSED_STRENGTH_SHIFT) \
    122                                                                         & DNX_RX_TRAP_FWD_COMPRESSED_STRENGTH_MASK)
    123 #define DNX_RX_TRAP_TM_PROFILE_GET(strength)                (strength & DNX_RX_TRAP_TM_PROFILE_MASK)
    124 
    125 /**
    126 *STAT_OBJ_CLEAR field in the trap FWD_ACT_PROFILE table should be set at init to all 1's
    127 * Since 1 is the default value for - "do nothing"
    128 */
    129 #define DNX_RX_TRAP_ACTION_STAT_OBJ_CLEAR_DEFAULT (0x3FF)
    130 
    131 /**
    132  * \brief - Snoop command defines
    133  * When PMF handle ITMH one of the fields is snoop command (5 bits).
    134  * In PMF a tranlation to snoop code (9 bits) is being done which in action resolution will be used to access HW.
    135  * DNX_RX_TRAP_CODE_SNIF_PROFILE_START_IND - start index of sniff in dabl table, finds the first available index
    136  * sniff profile is used for snooping, mirroring and sampling*/
    137 #define DNX_RX_TRAP_CODE_SNIF_PROFILE_START_IND(unit) (dnx_data_trap.ingress.nof_entries_action_table_get(unit) \
    138                                                        - dnx_data_snif.ingress.nof_profiles_get(unit))
    139 
    140 /**
    141  * \brief - check if a parameter is bool indication
    142  */
    143 #define DNX_RX_TRAP_IS_BOOL_INDICATION(param)   ((param == TRUE) | (param == FALSE))
    144 
    145 /**
    146  * \brief - check if ingress trap is DA NOT FOUND
    147  */
    148 #define DNX_RX_TRAP_IS_DA_NOT_FOUND(trap_id)    ((trap_id == DBAL_ENUM_FVAL_INGRESS_TRAP_ID_FLP_DA_NOT_FOUND0) || \
    149                                                  (trap_id == DBAL_ENUM_FVAL_INGRESS_TRAP_ID_FLP_DA_NOT_FOUND1) || \
    150                                                  (trap_id == DBAL_ENUM_FVAL_INGRESS_TRAP_ID_FLP_DA_NOT_FOUND2) || \
    151                                                  (trap_id == DBAL_ENUM_FVAL_INGRESS_TRAP_ID_FLP_DA_NOT_FOUND3))
    152 
    153 /**
    154  * \brief - check if etpp is user trap based on profile
    155  */
    156 #define DNX_RX_TRAP_IS_ETPP_USER_TRAP(profile)   ((profile >= DNX_RX_TRAP_ETPP_FWD_ACT_PROFILE_USER_TRAP_1) &&  \
    157                                                   (profile <= DNX_RX_TRAP_ETPP_FWD_ACT_PROFILE_USER_TRAP_4))
    158 
    159 /**
    160  * \brief - check if etpp oam trap is of UP-MEP type
    161  */
    162 #define DNX_RX_TRAP_IS_ETPP_OAM_UP_MEP(trap_type)   ((trap_type == DNX_RX_TRAP_ETPP_OAM_UP_MEP_OAMP)    || \
    163                                                      (trap_type == DNX_RX_TRAP_ETPP_OAM_UP_MEP_DEST1)   || \
    164                                                      (trap_type == DNX_RX_TRAP_ETPP_OAM_UP_MEP_DEST2))
    165 /**
    166  * \brief - check if etpp oam trap is of error type
    167  */
    168 #define DNX_RX_TRAP_IS_ETPP_OAM_ERR(trap_type)   ((trap_type == DNX_RX_TRAP_ETPP_OAM_PASSIVE_ERR)    || \
    169                                                   (trap_type == DNX_RX_TRAP_ETPP_OAM_LEVEL_ERR))
    170 
    171 /**
    172  * \brief - check if etpp is user trap based on profile
    173  */
    174 #define DNX_RX_TRAP_BLOCK_IS_VALID(trap_block)   ((trap_block > DNX_RX_TRAP_BLOCK_INVALID) &&  \
    175                                                   (trap_block < DNX_RX_TRAP_BLOCK_NUM_OF))
    176 
    177 /**
    178 * Protocol traps default profiles
    179 */
    180 #define ICMPV6_TRAP_PROFILE_DEFAULT (0)
    181 #define ICMPV4_TRAP_PROFILE_DEFAULT (0)
    182 #define L2CP_TRAP_PROFILE_DEFAULT (0)
    183 #define ARP_TRAP_PROFILE_DEFAULT (0)
    184 #define IGMP_TRAP_PROFILE_DEFAULT (0)
    185 #define DHCP_TRAP_PROFILE_DEFAULT (0)
    186 #define NON_AUTH_8021X_TRAP_PROFILE_DEFAULT (0)
    187 
    188 /**
    189 * Number of protocol trap arguments
    190 */
    191 #define DNX_RX_TRAP_NOF_L2CP_PROTOCOL_TRAP_ARGS (64)
    192 #define DNX_RX_TRAP_NOF_ICMP_PROTOCOL_TRAP_ARGS (256)
    193 
    194 /**
    195 * ICMP-NDP Neighbor Solicitation request is identified when the packet is ICMPoIPv6 and the ICMP type is 135
    196 */
    197 #define DNX_RX_TRAP_NEIGHBOR_SOLICITATION_TYPE  (135)
    198 
    199 /*
    200   * }
    201   */
    202 
    203 /*
    204   * Types
    205   * {
    206   */
    207 
    208 /**
    209  * \brief enum to hold the poissble blocks for traps.
    210  */
    211 typedef enum
    212 {
    213     DNX_RX_TRAP_BLOCK_INVALID = -1,
    214     DNX_RX_TRAP_BLOCK_FIRST = 0,
    215     /**
    216         * bcmRxTrapType.. is one of the ingress traps - predefined,user_defined.
    217         */
    218     DNX_RX_TRAP_BLOCK_INGRESS = DNX_RX_TRAP_BLOCK_FIRST,        /* Must be zero since ingress trap_id is used as index */
    219     /**
    220         *bcmRxTrapType.. is one of the OAMP traps - OAMP block
    221         */
    222     DNX_RX_TRAP_BLOCK_OAMP,
    223     /**
    224         *bcmRxTrapType.. is one of the egress traps - ERPP block
    225         */
    226     DNX_RX_TRAP_BLOCK_ERPP,
    227     /**
    228         *bcmRxTrapType.. is one of the egress traps - ETPP block
    229         */
    230     DNX_RX_TRAP_BLOCK_ETPP,
    231     DNX_RX_TRAP_BLOCK_NUM_OF
    232 } dnx_rx_trap_block_e;
    233 
    234 /**
    235  * \brief enum to hold the poissble classes for traps.
    236  */
    237 typedef enum
    238 {
    239     DNX_RX_TRAP_CLASS_INVALID = -1,
    240     DNX_RX_TRAP_CLASS_FIRST = 0,
    241     /**
    242     * bcmRxTrapType.. is one of user defined traps
    243     */
    244     DNX_RX_TRAP_CLASS_USER_DEFINED = DNX_RX_TRAP_CLASS_FIRST,   /* Must be zero since predefined trap_id is used as */
    245     /**
    246     * bcmRxTrapType.. is one of OAM traps
    247     */
    248     DNX_RX_TRAP_CLASS_OAM,
    249     /**
    250     * bcmRxTrapType.. is one of the predefined traps
    251     */
    252     DNX_RX_TRAP_CLASS_PREDEFINED,
    253     DNX_RX_TRAP_CLASS_NUM_OF
    254 } dnx_rx_trap_class_e;
    255 
    256 /**
    257  * \brief enum to hold possible same interface context profiles
    258  */
    259 typedef enum
    260 {
    261     DNX_RX_TRAP_SAME_INTERFACE_CONTEXT_PROFILE_DEFAULT = 0,
    262     DNX_RX_TRAP_SAME_INTERFACE_CONTEXT_PROFILE_IP = 1,
    263     DNX_RX_TRAP_NOF_SAME_INTERFACE_CONTEXT_PROFILES
    264 } dnx_rx_trap_same_interface_context_profile_e;
    265 
    266 /**
    267  * \brief enum to hold the possible stat objects to overwrite
    268  */
    269 typedef enum
    270 {
    271     DNX_RX_TRAP_STAT_OBJ_TO_OW_0 = 0,
    272     DNX_RX_TRAP_STAT_OBJ_TO_OW_1 = 1,
    273     DNX_RX_TRAP_NOF_STAT_OBJS_TO_OW
    274 } dnx_rx_trap_stat_obj_to_ow_e;
    275 
    276 /**
    277  * \brief enum to hold the possible protocol trap configuration modes.
    278  */
    279 typedef enum
    280 {
    281     DNX_RX_TRAP_PROTOCOL_MODE_INVALID = -1,
    282     DNX_RX_TRAP_PROTOCOL_MODE_FIRST = 0,
    283     /**
    284     * Enabling the device to look-up protocol profiles per in-lif
    285     */
    286     DNX_RX_TRAP_PROTOCOL_MODE_IN_LIF = DNX_RX_TRAP_PROTOCOL_MODE_FIRST,
    287     /**
    288     * Enabling the device to look-up protocol profiles per in-port
    289     */
    290     DNX_RX_TRAP_PROTOCOL_MODE_IN_PORT,
    291     DNX_RX_TRAP_PROTOCOL_MODE_NUM_OF
    292 } dnx_rx_trap_protocol_mode_e;
    293 
    294 /**
    295  * \brief enum for protocol DHCP trap arguments.
    296  */
    297 typedef enum
    298 {
    299     DNX_RX_TRAP_PROTOCOL_DHCP_ARGS_IPV4_CLIENT = 0,
    300     DNX_RX_TRAP_PROTOCOL_DHCP_ARGS_IPV4_SERVER = 1,
    301     DNX_RX_TRAP_PROTOCOL_DHCP_ARGS_IPV6_CLIENT = 2,
    302     DNX_RX_TRAP_PROTOCOL_DHCP_ARGS_IPV6_SERVER = 3
    303 } dnx_rx_trap_protocol_dhcp_args_e;
    304 
    305 /**
    306  * \brief enum for protocol ARP trap arguments.
    307  */
    308 typedef enum
    309 {
    310     DNX_RX_TRAP_PROTOCOL_ARP_ARGS = 0,
    311     DNX_RX_TRAP_PROTOCOL_MY_ARP_ARGS = 1
    312 } dnx_rx_trap_protocol_arp_args_e;
    313 
    314 /**
    315  * \brief enum for protocol NDP trap arguments.
    316  */
    317 typedef enum
    318 {
    319     DNX_RX_TRAP_PROTOCOL_NDP_ARGS = 0,
    320     DNX_RX_TRAP_PROTOCOL_MY_NDP_ARGS = 1
    321 } dnx_rx_trap_protocol_ndp_args_e;
    322 
    323 /**
    324  * \brief enum for Ethernet trap action profiles (routing enable procedure).
    325  */
    326 typedef enum
    327 {
    328     DNX_RX_TRAP_ETH_PROFILE_DEFAULT = 0,
    329     DNX_RX_TRAP_ETH_PROFILE_VTT_MY_MAC_AND_IP_DISABLE = 1,
    330     DNX_RX_TRAP_ETH_PROFILE_VTT_MY_MAC_AND_MPLS_DISABLE = 2,
    331     DNX_RX_TRAP_ETH_PROFILE_VTT_MY_MAC_AND_ARP = 3,
    332     DNX_RX_TRAP_ETH_PROFILE_VTT_MY_MAC_AND_UNKNOWN_L3 = 4
    333 } dnx_rx_trap_eth_profiles_e;
    334 
    335 /**
    336  * \brief enum for etpp forward action profiles.
    337  */
    338 typedef enum
    339 {
    340     DNX_RX_TRAP_ETPP_FWD_ACT_PROFILE_DO_NOTHING = 0,
    341     DNX_RX_TRAP_ETPP_FWD_ACT_PROFILE_DROP = 1,
    342     DNX_RX_TRAP_ETPP_FWD_ACT_PROFILE_GENERAL_TRAP = 2,
    343     DNX_RX_TRAP_ETPP_FWD_ACT_PROFILE_USER_TRAP_1 = 3,
    344     DNX_RX_TRAP_ETPP_FWD_ACT_PROFILE_USER_TRAP_2 = 4,
    345     DNX_RX_TRAP_ETPP_FWD_ACT_PROFILE_USER_TRAP_3 = 5,
    346     DNX_RX_TRAP_ETPP_FWD_ACT_PROFILE_USER_TRAP_4 = 6,
    347     DNX_RX_TRAP_ETPP_FWD_ACT_PROFILE_VISIBILITY = 7,
    348     DNX_RX_TRAP_ETPP_FWD_ACT_PROFILE_KEEP_FABRIC_PACKET = 8,
    349     DNX_RX_TRAP_ETPP_FWD_ACT_PROFILE_USER_TRAP_5,
    350     DNX_RX_TRAP_ETPP_FWD_ACT_NOF_PROFILES = 10
    351 } dnx_rx_trap_etpp_fwd_act_profiles_e;
    352 
    353 /**
    354  * \brief enum for forward recycle profiles.
    355  */
    356 typedef enum
    357 {
    358     DNX_RX_TRAP_FWD_RCY_PROFILE_DEFAULT = 0,
    359     DNX_RX_TRAP_FWD_RCY_PROFILE_EGRESS_TRAPPED = 1,
    360     DNX_RX_TRAP_FWD_RCY_PROFILE_OAM_UPMEP_REFLECTOR = 2,
    361     DNX_RX_TRAP_FWD_RCY_PROFILE_RESERVED_1 = 3,
    362     DNX_RX_TRAP_FWD_RCY_PROFILE_RESERVED_2 = 4,
    363     DNX_RX_TRAP_FWD_RCY_PROFILE_RESERVED_3 = 5,
    364     DNX_RX_TRAP_FWD_RCY_PROFILE_RESERVED_4 = 6,
    365     DNX_RX_TRAP_FWD_RCY_PROFILE_CONFIGURABLE_1 = 7,
    366     DNX_RX_TRAP_FWD_RCY_PROFILE_CONFIGURABLE_2 = 8,
    367     DNX_RX_TRAP_FWD_RCY_PROFILE_CONFIGURABLE_3 = 9,
    368     DNX_RX_TRAP_FWD_RCY_PROFILE_CONFIGURABLE_4 = 10,
    369     DNX_RX_TRAP_FWD_RCY_PROFILE_CONFIGURABLE_5 = 11,
    370     DNX_RX_TRAP_FWD_RCY_PROFILE_CONFIGURABLE_6 = 12,
    371     DNX_RX_TRAP_FWD_RCY_PROFILE_CONFIGURABLE_7 = 13,
    372     DNX_RX_TRAP_FWD_RCY_PROFILE_CONFIGURABLE_8 = 14,
    373     DNX_RX_TRAP_FWD_RCY_PROFILE_DROP = 15,
    374     DNX_RX_TRAP_FWD_RCY_NOF_PROFILES = 16
    375 } dnx_rx_trap_fwd_rcy_profiles_e;
    376 
    377 /**
    378  * \brief enum for lif profiles.
    379  */
    380 typedef enum
    381 {
    382     DNX_RX_TRAP_LIF_PROFILE_INVALID = -1,
    383     DNX_RX_TRAP_LIF_PROFILE_DEFAULT = 0,
    384     DNX_RX_TRAP_LIF_PROFILE_STACK_TRAP_1 = 1,
    385     DNX_RX_TRAP_LIF_PROFILE_STACK_TRAP_2 = 2,
    386     DNX_RX_TRAP_LIF_PROFILE_STACK_MIRROR = 3
    387 } dnx_rx_trap_lif_profiles_e;
    388 
    389 /**
    390  * \brief enum for etpp oam trap types.
    391  */
    392 typedef enum
    393 {
    394     DNX_RX_TRAP_ETPP_OAM_INVALID = -1,
    395     DNX_RX_TRAP_ETPP_OAM_FIRST = 0,
    396 
    397     /** OAM ETPP trap with destination OAMP*/
    398     DNX_RX_TRAP_ETPP_OAM_UP_MEP_OAMP = DNX_RX_TRAP_ETPP_OAM_FIRST,
    399 
    400     /** OAM ETPP trap with user configurable destination*/
    401     DNX_RX_TRAP_ETPP_OAM_UP_MEP_DEST1 = 1,
    402 
    403     /** OAM ETPP trap with user configurable destination*/
    404     DNX_RX_TRAP_ETPP_OAM_UP_MEP_DEST2 = 2,
    405 
    406     /** OAM ETPP level error trap*/
    407     DNX_RX_TRAP_ETPP_OAM_LEVEL_ERR = 3,
    408 
    409     /** OAM ETPP passive error trap*/
    410     DNX_RX_TRAP_ETPP_OAM_PASSIVE_ERR = 4,
    411 
    412     /** OAM ETPP reflector trap*/
    413     DNX_RX_TRAP_ETPP_OAM_REFLECTOR = 5,
    414     /** IFA ETPP trap*/
    415     DNX_RX_TRAP_ETPP_IFA2 = 6,
    416     DNX_RX_TRAP_ETPP_OAM_NOF_TRAPS
    417 } dnx_rx_trap_etpp_oam_types_e;
    418 
    419 typedef struct dnx_rx_trap_protocol_config_s
    420 {
    421     /** trap id */
    422     int trap_id;
    423 
    424     /** forward strength 0-16 */
    425     int fwd_strength;
    426 
    427     /** snoop strength 0-7 */
    428     int snp_strength;
    429 } dnx_rx_trap_protocol_config_t;
    430 
    431 typedef struct dnx_rx_trap_protocol_my_arp_ndp_config_s
    432 {
    433     /** two ip addresses defineing My-ARP/My-NDP trap */
    434     uint32 ip_1;
    435     uint32 ip_2;
    436 
    437     /** relevent yo My-ARP only */
    438     uint8 ignore_da;
    439 } dnx_rx_trap_protocol_my_arp_ndp_config_t;
    440 
    441 typedef struct dnx_rx_trap_action_profile_s
    442 {
    443     /** action profile 0-7 */
    444     int profile;
    445 
    446     /** forward strength 0-15 */
    447     int fwd_strength;
    448 
    449     /** snoop strength 0-7 */
    450     int snp_strength;
    451 } dnx_rx_trap_action_profile_t;
    452 
    453 /*
    454   * }
    455   */
    456 
    457 /**
    458 * \brief
    459 *  Check if specific trap was already allocated
    460 * \par DIRECT INPUT:
    461 *   \param [in] unit            -  Unit Id
    462 *   \param [in] trap_id         -  trap id to check
    463 *   \param [in] is_allocated_p  - Pointer type of int \n
    464 *               \b As \b output - \n
    465 *               Pointer will be filled by TRUE in case the trap was already created
    466 * \par INDIRECT INPUT:
    467 *   * None
    468 * \par DIRECT OUTPUT:
    469 *   shr_error_e -  Error Type
    470 * \par INDIRECT OUTPUT:
    471 *   * None
    472 * \remark
    473 *   * None
    474 * \see
    475 *   * None
    476 */
    477 shr_error_e dnx_rx_trap_is_trap_id_allocated(
    478     int unit,
    479     int trap_id,
    480     uint8 *is_allocated_p);
    481 
    482 /**
    483 * \brief
    484 *  Returns the ingress class (predefined, oam, user define) of trap based on trap type value
    485 * \par DIRECT INPUT:
    486 *   \param [in] unit       -   Unit Id
    487 *   \param [in] trap_type    -  trap type value to check
    488 *   \param [out] trap_class_p  -  Pointer to a memory type of dnx_rx_trap_class_e. \n
    489 *           \b As \b output - \n
    490 *           contains the trap class.
    491 * \par INDIRECT INPUT:
    492 *   * None
    493 * \par DIRECT OUTPUT:
    494 *   shr_error_e - Error Type
    495 * \par INDIRECT OUTPUT:
    496 *   * None
    497 * \remark
    498 *   * None
    499 * \see
    500 *   * None
    501 */
    502 shr_error_e dnx_rx_trap_ingress_class_get(
    503     int unit,
    504     int trap_type,
    505     dnx_rx_trap_class_e * trap_class_p);
    506 
    507 /**
    508 * \brief
    509 *  Retrun a list of trap types supported per block and class
    510 * \param [in] unit              - Device ID
    511 * \param [in] trap_block        - Stage to get trap ID for
    512 * \param [in] trap_class        -  Trap class to get Id of
    513 * \param [out] trap_type_list_p - List of trap ids
    514 * \param [out] trap_type_nof_p  - number of trap ids in the list
    515 * \return
    516 *   shr_error_e - Error Type
    517 * \remark
    518 *   * None
    519 * \see
    520 *   * None
    521 */
    522 shr_error_e dnx_rx_trap_type_list(
    523     int unit,
    524     dnx_rx_trap_block_e trap_block,
    525     dnx_rx_trap_class_e trap_class,
    526     uint32 **trap_type_list_p,
    527     int *trap_type_nof_p);
    528 
    529 /**
    530 * \brief
    531 *  Retrun trap name(string) of trap type
    532 * \param [in] unit            - Device ID
    533 * \param [in] trap_type     - Trap type to get its name
    534 * \param [out] trap_name  - Trap name
    535 * \return
    536 *   shr_error_e - Error Type
    537 * \remark
    538 *   * None
    539 * \see
    540 *   * None
    541 */
    542 shr_error_e dnx_rx_trap_type_to_name(
    543     int unit,
    544     bcm_rx_trap_t trap_type,
    545     char *trap_name);
    546 
    547 /**
    548 * \brief
    549 * Initialize error (invalid_dest and SER) handling configuration:
    550 * Configure destination to Redirect to cpu
    551 * Stamp given trap code
    552 * \param [in] unit  - Device ID
    553 * \return
    554 *   shr_error_e - Error Type
    555 * \remark
    556 *   * None
    557 * \see
    558 *   * None
    559 */
    560 shr_error_e dnx_rx_trap_ingress_err_handling_init(
    561     int unit);
    562 
    563 /**
    564  * \brief -
    565  *   Initialize SER action profile
    566  *
    567  * \param [in] unit - Unit ID
    568  * \param [in] trap_id - Trap id
    569  *
    570  * \return
    571  *   \retval  Zero if no error was detected
    572  *   \retval  Negative if error was detected. See \ref shr_error_e
    573  *
    574  * \remark
    575  *
    576  * \see
    577  *  None.
    578  */
    579 shr_error_e dnx_rx_trap_erpp_ser_handling_init(
    580     int unit,
    581     int trap_id);
    582 
    583 /**
    584 * \brief
    585 *  Set additional configuration of My-NDP protocol trap.
    586 * \par DIRECT INPUT:
    587 *   \param [in] unit        - unit id
    588 *   \param [in] word_index  - NDP IPv6 32b piece index
    589 *   \param [in] config_p    - My-ARP/My-NDP protocol traps additional configuration
    590 * \par INDIRECT INPUT:
    591 *   * None
    592 * \par DIRECT OUTPUT:
    593 *   shr_error_e - Error type
    594 * \par INDIRECT OUTPUT:
    595 *   * None
    596 * \remark
    597 *   * None
    598 * \see
    599 *   * None
    600 */
    601 shr_error_e dnx_rx_trap_protocol_my_ndp_set(
    602     int unit,
    603     int word_index,
    604     dnx_rx_trap_protocol_my_arp_ndp_config_t * config_p);
    605 
    606 /**
    607 * \brief
    608 *  Set additional configuration of My-ARP protocol trap.
    609 * \par DIRECT INPUT:
    610 *   \param [in] unit      - unit id
    611 *   \param [in] config_p  - My-ARP/My-NDP protocol traps additional configuration
    612 * \par INDIRECT INPUT:
    613 *   * None
    614 * \par DIRECT OUTPUT:
    615 *   shr_error_e - Error type
    616 * \par INDIRECT OUTPUT:
    617 *   * None
    618 * \remark
    619 *   * None
    620 * \see
    621 *   * None
    622 */
    623 shr_error_e dnx_rx_trap_protocol_my_arp_set(
    624     int unit,
    625     dnx_rx_trap_protocol_my_arp_ndp_config_t * config_p);
    626 /**
    627 * \brief
    628 * Get additional configuration of My-NDP protocol trap.
    629 * \par DIRECT INPUT:
    630 *   \param [in] unit        -  unit id
    631 *   \param [in] word_index  - NDP IPv6 32b piece index
    632 *   \param [out] config_p   -   My-ARP/My-NDP protocol traps additional configuration
    633 * \par INDIRECT INPUT:
    634 *   * None
    635 * \par DIRECT OUTPUT:
    636 *   shr_error_e - Error type
    637 * \par INDIRECT OUTPUT:
    638 *   * None
    639 * \remark
    640 *   * None
    641 * \see
    642 *   * None
    643 */
    644 shr_error_e dnx_rx_trap_protocol_my_ndp_get(
    645     int unit,
    646     int word_index,
    647     dnx_rx_trap_protocol_my_arp_ndp_config_t * config_p);
    648 
    649 /**
    650 * \brief
    651 * Get additional configuration of My-ARP protocol trap.
    652 * \par DIRECT INPUT:
    653 *   \param [in] unit           -  unit id
    654 *   \param [out] config_p   -   My-ARP/My-NDP protocol traps additional configuration
    655 * \par INDIRECT INPUT:
    656 *   * None
    657 * \par DIRECT OUTPUT:
    658 *   shr_error_e - Error type
    659 * \par INDIRECT OUTPUT:
    660 *   * None
    661 * \remark
    662 *   * None
    663 * \see
    664 *   * None
    665 */
    666 shr_error_e dnx_rx_trap_protocol_my_arp_get(
    667     int unit,
    668     dnx_rx_trap_protocol_my_arp_ndp_config_t * config_p);
    669 
    670 /**
    671 * \brief
    672 *  This function enables or disables the Ignore DA ICMP filter field,
    673 *  based on the enable field value.
    674 *
    675 * \par DIRECT INPUT:
    676 *   \param [in] unit    - Unit Id
    677 *   \param [in] enable  - Enable/Disable for ICMP Ignore DA
    678 * \par INDIRECT INPUT:
    679 *   * None
    680 * \par DIRECT OUTPUT:
    681 *   shr_error_e - Error type
    682 * \par INDIRECT OUTPUT:
    683 *   * None
    684 * \remark
    685 *   * None
    686 * \see
    687 *   * None
    688 */
    689 shr_error_e dnx_rx_trap_protocol_icmp_ignore_da_hw_set(
    690     int unit,
    691     int enable);
    692 
    693 /**
    694 * \brief
    695 *  This function gets the value of the Ignore DA ICMP filter field.
    696 *
    697 * \par DIRECT INPUT:
    698 *   \param [in] unit     - Unit Id
    699 *   \param [out] enable  - Enable/Disable for ICMP Ignore DA
    700 * \par INDIRECT INPUT:
    701 *   * None
    702 * \par DIRECT OUTPUT:
    703 *   shr_error_e - Error type
    704 * \par INDIRECT OUTPUT:
    705 *   * None
    706 * \remark
    707 *   * None
    708 * \see
    709 *   * None
    710 */
    711 shr_error_e dnx_rx_trap_protocol_icmp_ignore_da_hw_get(
    712     int unit,
    713     int *enable);
    714 
    715 /**
    716 * \brief
    717 *  Sets the Compressed ICMP type in the ICMP type compression table.
    718 * \par DIRECT INPUT:
    719 *   \param [in] unit                    - unit Id
    720 *   \param [in] icmp_type               - ICMP type
    721 *   \param [out] compressed_icmp_type    - Compressed ICMP type
    722 * \par INDIRECT INPUT:
    723 *   * None
    724 * \par DIRECT OUTPUT:
    725 *   shr_error_e - Error type
    726 * \par INDIRECT OUTPUT:
    727 *   * None
    728 * \remark
    729 *   * None
    730 * \see
    731 *   * None
    732 */
    733 shr_error_e dnx_rx_trap_icmp_compressed_type_hw_get(
    734     int unit,
    735     int icmp_type,
    736     uint32 *compressed_icmp_type);
    737 
    738 /**
    739 * \brief
    740 *  Retrieves the MTU profile data which has been set for the allocated context.
    741 * \par DIRECT INPUT:
    742 *   \param [in] unit                    - unit Id
    743 *   \param [in] mtu_profile             - MTU Profile
    744 *   \param [out] mtu_profile_config_p   - MTU Profile Config data
    745 * \par INDIRECT INPUT:
    746 *   * None
    747 * \par DIRECT OUTPUT:
    748 *   shr_error_e - Error type
    749 * \par INDIRECT OUTPUT:
    750 *   * None
    751 * \remark
    752 *   * None
    753 * \see
    754 *   * None
    755 */
    756 shr_error_e dnx_rx_trap_mtu_profile_data_get(
    757     int unit,
    758     int mtu_profile,
    759     dnx_rx_trap_mtu_profile_config_t * mtu_profile_config_p);
    760 
    761 /**
    762 * \brief
    763 *  Check if the supplied ingress trap_type(ID) requires a trap strength to be set.
    764 * \par DIRECT INPUT:
    765 *   \param [in] unit              -  Unit Id
    766 *   \param [in] trap_type         -  Ingress trap type (HW trap id value) to configure
    767 *   \param [out] is_strengthless  -  Strengthless trap indicator.
    768 * \par INDIRECT INPUT:
    769 *   * None
    770 * \par DIRECT OUTPUT:
    771 *   shr_error_e -  Error Type
    772 * \par INDIRECT OUTPUT:
    773 *   * None
    774 * \remark
    775 *   * None
    776 * \see
    777 *   * None
    778 */
    779 shr_error_e dnx_rx_trap_ingress_strengthless_trap_check(
    780     int unit,
    781     int trap_type,
    782     int *is_strengthless);
    783 
    784 /**
    785 * \brief
    786 *  This function allocates a recycle command according to given configuration.
    787 * \par DIRECT INPUT:
    788 *   \param [in] unit      -  unit id
    789 *   \param [in] old_recycle_cmd  -old recycle command configured for trap (4b)
    790 *   \param [in] recycle_cmd_config_p      -  recycle command configuration
    791 *   \param [in] new_recycle_cmd_p      -  new recycle command allocated
    792 * \par INDIRECT INPUT:
    793 *   * None
    794 * \par DIRECT OUTPUT:
    795 *   shr_error_e -  Error Type
    796 * \par INDIRECT OUTPUT:
    797 *   * None
    798 * \remark
    799 *   * None
    800 * \see
    801 *   * None
    802 */
    803 shr_error_e dnx_rx_trap_etpp_recycle_cmd_profile_set(
    804     int unit,
    805     uint8 old_recycle_cmd,
    806     dnx_rx_trap_recycle_cmd_config_t * recycle_cmd_config_p,
    807     int *new_recycle_cmd_p);
    808 
    809 /**
    810 * \brief
    811 *  This function gets the recycle command from HW .
    812 * \par DIRECT INPUT:
    813 *   \param [in] unit      -  unit id
    814 *   \param [in] core_id      -  core id
    815 *   \param [in] recycle_cmd  - recycle command (4b)
    816 *   \param [out] recycle_cmd_config      -  recycle command configuration: trap_id and strength
    817 * \par INDIRECT INPUT:
    818 *   * None
    819 * \par DIRECT OUTPUT:
    820 *   shr_error_e -  Error Type
    821 * \par INDIRECT OUTPUT:
    822 *   * None
    823 * \remark
    824 *   * None
    825 * \see
    826 *   * None
    827 */
    828 shr_error_e dnx_rx_trap_etpp_recycle_cmd_hw_get(
    829     int unit,
    830     uint32 core_id,
    831     uint8 recycle_cmd,
    832     dnx_rx_trap_recycle_cmd_config_t * recycle_cmd_config);
    833 
    834 /**
    835 * \brief
    836 *  Allocate and Set the ETPP LIF trap Profile (Trap or Mirror)
    837 * \par DIRECT INPUT:
    838 *   \param [in] unit        - unit Id
    839 *   \param [in] action_gport - action gport encoding Trap-Action-Profile
    840 *   \param [in] old_lif_trap_profile - old trap action profile from the lif
    841 *   \param [out] new_lif_trap_profile_p - - new trap action profile from the lif
    842 * \par INDIRECT INPUT:
    843 *   * None
    844 * \par DIRECT OUTPUT:
    845 *   shr_error_e - Error type
    846 * \par INDIRECT OUTPUT:
    847 *   * None
    848 * \remark
    849 *   * None
    850 * \see
    851 *   * None
    852 */
    853 shr_error_e dnx_rx_trap_lif_etpp_trap_profile_allocate_and_hw_update(
    854     int unit,
    855     uint32 old_lif_trap_profile,
    856     bcm_gport_t action_gport,
    857     uint32 *new_lif_trap_profile_p);
    858 
    859 #endif/*_RX_API_INCLUDED__*/