trident3.h (55448B)
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-2020 Broadcom Inc. All rights reserved. 6 * 7 * File: trident3.h 8 * Purpose: Function declarations for Trident3 Internal functions. 9 */ 10 11 #ifndef _BCM_INT_TRIDENT3_H_ 12 #define _BCM_INT_TRIDENT3_H_ 13 14 #include <bcm_int/esw/mbcm.h> 15 #include <bcm_int/esw/cosq.h> 16 #include <bcm_int/esw/xgs5.h> 17 #include <bcm/oob.h> 18 #include <bcm_int/esw/pfc_deadlock.h> 19 #include <soc/profile_mem.h> 20 21 #if defined(INCLUDE_IFA) 22 #include <bcm/ifa.h> 23 #endif 24 25 #include <soc/esw/port.h> 26 #include <soc/trident3.h> 27 #include <bcm_int/esw/l2.h> 28 29 #ifdef INCLUDE_L3 30 #define BCM_TD3_L3_ECMP_MODE_SINGLE 0x0 31 #define BCM_TD3_L3_ECMP_MODE_HIERARCHICAL 0x1 32 #endif 33 34 #ifdef SOC_L3_ECMP_PROTECTED_ACCESS_SUPPORT 35 #include <soc/esw/ecmp.h> 36 #endif /* SOC_L3_ECMP_PROTECTED_ACCESS_SUPPORT */ 37 38 #if defined(BCM_TRIDENT3_SUPPORT) 39 40 #define _BCM_TD3X_L3_ERR_EXIT(_rv_) \ 41 if ((_rv_) < 0) { \ 42 goto exit; \ 43 } 44 45 #define BCM_ECMP_LB_MODE_ENHANCED_HASH 0x4 46 47 /* entries_per_profile comes from MAXIDX in PHB_MAPPING_TBL_1 48 * MAXIDX => 8703, #(136 ports x 64 profiles) */ 49 #define _BCM_TD3_PHB_MAP_TAB1_ENTRIES_PER_PROFILE (64) 50 51 #define _BCM_TD3_NUM_PIPE_PORTS _TD3_TDM_DEV_PORTS_PER_PIPE 52 53 /* Flex InPorts Opaque3/4 field size */ 54 #define _FP_FLEX_PBMP_SIZE 16 55 /* IFP_TCAM_WIDE IPBMf size */ 56 #define _FP_TD3_TCAM_IPBMP_SIZE 34 57 #define _BCM_TD3_OPAQUE3_ID 3 58 #define _BCM_TD3_OPAQUE4_ID 4 59 #define _BCM_TD3_OPAQUE_ID_MASK 0x7 60 61 /* Max OBM priority */ 62 #define _BCM_TD3_OBM_PRIORITY_MAX 3 63 64 /* HGOE functions */ 65 #define BCM_TD3_HGOE_HDR_TYPE 0x8787 66 extern int bcm_td3_tx_hgoe_list(int unit, bcm_pkt_t *pkt, 67 bcm_pkt_cb_f all_done_cb, void *cookie); 68 extern int bcm_td3_tx_hgoe_array(int unit, bcm_pkt_t **pkt_arr, int count, 69 bcm_pkt_cb_f all_done_cb, void *cookie); 70 extern int bcm_td3_tx_hgoe_pkt(int unit, bcm_pkt_t *pkt, 71 bcm_port_encap_config_t *encap_cfg, void *cookie, 72 bcm_tx_f tx_f); 73 extern int bcm_td3_port_hgoe_mode_set(int unit, bcm_port_t port); 74 extern int bcm_td3_port_hgoe_mode_get( 75 int unit, bcm_port_t port, uint8 *is_hgoe); 76 /* end HOGE declarations */ 77 78 extern int _bcm_td3_port_phb_map_tab1_default_entry_add 79 (int unit, soc_profile_mem_t *prof); 80 extern int bcm_td3_port_init(int unit); 81 82 extern int bcm_td3_port_ing_pri_cng_set(int unit, bcm_port_t port, 83 int untagged, int pkt_pri, int cfi, 84 int int_pri, bcm_color_t color); 85 extern int bcm_td3_port_ing_pri_cng_get(int unit, bcm_port_t port, 86 int untagged, int pkt_pri, int cfi, 87 int *int_pri, bcm_color_t *color); 88 89 extern int bcm_td3_port_cfg_init(int unit, bcm_port_t port, 90 bcm_vlan_data_t *vlan_data); 91 extern int bcm_td3_port_cfg_get(int, bcm_port_t, bcm_port_cfg_t *); 92 extern int 93 bcm_td3_port_cfg_set(int unit, bcm_port_t port, bcm_port_cfg_t *port_cfg); 94 95 extern int _bcm_td3_egr_port_tab_conv(int unit, soc_field_t *field, 96 soc_mem_t* mem); 97 extern int _bcm_td3_port_tab_conv(int unit, soc_field_t *field, soc_mem_t *mem); 98 99 extern int bcmi_td3_port_internal_loopback_set(int unit, bcm_port_t port, int value); 100 101 extern int bcm_td3_port_ipbm_opaque_get(int unit, int stm_idx, uint32* class); 102 extern int bcm_td3_port_ipbm_opaque_set(int unit, int stm_idx, uint32 class); 103 104 extern int bcmi_td3_port_pp_num_set(int unit, bcm_port_t port, int pp_num); 105 extern int bcmi_td3_port_pp_num_get(int unit, bcm_port_t port, int *pp_num); 106 107 /* VLAN Module */ 108 extern int 109 _bcm_vlan_vfi_untag_profile_entry_op(int unit, void **entries, 110 int entries_per_set, int add, uint32 *index); 111 extern int 112 _bcm_vlan_vfi_untag_profile_mem_reference(int unit, int idx,int entries_per_set); 113 extern int 114 _bcm_vlan_vfi_untag_profile_ref_count(int unit, int index, int *ref_count); 115 extern int 116 bcm_td3_vlan_vfi_untag_init(int unit, bcm_vlan_t vid, pbmp_t pbmp); 117 extern int 118 _bcm_td3_vlan_vfi_profile_entry_get(int unit, bcm_vlan_t vlan_vfi, 119 void *entry_data); 120 extern int 121 _bcm_td3_vlan_vfi_profile_entry_set(int unit, bcm_vlan_t vlan_vfi, 122 void *entry_data); 123 extern int 124 bcm_td3_vlan_vfi_untag_add(int unit, bcm_vlan_t vid, pbmp_t pbmp, pbmp_t ubmp); 125 extern int 126 bcm_td3_vlan_vfi_untag_delete(int unit, bcm_vlan_t vid, pbmp_t pbmp); 127 extern int 128 bcm_td3_vlan_table_ut_port_get(int unit, bcm_vlan_t vid, pbmp_t *ut_pbmp); 129 extern int 130 bcm_td3_vlan_vfi_untag_destroy(int unit, bcm_vlan_t vlan); 131 extern int 132 _bcm_td3_vlan_shared_vlan_enable_get(int unit, int *enable); 133 extern int 134 _bcm_td3_vlan_shared_vlan_enable_set(int unit, int enable); 135 136 /* VLAN XLATE */ 137 extern int _bcm_td3_vlan_mac_action_add(int unit, bcm_mac_t mac, 138 bcm_vlan_action_set_t *action); 139 extern int 140 _bcm_td3_vlan_mac_action_get(int unit, bcm_mac_t mac, 141 bcm_vlan_action_set_t *action); 142 extern int 143 _bcm_td3_vlan_mac_delete(int unit, bcm_mac_t mac); 144 145 extern int 146 _bcm_td3_vlan_mac_delete_all(int unit); 147 148 extern int 149 _bcm_td3_vlan_mac_action_traverse(int unit, 150 bcm_vlan_mac_action_traverse_cb cb, 151 void *user_data); 152 /* COSQ Module */ 153 extern int 154 bcm_td3_cosq_init(int unit); 155 extern int 156 bcm_td3_cosq_detach(int unit, int software_state_only); 157 158 extern int 159 bcm_td3_cosq_config_get(int unit, int *numq); 160 161 extern int 162 bcm_td3_cosq_config_set(int unit, int numq); 163 164 extern int 165 bcm_td3_cosq_gport_attach(int unit, bcm_gport_t input_gport, 166 bcm_gport_t parent_gport, bcm_cos_queue_t cosq); 167 168 extern int 169 bcm_td3_cosq_gport_detach(int unit, bcm_gport_t input_gport, 170 bcm_gport_t parent_gport, bcm_cos_queue_t cosq); 171 172 extern int 173 bcm_td3_cosq_gport_attach_get(int unit, bcm_gport_t sched_gport, 174 bcm_gport_t *input_gport, bcm_cos_queue_t *cosq); 175 176 extern int 177 bcm_td3_cosq_gport_traverse(int unit, bcm_cosq_gport_traverse_cb cb, 178 void *user_data); 179 180 extern int 181 bcm_td3_cosq_gport_traverse_by_port(int unit, bcm_gport_t port, 182 bcm_cosq_gport_traverse_cb cb, 183 void *user_data); 184 extern int 185 bcm_td3_cosq_gport_child_get(int unit, bcm_gport_t in_gport, 186 bcm_cos_queue_t cosq, bcm_gport_t *out_gport); 187 188 extern int 189 bcm_td3_cosq_gport_get(int unit, bcm_gport_t gport, bcm_gport_t *port, 190 int *numq, uint32 *flags); 191 192 typedef enum { 193 _BCM_TD3_COSQ_INDEX_STYLE_WRED_QUEUE, 194 _BCM_TD3_COSQ_INDEX_STYLE_WRED_PORT, 195 _BCM_TD3_COSQ_INDEX_STYLE_WRED_DEVICE, 196 _BCM_TD3_COSQ_INDEX_STYLE_UCAST_QUEUE, 197 _BCM_TD3_COSQ_INDEX_STYLE_MCAST_QUEUE, 198 _BCM_TD3_COSQ_INDEX_STYLE_EGR_POOL, 199 _BCM_TD3_COSQ_INDEX_STYLE_COS, 200 _BCM_TD3_COSQ_INDEX_STYLE_COUNT 201 } _bcm_td3_cosq_index_style_t; 202 203 typedef struct _bcm_td3_cosq_node_s { 204 bcm_gport_t gport; 205 int numq; 206 int level; 207 int hw_index; 208 int in_use; 209 bcm_gport_t parent_gport; 210 } _bcm_td3_cosq_node_t; 211 212 extern int 213 _bcm_td3_cosq_node_get(int unit, bcm_gport_t gport, bcm_module_t *modid, 214 bcm_port_t *port, int *id, _bcm_td3_cosq_node_t **node); 215 216 extern int 217 _bcm_td3_cosq_port_resolve(int unit, bcm_gport_t gport, bcm_module_t *modid, 218 bcm_port_t *port, bcm_trunk_t *trunk_id, int *id, 219 int *qnum); 220 221 extern int 222 _bcm_td3_cosq_port_cos_resolve(int unit, bcm_port_t port, bcm_cos_t cos, 223 _bcm_td3_cosq_index_style_t style, 224 bcm_gport_t *gport); 225 226 extern int 227 bcm_td3_cosq_sched_weight_max_get(int unit, int mode, int *weight_max); 228 229 extern int 230 bcm_td3_cosq_gport_sched_get(int unit, bcm_gport_t gport, bcm_cos_queue_t cosq, 231 int *mode, int *weight); 232 233 extern int 234 bcm_td3_cosq_gport_sched_set(int unit, bcm_gport_t gport, bcm_cos_queue_t cosq, 235 int mode, int weight); 236 237 extern int 238 bcm_td3_cosq_port_sched_get(int unit, bcm_pbmp_t pbm, int *mode, int *weights, 239 int *delay); 240 241 extern int 242 bcm_td3_cosq_port_sched_set(int unit, bcm_pbmp_t pbm, int mode, const int 243 *weights, int delay); 244 245 extern int 246 bcm_td3_cosq_priority_mapping_get_all(int unit, bcm_gport_t gport, int index, 247 bcm_cosq_priority_mapping_t type, 248 int pri_max, int *pri_array, 249 int *pri_count); 250 251 extern int 252 bcm_td3_cosq_discard_set(int unit, uint32 flags); 253 254 extern int 255 bcm_td3_cosq_discard_get(int unit, uint32 *flags); 256 257 extern int 258 bcm_td3_cosq_discard_port_set(int unit, bcm_port_t port, bcm_cos_queue_t cosq, 259 uint32 color, int drop_start, int drop_slope, 260 int average_time); 261 262 extern int 263 bcm_td3_cosq_discard_port_get(int unit, bcm_port_t port, bcm_cos_queue_t cosq, 264 uint32 color, int *drop_start, int *drop_slope, 265 int *average_time); 266 267 extern int 268 bcm_td3_cosq_gport_discard_set(int unit, bcm_gport_t gport, 269 bcm_cos_queue_t cosq, 270 bcm_cosq_gport_discard_t *discard); 271 272 extern int 273 bcm_td3_cosq_gport_discard_get(int unit, bcm_gport_t gport, 274 bcm_cos_queue_t cosq, 275 bcm_cosq_gport_discard_t *discard); 276 277 extern int bcm_td3_cosq_wred_resolution_entry_create(int unit, int *index); 278 extern int bcm_td3_cosq_wred_resolution_entry_destroy(int unit, int index); 279 extern int bcm_td3_cosq_wred_resolution_set(int unit, int index, 280 bcm_cosq_discard_rule_t *rule); 281 extern int bcm_td3_cosq_wred_resolution_get(int unit, int index, int max, 282 bcm_cosq_discard_rule_t *rule, 283 int *count); 284 285 extern int 286 bcm_td3_cosq_gport_bandwidth_get(int unit, bcm_gport_t gport, 287 bcm_cos_queue_t cosq, uint32 *kbits_sec_min, 288 uint32 *kbits_sec_max, uint32 *flags); 289 290 extern int 291 bcm_td3_cosq_gport_bandwidth_set(int unit, bcm_gport_t gport, 292 bcm_cos_queue_t cosq, uint32 kbits_sec_min, 293 uint32 kbits_sec_max, uint32 flags); 294 295 extern int 296 bcm_td3_cosq_port_bandwidth_get(int unit, bcm_port_t port, bcm_cos_queue_t cosq, 297 uint32 *min_quantum, uint32 *max_quantum, 298 uint32 *burst_quantum, uint32 *flags); 299 300 extern int 301 bcm_td3_cosq_port_bandwidth_set(int unit, bcm_port_t port, bcm_cos_queue_t cosq, 302 uint32 min_quantum, uint32 max_quantum, 303 uint32 burst_quantum, uint32 flags); 304 305 extern int bcm_td3_cosq_port_attach(int unit, bcm_port_t port); 306 extern int bcm_td3_cosq_port_detach(int unit, bcm_port_t port); 307 308 extern int 309 bcm_td3_rx_queue_channel_set_test(int unit, bcm_cos_queue_t queue_id, 310 bcm_rx_chan_t chan_id); 311 312 extern int 313 bcm_td3_egr_mpls_combo_map_default(uint32 unit); 314 315 extern int 316 bcm_td3_egr_mpls_combo_map_create(uint32 unit, 317 int *egr_mpls_combo_map_created, 318 soc_profile_mem_t **egr_mpls_combo_map); 319 320 extern int 321 bcm_td3_egr_mpls_combo_dump(uint32 unit, 322 soc_profile_mem_t *profile); 323 324 extern void 325 bcm_td3_egr_mpls_combo_map_info_init(uint32 unit); 326 327 extern int 328 bcm_td3_qos_map_create(uint32 unit, uint32 *index, int entry_per_index); 329 330 extern int bcm_td3_cosq_control_set(int unit, bcm_gport_t gport, 331 bcm_cos_queue_t cosq, 332 bcm_cosq_control_t type, int arg); 333 extern int bcm_td3_cosq_control_get(int unit, bcm_gport_t gport, 334 bcm_cos_queue_t cosq, 335 bcm_cosq_control_t type, int *arg); 336 extern int 337 _bcm_td3_cosq_index_resolve(int unit, bcm_port_t port, 338 bcm_cos_queue_t cosq, _bcm_td3_cosq_index_style_t style, 339 bcm_port_t *local_port, int *index, int *count); 340 341 extern int 342 bcm_td3_cosq_bst_profile_set(int unit, 343 bcm_gport_t port, 344 bcm_cos_queue_t cosq, 345 bcm_bst_stat_id_t bid, 346 bcm_cosq_bst_profile_t *profile); 347 348 extern int 349 bcm_td3_cosq_bst_profile_get(int unit, 350 bcm_gport_t port, 351 bcm_cos_queue_t cosq, 352 bcm_bst_stat_id_t bid, 353 bcm_cosq_bst_profile_t *profile); 354 355 extern int 356 bcm_td3_cosq_bst_stat_get(int unit, 357 bcm_gport_t port, 358 bcm_cos_queue_t cosq, 359 bcm_bst_stat_id_t bid, 360 uint32 options, 361 uint64 *pvalue); 362 363 extern int 364 bcm_td3_cosq_bst_stat_multi_get(int unit, 365 bcm_gport_t port, 366 bcm_cos_queue_t cosq, 367 uint32 options, 368 int max_values, 369 bcm_bst_stat_id_t *id_list, 370 uint64 *pvalues); 371 372 extern int 373 bcm_td3_cosq_bst_stat_clear(int unit, bcm_gport_t port, 374 bcm_cos_queue_t cosq, bcm_bst_stat_id_t bid); 375 376 extern int bcm_td3_cosq_bst_stat_sync(int unit, bcm_bst_stat_id_t bid); 377 378 extern int 379 _bcm_td3_bst_hdrm_stat_clear(int unit, 380 bcm_gport_t gport, 381 bcm_cos_queue_t cosq); 382 extern int 383 bcm_td3_cosq_buffer_id_multi_get(int unit, bcm_gport_t gport, 384 bcm_cos_queue_t cosq, bcm_cosq_dir_t direction, 385 int array_max, bcm_cosq_buffer_id_t *buf_id_array, 386 int *array_count); 387 388 #if defined (INCLUDE_TCB) && defined (BCM_TCB_SUPPORT) 389 extern int bcm_td3_cosq_tcb_config_get(int unit, bcm_cosq_buffer_id_t buffer_id, 390 bcm_cosq_tcb_config_t *config); 391 extern int bcm_td3_cosq_tcb_config_set(int unit, bcm_cosq_buffer_id_t buffer_id, 392 bcm_cosq_tcb_config_t *config); 393 extern int bcm_td3_cosq_tcb_gport_threshold_mapping_get(int unit, 394 bcm_gport_t gport, bcm_cos_queue_t cosq, 395 bcm_cosq_buffer_id_t buffer_id, int *index); 396 extern int bcm_td3_cosq_tcb_gport_threshold_mapping_set(int unit, 397 bcm_gport_t gport, bcm_cos_queue_t cosq, 398 bcm_cosq_buffer_id_t buffer_id, 399 int index); 400 extern int bcm_td3_cosq_tcb_enable(int unit, bcm_cosq_buffer_id_t buffer_id, 401 int enable); 402 extern int bcm_td3_cosq_tcb_freeze(int unit, bcm_cosq_buffer_id_t buffer_id, 403 int enable); 404 extern int bcm_td3_cosq_tcb_init(int unit); 405 extern int _bcm_td3_cosq_tcb_deinit(int unit); 406 extern int bcm_td3_cosq_tcb_uc_queue_resolve(int unit, bcm_cosq_buffer_id_t buffer_id, 407 int queue, bcm_gport_t *uc_gport); 408 #ifdef BCM_WARM_BOOT_SUPPORT 409 extern int bcm_td3_cosq_tcb_reinit(int unit); 410 #endif 411 #endif 412 413 extern int 414 _bcm_td3_cosq_bst_hdrm_stat_get(int unit, 415 bcm_gport_t gport, 416 bcm_cos_queue_t cosq, 417 uint32 options, 418 uint64 *pvalue); 419 420 extern int 421 bcm_td3_cosq_mapping_set(int unit, bcm_port_t gport, bcm_cos_t priority, 422 bcm_cos_queue_t cosq); 423 424 extern int 425 bcm_td3_cosq_mapping_get(int unit, bcm_port_t gport, bcm_cos_t priority, 426 bcm_cos_queue_t *cosq); 427 428 extern int 429 bcm_td3_cosq_gport_mapping_set(int unit, bcm_port_t ing_port, 430 bcm_cos_t int_pri, uint32 flags, 431 bcm_gport_t gport, bcm_cos_queue_t cosq); 432 433 extern int 434 bcm_td3_cosq_gport_mapping_get(int unit, bcm_port_t ing_port, 435 bcm_cos_t int_pri, uint32 flags, 436 bcm_gport_t *gport, bcm_cos_queue_t *cosq); 437 438 extern int 439 bcm_td3_cosq_port_pfc_op(int unit, bcm_port_t port, 440 bcm_switch_control_t sctype, _bcm_cosq_op_t op, 441 bcm_gport_t *gport, int gport_count); 442 443 extern int 444 bcm_td3_cosq_port_pfc_get(int unit, bcm_port_t port, 445 bcm_switch_control_t sctype, 446 bcm_gport_t *gport, int gport_count, 447 int *actual_gport_count); 448 449 extern int 450 bcm_td3_cosq_pfc_class_mapping_set(int unit, bcm_gport_t port, 451 int array_count, 452 bcm_cosq_pfc_class_mapping_t *mapping_array); 453 454 extern int 455 bcm_td3_cosq_pfc_class_mapping_get(int unit, bcm_gport_t port, 456 int array_max, 457 bcm_cosq_pfc_class_mapping_t *mapping_array, 458 int *array_count); 459 460 extern int 461 _bcm_td3_port_enqueue_set(int unit, bcm_port_t gport, int enable); 462 extern int 463 _bcm_td3_port_enqueue_get(int unit, bcm_port_t gport, int *enable); 464 465 extern int 466 _bcm_td3_port_enable_get(int unit, bcm_port_t gport, int *enable); 467 468 /* OOB support */ 469 /* OOB FC Tx side global configuration API */ 470 extern int bcm_td3_oob_fc_tx_config_set( 471 int unit, 472 bcm_oob_fc_tx_config_t *config); 473 474 /* OOB FC Tx side global configuration get API */ 475 extern int bcm_td3_oob_fc_tx_config_get( 476 int unit, 477 bcm_oob_fc_tx_config_t *config); 478 479 extern int 480 _bcm_td3_oob_fc_tx_port_control_set(int unit, bcm_port_t port, 481 int status, int dir); 482 extern int 483 _bcm_td3_oob_fc_tx_port_control_get(int unit, bcm_port_t port, 484 int *status, int dir); 485 486 /* OOB FC Tx side global info get API */ 487 extern int bcm_td3_oob_fc_tx_info_get( 488 int unit, 489 bcm_oob_fc_tx_info_t *info); 490 491 /* 492 * OOB FC Rx Interface side Traffic Class to Priority Mapping Multi Set 493 * API 494 */ 495 extern int bcm_td3_oob_fc_rx_port_tc_mapping_multi_set( 496 int unit, 497 bcm_oob_fc_rx_intf_id_t intf_id, 498 bcm_gport_t gport, 499 int array_count, 500 uint32 *tc, 501 uint32 *pri_bmp); 502 503 /* 504 * OOB FC Rx Interface side Traffic Class to Priority Mapping Multi Get 505 * API 506 */ 507 extern int bcm_td3_oob_fc_rx_port_tc_mapping_multi_get( 508 int unit, 509 bcm_oob_fc_rx_intf_id_t intf_id, 510 bcm_gport_t gport, 511 int array_max, 512 uint32 *tc, 513 uint32 *pri_bmp, 514 int *array_count); 515 516 /* OOB FC Rx Interface side Traffic Class to Priority Mapping set API */ 517 extern int bcm_td3_oob_fc_rx_port_tc_mapping_set( 518 int unit, 519 bcm_oob_fc_rx_intf_id_t intf_id, 520 bcm_gport_t gport, 521 uint32 tc, 522 uint32 pri_bmp); 523 524 /* OOB FC Rx Interface side Traffic Class to Priority Mapping get API */ 525 extern int bcm_td3_oob_fc_rx_port_tc_mapping_get( 526 int unit, 527 bcm_oob_fc_rx_intf_id_t intf_id, 528 bcm_gport_t gport, 529 uint32 tc, 530 uint32 *pri_bmp); 531 532 /* OOB FC Rx Interface side Configuration set API */ 533 extern int bcm_td3_oob_fc_rx_config_set( 534 int unit, 535 bcm_oob_fc_rx_intf_id_t intf_id, 536 bcm_oob_fc_rx_config_t *config, 537 int array_count, 538 bcm_gport_t *gport_array); 539 540 /* OOB FC Rx Interface side Configuration get API */ 541 extern int bcm_td3_oob_fc_rx_config_get( 542 int unit, 543 bcm_oob_fc_rx_intf_id_t intf_id, 544 bcm_oob_fc_rx_config_t *config, 545 int array_max, 546 bcm_gport_t *gport_array, 547 int *array_count); 548 549 /* OOB FC Rx Interface side Channel offset value for a port */ 550 extern int bcm_td3_oob_fc_rx_port_offset_get( 551 int unit, 552 bcm_oob_fc_rx_intf_id_t intf_id, 553 bcm_gport_t gport, 554 uint32 *offset); 555 556 /* OOB STATS global configuration set API */ 557 extern int bcm_td3_oob_stats_config_set( 558 int unit, 559 bcm_oob_stats_config_t *config); 560 561 /* OOB STATS global configuration get API */ 562 extern int bcm_td3_oob_stats_config_get( 563 int unit, 564 bcm_oob_stats_config_t *config); 565 566 567 /* OOB STATS configuration of service pool list multi set API */ 568 extern int bcm_td3_oob_stats_pool_mapping_multi_set( 569 int unit, 570 int array_count, 571 int *offset_array, 572 uint8 *dir_array, 573 bcm_service_pool_id_t *pool_array); 574 575 /* OOB STATS configuration of service pool list multi get API */ 576 extern int bcm_td3_oob_stats_pool_mapping_multi_get( 577 int unit, 578 int array_max, 579 int *offset_array, 580 uint8 *dir_array, 581 bcm_service_pool_id_t *pool_array, 582 int *array_count); 583 584 /* OOB STATS configuration of service pool list set API */ 585 extern int bcm_td3_oob_stats_pool_mapping_set( 586 int unit, 587 int offset, 588 uint8 dir, 589 bcm_service_pool_id_t pool); 590 591 /* OOB STATS configuration of service pool list get API */ 592 extern int bcm_td3_oob_stats_pool_mapping_get( 593 int unit, 594 int offset, 595 uint8 *dir, 596 bcm_service_pool_id_t *pool); 597 598 /* OOB STATS configuration of Queue list set API */ 599 extern int bcm_td3_oob_stats_queue_mapping_multi_set( 600 int unit, 601 int array_count, 602 int *offset_array, 603 bcm_gport_t *gport_array); 604 605 /* OOB STATS configuration of Queue list get API */ 606 extern int bcm_td3_oob_stats_queue_mapping_multi_get( 607 int unit, 608 int array_max, 609 int *offset_array, 610 bcm_gport_t *gport_array, 611 int *array_count); 612 613 /* OOB STATS configuration of Queue list set API */ 614 extern int bcm_td3_oob_stats_queue_mapping_set( 615 int unit, 616 int offset, 617 bcm_gport_t gport); 618 619 /* OOB STATS configuration of Queue list get API */ 620 extern int bcm_td3_oob_stats_queue_mapping_get( 621 int unit, 622 int offset, 623 bcm_gport_t *gport); 624 625 626 627 /* 628 * 8 Priority Groups supported. 629 */ 630 #define TD3_PRIOROTY_GROUP_ID_MIN 0 631 #define TD3_PRIOROTY_GROUP_ID_MAX 7 632 /* 633 * Inpur priority range. 634 * PFC : 0-7 635 * SAFC : 0-15 636 */ 637 #define TD3_PFC_INPUT_PRIORITY_MIN 0 638 #define TD3_PFC_INPUT_PRIORITY_MAX 7 639 #define TD3_SAFC_INPUT_PRIORITY_MIN TD3_PFC_INPUT_PRIORITY_MIN 640 #define TD3_SAFC_INPUT_PRIORITY_MAX 15 641 642 extern int 643 bcm_td3_port_priority_group_mapping_set(int unit, bcm_gport_t gport, 644 int prio, int priority_group); 645 extern int 646 bcm_td3_port_priority_group_mapping_get(int unit, bcm_gport_t gport, 647 int prio, int *priority_group); 648 extern int 649 bcm_td3_port_priority_group_config_set(int unit, bcm_gport_t gport, 650 int priority_group, bcm_port_priority_group_config_t *prigrp_config); 651 extern int 652 bcm_td3_port_priority_group_config_get(int unit, bcm_gport_t gport, 653 int priority_group, bcm_port_priority_group_config_t *prigrp_config); 654 extern int 655 _bcm_td3_cosq_inv_mapping_get(int unit, bcm_gport_t gport, 656 bcm_cos_queue_t cosq, 657 uint32 flags, bcm_port_t *ing_port, 658 bcm_cos_t *priority); 659 660 /* pfc deadlock */ 661 #define TD3_PFC_DEADLOCK_MAX_COS 10 662 663 /* Below structure to contain register/field name specific to chip */ 664 typedef struct _bcm_td3_pfc_hw_resorces_s { 665 soc_reg_t timer_count[TD3_PFC_DEADLOCK_MAX_COS]; 666 soc_reg_t timer_status[TD3_PFC_DEADLOCK_MAX_COS]; 667 soc_reg_t timer_mask[TD3_PFC_DEADLOCK_MAX_COS]; 668 soc_reg_t timer_en[TD3_PFC_DEADLOCK_MAX_COS]; 669 soc_reg_t chip_config[3]; 670 soc_reg_t port_config; 671 soc_field_t cos_field[TD3_PFC_DEADLOCK_MAX_COS]; 672 soc_field_t time_init_val[TD3_PFC_DEADLOCK_MAX_COS]; 673 soc_field_t time_unit_field; 674 soc_field_t recovery_action_field; 675 soc_field_t deadlock_status_field; 676 } _bcm_td3_pfc_hw_resorces_t; 677 678 typedef struct _bcm_td3_pfc_deadlock_control_s { 679 uint8 pfc_deadlock_cos_max; /* Max COS supported for PFC Deadlock 680 * Detection and Recovery */ 681 uint8 pfc_deadlock_cos_used; /* Total COS configured for PFC Deadlock 682 * Detection and Recovery */ 683 uint8 hw_cos_idx_inuse[TD3_PFC_DEADLOCK_MAX_COS]; /* Boolean for used Cos indices */ 684 uint8 cb_enabled; /* Indicator if CB is enabled */ 685 bcm_switch_pfc_deadlock_detection_interval_t time_unit; /* 0 - 100ms, 686 * 1 - 10ms */ 687 uint32 cb_interval; /* CB interval duration */ 688 bcm_cos_t pfc_pri2cos[TD3_PFC_DEADLOCK_MAX_COS]; /* Mapping to reduce run-time 689 * computation */ 690 bcm_cos_t pfc_cos2pri[TD3_PFC_DEADLOCK_MAX_COS]; /* Mapping to reduce run-time 691 * computation */ 692 _bcm_pfc_deadlock_config_t cos_config[TD3_PFC_DEADLOCK_MAX_COS]; 693 _bcm_td3_pfc_hw_resorces_t hw_regs_fields; 694 bcm_switch_pfc_deadlock_action_t recovery_action; 695 uint32 cb_count; /* Debug ctr to keep track of #times CB fn is called */ 696 _bcm_cosq_inv_mapping_get_f cosq_inv_mapping_get; /* Function to retrieve 697 * Port/Priority from a 698 * given Gport */ 699 } _bcm_td3_pfc_deadlock_control_t; 700 701 #define _BCM_TD3_PFC_DEADLOCK_HW_RES_INIT(deadlock_hw) \ 702 do { \ 703 int i = 0; \ 704 for (i = 0; i < TD3_PFC_DEADLOCK_MAX_COS; i++) { \ 705 (deadlock_hw)->timer_count[i] = (INVALIDr); \ 706 (deadlock_hw)->timer_status[i] = (INVALIDr); \ 707 (deadlock_hw)->timer_mask[i] = (INVALIDr); \ 708 (deadlock_hw)->timer_en[i] = (INVALIDr); \ 709 (deadlock_hw)->cos_field[i] = (INVALIDf); \ 710 (deadlock_hw)->time_init_val[i] = (INVALIDf); \ 711 } \ 712 (deadlock_hw)->port_config = (INVALIDr); \ 713 (deadlock_hw)->chip_config[0] = (INVALIDr); \ 714 (deadlock_hw)->chip_config[1] = (INVALIDr); \ 715 (deadlock_hw)->time_unit_field = (INVALIDf); \ 716 (deadlock_hw)->recovery_action_field = (INVALIDf); \ 717 (deadlock_hw)->deadlock_status_field = (INVALIDf); \ 718 } while(0); 719 720 #define _BCM_TD3_UNIT_PFC_DEADLOCK_CONTROL(u) _bcm_td3_pfc_deadlock_control[(u)] 721 #define _BCM_TD3_PFC_DEADLOCK_CONFIG(u,cos) \ 722 (&((_bcm_td3_pfc_deadlock_control[(u)])->cos_config[(cos)])) 723 #define _BCM_TD3_PFC_DEADLOCK_COS_ENABLED(u,cos) \ 724 ((((_bcm_td3_pfc_deadlock_control[(u)])->cos_config[(cos)].flags) & \ 725 _BCM_PFC_DEADLOCK_F_ENABLE) ? TRUE : FALSE) 726 #define _BCM_TD3_PFC_DEADLOCK_CB_INTERVAL(u) \ 727 ((_bcm_td3_pfc_deadlock_control[(u)])->cb_interval) 728 #define _BCM_TD3_PFC_DEADLOCK_CB_ENABLED(u) \ 729 (((_bcm_td3_pfc_deadlock_control[(u)])->cb_enabled) ? (TRUE) :(FALSE)) 730 #define _BCM_TD3_PFC_DEADLOCK_CB_COUNT(u) \ 731 ((_bcm_td3_pfc_deadlock_control[(u)])->cb_count) 732 #define _BCM_TD3_PFC_DEADLOCK_TIME_UNIT(u) \ 733 ((_bcm_td3_pfc_deadlock_control[(u)])->time_unit) 734 #define _BCM_TD3_PFC_DEADLOCK_RECOVERY_ACTION(u) \ 735 ((_bcm_td3_pfc_deadlock_control[(u)])->recovery_action) 736 737 extern _bcm_td3_pfc_deadlock_control_t *_bcm_td3_pfc_deadlock_control[BCM_MAX_NUM_UNITS]; 738 739 extern int _bcm_td3_pfc_deadlock_recovery_reset(int unit); 740 741 extern int 742 _bcm_td3_pfc_deadlock_control_set(int unit, bcm_switch_control_t type, int arg); 743 744 extern int 745 _bcm_td3_pfc_deadlock_control_get(int unit, bcm_switch_control_t type, int *arg); 746 747 extern int _bcm_td3_pfc_deadlock_init(int unit); 748 extern int _bcm_td3_pfc_deadlock_hw_res_init(int unit); 749 extern int bcm_td3_pfc_deadlock_recovery_start(int unit, 750 bcm_port_t port, int pri); 751 extern int bcm_td3_pfc_deadlock_recovery_exit(int unit, 752 bcm_port_t port, int pri); 753 754 extern int _bcm_td3_pfc_deadlock_deinit(int unit); 755 extern int _bcm_td3_pfc_deadlock_reinit(int unit); 756 757 extern int 758 _bcm_td3_pfc_deadlock_hw_cos_index_get(int unit, 759 bcm_cos_t priority, 760 int *hw_cos_index); 761 extern int 762 _bcm_td3_pfc_deadlock_hw_cos_index_set(int unit, 763 bcm_cos_t priority, 764 int *hw_cos_index); 765 extern int 766 _bcm_td3_pfc_deadlock_chip_config_get(int unit, 767 bcm_cos_t priority, 768 soc_reg_t* chip_config); 769 extern int 770 _bcm_td3_pfc_deadlock_hw_oper(int unit, 771 _bcm_pfc_deadlock_oper_t operation, 772 bcm_cos_t priority, 773 _bcm_pfc_deadlock_config_t *config); 774 extern int 775 _bcm_td3_pfc_deadlock_q_config_helper(int unit, 776 _bcm_pfc_deadlock_oper_t operation, 777 bcm_gport_t gport, 778 bcm_cosq_pfc_deadlock_queue_config_t *config, 779 uint8 *enable_status); 780 extern int 781 bcm_td3_pfc_deadlock_ignore_pfc_xoff_gen(int unit, int priority, 782 bcm_port_t port, uint32 *rval32); 783 extern int 784 _bcm_td3_pfc_deadlock_recovery_end(int unit, int cos, bcm_port_t port); 785 extern int 786 _bcm_td3_pfc_deadlock_monitor(int unit); 787 788 extern int 789 bcm_td3_cosq_port_pps_set(int unit, bcm_port_t port, bcm_cos_queue_t cosq, 790 int pps); 791 792 extern int 793 bcm_td3_cosq_port_pps_get(int unit, bcm_port_t port, bcm_cos_queue_t cosq, 794 int *pps); 795 796 extern int 797 bcm_td3_cosq_port_burst_set(int unit, bcm_port_t port, bcm_cos_queue_t cosq, 798 int burst); 799 800 extern int 801 bcm_td3_cosq_port_burst_get(int unit, bcm_port_t port, bcm_cos_queue_t cosq, 802 int *burst); 803 804 extern int 805 bcm_td3_port_rate_egress_set(int unit, bcm_port_t port, uint32 bandwidth, 806 uint32 burst, uint32 mode); 807 808 extern int 809 bcm_td3_port_rate_egress_get(int unit, bcm_port_t port, uint32 *bandwidth, 810 uint32 *burst, uint32 *mode); 811 812 extern int 813 bcm_td3_port_drain_cells(int unit, int port); 814 815 extern int 816 bcm_td3_cosq_cpu_cosq_enable_set(int unit, bcm_cos_queue_t cosq, int enable); 817 818 extern int 819 bcm_td3_cosq_cpu_cosq_enable_get(int unit, bcm_cos_queue_t cosq, 820 int *enable); 821 822 extern int 823 bcm_td3_cosq_field_classifier_get(int unit, int classifier_id, 824 bcm_cosq_classifier_t *classifier); 825 826 extern int 827 bcm_td3_cosq_field_classifier_id_create(int unit, bcm_cosq_classifier_t 828 *classifier, int *classifier_id); 829 830 extern int 831 bcm_td3_cosq_field_classifier_id_destroy(int unit, int classifier_id); 832 833 extern int 834 bcm_td3_cosq_field_classifier_map_set(int unit, int classifier_id, int count, 835 bcm_cos_t *priority_array, bcm_cos_queue_t *cosq_array); 836 837 extern int 838 bcm_td3_cosq_field_classifier_map_get(int unit, int classifier_id,int array_max, 839 bcm_cos_t *priority_array, bcm_cos_queue_t *cosq_array, int *array_count); 840 841 extern int 842 bcm_td3_cosq_field_classifier_map_clear(int unit, int classifier_id); 843 844 extern int 845 bcm_td3_cosq_safc_class_mapping_set(int unit, bcm_gport_t port, int array_count, 846 bcm_cosq_safc_class_mapping_t *mapping_array); 847 848 extern int 849 bcm_td3_cosq_safc_class_mapping_get(int unit, bcm_gport_t port, int array_max, 850 bcm_cosq_safc_class_mapping_t *mapping_array, 851 int *array_count); 852 853 /* Subport functions */ 854 extern int bcm_td3_subport_coe_init(int unit); 855 #if defined(INCLUDE_L3) 856 /* L3 ECMP DLB */ 857 extern void _bcm_td3_ecmp_dlb_deinit(int unit); 858 extern int _bcm_td3_ecmp_dlb_init(int unit); 859 extern int bcm_td3_l3_egress_dlb_attr_set(int unit, int nh_index, 860 bcm_l3_egress_t *egr); 861 extern int bcm_td3_l3_egress_dlb_attr_destroy(int unit, int nh_index); 862 extern int bcm_td3_l3_egress_dlb_attr_get(int unit, int nh_index, 863 bcm_l3_egress_t *egr); 864 extern int bcm_td3_l3_egress_ecmp_dlb_create(int unit, 865 bcm_l3_egress_ecmp_t *ecmp, int intf_count, bcm_if_t *intf_array); 866 extern int bcm_td3_l3_egress_ecmp_dlb_destroy(int unit, 867 bcm_if_t mpintf); 868 extern int bcm_td3_l3_egress_ecmp_dlb_get(int unit, 869 bcm_l3_egress_ecmp_t *ecmp); 870 extern int bcm_td3_l3_egress_dlb_attr_get(int unit, int nh_index, bcm_l3_egress_t *egr); 871 extern int bcm_td3_l3_egress_ecmp_dlb_ethertype_set( 872 int unit, uint32 flags, int ethertype_count, int *ethertype_array); 873 874 extern int bcm_td3_l3_egress_ecmp_dlb_ethertype_get(int unit, 875 uint32 *flags, int ethertype_max, int *ethertype_array, int *ethertype_count); 876 877 extern int _bcm_td3_ecmp_dlb_config_set(int unit, bcm_switch_control_t type, 878 int arg); 879 extern int _bcm_td3_ecmp_dlb_config_get(int unit, bcm_switch_control_t type, 880 int *arg); 881 extern void bcm_td3_ecmp_dlb_sw_dump(int unit); 882 extern int 883 bcm_td3_l3_conflict_get(int unit, bcm_l3_key_t *ipkey, bcm_l3_key_t *cf_array, 884 int cf_max, int *cf_count); 885 extern int 886 bcm_td3_ipmc_egr_nh_mac_da_profile_entry_delete(int unit, int nh_idx); 887 888 #ifdef SOC_L3_ECMP_PROTECTED_ACCESS_SUPPORT 889 extern int 890 bcm_td3x_l3_ecmp_protected_grp_get(int unit, 891 int ecmp_grp, 892 int ecmp_group_size, 893 int *nh_idx); 894 extern int 895 bcm_td3x_l3_ecmp_protected_grp_add(int unit, 896 int ecmp_grp, 897 void *buf, 898 void *info); 899 extern int 900 bcm_td3x_l3_ecmp_protected_grp_del(int unit, 901 int ecmp_grp, 902 void *info); 903 904 extern int 905 bcm_td3x_l3_ecmp_free_idx_get(int unit, 906 soc_esw_ecmp_bank_lkup_level_t level, 907 int count, 908 int *free_idx); 909 #endif /* SOC_L3_ECMP_PROTECTED_ACCESS_SUPPORT */ 910 911 extern int _bcm_td3_l3_ecmp_group_info_get(int unit, 912 bcm_l3_ecmp_group_info_t *l3_ecmp_group_info); 913 914 extern int 915 bcm_td3_failover_alloc(int unit); 916 extern int 917 bcm_td3_failover_reinit(int unit); 918 extern int 919 bcm_td3_failover_sync(int unit); 920 /* TD3 v6 reserved multicast */ 921 extern int 922 _bcm_td3_ipv6_reserved_multicast_addr_multi_set(int unit, 923 int inner, 924 int index, 925 bcm_ip6_t ip6_addr, 926 bcm_ip6_t ip6_mask); 927 extern int 928 _bcm_td3_ipv6_reserved_multicast_addr_multi_get(int unit, 929 int inner, 930 int index, 931 bcm_ip6_t *ip6_addr, 932 bcm_ip6_t *ip6_mask); 933 #endif /* INCLUDE_L3 */ 934 935 #if defined(INCLUDE_L3) 936 extern int _bcm_td3_flow_port_resolve( 937 int unit, 938 bcm_gport_t flow_port_id, 939 bcm_if_t encap_id, 940 bcm_module_t *modid, 941 bcm_port_t *port, 942 bcm_trunk_t *trunk_id, 943 int *id); 944 945 extern int _bcm_td3_l3_flex_nh_add( 946 int unit, 947 int idx, 948 bcm_l3_egress_t *nh_entry, 949 uint32 *egr_nh, 950 int ipmc); 951 952 extern int _bcm_td3_l3_flex_nh_entry_parse( 953 int unit, 954 uint32 *egr_entry_ptr, 955 uint32 index, 956 bcm_l3_egress_t *nh_entry); 957 958 extern int _bcm_td3_flow_next_hop_set( 959 int unit, 960 int nh_index, 961 uint32 flags, 962 int vp, 963 int drop); 964 965 extern int _bcm_td3_flow_egress_reset( 966 int unit, 967 int nh_index); 968 969 extern int _bcm_td3_flow_egress_get( 970 int unit, 971 bcm_l3_egress_t *egr, 972 int nh_index); 973 974 extern int _bcm_td3_l3_flex_intf_add( 975 int unit, 976 _bcm_l3_intf_cfg_t *intf_info, 977 uint32 *l3_if_entry_p); 978 979 extern int _bcm_td3_l3_flex_intf_profile_delete( 980 int unit, 981 int ifindex); 982 983 extern int _bcm_td3_l3_flex_intf_get( 984 int unit, 985 _bcm_l3_intf_cfg_t *intf_info, 986 uint32 *l3_if_entry_p); 987 988 extern int _bcm_td3_l3_flex_entry_get( 989 int unit, 990 _bcm_l3_cfg_t *l3cfg, 991 int *nh_idx, 992 int *embd); 993 994 extern int _bcm_td3_l3_flex_ent_parse( 995 int unit, 996 soc_mem_t mem, 997 _bcm_l3_cfg_t *l3cfg, 998 int *nh_idx, 999 void *l3x_entry); 1000 1001 extern int _bcm_td3_l3_flex_entry_add( 1002 int unit, 1003 _bcm_l3_cfg_t *l3cfg, 1004 int nh_idx); 1005 1006 extern int _bcm_td3_l3_flex_entry_del( 1007 int unit, 1008 _bcm_l3_cfg_t *l3cfg); 1009 1010 extern int _bcm_td3_l3_flex_entry_flags_cmp( 1011 int unit, 1012 int req_flags, 1013 int ent_flags, 1014 int *idx); 1015 1016 extern int _bcm_td3_lpm_flex_ent_init( 1017 int unit, 1018 _bcm_defip_cfg_t *lpm_cfg, 1019 uint32 *lpm_entry); 1020 1021 extern int _bcm_td3_lpm_prepare_flex_defip_entry( 1022 int unit, 1023 _bcm_defip_cfg_t *lpm_cfg, 1024 int nh_ecmp_idx, 1025 uint32 *lpm_entry); 1026 1027 extern int _bcm_td3_lpm_flex_ent_get_key( 1028 int unit, 1029 _bcm_defip_cfg_t *lpm_cfg, 1030 uint32 *lpm_entry, 1031 uint32 key_type); 1032 1033 extern int _bcm_td3_lpm_flex_ent_parse( 1034 int unit, 1035 uint32 *lpm_entry, 1036 uint32 key_type, 1037 soc_mem_t mem, 1038 _bcm_defip_cfg_t *lpm_cfg, 1039 int *nh_idx); 1040 1041 extern int _bcm_defip_pair128_flex_get_key( 1042 int unit, 1043 uint32 *hw_entry, 1044 _bcm_defip_cfg_t *lpm_cfg, 1045 uint32 key_type); 1046 1047 extern int _bcm_l3_defip_pair128_flex_add( 1048 int unit, 1049 _bcm_defip_cfg_t *lpm_cfg, 1050 int nh_ecmp_idx, 1051 uint32 *hw_entry); 1052 1053 extern int _bcm_td3_mpls_gre_label_add( 1054 int unit, 1055 bcm_l3_egress_t *egr, 1056 int nh_index, 1057 uint32 flags); 1058 1059 extern int _bcm_td3_mpls_gre_label_get( 1060 int unit, 1061 int vc_swap_index, 1062 bcm_l3_egress_t *egr); 1063 1064 extern int _bcm_td3_mpls_gre_label_delete( 1065 int unit, 1066 int index, 1067 soc_mem_t view_id); 1068 1069 extern int 1070 _bcm_td3_lpm_ipv6mc_ent_init( 1071 int unit, 1072 _bcm_defip_cfg_t *lpm_cfg, 1073 uint32 *lpm_entry); 1074 1075 extern void 1076 _bcm_td3_mem_ip6mc_defip_get( 1077 int unit, 1078 const void *lpm_key, 1079 _bcm_defip_cfg_t *lpm_cfg); 1080 1081 extern void 1082 _bcm_td3_mem_ip6mc_defip_set( 1083 int unit, 1084 void *lpm_key, 1085 _bcm_defip_cfg_t *lpm_cfg); 1086 1087 extern void 1088 _bcm_td3_lpm_pair128_ipv6mc_ent_init( 1089 int unit, 1090 _bcm_defip_cfg_t *lpm_cfg, 1091 uint32 *lpm_entry); 1092 1093 #ifdef BCM_WARM_BOOT_SUPPORT 1094 extern int _bcm_td3_l3_repl_l3_intf_recover( 1095 int unit); 1096 extern int _bcm_td3_flex_egrnh_tpid_recover( 1097 int unit, egr_l3_next_hop_entry_t *egr_nh); 1098 #endif 1099 1100 #endif /* INCLUDE_L3 */ 1101 1102 extern int _bcm_td3_flex_l2_from_l2x( 1103 int unit, 1104 bcm_l2_addr_t *l2addr, 1105 l2x_entry_t *l2x_entry, 1106 int *mb_index); 1107 1108 extern int _bcm_td3_flex_l2_to_l2x( 1109 int unit, 1110 l2x_entry_t *l2x_entry, 1111 bcm_l2_addr_t *l2addr, 1112 int key_only); 1113 1114 extern int _bcm_td3_flex_l2_replace_data_mask_setup( 1115 int unit, 1116 _bcm_l2_replace_t *rep); 1117 1118 extern int _bcm_td3_flex_l2_bulk_replace_modport( 1119 int unit, 1120 _bcm_l2_replace_t *rep_st); 1121 1122 extern int 1123 bcm_td3_cosq_stat_set(int unit, bcm_gport_t port, 1124 bcm_cos_queue_t cosq, 1125 bcm_cosq_stat_t stat, uint64 value); 1126 extern int 1127 bcm_td3_cosq_stat_get(int unit, bcm_gport_t port, 1128 bcm_cos_queue_t cosq, 1129 bcm_cosq_stat_t stat, int sync_mode, 1130 uint64 *value); 1131 extern int bcmi_td3_port_fn_drv_init(int unit); 1132 extern int bcmi_td3_port_soc_resource_init(int unit, int nport, 1133 bcm_port_resource_t *resource, 1134 soc_port_resource_t *soc_resource); 1135 extern int bcmi_td3_port_resource_validate(int unit, 1136 soc_port_schedule_state_t *port_schedule_state); 1137 extern int bcmi_td3_pre_flexport_tdm(int unit, 1138 soc_port_schedule_state_t *port_schedule_state); 1139 extern int bcmi_td3_post_flexport_tdm(int unit, 1140 soc_port_schedule_state_t *port_schedule_state); 1141 1142 extern int bcmi_td3_port_cosmap_update(int unit, pbmp_t pbmp, int enable); 1143 1144 extern int bcmi_td3_clport_update(int unit, 1145 soc_port_schedule_state_t *port_schedule_state); 1146 extern int bcmi_td3_port_attach_mmu(int unit, int port); 1147 extern int bcmi_td3_port_detach_asf(int unit, bcm_port_t port); 1148 extern int bcmi_td3_port_enable(int unit, 1149 soc_port_schedule_state_t *port_schedule_state); 1150 extern int bcmi_td3_port_disable(int unit, 1151 soc_port_schedule_state_t *port_schedule_state); 1152 extern int bcmi_td3_port_speed_1g_update(int unit, bcm_port_t port, int speed); 1153 extern int bcmi_td3_speed_ability_get(int unit, bcm_port_t port, 1154 bcm_port_abil_t *mask); 1155 extern int bcmi_td3_speed_mix_validate(int unit, uint32 speed_mask); 1156 extern void bcm_td3_pstats_deinit(int unit); 1157 extern int bcm_td3_pstats_init(int unit); 1158 extern int bcmi_td3_port_detach_stack(int unit, bcm_port_t port); 1159 extern int bcmi_td3_port_attach_stack(int unit, bcm_port_t port); 1160 extern void _bcmi_td3_init_condition_set(int unit, 1161 bcmi_xgs5_dev_info_t *dev_info); 1162 extern int bcmi_td3_port_attach_l3(int unit, bcm_port_t port); 1163 extern int bcmi_td3_port_detach_l3(int unit, bcm_port_t port); 1164 1165 extern void bcm_td3_cosq_sw_dump(int unit); 1166 #ifdef BCM_WARM_BOOT_SUPPORT 1167 extern int bcm_td3_cosq_sync(int unit); 1168 #endif /* BCM_WARM_BOOT_SUPPORT */ 1169 1170 /* RIOT related defines */ 1171 1172 #ifdef BCM_RIOT_SUPPORT 1173 1174 1175 /* TD3 : EGR_L3_NEXT_HOP-KEY_TYPEf */ 1176 #define BCMI_TD3_L3_EGR_NH_MCAST_ENTRY_TYPE 7 1177 #define BCMI_TD3_L3_EGR_NH_SD_TAG_ENTRY_TYPE 2 1178 1179 1180 /* L3 interface banks values */ 1181 #define BCMI_TD3_L3_INTF_ENT_PER_BANK 2048 1182 #define BCMI_TD3_L3_INTF_BANKS_MAX 8 1183 1184 /* L3 next hop banks values */ 1185 #define BCMI_TD3_L3_NH_ENT_PER_BANK 4096 1186 #define BCMI_TD3_L3_NH_BANKS_MAX 16 1187 1188 1189 /* NH destination encodings, masks and macros */ 1190 #define BCMI_TD3_L3_NH_DEST_DGLP_SHIFT 16 1191 #define BCMI_TD3_L3_NH_DEST_DGLP_MASK 0xFFFF /* 15 bits value */ 1192 #define BCMI_TD3_L3_NH_DEST_DGLP_EN_MASK 0x3 /* 2 bits value */ 1193 #define BCMI_TD3_L3_NH_DEST_DGLP_ENCODING 0x0 /* 15 bits value */ 1194 #define BCMI_TD3_L3_NH_DEST_DVP_SHIFT 16 /* 14 bits value */ 1195 #define BCMI_TD3_L3_NH_DEST_DVP_MASK 0xFFFF /* 14 bits value */ 1196 #define BCMI_TD3_L3_NH_DEST_DVP_EN_MASK 0x3 /* 4 bits value */ 1197 #define BCMI_TD3_L3_NH_DEST_DVP_ENCODING 0x1 /* 15 bits value */ 1198 #define BCMI_TD3_L3_NH_DEST_LAG_SHIFT 13 /* 14 bits value */ 1199 #define BCMI_TD3_L3_NH_DEST_LAG_MASK 0x1FFF /* 14 bits value */ 1200 #define BCMI_TD3_L3_NH_DEST_LAG_EN_MASK 0xF /* 4 bits value */ 1201 #define BCMI_TD3_L3_NH_DEST_LAG_ENCODING 0x1 /* 15 bits value */ 1202 1203 1204 #define BCMI_TD3_L3_NH_DEST_DVP_GET(gport) \ 1205 ((BCMI_TD3_L3_NH_DEST_DVP_ENCODING << BCMI_TD3_L3_NH_DEST_DVP_SHIFT) | \ 1206 (gport & BCMI_TD3_L3_NH_DEST_DVP_MASK)) 1207 1208 #define BCMI_TD3_L3_NH_DEST_LAG_GET(gport) \ 1209 ((BCMI_TD3_L3_NH_DEST_LAG_ENCODING << BCMI_TD3_L3_NH_DEST_LAG_SHIFT) | \ 1210 (gport & BCMI_TD3_L3_NH_DEST_LAG_MASK)) 1211 1212 #define BCMI_TD3_L3_NH_DEST_DGLP_GET(gport) \ 1213 ((BCMI_TD3_L3_NH_DEST_DGLP_ENCODING << BCMI_TD3_L3_NH_DEST_DGLP_SHIFT) | \ 1214 (gport & BCMI_TD3_L3_NH_DEST_DGLP_MASK)) 1215 1216 #define BCMI_TD3_L3_NH_DEST_IS_DGLP(_dest) \ 1217 ((((_dest) >> BCMI_TD3_L3_NH_DEST_DGLP_SHIFT) & BCMI_TD3_L3_NH_DEST_DGLP_EN_MASK) == \ 1218 BCMI_TD3_L3_NH_DEST_DGLP_ENCODING) 1219 #define BCMI_TD3_L3_NH_PORT_DGLP_GET(_dest) \ 1220 (((_dest) & BCMI_TD3_L3_NH_DEST_DGLP_MASK)) 1221 1222 #define BCMI_TD3_L3_NH_DEST_IS_LAG(_dest) \ 1223 (BCMI_TD3_L3_NH_DEST_IS_DGLP(_dest) && ((((_dest) >> BCMI_TD3_L3_NH_DEST_LAG_SHIFT) & BCMI_TD3_L3_NH_DEST_LAG_EN_MASK) == \ 1224 BCMI_TD3_L3_NH_DEST_LAG_ENCODING)) 1225 1226 #define BCMI_TD3_L3_NH_PORT_LAG_GET(_dest) \ 1227 (((_dest) & BCMI_TD3_L3_NH_DEST_LAG_MASK)) 1228 1229 #define BCMI_TD3_L3_NH_DEST_IS_DVP(_dest) \ 1230 ((((_dest) >> BCMI_TD3_L3_NH_DEST_DVP_SHIFT) & BCMI_TD3_L3_NH_DEST_DVP_EN_MASK) == \ 1231 BCMI_TD3_L3_NH_DEST_DVP_ENCODING) 1232 1233 #define BCMI_TD3_L3_NH_PORT_DVP_GET(_dest) \ 1234 (((_dest) & BCMI_TD3_L3_NH_DEST_DVP_MASK)) 1235 1236 /* Td3 : EGR_L3_NEXT_HOP-NEXT_PTR field types */ 1237 #define BCMI_TD3_L3_NH_EGR_NEXT_PTR_TYPE_DVP 1 1238 #define BCMI_TD3_L3_NH_EGR_NEXT_PTR_TYPE_NH 2 1239 #define BCMI_TD3_L3_NH_EGR_NEXT_PTR_TYPE_VC_SWAP 3 1240 #define BCMI_TD3_L3_NH_EGR_NEXT_PTR_TYPE_DVP_AND_VC_SWAP 4 1241 1242 #define BCMI_TD3_L3_NH_IFA_DST_PORT_BITS(_ifa2) (_ifa2 ? 8 : 7) 1243 #define BCMI_TD3_L3_NH_IFA_DST_MODID_BITS(_ifa2) (_ifa2 ? 7 : 8) 1244 1245 /* RioT Overlay validity checks */ 1246 #define BCMI_RIOT_IS_ENABLED(_u) \ 1247 ((&_bcm_l3_bk_info[_u])->riot_enable) 1248 1249 #define BCMI_L3_NH_OVERLAY_VALID(_u) \ 1250 ((BCMI_RIOT_IS_ENABLED(_u)) && \ 1251 (((&_bcm_l3_bk_info[_u])->l3_nh_overlay_entries) > 0)) 1252 1253 #define BCMI_L3_INTF_OVERLAY_VALID(_u) \ 1254 ((BCMI_RIOT_IS_ENABLED(_u)) && \ 1255 (((&_bcm_l3_bk_info[_u])->l3_intf_overlay_entries) > 0)) 1256 1257 #define BCMI_RIOT_VPN_VFI_IS_SET(_u, _vid) \ 1258 ((BCMI_RIOT_IS_ENABLED(_u)) && (_BCM_VPN_VFI_IS_SET((_vid)))) 1259 1260 #define BCMI_RIOT_VPN_VFI_IS_NOT_SET(_u, _vid) \ 1261 ((!BCMI_RIOT_IS_ENABLED(_u)) || (!(_BCM_VPN_VFI_IS_SET((_vid))))) 1262 1263 #define BCMI_GPORT_TYPE_GET(_gport) \ 1264 (((_gport) >> _SHR_GPORT_TYPE_SHIFT) & _SHR_GPORT_TYPE_MASK) 1265 1266 #define BCMI_L3_NH_FLEX_VIEW(ent_type) ((ent_type >= 9) && (ent_type != 21)) 1267 #define BCMI_LPM_FLEX_VIEW(ent_type) (ent_type > 1) && (ent_type != 11) && (ent_type != 12) 1268 1269 #define BCMI_LPM_SEPARATE_IPV4MC_KEY_TYPE 11 1270 #define BCMI_LPM_SEPARATE_IPV6MC_KEY_TYPE 12 1271 1272 /* DESTINATION_FORMAT DEST_TYPE encodings */ 1273 #define BCMI_TD3_DEST_TYPE_INVALID 0 1274 #define BCMI_TD3_DEST_TYPE0_DVP 1 1275 #define BCMI_TD3_DEST_TYPE0_DGPP 2 1276 #define BCMI_TD3_DEST_TYPE0_NH 3 1277 #define BCMI_TD3_DEST_TYPE1_ECMP 1 1278 #define BCMI_TD3_DEST_TYPE1_L2MC 2 1279 #define BCMI_TD3_DEST_TYPE1_IPMC 3 1280 #define BCMI_TD3_DEST_TYPE2_LAG 1 1281 1282 #define BCMI_TD3_EGR_L3_NEXTHOP_WIDTH 169 1283 1284 1285 /* TD3 specific routines */ 1286 extern int bcmi_td3_get_port_from_destination(int unit, 1287 uint32 dest, bcm_l3_egress_t *nh); 1288 1289 extern int bcmi_td3_l3_nh_dest_set(int unit, bcm_l3_egress_t *nh_entry, uint32 *nh_dest); 1290 #endif /* BCM_RIOT_SUPPORT */ 1291 1292 #define _BCM_TD3_TPID_ACTION_NONE 0 1293 #define _BCM_TD3_TPID_ACTION_LEGACY 1 1294 #define _BCM_TD3_TPID_ACTION_FROM_TAG 2 1295 #define _BCM_TD3_TPID_ACTION_PRESSERVE 6 1296 1297 #define _BCM_TD3_TPID_ACTION_ENCODE(_action_) \ 1298 ((_action_) == bcmVlanTpidActionNone ? _BCM_TD3_TPID_ACTION_NONE : \ 1299 (_action_) == bcmVlanTpidActionModify ? _BCM_TD3_TPID_ACTION_FROM_TAG : \ 1300 _BCM_TD3_TPID_ACTION_NONE) 1301 1302 #define _BCM_TD3_TPID_ACTION_DECODE(_hw_action_) \ 1303 ((_hw_action_) == _BCM_TD3_TPID_ACTION_NONE ? bcmVlanTpidActionNone : \ 1304 (_hw_action_) == _BCM_TD3_TPID_ACTION_FROM_TAG ? bcmVlanTpidActionModify :\ 1305 bcmVlanTpidActionNone) 1306 1307 #ifdef BCM_SPECIAL_LABEL_SUPPORT 1308 1309 /************************* MPLS related Changes **********************/ 1310 1311 #define BCMI_MPLS_LABEL_ID_MAX (0xfffff) 1312 #define BCMI_MPLS_LABEL_ID_VALID(_label_) \ 1313 ((_label_) <= BCMI_MPLS_LABEL_ID_MAX) 1314 1315 #define BCMI_MPLS_LABEL_MASK_MAX (0xfffff) 1316 #define BCMI_MPLS_LABEL_MASK_VALID(_mask_) \ 1317 (((_mask__) >= 0) && \ 1318 ((_mask_) <= BCMI_MPLS_LABEL_MASK_MAX)) 1319 1320 #define BCMI_MPLS_EXP_MAX (0x7) 1321 #define BCMI_MPLS_EXP_VALID(exp) \ 1322 ((exp) <= BCMI_MPLS_EXP_MAX) 1323 1324 #define BCMI_MPLS_EXP_MASK_MAX (0x7) 1325 #define BCMI_MPLS_EXP_MASK_VALID(_mask_) \ 1326 (((_mask_) >= 0) && \ 1327 ((_mask_) <= BCMI_MPLS_EXP_MASK_MAX)) 1328 1329 #define BCMI_MPLS_TTL_MAX (0xFF) 1330 #define BCMI_MPLS_TTL_VALID(ttl) \ 1331 ((ttl) <= BCMI_MPLS_TTL_MAX) 1332 1333 #define BCMI_MPLS_TTL_MASK_MAX (0xff) 1334 #define BCMI_MPLS_TTL_MASK_VALID(_mask_) \ 1335 (((_mask_) >= 0) && \ 1336 ((_mask_) <= BCMI_MPLS_TTL_MASK_MAX)) 1337 1338 #define BCMI_MPLS_CONSTRUCT_LABEL(val, exp, ttl, bos) \ 1339 (((val) << 12) | ((exp) << 9) | \ 1340 ((bos) << 8) | (ttl)) 1341 1342 #define BCMI_MPLS_LABEL_VAL_FROM_LABEL_GET(mpls_label)\ 1343 (((mpls_label) >> 12) & 0xFFFFF) 1344 1345 #define BCMI_MPLS_EXP_FROM_LABEL_GET(mpls_label) \ 1346 (((mpls_label) >> 9) & 0x7) 1347 1348 #define BCMI_MPLS_BOS_FROM_LABEL_GET(mpls_label) \ 1349 (((mpls_label) >> 8) & 0x1) 1350 1351 #define BCMI_MPLS_TTL_FROM_LABEL_GET(mpls_label) \ 1352 ((mpls_label) & 0xFF) 1353 1354 /***************** Function Decalarations *********************/ 1355 extern int bcmi_mpls_special_label_init(int unit); 1356 extern void bcmi_mpls_special_label_deinit(int unit); 1357 1358 extern int bcmi_mpls_special_label_identifier_add(int unit, 1359 bcm_mpls_special_label_type_t label_type, 1360 bcm_mpls_special_label_t label_info); 1361 extern int bcmi_mpls_special_label_identifier_get(int unit, 1362 bcm_mpls_special_label_type_t label_type, 1363 bcm_mpls_special_label_t *label_info); 1364 extern int bcmi_mpls_special_label_identifier_delete(int unit, 1365 bcm_mpls_special_label_type_t label_type, 1366 bcm_mpls_special_label_t label_info); 1367 extern int bcmi_mpls_special_label_identifier_delete_all(int unit); 1368 extern int bcmi_mpls_special_label_identifier_traverse(int unit, 1369 bcm_mpls_special_label_identifier_traverse_cb cb, 1370 void *user_data); 1371 1372 1373 extern int bcmi_mpls_special_label_egress_add(int unit, 1374 bcm_mpls_special_label_type_t label_type, 1375 bcm_mpls_special_label_t label_info); 1376 extern int bcmi_mpls_special_label_egress_get(int unit, 1377 bcm_mpls_special_label_type_t label_type, 1378 bcm_mpls_special_label_t *label_info); 1379 extern int bcmi_mpls_special_label_egress_delete(int unit, 1380 bcm_mpls_special_label_type_t label_type, 1381 bcm_mpls_special_label_t label_info); 1382 extern int bcmi_mpls_special_label_egress_delete_all(int unit); 1383 extern int bcmi_mpls_special_label_egress_traverse(int unit, 1384 bcm_mpls_special_label_egress_traverse_cb cb, 1385 void *user_data); 1386 1387 extern int bcmi_mpls_special_label_push_action_set(int unit, 1388 bcm_mpls_special_label_push_element_t *element, 1389 bcm_mpls_special_label_push_type_t push_type); 1390 1391 extern int bcmi_mpls_special_label_push_action_get(int unit, 1392 bcm_mpls_special_label_push_element_t *element, 1393 bcm_mpls_special_label_push_type_t *push_type); 1394 1395 extern int _bcm_td3_def_vfi_profile_add(int unit, 1396 int is_eline, uint32 *profile_index); 1397 1398 extern int _bcm_td3_sd_tag_action_profile_get(int unit, 1399 int sd_tag_action_present, int sd_tag_action_not_present, 1400 uint32 *index); 1401 1402 extern int _bcm_td3_sd_tag_action_get(int unit, uint32 index, 1403 int *sd_tag_action_present, 1404 int *sd_tag_action_not_present); 1405 extern int _bcm_td3_def_vlan_profile_get( int unit, uint32 *index); 1406 1407 /***************** Structure Decalarations *********************/ 1408 1409 typedef struct bcmi_mpls_special_label_control_s { 1410 uint32 label_value; 1411 uint32 label_mask; 1412 int label_type; 1413 int valid; 1414 int ref_count; 1415 int cancun_added; 1416 }bcmi_mpls_special_label_control_t; 1417 1418 1419 typedef struct bcmi_mpls_special_label_egress_s { 1420 uint32 entropy_label_ref_count; 1421 uint32 special_label_ref_count; 1422 } bcmi_mpls_special_label_egress_t; 1423 1424 1425 1426 extern bcmi_mpls_special_label_control_t *bcmi_special_label_precedence_state[BCM_MAX_NUM_UNITS]; 1427 extern bcmi_mpls_special_label_egress_t bcmi_special_label_egress_state[BCM_MAX_NUM_UNITS]; 1428 1429 1430 /***************************************************************/ 1431 #endif /*BCM_SPECIAL_LABEL_SUPPORT*/ 1432 1433 extern int bcm_td3_cosq_burst_monitor_dma_config_set(int unit, 1434 uint32 host_mem_size, 1435 uint32 **host_mem_add); 1436 extern int bcm_td3_cosq_burst_monitor_dma_config_get(int unit, 1437 uint32 *host_mem_size, 1438 uint32 **host_mem_add); 1439 extern int bcm_td3_cosq_burst_monitor_set(int unit, int num_gports, 1440 bcm_gport_t *gport_list); 1441 extern int bcm_td3_cosq_burst_monitor_get(int unit, int max_gports, 1442 bcm_gport_t *gport_list, 1443 int *num_gports); 1444 extern int bcm_td3_cosq_burst_monitor_dma_config_reset(int unit); 1445 1446 extern int bcm_td3_qos_reinit(int unit); 1447 1448 extern int bcm_td3_qos_vpn_map_set(int unit, bcm_vpn_t vpn, 1449 int ing_map, int egr_map); 1450 1451 extern int bcm_td3_qos_vpn_map_type_get(int unit, bcm_vpn_t vpn, 1452 uint32 flags, int *map_id); 1453 1454 #if defined(INCLUDE_IFA) 1455 /* IFAv1 module APIs */ 1456 extern int _bcm_td3_ifa_init(int unit, uint8 *success); 1457 extern int _bcm_td3_ifa_detach(int unit); 1458 extern int _bcm_td3_ifa_collector_set(int unit, 1459 uint32 options, 1460 bcm_ifa_collector_info_t *collector_info); 1461 extern int _bcm_td3_ifa_collector_get(int unit, 1462 bcm_ifa_collector_info_t *collector_info); 1463 extern int _bcm_td3_ifa_config_set(int unit, 1464 uint32 options, 1465 bcm_ifa_config_info_t *ifa_config_info); 1466 extern int _bcm_td3_ifa_config_get(int unit, 1467 bcm_ifa_config_info_t *ifa_config_info); 1468 extern int _bcm_td3_ifa_stat_get(int unit, 1469 bcm_ifa_stat_info_t *stat_data); 1470 extern int _bcm_td3_ifa_stat_set(int unit, 1471 bcm_ifa_stat_info_t *stat_data); 1472 extern int _bcm_td3_ifa_sync(int unit); 1473 extern void _bcm_td3_ifa_cc_init(int unit); 1474 extern int _bcm_td3_ifa_cc_config_set(int unit, 1475 bcm_ifa_cc_config_t *config_data); 1476 extern int _bcm_td3_ifa_cc_config_get(int unit, 1477 bcm_ifa_cc_config_t *config_data); 1478 #endif /* INCLUDE_IFA */ 1479 1480 extern int _bcm_td3_field_inports_flex_config_init(int unit, int port); 1481 1482 /* 1483 * OBM Classifier functions. 1484 */ 1485 extern int 1486 bcm_td3_switch_obm_classifier_mapping_multi_set(int unit, bcm_gport_t gport, 1487 bcm_switch_obm_classifier_type_t switch_obm_classifier_type, 1488 int array_count, bcm_switch_obm_classifier_t *switch_obm_classifier); 1489 1490 extern int 1491 bcm_td3_switch_obm_classifier_mapping_multi_get(int unit, bcm_gport_t gport, 1492 bcm_switch_obm_classifier_type_t switch_obm_classifier_type, 1493 int array_max, bcm_switch_obm_classifier_t *switch_obm_classifier, 1494 int *array_count); 1495 1496 extern int 1497 bcm_td3_obm_classifier_port_control_set(int unit, bcm_port_t port, 1498 bcm_port_control_t type, int value); 1499 1500 extern int 1501 bcm_td3_obm_classifier_port_control_get(int unit, bcm_port_t port, 1502 bcm_port_control_t type, int *value); 1503 1504 #endif /* BCM_TRIDENT3_SUPPORT */ 1505 1506 #endif /* !_BCM_INT_TRIDENT3_H_ */