openbcm

Git mirror of https://github.com/Broadcom-Network-Switching-Software/OpenBCM
git clone git://git.finwo.net/mirror/broadcom/openbcm
Log | Files | Refs | README

switch.h (22643B)


      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  * 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 #endif
    421 
    422 #ifdef BCM_HELIX5_SUPPORT
    423 extern int
    424 _bcm_hx5_switch_dosattack_events_init(int unit);
    425 
    426 extern int
    427 _bcm_mcastgbp_default_classid_set(int unit, int arg);
    428 
    429 extern int
    430 _bcm_mcastgbp_default_classid_get(int unit, int *arg);
    431 #endif
    432 
    433 #ifdef BCM_APACHE_SUPPORT
    434 extern int
    435 _bcm_apache_switch_control_port_binding_set(int unit,
    436                                 bcm_port_t port,
    437                                 bcm_switch_control_t type,
    438                                 int arg, int *found);
    439 extern int
    440 _bcm_apache_switch_control_port_binding_get(int unit,
    441                                 bcm_port_t port,
    442                                 bcm_switch_control_t type,
    443                                 int *arg, int *found);
    444 #endif
    445 
    446 #ifdef BCM_TOMAHAWK2_SUPPORT
    447 extern int
    448 _bcm_th2_switch_control_port_binding_set(int unit,
    449                                 bcm_port_t port,
    450                                 bcm_switch_control_t type,
    451                                 int arg, int *found);
    452 extern int
    453 _bcm_th2_switch_control_port_binding_get(int unit,
    454                                 bcm_port_t port,
    455                                 bcm_switch_control_t type,
    456                                 int *arg, int *found);
    457 #endif
    458 
    459 #ifdef BCM_TOMAHAWK3_SUPPORT
    460 extern int
    461 _bcm_th3_switch_control_port_binding_set(int unit,
    462                                 bcm_port_t port,
    463                                 bcm_switch_control_t type,
    464                                 int arg, int *found);
    465 extern int
    466 _bcm_th3_switch_control_port_binding_get(int unit,
    467                                 bcm_port_t port,
    468                                 bcm_switch_control_t type,
    469                                 int *arg, int *found);
    470 #endif
    471 
    472 #if defined(BCM_TOMAHAWK_SUPPORT)
    473 
    474 #define OUT
    475 #define IN_OUT
    476 
    477 /* tflow mode checker */
    478 typedef struct _bcm_switch_tfow_mode_s {
    479     int enabled;
    480 } _bcm_switch_tflow_mode_t;
    481 
    482 extern
    483 _bcm_switch_tflow_mode_t _bcm_switch_tflow_mode_info[BCM_MAX_NUM_UNITS];
    484 
    485 extern int
    486 bcm_th_switch_tflow_wb_scache_size_get(int unit, int *req_scache_size);
    487 
    488 extern int
    489 bcm_th_switch_tflow_wb_sync(int unit, uint8 **scache_ptr);
    490 
    491 extern int
    492 bcm_th_switch_tflow_wb_reinit(int unit, uint8 **scache_ptr);
    493 
    494 extern int
    495 bcm_esw_switch_latency_deinit(int unit);
    496 
    497 extern int
    498 bcmi_esw_switch_latency_show(int unit);
    499 
    500 extern int
    501 bcmi_esw_switch_latency_diag(int unit);
    502 
    503 extern int
    504 bcmi_esw_switch_latency_mem_avail(
    505     int         unit,
    506     soc_mem_t   mem);
    507 
    508 extern int
    509 bcmi_esw_switch_latency_reg_avail(
    510     int         unit,
    511     soc_reg_t   reg);
    512 
    513 #ifdef BCM_WARM_BOOT_SUPPORT
    514 extern int
    515 bcm_esw_scache_ver_get(
    516     int               unit,
    517     int               module,
    518     OUT uint16* const version);
    519 
    520 extern int
    521 bcmi_esw_switch_latency_wb_memsz_get(
    522     int                 unit,
    523     OUT uint32* const   mem_sz,
    524     uint16              scache_ver);
    525 
    526 extern int
    527 bcmi_esw_switch_latency_wb_sync(
    528     int             unit,
    529     IN_OUT uint8*   wb_data);
    530 
    531 extern int
    532 bcmi_esw_switch_latency_wb_recover(
    533     int            unit,
    534     uint8* const   wb_data,
    535     uint16         scache_ver);
    536 #endif
    537 
    538 #endif
    539 
    540 extern int
    541 bcmi_esw_int_switch_control_set(int unit, bcm_switch_control_t type, int arg);
    542 extern int
    543 bcmi_esw_int_switch_control_get(int unit, bcm_switch_control_t type, int *arg);
    544 
    545 #define BCM_FB2_BMC_IFG_MAX     0x3f
    546 #define NUM_MMU_AGE_CYCLES 7
    547 /* IGMP/MLD values */
    548 #define BCM_SWITCH_FORWARD_VALUE        0
    549 #define BCM_SWITCH_DROP_VALUE           1
    550 #define BCM_SWITCH_FLOOD_VALUE          2
    551 #define BCM_SWITCH_RESERVED_VALUE       3
    552 #ifdef BCM_WARM_BOOT_SUPPORT
    553 
    554 #define BCM_SWITCH_WB_FLEXHASH_VERSION_1_0                SOC_SCACHE_VERSION(1,0)
    555 #define BCM_SWITCH_WB_FLEXHASH_VERSION_1_1                SOC_SCACHE_VERSION(1,1)
    556 #define BCM_SWITCH_WB_FLEXHASH_DEFAULT_VERSION            BCM_SWITCH_WB_FLEXHASH_VERSION_1_1
    557 #define BCM_SWITCH_WB_SCACHE_PART_FLEXHASH                1
    558 
    559 #define BCM_SWITCH_WB_OLP_VERSION_1_0                     SOC_SCACHE_VERSION(1,0)
    560 #define BCM_SWITCH_WB_OLP_DEFAULT_VERSION                 BCM_SWITCH_WB_OLP_VERSION_1_0
    561 #define BCM_SWITCH_WB_SCACHE_PART_OLP                     2
    562 
    563 #define BCM_SWITCH_WB_ENCAP_VERSION_1_0                     SOC_SCACHE_VERSION(1,0)
    564 #define BCM_SWITCH_WB_ENCAP_DEFAULT_VERSION                 BCM_SWITCH_WB_ENCAP_VERSION_1_0
    565 #define BCM_SWITCH_WB_SCACHE_PART_ENCAP                     3
    566 
    567 #define BCM_SWITCH_WB_AGM_VERSION_1_0                     SOC_SCACHE_VERSION(1,0)
    568 #define BCM_SWITCH_WB_AGM_DEFAULT_VERSION                 BCM_SWITCH_WB_AGM_VERSION_1_0
    569 #define BCM_SWITCH_WB_SCACHE_PART_AGM                     4
    570 
    571 #define BCM_SWITCH_WB_L2_VERSION_1_0                      SOC_SCACHE_VERSION(1,0)
    572 #define BCM_SWITCH_WB_L2_DEFAULT_VERSION                  BCM_SWITCH_WB_L2_VERSION_1_0
    573 #define BCM_SWITCH_WB_SCACHE_PART_L2                      5
    574 
    575 #define BCM_SWITCH_WB_TFLOW_VERSION_1_0                   SOC_SCACHE_VERSION(1,0)
    576 #define BCM_SWITCH_WB_TFLOW_DEFAULT_VERSION               BCM_SWITCH_WB_TFLOW_VERSION_1_0
    577 #define BCM_SWITCH_WB_SCACHE_PART_TFLOW                   8
    578 
    579 #define BCM_SWITCH_WB_MISC_VERSION_1_0                    SOC_SCACHE_VERSION(1,0)
    580 #define BCM_SWITCH_WB_MISC_DEFAULT_VERSION                BCM_SWITCH_WB_MISC_VERSION_1_0
    581 #define BCM_SWITCH_WB_SCACHE_PART_MISC                    9
    582 
    583 #define _BCM_SYNC_MODULE_BACKUP(unit, mod, ptr, min, max, bksize, rtn, rv) { \
    584             rv = rtn(unit, mod, ptr, min, max, bksize);       \
    585             if(!BCM_SUCCESS(rv)) {                            \
    586                 LOG_CLI((BSL_META_U(unit,                     \
    587                     "Warmboot Sync backup failed for  %s Module\n"), \
    588                     shr_bprof_stats_name(mod)));              \
    589                     sal_free(*ptr);                           \
    590                     return rv;                                \
    591             }                                                \
    592         }
    593 
    594 #define _BCM_SYNC_MODULE_DIRTY(unit, mod, ptr, min, max, rtn, rv) { \
    595             rv = rtn(unit, mod, ptr, min, max);       \
    596             if(!BCM_SUCCESS(rv)) {                            \
    597                 LOG_CLI((BSL_META_U(unit,                     \
    598                     "Warmboot Sync dirty set failed for  %s Module\n"), \
    599                     shr_bprof_stats_name(mod)));              \
    600                     sal_free(*ptr);                           \
    601                     return rv;                                \
    602             }                                                \
    603         }
    604 
    605 
    606 #define _BCM_SYNC_MODULE(unit, mod, rtn, ptr, rv) {           \
    607             rv = rtn(unit);                                   \
    608             if(!_BCM_SYNC_SUCCESS(rv)) {                      \
    609                 LOG_CLI((BSL_META_U(unit,                     \
    610                     "Warmboot Sync failed for  %s Module\n"), \
    611                     shr_bprof_stats_name(mod)));              \
    612                     sal_free(*ptr);                           \
    613                     return rv;                                \
    614             }                                                \
    615         }
    616 
    617 
    618 #define _BCM_SYNC_SUCCESS(rv) \
    619         (BCM_SUCCESS(rv) || (BCM_E_INIT == rv) || (BCM_E_UNAVAIL == rv))
    620 
    621 extern int
    622 _bcm_esw_switch_scache_sync(int unit);
    623 
    624 
    625 
    626 #endif
    627 
    628 #define CLEARMEM(_unit, _mem) \
    629         if (SOC_MEM_IS_VALID(_unit, _mem) && SOC_MEM_SIZE(_unit, _mem) > 0) {\
    630             SOC_IF_ERROR_RETURN(soc_mem_clear(_unit, _mem, MEM_BLOCK_ALL, 0));\
    631         }
    632 
    633 #define CLEAR_MEM_FIELD_ALL(_unit, _mem, _field) \
    634         if (SOC_MEM_IS_VALID(_unit, _mem) && SOC_MEM_SIZE(_unit, _mem) > 0) {\
    635             SOC_IF_ERROR_RETURN(soc_mem_field_clear_all(_unit, \
    636                                                         _mem, \
    637                                                         _field, \
    638                                                         MEM_BLOCK_ALL, \
    639                                                         0));\
    640         }
    641 
    642 
    643 
    644 #endif	/* !_BCM_INT_SWITCH_H */