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