xgs5.h (53550B)
1 /* 2 * 3 * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file. 4 * 5 * Copyright 2007-2019 Broadcom Inc. All rights reserved. 6 * 7 * File: xgs5.h 8 * Purpose: Definitions for XGS5 systems. 9 */ 10 11 #ifndef _BCM_INT_XGS5_H_ 12 #define _BCM_INT_XGS5_H_ 13 #include <shared/shr_bprof.h> 14 15 #include <bcm/qos.h> 16 #include <bcm/switch.h> 17 #include <bcm_int/esw/subport.h> 18 #include <bcm_int/esw/port.h> 19 #if defined(INCLUDE_FLOWTRACKER) 20 #include <soc/shared/ft_msg.h> 21 #include <bcm_int/esw/flowtracker.h> 22 #endif 23 #include <soc/esw/port.h> 24 25 #include <bcm/ecn.h> 26 #ifdef BCM_MPLS_SUPPORT 27 #include <bcm/mpls.h> 28 #endif 29 30 #if defined(INCLUDE_IFA) 31 #include <bcm/ifa.h> 32 #endif 33 34 #if defined(INCLUDE_BFD) 35 36 #include <soc/mcm/allenum.h> 37 #include <soc/tnl_term.h> 38 #include <bcm/tunnel.h> 39 #include <bcm/bfd.h> 40 #include <bcm_int/esw/bfd.h> 41 42 /* 43 * Local RX DMA channel 44 * 45 * This is the channel number local to the uC (0..3). 46 * Each uController application needs to use a different RX DMA channel. 47 */ 48 #define BCM_XGS5_BFD_RX_CHANNEL 1 49 50 51 /* 52 * Device Specific HW Definitions 53 */ 54 55 /* Device programming routines */ 56 typedef struct bcm_xgs5_bfd_hw_calls_s { 57 int (*l3_tnl_term_entry_init)(int unit, 58 bcm_tunnel_terminator_t *tnl_info, 59 soc_tunnel_term_t *entry); 60 int (*mpls_lock)(int unit); 61 void (*mpls_unlock)(int unit); 62 } bcm_xgs5_bfd_hw_calls_t; 63 64 /* L2 Table */ 65 typedef struct bcm_xgs5_bfd_l2_table_s { 66 soc_mem_t mem; 67 soc_field_t key_type; 68 uint32 bfd_key_type; 69 soc_field_t valid; 70 soc_field_t static_bit; 71 soc_field_t session_id_type; 72 soc_field_t your_discr; 73 soc_field_t label; 74 soc_field_t session_index; 75 soc_field_t cpu_queue_class; 76 soc_field_t remote; 77 soc_field_t dst_module; 78 soc_field_t dst_port; 79 soc_field_t int_pri; 80 } bcm_xgs5_bfd_l2_table_t; 81 82 /* L3 IPv4 Unicast Table */ 83 typedef struct bcm_xgs5_bfd_l3_ipv4_table_s { 84 soc_mem_t mem; 85 soc_field_t vrf_id; 86 soc_field_t ip_addr; 87 soc_field_t key_type; 88 soc_field_t local_address; 89 soc_field_t bfd_enable; 90 } bcm_xgs5_bfd_l3_ipv4_table_t; 91 92 /* L3 IPv6 Unicast Table */ 93 typedef struct bcm_xgs5_bfd_l3_ipv6_table_s { 94 soc_mem_t mem; 95 soc_field_t ip_addr_lwr_64; 96 soc_field_t ip_addr_upr_64; 97 soc_field_t key_type_0; 98 soc_field_t key_type_1; 99 soc_field_t vrf_id; 100 soc_field_t local_address; 101 soc_field_t bfd_enable; 102 soc_field_t base_valid_0; 103 soc_field_t base_valid_1; 104 soc_field_t key_type; 105 soc_field_t data_type; 106 } bcm_xgs5_bfd_l3_ipv6_table_t; 107 108 /* L3 Tunnel Table */ 109 typedef struct bcm_xgs5_bfd_l3_tunnel_table_s { 110 soc_mem_t mem; 111 soc_field_t bfd_enable; 112 } bcm_xgs5_bfd_l3_tunnel_table_t; 113 114 /* L3 Tunnel Table IPV6*/ 115 typedef struct bcm_xgs5_bfd_l3_tunnel_ipv6_table_s { 116 soc_mem_t mem; 117 soc_field_t bfd_enable; 118 } bcm_xgs5_bfd_l3_tunnel_ipv6_table_t; 119 120 /* MPLS Table */ 121 typedef struct bcm_xgs5_bfd_mpls_table_s { 122 soc_mem_t mem; 123 soc_field_t valid; 124 soc_field_t key_type; 125 uint32 key_type_value; 126 soc_field_t mpls_label; 127 soc_field_t session_id_type; 128 soc_field_t bfd_enable; 129 soc_field_t cw_check_ctrl; 130 soc_field_t pw_cc_type; 131 soc_field_t mpls_action_if_bos; 132 soc_field_t l3_iif; 133 soc_field_t decap_use_ttl; 134 soc_field_t mod_id; 135 soc_field_t port_num; 136 } bcm_xgs5_bfd_mpls_table_t; 137 138 /* HW Definitions */ 139 typedef struct bcm_xgs5_bfd_hw_defs_t { 140 bcm_xgs5_bfd_hw_calls_t *hw_call; /* Chip programming */ 141 bcm_xgs5_bfd_l2_table_t *l2; /* L2 Memory Table */ 142 bcm_xgs5_bfd_l3_ipv4_table_t *l3_ipv4; /* L3 IPv4 UC Table */ 143 bcm_xgs5_bfd_l3_ipv6_table_t *l3_ipv6; /* L3 IPv6 UC Table */ 144 bcm_xgs5_bfd_l3_tunnel_table_t *l3_tunnel; /* L3 Tunnel Table */ 145 bcm_xgs5_bfd_l3_tunnel_ipv6_table_t *l3_tunnel_ipv6; /*L3 Tunnel IPV6 table */ 146 bcm_xgs5_bfd_mpls_table_t *mpls; /* MPLS Table */ 147 uint8 bfd_feature_enable; /*Save BFD Feature Flag */ 148 } bcm_xgs5_bfd_hw_defs_t; 149 150 151 /* Functions */ 152 extern 153 int bcmi_xgs5_bfd_init(int unit, 154 bcm_esw_bfd_drv_t *drv, 155 bcm_xgs5_bfd_hw_defs_t *hw_defs); 156 extern 157 int bcmi_xgs5_bfd_detach(int unit); 158 extern 159 int bcmi_xgs5_bfd_endpoint_create(int unit, 160 bcm_bfd_endpoint_info_t *endpoint_info); 161 extern 162 int bcmi_xgs5_bfd_endpoint_get(int unit, bcm_bfd_endpoint_t endpoint, 163 bcm_bfd_endpoint_info_t *endpoint_info); 164 extern 165 int bcmi_xgs5_bfd_tx_start(int unit); 166 extern 167 int bcmi_xgs5_bfd_tx_stop(int unit); 168 extern 169 int bcmi_xgs5_bfd_endpoint_destroy(int unit, 170 bcm_bfd_endpoint_t endpoint); 171 extern 172 int bcmi_xgs5_bfd_endpoint_destroy_all(int unit); 173 extern 174 int bcmi_xgs5_bfd_endpoint_poll(int unit, bcm_bfd_endpoint_t endpoint); 175 extern 176 int bcmi_xgs5_bfd_event_register(int unit, 177 bcm_bfd_event_types_t event_types, 178 bcm_bfd_event_cb cb, void *user_data); 179 extern 180 int bcmi_xgs5_bfd_event_unregister(int unit, 181 bcm_bfd_event_types_t event_types, 182 bcm_bfd_event_cb cb); 183 extern 184 int bcmi_xgs5_bfd_endpoint_stat_get(int unit, 185 bcm_bfd_endpoint_t endpoint, 186 bcm_bfd_endpoint_stat_t *ctr_info, 187 uint32 options); 188 extern 189 int bcmi_xgs5_bfd_auth_sha1_set(int unit, int index, 190 bcm_bfd_auth_sha1_t *sha1); 191 extern 192 int bcmi_xgs5_bfd_auth_sha1_get(int unit, int index, 193 bcm_bfd_auth_sha1_t *sha1); 194 extern 195 int bcmi_xgs5_bfd_auth_simple_password_set(int unit, int index, 196 bcm_bfd_auth_simple_password_t *sp); 197 extern 198 int bcmi_xgs5_bfd_auth_simple_password_get(int unit, int index, 199 bcm_bfd_auth_simple_password_t *sp); 200 extern 201 int bcmi_xgs5_bfd_status_multi_get(int unit, int max_endpoints, 202 bcm_bfd_status_t *status_arr, 203 int *count); 204 extern 205 int bcmi_xgs5_bfd_discard_stat_set(int unit, 206 bcm_bfd_discard_stat_t *discarded_info); 207 extern 208 int bcmi_xgs5_bfd_discard_stat_get(int unit, 209 bcm_bfd_discard_stat_t *discarded_info); 210 211 #ifdef BCM_WARM_BOOT_SUPPORT 212 extern 213 int bcmi_xgs5_bfd_sync(int unit); 214 215 extern 216 int _bcmi_bfd_wb_downgrade_config_set(int unit, uint32 warmboot_ver); 217 #endif /* BCM_WARM_BOOT_SUPPORT */ 218 219 #ifdef BCM_WARM_BOOT_SUPPORT_SW_DUMP 220 extern 221 void bcmi_xgs5_bfd_sw_dump(int unit); 222 #endif /* BCM_WARM_BOOT_SUPPORT_SW_DUMP */ 223 224 extern 225 void bcmi_xgs5_bfd_dump_trace(int unit); 226 #endif /* INCLUDE_BFD */ 227 228 /* ING Port Table */ 229 typedef struct bcmi_xgs5_subport_coe_ing_port_table_s { 230 soc_mem_t mem; 231 soc_field_t port_type; 232 } bcmi_xgs5_subport_coe_ing_port_table_t; 233 234 /* EGR Port Table */ 235 typedef struct bcmi_xgs5_subport_coe_egr_port_table_s { 236 soc_mem_t mem; 237 soc_field_t port_type; 238 } bcmi_xgs5_subport_coe_egr_port_table_t; 239 240 /* Subport Tag SGPP Memory Table */ 241 typedef struct bcmi_xgs5_subport_coe_subport_tag_sgpp_table_s { 242 soc_mem_t mem; 243 soc_field_t valid; 244 soc_field_t subport_tag; 245 soc_field_t subport_tag_mask; 246 soc_field_t subport_tag_namespace; 247 soc_field_t subport_tag_namespace_mask; 248 soc_field_t src_modid; 249 soc_field_t src_port; 250 soc_field_t phb_enable; 251 soc_field_t int_pri; 252 soc_field_t cng; 253 } bcmi_xgs5_subport_coe_subport_tag_sgpp_table_t; 254 255 /* Modport map subport Memory Table */ 256 typedef struct bcmi_xgs5_subport_coe_modport_map_subport_table_s { 257 soc_mem_t mem; 258 soc_field_t dest; 259 soc_field_t is_trunk; 260 soc_field_t enable; 261 } bcmi_xgs5_subport_coe_modport_map_subport_table_t; 262 263 /* Egress subport tag dot1p Table */ 264 typedef struct bcmi_xgs5_subport_coe_egr_subport_tag_dot1p_table_s { 265 soc_mem_t mem; 266 soc_field_t subport_tag_priority; 267 soc_field_t subport_tag_cfi; 268 soc_field_t subport_tag_color; 269 } bcmi_xgs5_subport_coe_egr_subport_tag_dot1p_table_t; 270 271 typedef struct bcmi_xgs5_subport_coe_hw_defs_s { 272 /* Ingress Port Memory Table */ 273 bcmi_xgs5_subport_coe_ing_port_table_t *igr_port; 274 /* Egress Port Memory Table */ 275 bcmi_xgs5_subport_coe_egr_port_table_t *egr_port; 276 /* Subport Tag SGPP Memory Table */ 277 bcmi_xgs5_subport_coe_subport_tag_sgpp_table_t *subport_tag_sgpp; 278 /* Modport map subport Memory Table */ 279 bcmi_xgs5_subport_coe_modport_map_subport_table_t *modport_map_subport; 280 /* Egress subport tag dot1p Table */ 281 bcmi_xgs5_subport_coe_egr_subport_tag_dot1p_table_t *egr_subport_tag_dot1p; 282 } bcmi_xgs5_subport_coe_hw_defs_t; 283 284 285 /* Functions */ 286 extern int bcmi_xgs5_subport_init(int unit, 287 bcm_esw_subport_drv_t *drv, 288 bcmi_xgs5_subport_coe_hw_defs_t *hw_defs); 289 extern int _bcmi_xgs5_subport_reinit(int unit); 290 extern int bcmi_xgs5_subport_coe_cleanup(int unit); 291 extern int bcmi_xgs5_subport_coe_group_create(int unit, 292 bcm_subport_group_config_t *config, 293 bcm_gport_t *group); 294 extern int bcmi_xgs5_subport_coe_group_destroy(int unit, bcm_gport_t group); 295 extern int bcmi_xgs5_subport_coe_group_get(int unit, bcm_gport_t group, 296 bcm_subport_group_config_t *config); 297 extern int bcmi_xgs5_subport_coe_group_traverse(int unit, bcm_gport_t group, 298 bcm_subport_port_traverse_cb cb, 299 void *user_data); 300 extern int bcmi_xgs5_subport_coe_port_add(int unit, bcm_subport_config_t 301 *config, bcm_gport_t *port); 302 extern int bcmi_xgs5_subport_coe_port_delete(int unit, bcm_gport_t port); 303 extern int bcmi_xgs5_subport_coe_port_get(int unit, bcm_gport_t port, 304 bcm_subport_config_t *config); 305 extern int bcmi_xgs5_subport_coe_port_traverse(int unit, 306 bcm_subport_port_traverse_cb cb, 307 void *user_data); 308 309 extern int bcmi_xgs5_subport_egr_subtag_dot1p_map_add(int unit, 310 bcm_qos_map_t *map); 311 extern int bcmi_xgs5_subport_egr_subtag_dot1p_map_delete(int unit, 312 bcm_qos_map_t *map); 313 314 extern int bcmi_xgs5_subport_subtag_port_tpid_set(int unit, bcm_gport_t gport, 315 uint16 tpid); 316 317 extern int bcmi_xgs5_subport_subtag_port_tpid_delete(int unit, 318 bcm_gport_t gport, 319 uint16 tpid); 320 321 extern int bcmi_xgs5_subport_subtag_port_tpid_get(int unit, bcm_gport_t gport, 322 uint16 *tpid); 323 324 extern int bcmi_xgs5_port_control_subtag_status_set(int unit, 325 bcm_port_t port, 326 int value); 327 328 extern int bcmi_xgs5_port_control_subtag_status_get(int unit, 329 bcm_port_t port, 330 int *value); 331 332 extern int _bcmi_xgs5_subport_group_resolve(int unit, 333 bcm_gport_t subport_group_gport, 334 bcm_module_t *modid, 335 bcm_port_t *port, 336 bcm_trunk_t *trunk_id, 337 int *id); 338 339 extern int _bcm_xgs5_subport_port_resolve(int unit, 340 bcm_gport_t subport_port_gport, 341 bcm_module_t *modid, 342 bcm_port_t *port, 343 bcm_trunk_t *trunk_id, 344 int *id); 345 346 extern int bcmi_xgs5_subport_gport_modport_get(int unit, 347 bcm_gport_t subport_gport, bcm_module_t *module, bcm_port_t *port); 348 349 extern int _bcmi_coe_subport_physical_port_get(int unit, bcm_gport_t subport, 350 int *local_port); 351 352 extern int _bcmi_coe_subport_mod_port_physical_port_get(int unit, bcm_module_t modid, 353 bcm_port_t portid, 354 int *local_port); 355 356 extern int _bcm_xgs5_subport_coe_mod_local(int unit, int modid); 357 358 extern int _bcm_xgs5_subport_gport_validate(int unit, bcm_port_t port_in, 359 bcm_port_t *port_out); 360 361 extern int _bcm_xgs5_subport_coe_mod_port_local(int unit, int modid, 362 bcm_port_t port); 363 364 extern int _bcm_xgs5_subport_coe_gport_local(int unit, bcm_gport_t gport); 365 366 extern int _bcmi_coe_multicast_subport_encap_get(int unit, 367 bcm_gport_t subport_port, 368 bcm_if_t *encap_id); 369 370 extern int _bcmi_coe_subport_tcam_idx_get(int unit, bcm_gport_t subport, 371 int *hw_idx); 372 373 extern int bcmi_xgs5_subport_coe_ether_type_size_set(int unit, 374 bcm_switch_control_t type, 375 int arg); 376 377 extern int bcmi_xgs5_subport_coe_ether_type_size_get(int unit, 378 bcm_switch_control_t type, 379 int *arg); 380 381 extern int bcmi_xgs5_subport_subtag_port_override_set(int unit, int port, int arg); 382 383 extern int bcmi_xgs5_subport_subtag_port_override_get(int unit, int port, int *arg); 384 385 extern int bcmi_xgs5_subport_port_learn_set(int unit, bcm_gport_t subport_port_id, 386 uint32 flags); 387 388 extern int bcmi_xgs5_subport_port_learn_get(int unit, bcm_gport_t subport_port_id, 389 uint32 *flags); 390 391 392 #ifdef INCLUDE_L3 393 #if (defined(BCM_TOMAHAWK_SUPPORT) || defined(BCM_TRIDENT2PLUS_SUPPORT)) 394 395 #define _BCM_MPLS_XGS5_MPLS_ACTION_IF_NOT_BOS_INVALID 0x0 396 #define _BCM_MPLS_XGS5_MPLS_ACTION_IF_NOT_BOS_POP 0x1 397 #define _BCM_MPLS_XGS5_MPLS_ACTION_IF_NOT_BOS_PHP_NHI 0x2 398 #define _BCM_MPLS_XGS5_MPLS_ACTION_IF_NOT_BOS_SWAP_NHI 0x3 399 #define _BCM_MPLS_XGS5_MPLS_ACTION_IF_NOT_BOS_SWAP_ECMP 0x4 400 #define _BCM_MPLS_XGS5_MPLS_ACTION_IF_NOT_BOS_PHP_ECMP 0x5 401 402 #define _BCM_MPLS_XGS5_MPLS_ACTION_IF_BOS_INVALID 0x0 403 #define _BCM_MPLS_XGS5_MPLS_ACTION_IF_BOS_L2_SVP 0x1 404 #define _BCM_MPLS_XGS5_MPLS_ACTION_IF_BOS_L3_IIF 0x2 405 #define _BCM_MPLS_XGS5_MPLS_ACTION_IF_BOS_SWAP_NHI 0x3 406 #define _BCM_MPLS_XGS5_MPLS_ACTION_IF_BOS_L3_NHI 0x4 407 #define _BCM_MPLS_XGS5_MPLS_ACTION_IF_BOS_L3_ECMP 0x5 408 #define _BCM_MPLS_XGS5_MPLS_ACTION_IF_BOS_SWAP_ECMP 0x6 409 #define _BCM_MPLS_XGS5_MPLS_ACTION_IF_BOS_ROE_NHI 0x7 410 411 /* ROE Tunnel Type */ 412 #define _BCM_MPLS_XGS5_MPLS_ROE_CUSTOM_TUNNEL 0x1 413 #define _BCM_MPLS_XGS5_MPLS_ROE_TUNNEL 0x2 414 415 /* TD3:MPLS_ACTION 416 * Common format used for both MPLS_ACTION_IF_NOT_BOS 417 * and MPLS_ACTION_IF_BOS.*/ 418 #define _BCM_MPLS_TD3_MPLS_ACTION_INVALID 0x0 419 #define _BCM_MPLS_TD3_MPLS_ACTION_L2_SVP 0x1 420 #define _BCM_MPLS_TD3_MPLS_ACTION_L3_IIF 0x2 421 #define _BCM_MPLS_TD3_MPLS_ACTION_SWAP 0x3 422 #define _BCM_MPLS_TD3_MPLS_ACTION_RESERVED_2 0x4 423 #define _BCM_MPLS_TD3_MPLS_ACTION_PHP 0x5 424 #define _BCM_MPLS_TD3_MPLS_ACTION_POP_SVP_ENTROPY 0x6 /*Applicable only for BOS=0 labels*/ 425 #define _BCM_MPLS_TD3_MPLS_ACTION_POP 0x7 /*Applicable only for BOS=0 labels*/ 426 #define _BCM_MPLS_TD3_MPLS_ACTION_RESERVED_1 0x8 427 428 429 430 /* MPLS functions */ 431 extern int bcmi_xgs5_mpls_tunnel_switch_get(int unit, 432 bcm_mpls_tunnel_switch_t *info); 433 extern int bcmi_xgs5_mpls_tunnel_switch_delete_all(int unit); 434 extern int bcmi_xgs5_mpls_tunnel_switch_delete(int unit, 435 bcm_mpls_tunnel_switch_t *info); 436 extern int bcmi_xgs5_mpls_tunnel_switch_add(int unit, 437 bcm_mpls_tunnel_switch_t *info); 438 extern int bcmi_xgs5_mpls_tunnel_switch_traverse(int unit, 439 bcm_mpls_tunnel_switch_traverse_cb cb, 440 void *user_data); 441 442 /***************************************************** 443 ********** ********** 444 ****** ****** 445 **** Segment Routing Changes - START **** 446 */ 447 extern int bcmi_xgs5_mpls_tunnel_initiator_set(int unit, 448 bcm_if_t intf, int num_labels, 449 bcm_mpls_egress_label_t *label_array); 450 extern int bcmi_xgs5_mpls_tunnel_initiator_get(int unit, 451 bcm_if_t intf, int label_max, 452 bcm_mpls_egress_label_t *label_array, int *label_count); 453 extern int bcmi_xgs5_mpls_tunnel_initiator_clear(int unit, int intf_id); 454 extern int bcmi_xgs5_mpls_tunnel_initiator_clear_all(int unit); 455 extern int bcmi_xgs5_mpls_tunnel_initiator_reinit(int unit); 456 extern int bcmi_egr_ip_tunnel_mpls_sw_init(int unit); 457 extern int bcmi_egr_ip_tunnel_mpls_sw_cleanup(int unit); 458 /***************************************************** 459 ********** ********** 460 ****** ****** 461 **** Segment Routing Changes - END **** 462 */ 463 extern int 464 bcmi_xgs5_mpls_failover_nw_port_match_get(int unit, bcm_mpls_port_t *mpls_port, 465 int vp, mpls_entry_entry_t *return_ment); 466 467 /* End of MPLS functions */ 468 469 #endif /* (defined(BCM_TOMAHAWK_SUPPORT) || defined(BCM_TRIDENT2PLUS_SUPPORT)) */ 470 #if (defined(BCM_TOMAHAWK2_SUPPORT) || defined(BCM_TRIDENT3_SUPPORT)) 471 extern int bcmi_xgs5_mpls_ecn_map_create(int unit, uint32 flags, 472 int *map_id); 473 extern int bcmi_xgs5_mpls_ecn_map_destroy(int unit, int map_id); 474 extern int bcmi_xgs5_mpls_ecn_map_set(int unit, int map_id, 475 bcm_ecn_map_t *map); 476 extern int bcmi_xgs5_mpls_ecn_map_get(int unit, int map_id, 477 bcm_ecn_map_t *map); 478 extern int 479 bcmi_xgs5_mpls_ecn_port_map_get(int unit, bcm_gport_t port, 480 bcm_ecn_port_map_t* ecn_map); 481 extern int 482 bcmi_xgs5_mpls_ecn_port_map_set(int unit, bcm_gport_t port, 483 bcm_ecn_port_map_t* ecn_map); 484 485 #endif /* BCM_TOMAHAWK2_SUPPORT */ 486 487 extern int bcmi_xgs5_ecn_map_create(int unit, uint32 flags, 488 int *map_id); 489 extern int bcmi_xgs5_ecn_map_destroy(int unit, int map_id); 490 extern int bcmi_xgs5_ecn_map_set(int unit, int map_id, 491 bcm_ecn_map_t *map); 492 extern int bcmi_xgs5_ecn_map_get(int unit, int map_id, 493 bcm_ecn_map_t *map); 494 extern int 495 bcmi_xgs5_ecn_port_map_get(int unit, bcm_gport_t port, 496 bcm_ecn_port_map_t* ecn_map); 497 extern int 498 bcmi_xgs5_ecn_port_map_set(int unit, bcm_gport_t port, 499 bcm_ecn_port_map_t* ecn_map); 500 501 extern int bcmi_xgs5_ecn_init(int unit); 502 #ifdef BCM_WARM_BOOT_SUPPORT_SW_DUMP 503 extern void bcmi_xgs5_ecn_sw_dump(int unit); 504 #endif 505 #endif /* INCLUDE_L3 */ 506 507 508 /* EP Redirection definitions */ 509 510 /* Device specific hardware defines */ 511 /* EGR Port Table */ 512 typedef struct bcmi_xgs5_port_redirection_egr_port_table_s { 513 soc_mem_t mem; 514 soc_field_t dest_type; 515 soc_field_t dest_value; 516 soc_field_t drop_original; 517 soc_field_t pkt_priority; 518 soc_field_t pkt_change_priority; 519 soc_field_t pkt_color; 520 soc_field_t pkt_change_color; 521 soc_field_t strength; 522 soc_field_t buffer_priority; 523 soc_field_t action; 524 soc_field_t redir_pkt_source; 525 soc_field_t redir_pkt_truncate; 526 } bcmi_xgs5_port_redirection_egr_port_table_t; 527 528 /* Port hardware defs */ 529 typedef struct bcmi_xgs5_port_hw_defs_s { 530 bcmi_xgs5_port_redirection_egr_port_table_t *egr_port; 531 } bcmi_xgs5_port_hw_defs_t; 532 533 /* 534 * Port Functions 535 */ 536 537 /* 538 * FlexPort Operations Changes 539 * 540 * Flags to be used to determine the type of operations required 541 * when the FlexPort API multi_set() is called. 542 * 543 * OP_NONE - No changes. 544 * OP_REMAP - Change in port mapping. It requires FlexPort sequence. 545 * OP_LANES - Change in lanes. It requires FlexPort sequence. 546 * OP_SPEED - Change in speed. This is covered in a FlexPort sequence. 547 * If 'remap' or 'lanes' are not changing, then 548 * calling the 'speed' set function is enough (no need 549 * to call the FlexPort sequence). 550 * OP_ENCAP - Change in encap mode. It is NOT covered in a FlexPort 551 * sequence, so an explicit call must be made to change 552 * the encap mode. 553 * OP_ADD - Add a new logical port. It requires FlexPort sequence. 554 * OP_DEL - Delete a logical port. It requires FlexPort sequence. 555 * OP_ACTIVE - Active a logical port. It requires FlexPort sequence. 556 * OP_ENABLE - Enable or disable a logical port. It does NOT require 557 * FlexPort sequence. 558 * OP_CALENDAR - Only TDM calendar change. Currently only between 25G port use 25G TDM 559 * calendar and 25G port use 50G TDM. 560 * OP_ENCAP_FLEX - When change in encap mode, requires FlexPort sequence. 561 */ 562 #define BCMI_XGS5_PORT_RESOURCE_OP_NONE 0 563 #define BCMI_XGS5_PORT_RESOURCE_OP_REMAP (1 << 0) 564 #define BCMI_XGS5_PORT_RESOURCE_OP_LANES (1 << 1) 565 #define BCMI_XGS5_PORT_RESOURCE_OP_SPEED (1 << 2) 566 #define BCMI_XGS5_PORT_RESOURCE_OP_ENCAP (1 << 3) 567 #define BCMI_XGS5_PORT_RESOURCE_OP_ADD (1 << 4) 568 #define BCMI_XGS5_PORT_RESOURCE_OP_DEL (1 << 5) 569 #define BCMI_XGS5_PORT_RESOURCE_OP_ACTIVE (1 << 6) 570 #define BCMI_XGS5_PORT_RESOURCE_OP_ENABLE (1 << 7) 571 #define BCMI_XGS5_PORT_RESOURCE_OP_CALENDAR (1 << 8) 572 #define BCMI_XGS5_PORT_RESOURCE_OP_ENCAP_FLEX (1 << 9) 573 574 /* 575 * Sequence of attaching a port to BCM layer. 576 * Follow the same sequence as in _bcm_modules_init() 577 */ 578 typedef enum bcmi_xgs5_port_attach_exec_seq_e{ 579 /* MMU config init */ 580 PORT_ATTACH_EXEC__MMU_INIT, 581 582 /* PORT module (bcm_esw_port_init) */ 583 PORT_ATTACH_EXEC__DSCP_PROFILE, 584 PORT_ATTACH_EXEC__SOFTWARE, 585 PORT_ATTACH_EXEC__EGR_VLAN_ACTION, 586 PORT_ATTACH_EXEC__PORT_CFG_INIT, 587 PORT_ATTACH_EXEC__PORT_PROBE, 588 PORT_ATTACH_EXEC__FRAME_LENGTH_CHECK, 589 PORT_ATTACH_EXEC__RCPU_MTU, 590 PORT_ATTACH_EXEC__OUTER_TPID, 591 PORT_ATTACH_EXEC__EGR_BLOCK_PROFILE, 592 PORT_ATTACH_EXEC__VLAN_PROTOCOL, 593 PORT_ATTACH_EXEC__EEE, 594 PORT_ATTACH_EXEC__HIGIG, 595 PORT_ATTACH_EXEC__PORT_INFO_CFG, /* Set PORT_INFO with status from HW*/ 596 PORT_ATTACH_EXEC__EGR_LINK_DELAY, 597 598 /* Other modules related to port */ 599 PORT_ATTACH_EXEC__STG, 600 PORT_ATTACH_EXEC__VLAN, 601 PORT_ATTACH_EXEC__TRUNK, 602 PORT_ATTACH_EXEC__COSQ, 603 PORT_ATTACH_EXEC__LINKSCAN, 604 PORT_ATTACH_EXEC__STATISTIC, 605 PORT_ATTACH_EXEC__STACK, 606 PORT_ATTACH_EXEC__RATE, 607 PORT_ATTACH_EXEC__FIELD, 608 PORT_ATTACH_EXEC__MIRROR, 609 PORT_ATTACH_EXEC__L3, 610 PORT_ATTACH_EXEC__IPMC, 611 PORT_ATTACH_EXEC__IPMC_REPL, 612 PORT_ATTACH_EXEC__MPLS, 613 PORT_ATTACH_EXEC__MIM, 614 615 PORT_ATTACH_EXEC__MAX 616 } bcmi_xgs5_port_attach_exec_seq_t; 617 618 #define BCMI_XGS5_PORT_ATTACH_PHASES_MSG {\ 619 "MMU init", /* PORT_ATTACH_EXEC__MMU_INIT */ \ 620 "DSCP profile", /* PORT_ATTACH_EXEC__DSCP_PROFILE */ \ 621 "Software init", /* PORT_ATTACH_EXEC__SOFTWARE */ \ 622 "Egress Vlan action", /* PORT_ATTACH_EXEC__EGR_VLAN_ACTION */ \ 623 "Port config init", /* PORT_ATTACH_EXEC__PORT_CFG_INIT */ \ 624 "Port probe", /* PORT_ATTACH_EXEC__PORT_PROBE */ \ 625 "Fram length check", /* PORT_ATTACH_EXEC__FRAME_LENGTH_CHECK */ \ 626 "RCPU MTU", /* PORT_ATTACH_EXEC__RCPU_MTU */ \ 627 "Outer TPID", /* PORT_ATTACH_EXEC__OUTER_TPID */ \ 628 "Egress block profile", /* PORT_ATTACH_EXEC__EGR_BLOCK_PROFILE */ \ 629 "Vlan protocol", /* PORT_ATTACH_EXEC__VLAN_PROTOCOL */ \ 630 "EEE config", /* PORT_ATTACH_EXEC__EEE */ \ 631 "HIGIG", /* PORT_ATTACH_EXEC__HIGIG */ \ 632 "Port info config", /* PORT_ATTACH_EXEC__PORT_INFO_CFG */ \ 633 "Egress link delay", /* PORT_ATTACH_EXEC__EGR_LINK_DELAY */ \ 634 "STG", /* PORT_ATTACH_EXEC__STG */ \ 635 "Vlan", /* PORT_ATTACH_EXEC__VLAN */ \ 636 "Trunk", /* PORT_ATTACH_EXEC__TRUNK */ \ 637 "COSQ", /* PORT_ATTACH_EXEC__COSQ */ \ 638 "Linkscan", /* PORT_ATTACH_EXEC__LINKSCAN */ \ 639 "Statistic", /* PORT_ATTACH_EXEC__STATISTIC */ \ 640 "Stack", /* PORT_ATTACH_EXEC__STACK */ \ 641 "Rate", /* PORT_ATTACH_EXEC__RATE */ \ 642 "Field", /* PORT_ATTACH_EXEC__FIELD */ \ 643 "Mirror", /* PORT_ATTACH_EXEC__MIRROR */ \ 644 "L3", /* PORT_ATTACH_EXEC__L3 */ \ 645 "IPMC", /* PORT_ATTACH_EXEC__IPMC */ \ 646 "IPMC replication", /* PORT_ATTACH_EXEC__IPMC_REPL */ \ 647 "MPLS", /* PORT_ATTACH_EXEC__MPLS */ \ 648 "MIM", /* PORT_ATTACH_EXEC__MIM */ \ 649 "Unkown phase" /* PORT_ATTACH_EXEC__MAX */ \ 650 } 651 652 /* 653 * Sequence of detaching a port from BCM layer. 654 * Follow the same sequence as in _bcm_esw_modules_deinit() 655 */ 656 typedef enum bcmi_xgs5_port_detach_exec_seq_e{ 657 658 /* Other modules related to port */ 659 PORT_DETACH_EXEC__IPMC_REPL, 660 PORT_DETACH_EXEC__IPMC, 661 PORT_DETACH_EXEC__MPLS, 662 PORT_DETACH_EXEC__MIM, 663 PORT_DETACH_EXEC__L3, 664 PORT_DETACH_EXEC__MIRROR, 665 PORT_DETACH_EXEC__FIELD, 666 PORT_DETACH_EXEC__RATE, 667 PORT_DETACH_EXEC__STACK, 668 PORT_DETACH_EXEC__COSQ, 669 PORT_DETACH_EXEC__TRUNK, 670 PORT_DETACH_EXEC__VLAN, 671 PORT_DETACH_EXEC__STG, 672 673 /* PORT module (_bcm_esw_port_deinit) */ 674 PORT_DETACH_EXEC__ASF, 675 PORT_DETACH_EXEC__EGR_LINK_DELAY, 676 PORT_DETACH_EXEC__HIGIG, 677 PORT_DETACH_EXEC__EEE, 678 PORT_DETACH_EXEC__VLAN_PROTOCOL, 679 PORT_DETACH_EXEC__EGR_BLOCK_PROFILE, 680 PORT_DETACH_EXEC__PHY, 681 PORT_DETACH_EXEC__DSCP_PROFILE, 682 PORT_DETACH_EXEC__PORT_CFG_INIT, 683 PORT_DETACH_EXEC__EGR_VLAN_ACTION, 684 PORT_DETACH_EXEC__SOFTWARE, 685 686 PORT_DETACH_EXEC__MAX 687 } bcmi_xgs5_port_detach_exec_seq_t; 688 689 #define BCMI_XGS5_PORT_DETACH_PHASES_MSG {\ 690 "IPMC replication", /* PORT_DETACH_EXEC__IPMC_REPL */ \ 691 "IPMC", /* PORT_DETACH_EXEC__IPMC */ \ 692 "MPLS", /* PORT_DETACH_EXEC__MPLS */ \ 693 "MIM", /* PORT_DETACH_EXEC__MIM */ \ 694 "L3", /* PORT_DETACH_EXEC__L3 */ \ 695 "Mirror", /* PORT_DETACH_EXEC__MIRROR */ \ 696 "Field", /* PORT_DETACH_EXEC__FIELD */ \ 697 "Rate", /* PORT_DETACH_EXEC__RATE */ \ 698 "Stack", /* PORT_DETACH_EXEC__STACK */ \ 699 "COSQ", /* PORT_DETACH_EXEC__COSQ */ \ 700 "Trunk", /* PORT_DETACH_EXEC__TRUNK */ \ 701 "Vlan", /* PORT_DETACH_EXEC__VLAN */ \ 702 "STG", /* PORT_DETACH_EXEC__STG */ \ 703 "ASF", /* PORT_DETACH_EXEC__ASF */ \ 704 "Egress link delay", /* PORT_DETACH_EXEC__EGR_LINK_DELAY */ \ 705 "HIGIG", /* PORT_DETACH_EXEC__HIGIG */ \ 706 "EEE config", /* PORT_DETACH_EXEC__EEE */ \ 707 "Vlan protocol", /* PORT_DETACH_EXEC__VLAN_PROTOCOL */ \ 708 "Egress block profile", /* PORT_DETACH_EXEC__EGR_BLOCK_PROFILE */ \ 709 "PHY Detach", /* PORT_DETACH_EXEC__PHY */ \ 710 "DSCP profile", /* PORT_DETACH_EXEC__DSCP_PROFILE */ \ 711 "Port config init", /* PORT_DETACH_EXEC__PORT_CFG_INIT */ \ 712 "Egress Vlan action", /* PORT_DETACH_EXEC__EGR_VLAN_ACTION */ \ 713 "Software", /* PORT_DETACH_EXEC__SOFTWARE */ \ 714 "Unkown phase" /* PORT_DETACH_EXEC__MAX */ \ 715 } 716 717 #define BCMI_XGS5_PORTS_PER_PBLK 4 /* Num of ports per port block */ 718 #define BCMI_XGS5_PORTS_PER_PM8X50_PBLK 8 /* Num of ports per PM8x50 block */ 719 720 /* 721 * Flexport restriction 722 */ 723 #define BCMI_XGS5_FLEXPORT_RESTRICTION_MIX_LR_OVS_DEV (1 << 0) 724 #define BCMI_XGS5_FLEXPORT_RESTRICTION_MIX_LR_OVS_PM (1 << 1) 725 #define BCMI_XGS5_FLEXPORT_RESTRICTION_PIPE_BANDWIDTH (1 << 2) 726 #define BCMI_XGS5_FLEXPORT_RESTRICTION_SPEED_CLASS (1 << 3) 727 #define BCMI_XGS5_FLEXPORT_RESTRICTION_PM_OVS_MIX_SISTER (1 << 4) 728 #define BCMI_XGS5_FLEXPORT_RESTRICTION_PM_SINGLE_PLL (1 << 5) 729 #define BCMI_XGS5_FLEXPORT_RESTRICTION_PM_MIX_ETH_HIGIG (1 << 6) 730 #define BCMI_XGS5_FLEXPORT_RESTRICTION_PORT_RATIO (1 << 7) 731 #define BCMI_XGS5_FLEXPORT_RESTRICTION_LR_OVS (1 << 8) 732 #define BCMI_XGS5_FLEXPORT_RESTRICTION_PM_HG_MIX_SPEED (1 << 9) 733 #define BCMI_XGS5_FLEXPORT_RESTRICTION_PM_LR_MIX_SISTER (1 << 10) 734 #define BCMI_XGS5_FLEXPORT_RESTRICTION_PM_DOUBLE_PLL (1 << 11) 735 736 /* 737 * Port Ratio 738 */ 739 #define BCMI_XGS5_PORT_RATIO_SINGLE (1 << 0) 740 #define BCMI_XGS5_PORT_RATIO_DUAL_1_1 (1 << 1) 741 #define BCMI_XGS5_PORT_RATIO_DUAL_2_1 (1 << 2) 742 #define BCMI_XGS5_PORT_RATIO_DUAL_1_2 (1 << 3) 743 #define BCMI_XGS5_PORT_RATIO_TRI_023_2_1_1 (1 << 4) 744 #define BCMI_XGS5_PORT_RATIO_TRI_023_4_1_1 (1 << 5) 745 #define BCMI_XGS5_PORT_RATIO_TRI_012_1_1_2 (1 << 6) 746 #define BCMI_XGS5_PORT_RATIO_TRI_012_1_1_4 (1 << 7) 747 #define BCMI_XGS5_PORT_RATIO_QUAD (1 << 8) 748 749 /* Lanes support */ 750 #define BCMI_XGS5_PORT_LANES_1 (1 << 0) 751 #define BCMI_XGS5_PORT_LANES_2 (1 << 1) 752 #define BCMI_XGS5_PORT_LANES_4 (1 << 2) 753 #define BCMI_XGS5_PORT_LANES_10 (1 << 3) 754 #define BCMI_XGS5_PORT_LANES_12 (1 << 4) 755 #define BCMI_XGS5_PORT_LANES_8 (1 << 5) 756 757 758 /* 759 * Physical Port Information 760 */ 761 typedef struct bcmi_xgs5_phy_port_s { 762 uint32 lanes_valid; /* Lanes capabilities */ 763 int pipe; 764 int flex; /* Flex enable by SOC property 765 'port_flex_enable' */ 766 int force_lb; 767 int max_lane_speed; 768 int force_hg; /* Port forced to hg mode only, per TSC port */ 769 } bcmi_xgs5_phy_port_t; 770 771 typedef struct bcmi_xgs5_speed_class_s { 772 uint32 speed_class_num; /* Max speed class num */ 773 uint32 no_mix_speed_mask; /* Not supported combination of speed classes */ 774 } bcmi_xgs5_speed_class_t; 775 776 /* 777 * Physical Device information 778 */ 779 typedef struct bcmi_xgs5_dev_info_s { 780 int num_pipe; /* Number of pipes in device */ 781 int num_tsc; /* Number of TSCs in device, not including management TSC */ 782 int phy_ports_max; /* Max physical ports in device */ 783 int ports_pipe_max[SOC_MAX_NUM_PIPES]; /* Max logical ports per pipe */ 784 int mmu_lossless; /* Default MMU lossless */ 785 int asf_prof_default;/* Default ASF MEM profile */ 786 787 /* Logical port boundary for each pipe */ 788 int pipe_bound; /* Indicate if have logic port boundary for pipe */ 789 int pipe_log_port_base[SOC_MAX_NUM_PIPES]; 790 int pipe_phy_port_base[SOC_MAX_NUM_PIPES]; 791 792 /* Ethernet speed and related Higig speed share same speed class in TDM */ 793 int speed_unify; /* Indicate that schedulers handle Ethernet ports 794 * and the related HiGig port speed identically */ 795 796 int tdm_speed_min; /* Min speed involved in DV TDM code (Mbps) */ 797 798 /* The Max packet size that is used in statistic counter update*/ 799 int cntmaxsize_xl; /* default value for XLPORT */ 800 int cntmaxsize_cl; /* default value for CLPORT */ 801 802 /* Restrictions */ 803 uint32 restriction_mask; 804 uint32 encap_mask; 805 uint32 hg_encap_mask; /* Supported Higig encap mask */ 806 uint32 port_ratio_mask; 807 uint8 aux_port_flexible; /* 1: Auxiliary ports support FlexPort opertions 808 * 0: Auxiliary ports does NOT support FlexPort 809 */ 810 pbmp_t aux_pbm; /* Port bitmap of auxiliary ports */ 811 uint32 pipe_lr_bw; /* Max line rate bandwidth (Mbps) */ 812 int tdm_pipe_lr_bw_limit_checker_speed_min; /* Min speed used in 813 * line rate bandwidth limit 814 * check calculations for 815 * TDM (Mbps) 816 */ 817 uint32 speed_valid[SOC_PORT_RESOURCE_LANES_MAX+1]; 818 bcmi_xgs5_speed_class_t speed_class; 819 bcmi_xgs5_phy_port_t *phy_port_info; 820 821 /* Bitmap of modules initialized in _bcm_modules_init */ 822 SHR_BITDCL init_cond[_SHR_BITDCLSIZE(SHR_BPROF_STATS_MAX)]; 823 824 /* Enable to do entire FlexPort sequence for encap change 825 * operation i.e BCMI_XGS5_PORT_RESOURCE_OP_ENCAP 826 */ 827 uint8 encap_change_flex; 828 } bcmi_xgs5_dev_info_t; 829 830 /* Device programming routines */ 831 typedef struct bcmi_xgs5_port_func_s { 832 int (*reconfigure_ports)(int unit, 833 soc_port_schedule_state_t *flexport_info); /*DV provide*/ 834 int (*soc_resource_init)(int unit, int nport, 835 bcm_port_resource_t *resource, 836 soc_port_resource_t *soc_resource); 837 int (*port_resource_validate)(int unit, 838 soc_port_schedule_state_t *port_schedule_state); 839 int (*pre_flexport_tdm)(int unit, 840 soc_port_schedule_state_t *port_schedule_state); 841 int (*post_flexport_tdm)(int unit, 842 soc_port_schedule_state_t *port_schedule_state); 843 int (*port_macro_update)(int unit, 844 soc_port_schedule_state_t *port_schedule_state); 845 int (*port_enable)(int unit, 846 soc_port_schedule_state_t *port_schedule_state); 847 int (*port_disable)(int unit, 848 soc_port_schedule_state_t *port_schedule_state); 849 int (*no_tdm_speed_update)(int unit, bcm_port_t port, int speed); 850 int (*speed_ability_get)(int unit, bcm_port_t port, bcm_port_abil_t *mask); 851 int (*speed_mix_validate)(int unit, uint32 speed_mask); 852 int (*port_cosmap_update)(int unit, pbmp_t pbm, int enable); 853 854 int (*port_attach_exec[PORT_ATTACH_EXEC__MAX])(int unit, bcm_port_t port); 855 int (*port_detach_exec[PORT_DETACH_EXEC__MAX])(int unit, bcm_port_t port); 856 857 } bcmi_xgs5_port_func_t; 858 859 /* HW Definitions */ 860 typedef struct bcmi_xgs5_port_drv_s { 861 bcmi_xgs5_port_func_t *port_calls;/* Chip programming */ 862 bcmi_xgs5_dev_info_t *dev_info[SOC_MAX_NUM_DEVICES];/* Device info */ 863 } bcmi_xgs5_port_drv_t; 864 865 #ifdef BCM_XGS5_SWITCH_PORT_SUPPORT 866 extern int 867 bcmi_xgs5_port_fn_drv_init(int unit, bcm_esw_port_drv_t *drv, 868 bcmi_xgs5_port_drv_t *bcmi_drv, 869 bcmi_xgs5_port_hw_defs_t *hw_defs); 870 871 extern int 872 bcmi_xgs5_port_addressable_local_get(int unit, 873 bcm_port_t port, bcm_port_t *local_port); 874 extern int 875 bcmi_xgs5_port_resource_set(int unit, 876 bcm_gport_t port, bcm_port_resource_t *resource); 877 extern int 878 bcmi_xgs5_port_resource_get(int unit, 879 bcm_gport_t port, bcm_port_resource_t *resource); 880 extern int 881 bcmi_xgs5_port_resource_multi_set(int unit, 882 int nport, bcm_port_resource_t *resource); 883 extern int 884 bcmi_xgs5_port_resource_traverse(int unit, 885 bcm_port_resource_traverse_cb trav_fn, 886 void *user_data); 887 extern int 888 bcmi_xgs5_port_lanes_set(int unit, bcm_port_t port, int lanes); 889 890 extern int 891 bcmi_xgs5_port_lanes_get(int unit, bcm_port_t port, int *lanes); 892 893 extern int 894 bcmi_xgs5_port_speed_set(int unit, bcm_port_t port, int speed); 895 896 extern int 897 bcmi_xgs5_port_resource_status_update(int unit, 898 int nport, 899 bcm_port_resource_t *resource); 900 901 extern int 902 bcmi_xgs5_port_resource_speed_multi_set(int unit, 903 int nport, 904 bcm_port_resource_t *resource); 905 906 /* 907 * Port attach 908 */ 909 extern int 910 bcmi_xgs5_port_attach_dscp(int unit, bcm_port_t port); 911 912 extern int 913 bcmi_xgs5_port_attach_dscp(int unit, bcm_port_t port); 914 915 extern int 916 bcmi_xgs5_port_attach_software(int unit, bcm_port_t port); 917 918 extern int 919 bcmi_xgs5_port_attach_egr_vlan_action(int unit, bcm_port_t port); 920 921 extern int 922 bcmi_xgs5_port_cfg_init(int unit, bcm_port_t port); 923 924 extern int 925 bcmi_xgs5_port_attach_port_probe(int unit, bcm_port_t port); 926 927 extern int 928 bcmi_xgs5_port_attach_frame_length_check(int unit, bcm_port_t port); 929 930 extern int 931 bcmi_xgs5_port_attach_rcpu_mtu(int unit, bcm_port_t port); 932 933 extern int 934 bcmi_xgs5_port_attach_outer_tpid(int unit, bcm_port_t port); 935 936 extern int 937 bcmi_xgs5_port_egr_block_profile_init(int unit, bcm_port_t port); 938 939 extern int 940 bcmi_xgs5_port_attach_vlan_protocol(int unit, bcm_port_t port); 941 942 extern int 943 bcmi_xgs5_port_attach_eee(int unit, bcm_port_t port); 944 945 extern int 946 bcmi_xgs5_port_attach_higig(int unit, bcm_port_t port); 947 948 extern int 949 bcmi_xgs5_port_attach_port_info_cfg(int unit, bcm_port_t port); 950 951 extern int 952 bcmi_xgs5_port_attach_egr_link_delay(int unit, bcm_port_t port); 953 954 extern int 955 bcmi_xgs5_port_attach_stg(int unit, bcm_port_t port); 956 957 extern int 958 bcmi_xgs5_port_attach_vlan(int unit, bcm_port_t port); 959 960 extern int 961 bcmi_xgs5_port_attach_trunk(int unit, bcm_port_t port); 962 963 extern int 964 bcmi_xgs5_port_attach_linkscan(int unit, bcm_port_t port); 965 966 extern int 967 bcmi_xgs5_port_attach_stat(int unit, bcm_port_t port); 968 969 extern int 970 bcmi_xgs5_port_attach_stack(int unit, bcm_port_t port); 971 972 extern int 973 bcmi_xgs5_port_attach_rate(int unit, bcm_port_t port); 974 975 extern int 976 bcmi_xgs5_port_attach_field(int unit, bcm_port_t port); 977 978 extern int 979 bcmi_xgs5_port_attach_mirror(int unit, bcm_port_t port); 980 981 extern int 982 bcmi_xgs5_port_attach_l3(int unit, bcm_port_t port); 983 984 extern int 985 bcmi_xgs5_port_attach_ipmc(int unit, bcm_port_t port); 986 987 extern int 988 bcmi_xgs5_port_attach_mpls(int unit, bcm_port_t port); 989 990 extern int 991 bcmi_xgs5_port_attach_mim(int unit, bcm_port_t port); 992 993 /* 994 * Port Detach 995 */ 996 extern int 997 bcmi_xgs5_port_detach_dscp(int unit, bcm_port_t port); 998 999 extern int 1000 bcmi_xgs5_port_detach_software(int unit, bcm_port_t port); 1001 1002 extern int 1003 bcmi_xgs5_port_detach_egr_vlan_action(int unit, bcm_port_t port); 1004 1005 extern int 1006 bcmi_xgs5_port_detach_phy(int unit, bcm_port_t port); 1007 1008 extern int 1009 bcmi_xgs5_port_detach_vlan_protocol(int unit, bcm_port_t port); 1010 1011 extern int 1012 bcmi_xgs5_port_detach_eee(int unit, bcm_port_t port); 1013 1014 extern int 1015 bcmi_xgs5_port_detach_higig(int unit, bcm_port_t port); 1016 1017 extern int 1018 bcmi_xgs5_port_detach_egr_link_delay(int unit, bcm_port_t port); 1019 1020 extern int 1021 bcmi_xgs5_port_detach_stg(int unit, bcm_port_t port); 1022 1023 extern int 1024 bcmi_xgs5_port_detach_vlan(int unit, bcm_port_t port); 1025 1026 extern int 1027 bcmi_xgs5_port_detach_trunk(int unit, bcm_port_t port); 1028 1029 extern int 1030 bcmi_xgs5_port_detach_stat(int unit, bcm_port_t port); 1031 1032 extern int 1033 bcmi_xgs5_port_detach_stack(int unit, bcm_port_t port); 1034 1035 extern int 1036 bcmi_xgs5_port_detach_rate(int unit, bcm_port_t port); 1037 1038 extern int 1039 bcmi_xgs5_port_detach_field(int unit, bcm_port_t port); 1040 1041 extern int 1042 bcmi_xgs5_port_detach_mirror(int unit, bcm_port_t port); 1043 1044 extern int 1045 bcmi_xgs5_port_detach_l3(int unit, bcm_port_t port); 1046 1047 extern int 1048 bcmi_xgs5_port_detach_ipmc(int unit, bcm_port_t port); 1049 1050 extern int 1051 bcmi_xgs5_port_detach_mpls(int unit, bcm_port_t port); 1052 1053 extern int 1054 bcmi_xgs5_port_detach_mim(int unit, bcm_port_t port); 1055 1056 extern int 1057 bcmi_xgs5_port_enable_set(int unit, bcm_port_t port, int enable); 1058 1059 extern int 1060 bcmi_xgs5_flexport_based_speed_ability_get(int unit, bcm_port_t port, 1061 bcm_port_abil_t *mask); 1062 1063 extern int 1064 bcmi_xgs5_port_encap_speed_check(int unit, bcm_port_t port, int encap, 1065 int speed); 1066 1067 extern void 1068 bcmi_esw_port_redirect_config_t_init( 1069 bcm_port_redirect_config_t *redirect_config); 1070 1071 extern int 1072 bcmi_xgs5_port_redirect_config_set(int unit, bcm_gport_t port, 1073 bcm_port_redirect_config_t *redirect_config); 1074 1075 extern int 1076 bcmi_xgs5_port_redirect_config_get(int unit, bcm_gport_t port, 1077 bcm_port_redirect_config_t *redirect_config); 1078 extern int 1079 bcmi_xgs5_port_force_lb_set(int unit); 1080 1081 extern int 1082 bcmi_xgs5_port_force_lb_check(int unit, int port, int loopback); 1083 1084 /* Debug functions for Flexport */ 1085 extern int 1086 bcmi_xgs5_num_tsc(int unit, int *num); 1087 1088 extern int 1089 bcmi_xgs5_phy_to_pipe(int unit, int phy_port, int *pipe); 1090 1091 extern int 1092 bcmi_xgs5_port_range(int unit, int pipe, int *port_start, int *port_end); 1093 1094 extern int 1095 bcmi_xgs5_speed_to_lanes(int unit, int lane_max, int *speed, int *lanes); 1096 1097 #endif /* BCM_XGS5_SWITCH_PORT_SUPPORT */ 1098 1099 #if defined (BCM_EP_REDIRECT_VERSION_2) 1100 extern int 1101 bcmi_xgs5_rx_CopyToCpu_config_add(int unit, uint32 options, 1102 bcm_rx_CopyToCpu_config_t *copyToCpu_config); 1103 1104 extern int 1105 bcmi_xgs5_rx_CopyToCpu_config_get(int unit, int index, 1106 bcm_rx_CopyToCpu_config_t *copyToCpu_config); 1107 1108 extern int 1109 bcmi_xgs5_rx_CopyToCpu_config_delete(int unit, int index); 1110 1111 extern int 1112 bcmi_xgs5_rx_CopyToCpu_config_get_all(int unit, int entries_max, 1113 bcm_rx_CopyToCpu_config_t *copyToCpu_config, 1114 int *entries_count); 1115 extern int 1116 bcmi_xgs5_rx_CopyToCpu_config_delete_all(int unit); 1117 1118 extern int 1119 bcmi_rx_copyToCpu_drop_reason_field_get(int unit, 1120 bcm_pkt_drop_reason_t drop_reason, 1121 soc_field_t *drop_reason_field); 1122 #endif 1123 typedef enum _bcmi_mpls_entry_format_fields_e { 1124 bcmiMplsLabel, 1125 bcmiMplsPushAction, 1126 bcmiMplsExpSelect, 1127 bcmiMplsExpMappingPtr, 1128 bcmiNewCfi, 1129 bcmiNewPri, 1130 bcmiMplsExp, 1131 bcmiLabelSelect, 1132 bcmiMplsTtl, 1133 bcmiSpecialLabelPushType, 1134 bcmiExpMappingTableSelect, 1135 bcmiPktEcnToExpMappingPtr, 1136 bcmiPktEcnToExpPriority, 1137 bcmiEgrFlexCtrActionSet, 1138 bcmiFlexCtrBaseCounterIdx, 1139 bcmiFlexCtrPoolNumber, 1140 bcmiRsvdFlexCtrPoolNumber, 1141 bcmiFlexCtrOffsetMode, 1142 bcmiEcnMappingEnable, 1143 bcmiEcnMappingTableSelect, 1144 bcmiMplsEntryFormatReserved 1145 1146 }_bcmi_mpls_entry_format_fields_t; 1147 1148 extern int 1149 bcmi_egr_ip_tnl_mpls_entry_format_set(int unit, int field_type, void *tnl_buf, 1150 int lbl_offset, uint32 *retbuf, 1151 int set_value); 1152 1153 extern int 1154 bcmi_egr_ip_tnl_mpls_entry_format_get(int unit, void *tnl_buf, int lbl_offset, 1155 uint32 *inbuf, int field_type, 1156 uint32 *retval); 1157 1158 extern void 1159 bcm_td3_ip_tnl_mpls_label_info_get(int unit, void *tnl_buf, int type, 1160 int offset, int *val); 1161 1162 extern int 1163 bcmi_egress_tnl_label_entry_get(int unit, void *tnl_buf, 1164 int offset, uint32 *data_buf); 1165 1166 extern int 1167 bcmi_egress_tnl_label_entry_set(int unit, void *tnl_buf, 1168 int offset, uint32 *data_buf); 1169 1170 #if defined(INCLUDE_FLOWTRACKER) 1171 /* Flowtracker functions */ 1172 extern int bcm_xgs5_ft_eapp_init(int unit); 1173 extern int bcm_xgs5_ft_eapp_detach(int unit); 1174 1175 extern int 1176 _bcm_xgs5_ft_template_list_template_add(int unit, 1177 bcm_flowtracker_export_template_t template_id, 1178 _bcm_int_ft_export_template_info_t *template_int_info); 1179 extern int 1180 _bcm_xgs5_ft_template_list_template_delete (int unit, 1181 bcm_flowtracker_export_template_t template_id); 1182 extern int 1183 _bcm_xgs5_ft_template_list_template_modify( 1184 int unit, 1185 bcm_flowtracker_export_template_t template_id, 1186 _bcm_int_ft_export_template_info_t *template_info); 1187 1188 extern int 1189 _bcm_xgs5_ft_template_list_template_get (int unit, 1190 bcm_flowtracker_export_template_t template_id, 1191 _bcm_int_ft_export_template_info_t *template_info); 1192 extern int 1193 _bcm_xgs5_ft_template_list_destroy (int unit); 1194 1195 extern int 1196 _bcm_xgs5_ft_collector_list_collector_add(int unit, 1197 bcm_flowtracker_collector_t collector_id, 1198 bcm_flowtracker_collector_info_t *collector_info); 1199 extern int 1200 _bcm_xgs5_ft_collector_list_collector_delete (int unit, 1201 bcm_flowtracker_collector_t collector_id); 1202 extern int 1203 _bcm_xgs5_ft_collector_list_collector_modify(int unit, 1204 bcm_flowtracker_collector_t collector_id, 1205 bcm_flowtracker_collector_info_t *collector_info); 1206 extern int 1207 _bcm_xgs5_ft_collector_list_collector_get (int unit, 1208 bcm_flowtracker_collector_t collector_id, 1209 _bcm_int_ft_collector_info_t *collector_info); 1210 extern int 1211 _bcm_xgs5_ft_collector_list_destroy (int unit); 1212 1213 extern int 1214 _bcm_xgs5_ft_v2_collector_list_collector_add(int unit, 1215 bcm_collector_t collector_id, 1216 int coll_int_id); 1217 extern int 1218 _bcm_xgs5_ft_v2_collector_list_collector_delete(int unit, 1219 bcm_collector_t collector_id); 1220 extern int 1221 _bcm_xgs5_ft_v2_collector_list_collector_get(int unit, 1222 bcm_collector_t collector_id, 1223 int *coll_int_id); 1224 extern void 1225 _bcm_xgs5_ft_v2_collector_list_collector_in_use(int unit, 1226 bcm_collector_t collector_id, 1227 int *in_use); 1228 extern int 1229 _bcm_xgs5_ft_v2_collector_list_export_profile_add(int unit, 1230 int export_profile_id, 1231 int export_profile_int_id); 1232 extern int 1233 _bcm_xgs5_ft_v2_collector_list_export_profile_delete(int unit, 1234 int export_profile_id); 1235 1236 extern int 1237 _bcm_xgs5_ft_v2_collector_list_export_profile_get(int unit, 1238 int export_profile, 1239 int *export_profile_int_id); 1240 extern void 1241 _bcm_xgs5_ft_v2_collector_list_export_profile_in_use(int unit, 1242 int export_profile_id, 1243 int *in_use); 1244 1245 extern int 1246 _bcm_xgs5_ft_flow_group_list_flow_group_add(int unit, 1247 bcm_flowtracker_group_t flow_group_id); 1248 extern int 1249 _bcm_xgs5_ft_flow_group_list_flow_group_delete (int unit, 1250 bcm_flowtracker_group_t flow_group_id); 1251 extern int 1252 _bcm_xgs5_ft_flow_group_list_flow_group_modify(int unit, 1253 bcm_flowtracker_group_t flow_group_id, 1254 _bcm_int_ft_flow_group_info_t *flow_group_int_info); 1255 extern int 1256 _bcm_xgs5_ft_flow_group_list_flow_group_get (int unit, 1257 bcm_flowtracker_group_t flow_group_id, 1258 _bcm_int_ft_flow_group_info_t *flow_group_int_info); 1259 extern int 1260 _bcm_xgs5_ft_flow_group_list_destroy (int unit); 1261 extern int 1262 _bcm_xgs5_ft_flow_group_list_collector_in_use_check(int unit, 1263 bcm_flowtracker_collector_t collector_id); 1264 extern int 1265 _bcm_xgs5_ft_flow_group_list_template_in_use_check(int unit, 1266 bcm_flowtracker_export_template_t template_id); 1267 extern int 1268 _bcm_xgs5_ft_flow_group_list_elph_profile_in_use_check( 1269 int unit, 1270 bcm_flowtracker_export_template_t profile_id); 1271 extern int 1272 _bcm_xgs5_ft_flow_group_list_get_all_ids( 1273 int unit, 1274 bcm_flowtracker_group_t *flow_group_id_list, 1275 int *num_flow_groups); 1276 1277 extern int _bcm_xgs5_ft_eapp_send_flow_group_create_msg (int unit, 1278 bcm_flowtracker_group_t flow_group_id); 1279 extern int _bcm_xgs5_ft_eapp_send_flow_group_delete_msg (int unit, 1280 bcm_flowtracker_group_t flow_group_id); 1281 extern int _bcm_xgs5_ft_eapp_send_flow_group_update_msg (int unit, 1282 bcm_flowtracker_group_t flow_group_id, 1283 uint32 update_flags, uint32 update_value); 1284 extern int _bcm_xgs5_ft_eapp_send_flow_group_get_msg (int unit, 1285 bcm_flowtracker_group_t flow_group_id, 1286 uint32 *flow_count); 1287 extern int _bcm_xgs5_ft_eapp_send_template_create_msg (int unit, 1288 bcm_flowtracker_export_template_t template_id); 1289 extern int _bcm_xgs5_ft_eapp_send_template_delete_msg (int unit, 1290 bcm_flowtracker_export_template_t template_id); 1291 extern int _bcm_xgs5_ft_eapp_send_collector_create_msg (int unit, 1292 int collector_id, 1293 int export_profile_id); 1294 extern int _bcm_xgs5_ft_eapp_send_collector_delete_msg (int unit, 1295 uint16 collector_id); 1296 extern int _bcm_xgs5_ft_eapp_send_em_key_format_msg (int unit, 1297 shr_ft_msg_ctrl_em_key_format_t *em_key_format); 1298 1299 extern int 1300 _bcm_xgs5_ft_eapp_send_em_group_create_msg(int unit, 1301 shr_ft_msg_ctrl_em_group_create_t *msg); 1302 1303 extern int 1304 _bcm_xgs5_ft_eapp_send_em_group_delete_msg(int unit, 1305 int em_group_id); 1306 1307 extern int 1308 _bcm_xgs5_ft_eapp_send_flow_group_flow_data_get_msg( 1309 int unit, 1310 bcm_flowtracker_group_t flow_group_id, 1311 bcm_flowtracker_flow_key_t *flow_key, 1312 bcm_flowtracker_flow_data_t *flow_data); 1313 extern int 1314 _bcm_xgs5_ft_eapp_send_ser_event_msg(int unit, int pipe, soc_mem_t mem, int index); 1315 1316 extern int 1317 _bcm_xgs5_ft_eapp_send_template_xmit_start(int unit, 1318 bcm_flowtracker_export_template_t template_id, 1319 bcm_flowtracker_collector_t collector_id); 1320 1321 extern int 1322 _bcm_xgs5_ft_eapp_send_group_actions_set_msg(int unit, 1323 shr_ft_msg_ctrl_group_actions_set_t *msg); 1324 1325 extern int 1326 _bcm_xgs5_ft_elph_profile_list_add(int unit, 1327 bcm_flowtracker_elephant_profile_t id, 1328 bcm_flowtracker_elephant_profile_info_t *profile); 1329 1330 extern int 1331 _bcm_xgs5_ft_eapp_send_elph_profile_create_msg(int unit, int profile_id); 1332 1333 extern int 1334 _bcm_xgs5_ft_eapp_send_export_interval_update_msg (int unit, 1335 uint32 export_interval); 1336 1337 extern int 1338 _bcm_xgs5_ft_elph_profile_list_get(int unit, 1339 bcm_flowtracker_elephant_profile_t id, 1340 _bcm_int_ft_elph_profile_info_t *profile); 1341 1342 extern int 1343 _bcm_xgs5_ft_elph_profile_list_delete(int unit, 1344 bcm_flowtracker_elephant_profile_t id); 1345 1346 extern void _bcm_xgs5_flowtracker_sw_dump(int unit); 1347 extern void _bcm_xgs5_flowtracker_dump_stats_learn(int unit); 1348 extern void _bcm_xgs5_flowtracker_dump_stats_export(int unit); 1349 extern void _bcm_xgs5_flowtracker_dump_stats_age(int unit); 1350 extern void _bcm_xgs5_flowtracker_dump_stats_elephant(int unit); 1351 1352 #endif /* INCLUDE_FLOWTRACKER */ 1353 1354 #if defined(INCLUDE_IFA) 1355 /* IFA module APIs */ 1356 extern int bcm_xgs5_ifa_eapp_init(int unit); 1357 extern int bcm_xgs5_ifa_eapp_detach(int unit); 1358 extern int bcm_xgs5_ifa_collector_set(int unit, 1359 bcm_ifa_collector_info_t *ifa_collector_info); 1360 extern int bcm_xgs5_ifa_collector_get(int unit, 1361 bcm_ifa_collector_info_t *ifa_collector_info); 1362 extern int bcm_xgs5_ifa_collector_modify(int unit, 1363 bcm_ifa_collector_info_t *ifa_collector_info); 1364 extern int bcm_xgs5_ifa_eapp_collector_set_msg(int unit, 1365 bcm_ifa_collector_info_t *ifa_collector_info); 1366 extern int bcm_xgs5_ifa_config_set(int unit, 1367 bcm_ifa_config_info_t *ifa_config_info); 1368 extern int bcm_xgs5_ifa_config_get(int unit, 1369 bcm_ifa_config_info_t *ifa_config_info); 1370 extern int bcm_xgs5_ifa_config_modify(int unit, 1371 bcm_ifa_config_info_t *ifa_config_info); 1372 extern int bcm_xgs5_ifa_eapp_config_info_msg(int unit, 1373 bcm_ifa_config_info_t *ifa_config_info); 1374 extern int bcm_xgs5_ifa_eapp_collector_info_get_msg(int unit, 1375 bcm_ifa_collector_info_t *ifa_collector_info); 1376 extern int bcm_xgs5_ifa_eapp_config_info_get_msg(int unit, 1377 bcm_ifa_config_info_t *config_info); 1378 extern int bcm_xgs5_ifa_eapp_stat_info_get_msg(int unit, 1379 bcm_ifa_stat_info_t *stat_data); 1380 extern int bcm_xgs5_ifa_eapp_stat_info_set_msg(int unit, 1381 bcm_ifa_stat_info_t *stat_data); 1382 #endif /* INCLUDE_IFA */ 1383 #endif /* _BCM_INT_XGS5_H_ */