rx.h (7599B)
1 /** 2 * \file bcm_int/dnx/rx/rx.h 3 * 4 * Internal DNX RX APIs 5 PIs This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file. 6 PIs 7 PIs Copyright 2007-2020 Broadcom Inc. All rights reserved. 8 */ 9 10 #ifndef _RX_API_INCLUDED__ 11 /* 12 * { 13 */ 14 #define _RX_API_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/rx.h> 21 #include <include/bcm_int/dnx/algo/rx/algo_rx.h> 22 #include <include/bcm_int/dnx/algo/algo_gpm.h> 23 #include <shared/shrextend/shrextend_error.h> 24 #include <shared/utilex/utilex_bitstream.h> 25 #include <shared/bslenum.h> 26 #include <soc/dnx/dbal/dbal.h> 27 #include <bcm/types.h> 28 29 #define DNX_RX_ERPP_PMF_COUNTER_NOF (0x2) 30 #define DNX_RX_MTU_PROFILE_LIF_COMPRESSED_LAYER_TYPES (0x7) 31 32 /** 33 * snoop command reserved for snoop all packet to CPU 34 */ 35 #define DNX_RX_SNOOP_CMD_TO_CPU (1) 36 37 /** 38 *\brief - data of a ERPP trap action 39 * Holds all ERPP trap actions configured by the user using 40 * dnx_rx_trap_set() 41 */ 42 typedef struct dnx_rx_trap_erpp_config_s 43 { 44 /** when set traffic class is valid */ 45 uint8 tc_valid; 46 47 /** traffic class value */ 48 uint8 tc; 49 50 /** when set, drop presedence is valid */ 51 uint8 dp_valid; 52 53 /** drop presedence value */ 54 uint8 dp; 55 56 /** when set, quality of service is valid */ 57 uint8 qos_id_valid; 58 59 /** quality of service value */ 60 uint8 qos_id; 61 62 /** when set, PP DSP is valid */ 63 uint8 pp_dsp_valid; 64 65 /** PP DSP value */ 66 uint32 pp_dsp; 67 68 /** when set, packet is discarded */ 69 uint8 discard; 70 71 /** When set, PP drop reason is valid*/ 72 uint8 pp_drop_reason_valid; 73 74 /** PP drop reason value */ 75 int pp_drop_reason; 76 77 /** When Snoop profile is valid*/ 78 uint8 snoop_profile_valid; 79 80 /** Snoop profile */ 81 uint8 snoop_profile; 82 83 /** When Mirror profile is valid*/ 84 uint8 mirror_profile_valid; 85 86 /** Mirror profile */ 87 uint8 mirror_profile; 88 89 /** When CUD Outlif_or_MCDB pointer is valid*/ 90 uint8 outlif_or_mcdb_ptr_valid; 91 92 /** CUD Outlif_or_MCDB pointer */ 93 uint32 outlif_or_mcdb_ptr; 94 95 /** When Counter_profile is valid*/ 96 uint8 counter_profile_valid[DNX_RX_ERPP_PMF_COUNTER_NOF]; 97 98 /** Counter_profile */ 99 uint8 counter_profile[DNX_RX_ERPP_PMF_COUNTER_NOF]; 100 101 /** When Counter_ptr is valid*/ 102 uint8 counter_ptr_valid[DNX_RX_ERPP_PMF_COUNTER_NOF]; 103 104 /** Counter_ptr */ 105 uint32 counter_ptr[DNX_RX_ERPP_PMF_COUNTER_NOF]; 106 107 } dnx_rx_trap_erpp_config_t; 108 109 /** 110 * \brief ETPP trap action data for template manager. 111 */ 112 typedef struct dnx_rx_trap_etpp_action_s 113 { 114 /** When set packet is dropped */ 115 uint8 is_pkt_drop; 116 117 /** When set, recycling packet is in high priority */ 118 uint8 is_recycle_high_priority; 119 120 /** When set, only the first 128B of the Forward packet are copied to the recycle port */ 121 uint8 is_recycle_crop_pkt; 122 123 /** When set, Aligner appends the original FTMH to the Recycle Packet */ 124 uint8 is_recycle_append_ftmh; 125 126 /** forward recycle command. this field is used for providing additional information to IRPP */ 127 uint8 recycle_cmd; 128 129 /** ingress trap id stamped on FHEI */ 130 dbal_enum_value_field_ingress_trap_id_e ingress_trap_id; 131 132 /** Packet processing drop reason */ 133 int pp_drop_reason; 134 135 /** When set recycle copy is dropped */ 136 uint8 is_rcy_copy_drop; 137 138 /** When set profile is configured with keep original packet VR fields */ 139 uint8 is_pkt_keep_fabric_headers; 140 } dnx_rx_trap_etpp_action_t; 141 142 /** 143 * \brief recycle trap configuration. 144 */ 145 typedef struct dnx_rx_trap_recycle_cmd_config_s 146 { 147 /** forward recycle strength, used for providing the strength of recycle ingress trap */ 148 uint8 recycle_strength; 149 150 /** ingress trap id to indicate the recycle ingress trap */ 151 dbal_enum_value_field_ingress_trap_id_e ingress_trap_id; 152 } dnx_rx_trap_recycle_cmd_config_t; 153 154 /** 155 * \brief ETPP trap action profile configuration. 156 */ 157 typedef struct dnx_rx_trap_etpp_config_s 158 { 159 /** ETPP trap action */ 160 dnx_rx_trap_etpp_action_t action; 161 162 /** Recycle command configuration */ 163 dnx_rx_trap_recycle_cmd_config_t recycle_cmd_config; 164 } dnx_rx_trap_etpp_config_t; 165 166 /** 167 * \brief MTU Profile configuration for Template manager. 168 */ 169 170 typedef struct dnx_rx_trap_mtu_data_s 171 { 172 /** MTU value */ 173 int mtu; 174 175 /** Forward trap strength value */ 176 uint8 fwd_strength; 177 178 /** Snoop trap strength value */ 179 uint8 snp_strength; 180 181 /** Trap Action profile */ 182 uint8 trap_action_profile; 183 184 } dnx_rx_trap_mtu_data_t; 185 186 typedef struct dnx_rx_trap_mtu_profile_config_s 187 { 188 dnx_rx_trap_mtu_data_t mtu_data[DNX_RX_MTU_PROFILE_LIF_COMPRESSED_LAYER_TYPES]; 189 190 } dnx_rx_trap_mtu_profile_config_t; 191 192 /** 193 * \brief defination of DNX header ihformation 194 */ 195 typedef struct dnx_rx_parse_headers_s 196 { 197 /** FTMH.TM-Action-Type */ 198 bcm_pkt_dnx_ftmh_action_type_t action_type; 199 /** Headers stack */ 200 bcm_pkt_dnx_t dnx_header_stack[BCM_PKT_NOF_DNX_HEADERS]; 201 /** Number of DNX headers */ 202 uint8 dnx_header_count; 203 /** Length of total headers */ 204 uint32 header_length; 205 /** TRUE: then packet is trapped to CPU and trap-code/qualifier are valid */ 206 uint8 is_trapped; 207 /** TRUE: packet was punted to CPU by OAMP */ 208 uint8 is_punted; 209 /** FTMH.TM-Action-Is-MC */ 210 uint8 is_mc_traffic; 211 /** INTERNAL.FHEI.Code */ 212 uint32 cpu_trap_code; 213 /** INTERNAL.FHEI.Qualifier */ 214 uint32 cpu_trap_qualifier; 215 /** FTMH.Source-System-Port-Aggregate */ 216 uint32 src_sys_port; 217 /** INTERNAL.Forward-Domain */ 218 uint32 internal_inlif_inrif; 219 /** FTMH.PP_DSP */ 220 uint32 otm_port; 221 /** FTMH.Out-LIF (or MC-ID) */ 222 uint32 outlif_mcid; 223 /** FTMH LB-Key Extension */ 224 uint32 lb_key; 225 /** FTMH DSP Extension */ 226 uint32 dsp_ext; 227 /** FTMH stacking Extension */ 228 uint32 stacking_ext; 229 /** FTMH.TC */ 230 uint32 tc; 231 /** FTMH.DP */ 232 uint32 dp; 233 /** INTERNAL.Unknow_addr */ 234 uint8 unknown_addr; 235 /** INTERNAL.fwd_code in JR mode */ 236 uint32 jr_mode_fwd_code; 237 } dnx_rx_parse_headers_t; 238 239 int dnx_rx_packet_parse( 240 int unit, 241 bcm_pkt_t * pkt, 242 uint8 device_access_allowed); 243 244 int dnx_rx_packet_parser_etpp_mtu_trap( 245 int unit, 246 bcm_pkt_t * pkt, 247 uint8 is_recycle_append_ftmh); 248 249 /** 250 * \brief - Initialize dnx rx module 251 * Will init all relevant info, such as Traps etc.. 252 * \par DIRECT_INPUT: 253 * \param [in] unit - Unit-ID 254 * 255 * \par INDIRECT INPUT: 256 * * DNX data related RX module information 257 * \par DIRECT OUTPUT: 258 * shr_error_e 259 * \par INDIRECT OUTPUT 260 * * Rx HW related regs/mems 261 * \remark 262 * * None 263 * \see 264 * * None 265 */ 266 shr_error_e dnx_rx_init( 267 int unit); 268 269 /** 270 * \brief - Deinitialize dnx rx module 271 * Will deinit all relevant info, such as Traps etc.. 272 * \par DIRECT_INPUT: 273 * \param [in] unit - Unit-ID 274 * 275 * \par INDIRECT INPUT: 276 * * None 277 * \par DIRECT OUTPUT: 278 * shr_error_e - Error Type 279 * \par INDIRECT OUTPUT 280 * * None 281 * \remark 282 * * None 283 * \see 284 * * None 285 */ 286 shr_error_e dnx_rx_deinit( 287 int unit); 288 289 /* 290 * Procedures for rx_trap.c { 291 */ 292 293 /** 294 * \brief 295 * Configure all trap related that is relevant for device initiation 296 * \par DIRECT INPUT: 297 * \param [in] unit - Unit Id 298 * \par INDIRECT INPUT: 299 * * None 300 * \par DIRECT OUTPUT: 301 * shr_error_e - Error Type 302 * \par INDIRECT OUTPUT: 303 * * None 304 * \remark 305 * * None 306 * \see 307 * * None 308 */ 309 shr_error_e dnx_rx_trap_init( 310 int unit); 311 312 /* 313 * } Procedures for rx_trap.c 314 */ 315 316 /* 317 * } 318 */ 319 #endif/*_RX_API_INCLUDED__*/