trident2.h (84103B)
1 /* 2 * 3 * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file. 4 * 5 * Copyright 2007-2019 Broadcom Inc. All rights reserved. 6 * 7 * File: trident2.h 8 * Purpose: Function declarations for Trident2 Internal functions. 9 */ 10 11 #ifndef _BCM_INT_TRIDENT2_H_ 12 #define _BCM_INT_TRIDENT2_H_ 13 14 #if defined(BCM_TRIDENT2_SUPPORT) 15 16 #include <bcm_int/esw/mbcm.h> 17 #include <bcm_int/esw/firebolt.h> 18 #include <bcm_int/esw/cosq.h> 19 #include <bcm_int/esw/vxlan.h> 20 #include <bcm_int/esw/vlan.h> 21 #include <bcm_int/esw/l3.h> 22 23 #endif /* BCM_TRIDENT2_SUPPORT */ 24 25 #if defined(BCM_TRIDENT2_SUPPORT) || defined(BCM_PE_SUPPORT) 26 #include <bcm_int/esw/switch.h> 27 #include <bcm_int/esw/flex_ctr.h> 28 #if defined(INCLUDE_L3) 29 #include <bcm_int/esw/l2.h> 30 #include <bcm_int/esw/port.h> 31 #include <bcm/extender.h> 32 #endif /* INCLUDE_L3 */ 33 #endif /* BCM_TRIDENT2_SUPPORT || BCM_PE_SUPPORT */ 34 35 #if defined(BCM_TRIDENT2_SUPPORT) 36 extern int bcm_td2_l2_init(int unit); 37 38 extern int bcm_td2_port_rate_ingress_set(int unit, bcm_port_t port, 39 uint32 bandwidth, uint32 burst); 40 extern int bcm_td2_port_rate_ingress_get(int unit, bcm_port_t port, 41 uint32 *bandwidth, uint32 *burst); 42 extern int bcm_td2_port_rate_pause_get(int unit, bcm_port_t port, 43 uint32 *pause, uint32 *resume); 44 extern int bcm_td2_port_rate_egress_set(int unit, bcm_port_t port, 45 uint32 bandwidth, uint32 burst, 46 uint32 mode); 47 extern int bcm_td2_port_rate_egress_get(int unit, bcm_port_t port, 48 uint32 *bandwidth, uint32 *burst, 49 uint32 *mode); 50 extern int bcm_td2_port_drain_cells(int unit, int port); 51 extern int _bcm_td2_port_drain_cells(int unit, int port); 52 extern int _bcm_td2_nh_nat_id_update_by_l3_intf(int unit, 53 bcm_if_t intf, int nat_id); 54 extern int _bcm_td2_nh_nat_id_update_by_l3_iif(int unit, 55 bcm_if_t l3_iif, int nat_id); 56 extern int _bcm_td2_nh_nat_id_update_by_vlan(int unit, 57 bcm_vlan_t vlan, int nat_id); 58 #if defined(BCM_FIELD_SUPPORT) 59 extern int _bcm_field_td2_lookup_slice_clear(int unit, unsigned slice_num); 60 extern int _bcm_field_td2_stage_init(int unit, _field_stage_t *stage_fc); 61 extern int _bcm_field_td2_init(int unit, _field_control_t *fc); 62 extern int _bcm_field_td2_qual_tcam_key_mask_set(int unit, 63 _field_entry_t *f_ent, 64 unsigned validf); 65 extern int _bcm_field_td2_egress_selcode_set(int unit, 66 _field_group_t *fg, 67 uint32 efp_slice_mode, 68 uint32 efp_key_mode, 69 uint32 key_match_type, 70 int *parts_count); 71 extern int _bcm_field_td2_group_construct_quals_add(int unit, 72 _field_control_t *fc, 73 _field_stage_t *stage_fc, 74 uint8 entry_type, 75 _field_group_t *fg, 76 int8 pri_key1, 77 int8 pri_key2 78 ); 79 extern int _bcm_field_td2_qual_tcam_key_mask_get(int unit, 80 _field_entry_t *f_ent, 81 _field_tcam_t *tcam); 82 extern int _bcm_field_td2_qualify_PacketRes(int unit, 83 bcm_field_entry_t entry, 84 uint32 *data, 85 uint32 *mask 86 ); 87 extern int _bcm_field_td2_qualify_PacketRes_get(int unit, 88 bcm_field_entry_t entry, 89 uint32 *data, 90 uint32 *mask 91 ); 92 extern int 93 _bcm_field_td2_qualify_LoopbackType(int unit, 94 bcm_field_LoopbackType_t loopback_type, 95 uint32 *tcam_data, 96 uint32 *tcam_mask 97 ); 98 extern int 99 _bcm_field_td2_qualify_LoopbackType_get(uint8 tcam_data, 100 uint8 tcam_mask, 101 bcm_field_LoopbackType_t *loopback_type 102 ); 103 extern int 104 _bcm_field_td2_qualify_TunnelType(bcm_field_TunnelType_t tunnel_type, 105 uint32 *tcam_data, 106 uint32 *tcam_mask 107 ); 108 extern int 109 _bcm_field_td2_qualify_TunnelType_get(uint8 tcam_data, 110 uint8 tcam_mask, 111 bcm_field_TunnelType_t *tunnel_type 112 ); 113 extern int _bcm_field_td2_qualify_class(int unit, 114 bcm_field_entry_t entry, 115 bcm_field_qualify_t qual, 116 uint32 *data, 117 uint32 *mask 118 ); 119 extern int _bcm_field_td2_qualify_class_get(int unit, 120 bcm_field_entry_t entry, 121 bcm_field_qualify_t qual, 122 uint32 *data, 123 uint32 *mask 124 ); 125 extern int _bcm_field_td2_action_get(int unit, 126 soc_mem_t mem, 127 _field_entry_t *f_ent, 128 int tcam_idx, 129 _field_action_t *fa, 130 uint32 *buf 131 ); 132 133 extern int _bcm_field_td2_action_conflict_check(int unit, 134 _field_entry_t *f_ent, 135 bcm_field_action_t action1, 136 bcm_field_action_t action 137 ); 138 139 extern int 140 _bcm_field_td2_hash_select_profile_ref_count_get(int unit, 141 soc_mem_t profile_mem, 142 int index, 143 int *ref_count); 144 extern int 145 _bcm_field_td2_hash_select_profile_delete(int unit, 146 soc_mem_t profile_mem, 147 int index); 148 extern int 149 _bcm_field_td2_hash_select_profile_alloc(int unit, 150 _field_entry_t *f_ent, 151 _field_action_t *fa); 152 extern int 153 _bcm_field_td2_hash_select_profile_get(int unit, 154 soc_mem_t profile_mem, 155 soc_profile_mem_t **hash_select_profile); 156 extern int 157 _bcm_field_td2_hash_select_profile_hw_free(int unit, 158 _field_entry_t *f_ent, 159 uint32 flags); 160 extern int 161 _bcm_field_td2_hash_select_profile_hw_alloc (int unit, _field_entry_t *f_ent); 162 163 extern int _bcm_field_td2_group_install(int unit, _field_group_t *fg); 164 extern int _bcm_field_td2_write_slice_map(int unit, _field_stage_t *stage_fc, 165 _field_group_t *fg); 166 167 extern int _bcm_field_td2_slice_clear(int unit, 168 _field_group_t *fg, 169 _field_slice_t *fs); 170 171 extern int _bcm_field_td2_selcodes_install(int unit, 172 _field_group_t *fg, 173 uint8 slice_num, 174 bcm_pbmp_t pbmp, 175 int selcode_idx); 176 177 extern int _bcm_field_td2_entry_move(int unit, 178 _field_entry_t *f_ent, 179 int parts_count, 180 int *tcam_idx_old, 181 int *tcam_idx_new); 182 183 extern int _bcm_field_td2_action_support_check(int unit, 184 _field_entry_t *f_ent, 185 bcm_field_action_t action, 186 int *result); 187 188 extern int _bcm_field_td2_action_params_check(int unit, 189 _field_entry_t *f_ent, 190 _field_action_t *fa); 191 192 extern int _bcm_field_td2_stage_action_support_check(int unit, 193 unsigned stage, 194 bcm_field_action_t action, 195 int *result); 196 extern int 197 _bcm_field_td2_lookup_selcodes_install(int unit, 198 _field_group_t *fg, 199 uint8 slice_num, 200 int selcode_idx 201 ); 202 extern int 203 _bcm_field_td2_lookup_mode_set(int unit, 204 uint8 slice_num, 205 _field_group_t *fg, 206 uint8 flags 207 ); 208 extern int 209 _bcm_field_td2_qualify_VlanTranslationHit(int unit, 210 bcm_field_entry_t entry, 211 uint8 *data, 212 uint8 *mask); 213 extern int 214 _bcm_field_td2_qualify_VlanTranslationHit_get(int unit, 215 bcm_field_entry_t entry, 216 uint8 *data, 217 uint8 *mask); 218 219 extern int 220 _bcm_field_td2_qualify_ip_type(int unit, bcm_field_entry_t entry, 221 bcm_field_IpType_t type, 222 bcm_field_qualify_t qual); 223 extern int 224 _bcm_field_td2_qualify_ip_type_get(int unit, bcm_field_entry_t entry, 225 bcm_field_IpType_t *type, 226 bcm_field_qualify_t qual); 227 extern int 228 _bcm_field_td2_qualify_ip_type_encode_get(int unit, uint32 hw_data, 229 uint32 hw_mask, 230 bcm_field_IpType_t *type); 231 232 #endif /* BCM_FIELD_SUPPORT */ 233 234 #define _BCM_TD2_L3_PORT_MASK 0x7f 235 #define _BCM_TD2_L3_MODID_MASK 0xff 236 #define _BCM_TD2_L3_MODID_SHIFT 0x7 237 #define _BCM_TD2_L3_DEFAULT_MTU_SIZE 0x3fff 238 #define _BCM_TD2_L3_MEM_BANKS_ALL (-1) 239 #define _BCM_TD2_HOST_ENTRY_NOT_FOUND (-1) 240 241 #if defined(INCLUDE_L3) 242 243 #define BCM_TD2_L3_USE_EMBEDDED_NEXT_HOP(_u_, _intf_, _nhidx_) \ 244 ((_nhidx_ == BCM_XGS3_L3_INVALID_INDEX) && \ 245 (!BCM_XGS3_L3_EGRESS_IDX_VALID(_u_, _intf_)) && \ 246 (!BCM_XGS3_L3_MPATH_EGRESS_IDX_VALID(_u_, _intf_)) && \ 247 (!BCM_XGS3_DVP_EGRESS_IDX_VALID(_u_, _intf_)) && \ 248 (!BCM_XGS3_PROXY_EGRESS_IDX_VALID(_u_, _intf_)) && \ 249 (BCM_XGS3_L3_EGRESS_MODE_ISSET(_u_)) && \ 250 (soc_feature(unit, soc_feature_l3_extended_host_entry))) 251 252 #define BCM_TD2_L3_HOST_TABLE_MEM(_u_, _intf_, _v6_, _mem_, _nhidx_) \ 253 _mem_ = (_v6_) ? ((BCM_TD2_L3_USE_EMBEDDED_NEXT_HOP(_u_, _intf_, _nhidx_))? \ 254 L3_ENTRY_IPV6_MULTICASTm:L3_ENTRY_IPV6_UNICASTm) : \ 255 ((BCM_TD2_L3_USE_EMBEDDED_NEXT_HOP(_u_, _intf_, _nhidx_))? \ 256 L3_ENTRY_IPV4_MULTICASTm:L3_ENTRY_IPV4_UNICASTm) 257 258 #define BCM_TD2_L3_IS_EMBEDDED_NH_TABLE(_mem_, _v6_) \ 259 (_mem_ == L3_ENTRY_IPV4_MULTICASTm && !_v6_) || \ 260 (_mem_ == L3_ENTRY_IPV4_MULTICASTm && _v6_) 261 262 #define BCM_TD2_L3_HOST_TABLE_FLD(_u_, _mem_, _v6_, _fld_) \ 263 _fld_ = (_bcm_l3_fields_t *) INT_TO_PTR((_v6_) ? \ 264 ((_mem_ == L3_ENTRY_IPV6_UNICASTm) ? \ 265 BCM_XGS3_L3_MEM_FIELDS(_u_,v6): BCM_XGS3_L3_MEM_FIELDS(_u_, v6_4)) : \ 266 ((_mem_ == L3_ENTRY_IPV4_UNICASTm) ? \ 267 BCM_XGS3_L3_MEM_FIELDS(_u_,v4): BCM_XGS3_L3_MEM_FIELDS(_u_, v4_2))) 268 269 #define BCM_TD2_L3_HOST_ENTRY_BUF(_v6_, _mem_, _buf_, _v4ent_, _v4extent_, _v6ent_, _v6extent_) \ 270 _buf_ = ((_v6_) ? \ 271 ((_mem_ == L3_ENTRY_IPV6_UNICASTm) ? (uint32 *) &_v6ent_ : \ 272 (uint32 *) &_v6extent_) : \ 273 ((_mem_ == L3_ENTRY_IPV4_UNICASTm) ? (uint32 *) &_v4ent_ : \ 274 (uint32 *) &_v4extent_)) 275 276 277 #define BCM_TD3_L3_HOST_TABLE_MEM(_u_, _intf_, _v6_, _mem_, _nhidx_) \ 278 _mem_ = (_v6_) ? ((BCM_TD2_L3_USE_EMBEDDED_NEXT_HOP(_u_, _intf_, _nhidx_))? \ 279 BCM_XGS3_L3_MEM(unit, v6_4):BCM_XGS3_L3_MEM(unit, v6)) : \ 280 ((BCM_TD2_L3_USE_EMBEDDED_NEXT_HOP(_u_, _intf_, _nhidx_))? \ 281 BCM_XGS3_L3_MEM(unit, v4_2):BCM_XGS3_L3_MEM(unit, v4)) 282 283 #define BCM_TD3_L3_HOST_TABLE_FLD(_u_, _mem_, _v6_, _fld_) \ 284 _fld_ = (_bcm_l3_fields_t *) INT_TO_PTR((_v6_) ? \ 285 (((_mem_ == L3_ENTRY_ONLY_DOUBLEm) || (_mem_ == L3_ENTRY_DOUBLEm))? \ 286 BCM_XGS3_L3_MEM_FIELDS(_u_,v6): BCM_XGS3_L3_MEM_FIELDS(_u_, v6_4)) : \ 287 (((_mem_ == L3_ENTRY_ONLY_SINGLEm) || (_mem_ == L3_ENTRY_SINGLEm))? \ 288 BCM_XGS3_L3_MEM_FIELDS(_u_,v4): BCM_XGS3_L3_MEM_FIELDS(_u_, v4_2))) 289 290 #define BCM_TD3_L3_HOST_ENTRY_BUF(_v6_, _mem_, _buf_, _v4ent_, _v4extent_, _v6ent_, _v6extent_) \ 291 _buf_ = ((_v6_) ? \ 292 (((_mem_ == L3_ENTRY_ONLY_DOUBLEm) || (_mem_ == L3_ENTRY_DOUBLEm))? (uint32 *) &_v6ent_ : \ 293 (uint32 *) &_v6extent_) : \ 294 (((_mem_ == L3_ENTRY_ONLY_SINGLEm) || (_mem_ == L3_ENTRY_SINGLEm))? (uint32 *) &_v4ent_ : \ 295 (uint32 *) &_v4extent_)) 296 297 #define BCM_TH3_L3_HOST_TABLE_MEM(_u_, _intf_, _v6_, _ipmc, _mem_, _nhidx_) \ 298 _mem_ = (_v6_) ? ((ipmc)? \ 299 BCM_XGS3_L3_MEM(unit, v6_4):BCM_XGS3_L3_MEM(unit, v6)) : \ 300 ((ipmc)? \ 301 BCM_XGS3_L3_MEM(unit, v4_2):BCM_XGS3_L3_MEM(unit, v4)) 302 303 304 #define BCM_TH3_L3_HOST_TABLE_FLD(_u_, _mem_, _v6_, _fld_) \ 305 _fld_ = (_bcm_l3_fields_t *) INT_TO_PTR((_v6_) ? \ 306 (((_mem_ == L3_ENTRY_ONLY_DOUBLEm) || (_mem_ == L3_ENTRY_DOUBLEm))? \ 307 BCM_XGS3_L3_MEM_FIELDS(_u_,v6): BCM_XGS3_L3_MEM_FIELDS(_u_, v6_4)) : \ 308 (((_mem_ == L3_ENTRY_ONLY_SINGLEm) || (_mem_ == L3_ENTRY_SINGLEm))? \ 309 BCM_XGS3_L3_MEM_FIELDS(_u_,v4): BCM_XGS3_L3_MEM_FIELDS(_u_, v4_2))) 310 311 #define BCM_TH3_L3_HOST_ENTRY_BUF(_v6_, _mem_, _buf_, _v4ent_, _v4extent_, _v6ent_, _v6extent_) \ 312 _buf_ = ((_v6_) ? \ 313 (((_mem_ == L3_ENTRY_ONLY_DOUBLEm) || (_mem_ == L3_ENTRY_DOUBLEm))? (uint32 *) &_v6ent_ : \ 314 (uint32 *) &_v6extent_) : \ 315 (((_mem_ == L3_ENTRY_ONLY_SINGLEm) || (_mem_ == L3_ENTRY_SINGLEm))? (uint32 *) &_v4ent_ : \ 316 (uint32 *) &_v4extent_)) 317 318 319 /* Add support for Extended based on Flex Counter support type */ 320 #define BCM_TD2_L3_ALPM_TABLE_MEM(_u_, _v6_, _mem_) \ 321 _mem_ = (_v6_) ? L3_DEFIP_ALPM_IPV6_64m : L3_DEFIP_ALPM_IPV4m 322 323 /* Add suport for Extended */ 324 #define BCM_TD2_L3_ALPM_ENTRY_BUF(_v6_, _mem_, _buf_, _v4ent_, _v6ent_) \ 325 _buf_ = (_v6_) ? (uint32 *)&_v6ent_ : (uint32 *)&_v4ent_ 326 327 /* L3 Internal Functions */ 328 extern int _bcm_td2_l3_ent_init(int unit, soc_mem_t mem, 329 _bcm_l3_cfg_t *l3cfg, void *l3x_entry); 330 extern int _bcm_td2_l3_ipmc_ent_init(int unit, uint32 *buf_p, 331 _bcm_l3_cfg_t *l3cfg); 332 333 /* Host table support */ 334 extern int _bcm_td2_l3_add(int unit, _bcm_l3_cfg_t *l3cfg, int nh_idx); 335 extern int _bcm_td2_l3_get(int unit, _bcm_l3_cfg_t *l3cfg, int *nh_idx); 336 extern int _bcm_td2_l3_del(int unit, _bcm_l3_cfg_t *l3cfg); 337 extern int _bcm_td2_l3_del_match(int unit, int flags, void *pattern, 338 bcm_xgs3_ent_op_cb cmp_func, 339 bcm_l3_host_traverse_cb notify_cb, void *user_data); 340 extern int _bcm_td2_l3_traverse(int unit, int flags, uint32 start, uint32 end, 341 bcm_l3_host_traverse_cb cb, void *user_data); 342 343 extern int _bcm_td2_l3_get_by_idx(int unit, void *dma_ptr, int idx, 344 _bcm_l3_cfg_t *l3cfg, int *nh_idx); 345 extern int bcm_td2_l3_conflict_get(int unit, bcm_l3_key_t *ipkey, bcm_l3_key_t *cf_array, 346 int cf_max, int *cf_count); 347 extern int bcm_td2_l3_replace(int unit, _bcm_l3_cfg_t *l3cfg); 348 extern int bcm_td2_l3_del_intf(int unit, _bcm_l3_cfg_t *l3cfg, int negate); 349 extern int 350 _bcm_td2_l3_ent_init(int unit, soc_mem_t mem, _bcm_l3_cfg_t *l3cfg, void *l3x_entry); 351 352 #ifdef ALPM_ENABLE 353 /* ALPM */ 354 extern int _bcm_td2_alpm_add(int unit, _bcm_defip_cfg_t *lpm_cfg, 355 int nh_ecmp_idx); 356 extern int _bcm_td2_alpm_del(int unit, _bcm_defip_cfg_t *lpm_cfg); 357 extern int _bcm_td2_alpm_get(int unit, _bcm_defip_cfg_t *lpm_cfg, int 358 *nh_ecmp_idx); 359 extern int _bcm_td2_alpm_find(int unit, _bcm_defip_cfg_t *lpm_cfg, 360 int *nh_ecmp_idx); 361 extern int _bcm_td2_alpm_update_match(int unit, _bcm_l3_trvrs_data_t *trv_data); 362 #endif 363 364 365 /* L3 IPMC */ 366 extern int _bcm_td2_l3_ipmc_get_by_idx(int unit, void *dma_ptr, int idx, 367 _bcm_l3_cfg_t *l3cfg); 368 extern int _bcm_td2_l3_ipmc_get(int unit, _bcm_l3_cfg_t *l3cfg); 369 extern int _bcm_td2_l3_ipmc_add(int unit, _bcm_l3_cfg_t *l3cfg); 370 extern int _bcm_td2_l3_ipmc_del(int unit, _bcm_l3_cfg_t *l3cfg); 371 extern int bcm_td2_ipmc_pim_bidir_init(int unit); 372 extern int bcm_td2_ipmc_pim_bidir_detach(int unit); 373 extern int bcm_td2_ipmc_rp_create(int unit, uint32 flags, int *rp_id); 374 extern int bcm_td2_ipmc_rp_destroy(int unit, int rp_id); 375 extern int bcm_td2_ipmc_rp_set(int unit, int rp_id, int intf_count, 376 bcm_if_t *intf_array); 377 extern int bcm_td2_ipmc_rp_get(int unit, int rp_id, int intf_max, 378 bcm_if_t *intf_array, int *intf_count); 379 extern int bcm_td2_ipmc_rp_add(int unit, int rp_id, bcm_if_t intf_id); 380 extern int bcm_td2_ipmc_rp_delete(int unit, int rp_id, bcm_if_t intf_id); 381 extern int bcm_td2_ipmc_rp_delete_all(int unit, int rp_id); 382 extern int bcm_td2_ipmc_rp_ref_count_incr(int unit, int rp_id); 383 extern int bcm_td2_ipmc_rp_ref_count_decr(int unit, int rp_id); 384 extern int bcm_td2_ipmc_range_add(int unit, int *range_id, 385 bcm_ipmc_range_t *range); 386 extern int bcm_td2_ipmc_range_delete(int unit, int range_id); 387 extern int bcm_td2_ipmc_range_delete_all(int unit); 388 extern int bcm_td2_ipmc_range_get(int unit, int range_id, 389 bcm_ipmc_range_t *range); 390 extern int bcm_td2_ipmc_range_size_get(int unit, int *size); 391 /* TD2 v6 reserved multicast */ 392 extern int _bcm_td2_ipv6_reserved_multicast_addr_set(int unit, bcm_ip6_t ip6_addr, 393 bcm_ip6_t ip6_mask); 394 extern int _bcm_td2_ipv6_reserved_multicast_addr_get(int unit, bcm_ip6_t *ip6_addr, 395 bcm_ip6_t *ip6_mask); 396 #if defined(INCLUDE_BFD) 397 extern int bcmi_td2_bfd_init(int unit); 398 #endif /* INCLUDE_BFD */ 399 400 #ifdef BCM_WARM_BOOT_SUPPORT 401 extern int bcm_td2_ipmc_pim_bidir_scache_size_get(int unit, uint32 *size); 402 extern int bcm_td2_ipmc_pim_bidir_sync(int unit, uint8 **scache_ptr); 403 extern int bcm_td2_ipmc_pim_bidir_scache_recover(int unit, uint8 **scache_ptr); 404 extern int bcm_td2_ipmc_rp_ref_count_recover(int unit, int rp_id); 405 #endif /* BCM_WARM_BOOT_SUPPORT */ 406 #ifndef BCM_SW_STATE_DUMP_DISABLE 407 extern void _bcm_td2_ipmc_pim_bidir_sw_dump(int unit); 408 extern void _bcm_td2_vxlan_sw_dump(int unit); 409 #endif /* BCM_SW_STATE_DUMP_DISABLE */ 410 411 /* Flex stat - L3 host table */ 412 extern bcm_error_t _bcm_td2_l3_host_stat_attach( 413 int unit, 414 bcm_l3_host_t *info, 415 uint32 stat_counter_id); 416 extern bcm_error_t _bcm_td2_l3_host_stat_detach( 417 int unit, 418 bcm_l3_host_t *info); 419 extern bcm_error_t _bcm_td2_l3_host_stat_counter_get( 420 int unit, 421 int sync_mode, 422 bcm_l3_host_t *info, 423 bcm_l3_stat_t stat, 424 uint32 num_entries, 425 uint32 *counter_indexes, 426 bcm_stat_value_t *counter_values); 427 extern bcm_error_t _bcm_td2_l3_host_stat_counter_set( 428 int unit, 429 bcm_l3_host_t *info, 430 bcm_l3_stat_t stat, 431 uint32 num_entries, 432 uint32 *counter_indexes, 433 bcm_stat_value_t *counter_values); 434 extern bcm_error_t _bcm_td2_l3_host_stat_id_get( 435 int unit, 436 bcm_l3_host_t *info, 437 bcm_l3_stat_t stat, 438 uint32 *stat_counter_id); 439 440 /* Flex Stat - L3 Route defip */ 441 extern bcm_error_t _bcm_td2_l3_route_stat_attach ( 442 int unit, 443 bcm_l3_route_t *info, 444 uint32 stat_counter_id); 445 extern bcm_error_t _bcm_td2_l3_route_stat_detach ( 446 int unit, 447 bcm_l3_route_t *info); 448 449 extern bcm_error_t _bcm_td2_l3_route_stat_counter_get( 450 int unit, 451 int sync_mode, 452 bcm_l3_route_t *info, 453 bcm_l3_route_stat_t stat, 454 uint32 num_entries, 455 uint32 *counter_indexes, 456 bcm_stat_value_t *counter_values); 457 458 extern bcm_error_t _bcm_td2_l3_route_stat_counter_set( 459 int unit, 460 bcm_l3_route_t *info, 461 bcm_l3_route_stat_t stat, 462 uint32 num_entries, 463 uint32 *counter_indexes, 464 bcm_stat_value_t *counter_values); 465 extern bcm_error_t _bcm_td2_l3_route_stat_multi_get( 466 int unit, 467 bcm_l3_route_t *info, 468 int nstat, 469 bcm_l3_route_stat_t *stat_arr, 470 uint64 *value_arr); 471 472 extern bcm_error_t _bcm_td2_l3_route_stat_multi_get32( 473 int unit, 474 bcm_l3_route_t *info, 475 int nstat, 476 bcm_l3_route_stat_t *stat_arr, 477 uint32 *value_arr); 478 479 extern bcm_error_t _bcm_td2_l3_route_stat_multi_set( 480 int unit, 481 bcm_l3_route_t *info, 482 int nstat, 483 bcm_l3_route_stat_t *stat_arr, 484 uint64 *value_arr); 485 486 extern bcm_error_t _bcm_td2_l3_route_stat_multi_set32( 487 int unit, 488 bcm_l3_route_t *info, 489 int nstat, 490 bcm_l3_route_stat_t *stat_arr, 491 uint32 *value_arr); 492 extern bcm_error_t _bcm_td2_l3_route_stat_id_get( 493 int unit, 494 bcm_l3_route_t *info, 495 bcm_l3_route_stat_t stat, 496 uint32 *stat_counter_id); 497 extern int _bcm_td2_ip_key_to_l3cfg( 498 int unit, bcm_l3_key_t *ipkey, 499 _bcm_l3_cfg_t *l3cfg); 500 extern int 501 _bcm_td2_l3cfg_to_ipkey( 502 int unit, bcm_l3_key_t *ipkey, _bcm_l3_cfg_t *l3cfg); 503 504 extern bcm_error_t _bcm_td2_ipmc_stat_attach( 505 int unit, 506 bcm_ipmc_addr_t *info, 507 uint32 stat_counter_id); 508 extern bcm_error_t _bcm_td2_ipmc_stat_detach( 509 int unit, 510 bcm_ipmc_addr_t *info); 511 extern bcm_error_t _bcm_td2_ipmc_stat_counter_get( 512 int unit, 513 int sync_mode, 514 bcm_ipmc_addr_t *info, 515 bcm_ipmc_stat_t stat, 516 uint32 num_entries, 517 uint32 *counter_indexes, 518 bcm_stat_value_t *counter_values); 519 extern bcm_error_t _bcm_td2_ipmc_stat_counter_set( 520 int unit, 521 bcm_ipmc_addr_t *info, 522 bcm_ipmc_stat_t stat, 523 uint32 num_entries, 524 uint32 *counter_indexes, 525 bcm_stat_value_t *counter_values); 526 extern bcm_error_t _bcm_td2_ipmc_stat_id_get( 527 int unit, 528 bcm_ipmc_addr_t *info, 529 bcm_ipmc_stat_t stat, 530 uint32 *stat_counter_id); 531 extern bcm_error_t _bcm_td2_ipmc_stat_multi_get( 532 int unit, 533 bcm_ipmc_addr_t *info, 534 int nstat, 535 bcm_ipmc_stat_t *stat_arr, 536 uint64 *value_arr); 537 extern bcm_error_t _bcm_td2_ipmc_stat_multi_get32( 538 int unit, 539 bcm_ipmc_addr_t *info, 540 int nstat, 541 bcm_ipmc_stat_t *stat_arr, 542 uint32 *value_arr); 543 extern bcm_error_t _bcm_td2_ipmc_stat_multi_set( 544 int unit, 545 bcm_ipmc_addr_t *info, 546 int nstat, 547 bcm_ipmc_stat_t *stat_arr, 548 uint64 *value_arr); 549 extern bcm_error_t _bcm_td2_ipmc_stat_multi_set32( 550 int unit, 551 bcm_ipmc_addr_t *info, 552 int nstat, 553 bcm_ipmc_stat_t *stat_arr, 554 uint32 *value_arr); 555 556 extern int _bcm_td2_l3_ip4_options_free_resources(int unit); 557 extern int _bcm_td2_l3_ip4_options_profile_init(int unit); 558 extern int _bcm_td2_l3_ip4_options_profile_create(int unit, uint32 flags, 559 bcm_l3_ip4_options_action_t default_action, 560 int *ip4_options_profile_id); 561 extern int _bcm_td2_l3_ip4_options_profile_destroy(int unit, 562 int ip4_options_profile_id); 563 extern int _bcm_td2_l3_ip4_options_profile_action_set(int unit, 564 int ip4_options_profile_id, 565 int ip4_option, 566 bcm_l3_ip4_options_action_t action); 567 extern int _bcm_td2_l3_ip4_options_profile_action_get(int unit, 568 int ip4_options_profile_id, 569 int ip4_option, 570 bcm_l3_ip4_options_action_t *action); 571 extern int _bcm_td2_l3_ip4_options_profile_multi_get(int unit, int array_size, 572 int *ip_options_ids_array, 573 int *array_count); 574 extern int _bcm_td2_l3_ip4_options_profile_action_multi_get(int unit, 575 uint32 flags, 576 int ip_option_profile_id, int array_size, 577 bcm_l3_ip4_options_action_t *array, int *array_count); 578 extern int _bcm_td2_l3_ip4_options_profile_id2idx(int unit, int profile_id, 579 int *hw_idx); 580 extern int _bcm_td2_l3_ip4_options_profile_idx2id(int unit, int hw_idx, 581 int *profile_id); 582 extern int _bcm_td2_vp_urpf_mode_set(int unit, bcm_port_t port, int arg); 583 extern int _bcm_td2_vp_urpf_mode_get(int unit, bcm_port_t port, int *arg); 584 extern int _bcm_td2_l3_intf_iif_profile_update(int unit, bcm_vlan_t vid, 585 bcm_vlan_control_vlan_t *control); 586 extern int _bcm_td2_l3_intf_iif_profile_get(int unit, bcm_vlan_t vid, 587 bcm_vlan_control_vlan_t *control); 588 extern int _bcm_td2_l3_iif_ip4_options_profile_index_set( 589 int unit, _bcm_l3_intf_cfg_t *intf_info); 590 extern int _bcm_td2_l3_iif_ip4_options_profile_index_get( 591 int unit, _bcm_l3_intf_cfg_t *intf_info); 592 #ifdef BCM_WARM_BOOT_SUPPORT 593 extern int _bcm_td2_l3_ip4_options_profile_scache_len_get(int unit, 594 int *wb_alloc_size); 595 extern int _bcm_td2_l3_ip4_options_recover(int unit, uint8 **scache_ptr); 596 597 extern int _bcm_td2_l3_ip4_options_sync(int unit, uint8 **scache_ptr); 598 #endif /* BCM_WARM_BOOT_SUPPORT */ 599 600 /* VXLAN */ 601 extern int bcm_td2_vxlan_udpDestPort_set(int unit, int udpDestPort); 602 extern int bcm_td2_vxlan_udpSourcePort_set(int unit, int hashEnable); 603 extern int bcm_td2_vxlan_udpDestPort_get(int unit, int *udpDestPort); 604 extern int bcm_td2_vxlan_udpSourcePort_get(int unit, int *hashEnable); 605 extern int bcm_td2_vxlan_egress_get(int unit, bcm_l3_egress_t *egr, int nh_index); 606 extern int bcm_td2_vxlan_next_hop_set(int unit, int nh_index, uint32 flags, int vp, int drop); 607 extern int bcm_td2_vxlan_egress_reset(int unit, int nh_index); 608 609 extern int _bcm_td2_vxlan_port_resolve( 610 int unit, 611 bcm_gport_t l2gre_port_id, 612 bcm_if_t encap_id, 613 bcm_module_t *modid, 614 bcm_port_t *port, 615 bcm_trunk_t *trunk_id, 616 int *id); 617 618 extern int bcm_td2_vxlan_lock(int unit); 619 extern void bcm_td2_vxlan_unlock(int unit); 620 extern int bcm_td2_vxlan_init(int unit); 621 extern int bcm_td2_vxlan_cleanup(int unit); 622 extern int bcm_td2_vxlan_vpn_create(int unit, bcm_vxlan_vpn_config_t *info); 623 extern int bcm_td2_vxlan_vpn_destroy(int unit, bcm_vpn_t l2vpn); 624 extern int bcm_td2_vxlan_vpn_destroy_all(int unit); 625 extern int bcm_td2_vxlan_vpn_traverse(int unit, bcm_vxlan_vpn_traverse_cb cb, void *user_data); 626 extern int bcm_td2_vxlan_port_traverse(int unit, bcm_vxlan_port_traverse_cb cb, void *user_data); 627 extern int bcm_td2_vxlan_vpn_get( int unit, bcm_vpn_t l2vpn, bcm_vxlan_vpn_config_t *info); 628 extern int bcm_td2_vxlan_port_add(int unit, bcm_vpn_t vpn, bcm_vxlan_port_t *vxlan_port); 629 extern int bcm_td2_vxlan_port_delete(int unit, bcm_vpn_t vpn, bcm_gport_t vxlan_port_id); 630 extern int bcm_td2_vxlan_port_delete_all(int unit, bcm_vpn_t vpn); 631 extern int bcm_td2_vxlan_port_get(int unit, bcm_vpn_t vpn, bcm_vxlan_port_t *vxlan_port); 632 extern int bcm_td2_vxlan_port_get_all( int unit, bcm_vpn_t l2vpn, int port_max, bcm_vxlan_port_t *port_array, int *port_count); 633 extern void bcm_td2_vxlan_port_match_count_adjust(int unit, int vp, int step); 634 extern int bcm_td2_vxlan_tunnel_initiator_create(int unit, bcm_tunnel_initiator_t *info); 635 extern int bcm_td2_vxlan_tunnel_initiator_destroy(int unit, bcm_gport_t vxlan_tunnel_id); 636 extern int bcm_td2_vxlan_tunnel_initiator_destroy_all(int unit); 637 extern int bcm_td2_vxlan_tunnel_initiator_get(int unit, bcm_tunnel_initiator_t *info); 638 extern int bcm_td2_vxlan_tunnel_initiator_traverse(int unit, bcm_tunnel_initiator_traverse_cb cb, void *user_data); 639 extern int _bcm_td2_vxlan_tunnel_initiator_cmp(int unit, void *buf, int index, 640 int *cmp_result); 641 extern int _bcm_td2_vxlan_tunnel_initiator_hash_calc(int unit, void *buf, 642 uint16 *hash); 643 extern int bcm_td2_vxlan_tunnel_terminator_create(int unit, bcm_tunnel_terminator_t *info); 644 extern int bcm_td2_vxlan_tunnel_terminator_update(int unit, bcm_tunnel_terminator_t *info); 645 extern int bcm_td2_vxlan_tunnel_terminator_destroy(int unit, bcm_gport_t vxlan_tunnel_id); 646 extern int bcm_td2_vxlan_tunnel_terminator_destroy_all(int unit); 647 extern int bcm_td2_vxlan_tunnel_terminator_get( int unit, bcm_tunnel_terminator_t *info); 648 extern int bcm_td2_vxlan_tunnel_terminator_traverse(int unit, bcm_tunnel_terminator_traverse_cb cb, void *user_data); 649 extern int _bcm_td2_vxlan_vpn_get(int unit, int vfi_index, bcm_vlan_t *vid); 650 extern int bcm_td2_vxlan_multicast_leaf_entry_check(int unit, int tunnel_idx, int enable_flag); 651 extern int _bcm_td2_vxlan_vpn_is_valid( int unit, bcm_vpn_t l2vpn); 652 extern int _bcm_td2_vxlan_vpn_is_eline( int unit, bcm_vpn_t l2vpn, uint8 *isEline); 653 extern int bcm_td2_vxlan_port_learn_set(int unit, bcm_gport_t vxlan_port_id, uint32 flags); 654 extern int bcm_td2_vxlan_port_learn_get(int unit, bcm_gport_t vxlan_port_id, uint32 *flags); 655 extern int bcm_td2_vxlan_trunk_member_add (int unit, bcm_trunk_t trunk_id, 656 int trunk_member_count, bcm_port_t *trunk_member_array); 657 extern int bcm_td2_vxlan_trunk_member_delete(int unit, bcm_trunk_t trunk_id, 658 int trunk_member_count, bcm_port_t *trunk_member_array); 659 extern int _bcm_td2_vxlan_port_get(int unit, bcm_vpn_t vpn, int vp, 660 bcm_vxlan_port_t *vxlan_port); 661 extern int _bcm_td2_vxlan_match_add(int unit, bcm_vxlan_port_t *vxlan_port, int vp, bcm_vpn_t vpn); 662 extern int _bcm_td2_vxlan_match_delete(int unit, int vp , bcm_vxlan_port_t vxlan_port, bcm_vpn_t vpn); 663 extern int bcm_td2_vxlan_port_source_vp_lag_set(int unit, bcm_gport_t gport, int vp_lag_vp); 664 extern int bcm_td2_vxlan_port_source_vp_lag_clear(int unit, bcm_gport_t gport, int vp_lag_vp); 665 extern int bcm_td2_vxlan_port_source_vp_lag_get(int unit, bcm_gport_t gport, int *vp_lag_vp); 666 extern int _bcm_td2_vxlan_svp_field_set(int unit, bcm_gport_t vp, soc_field_t field, int value); 667 668 /* L2GRE */ 669 extern int bcm_td2_l2gre_match_add(int unit, bcm_l2gre_port_t *l2gre_port, int vp, bcm_vpn_t vpn); 670 extern int bcm_td2_l2gre_match_delete(int unit, int vp, bcm_l2gre_port_t *l2gre_port); 671 extern int bcm_td2_l2gre_match_get(int unit, bcm_l2gre_port_t *l2gre_port, int vp); 672 extern int _bcm_td2_l2gre_eline_vp_configure (int unit, int vfi_index, int active_vp, 673 source_vp_entry_t *svp, int tpid_enable, bcm_l2gre_port_t *l2gre_port); 674 extern int _bcm_td2_l2gre_elan_vp_configure (int unit, int vfi_index, int active_vp, 675 source_vp_entry_t *svp, int tpid_enable, bcm_l2gre_port_t *l2gre_port); 676 extern int _bcm_td2_vxlan_port_get(int unit, bcm_vpn_t vpn, int vp, 677 bcm_vxlan_port_t *vxlan_port); 678 extern int _bcm_td2_vxlan_default_port_get(int unit, int vp, bcm_vxlan_port_t *vxlan_port); 679 680 /* VP LAG */ 681 extern int bcm_td2_vp_lag_init(int unit); 682 extern void bcm_td2_vp_lag_deinit(int unit); 683 extern int bcm_td2_vp_lag_create(int unit, uint32 flags, bcm_trunk_t *tid, 684 bcm_gport_t *vplag_port_id); 685 extern int bcm_td2_vp_lag_info_get(int unit, int *ngroups_vp_lag, 686 int *nports_vp_lag); 687 extern int bcm_td2_vp_lag_set(int unit, bcm_trunk_t tid, 688 bcm_trunk_info_t *trunk_info, int member_count, 689 bcm_trunk_member_t *member_array); 690 extern int bcm_td2_vp_lag_destroy(int unit, bcm_trunk_t tid); 691 extern int bcm_td2_vp_lag_get(int unit, bcm_trunk_t tid, 692 bcm_trunk_info_t *trunk_info, int member_max, 693 bcm_trunk_member_t *member_array, int *member_count); 694 extern int _bcm_td2_vp_lag_match_multi_get( 695 int unit, bcm_trunk_t tid, int size, 696 bcm_port_match_info_t *match_array, int *count); 697 extern int bcm_td2_tid_to_vp_lag_vp(int unit, bcm_trunk_t tid, int *vp_lag_vp); 698 extern int bcm_td2_vp_lag_vp_to_tid(int unit, int vp_lag_vp, bcm_trunk_t *tid); 699 extern int bcm_td2_vp_lag_find(int unit, bcm_port_t port, bcm_trunk_t *tid); 700 extern int bcm_td2_vlan_vp_source_vp_lag_set(int unit, bcm_gport_t gport, 701 int vp_lag_vp); 702 extern int bcm_td2_vlan_vp_source_vp_lag_clear(int unit, bcm_gport_t gport, 703 int vp_lag_vp); 704 extern int bcm_td2_vlan_vp_source_vp_lag_get(int unit, bcm_gport_t gport, 705 int *vp_lag_vp); 706 extern int bcm_td2_niv_port_source_vp_lag_set(int unit, bcm_gport_t gport, 707 int vp_lag_vp); 708 extern int bcm_td2_niv_port_source_vp_lag_clear(int unit, bcm_gport_t gport, 709 int vp_lag_vp); 710 extern int bcm_td2_niv_port_source_vp_lag_get(int unit, bcm_gport_t gport, 711 int *vp_lag_vp); 712 extern int bcm_td2_extender_port_source_vp_lag_set(int unit, bcm_gport_t gport, 713 int vp_lag_vp); 714 extern int bcm_td2_extender_port_source_vp_lag_clear(int unit, bcm_gport_t gport, 715 int vp_lag_vp); 716 extern int bcm_td2_extender_port_source_vp_lag_get(int unit, bcm_gport_t gport, 717 int *vp_lag_vp); 718 extern int bcm_td2_mim_port_source_vp_lag_set(int unit, bcm_gport_t gport, 719 int vp_lag_vp); 720 extern int bcm_td2_mim_port_source_vp_lag_clear(int unit, bcm_gport_t gport, 721 int vp_lag_vp); 722 extern int bcm_td2_mim_port_source_vp_lag_get(int unit, bcm_gport_t gport, 723 int *vp_lag_vp); 724 extern int bcm_td2_l2gre_port_source_vp_lag_set(int unit, bcm_gport_t gport, 725 int vp_lag_vp); 726 extern int bcm_td2_l2gre_port_source_vp_lag_clear(int unit, bcm_gport_t gport, 727 int vp_lag_vp); 728 extern int bcm_td2_l2gre_port_source_vp_lag_get(int unit, bcm_gport_t gport, 729 int *vp_lag_vp); 730 extern int bcm_td2_vp_lag_status_get(int unit, int vp_lag_id, int *is_vp_lag, 731 int *is_used, int *has_member); 732 extern int _bcm_td2_vp_lag_member_is_vfi_type(int unit, bcm_trunk_t tid, int *vfi_type); 733 extern int _bcm_esw_num_vp_trunk_groups(int unit); 734 #ifdef BCM_WARM_BOOT_SUPPORT 735 extern int bcm_td2_vp_lag_reinit(int unit); 736 extern int _bcm_td2_vp_lag_egr_dis_vp_scache_size_get(int unit, int *size); 737 extern int _bcm_td2_vp_lag_egr_dis_vp_scache_recover(int unit, uint8 **scache_ptr); 738 extern int _bcm_td2_vp_lag_egr_dis_vp_sync(int unit, uint8 **scache_ptr); 739 #endif /* BCM_WARM_BOOT_SUPPORT */ 740 #ifndef BCM_SW_STATE_DUMP_DISABLE 741 extern void bcm_td2_vp_lag_sw_dump(int unit); 742 #endif /* BCM_SW_STATE_DUMP_DISABLE */ 743 744 extern int bcm_td2_multicast_l3_vp_init(int unit); 745 extern int bcm_td2_multicast_l3_vp_detach(int unit); 746 extern int bcm_td2_multicast_l3_vp_encap_get(int unit, bcm_multicast_t group, 747 bcm_gport_t port, bcm_if_t intf, bcm_if_t *encap_id); 748 extern int bcm_td2_multicast_l3_vp_next_hop_free(int unit, int intf); 749 #ifdef BCM_WARM_BOOT_SUPPORT_SW_DUMP 750 extern void bcm_td2_multicast_l3_vp_sw_dump(int unit); 751 #endif /* BCM_WARM_BOOT_SUPPORT_SW_DUMP */ 752 753 /* ECMP resilient hashing */ 754 extern int bcm_td2_ecmp_rh_init(int unit); 755 extern void bcm_td2_ecmp_rh_deinit(int unit); 756 extern int bcm_td2_l3_egress_ecmp_rh_create(int unit, 757 bcm_l3_egress_ecmp_t *ecmp, int intf_count, bcm_if_t *intf_array, 758 int op, int count, bcm_if_t *intf); 759 extern int bcm_td2_l3_egress_ecmp_rh_destroy(int unit, bcm_if_t mpintf); 760 extern int bcm_td2_l3_egress_ecmp_rh_get(int unit, bcm_l3_egress_ecmp_t *ecmp); 761 extern int bcm_td2_l3_egress_ecmp_rh_ethertype_set(int unit, uint32 flags, 762 int ethertype_count, int *ethertype_array); 763 extern int bcm_td2_l3_egress_ecmp_rh_ethertype_get(int unit, uint32 *flags, 764 int ethertype_max, int *ethertype_array, int *ethertype_count); 765 extern int bcm_td2_l3_egress_ecmp_rh_shared_copy(int unit, int old_ecmp_group, 766 int new_ecmp_group); 767 #ifdef BCM_WARM_BOOT_SUPPORT 768 extern int bcm_td2_ecmp_rh_hw_recover(int unit); 769 #endif /* BCM_WARM_BOOT_SUPPORT */ 770 #ifndef BCM_SW_STATE_DUMP_DISABLE 771 extern void bcm_td2_ecmp_rh_sw_dump(int unit); 772 #endif /* BCM_SW_STATE_DUMP_DISABLE */ 773 /* Proxy */ 774 extern int bcm_td2_proxy_egress_create(int unit, uint32 flags, bcm_proxy_egress_t *proxy_egr, 775 bcm_if_t *proxy_intf_id); 776 extern int bcm_td2_proxy_egress_destroy(int unit, bcm_if_t proxy_intf_id); 777 extern int bcm_td2_proxy_egress_get(int unit, bcm_if_t proxy_intf_id, bcm_proxy_egress_t *proxy_egr); 778 extern int _bcm_td2_proxy_nh_add(int unit, int idx, void *buf, void *info); 779 extern int _bcm_td2_proxy_nh_get(int unit, int idx, bcm_proxy_egress_t *proxy_nh_entry); 780 extern int bcm_td2_proxy_egress_traverse(int unit, bcm_proxy_egress_traverse_cb cb, 781 void *user_data); 782 #ifdef BCM_WARM_BOOT_SUPPORT 783 extern int _bcm_td2_vlan_vp_scache_size_get(int unit, int *size); 784 extern int _bcm_td2_vlan_vp_sync(int unit, uint8 **scache_ptr); 785 extern int _bcm_td2_vlan_vp_recover(int unit, uint8 **scache_ptr); 786 #endif 787 #endif /* INCLUDE_L3 */ 788 789 extern int bcm_td2_cosq_init(int unit); 790 791 extern int bcm_td2_cosq_detach(int unit, int software_state_only); 792 793 extern int bcm_td2_cosq_config_set(int unit, int numq); 794 795 extern int bcm_td2_cosq_config_get(int unit, int *numq); 796 797 #if defined(BCM_TRIDENT2_SUPPORT) 798 extern int bcm_td2p_port_cosq_config_set(int unit, bcm_port_t port, int enable); 799 #endif 800 801 extern int bcm_td2_cosq_mapping_set(int unit, bcm_port_t gport, 802 bcm_cos_t priority, bcm_cos_queue_t cosq); 803 804 extern int bcm_td2_cosq_mapping_get(int unit, bcm_port_t gport, 805 bcm_cos_t priority, bcm_cos_queue_t *cosq); 806 807 extern int bcm_td2_cosq_port_sched_set(int unit, bcm_pbmp_t pbm, 808 int mode, const int *weights, int delay); 809 810 extern int bcm_td2_cosq_port_sched_get(int unit, bcm_pbmp_t pbm, 811 int *mode, int *weights, int *delay); 812 813 extern int bcm_td2_cosq_priority_mapping_get_all(int unit, bcm_gport_t gport, 814 int index, bcm_cosq_priority_mapping_t type, 815 int pri_max, int *pri_array, 816 int *pri_count); 817 818 extern int bcm_td2_cosq_sched_weight_max_get(int unit, int mode, 819 int *weight_max); 820 821 extern int bcm_td2_cosq_discard_set(int unit, uint32 flags); 822 823 extern int bcm_td2_cosq_discard_get(int unit, uint32 *flags); 824 825 extern int 826 bcm_td2_cosq_gport_discard_set(int unit, bcm_gport_t gport, 827 bcm_cos_queue_t cosq, 828 bcm_cosq_gport_discard_t *discard); 829 830 extern int 831 bcm_td2_cosq_gport_discard_get(int unit, bcm_gport_t gport, 832 bcm_cos_queue_t cosq, 833 bcm_cosq_gport_discard_t *discard); 834 835 extern int 836 _bcm_td2_cosq_pfc_class_resolve(bcm_switch_control_t sctype, int *type, 837 int *class); 838 839 extern int 840 bcm_td2_cosq_port_pfc_op(int unit, bcm_port_t port, 841 bcm_switch_control_t sctype, _bcm_cosq_op_t op, 842 bcm_gport_t *gport, int gport_count); 843 844 extern int 845 bcm_td2_cosq_port_pfc_get(int unit, bcm_port_t port, 846 bcm_switch_control_t sctype, 847 bcm_gport_t *gport, int gport_count, 848 int *actual_gport_count); 849 850 extern int 851 bcm_td2_cosq_gport_add(int unit, bcm_gport_t port, int numq, uint32 flags, 852 bcm_gport_t *gport); 853 854 extern int 855 bcm_td2_cosq_gport_detach(int unit, bcm_gport_t sched_gport, 856 bcm_gport_t input_gport, bcm_cos_queue_t cosq); 857 858 extern int 859 bcm_td2_cosq_discard_port_get(int unit, bcm_port_t port, 860 bcm_cos_queue_t cosq, uint32 color, int *drop_start, 861 int *drop_slope, int *average_time); 862 863 extern int 864 bcm_td2_cosq_gport_delete(int unit, bcm_gport_t gport); 865 866 extern int 867 bcm_td2_cosq_gport_get(int unit, bcm_gport_t gport, bcm_gport_t *port, 868 int *numq, uint32 *flags); 869 870 extern int 871 bcm_td2_cosq_gport_traverse(int unit, bcm_cosq_gport_traverse_cb cb, 872 void *user_data); 873 874 extern int 875 bcm_td2_cosq_discard_port_set(int unit, bcm_port_t port, 876 bcm_cos_queue_t cosq, 877 uint32 color, int drop_start, int drop_slope, 878 int average_time); 879 880 extern int 881 bcm_td2_cosq_gport_attach(int unit, bcm_gport_t sched_gport, 882 bcm_gport_t input_gport, bcm_cos_queue_t cosq); 883 884 extern int 885 bcm_td2_cosq_gport_attach_get(int unit, bcm_gport_t sched_gport, 886 bcm_gport_t *input_gport, bcm_cos_queue_t *cosq); 887 888 extern int 889 bcm_td2_cosq_gport_child_get(int unit, bcm_gport_t in_gport, 890 bcm_cos_queue_t cosq, bcm_gport_t *out_gport); 891 892 extern int 893 bcm_td2_cosq_port_bandwidth_set(int unit, bcm_port_t port, 894 bcm_cos_queue_t cosq, 895 uint32 min_quantum, uint32 max_quantum, 896 uint32 burst_quantum, uint32 flags); 897 898 extern int 899 bcm_td2_cosq_port_bandwidth_get(int unit, bcm_port_t port, 900 bcm_cos_queue_t cosq, 901 uint32 *min_quantum, uint32 *max_quantum, 902 uint32 *burst_quantum, uint32 *flags); 903 904 extern int 905 bcm_td2_cosq_port_pps_set(int unit, bcm_port_t port, bcm_cos_queue_t cosq, 906 int pps); 907 908 extern int 909 bcm_td2_cosq_port_pps_get(int unit, bcm_port_t port, bcm_cos_queue_t cosq, 910 int *pps); 911 912 extern int bcm_td2_cosq_port_burst_set(int unit, bcm_port_t port, 913 bcm_cos_queue_t cosq, int burst); 914 915 extern int 916 bcm_td2_cosq_stat_set(int unit, bcm_gport_t port, bcm_cos_queue_t cosq, 917 bcm_cosq_stat_t stat, uint64 value); 918 919 extern int 920 bcm_td2_cosq_stat_get(int unit, bcm_port_t port, bcm_cos_queue_t cosq, 921 bcm_cosq_stat_t stat, int sync_mode, uint64 *value); 922 923 extern int 924 bcm_td2_cosq_port_burst_get(int unit, bcm_port_t port, bcm_cos_queue_t cosq, 925 int *burst); 926 927 extern int 928 bcm_td2_cosq_control_set(int unit, bcm_gport_t gport, bcm_cos_queue_t cosq, 929 bcm_cosq_control_t type, int arg); 930 931 extern int 932 bcm_td2_cosq_control_get(int unit, bcm_gport_t gport, bcm_cos_queue_t cosq, 933 bcm_cosq_control_t type, int *arg); 934 935 extern int 936 bcm_td2_cosq_service_pool_set(int unit, bcm_service_pool_id_t id, 937 bcm_cosq_service_pool_t cosq_service_pool); 938 939 extern int 940 bcm_td2_cosq_service_pool_get(int unit, bcm_service_pool_id_t id, 941 bcm_cosq_service_pool_t *cosq_service_pool); 942 943 extern int 944 bcm_td2_cosq_gport_bandwidth_burst_set(int unit, bcm_gport_t gport, 945 bcm_cos_queue_t cosq, 946 uint32 kbits_burst_min, 947 uint32 kbits_burst_max); 948 949 extern int 950 bcm_td2_cosq_gport_bandwidth_burst_get(int unit, bcm_gport_t gport, 951 bcm_cos_queue_t cosq, 952 uint32 *kbits_burst_min, 953 uint32 *kbits_burst_max); 954 extern int 955 bcm_td2_cosq_gport_bandwidth_set(int unit, bcm_gport_t gport, 956 bcm_cos_queue_t cosq, uint32 kbits_sec_min, 957 uint32 kbits_sec_max, uint32 flags); 958 959 extern int 960 bcm_td2_cosq_gport_bandwidth_get(int unit, bcm_gport_t gport, 961 bcm_cos_queue_t cosq, uint32 *kbits_sec_min, 962 uint32 *kbits_sec_max, uint32 *flags); 963 964 extern int bcm_td2_cosq_congestion_queue_set(int unit, bcm_port_t port, 965 bcm_cos_queue_t cosq, int index); 966 extern int bcm_td2_cosq_congestion_queue_get(int unit, bcm_port_t port, 967 bcm_cos_queue_t cosq, int *index); 968 extern int bcm_td2_cosq_congestion_quantize_set(int unit, bcm_port_t port, 969 bcm_cos_queue_t cosq, 970 int weight_code, int setpoint); 971 extern int bcm_td2_cosq_congestion_quantize_get(int unit, bcm_port_t port, 972 bcm_cos_queue_t cosq, 973 int *weight_code, 974 int *setpoint); 975 extern int bcm_td2_cosq_congestion_sample_int_set(int unit, bcm_port_t port, 976 bcm_cos_queue_t cosq, 977 int min, int max); 978 extern int bcm_td2_cosq_congestion_sample_int_get(int unit, bcm_port_t port, 979 bcm_cos_queue_t cosq, 980 int *min, int *max); 981 extern int bcm_td2_cosq_drop_status_enable_set(int unit, bcm_port_t port, 982 int enable); 983 extern int _bcm_td2_get_def_qbase(int unit, bcm_port_t inport, int qtype, 984 int *pbase, int *pnumq); 985 986 extern int bcm_td2_cosq_gport_sched_set(int unit, bcm_gport_t gport, 987 bcm_cos_queue_t cosq, int mode, 988 int weight); 989 extern int bcm_td2_cosq_gport_sched_get(int unit, bcm_gport_t gport, 990 bcm_cos_queue_t cosq, int *mode, 991 int *weight); 992 extern int 993 _bcm_td2_cosq_port_resolve(int unit, bcm_gport_t gport, bcm_module_t *modid, 994 bcm_port_t *port, bcm_trunk_t *trunk_id, int *id, 995 int *qnum); 996 997 extern int 998 bcm_td2_cosq_gport_mapping_set(int unit, bcm_port_t ing_port, 999 bcm_cos_t int_pri, uint32 flags, 1000 bcm_gport_t gport, bcm_cos_queue_t cosq); 1001 1002 extern int 1003 bcm_td2_cosq_gport_congestion_config_set(int unit, bcm_gport_t port, 1004 bcm_cos_queue_t cosq, 1005 bcm_cosq_congestion_info_t *config); 1006 extern int 1007 bcm_td2_cosq_gport_mapping_get(int unit, bcm_port_t ing_port, 1008 bcm_cos_t int_pri, uint32 flags, 1009 bcm_gport_t *gport, bcm_cos_queue_t *cosq); 1010 extern int 1011 bcm_td2_cosq_gport_congestion_config_get(int unit, bcm_gport_t port, 1012 bcm_cos_queue_t cosq, 1013 bcm_cosq_congestion_info_t *config); 1014 1015 extern int 1016 bcm_td2_cosq_bst_profile_set(int unit, 1017 bcm_gport_t port, 1018 bcm_cos_queue_t cosq, 1019 bcm_bst_stat_id_t bid, 1020 bcm_cosq_bst_profile_t *profile); 1021 1022 extern int 1023 bcm_td2_cosq_bst_profile_get(int unit, 1024 bcm_gport_t port, 1025 bcm_cos_queue_t cosq, 1026 bcm_bst_stat_id_t bid, 1027 bcm_cosq_bst_profile_t *profile); 1028 1029 extern int 1030 bcm_td2_cosq_bst_stat_get(int unit, 1031 bcm_gport_t port, 1032 bcm_cos_queue_t cosq, 1033 bcm_bst_stat_id_t bid, 1034 uint32 options, 1035 uint64 *pvalue); 1036 1037 extern int 1038 bcm_td2_cosq_bst_stat_multi_get(int unit, 1039 bcm_gport_t port, 1040 bcm_cos_queue_t cosq, 1041 uint32 options, 1042 int max_values, 1043 bcm_bst_stat_id_t *id_list, 1044 uint64 *pvalues); 1045 extern int 1046 bcm_td2_cosq_bst_stat_clear(int unit, 1047 bcm_gport_t port, 1048 bcm_cos_queue_t cosq, 1049 bcm_bst_stat_id_t bid); 1050 1051 extern int 1052 bcm_td2_cosq_bst_stat_sync(int unit, bcm_bst_stat_id_t bid); 1053 1054 extern int bcm_td2_cosq_endpoint_create( 1055 int unit, 1056 bcm_cosq_classifier_t *classifier, 1057 int *classifier_id); 1058 extern int bcm_td2_cosq_endpoint_destroy( 1059 int unit, 1060 int classifier_id); 1061 extern int bcm_td2_cosq_endpoint_get( 1062 int unit, 1063 int classifier_id, 1064 bcm_cosq_classifier_t *classifier); 1065 extern int bcm_td2_cosq_endpoint_map_set( 1066 int unit, 1067 bcm_port_t port, 1068 int classifier_id, 1069 bcm_gport_t queue_group, 1070 int array_count, 1071 bcm_cos_t *priority_array, 1072 bcm_cos_queue_t *cosq_array); 1073 extern int bcm_td2_cosq_endpoint_map_get( 1074 int unit, 1075 bcm_port_t port, 1076 int classifier_id, 1077 bcm_gport_t *queue_group, 1078 int array_max, 1079 bcm_cos_t *priority_array, 1080 bcm_cos_queue_t *cosq_array, 1081 int *array_count); 1082 extern int bcm_td2_cosq_endpoint_map_clear( 1083 int unit, 1084 bcm_gport_t port, 1085 int classifier_id); 1086 1087 extern int 1088 bcm_td2_cosq_field_classifier_get( 1089 int unit, int classifier_id, bcm_cosq_classifier_t *classifier); 1090 1091 extern int 1092 bcm_td2_cosq_field_classifier_id_create( 1093 int unit, bcm_cosq_classifier_t *classifier, int *classifier_id); 1094 1095 extern int 1096 bcm_td2_cosq_field_classifier_id_destroy( 1097 int unit, int classifier_id); 1098 1099 extern int 1100 bcm_td2_cosq_field_classifier_map_set( 1101 int unit, int classifier_id, int count, 1102 bcm_cos_t *priority_array, bcm_cos_queue_t *cosq_array); 1103 1104 extern int 1105 bcm_td2_cosq_field_classifier_map_get( 1106 int unit, int classifier_id, 1107 int array_max, bcm_cos_t *priority_array, 1108 bcm_cos_queue_t *cosq_array, int *array_count); 1109 1110 extern int 1111 bcm_td2_cosq_field_classifier_map_clear( 1112 int unit, int classifier_id); 1113 1114 extern int bcm_td2_cosq_sync(int unit); 1115 extern int bcm_td2_cosq_reinit(int unit); 1116 1117 extern void bcm_td2_cosq_sw_dump(int unit); 1118 1119 extern int bcm_td2_cosq_cpu_cosq_enable_set( 1120 int unit, 1121 bcm_cos_queue_t cosq, 1122 int enable); 1123 1124 extern int bcm_td2_cosq_cpu_cosq_enable_get( 1125 int unit, 1126 bcm_cos_queue_t cosq, 1127 int *enable); 1128 1129 extern int 1130 bcm_td2_cosq_service_classifier_id_create(int unit, 1131 bcm_cosq_classifier_t *classifier, 1132 int *classifier_id); 1133 extern int 1134 bcm_td2_cosq_service_classifier_id_destroy(int unit, int classifier_id); 1135 extern int 1136 bcm_td2_cosq_service_classifier_get(int unit, int classifier_id, 1137 bcm_cosq_classifier_t *classifier); 1138 extern int 1139 bcm_td2_cosq_service_map_set(int unit, bcm_port_t port, int classifier_id, 1140 bcm_gport_t queue_group, int array_count, 1141 bcm_cos_t *priority_array, 1142 bcm_cos_queue_t *cosq_array); 1143 extern int 1144 bcm_td2_cosq_service_map_get(int unit, bcm_port_t port, int classifier_id, 1145 bcm_gport_t *queue_group, int array_max, 1146 bcm_cos_t *priority_array, 1147 bcm_cos_queue_t *cosq_array, int *array_count); 1148 extern int 1149 bcm_td2_cosq_service_map_clear(int unit, bcm_gport_t port, int classifier_id); 1150 1151 typedef enum { 1152 _BCM_TD2_COSQ_INDEX_STYLE_BUCKET, 1153 _BCM_TD2_COSQ_INDEX_STYLE_QCN, 1154 _BCM_TD2_COSQ_INDEX_STYLE_WRED, 1155 _BCM_TD2_COSQ_INDEX_STYLE_WRED_PORT, 1156 _BCM_TD2_COSQ_INDEX_STYLE_WRED_POOL, 1157 _BCM_TD2_COSQ_INDEX_STYLE_SCHEDULER, 1158 _BCM_TD2_COSQ_INDEX_STYLE_PERQ_XMT, 1159 _BCM_TD2_COSQ_INDEX_STYLE_UCAST_DROP, 1160 _BCM_TD2_COSQ_INDEX_STYLE_COS, 1161 _BCM_TD2_COSQ_INDEX_STYLE_UCAST_QUEUE, 1162 _BCM_TD2_COSQ_INDEX_STYLE_MCAST_QUEUE, 1163 _BCM_TD2_COSQ_INDEX_STYLE_EXT_UCAST_QUEUE, 1164 _BCM_TD2_COSQ_INDEX_STYLE_EGR_POOL, 1165 _BCM_TD2_COSQ_INDEX_STYLE_EGR_PERQ_UCAST, 1166 _BCM_TD2_COSQ_INDEX_STYLE_EGR_PERQ_MCAST, 1167 _BCM_TD2_COSQ_INDEX_STYLE_UC_EGR_POOL, 1168 _BCM_TD2_COSQ_INDEX_STYLE_UCAST_QUEUE_GROUP, 1169 _BCM_TD2_COSQ_INDEX_STYLE_COUNT 1170 } _bcm_td2_cosq_index_style_t; 1171 1172 extern int 1173 _bcm_td2_cosq_index_resolve(int unit, bcm_port_t port, bcm_cos_queue_t cosq, 1174 _bcm_td2_cosq_index_style_t style, 1175 bcm_port_t *local_port, int *index, int *count); 1176 extern int 1177 bcm_td2_cosq_pfc_class_mapping_set(int unit, 1178 bcm_gport_t port, 1179 int array_count, 1180 bcm_cosq_pfc_class_mapping_t *mapping_array); 1181 extern int 1182 bcm_td2_cosq_pfc_class_mapping_get(int unit, 1183 bcm_gport_t port, 1184 int array_max, 1185 bcm_cosq_pfc_class_mapping_t *mapping_array, 1186 int *array_count); 1187 extern int 1188 bcm_td2_cosq_default_llfc_profile_attach(int unit, bcm_gport_t port); 1189 1190 extern int 1191 bcm_td2_cosq_llfc_profile_detach(int unit, bcm_gport_t port); 1192 1193 extern int 1194 bcm_td2_port_priority_group_mapping_set(int unit, bcm_gport_t gport, 1195 int prio, int priority_group); 1196 extern int 1197 bcm_td2_port_priority_group_mapping_get(int unit, bcm_gport_t gport, 1198 int prio, int *priority_group); 1199 extern int 1200 bcm_td2_port_priority_group_config_set(int unit, bcm_gport_t gport, 1201 int priority_group, bcm_port_priority_group_config_t *prigrp_config); 1202 extern int 1203 bcm_td2_port_priority_group_config_get(int unit, bcm_gport_t gport, 1204 int priority_group, bcm_port_priority_group_config_t *prigrp_config); 1205 /* Flexible hashing support routines */ 1206 1207 #if defined (BCM_WARM_BOOT_SUPPORT) 1208 extern int bcmi_td2_switch_wb_hash_entry_reinit( 1209 int unit, 1210 uint8 **scache_ptr); 1211 1212 #if defined (BCM_TOMAHAWK_SUPPORT) 1213 extern int bcmi_th_switch_wb_hash_entry_reinit( 1214 int unit, 1215 uint8 **scache_ptr); 1216 #endif 1217 1218 extern int bcmi_td2_switch_wb_hash_entry_sync( 1219 int unit, 1220 uint8 **scache_ptr); 1221 1222 extern int bcmi_td2_switch_wb_hash_entry_scache_size_get( 1223 int unit, 1224 int *req_scache_size); 1225 #endif 1226 1227 extern int bcm_td2_switch_hash_entry_create( 1228 int unit, 1229 bcm_field_group_t group, 1230 bcm_hash_entry_t *entry_id); 1231 extern int bcm_td2_switch_hash_entry_create_qset( 1232 int unit, 1233 bcm_field_qset_t qset, 1234 bcm_hash_entry_t *entry_id); 1235 extern int bcm_td2_switch_hash_entry_set( 1236 int unit, 1237 bcm_hash_entry_t entry, 1238 bcm_switch_hash_entry_config_t *config); 1239 extern int bcm_td2_switch_hash_entry_get( 1240 int unit, 1241 bcm_hash_entry_t entry, 1242 bcm_switch_hash_entry_config_t *config); 1243 extern int bcm_td2_switch_hash_entry_traverse( 1244 int unit, 1245 int flags, 1246 bcm_switch_hash_entry_traverse_cb cb_fn, 1247 void *user_data); 1248 extern int bcm_td2_switch_hash_qualify_udf( 1249 int unit, 1250 bcm_hash_entry_t entry_id, 1251 bcm_udf_id_t udf_id, 1252 int length, 1253 uint8 *data, uint8 *mask); 1254 extern int bcm_td2_switch_hash_qualify_udf_get( 1255 int unit, 1256 bcm_hash_entry_t entry_id, 1257 bcm_udf_id_t udf_id, 1258 int max_length, 1259 uint8 *data, uint8 *mask, 1260 int *actual_length); 1261 extern int bcm_td2_switch_hash_qualify_data ( 1262 int unit, 1263 bcm_hash_entry_t entry_id, 1264 int qual_id, 1265 uint32 data, 1266 uint32 mask); 1267 extern int bcm_td2_switch_hash_entry_remove ( 1268 int unit, 1269 bcm_hash_entry_t entry_id); 1270 extern int bcm_td2_switch_hash_entry_reinstall ( 1271 int unit, 1272 bcm_hash_entry_t entry_id, 1273 uint32 offset, 1274 uint32 mask); 1275 extern int bcm_td2_switch_hash_entry_install ( 1276 int unit, 1277 bcm_hash_entry_t entry_id, 1278 uint32 offset, 1279 uint32 mask); 1280 extern int bcm_td2_switch_hash_entry_destroy ( 1281 int unit, 1282 bcm_hash_entry_t entry_id); 1283 extern int bcm_td2_switch_hash_entry_detach(int unit); 1284 extern int bcm_td2_switch_hash_entry_init (int unit); 1285 extern int bcm_td2_switch_match_detach(int unit); 1286 extern int bcm_td2_switch_match_init(int unit); 1287 extern int bcm_td2_switch_match_config_add( 1288 int unit, 1289 bcm_switch_match_service_t match_service, 1290 bcm_switch_match_config_info_t *config_info, 1291 int *match_id); 1292 extern int bcm_td2_switch_match_config_delete( 1293 int unit, 1294 bcm_switch_match_service_t match_service, 1295 int match_id); 1296 extern int bcm_td2_switch_match_config_delete_all( 1297 int unit, 1298 bcm_switch_match_service_t match_service); 1299 extern int bcm_td2_switch_match_config_get( 1300 int unit, 1301 bcm_switch_match_service_t match_service, 1302 int match_id, 1303 bcm_switch_match_config_info_t *config_info); 1304 extern int bcm_td2_switch_match_config_set( 1305 int unit, 1306 bcm_switch_match_service_t match_service, 1307 int match_id, 1308 bcm_switch_match_config_info_t *config_info); 1309 extern int bcm_td2_switch_match_config_traverse( 1310 int unit, 1311 bcm_switch_match_service_t match_service, 1312 bcm_switch_match_config_traverse_cb cb_fn, 1313 void *user_data); 1314 extern int bcm_td2_l2x_freeze_mode_set(int unit, int arg); 1315 extern int bcm_td2_l2x_freeze_mode_get(int unit, int *arg); 1316 extern int bcm_td2_switch_l2_freeze_mode_init(int unit); 1317 extern int _bcm_td2_flags_to_stp_state(int unit, uint32 flags, int egress); 1318 extern int _bcm_td2_stp_state_to_flags(int unit, int stp_state, int egress); 1319 extern int bcm_td2_ing_vp_vlan_membership_add(int unit, 1320 int vp, bcm_vlan_t vlan, uint32 flags, 1321 _bcm_vp_vlan_mbrship_key_type_e key_type); 1322 extern int bcm_td2_egr_vp_vlan_membership_add(int unit, 1323 int vp, bcm_vlan_t vlan, uint32 flags, 1324 _bcm_vp_vlan_mbrship_key_type_e key_type); 1325 extern int bcm_td2_ing_vp_vlan_membership_delete(int unit, 1326 int vp, bcm_vlan_t vlan, 1327 _bcm_vp_vlan_mbrship_key_type_e key_type); 1328 extern int bcm_td2_egr_vp_vlan_membership_delete(int unit, 1329 int vp, bcm_vlan_t vlan, 1330 _bcm_vp_vlan_mbrship_key_type_e key_type); 1331 extern int bcm_td2_ing_vp_vlan_membership_get(int unit, 1332 int vp, bcm_vlan_t vlan, uint32 *flags, 1333 _bcm_vp_vlan_mbrship_key_type_e key_type); 1334 extern int bcm_td2_egr_vp_vlan_membership_get(int unit, 1335 int vp, bcm_vlan_t vlan, uint32 *flags, 1336 _bcm_vp_vlan_mbrship_key_type_e key_type); 1337 extern int bcm_td2_ing_vp_vlan_membership_get_all(int unit, bcm_vlan_t vlan, 1338 SHR_BITDCL *vp_bitmap, int arr_size, int *flags_arr); 1339 extern int bcm_td2_egr_vp_vlan_membership_get_all(int unit, bcm_vlan_t vlan, 1340 SHR_BITDCL *vp_bitmap, int arr_size, int *flags_arr); 1341 extern int bcm_td2_ing_vp_vlan_membership_delete_all(int unit, bcm_vlan_t vlan); 1342 extern int bcm_td2_egr_vp_vlan_membership_delete_all(int unit, bcm_vlan_t vlan); 1343 extern int bcm_td2_vp_vlan_stp_set(int unit, 1344 int vp, bcm_vlan_t vlan, int stp_state); 1345 extern int bcm_td2_vp_vlan_stp_get(int unit, 1346 int vp, bcm_vlan_t vlan, int *stp_state); 1347 extern int bcm_td2_vp_vlan_membership_add(int unit, int vp, bcm_vlan_t vlan, int flags); 1348 extern int bcm_td2_vp_vlan_membership_delete(int unit, int vp, bcm_vlan_t vlan); 1349 extern int bcm_td2_vp_vlan_membership_get(int unit, int vp, bcm_vlan_t vlan, int *flags); 1350 extern int bcm_td2_vp_vlan_membership_get_all(int unit, bcm_vlan_t vlan, 1351 int array_max, bcm_gport_t *gport_array, 1352 int *flags_array, int *array_size); 1353 1354 /* Higig resilient hashing */ 1355 extern int bcm_td2_hg_rh_init(int unit); 1356 extern void bcm_td2_hg_rh_deinit(int unit); 1357 extern int bcm_td2_hg_rh_dynamic_size_encode(int unit, int dynamic_size, 1358 int *encoded_value); 1359 extern int bcm_td2_hg_rh_set(int unit, int hgtid, 1360 _esw_trunk_add_info_t *add_info); 1361 extern int bcm_td2_hg_rh_replace(int unit, int hgtid, 1362 _esw_trunk_add_info_t *add_info, uint16 num_existing, 1363 uint16 *existing_ports, uint32 *existing_flags); 1364 extern int bcm_td2_hg_rh_add(int unit, int hgtid, 1365 _esw_trunk_add_info_t *add_info, bcm_trunk_member_t *new_member); 1366 extern int bcm_td2_hg_rh_delete(int unit, int hgtid, 1367 _esw_trunk_add_info_t *add_info, bcm_trunk_member_t *leaving_member); 1368 extern int bcm_td2_hg_rh_free_resource(int unit, int hgtid); 1369 extern int bcm_td2_hg_rh_status_get(int unit, int *rh_status); 1370 extern int bcm_td2_hg_rh_dynamic_size_set(int unit, int hgtid, int dynamic_size); 1371 extern int bcm_td2_hg_rh_ethertype_set(int unit, uint32 flags, 1372 int ethertype_count, int *ethertype_array); 1373 extern int bcm_td2_hg_rh_ethertype_get(int unit, uint32 *flags, 1374 int ethertype_max, int *ethertype_array, int *ethertype_count); 1375 #ifdef BCM_WARM_BOOT_SUPPORT 1376 extern int bcm_td2_hg_rh_recover(int unit, int hgtid, 1377 trunk_private_t *trunk_info); 1378 #endif /* BCM_WARM_BOOT_SUPPORT */ 1379 #ifndef BCM_SW_STATE_DUMP_DISABLE 1380 extern void bcm_td2_hg_rh_sw_dump(int unit); 1381 #endif /* BCM_SW_STATE_DUMP_DISABLE */ 1382 1383 /* LAG resilient hashing */ 1384 extern int bcm_td2_lag_rh_init(int unit); 1385 extern void bcm_td2_lag_rh_deinit(int unit); 1386 extern int bcm_td2_lag_rh_dynamic_size_encode(int unit, int dynamic_size, 1387 int *encoded_value); 1388 extern int bcm_td2_lag_rh_set(int unit, int tid, 1389 _esw_trunk_add_info_t *add_info, int num_rh_ports, int *mod_array, 1390 int *port_array); 1391 extern int bcm_td2_lag_rh_add(int unit, int tid, 1392 _esw_trunk_add_info_t *add_info, int num_rh_ports, int *mod_array, 1393 int *port_array, bcm_trunk_member_t *new_member); 1394 extern int bcm_td2_lag_rh_delete(int unit, int tid, 1395 _esw_trunk_add_info_t *add_info, int num_rh_ports, int *mod_array, 1396 int *port_array, bcm_trunk_member_t *leaving_member); 1397 extern int bcm_td2_lag_rh_replace(int unit, int tid, 1398 _esw_trunk_add_info_t *add_info, int num_rh_ports, int *mod_array, 1399 int *port_array, uint16 num_existing, uint16 *existing_modports, 1400 uint32 *existing_flags); 1401 extern int bcm_td2_lag_rh_free_resource(int unit, int tid); 1402 extern int bcm_td2_lag_rh_dynamic_size_set(int unit, int tid, int dynamic_size); 1403 extern int bcm_td2_lag_rh_ethertype_set(int unit, uint32 flags, 1404 int ethertype_count, int *ethertype_array); 1405 extern int bcm_td2_lag_rh_ethertype_get(int unit, uint32 *flags, 1406 int ethertype_max, int *ethertype_array, int *ethertype_count); 1407 #ifdef BCM_WARM_BOOT_SUPPORT 1408 extern int bcm_td2_lag_rh_recover(int unit, int tid, 1409 trunk_private_t *trunk_info); 1410 #endif /* BCM_WARM_BOOT_SUPPORT */ 1411 #ifndef BCM_SW_STATE_DUMP_DISABLE 1412 extern void bcm_td2_lag_rh_sw_dump(int unit); 1413 #endif /* BCM_SW_STATE_DUMP_DISABLE */ 1414 1415 /* FCOE */ 1416 extern int bcm_td2_fcoe_init(int unit); 1417 extern int bcm_td2_fcoe_cleanup(int unit); 1418 extern int bcm_td2_fcoe_zone_add(int unit, bcm_fcoe_zone_entry_t *zone); 1419 extern int bcm_td2_fcoe_zone_delete(int unit, 1420 bcm_fcoe_zone_entry_t *zone); 1421 extern int bcm_td2_fcoe_zone_delete_all (int unit); 1422 extern int bcm_td2_fcoe_zone_delete_by_vsan (int unit, 1423 bcm_fcoe_zone_entry_t *zone); 1424 extern int bcm_td2_fcoe_zone_delete_by_sid (int unit, 1425 bcm_fcoe_zone_entry_t *zone); 1426 extern int bcm_td2_fcoe_zone_delete_by_did (int unit, 1427 bcm_fcoe_zone_entry_t *zone); 1428 extern int bcm_td2_fcoe_zone_get (int unit, bcm_fcoe_zone_entry_t *zone); 1429 extern int bcm_td2_fcoe_route_add(int unit, bcm_fcoe_route_t *route); 1430 extern int bcm_td2_fcoe_route_delete(int unit, bcm_fcoe_route_t *route); 1431 extern int bcm_td2_fcoe_route_delete_by_prefix(int unit, 1432 bcm_fcoe_route_t *route); 1433 extern int bcm_td2_fcoe_route_delete_by_interface(int unit, 1434 bcm_fcoe_route_t *route); 1435 extern int bcm_td2_fcoe_route_delete_all(int unit); 1436 extern int bcm_td2_fcoe_route_find(int unit, bcm_fcoe_route_t *route); 1437 extern int bcm_td2_fcoe_vsan_create(int unit, uint32 options, 1438 bcm_fcoe_vsan_t *vsan, 1439 bcm_fcoe_vsan_id_t *vsan_id); 1440 extern int bcm_td2_fcoe_vsan_destroy(int unit, bcm_fcoe_vsan_id_t vsan_id); 1441 extern int bcm_td2_fcoe_vsan_destroy_all(int unit); 1442 extern int bcm_td2_fcoe_control_vsan_get(int unit, 1443 uint32 vsan_id, 1444 bcm_fcoe_vsan_control_t type, 1445 int *arg); 1446 extern int bcm_td2_fcoe_control_vsan_set(int unit, 1447 uint32 vsan_id, 1448 bcm_fcoe_vsan_control_t type, 1449 int arg); 1450 extern int bcm_td2_fcoe_vsan_get(int unit, uint32 vsan_id, 1451 bcm_fcoe_vsan_t *vsan); 1452 extern int bcm_td2_fcoe_vsan_set(int unit, uint32 vsan_id, 1453 bcm_fcoe_vsan_t *vsan); 1454 extern int bcm_td2_fcoe_vsan_stat_attach(int unit, 1455 bcm_fcoe_vsan_id_t vsan, 1456 uint32 stat_counter_id); 1457 extern int bcm_td2_fcoe_vsan_stat_detach(int unit, bcm_fcoe_vsan_id_t vsan); 1458 extern int bcm_td2_fcoe_vsan_stat_counter_get( 1459 int unit, 1460 int sync_mode, 1461 bcm_fcoe_vsan_id_t vsan, 1462 bcm_fcoe_vsan_stat_t stat, 1463 uint32 num_entries, 1464 uint32 *counter_indexes, 1465 bcm_stat_value_t *counter_values); 1466 extern int bcm_td2_fcoe_vsan_stat_counter_set( 1467 int unit, 1468 bcm_fcoe_vsan_id_t vsan, 1469 bcm_fcoe_vsan_stat_t stat, 1470 uint32 num_entries, 1471 uint32 *counter_indexes, 1472 bcm_stat_value_t *counter_values); 1473 extern int bcm_td2_fcoe_vsan_stat_id_get(int unit, 1474 bcm_fcoe_vsan_id_t vsan, 1475 bcm_fcoe_vsan_stat_t stat, 1476 uint32 *stat_counter_id); 1477 extern int bcm_td2_fcoe_route_stat_attach(int unit, 1478 bcm_fcoe_route_t *route, 1479 uint32 stat_counter_id); 1480 extern int bcm_td2_fcoe_route_stat_detach(int unit, bcm_fcoe_route_t *route); 1481 extern int bcm_td2_fcoe_route_stat_counter_get( 1482 int unit, 1483 int sync_mode, 1484 bcm_fcoe_route_t *route, 1485 bcm_fcoe_route_stat_t stat, 1486 uint32 num_entries, 1487 uint32 *counter_indexes, 1488 bcm_stat_value_t *counter_values); 1489 extern int bcm_td2_fcoe_route_stat_counter_set ( 1490 int unit, 1491 bcm_fcoe_route_t *route, 1492 bcm_fcoe_route_stat_t stat, 1493 uint32 num_entries, 1494 uint32 *counter_indexes, 1495 bcm_stat_value_t *counter_values); 1496 extern int bcm_td2_fcoe_route_stat_id_get( 1497 int unit, 1498 bcm_fcoe_route_t *route, 1499 bcm_fcoe_route_stat_t stat, 1500 uint32 *stat_counter_id); 1501 int bcm_td2_fcoe_intf_config_set(int unit, uint32 flags, bcm_if_t intf, 1502 bcm_fcoe_intf_config_t *cfg); 1503 1504 int bcm_td2_fcoe_intf_config_get(int unit, uint32 flags, bcm_if_t intf, 1505 bcm_fcoe_intf_config_t *cfg); 1506 extern int bcm_td2_fcoe_zone_traverse(int unit, 1507 uint32 flags, 1508 bcm_fcoe_zone_traverse_cb trav_fn, 1509 void *user_data); 1510 extern int bcm_td2_fcoe_vsan_traverse(int unit, 1511 uint32 flags, 1512 bcm_fcoe_vsan_traverse_cb trav_fn, 1513 void *user_data); 1514 extern int bcm_td2_fcoe_route_traverse(int unit, 1515 uint32 flags, 1516 bcm_fcoe_route_traverse_cb trav_fn, 1517 void *user_data); 1518 extern int bcm_td2_vp_lag_port_learn_set(int unit, 1519 bcm_trunk_t tid, uint32 flags); 1520 extern int bcm_td2_vp_lag_port_learn_get(int unit, 1521 bcm_trunk_t tid, uint32 *flags); 1522 1523 /* QOS */ 1524 1525 extern int bcm_td2_qos_init(int unit); 1526 extern int bcm_td2_qos_detach(int unit); 1527 extern int bcm_td2_qos_map_create(int unit, uint32 flags, int *map_id); 1528 extern int bcm_td2_qos_map_destroy(int unit, int map_id); 1529 extern int bcm_td2_qos_map_add(int unit, uint32 flags, bcm_qos_map_t *map, 1530 int map_id); 1531 extern int bcm_td2_qos_map_delete(int unit, uint32 flags, bcm_qos_map_t *map, 1532 int map_id); 1533 extern int bcm_td2_qos_port_map_set(int unit, bcm_gport_t port, int ing_map, 1534 int egr_map); 1535 extern int bcm_td2_qos_map_multi_get(int unit, uint32 flags, 1536 int map_id, int array_size, 1537 bcm_qos_map_t *array, int *array_count); 1538 #ifdef BCM_WARM_BOOT_SUPPORT_SW_DUMP 1539 extern void _bcm_td2_qos_sw_dump(int unit); 1540 #endif /* BCM_WARM_BOOT_SUPPORT_SW_DUMP */ 1541 #ifdef BCM_WARM_BOOT_SUPPORT 1542 extern int _bcm_td2_qos_reinit_scache_len_get(int unit, uint32 *scache_len); 1543 extern int _bcm_td2_qos_reinit_from_hw_state(int unit, soc_mem_t mem, 1544 soc_field_t field, uint8 map_type, 1545 SHR_BITDCL *hw_idx_bmp, int hw_idx_bmp_len); 1546 extern int _bcm_td2_qos_unsynchronized_reinit(int unit); 1547 extern int _bcm_td2_qos_extended_reinit(int unit, uint8 **scache_ptr); 1548 extern int _bcm_td2_qos_reinit_hw_profiles_update (int unit); 1549 extern int _bcm_td2_qos_sync(int unit, uint8 **scache_ptr); 1550 #endif /* BCM_WARM_BOOT_SUPPORT */ 1551 extern int _bcm_td2_egr_port_set(int unit, bcm_port_t port, 1552 soc_field_t field, int value); 1553 extern int _bcm_td2_egr_port_get(int unit, bcm_port_t port, 1554 soc_field_t field, int *value); 1555 1556 extern int _bcm_td2_qos_idx2id(int unit, int hw_idx, int type, int *map_id); 1557 extern int bcm_td2_qos_port_map_type_get(int unit, bcm_gport_t port, 1558 uint32 flags, int *map_id); 1559 1560 extern int bcm_td2_fcoe_fc_header_type_set(int unit, uint32 flags, uint8 r_ctl, 1561 bcm_fcoe_fc_header_type_t hdr_type); 1562 extern int bcm_td2_fcoe_fc_header_type_get(int unit, uint32 flags, uint8 r_ctl, 1563 bcm_fcoe_fc_header_type_t *hdr_type); 1564 1565 extern int bcm_td2_fcoe_vsan_translate_action_add( 1566 int unit, 1567 bcm_fcoe_vsan_translate_key_config_t *key, 1568 bcm_fcoe_vsan_action_set_t *action); 1569 extern int bcm_td2_fcoe_vsan_translate_action_delete( 1570 int unit, 1571 bcm_fcoe_vsan_translate_key_config_t *key); 1572 extern uint32 _bcm_td2_fcoe_ing_vft_pri_action_encode( 1573 bcm_fcoe_vsan_action_t action); 1574 extern uint32 _bcm_td2_fcoe_egr_vft_pri_action_encode( 1575 bcm_fcoe_vsan_action_t action); 1576 extern uint32 _bcm_td2_fcoe_egr_vft_tag_action_encode( 1577 bcm_fcoe_vsan_action_t action); 1578 extern int bcm_td2_port_dscp_map_set(int unit, bcm_port_t port, int srccp, 1579 int mapcp, int prio, int cng); 1580 1581 /* L2 */ 1582 extern int _bcm_td2_l2_hit_retrieve(int unit, l2x_entry_t *l2x_entry, 1583 int l2_hw_index); 1584 extern int _bcm_td2_l2_hit_range_retrieve(int unit, soc_mem_t mem, int idx_min, 1585 int idx_max, uint32 *l2_tbl_chnk); 1586 1587 extern int 1588 _bcm_td2_port_enqueue_set(int unit, bcm_port_t gport, 1589 int enable); 1590 1591 extern int 1592 _bcm_td2_cosq_port_queue_state_check(int unit, bcm_port_t gport); 1593 extern int 1594 _bcm_td2_cosq_localport_resolve(int unit, bcm_gport_t gport, 1595 bcm_port_t *local_port); 1596 extern int 1597 _bcm_td2_cosq_hw_idx_get(int unit, int max_count, 1598 bcm_gport_t *port, int *hw_idx, int* count); 1599 1600 1601 extern int 1602 _bcm_td2_port_enqueue_get(int unit, bcm_port_t gport, 1603 int *enable); 1604 /* tag/pri actions for ING_VLAN_TAG_ACTION_PROFILE table */ 1605 #define _BCM_TD2_ING_TAG_ACTION_NONE 0 /* do not modify */ 1606 #define _BCM_TD2_ING_TAG_CFI_ACTION_NONE 0 /* do not modify */ 1607 #define _BCM_TD2_ING_TAG_PRI_ACTION_NONE 0 /* do not modify */ 1608 #define _BCM_TD2_EGR_TAG_ACTION_NONE 0 /* do not modify */ 1609 #define _BCM_TD2_EGR_TAG_CFI_ACTION_NONE 0 /* do not modify */ 1610 #define _BCM_TD2_EGR_TAG_PRI_ACTION_NONE 0 /* do not modify */ 1611 1612 /* actions for ING VFT PRI (ING_VLAN_TAG_ACTION_PROFILE) */ 1613 #define _BCM_TD2_ING_VFT_PRI_ACTION_NONE 0 1614 #define _BCM_TD2_ING_VFT_PRI_ACTION_USE_INNER_PRI 1 1615 #define _BCM_TD2_ING_VFT_PRI_ACTION_USE_OUTER_PRI 2 1616 #define _BCM_TD2_ING_VFT_PRI_ACTION_REPLACE 3 /* use VLAN_XLATE.XLATE:: 1617 FCOE_VSAN_PRI */ 1618 1619 /* actions for EGR VFT PRI (EGR_VLAN_TAG_ACTION_PROFILE) */ 1620 #define _BCM_TD2_EGR_VFT_PRI_ACTION_NONE 0 1621 #define _BCM_TD2_EGR_VFT_PRI_ACTION_USE_INTERNAL_IPRI 1 1622 #define _BCM_TD2_EGR_VFT_PRI_ACTION_USE_INTERNAL_OPRI 2 1623 #define _BCM_TD2_EGR_VFT_PRI_ACTION_REPLACE 3 /* use EVXLT.XLATE:: 1624 FCOE_VSAN_PRI */ 1625 1626 /* actions for EGR VFT Tag (EGR_VLAN_TAG_ACTION_PROFILE) */ 1627 #define _BCM_TD2_EGR_VFT_TAG_ACTION_NONE 0 1628 #define _BCM_TD2_EGR_VFT_TAG_ACTION_USE_INTERNAL_IVID 1 1629 #define _BCM_TD2_EGR_VFT_TAG_ACTION_USE_INTERNAL_OVID 2 1630 #define _BCM_TD2_EGR_VFT_TAG_ACTION_DELETE 3 1631 #define _BCM_TD2_EGR_VFT_TAG_ACTION_USE_INTERNAL_VSAN 4 1632 #define _BCM_TD2_EGR_VFT_TAG_ACTION_REPLACE 5 /* use EVXLT.XLATE:: 1633 FCOE_VSAN_ID */ 1634 1635 #ifdef BCM_WARM_BOOT_SUPPORT 1636 extern int _bcm_td2_fcoe_sync(int unit); 1637 extern int _bcm_td2_fcoe_reinit(int unit); 1638 #endif /* BCM_WARM_BOOT_SUPPORT */ 1639 1640 #ifdef BCM_WARM_BOOT_SUPPORT_SW_DUMP 1641 extern void _bcm_td2_fcoe_sw_dump(int unit); 1642 #endif /* BCM_WARM_BOOT_SUPPORT_SW_DUMP */ 1643 extern int soc_td2x_ser_dlb_parity_set(int unit, int enable); 1644 1645 /* 1646 * 8 Priority Groups supported. 1647 */ 1648 #define TD2_PRIOROTY_GROUP_ID_MIN 0 1649 #define TD2_PRIOROTY_GROUP_ID_MAX 7 1650 /* 1651 * Inpur priority range. 1652 * PFC : 0-7 1653 * SAFC : 0-15 1654 */ 1655 #define TD2_PFC_INPUT_PRIORITY_MIN 0 1656 #define TD2_PFC_INPUT_PRIORITY_MAX 7 1657 #define TD2_SAFC_INPUT_PRIORITY_MIN TD2_PFC_INPUT_PRIORITY_MIN 1658 #define TD2_SAFC_INPUT_PRIORITY_MAX 15 1659 1660 extern void _bcm_td2_qos_fcoe_get(int unit, int array_size, 1661 int *map_ids_array, int *flags_array, 1662 int *array_count); 1663 extern int _bcm_td2_qos_multi_get(int unit, int array_size, 1664 int *map_ids_array, int *flags_array, 1665 int *array_count); 1666 extern int bcm_td2_switch_ser_log_info_get(int unit, 1667 int id, bcm_switch_ser_log_info_t *info); 1668 1669 extern int bcm_td2_switch_ser_error_stat_get(int unit, 1670 bcm_switch_ser_error_stat_type_t stat_type, 1671 uint32 *value); 1672 1673 extern int bcm_td2_switch_ser_error_stat_clear(int unit, 1674 bcm_switch_ser_error_stat_type_t stat_type); 1675 #endif /* BCM_TRIDENT2_SUPPORT */ 1676 1677 #if defined(BCM_TRIDENT2_SUPPORT) || defined(BCM_PE_SUPPORT) 1678 #if defined(INCLUDE_L3) 1679 1680 /* Port Extender */ 1681 extern int bcm_td2_extender_forward_add(int unit, 1682 bcm_extender_forward_t *extender_forward_entry); 1683 extern int bcm_td2_extender_forward_delete(int unit, 1684 bcm_extender_forward_t *extender_forward_entry); 1685 extern int bcm_td2_extender_forward_delete_all(int unit); 1686 extern int bcm_td2_extender_forward_get(int unit, 1687 bcm_extender_forward_t *extender_forward_entry); 1688 extern int bcm_td2_extender_forward_traverse(int unit, 1689 bcm_extender_forward_traverse_cb cb, void *user_data); 1690 #endif /* INCLUDE_L3 */ 1691 #endif /* BCM_TRIDENT2_SUPPORT || BCM_PE_SUPPORT */ 1692 1693 #endif /* !_BCM_INT_TRIDENT2_H_ */