in_lif_profile.h (28525B)
1 /** \file in_lif_profile.h 2 * 3 * in_lif profile management for DNX. 4 * 5 * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file. 6 * 7 * Copyright 2007-2020 Broadcom Inc. All rights reserved. 8 */ 9 #ifndef IN_LIF_PROFILE_H_INCLUDED 10 /* 11 * { 12 */ 13 #define IN_LIF_PROFILE_H_INCLUDED 14 15 #ifndef BCM_DNX_SUPPORT 16 #error "This file is for use by DNX (JR2) family only!" 17 #endif /* BCM_DNX_SUPPORT */ 18 19 #include <include/bcm_int/dnx/rx/rx.h> 20 #include <bcm/l3.h> 21 #include <shared/shrextend/shrextend_debug.h> 22 #include <soc/dnx/dbal/auto_generated/dbal_defines_fields.h> 23 #include <bcm_int/dnx/aacl/aacl_in_intf.h> 24 25 /***************************************************************************************/ 26 /* 27 * Defines 28 */ 29 /***************************************************************************************/ 30 /* 31 * number of bits that are used for in_lif_profile and eth_rif_profile 32 */ 33 #define NOF_ETH_RIF_PROFILE_BITS dnx_data_lif.in_lif.nof_used_eth_rif_profile_bits_get(unit) 34 /* 35 * in_lif_profile in HW is 8 bits but in order to have a simpler implementation given all the restrictions we decided 36 * to deal with only 7 bits out of the 8 37 */ 38 #define NOF_IN_LIF_PROFILE_BITS dnx_data_lif.in_lif.nof_used_in_lif_profile_bits_get(unit) 39 40 /* 41 * define number of bits and start bits for PMF reserved bits in in_lif_profile and eth_rif_profile 42 */ 43 #define ETH_RIF_PROFILE_PMF_RESERVED_NOF_BITS dnx_data_field.profile_bits.nof_ing_eth_rif_get(unit) 44 #define ETH_RIF_PROFILE_PMF_RESERVED_START_BIT NOF_ETH_RIF_PROFILE_BITS - ETH_RIF_PROFILE_PMF_RESERVED_NOF_BITS 45 #define IN_LIF_PROFILE_PMF_RESERVED_NOF_BITS dnx_data_field.profile_bits.nof_ing_in_lif_get(unit) 46 #define IN_LIF_PROFILE_PMF_RESERVED_START_BIT NOF_IN_LIF_PROFILE_BITS - IN_LIF_PROFILE_PMF_RESERVED_NOF_BITS 47 48 /* 49 * define number of bits for egress in_lif_profile bits according to soc properties 50 */ 51 #define IN_LIF_ORIENTATION_NOF_VALUES dnx_data_lif.in_lif.in_lif_profile_allocate_orientation_get(unit) 52 #define IN_LIF_ORIENTATION_NOF_BITS utilex_log2_round_up(IN_LIF_ORIENTATION_NOF_VALUES) 53 #define IVE_INNER_QOS_DP_PROFILE_NOF_VALUES dnx_data_lif.in_lif.in_lif_profile_allocate_policer_inner_dp_get(unit) 54 #define IVE_INNER_QOS_DP_PROFILE_NOF_BITS utilex_log2_round_up(IVE_INNER_QOS_DP_PROFILE_NOF_VALUES) 55 #define IVE_OUTER_QOS_DP_PROFILE_NOF_VALUES dnx_data_lif.in_lif.in_lif_profile_allocate_policer_outer_dp_get(unit) 56 #define IVE_OUTER_QOS_DP_PROFILE_NOF_BITS utilex_log2_round_up(IVE_OUTER_QOS_DP_PROFILE_NOF_VALUES) 57 #define SAME_INTERFACE_MODE_NOF_VALUES dnx_data_lif.in_lif.in_lif_profile_allocate_same_interface_mode_get(unit) 58 #define SAME_INTERFACE_MODE_NOF_BITS utilex_log2_round_up(SAME_INTERFACE_MODE_NOF_VALUES) 59 60 /* 61 * define number of bits for native indexed mode in_lif_profile bits according to soc properties 62 */ 63 #define NATIVE_INDEXED_MODE_NOF_VALUES dnx_data_lif.in_lif.in_lif_profile_allocate_indexed_mode_get(unit) 64 #define NATIVE_INDEXED_MODE_NOF_BITS utilex_log2_round_up(NATIVE_INDEXED_MODE_NOF_VALUES) 65 /* 66 * defines the number of values, that should be allocated to support PWE indexed mode indication 67 */ 68 #define IN_LIF_PROFILE_PWE_INDEXED_MODE_NOF_VALUES 2 69 /* 70 * define number of bits and start bits for EGRESS reserved bits in in_lif_profile and eth_rif_profile 71 * meanwhile we support only IN_LIF_PROFILE egress reserved bits 72 */ 73 #define ETH_RIF_PROFILE_EGRESS_RESERVED_NOF_BITS 0 74 #define ETH_RIF_PROFILE_EGRESS_RESERVED_START_BIT (ETH_RIF_PROFILE_PMF_RESERVED_START_BIT - ETH_RIF_PROFILE_EGRESS_RESERVED_NOF_BITS) 75 #define IN_LIF_PROFILE_EGRESS_RESERVED_NOF_BITS (IN_LIF_ORIENTATION_NOF_BITS + IVE_INNER_QOS_DP_PROFILE_NOF_BITS + IVE_OUTER_QOS_DP_PROFILE_NOF_BITS + SAME_INTERFACE_MODE_NOF_BITS) 76 #define IN_LIF_PROFILE_EGRESS_RESERVED_START_BIT (IN_LIF_PROFILE_PMF_RESERVED_START_BIT - IN_LIF_PROFILE_EGRESS_RESERVED_NOF_BITS) 77 #define IN_LIF_PROFILE_NATIVE_INDEXED_MODE_START_BIT (IN_LIF_PROFILE_PMF_RESERVED_START_BIT - IN_LIF_PROFILE_EGRESS_RESERVED_NOF_BITS - NATIVE_INDEXED_MODE_NOF_BITS) 78 /* 79 * defines the max number of supported bits for in_lif_profile in JR sys header mode 80 */ 81 #define IN_LIF_PROFILE_EGRESS_NOF_BITS_JR_MODE 2 82 #define IN_LIF_PROFILE_EGRESS_NOF_BITS_DSCP_MODE 1 83 #define JR_COMP_MODE_ONLY_SYS_SCOPE_ENABLED_BY_SOC_PROPERTIES 1 84 #define JR_COMP_MODE_ONLY_DEV_SCOPE_ENABLED_BY_SOC_PROPERTIES 2 85 #define JR_COMP_MODE_BOTH_DEV_AND_SYS_SCOPE_ENABLED_BY_SOC_PROPERTIES 3 86 /* 87 * number of supported in_lif_profiles after reserved bits 88 */ 89 #define NOF_IN_LIF_PROFILES (1 << (NOF_IN_LIF_PROFILE_BITS - IN_LIF_PROFILE_EGRESS_RESERVED_NOF_BITS - IN_LIF_PROFILE_PMF_RESERVED_NOF_BITS - NATIVE_INDEXED_MODE_NOF_BITS)) 90 #define NOF_IN_LIF_PROFILE_INGRESS_BITS (NOF_IN_LIF_PROFILE_BITS - IN_LIF_PROFILE_EGRESS_RESERVED_NOF_BITS - IN_LIF_PROFILE_PMF_RESERVED_NOF_BITS - NATIVE_INDEXED_MODE_NOF_BITS) 91 /* 92 * number of supported eth_rif_profiles after reserved bits 93 */ 94 #define NOF_ETH_RIF_PROFILES (1 << (NOF_ETH_RIF_PROFILE_BITS - ETH_RIF_PROFILE_EGRESS_RESERVED_NOF_BITS - ETH_RIF_PROFILE_PMF_RESERVED_NOF_BITS - NATIVE_INDEXED_MODE_NOF_BITS)) 95 #define NOF_ETH_RIF_PROFILE_INGRESS_BITS (NOF_ETH_RIF_PROFILE_BITS - ETH_RIF_PROFILE_EGRESS_RESERVED_NOF_BITS - ETH_RIF_PROFILE_PMF_RESERVED_NOF_BITS - NATIVE_INDEXED_MODE_NOF_BITS) 96 /* 97 * Routing Enablers Defines 98 */ 99 /** 100 * initial enablers vector before calling bcm_l3_intf_create 101 */ 102 #define INITIAL_ENABLERS_VECTOR_MSB (0x0) 103 #define INITIAL_ENABLERS_VECTOR_LSB (0x00000004) 104 /** 105 * Specify all routing enablers are disabled 106 */ 107 #define DEFAULT_ROUTING_ENABLERS_PROFILE (0x0) 108 109 /** 110 * number of enablers vector profiles 111 */ 112 #define NOF_ENTRIES_ENABLERS_VECTOR (32) 113 /** 114 * number of routing enablers profile bits 115 */ 116 #define NOF_ENABLERS_PROFILE_BITS (5) 117 /* 118 * supported enablers flags 119 */ 120 #define ENABLERS_DISABLE_SUPPORTED_FLAGS (BCM_L3_INGRESS_ROUTE_DISABLE_IP4_UCAST| \ 121 BCM_L3_INGRESS_ROUTE_DISABLE_IP6_UCAST|BCM_L3_INGRESS_ROUTE_DISABLE_IP6_MCAST| \ 122 BCM_L3_INGRESS_ROUTE_DISABLE_IP4_MCAST|BCM_L3_INGRESS_ROUTE_DISABLE_MPLS) 123 /***************************************************************************************/ 124 /* 125 * flags for setting cs_in_lif_profile value 126 */ 127 /** 128 * For PWE 129 */ 130 #define DNX_IN_LIF_PROFILE_CS_PROFILE_PWE_LIF_SCOPED (1 << 0) 131 132 /** 133 * For EVPN_IML 134 */ 135 #define DNX_IN_LIF_PROFILE_CS_PROFILE_EVPN_IML_LIF_SCOPED (1 << 0) 136 #define DNX_IN_LIF_PROFILE_CS_PROFILE_EVPN_IML_AH_NO_FL (1 << 1) 137 #define DNX_IN_LIF_PROFILE_CS_PROFILE_EVPN_IML_AH_FL_ONLY (1 << 2) 138 #define DNX_IN_LIF_PROFILE_CS_PROFILE_EVPN_IML_AH_FL_CW (1 << 3) 139 140 141 /** 142 * For LIF 143 */ 144 #define DNX_IN_LIF_PROFILE_CS_PROFILE_LIF_WITH_VIRTUAL_IP (1 << 0) 145 #define DNX_IN_LIF_PROFILE_CS_PROFILE_LIF_WITH_MPLS_NAMESPACE (1 << 1) 146 #define DNX_IN_LIF_PROFILE_CS_PROFILE_LIF_WITH_NAT (1 << 2) 147 #define DNX_IN_LIF_PROFILE_CS_PROFILE_LIF_WITH_AACL (1 << 3) 148 149 /***************************************************************************************/ 150 /* 151 * Default profiles/values defines 152 */ 153 /** 154 * Specify default RPF mode is RPF disabled 155 */ 156 #define DEFAULT_RPF_MODE (DBAL_ENUM_FVAL_RPF_MODE_DISABLE) 157 /** 158 * Specify default Context-Selection value when no specific action is required for the in_lif_profile (or on the case of init/clear) in VTT stage 159 */ 160 #define DNX_IN_LIF_PROFILE_CS_DEFAULT (0) 161 /** 162 * Specify default Context-Selection value when no specific action is required for the in_lif_profile (or on the case of init/clear) in FWD stage 163 */ 164 #define DNX_IN_LIF_FWD_PROFILE_CS_DEFAULT (0) 165 /** 166 * Specify default in_lif_profile 167 */ 168 #define DNX_IN_LIF_PROFILE_DEFAULT (0) 169 /** 170 * Specify default data for trap profiles 171 */ 172 #define DEFAULT_TRAP_PROFILES_DATA (0) 173 /** 174 * Specify default in_lif_orientation 175 */ 176 #define DEFAULT_IN_LIF_ORIENTATION (0) 177 /** 178 * Specify default VSI Profile IVL/SVL mode is SVL 179 */ 180 #define DEFAULT_VSI_PROFILE_IVL_SVL_MODE (DBAL_ENUM_FVAL_VSI_PROFILE_BRIDGE_SVL) 181 /** 182 * Specify default OAM Profile 183 */ 184 #define DEFAULT_OAM_PROFILE (0) 185 /** 186 * Specify default native indexed mode 187 */ 188 #define DEFAULT_NATIVE_INDEXED_MODE (0) 189 /** 190 * Specify default LIF LB Profile 191 */ 192 #define DEFAULT_IN_LIF_LB_PROFILE (0) 193 /***************************************************************************************/ 194 /** 195 * Specify default LIF LB Profile vector - enabled for all layer types 196 */ 197 #define INITIAL_IN_LIF_LB_ENABLERS_VECTOR (0xFFFFFFFF) 198 /* 199 * supported lb profile enablers flags 200 */ 201 #define LB_ENABLERS_DISABLE_SUPPORTED_FLAGS (BCM_HASH_LAYER_ETHERNET_DISABLE | \ 202 BCM_HASH_LAYER_IPV4_DISABLE | BCM_HASH_LAYER_IPV6_DISABLE | \ 203 BCM_HASH_LAYER_MPLS_DISABLE | BCM_HASH_LAYER_UDP_DISABLE | \ 204 BCM_HASH_LAYER_TCP_DISABLE) 205 /***************************************************************************************/ 206 /* 207 * Masks,Prefixes and Offsets for relation between ETH_RIF_PROFILE and VSI_PROFILE/IN_LIF_PROFILE 208 */ 209 /* 210 * the static prefix of VSI_PROFILE 3 MSBs when we access routing_profiles table with ETH_RIF profile 211 */ 212 #define VSI_MSB_PREFIX 0x7 213 /* 214 * the static prefix of IN_LIF_PROFILE MSB bit when we access IN_LIF_PROFILE_TABLE table with ETH_RIF profile 215 */ 216 #define IN_LIF_PROFILE_TABLE_MSB_PREFIX 0x1 217 /* 218 * used for VSI_TABLE dbal operations 219 */ 220 #define VSI_MSB_BITS_MASK_FOR_ETH_RIF_PROFILE (0x380) 221 #define VSI_LSB_BITS_MASK_FOR_ETH_RIF_PROFILE (0x7F) 222 /* 223 * used for IN_LIF_PROFILE_TABLE dbal operations 224 */ 225 #define IN_LIF_PROFILE_MSB_BITS_MASK_FOR_ETH_RIF_PROFILE (0x80) 226 #define IN_LIF_PROFILE_LSB_BITS_MASK_FOR_ETH_RIF_PROFILE (0x7F) 227 /***************************************************************************************/ 228 /* 229 * Macros 230 */ 231 /* 232 * calculates VSI_PROFILE from ETH_RIF profile by accumulating MSB prefix and ETH_RIF profile 233 */ 234 #define CALCULATE_VSI_PROFILE_FROM_ETH_RIF_PROFILE(vsi_msb_part,vsi_lsb_part) (((vsi_msb_part << NOF_ETH_RIF_PROFILE_BITS) & VSI_MSB_BITS_MASK_FOR_ETH_RIF_PROFILE) | (vsi_lsb_part & VSI_LSB_BITS_MASK_FOR_ETH_RIF_PROFILE)) 235 /* 236 * calculates IN_LIF_PROFILE from ETH_RIF profile by accumulating MSB prefix and ETH_RIF profile 237 */ 238 #define CALCULATE_IN_LIF_PROFILE_FROM_ETH_RIF_PROFILE(vsi_msb_part,vsi_lsb_part) (((vsi_msb_part << NOF_ETH_RIF_PROFILE_BITS)& IN_LIF_PROFILE_MSB_BITS_MASK_FOR_ETH_RIF_PROFILE) | (vsi_lsb_part & IN_LIF_PROFILE_LSB_BITS_MASK_FOR_ETH_RIF_PROFILE)) 239 /***************************************************************************************/ 240 /* 241 * Enums 242 */ 243 244 typedef enum 245 { 246 /** 247 * routing enable type is UC 248 */ 249 ROUTING_ENABLE_UC = 0, 250 /** 251 * routing enable type is MC 252 */ 253 ROUTING_ENABLE_MC = 1, 254 /** 255 * number of routing enable type 256 */ 257 NOF_ROUTING_ENABLE_TYPES 258 } routing_enable_type_e; 259 260 typedef enum 261 { 262 /** 263 * interface type is ETH-RIF 264 */ 265 ETH_RIF, 266 /** 267 * interface type is LIF 268 */ 269 LIF, 270 /** 271 * interface type is PWE 272 */ 273 PWE, 274 /** 275 * interface type is EVPN 276 */ 277 EVPN_IML 278 } in_lif_intf_type_e; 279 280 typedef enum 281 { 282 /** 283 * public routing is disabled 284 */ 285 PUBLIC_ROUTING_DISABLED, 286 /** 287 * public routing is enabled 288 */ 289 PUBLIC_ROUTING_ENABLED 290 } in_lif_public_routing_mode_e; 291 292 typedef enum 293 { 294 /** 295 * number of ethernet tags is 0 296 */ 297 ZERO_TAGS, 298 /** 299 * number of ethernet tags is 1 300 */ 301 ONE_TAG, 302 /** 303 * number of ethernet tags is 2 304 */ 305 TWO_TAGS 306 } in_lif_pwe_tagged_nof_eth_tags_e; 307 308 typedef enum 309 { 310 /** 311 * device scope lif 312 */ 313 DEVICE_SCOPE = 0, 314 /** 315 * system scope lif 316 */ 317 SYSTEM_SCOPE = 1, 318 /** 319 * disable same interface filter 320 */ 321 DISABLE = 2, 322 /** 323 * disable same interface filter for device scope 324 */ 325 DEVICE_SCOPE_DISABLE = 3, 326 /** 327 * disable same interface filter for system scope 328 */ 329 SYSTEM_SCOPE_DISABLE = 4 330 } in_lif_same_interface_mode_e; 331 332 typedef enum 333 { 334 /** 335 * preserve DSCP mode is disabled 336 */ 337 DISABLE_PRESERVE_DSCP_MODE = 0, 338 /** 339 * preserve DSCP mode is enabled 340 */ 341 ENABLE_PRESERVE_DSCP_MODE = 1 342 } preserve_dscp_mode_e; 343 /***************************************************************************************/ 344 /* 345 * Structures 346 */ 347 typedef struct 348 { 349 /* 350 * Layer type 351 */ 352 dbal_enum_value_field_layer_types_e layer_type; 353 /* 354 * MC enable value 355 */ 356 uint8 mc_enable; 357 /* 358 * UC enable value 359 */ 360 uint8 uc_enable; 361 } layer_types_enablers_t; 362 /** 363 * /brief - in_lif template data structure. 364 * The template manager's data of in_lif_profile, including all inner profiles and all fields. 365 * this structure is for inner usage only. 366 */ 367 typedef struct 368 { 369 /** 370 * routing enablers profile 371 */ 372 uint8 routing_enablers_profile; 373 /** 374 * RPF mode 375 * /see dbal_enum_value_field_rpf_mode_e in dbal_defines_fields.h 376 */ 377 dbal_enum_value_field_rpf_mode_e rpf_mode; 378 /** 379 * CS in_lif profile 380 */ 381 uint8 cs_in_lif_profile; 382 /** 383 * CS in_lif FWD profile 384 */ 385 uint8 cs_in_lif_fwd_profile; 386 /** 387 * Protocol trap profiles structure 388 */ 389 bcm_rx_trap_protocol_profiles_t protocol_trap_profiles; 390 /* 391 * LIF type 392 */ 393 in_lif_intf_type_e lif_type; 394 /** 395 * InLif Destination profile for unknown DA 396 */ 397 uint8 da_not_found_dst_profile; 398 /* 399 * MACT mode, used only for RIF/VSI type 400 */ 401 dbal_enum_value_field_vsi_profile_bridge_e mact_mode; 402 /* 403 * L2 IPv4 MC forward type, used only for RIF/VSI type 404 */ 405 dbal_enum_value_field_l2_v4_mc_fwd_type_e l2_v4_mc_fwd_type; 406 /* 407 * L2 IPv6 MC forward type, used only for RIF/VSI type 408 */ 409 dbal_enum_value_field_l2_v6_mc_fwd_type_e l2_v6_mc_fwd_type; 410 /* 411 * OAM Default Profile 412 */ 413 int oam_default_profile; 414 /** 415 * LB inlif profile 416 */ 417 uint8 in_lif_lb_profile; 418 } in_lif_template_data_t; 419 420 /** 421 * /brief - Default forwarding destination structure. 422 * It is used in in_lif_profile_info_t to exchange a in-lif-flood profile. 423 * The profile will take part in the exchanges of in-lif-profile. 424 */ 425 typedef struct 426 { 427 /* 428 * port/LIF default destination. 429 */ 430 uint32 destination; 431 432 /* 433 * Add the offset to destination when add_vsi is TRUE. 434 */ 435 uint32 offset; 436 437 /* 438 * If TRUE, Indicate that the forward destination is calculated as: 439 * forward-destination = vsi.default_destination + offset. 440 * If FALSE, the destination above is used as forward destination. 441 * This is useful to define the LIF default forwarding destination. 442 */ 443 uint8 add_vsi_dst; 444 445 } dnx_default_frwrd_dst_t; 446 447 /** 448 * \brief - the input structure of dnx_in_lif_profile_exchange, 449 * includes the in_lif profile properties to set. 450 * \remark 451 * need to call in_lif_profile_info_t_init in order to initiate the fields to the default valid values 452 * and then to update the structure and send it to the API. 453 */ 454 typedef struct 455 { 456 /** 457 * Interface flags, supported flags are: 458 * BCM_L3_INGRESS_ROUTE_DISABLE_IP4_UCAST 459 * BCM_L3_INGRESS_ROUTE_DISABLE_IP6_UCAST 460 * BCM_L3_INGRESS_ROUTE_DISABLE_IP6_MCAST 461 * BCM_L3_INGRESS_ROUTE_DISABLE_IP4_MCAST 462 * BCM_L3_INGRESS_ROUTE_DISABLE_MPLS 463 * BCM_L3_INGRESS_GLOBAL_ROUTE 464 * BCM_L3_INGRESS_MPLS_INTF_NAMESPACE 465 * BCM_L3_INGRESS_ROUTE_ENABLE_UNKNOWN 466 */ 467 uint32 l3_ingress_flags; 468 469 /** 470 * URPF (Unicast Reverse Path Forwarding) mode setting for L3 Ingress 471 */ 472 bcm_l3_ingress_urpf_mode_t urpf_mode; 473 474 /** 475 * number of inner ethernet tags 476 */ 477 in_lif_pwe_tagged_nof_eth_tags_e pwe_nof_eth_tags; 478 /** 479 * Protocol trap profiles structure 480 */ 481 bcm_rx_trap_protocol_profiles_t protocol_trap_profiles; 482 /** 483 * Additional flags that may change the cs_in_lif_profile value 484 * Note: Other fields may change the cs profile (e.g. l3_ingress_flags) 485 * supported flags are: 486 * DNX_IN_LIF_PROFILE_CS_PROFILE_PWE_LIF_SCOPED 487 */ 488 uint32 cs_in_lif_profile_flags; 489 /** 490 * Default Destinations for unknown DA 491 */ 492 dnx_default_frwrd_dst_t default_frwrd_dst[DBAL_NOF_ENUM_DESTINATION_DISTRIBUTION_TYPE_VALUES]; 493 /** 494 * Vlan forwarding and learning mode 495 * Indicate if it is SVL (shared vlan learning) or IVL (independent vlan learning) 496 * '0' means SVL, '1' means IVL 497 * Relevant only for VSI Profile 498 */ 499 dbal_enum_value_field_vsi_profile_bridge_e mact_mode; 500 /** 501 * L2 multicast fwd type 502 * '0' means Bridge, '1' means IPv4MC 503 * Relevant only for VSI Profile 504 */ 505 dbal_enum_value_field_l2_v4_mc_fwd_type_e l2_v4_mc_fwd_type; 506 /* 507 * L2 IPv6 MC forward type, used only for RIF/VSI type 508 * '0' means Bridge, '1' means IPv6MC 509 * Relevant only for VSI Profile 510 */ 511 dbal_enum_value_field_l2_v6_mc_fwd_type_e l2_v6_mc_fwd_type; 512 /* 513 * OAM Default Profile 514 */ 515 int oam_default_profile; 516 /* 517 * load balancing Disable flags, valid values are: 518 * BCM_HASH_LAYER_ETHERNET_DISABLE 519 * BCM_HASH_LAYER_IPV4_DISABLE 520 * BCM_HASH_LAYER_IPV6_DISABLE 521 * BCM_HASH_LAYER_MPLS_DISABLE 522 * BCM_HASH_LAYER_TCP_DISABLE 523 * BCM_HASH_LAYER_UDP_DISABLE 524 */ 525 uint32 lb_per_lif_flags; 526 /** 527 * LB inlif profile 528 */ 529 uint8 in_lif_lb_profile; 530 } in_lif_profile_info_ingress_t; 531 532 typedef struct 533 { 534 /** 535 * in_lif orientation 536 */ 537 uint8 in_lif_orientation; 538 /** 539 * in_lif outer dp profile for ive 540 */ 541 uint8 ive_outer_qos_dp_profile; 542 /** 543 * in_lif inner dp profile for ive 544 */ 545 uint8 ive_inner_qos_dp_profile; 546 /** 547 * same interface mode - supported are device and system scope 548 */ 549 in_lif_same_interface_mode_e lif_same_interface_mode; 550 /** 551 * in_lif_profile in jr_mode 552 */ 553 int in_lif_profile_jr_mode; 554 /* 555 * Preserve DSCP mode 556 */ 557 preserve_dscp_mode_e preserve_dscp_mode; 558 } in_lif_profile_info_egress_t; 559 560 typedef struct 561 { 562 in_lif_profile_info_ingress_t ingress_fields; 563 in_lif_profile_info_egress_t egress_fields; 564 uint8 native_indexed_mode; 565 } in_lif_profile_info_t; 566 567 static const layer_types_enablers_t layer_types_enablers[] = { 568 {DBAL_ENUM_FVAL_LAYER_TYPES_INITIALIZATION, 0, 0}, 569 {DBAL_ENUM_FVAL_LAYER_TYPES_ETHERNET, 1, 1}, 570 {DBAL_ENUM_FVAL_LAYER_TYPES_IPV4, 1, 1}, 571 {DBAL_ENUM_FVAL_LAYER_TYPES_IPV6, 1, 1}, 572 {DBAL_ENUM_FVAL_LAYER_TYPES_MPLS, 1, 1}, 573 {DBAL_ENUM_FVAL_LAYER_TYPES_ARP, 0, 0}, 574 {DBAL_ENUM_FVAL_LAYER_TYPES_FCOE, 1, 1}, 575 {DBAL_ENUM_FVAL_LAYER_TYPES_TCP, 0, 0}, 576 {DBAL_ENUM_FVAL_LAYER_TYPES_UDP, 0, 0}, 577 {DBAL_ENUM_FVAL_LAYER_TYPES_BFD_SINGLE_HOP, 0, 0}, 578 {DBAL_ENUM_FVAL_LAYER_TYPES_BFD_MULTI_HOP, 0, 0}, 579 {DBAL_ENUM_FVAL_LAYER_TYPES_L2TP, 1, 1}, 580 {DBAL_ENUM_FVAL_LAYER_TYPES_PTP, 0, 0}, 581 {DBAL_ENUM_FVAL_LAYER_TYPES_Y_1731, 0, 0}, 582 {DBAL_ENUM_FVAL_LAYER_TYPES_ICMP, 0, 0}, 583 {DBAL_ENUM_FVAL_LAYER_TYPES_BIER_TI, 0, 0}, 584 {DBAL_ENUM_FVAL_LAYER_TYPES_BIER_MPLS, 0, 0}, 585 {DBAL_ENUM_FVAL_LAYER_TYPES_RCH, 0, 0}, 586 {DBAL_ENUM_FVAL_LAYER_TYPES_PPPOE, 1, 1}, 587 {DBAL_ENUM_FVAL_LAYER_TYPES_SRV6_ENDPOINT, 1, 1}, 588 {DBAL_ENUM_FVAL_LAYER_TYPES_SRV6_BEYOND, 1, 1}, 589 {DBAL_ENUM_FVAL_LAYER_TYPES_IGMP, 0, 0}, 590 {DBAL_ENUM_FVAL_LAYER_TYPES_IPT, 0, 0}, 591 {DBAL_ENUM_FVAL_LAYER_TYPES_INGRESS_SCTP_EGRESS_FTMH, 1, 1}, 592 {DBAL_ENUM_FVAL_LAYER_TYPES_GTP, 1, 1}, 593 {DBAL_ENUM_FVAL_LAYER_TYPES_PPP, 1, 1}, 594 {DBAL_ENUM_FVAL_LAYER_TYPES_MPLS_UNTERM, 0, 0}, 595 {DBAL_ENUM_FVAL_LAYER_TYPES_ITMH_J1_VAL, 0, 0}, 596 {DBAL_ENUM_FVAL_LAYER_TYPES_IPVX, 1, 1}, 597 {DBAL_ENUM_FVAL_LAYER_TYPES_UNKNOWN, 0, 0}, 598 {DBAL_ENUM_FVAL_LAYER_TYPES_ITMH_VAL, 0, 0} 599 }; 600 601 /***************************************************************************************/ 602 /* 603 * API 604 */ 605 /** 606 * \brief 607 * initializes the module in_lif_profile: 608 * writes default profiles/values to relevant tables, for example: 609 * IN_LIF_PROFILE_TABLE 610 * VSI_PROFILE_TABLE 611 * ENABLERS_VECTORS 612 * \param [in] unit - 613 * The unit number. 614 * \return 615 * \retval Zero if no error was detected 616 * \retval Negative if error was detected. See \ref shr_error_e 617 * \remark 618 * * updates dbal tables IN_LIF_PROFILE_TABLE,VSI_PROFILE_TABLE,ENABLERS_VECTORS 619 * \see 620 * * None 621 */ 622 shr_error_e dnx_in_lif_profile_module_init( 623 int unit); 624 625 /** 626 * \brief 627 * deallocates in_lif_profile and returns the default in_lif_profile 628 * \param [in] unit - 629 * The unit number. 630 * \param [in] in_lif_profile - 631 * in_lif_profile id to deallocate 632 * \param [out] new_in_lif_profile - 633 * Pointer to new_in_lif_profile \n 634 * This procedure loads pointed memory by the newly assigned in_lif_profile 635 * id in template manager 636 * \param [in] intf_type - 637 * can be one of the following: 638 * ETH_RIF - interface type is ETH_RIF 639 * LIF - interface type is LIF 640 * \return 641 * \retval Zero if no error was detected 642 * \retval Negative if error was detected. See \ref shr_error_e 643 * \remark 644 * We don't clean HW tables in case of last profile case, because of the 645 * issue that when we delete the profile till we move the InLIF 646 * to the new place traffic will get some "undefine" state. 647 * \see 648 * * None 649 */ 650 shr_error_e dnx_in_lif_profile_dealloc( 651 int unit, 652 int in_lif_profile, 653 int *new_in_lif_profile, 654 in_lif_intf_type_e intf_type); 655 656 /** 657 * \brief 658 * updates template manager for L2/L3 profiles, and exchanges the old in_lif_profile with 659 * new in_lif_profile according to LIF properties which are stored in in_lif_profile_info. 660 * \param [in] unit - 661 * The unit number. 662 * \param [in] in_lif_profile_info - 663 * Pointer to in_lif_profile_info \n 664 * Pointed memory includes LIF-PROFILE properties 665 * \param [in] old_in_lif_profile - 666 * old in_lif_profile id to exchnage 667 * \param [out] new_in_lif_profile - 668 * Pointer to new_in_lif_profile \n 669 * This procedure loads pointed memory by the newly assigned in_lif_profile 670 * id in template manager 671 * \param [in] intf_type - 672 * can be one of the following: 673 * ETH_RIF - interface type is ETH_RIF 674 * LIF - interface type is LIF 675 * \param [in] inlif_dbal_table_id - 676 * used to retrieve dbal table information about the LIF 677 * \return 678 * \retval Zero if no error was detected 679 * \retval Negative if error was detected. See \ref shr_error_e 680 * \remark 681 * We don't clean HW tables in case of last profile case, because of the 682 * issue that when we delete the profile till we move the InLIF 683 * to the new place traffic will get some "undefine" state. 684 * \see 685 * * dnx_in_lif_profile_algo_handle_routing_enablers_profile 686 * * dnx_in_lif_profile_algo_convert_to_rpf_mode 687 * * dnx_algo_template_exchange 688 * * DBAL_TABLE_IN_LIF_PROFILE_TABLE 689 * * NOF_ROUTING_PROFILES_DUPLICATES 690 */ 691 692 shr_error_e dnx_in_lif_profile_exchange( 693 int unit, 694 in_lif_profile_info_t * in_lif_profile_info, 695 int old_in_lif_profile, 696 int *new_in_lif_profile, 697 in_lif_intf_type_e intf_type, 698 dbal_tables_e inlif_dbal_table_id); 699 700 /** 701 * \brief 702 * gets in_lif_profile and interface type and returns references count 703 * \param [in] unit - 704 * The unit number. 705 * \param [in] in_lif_profile - 706 * in_lif_profile id to get ref_count for 707 * \param [out] ref_count - 708 * Pointer to ref_count \n 709 * Pointed memory includes references count of the in_lif_profile 710 * \param [in] intf_type - 711 * can be one of the following: 712 * ETH_RIF - interface type is RIF 713 * LIF - interface type is LIF 714 * \return 715 * \retval Zero if no error was detected 716 * \retval Negative if error was detected. See \ref shr_error_e 717 * \remark 718 * * None 719 * \see 720 * * None 721 */ 722 shr_error_e dnx_in_lif_profile_get_ref_count( 723 int unit, 724 int in_lif_profile, 725 int *ref_count, 726 in_lif_intf_type_e intf_type); 727 728 /** 729 * \brief 730 * gets in_lif_profile and interface type and returns in_lif_profile data 731 * \param [in] unit - 732 * The unit number. 733 * \param [in] in_lif_profile - 734 * in_lif_profile id to get data for 735 * \param [out] in_lif_profile_info - 736 * Pointer to in_lif_profile_info \n 737 * Pointed memory includes in_lif_profile properties 738 * \param [in] intf_type - 739 * can be one of the following: 740 * ETH_RIF - interface type is ETH_RIF 741 * LIF - interface type is LIF 742 * \return 743 * \retval Zero if no error was detected 744 * \retval Negative if error was detected. See \ref shr_error_e 745 * \remark 746 * * None 747 * \see 748 * * None 749 */ 750 shr_error_e dnx_in_lif_profile_get_data( 751 int unit, 752 int in_lif_profile, 753 in_lif_profile_info_t * in_lif_profile_info, 754 in_lif_intf_type_e intf_type); 755 756 /* 757 * \brief 758 * initialize fields of the structure in_lif_profile_info_t to the default values 759 * \param [in] unit - 760 * The unit number. 761 * \param [out] in_lif_profile_info - 762 * Pointer to in_lif_profile_info \n 763 * Pointed memory includes LIF-PROFILE properties initiated to the default values 764 * \return 765 * \retval Negative if error was detected. See \ref shr_error_e 766 * \remark 767 * * None 768 * \see 769 * * None 770 */ 771 shr_error_e in_lif_profile_info_t_init( 772 int unit, 773 in_lif_profile_info_t * in_lif_profile_info); 774 775 /** 776 * \brief - 777 * extracts egress in_lif_profile values from in_lif_profile 778 * 779 * \param [in] unit - unit number 780 * \param [in] in_lif_profile - the whole in_lif_profile value 781 * \param [in] intf_type - intf type 782 * \param [out] egress_in_lif_profile_info - the return struct that includes egress in_lif_profile fields values 783 * \param [out] in_lif_profile_jr_mode - the inlif profile in jr sys headers mode 784 * \param [out] in_lif_profile_exclude_orientation - the inlif profile in jr sys headers mode excluding orientation 785 * \param [out] in_lif_orientation - the inlif orientation in jr sys headers mode 786 * 787 * \return 788 * \retval Negative if error was detected. See \ref shr_error_e 789 * 790 * \remark 791 * none 792 * 793 * \see 794 * dnx_in_lif_profile_exchange. 795 */ 796 shr_error_e dnx_in_lif_profile_algo_extract_egress_profile( 797 int unit, 798 int in_lif_profile, 799 in_lif_profile_info_egress_t * egress_in_lif_profile_info, 800 int *in_lif_profile_jr_mode, 801 int *in_lif_profile_exclude_orientation, 802 int *in_lif_orientation, 803 in_lif_intf_type_e intf_type); 804 805 /** 806 * \brief - 807 * extracts egress eth_rif_profile values from eth_rif_profile 808 * 809 * \param [in] unit - unit number 810 * \param [in] eth_rif_profile - the whole eth_rif_profile value 811 * \param [out] egress_in_lif_profile_info - the return struct that includes egress lif_profile fields values 812 * \param [out] eth_rif_profile_jr_mode - the eth_rif profile in jr sys headers mode 813 * \param [out] eth_rif_profile_exclude_orientation - the eth_rif profile in jr sys headers mode excluding orientation 814 * \param [out] eth_rif_orientation - the eth_rif orientation in jr sys headers mode 815 * 816 * \return 817 * \retval Negative if error was detected. See \ref shr_error_e 818 * 819 * \remark 820 * none 821 * 822 * \see 823 * dnx_in_lif_profile_exchange. 824 */ 825 shr_error_e dnx_eth_rif_profile_algo_extract_egress_profile( 826 int unit, 827 int eth_rif_profile, 828 in_lif_profile_info_egress_t * egress_in_lif_profile_info, 829 int *eth_rif_profile_jr_mode, 830 int *eth_rif_profile_exclude_orientation, 831 int *eth_rif_orientation); 832 833 /** 834 * \brief - 835 * Retrieves data for the VSI/LIF profile 836 * \param [in] unit - unit number 837 * \param [in] intf_id - The ETH_RIF/LIF interface ID. 838 * \param [out] intf_profile - the retrieved profile ID of the interface (LIF/VSI profile) 839 * \param [out] result_type - the result type of the VSI profile entry 840 * \param [out] intf_type - interface type ETH_RIF or LIF. 841 * \return 842 * \retval Negative if error was detected. See \ref shr_error_e 843 * \remark 844 * none 845 */ 846 shr_error_e dnx_in_lif_vsi_profile_get( 847 int unit, 848 uint32 intf_id, 849 uint32 *intf_profile, 850 uint32 *result_type, 851 in_lif_intf_type_e * intf_type); 852 853 /** 854 * \brief - 855 * Sets the profile data for the VSI/LIF profile 856 * \param [in] unit - unit number 857 * \param [in] intf_id - The ETH_RIF/LIF interface ID. 858 * \param [in] intf_profile - the profile ID of the interface (LIF/VSI profile) 859 * \param [in] result_type - the result type of the VSI profile entry 860 * \param [out] intf_type - interface type ETH_RIF or LIF. 861 * \return 862 * \retval Negative if error was detected. See \ref shr_error_e 863 * \remark 864 * none 865 */ 866 shr_error_e dnx_in_lif_vsi_profile_set( 867 int unit, 868 uint32 intf_id, 869 uint32 intf_profile, 870 uint32 result_type, 871 in_lif_intf_type_e * intf_type); 872 873 /* 874 * } 875 */ 876 #endif /* IN_LIF_PROFILE_H_INCLUDED */