greyhound2.h (18772B)
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 8 #ifndef _BCM_INT_GREYHOUND2_H_ 9 #define _BCM_INT_GREYHOUND2_H_ 10 #if defined(BCM_GREYHOUND2_SUPPORT) 11 #include <bcm_int/esw/mbcm.h> 12 #include <bcm_int/esw/vxlan.h> 13 #include <bcm_int/esw/cosq.h> 14 #ifdef BCM_FIELD_SUPPORT 15 #include <bcm_int/esw/field.h> 16 #endif /* BCM_FIELD_SUPPORT */ 17 #include <bcm_int/esw/port.h> 18 #include <bcm_int/esw/switch_match.h> 19 #ifdef BCM_TAS_SUPPORT 20 #include <bcm_int/esw/tas.h> 21 #endif /* BCM_TAS_SUPPORT */ 22 #include <bcm_int/esw/policer.h> 23 #include <bcm_int/esw/preemption_cnt.h> 24 #if defined(BCM_TSN_SUPPORT) 25 #include <bcm_int/esw/tsn.h> 26 #include <bcm_int/esw/tsn_taf.h> 27 #include <bcm_int/esw/tsn_stat.h> 28 #endif /* BCM_TSN_SUPPORT */ 29 #include <soc/greyhound2.h> 30 #if defined(BCM_FIRELIGHT_SUPPORT) 31 #include <soc/firelight.h> 32 #endif /* BCM_FIRELIGHT_SUPPORT */ 33 34 extern int bcm_td_l2_myStation_add(int unit, bcm_l2_addr_t *l2addr); 35 extern int bcm_td_l2_myStation_delete(int unit, bcm_mac_t mac, bcm_vlan_t vid, 36 int *l2_index); 37 extern int bcm_td_l2_myStation_get(int unit, bcm_mac_t mac, bcm_vlan_t vid, 38 bcm_l2_addr_t *l2addr); 39 40 extern int bcm_td_l2cache_myStation_set(int unit, int index, 41 bcm_l2_cache_addr_t *l2addr); 42 extern int bcm_td_l2cache_myStation_get(int unit, int index, 43 bcm_l2_cache_addr_t *l2addr); 44 extern int bcm_td_l2cache_myStation_delete(int unit, int index); 45 extern int bcm_td_l2cache_myStation_lookup(int unit, 46 bcm_l2_cache_addr_t *l2caddr, 47 int *result_index); 48 49 50 #ifdef BCM_FIELD_SUPPORT 51 extern int _bcm_field_gh2_init(int unit, _field_control_t *fc); 52 #endif /* BCM_FIELD_SUPPORT */ 53 54 55 extern int bcmi_gh2_cosq_drop_status_enable_set(int unit, bcm_port_t port, 56 int enable); 57 58 extern int 59 bcm_gh2_switch_control_port_set( 60 int unit, 61 bcm_port_t port, 62 bcm_switch_control_t type, 63 int arg); 64 extern int 65 bcm_gh2_switch_control_port_get( 66 int unit, 67 bcm_port_t port, 68 bcm_switch_control_t type, 69 int *arg); 70 extern int 71 bcm_gh2_switch_control_set(int unit, bcm_switch_control_t type, int arg); 72 extern int 73 bcm_gh2_switch_control_get(int unit, bcm_switch_control_t type, int *arg); 74 extern int _bcm_gh2_switch_init(int unit); 75 76 #ifdef BCM_WARM_BOOT_SUPPORT 77 extern int bcmi_gh2_cosq_sync(int unit); 78 #endif /* BCM_WARM_BOOT_SUPPORT */ 79 #ifndef BCM_SW_STATE_DUMP_DISABLE 80 extern void bcmi_gh2_cosq_sw_dump(int unit); 81 #endif /* BCM_SW_STATE_DUMP_DISABLE */ 82 extern int bcmi_gh2_cosq_init(int unit); 83 extern int bcmi_gh2_cosq_detach(int unit, int software_state_only); 84 extern int bcmi_gh2_cosq_config_set(int unit, int numq); 85 extern int bcmi_gh2_cosq_config_get(int unit, int *numq); 86 extern int bcmi_gh2_cosq_port_bandwidth_set(int unit, bcm_port_t port, 87 bcm_cos_queue_t cosq, 88 uint32 kbits_sec_min, 89 uint32 kbits_sec_max, 90 uint32 kbits_sec_burst, 91 uint32 flags); 92 extern int bcmi_gh2_cosq_port_bandwidth_get(int unit, bcm_port_t port, 93 bcm_cos_queue_t cosq, 94 uint32 *kbits_sec_min, 95 uint32 *kbits_sec_max, 96 uint32 *kbits_sec_burst, 97 uint32 *flags); 98 extern int bcmi_gh2_cosq_discard_set(int unit, uint32 flags); 99 extern int bcmi_gh2_cosq_discard_get(int unit, uint32 *flags); 100 extern int bcmi_gh2_cosq_gport_discard_set(int unit, bcm_gport_t port, 101 bcm_cos_queue_t cosq, 102 bcm_cosq_gport_discard_t *discard); 103 extern int bcmi_gh2_cosq_gport_discard_get(int unit, bcm_gport_t port, 104 bcm_cos_queue_t cosq, 105 bcm_cosq_gport_discard_t *discard); 106 extern int bcmi_gh2_cosq_discard_port_set(int unit, bcm_port_t port, 107 bcm_cos_queue_t cosq, 108 uint32 color, 109 int drop_start, 110 int drop_slope, 111 int average_time); 112 extern int bcmi_gh2_cosq_discard_port_get(int unit, bcm_port_t port, 113 bcm_cos_queue_t cosq, 114 uint32 color, 115 int *drop_start, 116 int *drop_slope, 117 int *average_time); 118 extern int 119 bcmi_gh2_cosq_wred_port_control_set(int unit, 120 bcm_gport_t gport, 121 bcm_port_control_t type, 122 int value); 123 extern int 124 bcmi_gh2_cosq_wred_port_control_get(int unit, 125 bcm_gport_t gport, 126 bcm_port_control_t type, 127 int *value); 128 129 130 extern int bcmi_gh2_cosq_sched_weight_max_get(int unit, int mode, 131 int *weight_max); 132 extern int bcmi_gh2_cosq_port_sched_set(int unit, bcm_pbmp_t pbm, 133 int mode, const int weights[], 134 int delay); 135 extern int bcmi_gh2_cosq_port_sched_get(int unit, bcm_pbmp_t pbm, 136 int *mode, int weights[], int *delay); 137 extern int bcmi_gh2_cosq_mapping_set(int unit, bcm_port_t port, 138 bcm_cos_t priority, bcm_cos_queue_t cosq); 139 extern int bcmi_gh2_cosq_mapping_get(int unit, bcm_port_t port, 140 bcm_cos_t priority, bcm_cos_queue_t *cosq); 141 extern int bcmi_gh2_cosq_gport_bandwidth_set(int unit, bcm_gport_t gport, 142 bcm_cos_queue_t cosq, 143 uint32 kbits_sec_min, 144 uint32 kbits_sec_max, uint32 flags); 145 extern int bcmi_gh2_cosq_gport_bandwidth_get(int unit, bcm_gport_t gport, 146 bcm_cos_queue_t cosq, 147 uint32 *kbits_sec_min, 148 uint32 *kbits_sec_max, 149 uint32 *flags); 150 extern int bcmi_gh2_cosq_gport_sched_set(int unit, bcm_gport_t gport, 151 bcm_cos_queue_t cosq, int mode, 152 int weight); 153 extern int bcmi_gh2_cosq_gport_sched_get(int unit, bcm_gport_t gport, 154 bcm_cos_queue_t cosq, int *mode, 155 int *weight); 156 extern int bcmi_gh2_cosq_gport_bandwidth_burst_set(int unit, bcm_gport_t gport, 157 bcm_cos_queue_t cosq, 158 uint32 kbits_burst); 159 extern int bcmi_gh2_cosq_gport_bandwidth_burst_get(int unit, bcm_gport_t gport, 160 bcm_cos_queue_t cosq, 161 uint32 *kbits_burst); 162 extern int bcmi_gh2_cosq_control_set(int unit, bcm_gport_t gport, 163 bcm_cos_queue_t cosq, 164 bcm_cosq_control_t type, int arg); 165 extern int bcmi_gh2_cosq_control_get(int unit, bcm_gport_t gport, 166 bcm_cos_queue_t cosq, 167 bcm_cosq_control_t type, int *arg); 168 extern int bcmi_gh2_cosq_stat_get(int unit, bcm_gport_t gport, 169 bcm_cos_queue_t cosq, 170 bcm_cosq_stat_t stat, int sync_mode, 171 uint64 *value); 172 extern int bcmi_gh2_cosq_stat_set(int unit, bcm_gport_t port, 173 bcm_cos_queue_t cosq, 174 bcm_cosq_stat_t stat, uint64 value); 175 extern int bcmi_gh2_cosq_gport_add(int unit, bcm_gport_t port, int numq, 176 uint32 flags, bcm_gport_t *gport); 177 extern int bcmi_gh2_cosq_gport_delete(int unit, bcm_gport_t gport); 178 extern int bcmi_gh2_cosq_gport_traverse(int unit, bcm_cosq_gport_traverse_cb cb, 179 void *user_data); 180 extern int bcmi_gh2_cosq_gport_get(int unit, bcm_gport_t gport, 181 bcm_gport_t *port, 182 int *numq, uint32 *flags); 183 extern int bcmi_gh2_cosq_gport_attach(int unit, bcm_gport_t gport, 184 bcm_gport_t to_gport, 185 bcm_cos_queue_t to_cosq); 186 extern int bcmi_gh2_cosq_gport_detach(int unit, bcm_gport_t gport, 187 bcm_gport_t input_gport, 188 bcm_cos_queue_t cosq); 189 extern int bcmi_gh2_cosq_gport_attach_get(int unit, bcm_gport_t gport, 190 bcm_gport_t *input_gport, 191 bcm_cos_queue_t *cosq); 192 extern int bcmi_gh2_cosq_gport_child_get(int unit, bcm_gport_t in_gport, 193 bcm_cos_queue_t cosq, 194 bcm_gport_t *out_gport); 195 extern int bcmi_gh2_cosq_port_resolve(int unit, bcm_gport_t gport, 196 bcm_module_t *modid, 197 bcm_port_t *port, bcm_trunk_t *trunk_id, 198 int *id); 199 extern int bcmi_gh2_cosq_index_resolve(int unit, bcm_gport_t gport, int *cosq); 200 201 extern int 202 bcmi_gh2_cosq_port_pfc_op(int unit, 203 bcm_port_t port, 204 bcm_switch_control_t sctype, 205 _bcm_cosq_op_t op, 206 int cosq); 207 extern int 208 bcmi_gh2_cosq_port_pfc_get(int unit, 209 bcm_port_t port, 210 bcm_switch_control_t sctype, 211 int *cosq); 212 213 extern int bcmi_gh2_preemption_capability_set(int unit, bcm_port_t port, 214 uint32 arg); 215 extern int bcmi_gh2_preemption_queue_bitmap_set(int unit, bcm_port_t port, 216 uint32 arg); 217 extern int bcmi_gh2_preemption_hold_request_mode_set(int unit, bcm_port_t port, 218 uint32 arg); 219 extern int bcmi_gh2_preemption_frag_config_tx_set(int unit, bcm_port_t port, 220 int is_final, 221 uint32 value); 222 extern int bcmi_gh2_preemption_capability_get(int unit, bcm_port_t port, 223 uint32* arg); 224 extern int bcmi_gh2_preemption_queue_bitmap_get(int unit, bcm_port_t port, 225 uint32* arg); 226 extern int bcmi_gh2_preemption_hold_request_mode_get(int unit, bcm_port_t port, 227 uint32* arg); 228 extern int bcmi_gh2_port_mac_type_get(int unit, soc_port_t port, 229 bcmi_port_mac_type_t *port_type); 230 extern int bcmi_gh2_preemption_frag_config_tx_get(int unit, bcm_port_t port, 231 int is_final, 232 uint32* value); 233 extern int bcmi_gh2_cosq_event_mask_set(int unit, 234 bcm_cosq_event_type_t event_type, 235 int val); 236 extern int bcmi_gh2_cosq_events_validate(int unit, 237 bcm_cosq_event_types_t event_types); 238 239 extern int bcmi_gh2_port_force_lb_set(int unit); 240 #if defined(INCLUDE_L3) 241 /* Library-private functions exported from vxlan.c */ 242 extern int 243 bcmi_gh2_vxlan_udp_dest_port_set( 244 int unit, 245 bcm_switch_control_t type, 246 int udp_destport); 247 extern int 248 bcmi_gh2_vxlan_udp_dest_port_get( 249 int unit, 250 bcm_switch_control_t type, 251 int *udp_destport); 252 extern int 253 bcmi_gh2_vxlan_udp_source_port_set( 254 int unit, 255 bcm_switch_control_t type, 256 int hash_enable); 257 extern int 258 bcmi_gh2_vxlan_udp_source_port_get( 259 int unit, 260 bcm_switch_control_t type, 261 int *hash_enable); 262 extern int 263 bcmi_gh2_vxlan_egress_get(int unit, bcm_l3_egress_t *egr, int nh_index); 264 extern int 265 bcmi_gh2_vxlan_tunnel_initiator_cmp( 266 int unit, 267 void *buf, 268 int index, 269 int *cmp_result); 270 extern int 271 bcmi_gh2_vxlan_tunnel_initiator_hash_calc(int unit, void *buf, uint16 *hash); 272 273 extern int 274 bcmi_gh2_vxlan_port_resolve( 275 int unit, 276 bcm_gport_t l2gre_port_id, 277 bcm_if_t encap_id, 278 bcm_module_t *modid, 279 bcm_port_t *port, 280 bcm_trunk_t *trunk_id, 281 int *id); 282 283 extern int 284 bcmi_gh2_vxlan_lock(int unit); 285 extern void 286 bcmi_gh2_vxlan_unlock(int unit); 287 extern int 288 bcmi_gh2_vxlan_init(int unit); 289 extern int 290 bcmi_gh2_vxlan_cleanup(int unit); 291 extern int 292 bcmi_gh2_vxlan_vpn_create(int unit, bcm_vxlan_vpn_config_t *info); 293 extern int 294 bcmi_gh2_vxlan_vpn_destroy(int unit, bcm_vpn_t l2vpn); 295 extern int 296 bcmi_gh2_vxlan_vpn_destroy_all(int unit); 297 extern int 298 bcmi_gh2_vxlan_vpn_get( 299 int unit, 300 bcm_vpn_t l2vpn, 301 bcm_vxlan_vpn_config_t *info); 302 extern int 303 bcmi_gh2_vxlan_vpn_traverse( 304 int unit, 305 bcm_vxlan_vpn_traverse_cb cb, 306 void *user_data); 307 extern int 308 bcmi_gh2_vxlan_port_traverse( 309 int unit, 310 bcm_vxlan_port_traverse_cb cb, 311 void *user_data); 312 extern int 313 bcmi_gh2_vxlan_tunnel_terminator_create( 314 int unit, 315 bcm_tunnel_terminator_t *tnl_info); 316 extern int 317 bcmi_gh2_vxlan_tunnel_terminator_update( 318 int unit, 319 bcm_tunnel_terminator_t *tnl_info); 320 extern int 321 bcmi_gh2_vxlan_tunnel_terminator_destroy( 322 int unit, 323 bcm_gport_t vxlan_tunnel_id); 324 extern int 325 bcmi_gh2_vxlan_tunnel_terminator_destroy_all(int unit); 326 extern int 327 bcmi_gh2_vxlan_tunnel_terminator_get( 328 int unit, 329 bcm_tunnel_terminator_t *tnl_info); 330 extern int 331 bcmi_gh2_vxlan_tunnel_terminator_traverse( 332 int unit, 333 bcm_tunnel_terminator_traverse_cb cb, 334 void *user_data); 335 extern int 336 bcmi_gh2_vxlan_tunnel_initiator_create(int unit, bcm_tunnel_initiator_t *info); 337 extern int 338 bcmi_gh2_vxlan_tunnel_initiator_destroy( 339 int unit, 340 bcm_gport_t vxlan_tunnel_id); 341 extern int 342 bcmi_gh2_vxlan_tunnel_initiator_destroy_all(int unit); 343 extern int 344 bcmi_gh2_vxlan_tunnel_initiator_get(int unit, bcm_tunnel_initiator_t *info); 345 extern int 346 bcmi_gh2_vxlan_tunnel_initiator_traverse( 347 int unit, 348 bcm_tunnel_initiator_traverse_cb cb, 349 void *user_data); 350 extern int 351 bcmi_gh2_vxlan_trunk_member_delete( 352 int unit, 353 bcm_trunk_t trunk_id, 354 int trunk_member_count, 355 bcm_port_t *trunk_member_array); 356 extern int 357 bcmi_gh2_vxlan_port_add( 358 int unit, 359 bcm_vpn_t vpn, 360 bcm_vxlan_port_t *vxlan_port); 361 extern int 362 bcmi_gh2_vxlan_port_delete( 363 int unit, 364 bcm_vpn_t vpn, 365 bcm_gport_t vxlan_port_id); 366 extern int 367 bcmi_gh2_vxlan_port_delete_all(int unit, bcm_vpn_t vpn); 368 extern int 369 bcmi_gh2_vxlan_port_get( 370 int unit, 371 bcm_vpn_t vpn, 372 bcm_vxlan_port_t *vxlan_port); 373 extern int 374 bcmi_gh2_vxlan_port_get_all( 375 int unit, 376 bcm_vpn_t vpn, 377 int port_max, 378 bcm_vxlan_port_t *port_array, 379 int *port_count); 380 extern int 381 bcmi_gh2_vxlan_port_to_nh_ecmp_index( 382 int unit, 383 int vp, 384 int *ecmp, 385 int *nh_ecmp_index); 386 extern int 387 bcmi_gh2_vxlan_port_from_nh_ecmp_index( 388 int unit, 389 int ecmp, 390 int nh_ecmp_index, 391 int *vp); 392 extern int 393 bcmi_gh2_vxlan_vfi_used_get(int unit, int vfi); 394 extern int 395 bcmi_gh2_vxlan_vfi_to_vpn_get(int unit, int vfi_index, bcm_vlan_t *vid); 396 extern int 397 bcmi_gh2_vxlan_vp_used_get(int unit,int vp); 398 extern int 399 bcmi_gh2_vxlan_egress_entry_mac_replace( 400 int unit, 401 int nh_index, 402 bcm_l3_egress_t *egr); 403 404 extern int 405 bcmi_gh2_l3_intf_qos_set( 406 int unit, 407 uint32 *l3_if_entry_p, 408 _bcm_l3_intf_cfg_t *intf_info); 409 extern int 410 bcmi_gh2_l3_intf_qos_get( 411 int unit, 412 uint32 *l3_if_entry_p, 413 _bcm_l3_intf_cfg_t *intf_info); 414 extern int 415 bcmi_gh2_vlan_control_vpn_set( 416 int unit, 417 bcm_vlan_t vid, 418 uint32 valid_fields, 419 bcm_vlan_control_vlan_t * control); 420 extern int 421 bcmi_gh2_vlan_control_vpn_get( 422 int unit, 423 bcm_vlan_t vid, 424 uint32 valid_fields, 425 bcm_vlan_control_vlan_t * control); 426 427 #ifdef BCM_WARM_BOOT_SUPPORT 428 extern int bcmi_gh2_vxlan_sync(int unit); 429 #endif /* BCM_WARM_BOOT_SUPPORT */ 430 #ifndef BCM_SW_STATE_DUMP_DISABLE 431 extern void 432 bcmi_gh2_vxlan_sw_dump(int unit); 433 #endif /* BCM_SW_STATE_DUMP_DISABLE */ 434 #endif /* INCLUDE_L3 */ 435 436 #if defined(BCM_PREEMPTION_SUPPORT) 437 extern int bcmi_gh2_preemption_counter_dev_func_init( 438 bcmi_preemption_counte_func_t* dev_func); 439 #endif /* BCM_PREEMPTION_SUPPORT */ 440 441 #ifdef BCM_TAS_SUPPORT 442 extern int bcmi_gh2_tas_drv_init(int unit, const tas_drv_t **func); 443 extern int bcmi_gh2_tas_port_validate(int unit, bcm_port_t port); 444 #endif /* BCM_TAS_SUPPORT */ 445 446 #if defined(BCM_TSN_SUPPORT) 447 extern int 448 bcmi_gh2_tsn_info_init( 449 int unit, 450 const bcmi_esw_tsn_dev_info_t **devinfo); 451 extern int 452 bcmi_gh2_tsn_noninit_dev_info_get( 453 int unit, 454 const bcmi_esw_tsn_dev_info_t **devinfo); 455 extern int 456 bcmi_gh2_tsn_stat_info_init( 457 int unit, 458 const bcmi_esw_tsn_stat_dev_info_t **devinfo); 459 extern int 460 bcmi_gh2_taf_info_init( 461 int unit, 462 const bcmi_tsn_taf_dev_info_t **devinfo); 463 extern int 464 bcmi_gh2_tsn_info_detach(int unit); 465 #endif /* BCM_TSN_SUPPORT */ 466 467 extern int 468 bcmi_gh2_global_meter_dev_info_init( 469 int unit, 470 const bcmi_global_meter_dev_info_t **dev_info); 471 extern int 472 bcmi_gh2_switch_chip_info_get(int unit, 473 bcm_switch_chip_info_t info_type, 474 int max_size, 475 void *data_buf, 476 int *actual_size); 477 #ifdef BCM_SWITCH_MATCH_SUPPORT 478 /* ################ Switch Match related ################### */ 479 extern int 480 bcmi_gh2_switch_match_dev_info_init( 481 int unit, 482 const bcmi_switch_match_dev_info_t **dev_info); 483 #endif /* BCM_SWITCH_MATCH_SUPPORT */ 484 485 #endif /* BCM_GREYHOUND2_SUPPORT */ 486 #endif /* !_BCM_INT_GREYHOUND2_H_ */ 487