firebolt6.h (62785B)
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: firebolt6.h 8 * Purpose: Function declarations for firebolt6 Internal functions. 9 */ 10 11 #ifndef _BCM_INT_FIREBOLT6_H_ 12 #define _BCM_INT_FIREBOLT6_H_ 13 14 #include <bcm_int/esw/mbcm.h> 15 #include <bcm_int/esw/cosq.h> 16 #include <bcm/oob.h> 17 #include <bcm_int/esw/pfc_deadlock.h> 18 #include <bcm_int/esw/field.h> 19 #include <soc/profile_mem.h> 20 21 #if defined(BCM_FIREBOLT6_SUPPORT) 22 #include <soc/esw/port.h> 23 #include <soc/firebolt6.h> 24 #include <bcm_int/esw/l2.h> 25 #include <bcm_int/esw/trident3.h> 26 27 #define _BCM_MBR_ENCODE_VALUES_NUM 4 28 29 typedef enum { 30 _BCM_FB6_COSQ_INDEX_STYLE_WRED_QUEUE, 31 _BCM_FB6_COSQ_INDEX_STYLE_WRED_PORT, 32 _BCM_FB6_COSQ_INDEX_STYLE_WRED_DEVICE, 33 _BCM_FB6_COSQ_INDEX_STYLE_UCAST_QUEUE, 34 _BCM_FB6_COSQ_INDEX_STYLE_MCAST_QUEUE, 35 _BCM_FB6_COSQ_INDEX_STYLE_EGR_POOL, 36 _BCM_FB6_COSQ_INDEX_STYLE_COS, 37 _BCM_FB6_COSQ_INDEX_STYLE_COUNT, 38 _BCM_FB6_COSQ_INDEX_STYLE_SCHEDULER 39 } _bcm_fb6_cosq_index_style_t; 40 41 extern int bcmi_fb6_port_fn_drv_init(int unit); 42 extern int bcmi_fb6_speed_ability_get(int unit, bcm_port_t port, 43 bcm_port_abil_t *mask); 44 extern int 45 bcm_firebolt6_port_obm_info_get(int unit, bcm_port_t port, 46 int *obm_id, int *lane); 47 /* COSQ Module */ 48 extern int 49 bcm_fb6_cosq_init(int unit); 50 51 52 extern int 53 bcm_fb6_port_param_check(int unit, bcm_port_t port); 54 55 extern int 56 bcm_fb6_cosq_gport_add(int unit, bcm_gport_t port, int numq, 57 uint32 flags, bcm_gport_t *gport); 58 extern int 59 bcm_fb6_cosq_gport_delete(int unit, bcm_gport_t gport); 60 61 extern int 62 bcm_fb6_cosq_gport_attach(int unit, bcm_gport_t input_gport, 63 bcm_gport_t parent_gport, bcm_cos_queue_t cosq); 64 65 extern int 66 bcm_fb6_cosq_gport_detach(int unit, bcm_gport_t input_gport, 67 bcm_gport_t parent_gport, bcm_cos_queue_t cosq); 68 69 extern int 70 bcm_fb6_cosq_gport_attach_get(int unit, bcm_gport_t sched_gport, 71 bcm_gport_t *input_gport, bcm_cos_queue_t *cosq); 72 73 extern int 74 bcm_fb6_cosq_gport_traverse(int unit, bcm_cosq_gport_traverse_cb cb, 75 void *user_data); 76 77 extern int 78 bcm_fb6_cosq_gport_get(int unit, bcm_gport_t gport, bcm_gport_t *port, 79 int *numq, uint32 *flags); 80 81 extern int 82 bcm_fb6_cosq_gport_child_get(int unit, bcm_gport_t in_gport, 83 bcm_cos_queue_t cosq, bcm_gport_t *out_gport); 84 extern int 85 _bcm_fb6_cosq_port_resolve(int unit, bcm_gport_t gport, bcm_module_t *modid, 86 bcm_port_t *port, bcm_trunk_t *trunk_id, int *id, 87 int *qnum); 88 extern int 89 bcm_fb6_rx_queue_channel_set_test(int unit, bcm_cos_queue_t queue_id, 90 bcm_rx_chan_t chan_id); 91 92 extern int 93 bcm_fb6_cosq_gport_traverse_by_port(int unit, bcm_gport_t port, 94 bcm_cosq_gport_traverse_cb cb, 95 void *user_data); 96 97 extern int 98 bcm_fb6_cosq_port_burst_set(int unit, bcm_port_t port, bcm_cos_queue_t cosq, 99 int burst); 100 101 extern int 102 bcm_fb6_cosq_port_burst_get(int unit, bcm_port_t port, bcm_cos_queue_t cosq, 103 int *burst); 104 105 extern int 106 bcm_fb6_cosq_port_pps_set(int unit, bcm_port_t port, bcm_cos_queue_t cosq, 107 int pps); 108 109 extern int 110 bcm_fb6_cosq_port_pps_get(int unit, bcm_port_t port, bcm_cos_queue_t cosq, 111 int *pps); 112 113 extern int 114 _bcm_fb6_cosq_index_resolve(int unit, bcm_port_t port, 115 bcm_cos_queue_t cosq, _bcm_fb6_cosq_index_style_t style, 116 bcm_port_t *local_port, int *index, int *count); 117 extern int 118 bcm_fb6_cosq_sched_weight_max_get(int unit, int mode, int *weight_max); 119 120 extern int 121 bcm_fb6_cosq_gport_sched_get(int unit, bcm_gport_t gport, bcm_cos_queue_t cosq, 122 int *mode, int *weight); 123 124 extern int 125 bcm_fb6_cosq_gport_sched_set(int unit, bcm_gport_t gport, bcm_cos_queue_t cosq, 126 int mode, int weight); 127 128 extern int 129 bcm_fb6_cosq_port_sched_get(int unit, bcm_pbmp_t pbm, int *mode, int *weights, 130 int *delay); 131 132 extern int 133 bcm_fb6_cosq_port_sched_set(int unit, bcm_pbmp_t pbm, int mode, const int 134 *weights, int delay); 135 136 extern int 137 bcm_fb6_cosq_gport_bandwidth_get(int unit, bcm_gport_t gport, 138 bcm_cos_queue_t cosq, uint32 *kbits_sec_min, 139 uint32 *kbits_sec_max, uint32 *flags); 140 141 extern int 142 bcm_fb6_cosq_gport_bandwidth_set(int unit, bcm_gport_t gport, 143 bcm_cos_queue_t cosq, uint32 kbits_sec_min, 144 uint32 kbits_sec_max, uint32 flags); 145 146 extern int 147 bcm_fb6_cosq_port_bandwidth_get(int unit, bcm_port_t port, bcm_cos_queue_t cosq, 148 uint32 *min_quantum, uint32 *max_quantum, 149 uint32 *burst_quantum, uint32 *flags); 150 151 extern int 152 bcm_fb6_cosq_port_bandwidth_set(int unit, bcm_port_t port, bcm_cos_queue_t cosq, 153 uint32 min_quantum, uint32 max_quantum, 154 uint32 burst_quantum, uint32 flags); 155 156 extern int 157 bcm_fb6_cosq_config_get(int unit, int *numq); 158 159 extern int 160 bcm_fb6_cosq_config_set(int unit, int numq); 161 162 extern int 163 bcm_fb6_cosq_mapping_set(int unit, bcm_port_t gport, bcm_cos_t priority, 164 bcm_cos_queue_t cosq); 165 166 extern int 167 bcm_fb6_cosq_mapping_get(int unit, bcm_port_t gport, bcm_cos_t priority, 168 bcm_cos_queue_t *cosq); 169 170 extern int 171 bcm_fb6_cosq_gport_mapping_set(int unit, bcm_port_t ing_port, 172 bcm_cos_t int_pri, uint32 flags, 173 bcm_gport_t gport, bcm_cos_queue_t cosq); 174 175 extern int 176 bcm_fb6_cosq_gport_mapping_get(int unit, bcm_port_t ing_port, 177 bcm_cos_t int_pri, uint32 flags, 178 bcm_gport_t *gport, bcm_cos_queue_t *cosq); 179 180 extern int 181 bcm_fb6_cosq_discard_set(int unit, uint32 flags); 182 183 extern int 184 bcm_fb6_cosq_discard_get(int unit, uint32 *flags); 185 186 extern int 187 bcm_fb6_cosq_discard_port_set(int unit, bcm_port_t port, bcm_cos_queue_t cosq, 188 uint32 color, int drop_start, int drop_slope, 189 int average_time); 190 191 extern int 192 bcm_fb6_cosq_discard_port_get(int unit, bcm_port_t port, bcm_cos_queue_t cosq, 193 uint32 color, int *drop_start, int *drop_slope, 194 int *average_time); 195 196 extern int 197 bcm_fb6_cosq_gport_discard_set(int unit, bcm_gport_t gport, 198 bcm_cos_queue_t cosq, 199 bcm_cosq_gport_discard_t *discard); 200 201 extern int 202 bcm_fb6_cosq_gport_discard_get(int unit, bcm_gport_t gport, 203 bcm_cos_queue_t cosq, 204 bcm_cosq_gport_discard_t *discard); 205 206 extern int 207 bcm_fb6_cosq_wred_resolution_entry_create(int unit, int *index); 208 209 extern int 210 bcm_fb6_cosq_wred_resolution_entry_destroy(int unit, int index); 211 212 extern int 213 bcm_fb6_cosq_wred_resolution_set(int unit, int index, 214 bcm_cosq_discard_rule_t *rule); 215 216 extern int 217 bcm_fb6_cosq_wred_resolution_get(int unit, int index, int max, 218 bcm_cosq_discard_rule_t *rule, 219 int *count); 220 221 extern int bcm_fb6_cosq_control_set(int unit, bcm_gport_t gport, 222 bcm_cos_queue_t cosq, 223 bcm_cosq_control_t type, int arg); 224 225 extern int bcm_fb6_cosq_control_get(int unit, bcm_gport_t gport, 226 bcm_cos_queue_t cosq, 227 bcm_cosq_control_t type, int *arg); 228 229 extern int 230 bcm_fb6_cosq_field_classifier_get(int unit, int classifier_id, 231 bcm_cosq_classifier_t *classifier); 232 233 extern int 234 bcm_fb6_cosq_field_classifier_id_create(int unit, bcm_cosq_classifier_t 235 *classifier, int *classifier_id); 236 237 extern int 238 bcm_fb6_cosq_field_classifier_id_destroy(int unit, int classifier_id); 239 240 extern int 241 bcm_fb6_cosq_field_classifier_map_set(int unit, int classifier_id, int count, 242 bcm_cos_t *priority_array, bcm_cos_queue_t *cosq_array); 243 244 extern int 245 bcm_fb6_cosq_field_classifier_map_get(int unit, int classifier_id,int array_max, 246 bcm_cos_t *priority_array, bcm_cos_queue_t *cosq_array, int *array_count); 247 248 extern int 249 bcm_fb6_cosq_field_classifier_map_clear(int unit, int classifier_id); 250 251 extern int 252 bcm_fb6_cosq_cpu_cosq_enable_set(int unit, bcm_cos_queue_t cosq, int enable); 253 254 extern int 255 bcm_fb6_cosq_cpu_cosq_enable_get(int unit, bcm_cos_queue_t cosq, 256 int *enable); 257 258 extern int 259 bcm_fb6_cosq_port_pfc_op(int unit, bcm_port_t port, 260 bcm_switch_control_t sctype, _bcm_cosq_op_t op, 261 bcm_gport_t *gport, int gport_count); 262 263 extern int 264 bcm_fb6_cosq_port_pfc_get(int unit, bcm_port_t port, 265 bcm_switch_control_t sctype, 266 bcm_gport_t *gport, int gport_count, 267 int *actual_gport_count); 268 269 extern int 270 bcm_fb6_cosq_pfc_class_mapping_set(int unit, bcm_gport_t port, 271 int array_count, 272 bcm_cosq_pfc_class_mapping_t *mapping_array); 273 274 extern int 275 bcm_fb6_cosq_pfc_class_mapping_get(int unit, bcm_gport_t port, 276 int array_max, 277 bcm_cosq_pfc_class_mapping_t *mapping_array, 278 int *array_count); 279 280 extern int 281 _bcm_fb6_cosq_inv_mapping_get(int unit, bcm_gport_t gport, 282 bcm_cos_queue_t cosq, 283 uint32 flags, bcm_port_t *ing_port, 284 bcm_cos_t *priority); 285 286 extern int 287 bcm_fb6_pfc_deadlock_queue_info_get(int unit, bcm_gport_t gport, bcm_port_t *local_port, 288 int *type, int *split, int *index, int *offset); 289 290 extern int 291 _bcm_fb6_pfc_deadlock_q_config_helper(int unit, 292 _bcm_pfc_deadlock_oper_t operation, 293 bcm_gport_t gport, 294 bcm_cosq_pfc_deadlock_queue_config_t *config, 295 uint8 *enable_status); 296 297 298 /* pfc deadlock */ 299 #define FB6_PFC_DEADLOCK_MAX_COS 32 300 301 /* Below structure to contain register/field name specific to chip */ 302 typedef struct _bcm_fb6_pfc_hw_resorces_s { 303 soc_reg_t timer_count[FB6_PFC_DEADLOCK_MAX_COS]; 304 soc_reg_t timer_status[FB6_PFC_DEADLOCK_MAX_COS]; 305 soc_reg_t timer_mask[FB6_PFC_DEADLOCK_MAX_COS]; 306 soc_reg_t timer_en[FB6_PFC_DEADLOCK_MAX_COS]; 307 soc_reg_t chip_config[4]; 308 soc_reg_t port_config[4]; 309 soc_field_t cos_field[FB6_PFC_DEADLOCK_MAX_COS]; 310 soc_field_t time_init_val[FB6_PFC_DEADLOCK_MAX_COS]; 311 soc_field_t time_unit_field; 312 soc_field_t recovery_action_field; 313 soc_field_t deadlock_status_field; 314 } _bcm_fb6_pfc_hw_resorces_t; 315 316 typedef struct _bcm_fb6_pfc_deadlock_control_s { 317 uint8 pfc_deadlock_cos_max; /* Max COS supported for PFC Deadlock 318 * Detection and Recovery */ 319 uint8 pfc_deadlock_cos_used; /* Total COS configured for PFC Deadlock 320 * Detection and Recovery */ 321 uint8 hw_cos_idx_inuse[FB6_PFC_DEADLOCK_MAX_COS]; /* Boolean for used Cos indices */ 322 uint8 cb_enabled; /* Indicator if CB is enabled */ 323 bcm_switch_pfc_deadlock_detection_interval_t time_unit; /* 0 - 100ms, 324 * 1 - 10ms */ 325 uint32 cb_interval; /* CB interval duration */ 326 bcm_cos_t pfc_pri2cos[FB6_PFC_DEADLOCK_MAX_COS]; /* Mapping to reduce run-time 327 * computation */ 328 bcm_cos_t pfc_cos2pri[FB6_PFC_DEADLOCK_MAX_COS]; /* Mapping to reduce run-time 329 * computation */ 330 _bcm_pfc_deadlock_config_t cos_config[FB6_PFC_DEADLOCK_MAX_COS]; 331 _bcm_fb6_pfc_hw_resorces_t hw_regs_fields; 332 bcm_switch_pfc_deadlock_action_t recovery_action; 333 uint32 cb_count; /* Debug ctr to keep track of #times CB fn is called */ 334 _bcm_cosq_inv_mapping_get_f cosq_inv_mapping_get; /* Function to retrieve 335 * Port/Priority from a 336 * given Gport */ 337 } _bcm_fb6_pfc_deadlock_control_t; 338 339 #define _BCM_FB6_PFC_DEADLOCK_HW_RES_INIT(deadlock_hw) \ 340 do { \ 341 int i = 0; \ 342 for (i = 0; i < FB6_PFC_DEADLOCK_MAX_COS; i++) { \ 343 (deadlock_hw)->timer_count[i] = (INVALIDr); \ 344 (deadlock_hw)->timer_status[i] = (INVALIDr); \ 345 (deadlock_hw)->timer_mask[i] = (INVALIDr); \ 346 (deadlock_hw)->timer_en[i] = (INVALIDr); \ 347 (deadlock_hw)->cos_field[i] = (INVALIDf); \ 348 (deadlock_hw)->time_init_val[i] = (INVALIDf); \ 349 } \ 350 (deadlock_hw)->port_config[0] = (INVALIDr); \ 351 (deadlock_hw)->port_config[1] = (INVALIDr); \ 352 (deadlock_hw)->chip_config[0] = (INVALIDr); \ 353 (deadlock_hw)->chip_config[1] = (INVALIDr); \ 354 (deadlock_hw)->time_unit_field = (INVALIDf); \ 355 (deadlock_hw)->recovery_action_field = (INVALIDf); \ 356 (deadlock_hw)->deadlock_status_field = (INVALIDf); \ 357 } while(0); 358 359 #define _BCM_FB6_UNIT_PFC_DEADLOCK_CONTROL(u) _bcm_fb6_pfc_deadlock_control[(u)] 360 #define _BCM_FB6_PFC_DEADLOCK_CONFIG(u,cos) \ 361 (&((_bcm_fb6_pfc_deadlock_control[(u)])->cos_config[(cos)])) 362 #define _BCM_FB6_PFC_DEADLOCK_COS_ENABLED(u,cos) \ 363 ((((_bcm_fb6_pfc_deadlock_control[(u)])->cos_config[(cos)].flags) & \ 364 _BCM_PFC_DEADLOCK_F_ENABLE) ? TRUE : FALSE) 365 #define _BCM_FB6_PFC_DEADLOCK_CB_INTERVAL(u) \ 366 ((_bcm_fb6_pfc_deadlock_control[(u)])->cb_interval) 367 #define _BCM_FB6_PFC_DEADLOCK_CB_ENABLED(u) \ 368 (((_bcm_fb6_pfc_deadlock_control[(u)])->cb_enabled) ? (TRUE) :(FALSE)) 369 #define _BCM_FB6_PFC_DEADLOCK_CB_COUNT(u) \ 370 ((_bcm_fb6_pfc_deadlock_control[(u)])->cb_count) 371 #define _BCM_FB6_PFC_DEADLOCK_TIME_UNIT(u) \ 372 ((_bcm_fb6_pfc_deadlock_control[(u)])->time_unit) 373 #define _BCM_FB6_PFC_DEADLOCK_RECOVERY_ACTION(u) \ 374 ((_bcm_fb6_pfc_deadlock_control[(u)])->recovery_action) 375 376 extern _bcm_fb6_pfc_deadlock_control_t *_bcm_fb6_pfc_deadlock_control[BCM_MAX_NUM_UNITS]; 377 378 extern int _bcm_fb6_pfc_deadlock_recovery_reset(int unit); 379 380 extern int 381 _bcm_fb6_pfc_deadlock_control_set(int unit, bcm_switch_control_t type, int arg); 382 383 extern int 384 _bcm_fb6_pfc_deadlock_control_get(int unit, bcm_switch_control_t type, int *arg); 385 386 extern int bcm_fb6_pfc_deadlock_recovery_start(int unit, 387 bcm_port_t port, int pri); 388 extern int bcm_fb6_pfc_deadlock_recovery_exit(int unit, 389 bcm_port_t port, int pri); 390 391 392 extern int _bcm_fb6_pfc_deadlock_init(int unit); 393 extern int _bcm_fb6_pfc_deadlock_hw_res_init(int unit); 394 395 extern int _bcm_fb6_pfc_deadlock_deinit(int unit); 396 extern int _bcm_fb6_pfc_deadlock_reinit(int unit); 397 398 extern int 399 _bcm_fb6_pfc_deadlock_hw_cos_index_get(int unit, 400 bcm_cos_t priority, 401 int *hw_cos_index); 402 extern int 403 _bcm_fb6_pfc_deadlock_hw_cos_index_set(int unit, 404 bcm_cos_t priority, 405 int *hw_cos_index); 406 extern int 407 _bcm_fb6_pfc_deadlock_chip_config_get(int unit, 408 bcm_cos_t priority, 409 soc_reg_t* chip_config); 410 extern int 411 _bcm_fb6_pfc_deadlock_hw_oper(int unit, 412 _bcm_pfc_deadlock_oper_t operation, 413 bcm_cos_t priority, 414 _bcm_pfc_deadlock_config_t *config); 415 extern int 416 _bcm_fb6_pfc_deadlock_q_config_helper(int unit, 417 _bcm_pfc_deadlock_oper_t operation, 418 bcm_gport_t gport, 419 bcm_cosq_pfc_deadlock_queue_config_t *config, 420 uint8 *enable_status); 421 extern int 422 bcm_fb6_pfc_deadlock_ignore_pfc_xoff_gen(int unit, int priority, 423 bcm_port_t port, uint32 *rval32); 424 extern int 425 _bcm_fb6_pfc_deadlock_recovery_end(int unit, int cos, bcm_port_t port); 426 extern int 427 _bcm_fb6_pfc_deadlock_monitor(int unit); 428 extern int bcmi_fb6_port_mmu_attach(int unit, int port); 429 extern int bcm_fb6_cosq_port_attach(int unit, bcm_port_t port); 430 extern int bcm_fb6_cosq_port_detach(int unit, bcm_port_t port); 431 extern int bcmi_fb6_port_cosmap_update(int unit, pbmp_t pbmp, int enable); 432 433 extern void bcm_fb6_pstats_deinit(int unit); 434 extern int bcm_fb6_pstats_init(int unit); 435 436 extern int 437 bcm_fb6_cosq_stat_set(int unit, bcm_gport_t port, 438 bcm_cos_queue_t cosq, 439 bcm_cosq_stat_t stat, uint64 value); 440 extern int 441 bcm_fb6_cosq_stat_get(int unit, bcm_gport_t port, 442 bcm_cos_queue_t cosq, 443 bcm_cosq_stat_t stat, int sync_mode, 444 uint64 *value); 445 446 extern int 447 bcm_fb6_cosq_gport_info_get(int unit, bcm_gport_t gport, 448 bcm_cosq_gport_level_info_t *info); 449 450 extern int 451 bcm_fb6_cosq_subport_congestion_config_set(int unit, bcm_gport_t gport, 452 bcm_cosq_subport_congestion_type_t congestion_type, 453 bcm_cosq_subport_congestion_config_t *congestion_config); 454 455 extern int 456 bcm_fb6_cosq_subport_congestion_config_get(int unit, bcm_gport_t gport, 457 bcm_cosq_subport_congestion_type_t congestion_type, 458 bcm_cosq_subport_congestion_config_t *congestion_config); 459 extern int 460 bcm_fb6_cosq_subport_pfc_class_mapping_set(int unit, bcm_gport_t gport, 461 bcm_subport_cos_to_pfc_pri_map_t *cos_to_pfc_map, 462 int *cos_to_pfc_map_profile_id); 463 extern int 464 bcm_fb6_cosq_subport_pfc_class_mapping_get(int unit, bcm_gport_t gport, 465 bcm_subport_cos_to_pfc_pri_map_t *cos_to_pfc_map); 466 467 extern int 468 bcm_fb6_cosq_safc_class_mapping_set(int unit, bcm_gport_t port, int array_count, 469 bcm_cosq_safc_class_mapping_t *mapping_array); 470 471 extern int 472 bcm_fb6_cosq_safc_class_mapping_get(int unit, bcm_gport_t port, int array_max, 473 bcm_cosq_safc_class_mapping_t *mapping_array, 474 int *array_count); 475 476 extern void bcm_fb6_cosq_sw_dump(int unit); 477 bcm_error_t 478 bcmi_fb6_repl_head_icc_move(int unit, int old_head_index, 479 int new_head_index); 480 481 extern int 482 bcm_fb6_dump_port_hsp(int unit, bcm_port_t port); 483 484 extern int 485 bcm_fb6_dump_subport_hsp(int unit, bcm_port_t port, int subport); 486 #ifdef BCM_WARM_BOOT_SUPPORT 487 extern int bcm_fb6_cosq_sync(int unit); 488 #endif /* BCM_WARM_BOOT_SUPPORT */ 489 490 #if 0 491 #define TD3_ECMP_MODE_SINGLE 0x0 492 #define TD3_ECMP_MODE_HIERARCHICAL 0x1 493 494 /* entries_per_profile comes from MAXIDX in PHB_MAPPING_TBL_1 495 * MAXIDX => 8703, #(136 ports x 64 profiles) */ 496 #define _BCM_TD3_PHB_MAP_TAB1_ENTRIES_PER_PROFILE (132) 497 498 extern int _bcm_td3_port_phb_map_tab1_default_entry_add 499 (int unit, soc_profile_mem_t *prof); 500 501 502 extern int bcm_td3_port_init(int unit); 503 504 extern int bcm_td3_port_ing_pri_cng_set(int unit, bcm_port_t port, 505 int untagged, int pkt_pri, int cfi, 506 int int_pri, bcm_color_t color); 507 extern int bcm_td3_port_ing_pri_cng_get(int unit, bcm_port_t port, 508 int untagged, int pkt_pri, int cfi, 509 int *int_pri, bcm_color_t *color); 510 511 extern int bcm_td3_port_cfg_init(int unit, bcm_port_t port, 512 bcm_vlan_data_t *vlan_data); 513 extern int bcm_td3_port_cfg_get(int, bcm_port_t, bcm_port_cfg_t *); 514 extern int 515 bcm_td3_port_cfg_set(int unit, bcm_port_t port, bcm_port_cfg_t *port_cfg); 516 517 extern int _bcm_td3_egr_port_tab_conv(int unit, soc_field_t *field, 518 soc_mem_t* mem); 519 extern int _bcm_td3_port_tab_conv(int unit, soc_field_t *field, soc_mem_t *mem); 520 521 /* VLAN Module */ 522 extern int 523 _bcm_vlan_vfi_untag_profile_entry_op(int unit, void **entries, 524 int entries_per_set, int add, uint32 *index); 525 extern int 526 _bcm_vlan_vfi_untag_profile_mem_reference(int unit, int idx,int entries_per_set); 527 extern int 528 _bcm_vlan_vfi_untag_profile_ref_count(int unit, int index, int *ref_count); 529 extern int 530 bcm_td3_vlan_vfi_untag_init(int unit, bcm_vlan_t vid, pbmp_t pbmp); 531 532 extern int 533 _bcm_td3_vlan_vfi_profile_entry_set(int unit, bcm_vlan_t vlan_vfi, 534 void *entry_data); 535 extern int 536 bcm_td3_vlan_vfi_untag_add(int unit, bcm_vlan_t vid, pbmp_t pbmp, pbmp_t ubmp); 537 extern int 538 bcm_td3_vlan_vfi_untag_delete(int unit, bcm_vlan_t vid, pbmp_t pbmp); 539 extern int 540 bcm_td3_vlan_table_ut_port_get(int unit, bcm_vlan_t vid, pbmp_t *ut_pbmp); 541 extern int 542 bcm_td3_vlan_vfi_untag_destroy(int unit, bcm_vlan_t vlan); 543 544 /* VLAN XLATE */ 545 extern int _bcm_td3_vlan_mac_action_add(int unit, bcm_mac_t mac, 546 bcm_vlan_action_set_t *action); 547 extern int 548 _bcm_td3_vlan_mac_action_get(int unit, bcm_mac_t mac, 549 bcm_vlan_action_set_t *action); 550 extern int 551 _bcm_td3_vlan_mac_delete(int unit, bcm_mac_t mac); 552 553 extern int 554 _bcm_td3_vlan_mac_delete_all(int unit); 555 556 extern int 557 _bcm_td3_vlan_mac_action_traverse(int unit, 558 bcm_vlan_mac_action_traverse_cb cb, 559 void *user_data); 560 561 extern int 562 bcm_td3_cosq_config_get(int unit, int *numq); 563 564 extern int 565 bcm_td3_cosq_config_set(int unit, int numq); 566 567 extern int 568 bcm_td3_cosq_gport_attach(int unit, bcm_gport_t input_gport, 569 bcm_gport_t parent_gport, bcm_cos_queue_t cosq); 570 571 extern int 572 bcm_td3_cosq_gport_detach(int unit, bcm_gport_t input_gport, 573 bcm_gport_t parent_gport, bcm_cos_queue_t cosq); 574 575 extern int 576 bcm_td3_cosq_gport_attach_get(int unit, bcm_gport_t sched_gport, 577 bcm_gport_t *input_gport, bcm_cos_queue_t *cosq); 578 579 extern int 580 bcm_td3_cosq_gport_traverse(int unit, bcm_cosq_gport_traverse_cb cb, 581 void *user_data); 582 583 extern int 584 bcm_td3_cosq_gport_child_get(int unit, bcm_gport_t in_gport, 585 bcm_cos_queue_t cosq, bcm_gport_t *out_gport); 586 587 typedef enum { 588 _BCM_TD3_COSQ_INDEX_STYLE_WRED_QUEUE, 589 _BCM_TD3_COSQ_INDEX_STYLE_WRED_PORT, 590 _BCM_TD3_COSQ_INDEX_STYLE_WRED_DEVICE, 591 _BCM_TD3_COSQ_INDEX_STYLE_UCAST_QUEUE, 592 _BCM_TD3_COSQ_INDEX_STYLE_MCAST_QUEUE, 593 _BCM_TD3_COSQ_INDEX_STYLE_EGR_POOL, 594 _BCM_TD3_COSQ_INDEX_STYLE_COS, 595 _BCM_TD3_COSQ_INDEX_STYLE_COUNT 596 } _bcm_td3_cosq_index_style_t; 597 598 extern int 599 _bcm_td3_cosq_port_resolve(int unit, bcm_gport_t gport, bcm_module_t *modid, 600 bcm_port_t *port, bcm_trunk_t *trunk_id, int *id, 601 int *qnum); 602 603 extern int 604 _bcm_td3_cosq_port_cos_resolve(int unit, bcm_port_t port, bcm_cos_t cos, 605 _bcm_td3_cosq_index_style_t style, 606 bcm_gport_t *gport); 607 608 extern int 609 bcm_td3_cosq_sched_weight_max_get(int unit, int mode, int *weight_max); 610 611 extern int 612 bcm_td3_cosq_gport_sched_get(int unit, bcm_gport_t gport, bcm_cos_queue_t cosq, 613 int *mode, int *weight); 614 615 extern int 616 bcm_td3_cosq_gport_sched_set(int unit, bcm_gport_t gport, bcm_cos_queue_t cosq, 617 int mode, int weight); 618 619 extern int 620 bcm_td3_cosq_port_sched_get(int unit, bcm_pbmp_t pbm, int *mode, int *weights, 621 int *delay); 622 623 extern int 624 bcm_td3_cosq_port_sched_set(int unit, bcm_pbmp_t pbm, int mode, const int 625 *weights, int delay); 626 627 extern int 628 bcm_td3_cosq_discard_set(int unit, uint32 flags); 629 630 extern int 631 bcm_td3_cosq_discard_get(int unit, uint32 *flags); 632 633 extern int 634 bcm_td3_cosq_discard_port_set(int unit, bcm_port_t port, bcm_cos_queue_t cosq, 635 uint32 color, int drop_start, int drop_slope, 636 int average_time); 637 638 extern int 639 bcm_td3_cosq_discard_port_get(int unit, bcm_port_t port, bcm_cos_queue_t cosq, 640 uint32 color, int *drop_start, int *drop_slope, 641 int *average_time); 642 643 extern int 644 bcm_td3_cosq_gport_discard_set(int unit, bcm_gport_t gport, 645 bcm_cos_queue_t cosq, 646 bcm_cosq_gport_discard_t *discard); 647 648 extern int 649 bcm_td3_cosq_gport_discard_get(int unit, bcm_gport_t gport, 650 bcm_cos_queue_t cosq, 651 bcm_cosq_gport_discard_t *discard); 652 653 extern int 654 bcm_td3_cosq_gport_bandwidth_get(int unit, bcm_gport_t gport, 655 bcm_cos_queue_t cosq, uint32 *kbits_sec_min, 656 uint32 *kbits_sec_max, uint32 *flags); 657 658 extern int 659 bcm_td3_cosq_gport_bandwidth_set(int unit, bcm_gport_t gport, 660 bcm_cos_queue_t cosq, uint32 kbits_sec_min, 661 uint32 kbits_sec_max, uint32 flags); 662 663 extern int 664 bcm_td3_cosq_port_bandwidth_get(int unit, bcm_port_t port, bcm_cos_queue_t cosq, 665 uint32 *min_quantum, uint32 *max_quantum, 666 uint32 *burst_quantum, uint32 *flags); 667 668 extern int 669 bcm_td3_cosq_port_bandwidth_set(int unit, bcm_port_t port, bcm_cos_queue_t cosq, 670 uint32 min_quantum, uint32 max_quantum, 671 uint32 burst_quantum, uint32 flags); 672 673 extern int bcm_td3_cosq_port_attach(int unit, bcm_port_t port); 674 extern int bcm_td3_cosq_port_detach(int unit, bcm_port_t port); 675 676 extern int 677 bcm_td3_rx_queue_channel_set_test(int unit, bcm_cos_queue_t queue_id, 678 bcm_rx_chan_t chan_id); 679 680 extern int 681 bcm_td3_egr_mpls_combo_map_default(uint32 unit); 682 683 extern int 684 bcm_td3_egr_mpls_combo_map_create(uint32 unit, 685 int *egr_mpls_combo_map_created, 686 soc_profile_mem_t **egr_mpls_combo_map); 687 688 extern int 689 bcm_td3_egr_mpls_combo_dump(uint32 unit, 690 soc_profile_mem_t *profile); 691 692 extern void 693 bcm_td3_egr_mpls_combo_map_info_init(uint32 unit); 694 695 extern int 696 bcm_td3_qos_map_create(uint32 unit, uint32 *index, int entry_per_index); 697 698 extern int bcm_td3_cosq_control_set(int unit, bcm_gport_t gport, 699 bcm_cos_queue_t cosq, 700 bcm_cosq_control_t type, int arg); 701 extern int bcm_td3_cosq_control_get(int unit, bcm_gport_t gport, 702 bcm_cos_queue_t cosq, 703 bcm_cosq_control_t type, int *arg); 704 extern int 705 _bcm_td3_cosq_index_resolve(int unit, bcm_port_t port, 706 bcm_cos_queue_t cosq, _bcm_td3_cosq_index_style_t style, 707 bcm_port_t *local_port, int *index, int *count); 708 709 extern int 710 bcm_td3_cosq_bst_profile_set(int unit, 711 bcm_gport_t port, 712 bcm_cos_queue_t cosq, 713 bcm_bst_stat_id_t bid, 714 bcm_cosq_bst_profile_t *profile); 715 716 extern int 717 bcm_td3_cosq_bst_profile_get(int unit, 718 bcm_gport_t port, 719 bcm_cos_queue_t cosq, 720 bcm_bst_stat_id_t bid, 721 bcm_cosq_bst_profile_t *profile); 722 723 extern int 724 bcm_td3_cosq_bst_stat_get(int unit, 725 bcm_gport_t port, 726 bcm_cos_queue_t cosq, 727 bcm_bst_stat_id_t bid, 728 uint32 options, 729 uint64 *pvalue); 730 731 extern int 732 bcm_td3_cosq_bst_stat_multi_get(int unit, 733 bcm_gport_t port, 734 bcm_cos_queue_t cosq, 735 uint32 options, 736 int max_values, 737 bcm_bst_stat_id_t *id_list, 738 uint64 *pvalues); 739 740 extern int 741 bcm_td3_cosq_bst_stat_clear(int unit, bcm_gport_t port, 742 bcm_cos_queue_t cosq, bcm_bst_stat_id_t bid); 743 744 extern int bcm_td3_cosq_bst_stat_sync(int unit, bcm_bst_stat_id_t bid); 745 746 extern int 747 _bcm_td3_bst_hdrm_stat_clear(int unit, 748 bcm_gport_t gport, 749 bcm_cos_queue_t cosq); 750 751 extern int 752 _bcm_td3_cosq_bst_hdrm_stat_get(int unit, 753 bcm_gport_t gport, 754 bcm_cos_queue_t cosq, 755 uint32 options, 756 uint64 *pvalue); 757 758 extern int 759 bcm_td3_cosq_mapping_set(int unit, bcm_port_t gport, bcm_cos_t priority, 760 bcm_cos_queue_t cosq); 761 762 extern int 763 bcm_td3_cosq_mapping_get(int unit, bcm_port_t gport, bcm_cos_t priority, 764 bcm_cos_queue_t *cosq); 765 766 extern int 767 bcm_td3_cosq_gport_mapping_set(int unit, bcm_port_t ing_port, 768 bcm_cos_t int_pri, uint32 flags, 769 bcm_gport_t gport, bcm_cos_queue_t cosq); 770 771 extern int 772 bcm_td3_cosq_gport_mapping_get(int unit, bcm_port_t ing_port, 773 bcm_cos_t int_pri, uint32 flags, 774 bcm_gport_t *gport, bcm_cos_queue_t *cosq); 775 776 extern int 777 bcm_td3_cosq_port_pfc_op(int unit, bcm_port_t port, 778 bcm_switch_control_t sctype, _bcm_cosq_op_t op, 779 bcm_gport_t *gport, int gport_count); 780 781 extern int 782 bcm_td3_cosq_port_pfc_get(int unit, bcm_port_t port, 783 bcm_switch_control_t sctype, 784 bcm_gport_t *gport, int gport_count, 785 int *actual_gport_count); 786 787 extern int 788 bcm_td3_cosq_pfc_class_mapping_set(int unit, bcm_gport_t port, 789 int array_count, 790 bcm_cosq_pfc_class_mapping_t *mapping_array); 791 792 extern int 793 bcm_td3_cosq_pfc_class_mapping_get(int unit, bcm_gport_t port, 794 int array_max, 795 bcm_cosq_pfc_class_mapping_t *mapping_array, 796 int *array_count); 797 798 /* OOB support */ 799 /* OOB FC Tx side global configuration API */ 800 extern int bcm_td3_oob_fc_tx_config_set( 801 int unit, 802 bcm_oob_fc_tx_config_t *config); 803 804 /* OOB FC Tx side global configuration get API */ 805 extern int bcm_td3_oob_fc_tx_config_get( 806 int unit, 807 bcm_oob_fc_tx_config_t *config); 808 809 extern int 810 _bcm_td3_oob_fc_tx_port_control_set(int unit, bcm_port_t port, 811 int status, int dir); 812 extern int 813 _bcm_td3_oob_fc_tx_port_control_get(int unit, bcm_port_t port, 814 int *status, int dir); 815 816 /* OOB FC Tx side global info get API */ 817 extern int bcm_td3_oob_fc_tx_info_get( 818 int unit, 819 bcm_oob_fc_tx_info_t *info); 820 821 /* 822 * OOB FC Rx Interface side Traffic Class to Priority Mapping Multi Set 823 * API 824 */ 825 extern int bcm_td3_oob_fc_rx_port_tc_mapping_multi_set( 826 int unit, 827 bcm_oob_fc_rx_intf_id_t intf_id, 828 bcm_gport_t gport, 829 int array_count, 830 uint32 *tc, 831 uint32 *pri_bmp); 832 833 /* 834 * OOB FC Rx Interface side Traffic Class to Priority Mapping Multi Get 835 * API 836 */ 837 extern int bcm_td3_oob_fc_rx_port_tc_mapping_multi_get( 838 int unit, 839 bcm_oob_fc_rx_intf_id_t intf_id, 840 bcm_gport_t gport, 841 int array_max, 842 uint32 *tc, 843 uint32 *pri_bmp, 844 int *array_count); 845 846 /* OOB FC Rx Interface side Traffic Class to Priority Mapping set API */ 847 extern int bcm_td3_oob_fc_rx_port_tc_mapping_set( 848 int unit, 849 bcm_oob_fc_rx_intf_id_t intf_id, 850 bcm_gport_t gport, 851 uint32 tc, 852 uint32 pri_bmp); 853 854 /* OOB FC Rx Interface side Traffic Class to Priority Mapping get API */ 855 extern int bcm_td3_oob_fc_rx_port_tc_mapping_get( 856 int unit, 857 bcm_oob_fc_rx_intf_id_t intf_id, 858 bcm_gport_t gport, 859 uint32 tc, 860 uint32 *pri_bmp); 861 862 /* OOB FC Rx Interface side Configuration set API */ 863 extern int bcm_td3_oob_fc_rx_config_set( 864 int unit, 865 bcm_oob_fc_rx_intf_id_t intf_id, 866 bcm_oob_fc_rx_config_t *config, 867 int array_count, 868 bcm_gport_t *gport_array); 869 870 /* OOB FC Rx Interface side Configuration get API */ 871 extern int bcm_td3_oob_fc_rx_config_get( 872 int unit, 873 bcm_oob_fc_rx_intf_id_t intf_id, 874 bcm_oob_fc_rx_config_t *config, 875 int array_max, 876 bcm_gport_t *gport_array, 877 int *array_count); 878 879 /* OOB FC Rx Interface side Channel offset value for a port */ 880 extern int bcm_td3_oob_fc_rx_port_offset_get( 881 int unit, 882 bcm_oob_fc_rx_intf_id_t intf_id, 883 bcm_gport_t gport, 884 uint32 *offset); 885 886 /* OOB STATS global configuration set API */ 887 extern int bcm_td3_oob_stats_config_set( 888 int unit, 889 bcm_oob_stats_config_t *config); 890 891 /* OOB STATS global configuration get API */ 892 extern int bcm_td3_oob_stats_config_get( 893 int unit, 894 bcm_oob_stats_config_t *config); 895 896 897 /* OOB STATS configuration of service pool list multi set API */ 898 extern int bcm_td3_oob_stats_pool_mapping_multi_set( 899 int unit, 900 int array_count, 901 int *offset_array, 902 uint8 *dir_array, 903 bcm_service_pool_id_t *pool_array); 904 905 /* OOB STATS configuration of service pool list multi get API */ 906 extern int bcm_td3_oob_stats_pool_mapping_multi_get( 907 int unit, 908 int array_max, 909 int *offset_array, 910 uint8 *dir_array, 911 bcm_service_pool_id_t *pool_array, 912 int *array_count); 913 914 /* OOB STATS configuration of service pool list set API */ 915 extern int bcm_td3_oob_stats_pool_mapping_set( 916 int unit, 917 int offset, 918 uint8 dir, 919 bcm_service_pool_id_t pool); 920 921 /* OOB STATS configuration of service pool list get API */ 922 extern int bcm_td3_oob_stats_pool_mapping_get( 923 int unit, 924 int offset, 925 uint8 *dir, 926 bcm_service_pool_id_t *pool); 927 928 /* OOB STATS configuration of Queue list set API */ 929 extern int bcm_td3_oob_stats_queue_mapping_multi_set( 930 int unit, 931 int array_count, 932 int *offset_array, 933 bcm_gport_t *gport_array); 934 935 /* OOB STATS configuration of Queue list get API */ 936 extern int bcm_td3_oob_stats_queue_mapping_multi_get( 937 int unit, 938 int array_max, 939 int *offset_array, 940 bcm_gport_t *gport_array, 941 int *array_count); 942 943 /* OOB STATS configuration of Queue list set API */ 944 extern int bcm_td3_oob_stats_queue_mapping_set( 945 int unit, 946 int offset, 947 bcm_gport_t gport); 948 949 /* OOB STATS configuration of Queue list get API */ 950 extern int bcm_td3_oob_stats_queue_mapping_get( 951 int unit, 952 int offset, 953 bcm_gport_t *gport); 954 955 956 957 /* 958 * 8 Priority Groups supported. 959 */ 960 #define TD3_PRIOROTY_GROUP_ID_MIN 0 961 #define TD3_PRIOROTY_GROUP_ID_MAX 7 962 /* 963 * Inpur priority range. 964 * PFC : 0-7 965 * SAFC : 0-15 966 */ 967 #define TD3_PFC_INPUT_PRIORITY_MIN 0 968 #define TD3_PFC_INPUT_PRIORITY_MAX 7 969 #define TD3_SAFC_INPUT_PRIORITY_MIN TD3_PFC_INPUT_PRIORITY_MIN 970 #define TD3_SAFC_INPUT_PRIORITY_MAX 15 971 972 extern int 973 bcm_td3_port_priority_group_mapping_set(int unit, bcm_gport_t gport, 974 int prio, int priority_group); 975 extern int 976 bcm_td3_port_priority_group_mapping_get(int unit, bcm_gport_t gport, 977 int prio, int *priority_group); 978 extern int 979 bcm_td3_port_priority_group_config_set(int unit, bcm_gport_t gport, 980 int priority_group, bcm_port_priority_group_config_t *prigrp_config); 981 extern int 982 bcm_td3_port_priority_group_config_get(int unit, bcm_gport_t gport, 983 int priority_group, bcm_port_priority_group_config_t *prigrp_config); 984 extern int 985 _bcm_td3_cosq_inv_mapping_get(int unit, bcm_gport_t gport, 986 bcm_cos_queue_t cosq, 987 uint32 flags, bcm_port_t *ing_port, 988 bcm_cos_t *priority); 989 990 /* pfc deadlock */ 991 extern int 992 _bcm_td3_pfc_deadlock_init(int unit); 993 994 extern int 995 _bcm_td3_pfc_deadlock_hw_cos_index_get(int unit, 996 bcm_cos_t priority, 997 int *hw_cos_index); 998 extern int 999 _bcm_td3_pfc_deadlock_hw_cos_index_set(int unit, 1000 bcm_cos_t priority, 1001 int *hw_cos_index); 1002 extern int 1003 _bcm_td3_pfc_deadlock_chip_config_get(int unit, 1004 bcm_cos_t priority, 1005 soc_reg_t* chip_config); 1006 extern int 1007 _bcm_td3_pfc_deadlock_hw_oper(int unit, 1008 _bcm_pfc_deadlock_oper_t operation, 1009 bcm_cos_t priority, 1010 _bcm_pfc_deadlock_config_t *config); 1011 extern int 1012 _bcm_td3_pfc_deadlock_q_config_helper(int unit, 1013 _bcm_pfc_deadlock_oper_t operation, 1014 bcm_gport_t gport, 1015 bcm_cosq_pfc_deadlock_queue_config_t *config, 1016 uint8 *enable_status); 1017 extern int 1018 bcm_td3_pfc_deadlock_ignore_pfc_xoff_gen(int unit, int priority, 1019 bcm_port_t port, uint32 *rval32); 1020 extern int 1021 _bcm_td3_pfc_deadlock_recovery_end(int unit, int cos, bcm_port_t port); 1022 extern int 1023 _bcm_td3_pfc_deadlock_recovery_begin(int unit, int cos, int pipe, int pipe_mmu_port); 1024 extern int 1025 _bcm_td3_pfc_deadlock_recovery_reset(int unit); 1026 extern int 1027 _bcm_td3_pfc_deadlock_monitor(int unit); 1028 1029 1030 extern int 1031 bcm_td3_cosq_port_pps_set(int unit, bcm_port_t port, bcm_cos_queue_t cosq, 1032 int pps); 1033 1034 extern int 1035 bcm_td3_cosq_port_pps_get(int unit, bcm_port_t port, bcm_cos_queue_t cosq, 1036 int *pps); 1037 1038 extern int 1039 bcm_td3_cosq_port_burst_set(int unit, bcm_port_t port, bcm_cos_queue_t cosq, 1040 int burst); 1041 1042 extern int 1043 bcm_td3_cosq_port_burst_get(int unit, bcm_port_t port, bcm_cos_queue_t cosq, 1044 int *burst); 1045 1046 extern int 1047 bcm_td3_port_rate_egress_set(int unit, bcm_port_t port, uint32 bandwidth, 1048 uint32 burst, uint32 mode); 1049 1050 extern int 1051 bcm_td3_port_rate_egress_get(int unit, bcm_port_t port, uint32 *bandwidth, 1052 uint32 *burst, uint32 *mode); 1053 1054 extern int 1055 bcm_td3_port_drain_cells(int unit, int port); 1056 1057 extern int 1058 bcm_td3_cosq_cpu_cosq_enable_set(int unit, bcm_cos_queue_t cosq, int enable); 1059 1060 extern int 1061 bcm_td3_cosq_cpu_cosq_enable_get(int unit, bcm_cos_queue_t cosq, 1062 int *enable); 1063 1064 extern int 1065 bcm_td3_cosq_field_classifier_get(int unit, int classifier_id, 1066 bcm_cosq_classifier_t *classifier); 1067 1068 extern int 1069 bcm_td3_cosq_field_classifier_id_create(int unit, bcm_cosq_classifier_t 1070 *classifier, int *classifier_id); 1071 1072 extern int 1073 bcm_td3_cosq_field_classifier_id_destroy(int unit, int classifier_id); 1074 1075 extern int 1076 bcm_td3_cosq_field_classifier_map_set(int unit, int classifier_id, int count, 1077 bcm_cos_t *priority_array, bcm_cos_queue_t *cosq_array); 1078 1079 extern int 1080 bcm_td3_cosq_field_classifier_map_get(int unit, int classifier_id,int array_max, 1081 bcm_cos_t *priority_array, bcm_cos_queue_t *cosq_array, int *array_count); 1082 1083 extern int 1084 bcm_td3_cosq_field_classifier_map_clear(int unit, int classifier_id); 1085 1086 extern int 1087 bcm_td3_cosq_safc_class_mapping_set(int unit, bcm_gport_t port, int array_count, 1088 bcm_cosq_safc_class_mapping_t *mapping_array); 1089 1090 extern int 1091 bcm_td3_cosq_safc_class_mapping_get(int unit, bcm_gport_t port, int array_max, 1092 bcm_cosq_safc_class_mapping_t *mapping_array, 1093 int *array_count); 1094 1095 /* Subport functions */ 1096 extern int bcm_td3_subport_coe_init(int unit); 1097 #if defined(INCLUDE_L3) 1098 /* L3 ECMP DLB */ 1099 extern void _bcm_td3_ecmp_dlb_deinit(int unit); 1100 extern int _bcm_td3_ecmp_dlb_init(int unit); 1101 extern int bcm_td3_l3_egress_dlb_attr_set(int unit, int nh_index, 1102 bcm_l3_egress_t *egr); 1103 extern int bcm_td3_l3_egress_dlb_attr_destroy(int unit, int nh_index); 1104 extern int bcm_td3_l3_egress_dlb_attr_get(int unit, int nh_index, 1105 bcm_l3_egress_t *egr); 1106 extern int bcm_td3_l3_egress_ecmp_dlb_create(int unit, 1107 bcm_l3_egress_ecmp_t *ecmp, int intf_count, bcm_if_t *intf_array); 1108 extern int bcm_td3_l3_egress_ecmp_dlb_destroy(int unit, 1109 bcm_if_t mpintf); 1110 extern int bcm_td3_l3_egress_ecmp_dlb_get(int unit, 1111 bcm_l3_egress_ecmp_t *ecmp); 1112 extern int bcm_td3_l3_egress_dlb_attr_get(int unit, int nh_index, bcm_l3_egress_t *egr); 1113 extern int bcm_td3_l3_egress_ecmp_dlb_ethertype_set( 1114 int unit, uint32 flags, int ethertype_count, int *ethertype_array); 1115 1116 extern int bcm_td3_l3_egress_ecmp_dlb_ethertype_get(int unit, 1117 uint32 *flags, int ethertype_max, int *ethertype_array, int *ethertype_count); 1118 1119 extern int _bcm_td3_ecmp_dlb_config_set(int unit, bcm_switch_control_t type, 1120 int arg); 1121 extern int _bcm_td3_ecmp_dlb_config_get(int unit, bcm_switch_control_t type, 1122 int *arg); 1123 extern void bcm_td3_ecmp_dlb_sw_dump(int unit); 1124 extern int 1125 bcm_td3_l3_conflict_get(int unit, bcm_l3_key_t *ipkey, bcm_l3_key_t *cf_array, 1126 int cf_max, int *cf_count); 1127 1128 #endif /* INCLUDE_L3 */ 1129 1130 #if defined(INCLUDE_L3) 1131 extern int _bcm_td3_flow_port_resolve( 1132 int unit, 1133 bcm_gport_t flow_port_id, 1134 bcm_if_t encap_id, 1135 bcm_module_t *modid, 1136 bcm_port_t *port, 1137 bcm_trunk_t *trunk_id, 1138 int *id); 1139 1140 extern int _bcm_td3_l3_flex_nh_add( 1141 int unit, 1142 int idx, 1143 bcm_l3_egress_t *nh_entry, 1144 uint32 *egr_nh, 1145 int ipmc); 1146 1147 extern int _bcm_td3_l3_flex_nh_entry_parse( 1148 int unit, 1149 uint32 *egr_entry_ptr, 1150 uint32 index, 1151 bcm_l3_egress_t *nh_entry); 1152 1153 extern int _bcm_td3_flow_next_hop_set( 1154 int unit, 1155 int nh_index, 1156 uint32 flags, 1157 int vp, 1158 int drop); 1159 1160 extern int _bcm_td3_flow_egress_reset( 1161 int unit, 1162 int nh_index); 1163 1164 extern int _bcm_td3_flow_egress_get( 1165 int unit, 1166 bcm_l3_egress_t *egr, 1167 int nh_index); 1168 1169 extern int _bcm_td3_l3_flex_intf_add( 1170 int unit, 1171 _bcm_l3_intf_cfg_t *intf_info, 1172 uint32 *l3_if_entry_p); 1173 1174 extern int _bcm_td3_l3_flex_intf_get( 1175 int unit, 1176 _bcm_l3_intf_cfg_t *intf_info, 1177 uint32 *l3_if_entry_p); 1178 1179 extern int _bcm_td3_l3_flex_entry_get( 1180 int unit, 1181 _bcm_l3_cfg_t *l3cfg, 1182 int *nh_idx, 1183 int *embd); 1184 1185 extern int _bcm_td3_l3_flex_ent_parse( 1186 int unit, 1187 soc_mem_t mem, 1188 _bcm_l3_cfg_t *l3cfg, 1189 int *nh_idx, 1190 void *l3x_entry); 1191 1192 extern int _bcm_td3_l3_flex_entry_add( 1193 int unit, 1194 _bcm_l3_cfg_t *l3cfg, 1195 int nh_idx); 1196 1197 extern int _bcm_td3_l3_flex_entry_del( 1198 int unit, 1199 _bcm_l3_cfg_t *l3cfg); 1200 1201 extern int _bcm_td3_lpm_flex_ent_init( 1202 int unit, 1203 _bcm_defip_cfg_t *lpm_cfg, 1204 defip_entry_t *lpm_entry); 1205 1206 extern int _bcm_td3_lpm_prepare_flex_defip_entry( 1207 int unit, 1208 _bcm_defip_cfg_t *lpm_cfg, 1209 int nh_ecmp_idx, 1210 defip_entry_t *lpm_entry); 1211 1212 extern int _bcm_td3_lpm_flex_ent_get_key( 1213 int unit, 1214 _bcm_defip_cfg_t *lpm_cfg, 1215 defip_entry_t *lpm_entry, 1216 uint32 key_type); 1217 1218 extern int _bcm_td3_lpm_flex_ent_parse( 1219 int unit, 1220 uint32 *lpm_entry, 1221 uint32 key_type, 1222 soc_mem_t mem, 1223 _bcm_defip_cfg_t *lpm_cfg, 1224 int *nh_idx); 1225 1226 extern int _bcm_defip_pair128_flex_get_key( 1227 int unit, 1228 uint32 *hw_entry, 1229 _bcm_defip_cfg_t *lpm_cfg); 1230 1231 extern int _bcm_l3_defip_pair128_flex_add( 1232 int unit, 1233 _bcm_defip_cfg_t *lpm_cfg, 1234 int nh_ecmp_idx, 1235 uint32 *hw_entry); 1236 1237 extern int _bcm_td3_mpls_gre_label_add( 1238 int unit, 1239 bcm_l3_egress_t *egr, 1240 int nh_index, 1241 uint32 flags); 1242 1243 extern int _bcm_td3_mpls_gre_label_get( 1244 int unit, 1245 int vc_swap_index, 1246 bcm_l3_egress_t *egr); 1247 1248 extern int _bcm_td3_mpls_gre_label_delete( 1249 int unit, 1250 int index, 1251 soc_mem_t view_id); 1252 #endif /* INCLUDE_L3 */ 1253 1254 extern int _bcm_td3_flex_l2_from_l2x( 1255 int unit, 1256 bcm_l2_addr_t *l2addr, 1257 l2x_entry_t *l2x_entry, 1258 int *mb_index); 1259 1260 extern int _bcm_td3_flex_l2_to_l2x( 1261 int unit, 1262 l2x_entry_t *l2x_entry, 1263 bcm_l2_addr_t *l2addr, 1264 int key_only); 1265 1266 extern int _bcm_td3_flex_l2_replace_data_mask_setup( 1267 int unit, 1268 _bcm_l2_replace_t *rep); 1269 1270 extern int _bcm_td3_flex_l2_bulk_replace_modport( 1271 int unit, 1272 _bcm_l2_replace_t *rep_st); 1273 1274 extern int 1275 bcm_td3_cosq_stat_set(int unit, bcm_gport_t port, 1276 bcm_cos_queue_t cosq, 1277 bcm_cosq_stat_t stat, uint64 value); 1278 extern int 1279 bcm_td3_cosq_stat_get(int unit, bcm_gport_t port, 1280 bcm_cos_queue_t cosq, 1281 bcm_cosq_stat_t stat, int sync_mode, 1282 uint64 *value); 1283 extern int bcmi_td3_port_fn_drv_init(int unit); 1284 extern int bcmi_td3_port_soc_resource_init(int unit, int nport, 1285 bcm_port_resource_t *resource, 1286 soc_port_resource_t *soc_resource); 1287 extern int bcmi_td3_port_resource_validate(int unit, 1288 soc_port_schedule_state_t *port_schedule_state); 1289 extern int bcmi_td3_pre_flexport_tdm(int unit, 1290 soc_port_schedule_state_t *port_schedule_state); 1291 extern int bcmi_td3_post_flexport_tdm(int unit, 1292 soc_port_schedule_state_t *port_schedule_state); 1293 extern int bcmi_td3_port_attach_mmu(int unit, int port); 1294 extern int bcmi_td3_port_detach_asf(int unit, bcm_port_t port); 1295 extern int bcmi_td3_port_enable(int unit, 1296 soc_port_schedule_state_t *port_schedule_state); 1297 extern int bcmi_td3_port_disable(int unit, 1298 soc_port_schedule_state_t *port_schedule_state); 1299 extern int bcmi_td3_port_speed_1g_update(int unit, bcm_port_t port, int speed); 1300 bcm_port_abil_t *mask); 1301 extern void bcm_td3_pstats_deinit(int unit); 1302 extern int bcm_td3_pstats_init(int unit); 1303 extern int bcmi_td3_port_detach_stack(int unit, bcm_port_t port); 1304 extern int bcmi_td3_port_attach_stack(int unit, bcm_port_t port); 1305 1306 #ifdef BCM_WARM_BOOT_SUPPORT_SW_DUMP 1307 extern void bcm_td3_cosq_sw_dump(int unit); 1308 #endif 1309 #ifdef BCM_WARM_BOOT_SUPPORT 1310 extern int bcm_td3_cosq_sync(int unit); 1311 #endif /* BCM_WARM_BOOT_SUPPORT */ 1312 1313 /* RIOT related defines */ 1314 1315 #ifdef BCM_RIOT_SUPPORT 1316 1317 1318 /* TD3 : EGR_L3_NEXT_HOP-KEY_TYPEf */ 1319 #define BCMI_TD3_L3_EGR_NH_MCAST_ENTRY_TYPE 7 1320 #define BCMI_TD3_L3_EGR_NH_SD_TAG_ENTRY_TYPE 2 1321 1322 1323 /* L3 interface banks values */ 1324 #define BCMI_TD3_L3_INTF_ENT_PER_BANK 2048 1325 #define BCMI_TD3_L3_INTF_BANKS_MAX 8 1326 1327 /* L3 next hop banks values */ 1328 #define BCMI_TD3_L3_NH_ENT_PER_BANK 4096 1329 #define BCMI_TD3_L3_NH_BANKS_MAX 16 1330 1331 1332 /* NH destination encodings, masks and macros */ 1333 #define BCMI_TD3_L3_NH_DEST_DGLP_SHIFT 16 1334 #define BCMI_TD3_L3_NH_DEST_DGLP_MASK 0xFFFF /* 15 bits value */ 1335 #define BCMI_TD3_L3_NH_DEST_DGLP_EN_MASK 0x3 /* 2 bits value */ 1336 #define BCMI_TD3_L3_NH_DEST_DGLP_ENCODING 0x0 /* 15 bits value */ 1337 #define BCMI_TD3_L3_NH_DEST_DVP_SHIFT 16 /* 14 bits value */ 1338 #define BCMI_TD3_L3_NH_DEST_DVP_MASK 0xFFFF /* 14 bits value */ 1339 #define BCMI_TD3_L3_NH_DEST_DVP_EN_MASK 0x3 /* 4 bits value */ 1340 #define BCMI_TD3_L3_NH_DEST_DVP_ENCODING 0x1 /* 15 bits value */ 1341 #define BCMI_TD3_L3_NH_DEST_LAG_SHIFT 13 /* 14 bits value */ 1342 #define BCMI_TD3_L3_NH_DEST_LAG_MASK 0x1FFF /* 14 bits value */ 1343 #define BCMI_TD3_L3_NH_DEST_LAG_EN_MASK 0xF /* 4 bits value */ 1344 #define BCMI_TD3_L3_NH_DEST_LAG_ENCODING 0x1 /* 15 bits value */ 1345 1346 1347 #define BCMI_TD3_L3_NH_DEST_DVP_GET(gport) \ 1348 ((BCMI_TD3_L3_NH_DEST_DVP_ENCODING << BCMI_TD3_L3_NH_DEST_DVP_SHIFT) | \ 1349 (gport & BCMI_TD3_L3_NH_DEST_DVP_MASK)) 1350 1351 #define BCMI_TD3_L3_NH_DEST_LAG_GET(gport) \ 1352 ((BCMI_TD3_L3_NH_DEST_LAG_ENCODING << BCMI_TD3_L3_NH_DEST_LAG_SHIFT) | \ 1353 (gport & BCMI_TD3_L3_NH_DEST_LAG_MASK)) 1354 1355 #define BCMI_TD3_L3_NH_DEST_DGLP_GET(gport) \ 1356 ((BCMI_TD3_L3_NH_DEST_DGLP_ENCODING << BCMI_TD3_L3_NH_DEST_DGLP_SHIFT) | \ 1357 (gport & BCMI_TD3_L3_NH_DEST_DGLP_MASK)) 1358 1359 #define BCMI_TD3_L3_NH_DEST_IS_DGLP(_dest) \ 1360 ((((_dest) >> BCMI_TD3_L3_NH_DEST_DGLP_SHIFT) & BCMI_TD3_L3_NH_DEST_DGLP_EN_MASK) == \ 1361 BCMI_TD3_L3_NH_DEST_DGLP_ENCODING) 1362 #define BCMI_TD3_L3_NH_PORT_DGLP_GET(_dest) \ 1363 (((_dest) & BCMI_TD3_L3_NH_DEST_DGLP_MASK)) 1364 1365 #define BCMI_TD3_L3_NH_DEST_IS_LAG(_dest) \ 1366 (BCMI_TD3_L3_NH_DEST_IS_DGLP(_dest) && ((((_dest) >> BCMI_TD3_L3_NH_DEST_LAG_SHIFT) & BCMI_TD3_L3_NH_DEST_LAG_EN_MASK) == \ 1367 BCMI_TD3_L3_NH_DEST_LAG_ENCODING)) 1368 1369 #define BCMI_TD3_L3_NH_PORT_LAG_GET(_dest) \ 1370 (((_dest) & BCMI_TD3_L3_NH_DEST_LAG_MASK)) 1371 1372 #define BCMI_TD3_L3_NH_DEST_IS_DVP(_dest) \ 1373 ((((_dest) >> BCMI_TD3_L3_NH_DEST_DVP_SHIFT) & BCMI_TD3_L3_NH_DEST_DVP_EN_MASK) == \ 1374 BCMI_TD3_L3_NH_DEST_DVP_ENCODING) 1375 1376 #define BCMI_TD3_L3_NH_PORT_DVP_GET(_dest) \ 1377 (((_dest) & BCMI_TD3_L3_NH_DEST_DVP_MASK)) 1378 1379 /* Td3 : EGR_L3_NEXT_HOP-NEXT_PTR field types */ 1380 #define BCMI_TD3_L3_NH_EGR_NEXT_PTR_TYPE_DVP 1 1381 #define BCMI_TD3_L3_NH_EGR_NEXT_PTR_TYPE_NH 2 1382 #define BCMI_TD3_L3_NH_EGR_NEXT_PTR_TYPE_VC_SWAP 3 1383 1384 /* RioT Overlay validity checks */ 1385 #define BCMI_RIOT_IS_ENABLED(_u) \ 1386 ((&_bcm_l3_bk_info[_u])->riot_enable) 1387 1388 #define BCMI_L3_NH_OVERLAY_VALID(_u) \ 1389 ((BCMI_RIOT_IS_ENABLED(_u)) && \ 1390 (((&_bcm_l3_bk_info[_u])->l3_nh_overlay_entries) > 0)) 1391 1392 #define BCMI_L3_INTF_OVERLAY_VALID(_u) \ 1393 ((BCMI_RIOT_IS_ENABLED(_u)) && \ 1394 (((&_bcm_l3_bk_info[_u])->l3_intf_overlay_entries) > 0)) 1395 1396 #define BCMI_RIOT_VPN_VFI_IS_SET(_u, _vid) \ 1397 ((BCMI_RIOT_IS_ENABLED(_u)) && (_BCM_VPN_VFI_IS_SET((_vid)))) 1398 1399 #define BCMI_RIOT_VPN_VFI_IS_NOT_SET(_u, _vid) \ 1400 ((!BCMI_RIOT_IS_ENABLED(_u)) || (!(_BCM_VPN_VFI_IS_SET((_vid))))) 1401 1402 #define BCMI_GPORT_TYPE_GET(_gport) \ 1403 (((_gport) >> _SHR_GPORT_TYPE_SHIFT) & _SHR_GPORT_TYPE_MASK) 1404 1405 #define BCMI_L3_NH_FLEX_VIEW(ent_type) (ent_type >= 9) 1406 #define BCMI_LPM_FLEX_VIEW(ent_type) (ent_type > 1) 1407 1408 /* DESTINATION_FORMAT DEST_TYPE encodings */ 1409 #define BCMI_TD3_DEST_TYPE_INVALID 0 1410 #define BCMI_TD3_DEST_TYPE0_DVP 1 1411 #define BCMI_TD3_DEST_TYPE0_DGPP 2 1412 #define BCMI_TD3_DEST_TYPE0_NH 3 1413 #define BCMI_TD3_DEST_TYPE1_ECMP 1 1414 #define BCMI_TD3_DEST_TYPE1_L2MC 2 1415 #define BCMI_TD3_DEST_TYPE1_IPMC 3 1416 #define BCMI_TD3_DEST_TYPE2_LAG 1 1417 1418 #define BCMI_TD3_EGR_L3_NEXTHOP_WIDTH 160 1419 1420 /* 1421 * The below infrastructure is done specially for nh-nh association management. 1422 * When overlay nh is associated with underlay nh, we will have to keep 1423 * backward tracing to redraw association if underlay NH is changed. 1424 */ 1425 typedef struct _td3_ol_nh_link_s { 1426 int o_nh_idx; 1427 struct _td3_ol_nh_link_s *next_link; 1428 } td3_ol_nh_link_t; 1429 1430 typedef struct _td3_ul_nh_link_s { 1431 int u_nh_idx; 1432 td3_ol_nh_link_t *ol_nh_assoc; 1433 struct _td3_ul_nh_link_s *ul_nh_link; 1434 } td3_ul_nh_link_t; 1435 1436 /* TD3 specific routines */ 1437 extern int bcmi_td3_l3_riot_init(int unit); 1438 extern int bcmi_td3_get_port_from_destination(int unit, 1439 uint32 dest, bcm_l3_egress_t *nh); 1440 1441 extern int bcm_td3_riot_l3_nh_dest_set(int unit, bcm_l3_egress_t *nh_entry, ing_l3_next_hop_entry_t *nh_dest); 1442 /* ol-ul association routines */ 1443 extern int bcmi_td3_l3_nh_assoc_ol_ul_link_sw_add(int unit, 1444 int ol_nh, int ul_nh); 1445 extern int bcmi_td3_l3_nh_assoc_ol_ul_link_delete(int unit, int nh_idx); 1446 extern int bcmi_td3_l3_nh_assoc_ol_ul_link_is_required(int unit, int vp_nh_index); 1447 extern int bcmi_td3_l3_nh_assoc_ol_ul_link_replace(int unit, 1448 int old_ul, int new_ul); 1449 extern int bcmi_td3_l3_nh_assoc_ol_ul_link_sw_delete(int unit, int ol_nh, 1450 int ul_nh); 1451 extern int bcmi_td3_l3_nh_assoc_ol_ul_link_reinit(int unit, int ol_nh_idx); 1452 extern int bcmi_td3_riot_l3_nh_dest_set(int unit, 1453 bcm_l3_egress_t *nh_entry, uint32 *nh_dest); 1454 #endif /* BCM_RIOT_SUPPORT */ 1455 1456 #ifdef BCM_SPECIAL_LABEL_SUPPORT 1457 1458 /************************* MPLS related Changes **********************/ 1459 1460 #define BCMI_MPLS_LABEL_ID_MAX (0xfffff) 1461 #define BCMI_MPLS_LABEL_ID_VALID(_label_) \ 1462 (((_label_) >= 0) && \ 1463 ((_label_) <= BCMI_MPLS_LABEL_ID_MAX)) 1464 1465 #define BCMI_MPLS_LABEL_MASK_MAX (0xfffff) 1466 #define BCMI_MPLS_LABEL_MASK_VALID(_mask_) \ 1467 (((_mask_) >= 0) && \ 1468 (((_mask_) <= BCMI_MPLS_LABEL_MASK_MAX)) 1469 1470 #define BCMI_MPLS_EXP_MAX (0x7) 1471 #define BCMI_MPLS_EXP_VALID(exp) \ 1472 (((exp) >= 0) && \ 1473 ((exp) <= BCMI_MPLS_EXP_MAX)) 1474 1475 #define BCMI_MPLS_EXP_MASK_MAX (0x7) 1476 #define BCMI_MPLS_EXP_MASK_VALID(_mask_) \ 1477 (((_mask_) >= 0) && \ 1478 (((_mask_) <= BCMI_MPLS_EXP_MASK_MAX)) 1479 #define BCMI_MPLS_TTL_MAX (0xFF) 1480 #define BCMI_MPLS_TTL_VALID(ttl) \ 1481 (((ttl) >= 0) && \ 1482 ((ttl) <= BCMI_MPLS_TTL_MAX)) 1483 1484 #define BCMI_MPLS_TTL_MASK_MAX (0xff) 1485 #define BCMI_MPLS_TTL_MASK_VALID(_mask_) \ 1486 (((_mask_) >= 0) && \ 1487 (((_mask_) <= BCMI_MPLS_TTL_MASK_MAX)) 1488 1489 #define BCMI_MPLS_CONSTRUCT_LABEL(val, exp, ttl, bos) \ 1490 (((val) << 12) | ((exp) << 9) | \ 1491 ((bos) << 8) | (ttl)) 1492 1493 #define BCMI_MPLS_LABEL_VAL_FROM_LABEL_GET(mpls_label)\ 1494 (((mpls_label) >> 12) & 0xFFFFF) 1495 1496 #define BCMI_MPLS_EXP_FROM_LABEL_GET(mpls_label) \ 1497 (((mpls_label) >> 9) & 0x7) 1498 1499 #define BCMI_MPLS_BOS_FROM_LABEL_GET(mpls_label) \ 1500 (((mpls_label) >> 8) & 0x1) 1501 1502 #define BCMI_MPLS_TTL_FROM_LABEL_GET(mpls_label) \ 1503 ((mpls_label) & 0xFF) 1504 1505 /***************** Function Decalarations *********************/ 1506 extern int bcmi_mpls_special_label_init(int unit); 1507 extern void bcmi_mpls_special_label_deinit(int unit); 1508 1509 extern int bcmi_mpls_special_label_identifier_add(int unit, 1510 bcm_mpls_special_label_type_t label_type, 1511 bcm_mpls_special_label_t label_info); 1512 extern int bcmi_mpls_special_label_identifier_get(int unit, 1513 bcm_mpls_special_label_type_t label_type, 1514 bcm_mpls_special_label_t *label_info); 1515 extern int bcmi_mpls_special_label_identifier_delete(int unit, 1516 bcm_mpls_special_label_type_t label_type, 1517 bcm_mpls_special_label_t label_info); 1518 extern int bcmi_mpls_special_label_identifier_delete_all(int unit); 1519 extern int bcmi_mpls_special_label_identifier_traverse(int unit, 1520 bcm_mpls_special_label_identifier_traverse_cb cb, 1521 void *user_data); 1522 1523 1524 extern int bcmi_mpls_special_label_egress_add(int unit, 1525 bcm_mpls_special_label_type_t label_type, 1526 bcm_mpls_special_label_t label_info); 1527 extern int bcmi_mpls_special_label_egress_get(int unit, 1528 bcm_mpls_special_label_type_t label_type, 1529 bcm_mpls_special_label_t *label_info); 1530 extern int bcmi_mpls_special_label_egress_delete(int unit, 1531 bcm_mpls_special_label_type_t label_type, 1532 bcm_mpls_special_label_t label_info); 1533 extern int bcmi_mpls_special_label_egress_delete_all(int unit); 1534 extern int bcmi_mpls_special_label_egress_traverse(int unit, 1535 bcm_mpls_special_label_egress_traverse_cb cb, 1536 void *user_data); 1537 1538 extern int bcmi_mpls_special_label_push_action_set(int unit, 1539 bcm_mpls_special_label_push_element_t *element, 1540 bcm_mpls_special_label_push_type_t push_type); 1541 1542 extern int bcmi_mpls_special_label_push_action_get(int unit, 1543 bcm_mpls_special_label_push_element_t *element, 1544 bcm_mpls_special_label_push_type_t *push_type); 1545 1546 extern int _bcm_td3_def_vfi_profile_add(int unit, 1547 int is_eline, uint32 *profile_index); 1548 1549 /***************** Structure Decalarations *********************/ 1550 1551 typedef struct bcmi_mpls_special_label_control_s { 1552 uint32 label_value; 1553 uint32 label_mask; 1554 int label_type; 1555 int valid; 1556 int ref_count; 1557 int cancun_added; 1558 }bcmi_mpls_special_label_control_t; 1559 1560 extern bcmi_mpls_special_label_control_t *bcmi_special_label_precedence_state[BCM_MAX_NUM_UNITS]; 1561 1562 /***************************************************************/ 1563 #endif /*BCM_SPECIAL_LABEL_SUPPORT*/ 1564 #endif 1565 #endif /* BCM_FIREBOLT6_SUPPORT */ 1566 1567 #if defined(BCM_CHANNELIZED_SWITCHING_SUPPORT) 1568 typedef struct bcmi_mc_group_chnl_info_s { 1569 uint32 l3_pbm_port_refcount[SOC_MAX_NUM_PORTS]; 1570 } bcmi_mc_group_chnl_info_t; 1571 1572 extern bcmi_mc_group_chnl_info_t **bcmi_mc_group_chnl_info[BCM_MAX_NUM_UNITS]; 1573 1574 /* refcount value of port on that multicast group. */ 1575 #define BCMI_MC_GROUP_REFCOUNT_INFO(u, m) \ 1576 (((bcmi_mc_group_chnl_info[u])[m])->l3_pbm_port_refcount) 1577 1578 /* refcount value of port on that multicast group. */ 1579 #define BCMI_MC_GROUP_PORT_REFCOUNT(u, m, p) \ 1580 (((bcmi_mc_group_chnl_info[u])[m])->l3_pbm_port_refcount[p]) 1581 1582 #if 0 1583 /* forwarding port of this trunk on that multicast group. */ 1584 #define BCMI_MC_GROUP_TRUNK_FWD_SUBPORT(u, m, t) \ 1585 (((bcmi_mc_group_chnl_info[u])[m]).trunk_fwd_subport[t]) 1586 #endif 1587 1588 /* Clear the refcount for all ports in that multicast group. */ 1589 #define BCMI_MC_GROUP_PORT_REFCOUNT_CLEAR(u, m) \ 1590 do { \ 1591 if (soc_feature(unit, soc_feature_channelized_switching)) { \ 1592 sal_memset( \ 1593 ((bcmi_mc_group_chnl_info[u])[m])->l3_pbm_port_refcount, \ 1594 0, SOC_MAX_NUM_PORTS * sizeof(uint32)); \ 1595 } \ 1596 } while(0); 1597 #endif /* BCM_CHANNELIZED_SWITCHING_SUPPORT */ 1598 1599 1600 #if defined(BCM_FLOWTRACKER_V3_SUPPORT) 1601 #define _BCM_FIELD_FB6_INGRESS_FLOWTRACKER_MAX_SMALL_SLICES 1 1602 #define _BCM_FIELD_FB6_INGRESS_FLOWTRACKER_SMALL_SLICE_SZ 2048 1603 #define _BCM_FIELD_FB6_INGRESS_FLOWTRACKER_LARGE_SLICE_SZ 1024 1604 1605 /* Reserve entries in aggregate mmu and egress flowtracker stage 1606 * slice to prevent HIT when ACID is not set. 1607 */ 1608 #define _BCM_FIELD_FB6_AFT_RESERVED_ENTRIES 1 1609 1610 extern int _field_fb6_amftstage_init(int unit, 1611 _field_control_t *fc, 1612 _field_stage_t *stage_fc); 1613 1614 extern int _field_fb6_aeftstage_init(int unit, 1615 _field_control_t *fc, 1616 _field_stage_t *stage_fc); 1617 1618 extern int _field_fb6_aft_tcam_policy_init(int unit, 1619 _field_stage_t *stage_fc); 1620 1621 extern int _field_fb6_aft_entry_policy_mem_install(int unit, 1622 _field_entry_t *f_ent, 1623 soc_mem_t policy_mem, 1624 int tcam_idx); 1625 1626 extern int _field_fb6_aft_entry_qual_tcam_install(int unit, 1627 _field_entry_t *f_ent, 1628 soc_mem_t tcam_mem, 1629 int tcam_idx); 1630 1631 extern int _bcm_field_fb6_ft_user_entry_hw_alloc(int unit, 1632 _field_entry_t *f_ent, 1633 _field_action_t *fa); 1634 1635 extern int _bcm_field_fb6_ft_user_entry_hw_free(int unit, 1636 _field_entry_t *f_ent, 1637 _field_action_t *fa, 1638 uint32 flags); 1639 1640 extern int _bcm_field_fb6_ft_aggregate_class_hw_alloc(int unit, 1641 _field_entry_t *f_ent, 1642 _field_action_t *fa); 1643 1644 extern int _bcm_field_fb6_ft_aggregate_class_hw_free(int unit, 1645 _field_entry_t *f_ent, 1646 _field_action_t *fa, 1647 uint32 flags); 1648 1649 extern int _bcm_field_fb6_entry_sw_to_hw_tcam_idx(int unit, 1650 _field_slice_t *fs, 1651 int sw_tcam_idx, 1652 int *hw_tcam_idx); 1653 1654 extern int _bcm_field_fb6_entry_hw_to_sw_tcam_idx(int unit, 1655 _field_slice_t *fs, 1656 int hw_tcam_idx, 1657 int *sw_tcam_idx); 1658 1659 extern int _bcm_field_fb6_qualify_cos_queueid(int unit, 1660 bcm_field_entry_t entry, 1661 bcm_gport_t queue_gport); 1662 1663 extern int _bcm_field_fb6_qualify_cos_queueid_get(int unit, 1664 bcm_field_entry_t entry, 1665 bcm_gport_t *queue_gport); 1666 1667 #endif /* BCM_FLOWTRACKER_V3_SUPPORT */ 1668 1669 /* Compression related */ 1670 extern int 1671 _field_fb6_compress_init(int unit, _field_stage_t *stage_fc); 1672 extern int 1673 _field_fb6_compress_deinit(int unit, _field_stage_t *stage_fc); 1674 extern int 1675 _bcm_field_fb6_compress_qualify_set(int unit, _field_entry_t *f_ent, 1676 bcm_field_qualify_t qual, 1677 uint32 *data, uint32 *mask); 1678 extern int 1679 _bcm_field_fb6_compress_entry_qualifier_key_get(int unit, _field_entry_t *f_ent, 1680 bcm_field_qualify_t qual, 1681 _bcm_field_qual_data_t data, 1682 _bcm_field_qual_data_t mask); 1683 extern int 1684 _bcm_field_fb6_compress_entry_install(int unit, _field_entry_t *f_ent); 1685 extern int 1686 _bcm_field_fb6_compress_entry_remove(int unit, _field_entry_t *f_ent); 1687 extern int 1688 _bcm_field_fb6_compress_entry_destroy(int unit, _field_entry_t *f_ent); 1689 1690 #ifdef BCM_WARM_BOOT_SUPPORT 1691 extern int _bcm_field_fb6_compress_scache_allocate(int unit); 1692 extern int _bcm_field_fb6_compress_scache_sync(int unit); 1693 extern int _bcm_field_fb6_compress_scache_recovery(int unit); 1694 #endif 1695 1696 extern int 1697 _bcm_fb6_cosq_gport_hw_qnum_get(int unit, 1698 bcm_gport_t gport, 1699 int *qnum); 1700 1701 extern int 1702 _bcm_fb6_cosq_hw_qnum_gport_get(int unit, 1703 int qnum, 1704 bcm_gport_t *gport); 1705 1706 #endif /* !_BCM_INT_FIREBOLT6_H_ */ 1707