trident2.h (84876B)
1 /* 2 * 3 * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file. 4 * 5 * Copyright 2007-2020 Broadcom Inc. All rights reserved. 6 * 7 * File: 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 363 typedef int (*_bcm_td2_alpm_trace_dump_cb)(int u, void *user_data, char *log_data); 364 365 extern int _bcm_td2_alpm_trace_enabled(int u); 366 extern int _bcm_td2_alpm_trace_dump(int u, int showflags, _bcm_td2_alpm_trace_dump_cb dump_cb, void *user_data); 367 extern int _bcm_td2_alpm_trace_cnt(int u); 368 extern int _bcm_td2_alpm_trace_init(int u); 369 extern int _bcm_td2_alpm_trace_deinit(int u); 370 extern int _bcm_td2_alpm_trace_set(int u, int val); 371 extern int _bcm_td2_alpm_trace_clear(int u); 372 extern int _bcm_td2_alpm_trace_sanity(int u, int enable, int start, int end); 373 extern int _bcm_td2_alpm_trace_wrap_set(int u, int val); 374 extern int _bcm_td2_alpm_trace_log(int u, int op, _bcm_defip_cfg_t *cfg, int nh_idx, int rc); 375 376 #endif 377 378 379 /* L3 IPMC */ 380 extern int _bcm_td2_l3_ipmc_get_by_idx(int unit, void *dma_ptr, int idx, 381 _bcm_l3_cfg_t *l3cfg); 382 extern int _bcm_td2_l3_ipmc_get(int unit, _bcm_l3_cfg_t *l3cfg); 383 extern int _bcm_td2_l3_ipmc_add(int unit, _bcm_l3_cfg_t *l3cfg); 384 extern int _bcm_td2_l3_ipmc_del(int unit, _bcm_l3_cfg_t *l3cfg); 385 extern int bcm_td2_ipmc_pim_bidir_init(int unit); 386 extern int bcm_td2_ipmc_pim_bidir_detach(int unit); 387 extern int bcm_td2_ipmc_rp_create(int unit, uint32 flags, int *rp_id); 388 extern int bcm_td2_ipmc_rp_destroy(int unit, int rp_id); 389 extern int bcm_td2_ipmc_rp_set(int unit, int rp_id, int intf_count, 390 bcm_if_t *intf_array); 391 extern int bcm_td2_ipmc_rp_get(int unit, int rp_id, int intf_max, 392 bcm_if_t *intf_array, int *intf_count); 393 extern int bcm_td2_ipmc_rp_add(int unit, int rp_id, bcm_if_t intf_id); 394 extern int bcm_td2_ipmc_rp_delete(int unit, int rp_id, bcm_if_t intf_id); 395 extern int bcm_td2_ipmc_rp_delete_all(int unit, int rp_id); 396 extern int bcm_td2_ipmc_rp_ref_count_incr(int unit, int rp_id); 397 extern int bcm_td2_ipmc_rp_ref_count_decr(int unit, int rp_id); 398 extern int bcm_td2_ipmc_range_add(int unit, int *range_id, 399 bcm_ipmc_range_t *range); 400 extern int bcm_td2_ipmc_range_delete(int unit, int range_id); 401 extern int bcm_td2_ipmc_range_delete_all(int unit); 402 extern int bcm_td2_ipmc_range_get(int unit, int range_id, 403 bcm_ipmc_range_t *range); 404 extern int bcm_td2_ipmc_range_size_get(int unit, int *size); 405 /* TD2 v6 reserved multicast */ 406 extern int _bcm_td2_ipv6_reserved_multicast_addr_set(int unit, bcm_ip6_t ip6_addr, 407 bcm_ip6_t ip6_mask); 408 extern int _bcm_td2_ipv6_reserved_multicast_addr_get(int unit, bcm_ip6_t *ip6_addr, 409 bcm_ip6_t *ip6_mask); 410 #if defined(INCLUDE_BFD) 411 extern int bcmi_td2_bfd_init(int unit); 412 #endif /* INCLUDE_BFD */ 413 414 #ifdef BCM_WARM_BOOT_SUPPORT 415 extern int bcm_td2_ipmc_pim_bidir_scache_size_get(int unit, uint32 *size); 416 extern int bcm_td2_ipmc_pim_bidir_sync(int unit, uint8 **scache_ptr); 417 extern int bcm_td2_ipmc_pim_bidir_scache_recover(int unit, uint8 **scache_ptr); 418 extern int bcm_td2_ipmc_rp_ref_count_recover(int unit, int rp_id); 419 #endif /* BCM_WARM_BOOT_SUPPORT */ 420 #ifndef BCM_SW_STATE_DUMP_DISABLE 421 extern void _bcm_td2_ipmc_pim_bidir_sw_dump(int unit); 422 extern void _bcm_td2_vxlan_sw_dump(int unit); 423 #endif /* BCM_SW_STATE_DUMP_DISABLE */ 424 425 /* Flex stat - L3 host table */ 426 extern bcm_error_t _bcm_td2_l3_host_stat_attach( 427 int unit, 428 bcm_l3_host_t *info, 429 uint32 stat_counter_id); 430 extern bcm_error_t _bcm_td2_l3_host_stat_detach( 431 int unit, 432 bcm_l3_host_t *info); 433 extern bcm_error_t _bcm_td2_l3_host_stat_counter_get( 434 int unit, 435 int sync_mode, 436 bcm_l3_host_t *info, 437 bcm_l3_stat_t stat, 438 uint32 num_entries, 439 uint32 *counter_indexes, 440 bcm_stat_value_t *counter_values); 441 extern bcm_error_t _bcm_td2_l3_host_stat_counter_set( 442 int unit, 443 bcm_l3_host_t *info, 444 bcm_l3_stat_t stat, 445 uint32 num_entries, 446 uint32 *counter_indexes, 447 bcm_stat_value_t *counter_values); 448 extern bcm_error_t _bcm_td2_l3_host_stat_id_get( 449 int unit, 450 bcm_l3_host_t *info, 451 bcm_l3_stat_t stat, 452 uint32 *stat_counter_id); 453 454 /* Flex Stat - L3 Route defip */ 455 extern bcm_error_t _bcm_td2_l3_route_stat_attach ( 456 int unit, 457 bcm_l3_route_t *info, 458 uint32 stat_counter_id); 459 extern bcm_error_t _bcm_td2_l3_route_stat_detach ( 460 int unit, 461 bcm_l3_route_t *info); 462 463 extern bcm_error_t _bcm_td2_l3_route_stat_counter_get( 464 int unit, 465 int sync_mode, 466 bcm_l3_route_t *info, 467 bcm_l3_route_stat_t stat, 468 uint32 num_entries, 469 uint32 *counter_indexes, 470 bcm_stat_value_t *counter_values); 471 472 extern bcm_error_t _bcm_td2_l3_route_stat_counter_set( 473 int unit, 474 bcm_l3_route_t *info, 475 bcm_l3_route_stat_t stat, 476 uint32 num_entries, 477 uint32 *counter_indexes, 478 bcm_stat_value_t *counter_values); 479 extern bcm_error_t _bcm_td2_l3_route_stat_multi_get( 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_get32( 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 493 extern bcm_error_t _bcm_td2_l3_route_stat_multi_set( 494 int unit, 495 bcm_l3_route_t *info, 496 int nstat, 497 bcm_l3_route_stat_t *stat_arr, 498 uint64 *value_arr); 499 500 extern bcm_error_t _bcm_td2_l3_route_stat_multi_set32( 501 int unit, 502 bcm_l3_route_t *info, 503 int nstat, 504 bcm_l3_route_stat_t *stat_arr, 505 uint32 *value_arr); 506 extern bcm_error_t _bcm_td2_l3_route_stat_id_get( 507 int unit, 508 bcm_l3_route_t *info, 509 bcm_l3_route_stat_t stat, 510 uint32 *stat_counter_id); 511 extern int _bcm_td2_ip_key_to_l3cfg( 512 int unit, bcm_l3_key_t *ipkey, 513 _bcm_l3_cfg_t *l3cfg); 514 extern int 515 _bcm_td2_l3cfg_to_ipkey( 516 int unit, bcm_l3_key_t *ipkey, _bcm_l3_cfg_t *l3cfg); 517 518 extern bcm_error_t _bcm_td2_ipmc_stat_attach( 519 int unit, 520 bcm_ipmc_addr_t *info, 521 uint32 stat_counter_id); 522 extern bcm_error_t _bcm_td2_ipmc_stat_detach( 523 int unit, 524 bcm_ipmc_addr_t *info); 525 extern bcm_error_t _bcm_td2_ipmc_stat_counter_get( 526 int unit, 527 int sync_mode, 528 bcm_ipmc_addr_t *info, 529 bcm_ipmc_stat_t stat, 530 uint32 num_entries, 531 uint32 *counter_indexes, 532 bcm_stat_value_t *counter_values); 533 extern bcm_error_t _bcm_td2_ipmc_stat_counter_set( 534 int unit, 535 bcm_ipmc_addr_t *info, 536 bcm_ipmc_stat_t stat, 537 uint32 num_entries, 538 uint32 *counter_indexes, 539 bcm_stat_value_t *counter_values); 540 extern bcm_error_t _bcm_td2_ipmc_stat_id_get( 541 int unit, 542 bcm_ipmc_addr_t *info, 543 bcm_ipmc_stat_t stat, 544 uint32 *stat_counter_id); 545 extern bcm_error_t _bcm_td2_ipmc_stat_multi_get( 546 int unit, 547 bcm_ipmc_addr_t *info, 548 int nstat, 549 bcm_ipmc_stat_t *stat_arr, 550 uint64 *value_arr); 551 extern bcm_error_t _bcm_td2_ipmc_stat_multi_get32( 552 int unit, 553 bcm_ipmc_addr_t *info, 554 int nstat, 555 bcm_ipmc_stat_t *stat_arr, 556 uint32 *value_arr); 557 extern bcm_error_t _bcm_td2_ipmc_stat_multi_set( 558 int unit, 559 bcm_ipmc_addr_t *info, 560 int nstat, 561 bcm_ipmc_stat_t *stat_arr, 562 uint64 *value_arr); 563 extern bcm_error_t _bcm_td2_ipmc_stat_multi_set32( 564 int unit, 565 bcm_ipmc_addr_t *info, 566 int nstat, 567 bcm_ipmc_stat_t *stat_arr, 568 uint32 *value_arr); 569 570 extern int _bcm_td2_l3_ip4_options_free_resources(int unit); 571 extern int _bcm_td2_l3_ip4_options_profile_init(int unit); 572 extern int _bcm_td2_l3_ip4_options_profile_create(int unit, uint32 flags, 573 bcm_l3_ip4_options_action_t default_action, 574 int *ip4_options_profile_id); 575 extern int _bcm_td2_l3_ip4_options_profile_destroy(int unit, 576 int ip4_options_profile_id); 577 extern int _bcm_td2_l3_ip4_options_profile_action_set(int unit, 578 int ip4_options_profile_id, 579 int ip4_option, 580 bcm_l3_ip4_options_action_t action); 581 extern int _bcm_td2_l3_ip4_options_profile_action_get(int unit, 582 int ip4_options_profile_id, 583 int ip4_option, 584 bcm_l3_ip4_options_action_t *action); 585 extern int _bcm_td2_l3_ip4_options_profile_multi_get(int unit, int array_size, 586 int *ip_options_ids_array, 587 int *array_count); 588 extern int _bcm_td2_l3_ip4_options_profile_action_multi_get(int unit, 589 uint32 flags, 590 int ip_option_profile_id, int array_size, 591 bcm_l3_ip4_options_action_t *array, int *array_count); 592 extern int _bcm_td2_l3_ip4_options_profile_id2idx(int unit, int profile_id, 593 int *hw_idx); 594 extern int _bcm_td2_l3_ip4_options_profile_idx2id(int unit, int hw_idx, 595 int *profile_id); 596 extern int _bcm_td2_vp_urpf_mode_set(int unit, bcm_port_t port, int arg); 597 extern int _bcm_td2_vp_urpf_mode_get(int unit, bcm_port_t port, int *arg); 598 extern int _bcm_td2_l3_intf_iif_profile_update(int unit, bcm_vlan_t vid, 599 bcm_vlan_control_vlan_t *control); 600 extern int _bcm_td2_l3_intf_iif_profile_get(int unit, bcm_vlan_t vid, 601 bcm_vlan_control_vlan_t *control); 602 extern int _bcm_td2_l3_iif_ip4_options_profile_index_set( 603 int unit, _bcm_l3_intf_cfg_t *intf_info); 604 extern int _bcm_td2_l3_iif_ip4_options_profile_index_get( 605 int unit, _bcm_l3_intf_cfg_t *intf_info); 606 #ifdef BCM_WARM_BOOT_SUPPORT 607 extern int _bcm_td2_l3_ip4_options_profile_scache_len_get(int unit, 608 int *wb_alloc_size); 609 extern int _bcm_td2_l3_ip4_options_recover(int unit, uint8 **scache_ptr, 610 int offset); 611 612 extern int _bcm_td2_l3_ip4_options_sync(int unit, uint8 **scache_ptr, int offset); 613 #endif /* BCM_WARM_BOOT_SUPPORT */ 614 615 /* VXLAN */ 616 extern int bcm_td2_vxlan_udpDestPort_set(int unit, int udpDestPort); 617 extern int bcm_td2_vxlan_udpSourcePort_set(int unit, int hashEnable); 618 extern int bcm_td2_vxlan_udpDestPort_get(int unit, int *udpDestPort); 619 extern int bcm_td2_vxlan_udpSourcePort_get(int unit, int *hashEnable); 620 extern int bcm_td2_vxlan_egress_get(int unit, bcm_l3_egress_t *egr, int nh_index); 621 extern int bcm_td2_vxlan_next_hop_set(int unit, int nh_index, uint32 flags, int vp, int drop); 622 extern int bcm_td2_vxlan_egress_reset(int unit, int nh_index); 623 624 extern int _bcm_td2_vxlan_port_resolve( 625 int unit, 626 bcm_gport_t l2gre_port_id, 627 bcm_if_t encap_id, 628 bcm_module_t *modid, 629 bcm_port_t *port, 630 bcm_trunk_t *trunk_id, 631 int *id); 632 633 extern int bcm_td2_vxlan_lock(int unit); 634 extern void bcm_td2_vxlan_unlock(int unit); 635 extern int bcm_td2_vxlan_init(int unit); 636 extern int bcm_td2_vxlan_cleanup(int unit); 637 extern int bcm_td2_vxlan_vpn_create(int unit, bcm_vxlan_vpn_config_t *info); 638 extern int bcm_td2_vxlan_vpn_destroy(int unit, bcm_vpn_t l2vpn); 639 extern int bcm_td2_vxlan_vpn_destroy_all(int unit); 640 extern int bcm_td2_vxlan_vpn_traverse(int unit, bcm_vxlan_vpn_traverse_cb cb, void *user_data); 641 extern int bcm_td2_vxlan_port_traverse(int unit, bcm_vxlan_port_traverse_cb cb, void *user_data); 642 extern int bcm_td2_vxlan_vpn_get( int unit, bcm_vpn_t l2vpn, bcm_vxlan_vpn_config_t *info); 643 extern int bcm_td2_vxlan_port_add(int unit, bcm_vpn_t vpn, bcm_vxlan_port_t *vxlan_port); 644 extern int bcm_td2_vxlan_port_delete(int unit, bcm_vpn_t vpn, bcm_gport_t vxlan_port_id); 645 extern int bcm_td2_vxlan_port_delete_all(int unit, bcm_vpn_t vpn); 646 extern int bcm_td2_vxlan_port_get(int unit, bcm_vpn_t vpn, bcm_vxlan_port_t *vxlan_port); 647 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); 648 extern void bcm_td2_vxlan_port_match_count_adjust(int unit, int vp, int step); 649 extern int bcm_td2_vxlan_tunnel_initiator_create(int unit, bcm_tunnel_initiator_t *info); 650 extern int bcm_td2_vxlan_tunnel_initiator_destroy(int unit, bcm_gport_t vxlan_tunnel_id); 651 extern int bcm_td2_vxlan_tunnel_initiator_destroy_all(int unit); 652 extern int bcm_td2_vxlan_tunnel_initiator_get(int unit, bcm_tunnel_initiator_t *info); 653 extern int bcm_td2_vxlan_tunnel_initiator_traverse(int unit, bcm_tunnel_initiator_traverse_cb cb, void *user_data); 654 extern int _bcm_td2_vxlan_tunnel_initiator_cmp(int unit, void *buf, int index, 655 int *cmp_result); 656 extern int _bcm_td2_vxlan_tunnel_initiator_hash_calc(int unit, void *buf, 657 uint16 *hash); 658 extern int bcm_td2_vxlan_tunnel_terminator_create(int unit, bcm_tunnel_terminator_t *info); 659 extern int bcm_td2_vxlan_tunnel_terminator_update(int unit, bcm_tunnel_terminator_t *info); 660 extern int bcm_td2_vxlan_tunnel_terminator_destroy(int unit, bcm_gport_t vxlan_tunnel_id); 661 extern int bcm_td2_vxlan_tunnel_terminator_destroy_all(int unit); 662 extern int bcm_td2_vxlan_tunnel_terminator_get( int unit, bcm_tunnel_terminator_t *info); 663 extern int bcm_td2_vxlan_tunnel_terminator_traverse(int unit, bcm_tunnel_terminator_traverse_cb cb, void *user_data); 664 extern int _bcm_td2_vxlan_vpn_get(int unit, int vfi_index, bcm_vlan_t *vid); 665 extern int bcm_td2_vxlan_multicast_leaf_entry_check(int unit, int tunnel_idx, int enable_flag); 666 extern int _bcm_td2_vxlan_vpn_is_valid( int unit, bcm_vpn_t l2vpn); 667 extern int _bcm_td2_vxlan_vpn_is_eline( int unit, bcm_vpn_t l2vpn, uint8 *isEline); 668 extern int bcm_td2_vxlan_port_learn_set(int unit, bcm_gport_t vxlan_port_id, uint32 flags); 669 extern int bcm_td2_vxlan_port_learn_get(int unit, bcm_gport_t vxlan_port_id, uint32 *flags); 670 extern int bcm_td2_vxlan_trunk_member_add (int unit, bcm_trunk_t trunk_id, 671 int trunk_member_count, bcm_port_t *trunk_member_array); 672 extern int bcm_td2_vxlan_trunk_member_delete(int unit, bcm_trunk_t trunk_id, 673 int trunk_member_count, bcm_port_t *trunk_member_array); 674 extern int _bcm_td2_vxlan_port_get(int unit, bcm_vpn_t vpn, int vp, 675 bcm_vxlan_port_t *vxlan_port); 676 extern int _bcm_td2_vxlan_match_add(int unit, bcm_vxlan_port_t *vxlan_port, int vp, bcm_vpn_t vpn); 677 extern int _bcm_td2_vxlan_match_delete(int unit, int vp , bcm_vxlan_port_t vxlan_port, bcm_vpn_t vpn); 678 extern int bcm_td2_vxlan_port_source_vp_lag_set(int unit, bcm_gport_t gport, int vp_lag_vp); 679 extern int bcm_td2_vxlan_port_source_vp_lag_clear(int unit, bcm_gport_t gport, int vp_lag_vp); 680 extern int bcm_td2_vxlan_port_source_vp_lag_get(int unit, bcm_gport_t gport, int *vp_lag_vp); 681 extern int _bcm_td2_vxlan_svp_field_set(int unit, bcm_gport_t vp, soc_field_t field, int value); 682 683 /* L2GRE */ 684 extern int bcm_td2_l2gre_match_add(int unit, bcm_l2gre_port_t *l2gre_port, int vp, bcm_vpn_t vpn); 685 extern int bcm_td2_l2gre_match_delete(int unit, int vp, bcm_l2gre_port_t *l2gre_port); 686 extern int bcm_td2_l2gre_match_get(int unit, bcm_l2gre_port_t *l2gre_port, int vp); 687 extern int _bcm_td2_l2gre_eline_vp_configure (int unit, int vfi_index, int active_vp, 688 source_vp_entry_t *svp, int tpid_enable, bcm_l2gre_port_t *l2gre_port); 689 extern int _bcm_td2_l2gre_elan_vp_configure (int unit, int vfi_index, int active_vp, 690 source_vp_entry_t *svp, int tpid_enable, bcm_l2gre_port_t *l2gre_port); 691 extern int _bcm_td2_vxlan_port_get(int unit, bcm_vpn_t vpn, int vp, 692 bcm_vxlan_port_t *vxlan_port); 693 extern int _bcm_td2_vxlan_default_port_get(int unit, int vp, bcm_vxlan_port_t *vxlan_port); 694 695 /* VP LAG */ 696 extern int bcm_td2_vp_lag_init(int unit); 697 extern void bcm_td2_vp_lag_deinit(int unit); 698 extern int bcm_td2_vp_lag_create(int unit, uint32 flags, bcm_trunk_t *tid, 699 bcm_gport_t *vplag_port_id); 700 extern int bcm_td2_vp_lag_info_get(int unit, int *ngroups_vp_lag, 701 int *nports_vp_lag); 702 extern int bcm_td2_vp_lag_set(int unit, bcm_trunk_t tid, 703 bcm_trunk_info_t *trunk_info, int member_count, 704 bcm_trunk_member_t *member_array); 705 extern int bcm_td2_vp_lag_destroy(int unit, bcm_trunk_t tid); 706 extern int bcm_td2_vp_lag_get(int unit, bcm_trunk_t tid, 707 bcm_trunk_info_t *trunk_info, int member_max, 708 bcm_trunk_member_t *member_array, int *member_count); 709 extern int _bcm_td2_vp_lag_match_multi_get( 710 int unit, bcm_trunk_t tid, int size, 711 bcm_port_match_info_t *match_array, int *count); 712 extern int bcm_td2_tid_to_vp_lag_vp(int unit, bcm_trunk_t tid, int *vp_lag_vp); 713 extern int bcm_td2_vp_lag_vp_to_tid(int unit, int vp_lag_vp, bcm_trunk_t *tid); 714 extern int bcm_td2_vp_lag_find(int unit, bcm_port_t port, bcm_trunk_t *tid); 715 extern int bcm_td2_vlan_vp_source_vp_lag_set(int unit, bcm_gport_t gport, 716 int vp_lag_vp); 717 extern int bcm_td2_vlan_vp_source_vp_lag_clear(int unit, bcm_gport_t gport, 718 int vp_lag_vp); 719 extern int bcm_td2_vlan_vp_source_vp_lag_get(int unit, bcm_gport_t gport, 720 int *vp_lag_vp); 721 extern int bcm_td2_niv_port_source_vp_lag_set(int unit, bcm_gport_t gport, 722 int vp_lag_vp); 723 extern int bcm_td2_niv_port_source_vp_lag_clear(int unit, bcm_gport_t gport, 724 int vp_lag_vp); 725 extern int bcm_td2_niv_port_source_vp_lag_get(int unit, bcm_gport_t gport, 726 int *vp_lag_vp); 727 extern int bcm_td2_extender_port_source_vp_lag_set(int unit, bcm_gport_t gport, 728 int vp_lag_vp); 729 extern int bcm_td2_extender_port_source_vp_lag_clear(int unit, bcm_gport_t gport, 730 int vp_lag_vp); 731 extern int bcm_td2_extender_port_source_vp_lag_get(int unit, bcm_gport_t gport, 732 int *vp_lag_vp); 733 extern int bcm_td2_mim_port_source_vp_lag_set(int unit, bcm_gport_t gport, 734 int vp_lag_vp); 735 extern int bcm_td2_mim_port_source_vp_lag_clear(int unit, bcm_gport_t gport, 736 int vp_lag_vp); 737 extern int bcm_td2_mim_port_source_vp_lag_get(int unit, bcm_gport_t gport, 738 int *vp_lag_vp); 739 extern int bcm_td2_l2gre_port_source_vp_lag_set(int unit, bcm_gport_t gport, 740 int vp_lag_vp); 741 extern int bcm_td2_l2gre_port_source_vp_lag_clear(int unit, bcm_gport_t gport, 742 int vp_lag_vp); 743 extern int bcm_td2_l2gre_port_source_vp_lag_get(int unit, bcm_gport_t gport, 744 int *vp_lag_vp); 745 extern int bcm_td2_vp_lag_status_get(int unit, int vp_lag_id, int *is_vp_lag, 746 int *is_used, int *has_member); 747 extern int _bcm_td2_vp_lag_member_is_vfi_type(int unit, bcm_trunk_t tid, int *vfi_type); 748 extern int _bcm_esw_num_vp_trunk_groups(int unit); 749 #ifdef BCM_WARM_BOOT_SUPPORT 750 extern int bcm_td2_vp_lag_reinit(int unit); 751 extern int _bcm_td2_vp_lag_egr_dis_vp_scache_size_get(int unit, int *size); 752 extern int _bcm_td2_vp_lag_egr_dis_vp_scache_recover(int unit, uint8 **scache_ptr); 753 extern int _bcm_td2_vp_lag_egr_dis_vp_sync(int unit, uint8 **scache_ptr); 754 #endif /* BCM_WARM_BOOT_SUPPORT */ 755 #ifndef BCM_SW_STATE_DUMP_DISABLE 756 extern void bcm_td2_vp_lag_sw_dump(int unit); 757 #endif /* BCM_SW_STATE_DUMP_DISABLE */ 758 759 extern int bcm_td2_multicast_l3_vp_init(int unit); 760 extern int bcm_td2_multicast_l3_vp_detach(int unit); 761 extern int bcm_td2_multicast_l3_vp_encap_get(int unit, bcm_multicast_t group, 762 bcm_gport_t port, bcm_if_t intf, bcm_if_t *encap_id); 763 extern int bcm_td2_multicast_l3_vp_next_hop_free(int unit, int intf); 764 #ifdef BCM_WARM_BOOT_SUPPORT_SW_DUMP 765 extern void bcm_td2_multicast_l3_vp_sw_dump(int unit); 766 #endif /* BCM_WARM_BOOT_SUPPORT_SW_DUMP */ 767 768 /* ECMP resilient hashing */ 769 extern int bcm_td2_ecmp_rh_init(int unit); 770 extern void bcm_td2_ecmp_rh_deinit(int unit); 771 extern int bcm_td2_l3_egress_ecmp_rh_create(int unit, 772 bcm_l3_egress_ecmp_t *ecmp, int intf_count, bcm_if_t *intf_array, 773 int op, int count, bcm_if_t *intf); 774 extern int bcm_td2_l3_egress_ecmp_rh_destroy(int unit, bcm_if_t mpintf); 775 extern int bcm_td2_l3_egress_ecmp_rh_get(int unit, bcm_l3_egress_ecmp_t *ecmp); 776 extern int bcm_td2_l3_egress_ecmp_rh_ethertype_set(int unit, uint32 flags, 777 int ethertype_count, int *ethertype_array); 778 extern int bcm_td2_l3_egress_ecmp_rh_ethertype_get(int unit, uint32 *flags, 779 int ethertype_max, int *ethertype_array, int *ethertype_count); 780 extern int bcm_td2_l3_egress_ecmp_rh_shared_copy(int unit, int old_ecmp_group, 781 int new_ecmp_group); 782 #ifdef BCM_WARM_BOOT_SUPPORT 783 extern int bcm_td2_ecmp_rh_hw_recover(int unit); 784 #endif /* BCM_WARM_BOOT_SUPPORT */ 785 #ifndef BCM_SW_STATE_DUMP_DISABLE 786 extern void bcm_td2_ecmp_rh_sw_dump(int unit); 787 #endif /* BCM_SW_STATE_DUMP_DISABLE */ 788 /* Proxy */ 789 extern int bcm_td2_proxy_egress_create(int unit, uint32 flags, bcm_proxy_egress_t *proxy_egr, 790 bcm_if_t *proxy_intf_id); 791 extern int bcm_td2_proxy_egress_destroy(int unit, bcm_if_t proxy_intf_id); 792 extern int bcm_td2_proxy_egress_get(int unit, bcm_if_t proxy_intf_id, bcm_proxy_egress_t *proxy_egr); 793 extern int _bcm_td2_proxy_nh_add(int unit, int idx, void *buf, void *info); 794 extern int _bcm_td2_proxy_nh_get(int unit, int idx, bcm_proxy_egress_t *proxy_nh_entry); 795 extern int bcm_td2_proxy_egress_traverse(int unit, bcm_proxy_egress_traverse_cb cb, 796 void *user_data); 797 #ifdef BCM_WARM_BOOT_SUPPORT 798 extern int _bcm_td2_vlan_vp_scache_size_get(int unit, int *size); 799 extern int _bcm_td2_vlan_vp_sync(int unit, uint8 **scache_ptr); 800 extern int _bcm_td2_vlan_vp_recover(int unit, uint8 **scache_ptr); 801 #endif 802 #endif /* INCLUDE_L3 */ 803 804 extern int bcm_td2_cosq_init(int unit); 805 806 extern int bcm_td2_cosq_detach(int unit, int software_state_only); 807 808 extern int bcm_td2_cosq_config_set(int unit, int numq); 809 810 extern int bcm_td2_cosq_config_get(int unit, int *numq); 811 812 #if defined(BCM_TRIDENT2_SUPPORT) 813 extern int bcm_td2p_port_cosq_config_set(int unit, bcm_port_t port, int enable); 814 #endif 815 816 extern int bcm_td2_cosq_mapping_set(int unit, bcm_port_t gport, 817 bcm_cos_t priority, bcm_cos_queue_t cosq); 818 819 extern int bcm_td2_cosq_mapping_get(int unit, bcm_port_t gport, 820 bcm_cos_t priority, bcm_cos_queue_t *cosq); 821 822 extern int bcm_td2_cosq_port_sched_set(int unit, bcm_pbmp_t pbm, 823 int mode, const int *weights, int delay); 824 825 extern int bcm_td2_cosq_port_sched_get(int unit, bcm_pbmp_t pbm, 826 int *mode, int *weights, int *delay); 827 828 extern int bcm_td2_cosq_priority_mapping_get_all(int unit, bcm_gport_t gport, 829 int index, bcm_cosq_priority_mapping_t type, 830 int pri_max, int *pri_array, 831 int *pri_count); 832 833 extern int bcm_td2_cosq_sched_weight_max_get(int unit, int mode, 834 int *weight_max); 835 836 extern int bcm_td2_cosq_discard_set(int unit, uint32 flags); 837 838 extern int bcm_td2_cosq_discard_get(int unit, uint32 *flags); 839 840 extern int 841 bcm_td2_cosq_gport_discard_set(int unit, bcm_gport_t gport, 842 bcm_cos_queue_t cosq, 843 bcm_cosq_gport_discard_t *discard); 844 845 extern int 846 bcm_td2_cosq_gport_discard_get(int unit, bcm_gport_t gport, 847 bcm_cos_queue_t cosq, 848 bcm_cosq_gport_discard_t *discard); 849 850 extern int 851 _bcm_td2_cosq_pfc_class_resolve(bcm_switch_control_t sctype, int *type, 852 int *class); 853 854 extern int 855 bcm_td2_cosq_port_pfc_op(int unit, bcm_port_t port, 856 bcm_switch_control_t sctype, _bcm_cosq_op_t op, 857 bcm_gport_t *gport, int gport_count); 858 859 extern int 860 bcm_td2_cosq_port_pfc_get(int unit, bcm_port_t port, 861 bcm_switch_control_t sctype, 862 bcm_gport_t *gport, int gport_count, 863 int *actual_gport_count); 864 865 extern int 866 bcm_td2_cosq_gport_add(int unit, bcm_gport_t port, int numq, uint32 flags, 867 bcm_gport_t *gport); 868 869 extern int 870 bcm_td2_cosq_gport_detach(int unit, bcm_gport_t sched_gport, 871 bcm_gport_t input_gport, bcm_cos_queue_t cosq); 872 873 extern int 874 bcm_td2_cosq_discard_port_get(int unit, bcm_port_t port, 875 bcm_cos_queue_t cosq, uint32 color, int *drop_start, 876 int *drop_slope, int *average_time); 877 878 extern int 879 bcm_td2_cosq_gport_delete(int unit, bcm_gport_t gport); 880 881 extern int 882 bcm_td2_cosq_gport_get(int unit, bcm_gport_t gport, bcm_gport_t *port, 883 int *numq, uint32 *flags); 884 885 extern int 886 bcm_td2_cosq_gport_traverse(int unit, bcm_cosq_gport_traverse_cb cb, 887 void *user_data); 888 889 extern int 890 bcm_td2_cosq_discard_port_set(int unit, bcm_port_t port, 891 bcm_cos_queue_t cosq, 892 uint32 color, int drop_start, int drop_slope, 893 int average_time); 894 895 extern int 896 bcm_td2_cosq_gport_attach(int unit, bcm_gport_t sched_gport, 897 bcm_gport_t input_gport, bcm_cos_queue_t cosq); 898 899 extern int 900 bcm_td2_cosq_gport_attach_get(int unit, bcm_gport_t sched_gport, 901 bcm_gport_t *input_gport, bcm_cos_queue_t *cosq); 902 903 extern int 904 bcm_td2_cosq_gport_child_get(int unit, bcm_gport_t in_gport, 905 bcm_cos_queue_t cosq, bcm_gport_t *out_gport); 906 907 extern int 908 bcm_td2_cosq_port_bandwidth_set(int unit, bcm_port_t port, 909 bcm_cos_queue_t cosq, 910 uint32 min_quantum, uint32 max_quantum, 911 uint32 burst_quantum, uint32 flags); 912 913 extern int 914 bcm_td2_cosq_port_bandwidth_get(int unit, bcm_port_t port, 915 bcm_cos_queue_t cosq, 916 uint32 *min_quantum, uint32 *max_quantum, 917 uint32 *burst_quantum, uint32 *flags); 918 919 extern int 920 bcm_td2_cosq_port_pps_set(int unit, bcm_port_t port, bcm_cos_queue_t cosq, 921 int pps); 922 923 extern int 924 bcm_td2_cosq_port_pps_get(int unit, bcm_port_t port, bcm_cos_queue_t cosq, 925 int *pps); 926 927 extern int bcm_td2_cosq_port_burst_set(int unit, bcm_port_t port, 928 bcm_cos_queue_t cosq, int burst); 929 930 extern int 931 bcm_td2_cosq_stat_set(int unit, bcm_gport_t port, bcm_cos_queue_t cosq, 932 bcm_cosq_stat_t stat, uint64 value); 933 934 extern int 935 bcm_td2_cosq_stat_get(int unit, bcm_port_t port, bcm_cos_queue_t cosq, 936 bcm_cosq_stat_t stat, int sync_mode, uint64 *value); 937 938 extern int 939 bcm_td2_cosq_port_burst_get(int unit, bcm_port_t port, bcm_cos_queue_t cosq, 940 int *burst); 941 942 extern int 943 bcm_td2_cosq_control_set(int unit, bcm_gport_t gport, bcm_cos_queue_t cosq, 944 bcm_cosq_control_t type, int arg); 945 946 extern int 947 bcm_td2_cosq_control_get(int unit, bcm_gport_t gport, bcm_cos_queue_t cosq, 948 bcm_cosq_control_t type, int *arg); 949 950 extern int 951 bcm_td2_cosq_service_pool_set(int unit, bcm_service_pool_id_t id, 952 bcm_cosq_service_pool_t cosq_service_pool); 953 954 extern int 955 bcm_td2_cosq_service_pool_get(int unit, bcm_service_pool_id_t id, 956 bcm_cosq_service_pool_t *cosq_service_pool); 957 958 extern int 959 bcm_td2_cosq_gport_bandwidth_burst_set(int unit, bcm_gport_t gport, 960 bcm_cos_queue_t cosq, 961 uint32 kbits_burst_min, 962 uint32 kbits_burst_max); 963 964 extern int 965 bcm_td2_cosq_gport_bandwidth_burst_get(int unit, bcm_gport_t gport, 966 bcm_cos_queue_t cosq, 967 uint32 *kbits_burst_min, 968 uint32 *kbits_burst_max); 969 extern int 970 bcm_td2_cosq_gport_bandwidth_set(int unit, bcm_gport_t gport, 971 bcm_cos_queue_t cosq, uint32 kbits_sec_min, 972 uint32 kbits_sec_max, uint32 flags); 973 974 extern int 975 bcm_td2_cosq_gport_bandwidth_get(int unit, bcm_gport_t gport, 976 bcm_cos_queue_t cosq, uint32 *kbits_sec_min, 977 uint32 *kbits_sec_max, uint32 *flags); 978 979 extern int bcm_td2_cosq_congestion_queue_set(int unit, bcm_port_t port, 980 bcm_cos_queue_t cosq, int index); 981 extern int bcm_td2_cosq_congestion_queue_get(int unit, bcm_port_t port, 982 bcm_cos_queue_t cosq, int *index); 983 extern int bcm_td2_cosq_congestion_quantize_set(int unit, bcm_port_t port, 984 bcm_cos_queue_t cosq, 985 int weight_code, int setpoint); 986 extern int bcm_td2_cosq_congestion_quantize_get(int unit, bcm_port_t port, 987 bcm_cos_queue_t cosq, 988 int *weight_code, 989 int *setpoint); 990 extern int bcm_td2_cosq_congestion_sample_int_set(int unit, bcm_port_t port, 991 bcm_cos_queue_t cosq, 992 int min, int max); 993 extern int bcm_td2_cosq_congestion_sample_int_get(int unit, bcm_port_t port, 994 bcm_cos_queue_t cosq, 995 int *min, int *max); 996 extern int bcm_td2_cosq_drop_status_enable_set(int unit, bcm_port_t port, 997 int enable); 998 extern int _bcm_td2_get_def_qbase(int unit, bcm_port_t inport, int qtype, 999 int *pbase, int *pnumq); 1000 1001 extern int bcm_td2_cosq_gport_sched_set(int unit, bcm_gport_t gport, 1002 bcm_cos_queue_t cosq, int mode, 1003 int weight); 1004 extern int bcm_td2_cosq_gport_sched_get(int unit, bcm_gport_t gport, 1005 bcm_cos_queue_t cosq, int *mode, 1006 int *weight); 1007 extern int 1008 _bcm_td2_cosq_port_resolve(int unit, bcm_gport_t gport, bcm_module_t *modid, 1009 bcm_port_t *port, bcm_trunk_t *trunk_id, int *id, 1010 int *qnum); 1011 1012 extern int 1013 bcm_td2_cosq_gport_mapping_set(int unit, bcm_port_t ing_port, 1014 bcm_cos_t int_pri, uint32 flags, 1015 bcm_gport_t gport, bcm_cos_queue_t cosq); 1016 1017 extern int 1018 bcm_td2_cosq_gport_congestion_config_set(int unit, bcm_gport_t port, 1019 bcm_cos_queue_t cosq, 1020 bcm_cosq_congestion_info_t *config); 1021 extern int 1022 bcm_td2_cosq_gport_mapping_get(int unit, bcm_port_t ing_port, 1023 bcm_cos_t int_pri, uint32 flags, 1024 bcm_gport_t *gport, bcm_cos_queue_t *cosq); 1025 extern int 1026 bcm_td2_cosq_gport_congestion_config_get(int unit, bcm_gport_t port, 1027 bcm_cos_queue_t cosq, 1028 bcm_cosq_congestion_info_t *config); 1029 1030 extern int 1031 bcm_td2_cosq_bst_profile_set(int unit, 1032 bcm_gport_t port, 1033 bcm_cos_queue_t cosq, 1034 bcm_bst_stat_id_t bid, 1035 bcm_cosq_bst_profile_t *profile); 1036 1037 extern int 1038 bcm_td2_cosq_bst_profile_get(int unit, 1039 bcm_gport_t port, 1040 bcm_cos_queue_t cosq, 1041 bcm_bst_stat_id_t bid, 1042 bcm_cosq_bst_profile_t *profile); 1043 1044 extern int 1045 bcm_td2_cosq_bst_stat_get(int unit, 1046 bcm_gport_t port, 1047 bcm_cos_queue_t cosq, 1048 bcm_bst_stat_id_t bid, 1049 uint32 options, 1050 uint64 *pvalue); 1051 1052 extern int 1053 bcm_td2_cosq_bst_stat_multi_get(int unit, 1054 bcm_gport_t port, 1055 bcm_cos_queue_t cosq, 1056 uint32 options, 1057 int max_values, 1058 bcm_bst_stat_id_t *id_list, 1059 uint64 *pvalues); 1060 extern int 1061 bcm_td2_cosq_bst_stat_clear(int unit, 1062 bcm_gport_t port, 1063 bcm_cos_queue_t cosq, 1064 bcm_bst_stat_id_t bid); 1065 1066 extern int 1067 bcm_td2_cosq_bst_stat_sync(int unit, bcm_bst_stat_id_t bid); 1068 1069 extern int bcm_td2_cosq_endpoint_create( 1070 int unit, 1071 bcm_cosq_classifier_t *classifier, 1072 int *classifier_id); 1073 extern int bcm_td2_cosq_endpoint_destroy( 1074 int unit, 1075 int classifier_id); 1076 extern int bcm_td2_cosq_endpoint_get( 1077 int unit, 1078 int classifier_id, 1079 bcm_cosq_classifier_t *classifier); 1080 extern int bcm_td2_cosq_endpoint_map_set( 1081 int unit, 1082 bcm_port_t port, 1083 int classifier_id, 1084 bcm_gport_t queue_group, 1085 int array_count, 1086 bcm_cos_t *priority_array, 1087 bcm_cos_queue_t *cosq_array); 1088 extern int bcm_td2_cosq_endpoint_map_get( 1089 int unit, 1090 bcm_port_t port, 1091 int classifier_id, 1092 bcm_gport_t *queue_group, 1093 int array_max, 1094 bcm_cos_t *priority_array, 1095 bcm_cos_queue_t *cosq_array, 1096 int *array_count); 1097 extern int bcm_td2_cosq_endpoint_map_clear( 1098 int unit, 1099 bcm_gport_t port, 1100 int classifier_id); 1101 1102 extern int 1103 bcm_td2_cosq_field_classifier_get( 1104 int unit, int classifier_id, bcm_cosq_classifier_t *classifier); 1105 1106 extern int 1107 bcm_td2_cosq_field_classifier_id_create( 1108 int unit, bcm_cosq_classifier_t *classifier, int *classifier_id); 1109 1110 extern int 1111 bcm_td2_cosq_field_classifier_id_destroy( 1112 int unit, int classifier_id); 1113 1114 extern int 1115 bcm_td2_cosq_field_classifier_map_set( 1116 int unit, int classifier_id, int count, 1117 bcm_cos_t *priority_array, bcm_cos_queue_t *cosq_array); 1118 1119 extern int 1120 bcm_td2_cosq_field_classifier_map_get( 1121 int unit, int classifier_id, 1122 int array_max, bcm_cos_t *priority_array, 1123 bcm_cos_queue_t *cosq_array, int *array_count); 1124 1125 extern int 1126 bcm_td2_cosq_field_classifier_map_clear( 1127 int unit, int classifier_id); 1128 1129 extern int bcm_td2_cosq_sync(int unit); 1130 extern int bcm_td2_cosq_reinit(int unit); 1131 1132 extern void bcm_td2_cosq_sw_dump(int unit); 1133 1134 extern int bcm_td2_cosq_cpu_cosq_enable_set( 1135 int unit, 1136 bcm_cos_queue_t cosq, 1137 int enable); 1138 1139 extern int bcm_td2_cosq_cpu_cosq_enable_get( 1140 int unit, 1141 bcm_cos_queue_t cosq, 1142 int *enable); 1143 1144 extern int 1145 bcm_td2_cosq_service_classifier_id_create(int unit, 1146 bcm_cosq_classifier_t *classifier, 1147 int *classifier_id); 1148 extern int 1149 bcm_td2_cosq_service_classifier_id_destroy(int unit, int classifier_id); 1150 extern int 1151 bcm_td2_cosq_service_classifier_get(int unit, int classifier_id, 1152 bcm_cosq_classifier_t *classifier); 1153 extern int 1154 bcm_td2_cosq_service_map_set(int unit, bcm_port_t port, int classifier_id, 1155 bcm_gport_t queue_group, int array_count, 1156 bcm_cos_t *priority_array, 1157 bcm_cos_queue_t *cosq_array); 1158 extern int 1159 bcm_td2_cosq_service_map_get(int unit, bcm_port_t port, int classifier_id, 1160 bcm_gport_t *queue_group, int array_max, 1161 bcm_cos_t *priority_array, 1162 bcm_cos_queue_t *cosq_array, int *array_count); 1163 extern int 1164 bcm_td2_cosq_service_map_clear(int unit, bcm_gport_t port, int classifier_id); 1165 1166 typedef enum { 1167 _BCM_TD2_COSQ_INDEX_STYLE_BUCKET, 1168 _BCM_TD2_COSQ_INDEX_STYLE_QCN, 1169 _BCM_TD2_COSQ_INDEX_STYLE_WRED, 1170 _BCM_TD2_COSQ_INDEX_STYLE_WRED_PORT, 1171 _BCM_TD2_COSQ_INDEX_STYLE_WRED_POOL, 1172 _BCM_TD2_COSQ_INDEX_STYLE_SCHEDULER, 1173 _BCM_TD2_COSQ_INDEX_STYLE_PERQ_XMT, 1174 _BCM_TD2_COSQ_INDEX_STYLE_UCAST_DROP, 1175 _BCM_TD2_COSQ_INDEX_STYLE_COS, 1176 _BCM_TD2_COSQ_INDEX_STYLE_UCAST_QUEUE, 1177 _BCM_TD2_COSQ_INDEX_STYLE_MCAST_QUEUE, 1178 _BCM_TD2_COSQ_INDEX_STYLE_EXT_UCAST_QUEUE, 1179 _BCM_TD2_COSQ_INDEX_STYLE_EGR_POOL, 1180 _BCM_TD2_COSQ_INDEX_STYLE_EGR_PERQ_UCAST, 1181 _BCM_TD2_COSQ_INDEX_STYLE_EGR_PERQ_MCAST, 1182 _BCM_TD2_COSQ_INDEX_STYLE_UC_EGR_POOL, 1183 _BCM_TD2_COSQ_INDEX_STYLE_UCAST_QUEUE_GROUP, 1184 _BCM_TD2_COSQ_INDEX_STYLE_COUNT 1185 } _bcm_td2_cosq_index_style_t; 1186 1187 extern int 1188 _bcm_td2_cosq_index_resolve(int unit, bcm_port_t port, bcm_cos_queue_t cosq, 1189 _bcm_td2_cosq_index_style_t style, 1190 bcm_port_t *local_port, int *index, int *count); 1191 extern int 1192 bcm_td2_cosq_pfc_class_mapping_set(int unit, 1193 bcm_gport_t port, 1194 int array_count, 1195 bcm_cosq_pfc_class_mapping_t *mapping_array); 1196 extern int 1197 bcm_td2_cosq_pfc_class_mapping_get(int unit, 1198 bcm_gport_t port, 1199 int array_max, 1200 bcm_cosq_pfc_class_mapping_t *mapping_array, 1201 int *array_count); 1202 extern int 1203 bcm_td2_cosq_default_llfc_profile_attach(int unit, bcm_gport_t port); 1204 1205 extern int 1206 bcm_td2_cosq_llfc_profile_detach(int unit, bcm_gport_t port); 1207 1208 extern int 1209 bcm_td2_port_priority_group_mapping_set(int unit, bcm_gport_t gport, 1210 int prio, int priority_group); 1211 extern int 1212 bcm_td2_port_priority_group_mapping_get(int unit, bcm_gport_t gport, 1213 int prio, int *priority_group); 1214 extern int 1215 bcm_td2_port_priority_group_config_set(int unit, bcm_gport_t gport, 1216 int priority_group, bcm_port_priority_group_config_t *prigrp_config); 1217 extern int 1218 bcm_td2_port_priority_group_config_get(int unit, bcm_gport_t gport, 1219 int priority_group, bcm_port_priority_group_config_t *prigrp_config); 1220 /* Flexible hashing support routines */ 1221 1222 #if defined (BCM_WARM_BOOT_SUPPORT) 1223 extern int bcmi_td2_switch_wb_hash_entry_reinit( 1224 int unit, 1225 uint8 **scache_ptr); 1226 1227 #if defined (BCM_TOMAHAWK_SUPPORT) 1228 extern int bcmi_th_switch_wb_hash_entry_reinit( 1229 int unit, 1230 uint8 **scache_ptr); 1231 #endif 1232 1233 extern int bcmi_td2_switch_wb_hash_entry_sync( 1234 int unit, 1235 uint8 **scache_ptr); 1236 1237 extern int bcmi_td2_switch_wb_hash_entry_scache_size_get( 1238 int unit, 1239 int *req_scache_size); 1240 #endif 1241 1242 extern int bcm_td2_switch_hash_entry_create( 1243 int unit, 1244 bcm_field_group_t group, 1245 bcm_hash_entry_t *entry_id); 1246 extern int bcm_td2_switch_hash_entry_create_qset( 1247 int unit, 1248 bcm_field_qset_t qset, 1249 bcm_hash_entry_t *entry_id); 1250 extern int bcm_td2_switch_hash_entry_set( 1251 int unit, 1252 bcm_hash_entry_t entry, 1253 bcm_switch_hash_entry_config_t *config); 1254 extern int bcm_td2_switch_hash_entry_get( 1255 int unit, 1256 bcm_hash_entry_t entry, 1257 bcm_switch_hash_entry_config_t *config); 1258 extern int bcm_td2_switch_hash_entry_traverse( 1259 int unit, 1260 int flags, 1261 bcm_switch_hash_entry_traverse_cb cb_fn, 1262 void *user_data); 1263 extern int bcm_td2_switch_hash_qualify_udf( 1264 int unit, 1265 bcm_hash_entry_t entry_id, 1266 bcm_udf_id_t udf_id, 1267 int length, 1268 uint8 *data, uint8 *mask); 1269 extern int bcm_td2_switch_hash_qualify_udf_get( 1270 int unit, 1271 bcm_hash_entry_t entry_id, 1272 bcm_udf_id_t udf_id, 1273 int max_length, 1274 uint8 *data, uint8 *mask, 1275 int *actual_length); 1276 extern int bcm_td2_switch_hash_qualify_data ( 1277 int unit, 1278 bcm_hash_entry_t entry_id, 1279 int qual_id, 1280 uint32 data, 1281 uint32 mask); 1282 extern int bcm_td2_switch_hash_entry_remove ( 1283 int unit, 1284 bcm_hash_entry_t entry_id); 1285 extern int bcm_td2_switch_hash_entry_reinstall ( 1286 int unit, 1287 bcm_hash_entry_t entry_id, 1288 uint32 offset, 1289 uint32 mask); 1290 extern int bcm_td2_switch_hash_entry_install ( 1291 int unit, 1292 bcm_hash_entry_t entry_id, 1293 uint32 offset, 1294 uint32 mask); 1295 extern int bcm_td2_switch_hash_entry_destroy ( 1296 int unit, 1297 bcm_hash_entry_t entry_id); 1298 extern int bcm_td2_switch_hash_entry_detach(int unit); 1299 extern int bcm_td2_switch_hash_entry_init (int unit); 1300 extern int bcm_td2_switch_match_detach(int unit); 1301 extern int bcm_td2_switch_match_init(int unit); 1302 extern int bcm_td2_switch_match_config_add( 1303 int unit, 1304 bcm_switch_match_service_t match_service, 1305 bcm_switch_match_config_info_t *config_info, 1306 int *match_id); 1307 extern int bcm_td2_switch_match_config_delete( 1308 int unit, 1309 bcm_switch_match_service_t match_service, 1310 int match_id); 1311 extern int bcm_td2_switch_match_config_delete_all( 1312 int unit, 1313 bcm_switch_match_service_t match_service); 1314 extern int bcm_td2_switch_match_config_get( 1315 int unit, 1316 bcm_switch_match_service_t match_service, 1317 int match_id, 1318 bcm_switch_match_config_info_t *config_info); 1319 extern int bcm_td2_switch_match_config_set( 1320 int unit, 1321 bcm_switch_match_service_t match_service, 1322 int match_id, 1323 bcm_switch_match_config_info_t *config_info); 1324 extern int bcm_td2_switch_match_config_traverse( 1325 int unit, 1326 bcm_switch_match_service_t match_service, 1327 bcm_switch_match_config_traverse_cb cb_fn, 1328 void *user_data); 1329 extern int bcm_td2_l2x_freeze_mode_set(int unit, int arg); 1330 extern int bcm_td2_l2x_freeze_mode_get(int unit, int *arg); 1331 extern int bcm_td2_switch_l2_freeze_mode_init(int unit); 1332 extern int _bcm_td2_flags_to_stp_state(int unit, uint32 flags, int egress); 1333 extern int _bcm_td2_stp_state_to_flags(int unit, int stp_state, int egress); 1334 extern int bcm_td2_ing_vp_vlan_membership_add(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_egr_vp_vlan_membership_add(int unit, 1338 int vp, bcm_vlan_t vlan, uint32 flags, 1339 _bcm_vp_vlan_mbrship_key_type_e key_type); 1340 extern int bcm_td2_ing_vp_vlan_membership_delete(int unit, 1341 int vp, bcm_vlan_t vlan, 1342 _bcm_vp_vlan_mbrship_key_type_e key_type); 1343 extern int bcm_td2_egr_vp_vlan_membership_delete(int unit, 1344 int vp, bcm_vlan_t vlan, 1345 _bcm_vp_vlan_mbrship_key_type_e key_type); 1346 extern int bcm_td2_ing_vp_vlan_membership_get(int unit, 1347 int vp, bcm_vlan_t vlan, uint32 *flags, 1348 _bcm_vp_vlan_mbrship_key_type_e key_type); 1349 extern int bcm_td2_egr_vp_vlan_membership_get(int unit, 1350 int vp, bcm_vlan_t vlan, uint32 *flags, 1351 _bcm_vp_vlan_mbrship_key_type_e key_type); 1352 extern int bcm_td2_ing_vp_vlan_membership_get_all(int unit, bcm_vlan_t vlan, 1353 SHR_BITDCL *vp_bitmap, int arr_size, int *flags_arr); 1354 extern int bcm_td2_egr_vp_vlan_membership_get_all(int unit, bcm_vlan_t vlan, 1355 SHR_BITDCL *vp_bitmap, int arr_size, int *flags_arr); 1356 extern int bcm_td2_ing_vp_vlan_membership_delete_all(int unit, bcm_vlan_t vlan); 1357 extern int bcm_td2_egr_vp_vlan_membership_delete_all(int unit, bcm_vlan_t vlan); 1358 extern int bcm_td2_vp_vlan_stp_set(int unit, 1359 int vp, bcm_vlan_t vlan, int stp_state); 1360 extern int bcm_td2_vp_vlan_stp_get(int unit, 1361 int vp, bcm_vlan_t vlan, int *stp_state); 1362 extern int bcm_td2_vp_vlan_membership_add(int unit, int vp, bcm_vlan_t vlan, int flags); 1363 extern int bcm_td2_vp_vlan_membership_delete(int unit, int vp, bcm_vlan_t vlan); 1364 extern int bcm_td2_vp_vlan_membership_get(int unit, int vp, bcm_vlan_t vlan, int *flags); 1365 extern int bcm_td2_vp_vlan_membership_get_all(int unit, bcm_vlan_t vlan, 1366 int array_max, bcm_gport_t *gport_array, 1367 int *flags_array, int *array_size); 1368 1369 /* Higig resilient hashing */ 1370 extern int bcm_td2_hg_rh_init(int unit); 1371 extern void bcm_td2_hg_rh_deinit(int unit); 1372 extern int bcm_td2_hg_rh_dynamic_size_encode(int unit, int dynamic_size, 1373 int *encoded_value); 1374 extern int bcm_td2_hg_rh_set(int unit, int hgtid, 1375 _esw_trunk_add_info_t *add_info); 1376 extern int bcm_td2_hg_rh_replace(int unit, int hgtid, 1377 _esw_trunk_add_info_t *add_info, uint16 num_existing, 1378 uint16 *existing_ports, uint32 *existing_flags); 1379 extern int bcm_td2_hg_rh_add(int unit, int hgtid, 1380 _esw_trunk_add_info_t *add_info, bcm_trunk_member_t *new_member); 1381 extern int bcm_td2_hg_rh_delete(int unit, int hgtid, 1382 _esw_trunk_add_info_t *add_info, bcm_trunk_member_t *leaving_member); 1383 extern int bcm_td2_hg_rh_free_resource(int unit, int hgtid); 1384 extern int bcm_td2_hg_rh_status_get(int unit, int *rh_status); 1385 extern int bcm_td2_hg_rh_dynamic_size_set(int unit, int hgtid, int dynamic_size); 1386 extern int bcm_td2_hg_rh_ethertype_set(int unit, uint32 flags, 1387 int ethertype_count, int *ethertype_array); 1388 extern int bcm_td2_hg_rh_ethertype_get(int unit, uint32 *flags, 1389 int ethertype_max, int *ethertype_array, int *ethertype_count); 1390 #ifdef BCM_WARM_BOOT_SUPPORT 1391 extern int bcm_td2_hg_rh_recover(int unit, int hgtid, 1392 trunk_private_t *trunk_info); 1393 #endif /* BCM_WARM_BOOT_SUPPORT */ 1394 #ifndef BCM_SW_STATE_DUMP_DISABLE 1395 extern void bcm_td2_hg_rh_sw_dump(int unit); 1396 #endif /* BCM_SW_STATE_DUMP_DISABLE */ 1397 1398 /* LAG resilient hashing */ 1399 extern int bcm_td2_lag_rh_init(int unit); 1400 extern void bcm_td2_lag_rh_deinit(int unit); 1401 extern int bcm_td2_lag_rh_dynamic_size_encode(int unit, int dynamic_size, 1402 int *encoded_value); 1403 extern int bcm_td2_lag_rh_set(int unit, int tid, 1404 _esw_trunk_add_info_t *add_info, int num_rh_ports, int *mod_array, 1405 int *port_array); 1406 extern int bcm_td2_lag_rh_add(int unit, int tid, 1407 _esw_trunk_add_info_t *add_info, int num_rh_ports, int *mod_array, 1408 int *port_array, bcm_trunk_member_t *new_member); 1409 extern int bcm_td2_lag_rh_delete(int unit, int tid, 1410 _esw_trunk_add_info_t *add_info, int num_rh_ports, int *mod_array, 1411 int *port_array, bcm_trunk_member_t *leaving_member); 1412 extern int bcm_td2_lag_rh_replace(int unit, int tid, 1413 _esw_trunk_add_info_t *add_info, int num_rh_ports, int *mod_array, 1414 int *port_array, uint16 num_existing, uint16 *existing_modports, 1415 uint32 *existing_flags); 1416 extern int bcm_td2_lag_rh_free_resource(int unit, int tid); 1417 extern int bcm_td2_lag_rh_dynamic_size_set(int unit, int tid, int dynamic_size); 1418 extern int bcm_td2_lag_rh_ethertype_set(int unit, uint32 flags, 1419 int ethertype_count, int *ethertype_array); 1420 extern int bcm_td2_lag_rh_ethertype_get(int unit, uint32 *flags, 1421 int ethertype_max, int *ethertype_array, int *ethertype_count); 1422 #ifdef BCM_WARM_BOOT_SUPPORT 1423 extern int bcm_td2_lag_rh_recover(int unit, int tid, 1424 trunk_private_t *trunk_info); 1425 #endif /* BCM_WARM_BOOT_SUPPORT */ 1426 #ifndef BCM_SW_STATE_DUMP_DISABLE 1427 extern void bcm_td2_lag_rh_sw_dump(int unit); 1428 #endif /* BCM_SW_STATE_DUMP_DISABLE */ 1429 1430 /* FCOE */ 1431 extern int bcm_td2_fcoe_init(int unit); 1432 extern int bcm_td2_fcoe_cleanup(int unit); 1433 extern int bcm_td2_fcoe_zone_add(int unit, bcm_fcoe_zone_entry_t *zone); 1434 extern int bcm_td2_fcoe_zone_delete(int unit, 1435 bcm_fcoe_zone_entry_t *zone); 1436 extern int bcm_td2_fcoe_zone_delete_all (int unit); 1437 extern int bcm_td2_fcoe_zone_delete_by_vsan (int unit, 1438 bcm_fcoe_zone_entry_t *zone); 1439 extern int bcm_td2_fcoe_zone_delete_by_sid (int unit, 1440 bcm_fcoe_zone_entry_t *zone); 1441 extern int bcm_td2_fcoe_zone_delete_by_did (int unit, 1442 bcm_fcoe_zone_entry_t *zone); 1443 extern int bcm_td2_fcoe_zone_get (int unit, bcm_fcoe_zone_entry_t *zone); 1444 extern int bcm_td2_fcoe_route_add(int unit, bcm_fcoe_route_t *route); 1445 extern int bcm_td2_fcoe_route_delete(int unit, bcm_fcoe_route_t *route); 1446 extern int bcm_td2_fcoe_route_delete_by_prefix(int unit, 1447 bcm_fcoe_route_t *route); 1448 extern int bcm_td2_fcoe_route_delete_by_interface(int unit, 1449 bcm_fcoe_route_t *route); 1450 extern int bcm_td2_fcoe_route_delete_all(int unit); 1451 extern int bcm_td2_fcoe_route_find(int unit, bcm_fcoe_route_t *route); 1452 extern int bcm_td2_fcoe_vsan_create(int unit, uint32 options, 1453 bcm_fcoe_vsan_t *vsan, 1454 bcm_fcoe_vsan_id_t *vsan_id); 1455 extern int bcm_td2_fcoe_vsan_destroy(int unit, bcm_fcoe_vsan_id_t vsan_id); 1456 extern int bcm_td2_fcoe_vsan_destroy_all(int unit); 1457 extern int bcm_td2_fcoe_control_vsan_get(int unit, 1458 uint32 vsan_id, 1459 bcm_fcoe_vsan_control_t type, 1460 int *arg); 1461 extern int bcm_td2_fcoe_control_vsan_set(int unit, 1462 uint32 vsan_id, 1463 bcm_fcoe_vsan_control_t type, 1464 int arg); 1465 extern int bcm_td2_fcoe_vsan_get(int unit, uint32 vsan_id, 1466 bcm_fcoe_vsan_t *vsan); 1467 extern int bcm_td2_fcoe_vsan_set(int unit, uint32 vsan_id, 1468 bcm_fcoe_vsan_t *vsan); 1469 extern int bcm_td2_fcoe_vsan_stat_attach(int unit, 1470 bcm_fcoe_vsan_id_t vsan, 1471 uint32 stat_counter_id); 1472 extern int bcm_td2_fcoe_vsan_stat_detach(int unit, bcm_fcoe_vsan_id_t vsan); 1473 extern int bcm_td2_fcoe_vsan_stat_counter_get( 1474 int unit, 1475 int sync_mode, 1476 bcm_fcoe_vsan_id_t vsan, 1477 bcm_fcoe_vsan_stat_t stat, 1478 uint32 num_entries, 1479 uint32 *counter_indexes, 1480 bcm_stat_value_t *counter_values); 1481 extern int bcm_td2_fcoe_vsan_stat_counter_set( 1482 int unit, 1483 bcm_fcoe_vsan_id_t vsan, 1484 bcm_fcoe_vsan_stat_t stat, 1485 uint32 num_entries, 1486 uint32 *counter_indexes, 1487 bcm_stat_value_t *counter_values); 1488 extern int bcm_td2_fcoe_vsan_stat_id_get(int unit, 1489 bcm_fcoe_vsan_id_t vsan, 1490 bcm_fcoe_vsan_stat_t stat, 1491 uint32 *stat_counter_id); 1492 extern int bcm_td2_fcoe_route_stat_attach(int unit, 1493 bcm_fcoe_route_t *route, 1494 uint32 stat_counter_id); 1495 extern int bcm_td2_fcoe_route_stat_detach(int unit, bcm_fcoe_route_t *route); 1496 extern int bcm_td2_fcoe_route_stat_counter_get( 1497 int unit, 1498 int sync_mode, 1499 bcm_fcoe_route_t *route, 1500 bcm_fcoe_route_stat_t stat, 1501 uint32 num_entries, 1502 uint32 *counter_indexes, 1503 bcm_stat_value_t *counter_values); 1504 extern int bcm_td2_fcoe_route_stat_counter_set ( 1505 int unit, 1506 bcm_fcoe_route_t *route, 1507 bcm_fcoe_route_stat_t stat, 1508 uint32 num_entries, 1509 uint32 *counter_indexes, 1510 bcm_stat_value_t *counter_values); 1511 extern int bcm_td2_fcoe_route_stat_id_get( 1512 int unit, 1513 bcm_fcoe_route_t *route, 1514 bcm_fcoe_route_stat_t stat, 1515 uint32 *stat_counter_id); 1516 int bcm_td2_fcoe_intf_config_set(int unit, uint32 flags, bcm_if_t intf, 1517 bcm_fcoe_intf_config_t *cfg); 1518 1519 int bcm_td2_fcoe_intf_config_get(int unit, uint32 flags, bcm_if_t intf, 1520 bcm_fcoe_intf_config_t *cfg); 1521 extern int bcm_td2_fcoe_zone_traverse(int unit, 1522 uint32 flags, 1523 bcm_fcoe_zone_traverse_cb trav_fn, 1524 void *user_data); 1525 extern int bcm_td2_fcoe_vsan_traverse(int unit, 1526 uint32 flags, 1527 bcm_fcoe_vsan_traverse_cb trav_fn, 1528 void *user_data); 1529 extern int bcm_td2_fcoe_route_traverse(int unit, 1530 uint32 flags, 1531 bcm_fcoe_route_traverse_cb trav_fn, 1532 void *user_data); 1533 extern int bcm_td2_vp_lag_port_learn_set(int unit, 1534 bcm_trunk_t tid, uint32 flags); 1535 extern int bcm_td2_vp_lag_port_learn_get(int unit, 1536 bcm_trunk_t tid, uint32 *flags); 1537 1538 /* QOS */ 1539 1540 extern int bcm_td2_qos_init(int unit); 1541 extern int bcm_td2_qos_detach(int unit); 1542 extern int bcm_td2_qos_map_create(int unit, uint32 flags, int *map_id); 1543 extern int bcm_td2_qos_map_destroy(int unit, int map_id); 1544 extern int bcm_td2_qos_map_add(int unit, uint32 flags, bcm_qos_map_t *map, 1545 int map_id); 1546 extern int bcm_td2_qos_map_delete(int unit, uint32 flags, bcm_qos_map_t *map, 1547 int map_id); 1548 extern int bcm_td2_qos_port_map_set(int unit, bcm_gport_t port, int ing_map, 1549 int egr_map); 1550 extern int bcm_td2_qos_map_multi_get(int unit, uint32 flags, 1551 int map_id, int array_size, 1552 bcm_qos_map_t *array, int *array_count); 1553 #ifdef BCM_WARM_BOOT_SUPPORT_SW_DUMP 1554 extern void _bcm_td2_qos_sw_dump(int unit); 1555 #endif /* BCM_WARM_BOOT_SUPPORT_SW_DUMP */ 1556 #ifdef BCM_WARM_BOOT_SUPPORT 1557 extern int _bcm_td2_qos_reinit_scache_len_get(int unit, uint32 *scache_len); 1558 extern int _bcm_td2_qos_reinit_from_hw_state(int unit, soc_mem_t mem, 1559 soc_field_t field, uint8 map_type, 1560 SHR_BITDCL *hw_idx_bmp, int hw_idx_bmp_len); 1561 extern int _bcm_td2_qos_unsynchronized_reinit(int unit); 1562 extern int _bcm_td2_qos_extended_reinit(int unit, uint8 **scache_ptr); 1563 extern int _bcm_td2_qos_reinit_hw_profiles_update (int unit); 1564 extern int _bcm_td2_qos_sync(int unit, uint8 **scache_ptr); 1565 #endif /* BCM_WARM_BOOT_SUPPORT */ 1566 extern int _bcm_td2_egr_port_set(int unit, bcm_port_t port, 1567 soc_field_t field, int value); 1568 extern int _bcm_td2_egr_port_get(int unit, bcm_port_t port, 1569 soc_field_t field, int *value); 1570 1571 extern int _bcm_td2_qos_idx2id(int unit, int hw_idx, int type, int *map_id); 1572 extern int bcm_td2_qos_port_map_type_get(int unit, bcm_gport_t port, 1573 uint32 flags, int *map_id); 1574 1575 extern int bcm_td2_fcoe_fc_header_type_set(int unit, uint32 flags, uint8 r_ctl, 1576 bcm_fcoe_fc_header_type_t hdr_type); 1577 extern int bcm_td2_fcoe_fc_header_type_get(int unit, uint32 flags, uint8 r_ctl, 1578 bcm_fcoe_fc_header_type_t *hdr_type); 1579 1580 extern int bcm_td2_fcoe_vsan_translate_action_add( 1581 int unit, 1582 bcm_fcoe_vsan_translate_key_config_t *key, 1583 bcm_fcoe_vsan_action_set_t *action); 1584 extern int bcm_td2_fcoe_vsan_translate_action_delete( 1585 int unit, 1586 bcm_fcoe_vsan_translate_key_config_t *key); 1587 extern uint32 _bcm_td2_fcoe_ing_vft_pri_action_encode( 1588 bcm_fcoe_vsan_action_t action); 1589 extern uint32 _bcm_td2_fcoe_egr_vft_pri_action_encode( 1590 bcm_fcoe_vsan_action_t action); 1591 extern uint32 _bcm_td2_fcoe_egr_vft_tag_action_encode( 1592 bcm_fcoe_vsan_action_t action); 1593 extern int bcm_td2_port_dscp_map_set(int unit, bcm_port_t port, int srccp, 1594 int mapcp, int prio, int cng); 1595 1596 /* L2 */ 1597 extern int _bcm_td2_l2_hit_retrieve(int unit, l2x_entry_t *l2x_entry, 1598 int l2_hw_index); 1599 extern int _bcm_td2_l2_hit_range_retrieve(int unit, soc_mem_t mem, int idx_min, 1600 int idx_max, uint32 *l2_tbl_chnk); 1601 1602 extern int 1603 _bcm_td2_port_enqueue_set(int unit, bcm_port_t gport, 1604 int enable); 1605 1606 extern int 1607 _bcm_td2_cosq_port_queue_state_check(int unit, bcm_port_t gport); 1608 extern int 1609 _bcm_td2_cosq_localport_resolve(int unit, bcm_gport_t gport, 1610 bcm_port_t *local_port); 1611 extern int 1612 _bcm_td2_cosq_hw_idx_get(int unit, int max_count, 1613 bcm_gport_t *port, int *hw_idx, int* count); 1614 1615 1616 extern int 1617 _bcm_td2_port_enqueue_get(int unit, bcm_port_t gport, 1618 int *enable); 1619 /* tag/pri actions for ING_VLAN_TAG_ACTION_PROFILE table */ 1620 #define _BCM_TD2_ING_TAG_ACTION_NONE 0 /* do not modify */ 1621 #define _BCM_TD2_ING_TAG_CFI_ACTION_NONE 0 /* do not modify */ 1622 #define _BCM_TD2_ING_TAG_PRI_ACTION_NONE 0 /* do not modify */ 1623 #define _BCM_TD2_EGR_TAG_ACTION_NONE 0 /* do not modify */ 1624 #define _BCM_TD2_EGR_TAG_CFI_ACTION_NONE 0 /* do not modify */ 1625 #define _BCM_TD2_EGR_TAG_PRI_ACTION_NONE 0 /* do not modify */ 1626 1627 /* actions for ING VFT PRI (ING_VLAN_TAG_ACTION_PROFILE) */ 1628 #define _BCM_TD2_ING_VFT_PRI_ACTION_NONE 0 1629 #define _BCM_TD2_ING_VFT_PRI_ACTION_USE_INNER_PRI 1 1630 #define _BCM_TD2_ING_VFT_PRI_ACTION_USE_OUTER_PRI 2 1631 #define _BCM_TD2_ING_VFT_PRI_ACTION_REPLACE 3 /* use VLAN_XLATE.XLATE:: 1632 FCOE_VSAN_PRI */ 1633 1634 /* actions for EGR VFT PRI (EGR_VLAN_TAG_ACTION_PROFILE) */ 1635 #define _BCM_TD2_EGR_VFT_PRI_ACTION_NONE 0 1636 #define _BCM_TD2_EGR_VFT_PRI_ACTION_USE_INTERNAL_IPRI 1 1637 #define _BCM_TD2_EGR_VFT_PRI_ACTION_USE_INTERNAL_OPRI 2 1638 #define _BCM_TD2_EGR_VFT_PRI_ACTION_REPLACE 3 /* use EVXLT.XLATE:: 1639 FCOE_VSAN_PRI */ 1640 1641 /* actions for EGR VFT Tag (EGR_VLAN_TAG_ACTION_PROFILE) */ 1642 #define _BCM_TD2_EGR_VFT_TAG_ACTION_NONE 0 1643 #define _BCM_TD2_EGR_VFT_TAG_ACTION_USE_INTERNAL_IVID 1 1644 #define _BCM_TD2_EGR_VFT_TAG_ACTION_USE_INTERNAL_OVID 2 1645 #define _BCM_TD2_EGR_VFT_TAG_ACTION_DELETE 3 1646 #define _BCM_TD2_EGR_VFT_TAG_ACTION_USE_INTERNAL_VSAN 4 1647 #define _BCM_TD2_EGR_VFT_TAG_ACTION_REPLACE 5 /* use EVXLT.XLATE:: 1648 FCOE_VSAN_ID */ 1649 1650 #ifdef BCM_WARM_BOOT_SUPPORT 1651 extern int _bcm_td2_fcoe_sync(int unit); 1652 extern int _bcm_td2_fcoe_reinit(int unit); 1653 #endif /* BCM_WARM_BOOT_SUPPORT */ 1654 1655 #ifdef BCM_WARM_BOOT_SUPPORT_SW_DUMP 1656 extern void _bcm_td2_fcoe_sw_dump(int unit); 1657 #endif /* BCM_WARM_BOOT_SUPPORT_SW_DUMP */ 1658 extern int soc_td2x_ser_dlb_parity_set(int unit, int enable); 1659 1660 /* 1661 * 8 Priority Groups supported. 1662 */ 1663 #define TD2_PRIOROTY_GROUP_ID_MIN 0 1664 #define TD2_PRIOROTY_GROUP_ID_MAX 7 1665 /* 1666 * Inpur priority range. 1667 * PFC : 0-7 1668 * SAFC : 0-15 1669 */ 1670 #define TD2_PFC_INPUT_PRIORITY_MIN 0 1671 #define TD2_PFC_INPUT_PRIORITY_MAX 7 1672 #define TD2_SAFC_INPUT_PRIORITY_MIN TD2_PFC_INPUT_PRIORITY_MIN 1673 #define TD2_SAFC_INPUT_PRIORITY_MAX 15 1674 1675 extern void _bcm_td2_qos_fcoe_get(int unit, int array_size, 1676 int *map_ids_array, int *flags_array, 1677 int *array_count); 1678 extern int _bcm_td2_qos_multi_get(int unit, int array_size, 1679 int *map_ids_array, int *flags_array, 1680 int *array_count); 1681 extern int bcm_td2_switch_ser_log_info_get(int unit, 1682 int id, bcm_switch_ser_log_info_t *info); 1683 1684 extern int bcm_td2_switch_ser_error_stat_get(int unit, 1685 bcm_switch_ser_error_stat_type_t stat_type, 1686 uint32 *value); 1687 1688 extern int bcm_td2_switch_ser_error_stat_clear(int unit, 1689 bcm_switch_ser_error_stat_type_t stat_type); 1690 #endif /* BCM_TRIDENT2_SUPPORT */ 1691 1692 #if defined(BCM_TRIDENT2_SUPPORT) || defined(BCM_PE_SUPPORT) 1693 #if defined(INCLUDE_L3) 1694 1695 /* Port Extender */ 1696 extern int bcm_td2_extender_forward_add(int unit, 1697 bcm_extender_forward_t *extender_forward_entry); 1698 extern int bcm_td2_extender_forward_delete(int unit, 1699 bcm_extender_forward_t *extender_forward_entry); 1700 extern int bcm_td2_extender_forward_delete_all(int unit); 1701 extern int bcm_td2_extender_forward_get(int unit, 1702 bcm_extender_forward_t *extender_forward_entry); 1703 extern int bcm_td2_extender_forward_traverse(int unit, 1704 bcm_extender_forward_traverse_cb cb, void *user_data); 1705 #endif /* INCLUDE_L3 */ 1706 #endif /* BCM_TRIDENT2_SUPPORT || BCM_PE_SUPPORT */ 1707 1708 #endif /* !_BCM_INT_TRIDENT2_H_ */