switch.h (24250B)
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 * This file contains internal definitions for switch module to the BCM library. 8 */ 9 10 #ifndef _BCM_INT_SWITCH_H 11 #define _BCM_INT_SWITCH_H 12 13 #include <bcm/switch.h> 14 15 typedef int (*xlate_arg_f)(int unit, int arg, int set); 16 17 typedef struct { 18 bcm_switch_control_t type; 19 uint32 chip; 20 soc_reg_t reg; 21 soc_field_t field; 22 xlate_arg_f xlate_arg; 23 soc_feature_t feature; 24 } bcm_switch_binding_t; 25 26 #if defined(BCM_BRADLEY_SUPPORT) || defined(BCM_TRX_SUPPORT) 27 typedef struct { 28 uint32 flag; 29 uint32 hw_map; 30 } _hash_bmap_t; 31 32 typedef struct { 33 bcm_switch_control_t type; 34 _hash_bmap_t *map; 35 int size; 36 soc_reg_t reg; 37 soc_field_t field; 38 } _hash_fieldselect_t; 39 40 enum ENHANCE_XGS3_HASH { 41 /* WARNING: values given match hardware register; do not modify */ 42 ENHANCE_XGS3_HASH_KOOPMAN_CRC32HI = 15, 43 ENHANCE_XGS3_HASH_KOOPMAN_CRC32LO = 14, 44 ENHANCE_XGS3_HASH_ETH_CRC32HI = 13, 45 ENHANCE_XGS3_HASH_ETH_CRC32LO = 12, 46 ENHANCE_XGS3_HASH_CRC32HI = 11, 47 ENHANCE_XGS3_HASH_CRC32LO = 10, 48 ENHANCE_XGS3_HASH_CRC16CCITT = 9, 49 ENHANCE_XGS3_HASH_XOR16 = 8, 50 ENHANCE_XGS3_HASH_CRC16XOR8 = 7, 51 ENHANCE_XGS3_HASH_CRC16XOR4 = 6, 52 ENHANCE_XGS3_HASH_CRC16XOR2 = 5, 53 ENHANCE_XGS3_HASH_CRC16XOR1 = 4, 54 ENHANCE_XGS3_HASH_CRC16 = 3 55 }; 56 57 typedef struct { 58 int idx; 59 int hash_concat; 60 int regmem; 61 soc_field_t sub_f; 62 soc_field_t offset_f; 63 soc_field_t concat_f; 64 } hash_offset_info_t; 65 #endif /* BCM_BRADLEY_SUPPORT || BCM_TRX_SUPPORT */ 66 67 /* Following struct contains synce L1 clock recovery port to unicore, warpcore 68 * lane map and mux value 69 */ 70 typedef struct { 71 bcm_port_t port; /* phyical port number */ 72 uint32 unicore_or_warpcore; /* unicore -> 0, wrapcore -> 1, 2*/ 73 uint32 lane_num; 74 uint32 recovered_clock_select; /* configured mux value */ 75 } _bcm_l1_port_mx_lane_map_t; 76 77 /* Following struct contains AGM monitor state and attribute */ 78 #define _AGM_POOL_ID_CNT (2) 79 #define _AGM_POOL_ID_INVALID (-1) 80 #define _AGM_ID_INVALID (0) 81 #define _AGM_GROUP_ID_INVALID (-1) 82 #define _AGM_TIME_ID_INVALID (-1) 83 #define _AGM_TIME_ID_DFLT (0) 84 85 typedef struct agm_monitor_s { 86 int agm_pool_id; 87 int in_use; 88 int running; 89 int group_id; 90 int counter_id; 91 bcm_switch_agm_info_t attr; 92 } agm_monitor_t; 93 94 extern int 95 _bcm_th_switch_agm_info(int unit, bcm_switch_agm_id_t agm_id, 96 agm_monitor_t *agm_mnt); 97 98 extern int 99 _bcm_th_switch_agm_update_counter_id(int unit, bcm_switch_agm_id_t agm_id, 100 int counter_id); 101 102 extern int 103 bcm_th_switch_agm_id_validate(int unit, bcm_switch_agm_id_t agm_id); 104 105 extern int 106 bcm_th_switch_agm_init(int unit); 107 108 extern int 109 bcm_th_switch_agm_deinit(int unit); 110 111 extern int 112 bcm_th_switch_agm_wb_scache_size_get(int unit, int *req_scache_size); 113 114 extern int 115 bcm_th_switch_agm_wb_sync(int unit, uint8 **scache_ptr); 116 117 extern int 118 bcm_th_switch_agm_wb_reinit(int unit, uint8 **scache_ptr); 119 120 extern int 121 bcm_th_switch_agm_info(int unit, bcm_switch_agm_id_t agm_id, 122 agm_monitor_t *agm_mnt); 123 extern int 124 bcm_th_switch_agm_fwd_grp_update(int unit, bcm_switch_agm_id_t agm_id, 125 int group_id); 126 extern int 127 bcm_th_switch_agm_id_get_by_group(int unit, int group_id, 128 bcm_switch_agm_id_t *agm_id); 129 130 extern int bcm_th_switch_agm_dump(int unit); 131 132 extern int 133 bcm_th_switch_agm_create(int unit, 134 uint32 options, 135 bcm_switch_agm_info_t *agm_info); 136 extern int 137 bcm_th_switch_agm_enable_set(int unit, 138 bcm_switch_agm_id_t agm_id, 139 int enable); 140 extern int 141 bcm_th_switch_agm_stat_get(int unit, 142 bcm_switch_agm_id_t agm_id, 143 int nstat, 144 bcm_switch_agm_stat_t *stat_arr); 145 146 extern int 147 bcm_th_switch_agm_stat_clear(int unit, bcm_switch_agm_id_t agm_id); 148 149 extern int 150 bcm_th_switch_agm_destroy(int unit, bcm_switch_agm_id_t agm_id); 151 152 extern int 153 bcm_th_switch_agm_trunk_attach_get(int unit, bcm_switch_agm_id_t agm_id, 154 bcm_trunk_t *trunk_id); 155 156 extern int 157 bcm_th_switch_agm_l3_ecmp_attach_get(int unit, bcm_switch_agm_id_t agm_id, 158 bcm_if_t *l3_ecmp_id); 159 160 extern int 161 bcm_th_switch_agm_get(int unit, bcm_switch_agm_info_t *agm_info); 162 163 extern int 164 bcm_th_switch_agm_enable_get(int unit, bcm_switch_agm_id_t agm_id, int *enable); 165 166 extern int 167 bcm_th_switch_agm_traverse(int unit, int flags, 168 bcm_switch_agm_traverse_cb trav_fn, 169 void *user_data); 170 171 extern int 172 bcm_th_agm_stat_get_table_info(int unit, bcm_switch_agm_id_t agm_id, 173 uint32 *num_of_tables, void *table_info); 174 175 extern int 176 bcm_th_agm_stat_attach(int unit, bcm_switch_agm_id_t agm_id, 177 int agm_pid, uint32 counter_id); 178 179 extern int 180 bcm_th_agm_stat_detach(int unit, 181 bcm_switch_agm_id_t agm_id, int agm_pid, uint32 ctr_id); 182 183 extern int 184 bcm_th_agm_stat_id_clear(int unit, uint32 stat_counter_id); 185 186 extern int 187 bcm_th_agm_stat_id_get(int unit, bcm_switch_agm_id_t agm_id, 188 int agm_pid, int total_cntr_idxs, uint32 *stat_counter_id); 189 190 #if defined(BCM_TOMAHAWK3_SUPPORT) 191 #if defined(INCLUDE_L3) 192 extern int 193 bcm_th3_switch_agm_l3_ecmp_stat_create(int unit, 194 bcm_switch_agm_id_t agm_id, 195 bcm_if_t l3_ecmp_id); 196 197 extern int 198 bcm_th3_switch_agm_l3_ecmp_stat_destroy(int unit, bcm_switch_agm_id_t agm_id); 199 #endif /* INCLUDE_L3 */ 200 201 extern int 202 bcm_th3_switch_agm_stat_get(int unit, 203 bcm_switch_agm_id_t agm_id, 204 int nstat, 205 bcm_switch_agm_stat_t *stat_arr); 206 207 extern int 208 bcm_th3_switch_agm_stat_clear(int unit, bcm_switch_agm_id_t agm_id); 209 #endif /* BCM_TOMAHAWK3_SUPPORT */ 210 211 extern int 212 bcm_th_xgs3_meter_adjust_set(int unit, bcm_port_t port, int arg); 213 214 215 extern int 216 bcm_th_xgs3_meter_adjust_get(int unit, bcm_port_t port, int *arg); 217 218 /* Number of KT2 physical ports = 40 */ 219 extern _bcm_l1_port_mx_lane_map_t _kt2_l1_port_mx_lane_map[40 + 1]; 220 221 #define MMRP_ETHERTYPE_DEFAULT 0x88f6 222 #define SRP_ETHERTYPE_DEFAULT 0x1 223 #define TS_ETHERTYPE_DEFAULT 0x88f7 224 #define MMRP_MAC_OUI_DEFAULT 0x0180c2 225 #define SRP_MAC_OUI_DEFAULT 0x0 226 #define TS_MAC_OUI_DEFAULT 0x0180c2 227 #define MMRP_MAC_NONOUI_DEFAULT 0x000020 228 #define SRP_MAC_NONOUI_DEFAULT 0x0 229 #define TS_MAC_NONOUI_DEFAULT 0x00000e 230 #define TS_MAC_MSGBITMAP_DEFAULT 0x000d 231 #define EP_COPY_TOCPU_DEFAULT 0x1 232 #define TCP_FLAGS_MASK_DEFAULT 0xff 233 234 235 extern int _bcm_esw_switch_init(int unit); 236 extern int _bcm_esw_switch_detach(int unit); 237 238 extern int _bcm_switch_module_type_get(int unit, bcm_module_t mod, 239 uint32 *mod_type); 240 241 extern int _bcm_switch_pkt_info_ecmp_hash_get(int unit, 242 bcm_switch_pkt_info_t *pkt_info, 243 bcm_gport_t *dst_gport, 244 bcm_if_t *dst_intf); 245 extern int _bcm_td2_switch_pkt_info_hash_get(int unit, 246 bcm_switch_pkt_info_t *pkt_info, 247 bcm_gport_t *dst_gport, 248 bcm_if_t *dst_intf); 249 extern int _bcm_tr3_switch_pkt_info_hash_get(int unit, 250 bcm_switch_pkt_info_t *pkt_info, 251 bcm_gport_t *dst_gport, 252 bcm_if_t *dst_intf); 253 extern int _bcm_kt2_switch_pkt_info_hash_get(int unit, 254 bcm_switch_pkt_info_t *pkt_info, 255 bcm_gport_t *dst_gport, 256 bcm_if_t *dst_intf); 257 extern int _bcm_gh2_switch_pkt_info_hash_get(int unit, 258 bcm_switch_pkt_info_t *pkt_info, 259 bcm_gport_t *dst_gport, 260 bcm_if_t* dst_intf); 261 #ifdef BCM_TOMAHAWK_SUPPORT 262 extern int _bcm_th_switch_pkt_info_hash_get(int unit, 263 bcm_switch_pkt_info_t *pkt_info, 264 bcm_gport_t *dst_gport, 265 bcm_if_t *dst_intf); 266 #endif 267 268 #ifdef BCM_SABER2_SUPPORT 269 extern int _bcm_switch_port_to_phyaddr(int unit, int port); 270 #endif 271 extern int _bcm_tr3_repl_head_entry_info_get(int unit, int *free); 272 273 extern int _bcm_en_switch_pkt_info_hash_get(int unit, 274 bcm_switch_pkt_info_t *pkt_info, 275 bcm_gport_t *dst_gport, 276 bcm_if_t *dst_intf); 277 278 #define _BCM_SWITCH_PKT_INFO_FLAG_TEST(_pkt_info, _flag_suffix) \ 279 (0 != (((_pkt_info)->flags) & BCM_SWITCH_PKT_INFO_##_flag_suffix)) 280 281 #if defined(BCM_KATANA2_SUPPORT) || defined(BCM_TRIDENT2PLUS_SUPPORT) 282 extern int _bcm_switch_olp_port_mac_get(int unit, bcm_port_t port, bcm_mac_t *mac); 283 extern int _bcm_switch_olp_dglp_get(int unit, int dglp, bcm_mac_t *mac,int *Index); 284 #endif 285 /* Switch OLP bookkeeping structure */ 286 typedef struct _bcm_switch_olp_bookeeping_s { 287 int api_ver; 288 } _bcm_switch_olp_bookeeping_t; 289 290 extern _bcm_switch_olp_bookeeping_t _bcm_switch_olp_bk_info[BCM_MAX_NUM_UNITS]; 291 extern int _bcm_esw_switch_olp_init(int unit); 292 293 #define _BCM_SWITCH_OLP_INFO(_unit_) (&_bcm_switch_olp_bk_info[_unit_]) 294 #define _BCM_SWITCH_OLP_APIV(_unit_) \ 295 (_bcm_switch_olp_bk_info[_unit_].api_ver) 296 #define _BCM_SWITCH_OLP_APIV_SET(_unit_, v) \ 297 (_bcm_switch_olp_bk_info[_unit_].api_ver = (v)) 298 299 /* 300 * Following flags are used with _bcm_switch_olp_bookeeping_t.api_ver 301 * _BCM_SWITCH_OLP_OPEN_API represents that either of bcm_l2_station_xxx OR 302 * bcm_switch_olp_l2_addr_xxx can be used at this moment 303 * for OLP configuration. 304 * _BCM_SWITCH_OLP_L2_STATION_API represents that only bcm_l2_station_xxx can be 305 * used for olp configuration 306 * _BCM_SWITCH_OLP_TRUE_API represents that only bcm_switch_olp_l2_addr_xxx can be 307 * used for olp configuration 308 */ 309 #define _BCM_SWITCH_OLP_OPEN_API 0 310 #define _BCM_SWITCH_OLP_L2_STATION_API 1 311 #define _BCM_SWITCH_OLP_TRUE_API 2 312 313 /* Followings defines would be used for OBM classification */ 314 315 #define BCM_OBM_CLASSIFIER_NUM_ENTRY_DSCP 64 316 #define BCM_OBM_CLASSIFIER_NUM_ENTRY_MPLS 8 317 #define BCM_OBM_CLASSIFIER_NUM_ENTRY_ETAG 8 318 #define BCM_OBM_CLASSIFIER_NUM_ENTRY_VLAN 8 319 #define BCM_OBM_CLASSIFIER_NUM_ENTRY_HIGIG2 16 320 #define BCM_OBM_CLASSIFIER_NUM_ENTRY_FIELD 5 321 322 #define BCM_OBM_PRIORITY_MAX 4 323 #define BCM_OBM_DSCP_CHUNK_SIZE 16 324 325 #ifdef BCM_WARM_BOOT_SUPPORT 326 extern int _bcm_esw_scache_ptr_get(int unit, soc_scache_handle_t handle, 327 int create, uint32 size, 328 uint8 **scache_ptr, uint16 default_ver, 329 uint16 *recovered_ver); 330 extern int _bcm_mem_scache_sync(int unit); 331 extern int _bcm_switch_control_scache_sync(int unit); 332 extern int _bcm_field_wb_downgrade_config_set(int unit, uint32 warmboot_ver); 333 #endif /* BCM_WARM_BOOT_SUPPORT */ 334 335 #ifdef BCM_GREYHOUND_SUPPORT 336 extern int 337 _bcm_gh_switch_control_port_binding_set(int unit, 338 bcm_port_t port, 339 bcm_switch_control_t type, 340 int arg, int *found); 341 extern int 342 _bcm_gh_switch_control_port_binding_get(int unit, 343 bcm_port_t port, 344 bcm_switch_control_t type, 345 int *arg, int *found); 346 #endif 347 348 #ifdef BCM_TRIDENT3_SUPPORT 349 extern int 350 _bcm_td3_switch_control_port_binding_set(int unit, 351 bcm_port_t port, 352 bcm_switch_control_t type, 353 int arg, int *found); 354 extern int 355 _bcm_td3_switch_control_port_binding_get(int unit, 356 bcm_port_t port, 357 bcm_switch_control_t type, 358 int *arg, int *found); 359 360 extern int 361 _bcm_td3_meter_adjust_set(int unit, bcm_port_t port, int arg); 362 363 extern int 364 _bcm_td3_shaper_adjust_set(int unit, bcm_port_t port, int arg); 365 366 extern int 367 _bcm_td3_meter_adjust_get(int unit, bcm_port_t port, int *arg); 368 369 extern int 370 _bcm_td3_shaper_adjust_get(int unit, bcm_port_t port, int *arg); 371 372 extern int 373 _bcm_td3_dosattack_pkt_size_set(int unit, bcm_switch_control_t type, int arg); 374 375 extern int 376 _bcm_td3_dosattack_pkt_size_get(int unit, bcm_switch_control_t type, int *arg); 377 378 extern int 379 _bcm_td3_gbp_ethertype_set(int unit, int arg); 380 381 extern int 382 _bcm_td3_ing_gbp_ethertype_get(int unit, int *arg); 383 384 extern int 385 _bcm_td3_vxlan_udp_source_port_sel_set(int unit, int mode); 386 387 extern int 388 _bcm_td3_vxlan_udp_source_port_sel_get(int unit, int *mode); 389 390 extern int 391 _bcm_td3_gpe_udp_source_port_sel_set(int unit, int mode); 392 393 extern int 394 _bcm_td3_gpe_udp_source_port_sel_get(int unit, int *mode); 395 396 extern int 397 _bcm_td3_geneve_udp_source_port_sel_set(int unit, int mode); 398 399 extern int 400 _bcm_td3_geneve_udp_source_port_sel_get(int unit, int *mode); 401 402 extern int 403 _bcm_td3_custom_fields_set(int unit, bcm_switch_control_t type, int arg); 404 405 extern int 406 _bcm_td3_custom_fields_get(int unit, bcm_switch_control_t type, int *arg); 407 408 extern int 409 _bcm_td3_large_scale_nat_mc_get(int unit, bcm_switch_control_t type, int *arg); 410 411 extern int 412 _bcm_td3_large_scale_nat_mc_set(int unit, bcm_switch_control_t type, int arg); 413 414 extern int 415 _bcm_td3_large_scale_nat_uc_get(int unit, bcm_switch_control_t type, int *arg); 416 417 extern int 418 _bcm_td3_large_scale_nat_uc_set(int unit, bcm_switch_control_t type, int arg); 419 420 extern int 421 _bcm_td3_ioam_max_payload_length_set(int unit, int payload_length); 422 423 extern int 424 _bcm_td3_ioam_max_payload_length_get(int unit, int *payload_length); 425 426 extern int 427 _bcm_td3_ioam_namespaceid_set(int unit, int namespace_id); 428 429 extern int 430 _bcm_td3_ioam_namespaceid_get(int unit, int *namespace_id); 431 432 extern int 433 _bcm_td3_ioam_protocol_set(int unit, int ioam_proto); 434 435 extern int 436 _bcm_td3_ioam_protocol_get(int unit, int *ioam_proto); 437 438 extern int 439 _bcm_td3_v6linklocal_disposition_set(int unit, int drop_control); 440 441 extern int 442 _bcm_td3_v6linklocal_disposition_get(int unit, int *drop_control); 443 444 #endif 445 446 #if defined(BCM_HURRICANE4_SUPPORT) || defined(BCM_FIREBOLT6_SUPPORT) 447 extern int 448 _bcm_td3_ioam_e2e_protocol_set(int unit, int ioam_proto); 449 450 extern int 451 _bcm_td3_ioam_e2e_protocol_get(int unit, int *ioam_proto); 452 453 extern int 454 _bcm_td3_gbp_type_set(int unit, int gbp_type); 455 456 extern int 457 _bcm_td3_gbp_type_get(int unit, int *gbp_type); 458 459 extern int 460 _bcm_td3_ioam_e2e_gbp_type_set(int unit, int gbp_type); 461 462 extern int 463 _bcm_td3_ioam_e2e_gbp_type_get(int unit, int *gbp_type); 464 465 466 #endif /* BCM_HURRICANE4_SUPPORT & BCM_FIREBOLT6_SUPPORT */ 467 468 #ifdef BCM_HELIX5_SUPPORT 469 extern int 470 _bcm_hx5_switch_dosattack_events_init(int unit); 471 472 extern int 473 _bcm_mcastgbp_default_classid_set(int unit, int arg); 474 475 extern int 476 _bcm_mcastgbp_default_classid_get(int unit, int *arg); 477 #endif 478 479 #ifdef BCM_APACHE_SUPPORT 480 extern int 481 _bcm_apache_switch_control_port_binding_set(int unit, 482 bcm_port_t port, 483 bcm_switch_control_t type, 484 int arg, int *found); 485 extern int 486 _bcm_apache_switch_control_port_binding_get(int unit, 487 bcm_port_t port, 488 bcm_switch_control_t type, 489 int *arg, int *found); 490 #endif 491 492 #ifdef BCM_TOMAHAWK2_SUPPORT 493 extern int 494 _bcm_th2_switch_control_port_binding_set(int unit, 495 bcm_port_t port, 496 bcm_switch_control_t type, 497 int arg, int *found); 498 extern int 499 _bcm_th2_switch_control_port_binding_get(int unit, 500 bcm_port_t port, 501 bcm_switch_control_t type, 502 int *arg, int *found); 503 #endif 504 505 #ifdef BCM_TOMAHAWK3_SUPPORT 506 extern int 507 _bcm_th3_switch_control_port_binding_set(int unit, 508 bcm_port_t port, 509 bcm_switch_control_t type, 510 int arg, int *found); 511 extern int 512 _bcm_th3_switch_control_port_binding_get(int unit, 513 bcm_port_t port, 514 bcm_switch_control_t type, 515 int *arg, int *found); 516 #endif 517 518 #if defined(BCM_TOMAHAWK_SUPPORT) 519 520 #define OUT 521 #define IN_OUT 522 523 /* tflow mode checker */ 524 typedef struct _bcm_switch_tfow_mode_s { 525 int enabled; 526 } _bcm_switch_tflow_mode_t; 527 528 extern 529 _bcm_switch_tflow_mode_t _bcm_switch_tflow_mode_info[BCM_MAX_NUM_UNITS]; 530 531 extern int 532 bcm_th_switch_tflow_wb_scache_size_get(int unit, int *req_scache_size); 533 534 extern int 535 bcm_th_switch_tflow_wb_sync(int unit, uint8 **scache_ptr); 536 537 extern int 538 bcm_th_switch_tflow_wb_reinit(int unit, uint8 **scache_ptr); 539 540 extern int 541 bcm_esw_switch_latency_deinit(int unit); 542 543 extern int 544 bcmi_esw_switch_latency_show(int unit); 545 546 extern int 547 bcmi_esw_switch_latency_diag(int unit); 548 549 extern int 550 bcmi_esw_switch_latency_mem_avail( 551 int unit, 552 soc_mem_t mem); 553 554 extern int 555 bcmi_esw_switch_latency_reg_avail( 556 int unit, 557 soc_reg_t reg); 558 559 #ifdef BCM_WARM_BOOT_SUPPORT 560 extern int 561 bcm_esw_scache_ver_get( 562 int unit, 563 int module, 564 OUT uint16* const version); 565 566 extern int 567 bcmi_esw_switch_latency_wb_memsz_get( 568 int unit, 569 OUT uint32* const mem_sz, 570 uint16 scache_ver); 571 572 extern int 573 bcmi_esw_switch_latency_wb_sync( 574 int unit, 575 IN_OUT uint8* wb_data); 576 577 extern int 578 bcmi_esw_switch_latency_wb_recover( 579 int unit, 580 uint8* const wb_data, 581 uint16 scache_ver); 582 #endif 583 584 #endif 585 586 extern int 587 bcmi_esw_int_switch_control_set(int unit, bcm_switch_control_t type, int arg); 588 extern int 589 bcmi_esw_int_switch_control_get(int unit, bcm_switch_control_t type, int *arg); 590 591 #define BCM_FB2_BMC_IFG_MAX 0x3f 592 #define NUM_MMU_AGE_CYCLES 7 593 /* IGMP/MLD values */ 594 #define BCM_SWITCH_FORWARD_VALUE 0 595 #define BCM_SWITCH_DROP_VALUE 1 596 #define BCM_SWITCH_FLOOD_VALUE 2 597 #define BCM_SWITCH_RESERVED_VALUE 3 598 #ifdef BCM_WARM_BOOT_SUPPORT 599 600 #define BCM_SWITCH_WB_FLEXHASH_VERSION_1_0 SOC_SCACHE_VERSION(1,0) 601 #define BCM_SWITCH_WB_FLEXHASH_VERSION_1_1 SOC_SCACHE_VERSION(1,1) 602 #define BCM_SWITCH_WB_FLEXHASH_DEFAULT_VERSION BCM_SWITCH_WB_FLEXHASH_VERSION_1_1 603 #define BCM_SWITCH_WB_SCACHE_PART_FLEXHASH 1 604 605 #define BCM_SWITCH_WB_OLP_VERSION_1_0 SOC_SCACHE_VERSION(1,0) 606 #define BCM_SWITCH_WB_OLP_DEFAULT_VERSION BCM_SWITCH_WB_OLP_VERSION_1_0 607 #define BCM_SWITCH_WB_SCACHE_PART_OLP 2 608 609 #define BCM_SWITCH_WB_ENCAP_VERSION_1_0 SOC_SCACHE_VERSION(1,0) 610 #define BCM_SWITCH_WB_ENCAP_DEFAULT_VERSION BCM_SWITCH_WB_ENCAP_VERSION_1_0 611 #define BCM_SWITCH_WB_SCACHE_PART_ENCAP 3 612 613 #define BCM_SWITCH_WB_AGM_VERSION_1_0 SOC_SCACHE_VERSION(1,0) 614 #define BCM_SWITCH_WB_AGM_DEFAULT_VERSION BCM_SWITCH_WB_AGM_VERSION_1_0 615 #define BCM_SWITCH_WB_SCACHE_PART_AGM 4 616 617 #define BCM_SWITCH_WB_L2_VERSION_1_0 SOC_SCACHE_VERSION(1,0) 618 #define BCM_SWITCH_WB_L2_DEFAULT_VERSION BCM_SWITCH_WB_L2_VERSION_1_0 619 #define BCM_SWITCH_WB_SCACHE_PART_L2 5 620 621 #define BCM_SWITCH_WB_TFLOW_VERSION_1_0 SOC_SCACHE_VERSION(1,0) 622 #define BCM_SWITCH_WB_TFLOW_DEFAULT_VERSION BCM_SWITCH_WB_TFLOW_VERSION_1_0 623 #define BCM_SWITCH_WB_SCACHE_PART_TFLOW 8 624 625 #define BCM_SWITCH_WB_MISC_VERSION_1_0 SOC_SCACHE_VERSION(1,0) 626 #define BCM_SWITCH_WB_MISC_VERSION_1_1 SOC_SCACHE_VERSION(1,1) 627 #define BCM_SWITCH_WB_MISC_VERSION_1_2 SOC_SCACHE_VERSION(1,2) 628 #define BCM_SWITCH_WB_MISC_VERSION_1_3 SOC_SCACHE_VERSION(1,3) 629 #define BCM_SWITCH_WB_MISC_DEFAULT_VERSION BCM_SWITCH_WB_MISC_VERSION_1_3 630 #define BCM_SWITCH_WB_SCACHE_PART_MISC 9 631 632 #define BCM_SWITCH_WB_APPL_SIGN_VERSION_1_0 SOC_SCACHE_VERSION(1,0) 633 #define BCM_SWITCH_WB_APPL_SIGN_DEFAULT_VERSION BCM_SWITCH_WB_APPL_SIGN_VERSION_1_0 634 #define BCM_SWITCH_WB_SCAHCE_PART_APPL_SIGN 10 635 636 #define _BCM_SYNC_MODULE_BACKUP(unit, mod, ptr, min, max, bksize, rtn, rv) { \ 637 rv = rtn(unit, mod, ptr, min, max, bksize); \ 638 if(!BCM_SUCCESS(rv)) { \ 639 LOG_CLI((BSL_META_U(unit, \ 640 "Warmboot Sync backup failed for %s Module\n"), \ 641 shr_bprof_stats_name(mod))); \ 642 sal_free(*ptr); \ 643 return rv; \ 644 } \ 645 } 646 647 #define _BCM_SYNC_MODULE_DIRTY(unit, mod, ptr, min, max, rtn, rv) { \ 648 rv = rtn(unit, mod, ptr, min, max); \ 649 if(!BCM_SUCCESS(rv)) { \ 650 LOG_CLI((BSL_META_U(unit, \ 651 "Warmboot Sync dirty set failed for %s Module\n"), \ 652 shr_bprof_stats_name(mod))); \ 653 sal_free(*ptr); \ 654 return rv; \ 655 } \ 656 } 657 658 659 #define _BCM_SYNC_MODULE(unit, mod, rtn, ptr, rv) { \ 660 rv = rtn(unit); \ 661 if(!_BCM_SYNC_SUCCESS(rv)) { \ 662 LOG_CLI((BSL_META_U(unit, \ 663 "Warmboot Sync failed for %s Module\n"), \ 664 shr_bprof_stats_name(mod))); \ 665 sal_free(*ptr); \ 666 return rv; \ 667 } \ 668 } 669 670 671 #define _BCM_SYNC_SUCCESS(rv) \ 672 (BCM_SUCCESS(rv) || (BCM_E_INIT == rv) || (BCM_E_UNAVAIL == rv)) 673 674 extern int 675 _bcm_esw_switch_scache_sync(int unit); 676 677 678 679 #endif 680 681 #define CLEARMEM(_unit, _mem) \ 682 if (SOC_MEM_IS_VALID(_unit, _mem) && SOC_MEM_SIZE(_unit, _mem) > 0) {\ 683 SOC_IF_ERROR_RETURN(soc_mem_clear(_unit, _mem, MEM_BLOCK_ALL, 0));\ 684 } 685 686 #define CLEAR_MEM_FIELD_ALL(_unit, _mem, _field) \ 687 if (SOC_MEM_IS_VALID(_unit, _mem) && SOC_MEM_SIZE(_unit, _mem) > 0) {\ 688 SOC_IF_ERROR_RETURN(soc_mem_field_clear_all(_unit, \ 689 _mem, \ 690 _field, \ 691 MEM_BLOCK_ALL, \ 692 0));\ 693 } 694 695 696 697 #endif /* !_BCM_INT_SWITCH_H */