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

tomahawk2.h (15950B)


      1 /*
      2  * 
      3  * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file.
      4  * 
      5  * Copyright 2007-2019 Broadcom Inc. All rights reserved.
      6  *
      7  * File:        tomahawk2.h
      8  * Purpose:     Function declarations for Tomahawk2 Internal functions.
      9  */
     10 
     11 #ifndef _BCM_INT_TOMAHAWK2_H_
     12 #define _BCM_INT_TOMAHAWK2_H_
     13 
     14 #if defined(BCM_TOMAHAWK2_SUPPORT) || defined(BCM_TRIDENT3_SUPPORT)
     15 
     16 #include <bcm/types.h>
     17 #include <bcm/l3.h>
     18 #include <soc/defs.h>
     19 #include <soc/esw/port.h>
     20 #include <bcm/failover.h>
     21 #include <bcm/cosq.h>
     22 #include <bcm/pstats.h>
     23 
     24 
     25 #if defined(INCLUDE_L3)
     26 
     27 /* L3 ECMP DLB */
     28 
     29 typedef struct _th2_ecmp_dlb_port_membership_s {
     30     int nh_index;   /* ECMP DLB member next hop index */
     31     int ref_count;  /* Number of identical nexthops within DLB Group */
     32     int dlb_id;     /* DLB Group */
     33     struct _th2_ecmp_dlb_port_membership_s *next;
     34 } _th2_ecmp_dlb_port_membership_t;
     35 
     36 typedef struct _th2_ecmp_dlb_port_info_s {
     37     int nh_count;   /* Counting different next hops assigned to this port */
     38     int dlb_count;  /* Counting DLB Groups assigned to this port */
     39     _th2_ecmp_dlb_port_membership_t *port_membership_list;
     40               /* Linked list of ECMP DLB nh-indexes assigned to this
     41                * port and the ECMP DLB Groups the next hop
     42                * belong to.
     43                */
     44 } _th2_ecmp_dlb_port_info_t;
     45 
     46 typedef struct _th2_ecmp_dlb_bookkeeping_s {
     47     int ecmp_dlb_property_force_set;
     48     int ecmp_dlb_port_info_size;         /* Size of ecmp_dlb_port_info array */
     49     _th2_ecmp_dlb_port_info_t *ecmp_dlb_port_info;
     50     SHR_BITDCL *ecmp_dlb_id_used_bitmap;
     51     SHR_BITDCL *ecmp_dlb_id_dgm_bitmap;
     52     SHR_BITDCL *ecmp_dlb_flowset_block_bitmap; /* Each block corresponds to
     53                                                   256 entries */
     54     int ecmp_dlb_sample_rate;
     55     int ecmp_dlb_tx_load_min_th;
     56     int ecmp_dlb_tx_load_max_th;
     57     int ecmp_dlb_qsize_min_th;
     58     int ecmp_dlb_qsize_max_th;
     59     int ecmp_dlb_physical_qsize_min_th;
     60     int ecmp_dlb_physical_qsize_max_th;
     61     uint8 *ecmp_dlb_load_weight;
     62     uint8 *ecmp_dlb_qsize_weight;
     63     soc_profile_mem_t *ecmp_dlb_quality_map_profile;
     64 #ifdef BCM_WARM_BOOT_SUPPORT
     65     uint8 recovered_from_scache; /* Indicates if the following members of this
     66                                     structure have been recovered from scache:
     67                                     ecmp_dlb_sample_rate,
     68                                     ecmp_dlb_tx_load_min_th,
     69                                     ecmp_dlb_tx_load_max_th,
     70                                     ecmp_dlb_qsize_min_th,
     71                                     ecmp_dlb_qsize_max_th,
     72                                     ecmp_dlb_physical_qsize_min_th,
     73                                     ecmp_dlb_physical_qsize_max_th,
     74                                     ecmp_dlb_load_weight,
     75                                     ecmp_dlb_qsize_weight,
     76                                     ecmp_dlb_id_dgm_bitmap */
     77 #endif /* BCM_WARM_BOOT_SUPPORT */
     78 } _th2_ecmp_dlb_bookkeeping_t;
     79 
     80 extern void _bcm_th2_ecmp_dlb_deinit(int unit);
     81 extern int _bcm_th2_ecmp_dlb_init(int unit);
     82 extern int bcm_th2_l3_egress_dlb_attr_set(int unit,
     83                                           int nh_index,
     84                                           bcm_l3_egress_t *egr,
     85                                           bcm_l3_egress_t *old_egr);
     86 extern int bcm_th2_l3_egress_dlb_attr_destroy(int unit,
     87                                               int nh_index,
     88                                               bcm_l3_egress_t *egr);
     89 extern int bcm_th2_l3_egress_dlb_attr_get(int unit,
     90                                           int nh_index,
     91                                           bcm_l3_egress_t *egr);
     92 extern int bcm_th2_l3_egress_ecmp_dlb_create(int unit,
     93                                              bcm_l3_egress_ecmp_t *ecmp,
     94                                              int intf_count,
     95                                              bcm_if_t *intf_array,
     96                                              int primary_count,
     97                                              SHR_BITDCL *dlb_member_bitmap);
     98 extern int bcm_th2_l3_egress_ecmp_dlb_destroy(int unit, bcm_if_t mpintf);
     99 extern int bcm_th2_l3_egress_ecmp_dlb_get(int unit, bcm_l3_egress_ecmp_t *ecmp);
    100 extern int _bcm_th2_ecmp_dlb_config_set(int unit,
    101                                         bcm_switch_control_t type,
    102                                         int arg);
    103 extern int _bcm_th2_ecmp_dlb_config_get(int unit,
    104                                         bcm_switch_control_t type,
    105                                         int *arg);
    106 extern int _bcm_th2_l3_egress_ecmp_port_status_set(int unit,
    107                                                    bcm_port_t port, int status);
    108 extern int _bcm_th2_l3_egress_ecmp_port_status_get(int unit,
    109                                                    bcm_port_t port, int *status);
    110 extern int bcm_th2_l3_egress_ecmp_member_status_set(int unit,
    111                                                     bcm_if_t intf,
    112                                                     int status);
    113 extern int bcm_th2_l3_egress_ecmp_member_status_get(int unit,
    114                                                     bcm_if_t intf,
    115                                                     int *status);
    116 extern int bcm_th2_l3_egress_ecmp_dlb_ethertype_set(int unit,
    117                                                     uint32 flags,
    118                                                     int ethertype_count,
    119                                                     int *ethertype_array);
    120 extern int bcm_th2_l3_egress_ecmp_dlb_ethertype_get(int unit,
    121                                                     uint32 *flags,
    122                                                     int ethertype_max,
    123                                                     int *ethertype_array,
    124                                                     int *ethertype_count);
    125 extern int bcm_th2_l3_ecmp_dlb_member_delete(int unit,
    126                                              bcm_l3_egress_ecmp_t *ecmp,
    127                                              bcm_if_t intf,
    128                                              bcm_if_t *intf_array,
    129                                              int *intf_count);
    130 extern int bcm_th2_l3_ecmp_dlb_dgm_member_delete(int unit,
    131                                                  bcm_l3_egress_ecmp_t *ecmp,
    132                                                  bcm_l3_ecmp_member_t *ecmp_member,
    133                                                  bcm_l3_ecmp_member_t *ecmp_member_array,
    134                                                  int *ecmp_member_count);
    135 extern int bcm_th2_l3_ecmp_dlb_member_create(int unit,
    136                                              bcm_l3_egress_ecmp_t *ecmp,
    137                                              bcm_if_t *intf_array,
    138                                              int intf_count);
    139 extern int bcm_th2_l3_ecmp_dlb_dgm_member_create(int unit,
    140                                                  bcm_l3_egress_ecmp_t *ecmp,
    141                                                  bcm_l3_ecmp_member_t *ecmp_member_array,
    142                                                  int ecmp_member_count);
    143 extern int bcm_th2_l3_ecmp_dlb_member_add(int unit,
    144                                           bcm_l3_egress_ecmp_t *ecmp,
    145                                           bcm_if_t intf, bcm_if_t *intf_array,
    146                                           int *intf_count);
    147 extern int bcm_th2_l3_ecmp_dlb_dgm_member_add(int unit,
    148                                               bcm_l3_egress_ecmp_t *ecmp,
    149                                               bcm_l3_ecmp_member_t *ecmp_member,
    150                                               bcm_l3_ecmp_member_t *ecmp_member_array,
    151                                               int *ecmp_member_count);
    152 extern int bcm_th2_l3_ecmp_dlb_member_get(int unit,
    153                                           bcm_l3_egress_ecmp_t *ecmp,
    154                                           int intf_size, bcm_if_t *intf_array,
    155                                           int *intf_count);
    156 extern int bcm_th2_l3_ecmp_dlb_dgm_member_get(int unit,
    157                                               bcm_l3_egress_ecmp_t *ecmp_info,
    158                                               int ecmp_member_size,
    159                                               bcm_l3_ecmp_member_t *ecmp_member_array,
    160                                               int *ecmp_member_count);
    161 #ifdef BCM_WARM_BOOT_SUPPORT
    162 extern int bcm_th2_ecmp_dlb_wb_alloc_size_get(int unit, int *size);
    163 extern int bcm_th2_ecmp_dlb_member_sync(int unit, uint8 **scache_ptr);
    164 extern int bcm_th2_ecmp_dlb_member_scache_recover(int unit, uint8 **scache_ptr);
    165 extern int bcm_th2_ecmp_dlb_sync(int unit, uint8 **scache_ptr);
    166 extern int bcm_th2_ecmp_dlb_scache_recover(int unit, uint8 **scache_ptr);
    167 extern int bcm_th2_ecmp_dlb_hw_recover(int unit);
    168 #endif /* BCM_WARM_BOOT_SUPPORT */
    169 
    170 #ifndef BCM_SW_STATE_DUMP_DISABLE
    171 extern void bcm_th2_ecmp_dlb_sw_dump(int unit);
    172 extern void bcm_th2_dgm_sw_dump(int unit);
    173 #endif /* ifndef BCM_SW_STATE_DUMP_DISABLE */
    174 
    175 /* Number of protection switching groups
    176  * represented per entry in the PROT_SW table TX_INITIAL_PROT_GROUP_TABLE
    177  */
    178 #define BCM_TH2_FAILOVER_PROT_GROUPS_PER_ENTRY 128
    179 extern int _bcm_th2_failover_ingress_id_validate(int unit,
    180                                                   bcm_failover_t failover_id);
    181 
    182 #define BCM_TH2_ECMP_IS_DLB_OR_DGM(_u_, _mode_) \
    183     ((soc_feature(_u_, soc_feature_ecmp_dlb_optimized) && \
    184      (((_mode_) == BCM_L3_ECMP_DYNAMIC_MODE_NORMAL) || \
    185       ((_mode_) == BCM_L3_ECMP_DYNAMIC_MODE_ASSIGNED) || \
    186       ((_mode_) == BCM_L3_ECMP_DYNAMIC_MODE_OPTIMAL))) || \
    187      (soc_feature(_u_, soc_feature_dgm) && \
    188       ((_mode_) == BCM_L3_ECMP_DYNAMIC_MODE_DGM)))
    189 
    190 #define BCM_TH2_ECMP_IS_DLB(_u_, _mode_) \
    191     (soc_feature(_u_, soc_feature_ecmp_dlb_optimized) && \
    192      (((_mode_) == BCM_L3_ECMP_DYNAMIC_MODE_NORMAL) || \
    193       ((_mode_) == BCM_L3_ECMP_DYNAMIC_MODE_ASSIGNED) || \
    194       ((_mode_) == BCM_L3_ECMP_DYNAMIC_MODE_OPTIMAL)))
    195 
    196 extern int _bcm_th2_failover_ingress_id_validate(int unit,
    197                                                   bcm_failover_t failover_id);
    198 
    199 extern int  bcm_th2_failover_init(int unit);
    200 extern void bcm_th2_failover_unlock(int unit);
    201 extern int  bcm_th2_failover_lock(int unit);
    202 extern int  bcm_th2_failover_cleanup(int unit);
    203 extern int  bcm_th2_failover_create(int unit, uint32 flags,
    204                                     bcm_failover_t *failover_id);
    205 extern int  bcm_th2_failover_destroy(int unit, bcm_failover_t  failover_id);
    206 extern int  bcm_th2_failover_status_set(int unit,
    207                 bcm_failover_element_t *failover, int value);
    208 extern int  bcm_th2_failover_status_get(int unit,
    209                 bcm_failover_element_t *failover, int  *value);
    210 #ifdef BCM_WARM_BOOT_SUPPORT
    211 extern int _bcm_th2_failover_sync(int unit);
    212 #endif /* BCM_WARM_BOOT_SUPPORT */
    213 #endif /* INCLUDE_L3 */
    214 
    215 extern int bcmi_th2_port_fn_drv_init(int unit);
    216 extern int bcmi_th2_port_soc_resource_init(int unit, int nport,
    217                                  bcm_port_resource_t *resource,
    218                                  soc_port_resource_t *soc_resource);
    219 extern int bcmi_th2_port_resource_validate(int unit,
    220                             soc_port_schedule_state_t *port_schedule_state);
    221 extern int bcmi_th2_pre_flexport_tdm(int unit,
    222                             soc_port_schedule_state_t *port_schedule_state);
    223 extern int bcmi_th2_post_flexport_tdm(int unit,
    224                             soc_port_schedule_state_t *port_schedule_state);
    225 extern int bcmi_th2_clport_update(int unit,
    226                             soc_port_schedule_state_t *port_schedule_state);
    227 extern int bcmi_th2_port_attach_mmu(int unit, int port);
    228 extern int bcmi_th2_port_detach_asf(int unit, bcm_port_t port);
    229 extern int bcm_th2_ipmc_repl_port_attach(int unit, bcm_port_t port);
    230 extern int bcm_th2_ipmc_repl_port_detach(int unit, bcm_port_t port);
    231 extern int bcmi_th2_port_enable(int unit,
    232                              soc_port_schedule_state_t *port_schedule_state);
    233 extern int bcmi_th2_port_disable(int unit,
    234                              soc_port_schedule_state_t *port_schedule_state);
    235 extern int bcmi_th2_port_speed_1g_update(int unit, bcm_port_t port, int speed);
    236 extern int bcmi_th2_speed_ability_get(int unit, bcm_port_t port,
    237                                       bcm_port_abil_t *mask);
    238 extern int bcmi_th2_tsc_xgxs_reset(int unit, pbmp_t pbmp);
    239 extern int bcmi_th2_speed_mix_validate(int unit, uint32 speed_mask);
    240 
    241 #if defined (INCLUDE_TCB) && defined (BCM_TCB_SUPPORT)
    242 extern int bcm_th2_cosq_tcb_init(int unit);
    243 extern int _bcm_th2_cosq_tcb_deinit(int unit);
    244 #ifndef BCM_SW_STATE_DUMP_DISABLE
    245 extern void bcm_th2_cosq_tcb_sw_dump(int unit);
    246 #endif /* BCM_SW_STATE_DUMP_DISABLE */
    247 extern int bcm_th2_cosq_tcb_config_set(int unit, bcm_cosq_buffer_id_t buffer_id, 
    248                                   bcm_cosq_tcb_config_t *config);
    249 extern int bcm_th2_cosq_tcb_config_get(int unit, bcm_cosq_buffer_id_t buffer_id, 
    250                                   bcm_cosq_tcb_config_t *config);
    251 extern int bcm_th2_cosq_tcb_gport_threshold_mapping_set(int unit, 
    252                                                bcm_gport_t port, 
    253                                                bcm_cos_queue_t cosq, 
    254                                                bcm_cosq_buffer_id_t buffer_id, 
    255                                                int index);
    256 extern int bcm_th2_cosq_tcb_gport_threshold_mapping_get(int unit,
    257                                                bcm_gport_t port, 
    258                                                bcm_cos_queue_t cosq, 
    259                                                bcm_cosq_buffer_id_t buffer_id, 
    260                                                int *index);
    261 extern int bcm_th2_cosq_tcb_threshold_profile_create(int unit, int flags,
    262                                             bcm_cosq_buffer_id_t buffer_id, 
    263                                             bcm_cosq_tcb_threshold_profile_t *threshold,
    264                                             int *index);
    265 extern int bcm_th2_cosq_tcb_threshold_profile_get(int unit, 
    266                                          bcm_cosq_buffer_id_t buffer_id, int index,
    267                                          bcm_cosq_tcb_threshold_profile_t *threshold);
    268 extern int bcm_th2_cosq_tcb_threshold_profile_destroy(int unit, 
    269                                          bcm_cosq_buffer_id_t buffer_id, int index);
    270 extern int bcm_th2_cosq_tcb_buffer_multi_get(int unit, 
    271                                   bcm_cosq_buffer_id_t buffer_id, int count, 
    272                                   bcm_cosq_tcb_buffer_t *entries, int *num);
    273 extern int bcm_th2_cosq_tcb_event_multi_get(int unit, 
    274                                  bcm_cosq_buffer_id_t buffer_id, int count, 
    275                                  bcm_cosq_tcb_event_t *entries, int *num, 
    276                                  int *overflow_count);
    277 extern int bcm_th2_cosq_tcb_control_get(int unit, bcm_cosq_buffer_id_t buffer_id, 
    278                                         bcm_cosq_tcb_control_t type, int *arg);
    279 extern int bcm_th2_cosq_tcb_enable(int unit, bcm_cosq_buffer_id_t buffer_id, 
    280                                           int enable);
    281 extern int bcm_th2_cosq_tcb_freeze(int unit, bcm_cosq_buffer_id_t buffer_id, 
    282                                           int enable);
    283 extern int bcm_th2_cosq_tcb_current_phase_get(int unit, 
    284                                    bcm_cosq_buffer_id_t buffer_id, int *status);
    285 extern int bcm_th2_cosq_tcb_uc_queue_resolve(int unit, bcm_cosq_buffer_id_t buffer_id,
    286                                              int queue, bcm_gport_t *uc_gport);
    287 #ifdef BCM_WARM_BOOT_SUPPORT
    288 extern int bcm_th2_cosq_tcb_reinit(int unit);
    289 #endif
    290 #endif /* INCLUDE_TCB && BCM_TCB_SUPPORT */
    291 
    292 extern void bcm_th2_pstats_deinit(int unit);
    293 extern int bcm_th2_pstats_init(int unit);
    294 
    295 #endif /* BCM_TOMAHAWK2_SUPPORT  */
    296 
    297 #endif /* !_BCM_INT_TOMAHAWK2_H_ */