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

apache.h (73240B)


      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:        apache.h
      8  * Purpose:     Function declarations for apache Internal functions.
      9  */
     10 
     11 #ifndef _BCM_INT_APACHE_H_
     12 #define _BCM_INT_APACHE_H_
     13 
     14 #if defined(BCM_APACHE_SUPPORT)
     15 
     16 #include <bcm_int/esw/mbcm.h>
     17 #include <bcm_int/esw/firebolt.h>
     18 #include <bcm_int/esw/flex_ctr.h>
     19 #include <bcm_int/esw/cosq.h>
     20 #include <bcm_int/esw/switch.h>
     21 #include <bcm_int/esw/vxlan.h>
     22 
     23 #define BCM_AP_COS_PORT_TYPE_HSP 0x1 
     24 #define BCM_AP_COS_PORT_TYPE_LLS 0x2
     25 #define BCM_AP_COS_PORT_TYPE_OVERSUB 0x4
     26 
     27 
     28 /*
     29  * 8 Priority Groups supported.
     30  */
     31 #define AP_PRIOROTY_GROUP_ID_MIN 0
     32 #define AP_PRIOROTY_GROUP_ID_MAX 7
     33 /*
     34  * Inpur priority range.
     35  * PFC : 0-7
     36  * SAFC : 0-15
     37  */
     38 #define AP_PFC_INPUT_PRIORITY_MIN  0
     39 #define AP_PFC_INPUT_PRIORITY_MAX  7
     40 #define AP_SAFC_INPUT_PRIORITY_MIN AP_PFC_INPUT_PRIORITY_MIN
     41 #define AP_SAFC_INPUT_PRIORITY_MAX 15
     42 
     43 extern int bcm_ap_port_rate_ingress_set(int unit, bcm_port_t port,
     44                                          uint32 bandwidth, uint32 burst);
     45 extern int bcm_ap_port_rate_ingress_get(int unit, bcm_port_t port,
     46                                          uint32 *bandwidth, uint32 *burst);
     47 extern int bcm_ap_port_rate_pause_get(int unit, bcm_port_t port,
     48                                        uint32 *pause, uint32 *resume);
     49 extern int bcm_ap_port_rate_egress_set(int unit, bcm_port_t port,
     50                                         uint32 bandwidth, uint32 burst,
     51                                         uint32 mode);
     52 extern int bcm_ap_port_rate_egress_get(int unit, bcm_port_t port,
     53                                         uint32 *bandwidth, uint32 *burst,
     54                                         uint32 *mode);
     55 
     56 extern int bcm_apache_flexport_pbmp_update(int unit, bcm_pbmp_t *pbmp);
     57 
     58 extern int bcm_apache_port_drain_cells(int unit, int port);
     59 extern int bcm_ap_port_init(int unit);
     60 
     61 extern int _bcm_ap_port_lls_config_set(int unit, bcm_port_t port);
     62 extern int _bcm_ap_port_hsp_config_set(int unit, bcm_port_t port);
     63 extern int bcm_ap_cosq_flex_port_update(int unit, bcm_port_t port , 
     64                                                       int enable); 
     65 extern int
     66 bcm_ap_port_priority_group_mapping_set(int unit, bcm_gport_t gport,
     67                                         int prio, int priority_group);
     68 extern int
     69 bcm_ap_port_priority_group_mapping_get(int unit, bcm_gport_t gport,
     70                                         int prio, int *priority_group);
     71 #if defined(BCM_FIELD_SUPPORT)
     72 extern int _bcm_field_ap_stage_init(int unit, _field_stage_t *stage_fc);
     73 extern int _bcm_field_ap_init(int unit, _field_control_t *fc);
     74 extern int _bcm_field_ap_qual_tcam_key_mask_set(int unit,
     75                                                  _field_entry_t *f_ent,
     76                                                  unsigned validf);
     77 extern int _bcm_field_ap_egress_selcode_set(int unit,
     78                                              _field_group_t *fg,
     79                                              uint32 efp_slice_mode, 
     80                                              uint32 efp_key_mode,
     81                                              uint32 key_match_type, 
     82                                              int *parts_count);
     83 extern int _bcm_field_ap_group_construct_quals_add(int unit,
     84                                                     _field_control_t *fc,
     85                                                     _field_stage_t   *stage_fc,
     86                                                     bcm_field_qset_t qset,
     87                                                     uint8 entry_type,
     88                                                     _field_group_t *fg
     89                                                    );
     90 extern int _bcm_field_ap_qual_tcam_key_mask_get(int unit,
     91                                                 _field_entry_t *f_ent,
     92                                                 _field_tcam_t *tcam);
     93 extern int _bcm_field_ap_qualify_PacketRes(int               unit,
     94                                             bcm_field_entry_t entry,
     95                                             uint32            *data,
     96                                             uint32            *mask
     97                                             );
     98 extern int _bcm_field_ap_qualify_PacketRes_get(int               unit,
     99                                                 bcm_field_entry_t entry,
    100                                                 uint32            *data,
    101                                                 uint32            *mask
    102                                                 );
    103 extern int
    104 _bcm_field_ap_qualify_LoopbackType(bcm_field_LoopbackType_t loopback_type,
    105                                     uint32                   *tcam_data,
    106                                     uint32                   *tcam_mask
    107                                     );
    108 extern int
    109 _bcm_field_ap_qualify_LoopbackType_get(uint8                    tcam_data,
    110                                         uint8                    tcam_mask,
    111                                         bcm_field_LoopbackType_t *loopback_type
    112                                         );
    113 extern int 
    114 _bcm_field_ap_qualify_TunnelType(bcm_field_TunnelType_t tunnel_type,
    115                                   uint32                 *tcam_data,
    116                                   uint32                 *tcam_mask
    117                                   );
    118 extern int 
    119 _bcm_field_ap_qualify_TunnelType_get(uint8                  tcam_data,
    120                                       uint8                  tcam_mask,
    121                                       bcm_field_TunnelType_t *tunnel_type
    122                                       );
    123 extern int _bcm_field_ap_qualify_class(int unit,
    124                                         bcm_field_entry_t entry,
    125                                         bcm_field_qualify_t qual,
    126                                         uint32 *data,
    127                                         uint32 *mask
    128                                         );
    129 extern int _bcm_field_ap_qualify_class_get(int unit,
    130                                             bcm_field_entry_t entry,
    131                                             bcm_field_qualify_t qual,
    132                                             uint32 *data,
    133                                             uint32 *mask
    134                                             );
    135 extern int _bcm_field_ap_action_get(int             unit,
    136                                      soc_mem_t       mem,
    137                                      _field_entry_t  *f_ent,
    138                                      int             tcam_idx,
    139                                      _field_action_t *fa,
    140                                      uint32          *buf
    141                                      );
    142 extern int 
    143 _bcm_field_ap_hash_select_profile_ref_count_get(int unit,
    144                                                  soc_mem_t profile_mem, 
    145                                                  int index, 
    146                                                  int *ref_count);
    147 extern int 
    148 _bcm_field_ap_hash_select_profile_delete(int unit, 
    149                                          soc_mem_t profile_mem, 
    150                                          int index);
    151 extern int 
    152 _bcm_field_ap_hash_select_profile_alloc(int unit,
    153                                          _field_entry_t *f_ent,
    154                                          _field_action_t *fa);
    155 extern int 
    156 _bcm_field_ap_hash_select_profile_get(int unit, 
    157                                        soc_mem_t profile_mem,
    158                                        soc_profile_mem_t **hash_select_profile);
    159 extern int
    160 _bcm_field_ap_hash_select_profile_hw_free(int unit, 
    161                                            _field_entry_t *f_ent, 
    162                                            uint32 flags);
    163 extern int
    164 _bcm_field_ap_hash_select_profile_hw_alloc (int unit, _field_entry_t *f_ent);
    165 
    166 extern int _bcm_field_ap_group_install(int unit, _field_group_t *fg);
    167 extern int _bcm_field_ap_write_slice_map(int unit, _field_stage_t *stage_fc);
    168 
    169 extern int _bcm_field_ap_slice_clear(int unit,
    170                                       _field_group_t *fg,
    171                                       _field_slice_t *fs);
    172 
    173 extern int _bcm_field_ap_selcodes_install(int unit,
    174                                            _field_group_t *fg,
    175                                            uint8 slice_num,
    176                                            bcm_pbmp_t pbmp,
    177                                            int selcode_idx);
    178 
    179 extern int _bcm_field_ap_entry_move(int unit,
    180                                      _field_entry_t *f_ent,
    181                                     int parts_count,
    182                                     int *tcam_idx_old,
    183                                     int *tcam_idx_new);
    184 
    185 extern int _bcm_field_ap_action_support_check(int unit,
    186                                                _field_entry_t *f_ent,
    187                                                bcm_field_action_t action,
    188                                                int *result);
    189 
    190 extern int _bcm_field_ap_action_params_check(int unit,
    191                                               _field_entry_t  *f_ent,
    192                                               _field_action_t *fa);
    193 
    194 extern int _bcm_field_ap_stage_action_support_check(int unit,
    195                                                      unsigned stage,
    196                                                      bcm_field_action_t action,
    197                                                      int *result);
    198 extern int
    199 _bcm_field_ap_lookup_selcodes_install(int            unit,
    200                                        _field_group_t *fg,
    201                                        uint8          slice_num,
    202                                        int            selcode_idx
    203                                        );
    204 extern int
    205 _bcm_field_ap_lookup_mode_set(int            unit,
    206                                uint8          slice_num,
    207                                _field_group_t *fg,
    208                                uint8          flags
    209                                );
    210 extern int
    211 _bcm_field_ap_qualify_VlanTranslationHit(int               unit,
    212                                           bcm_field_entry_t entry,
    213                                           uint8             *data,
    214                                           uint8             *mask);
    215 extern int
    216 _bcm_field_ap_qualify_VlanTranslationHit_get(int               unit,
    217                                               bcm_field_entry_t entry,
    218                                               uint8             *data,
    219                                               uint8             *mask);
    220 
    221 extern int 
    222 _bcm_field_ap_qualify_ip_type(int unit, _field_entry_t *f_ent, 
    223                                           bcm_field_IpType_t type);
    224 extern int 
    225 _bcm_field_ap_qualify_ip_type_get(int unit, _field_entry_t *f_ent, 
    226                                               bcm_field_IpType_t *type);
    227 extern int 
    228 _bcm_field_ap_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_AP_L3_PORT_MASK        0x7f
    235 #define _BCM_AP_L3_MODID_MASK       0xff
    236 #define _BCM_AP_L3_MODID_SHIFT      0x7
    237 #define _BCM_AP_L3_DEFAULT_MTU_SIZE 0x3fff
    238 
    239 #if defined(INCLUDE_L3)
    240 
    241 #define BCM_AP_L3_USE_EMBEDDED_NEXT_HOP(_u_, _intf_, _nhidx_)      \
    242              ((_nhidx_ == BCM_XGS3_L3_INVALID_INDEX)             && \
    243               (!BCM_XGS3_L3_EGRESS_IDX_VALID(_u_, _intf_))       && \
    244               (!BCM_XGS3_L3_MPATH_EGRESS_IDX_VALID(_u_, _intf_)) && \
    245               (!BCM_XGS3_DVP_EGRESS_IDX_VALID(_u_, _intf_))      && \
    246               (BCM_XGS3_L3_EGRESS_MODE_ISSET(_u_))               && \
    247               (soc_feature(unit, soc_feature_l3_extended_host_entry)))
    248             
    249 #define BCM_AP_L3_HOST_TABLE_MEM(_u_, _intf_, _v6_, _mem_, _nhidx_)                     \
    250             _mem_ = (_v6_) ? ((BCM_AP_L3_USE_EMBEDDED_NEXT_HOP(_u_, _intf_, _nhidx_))?  \
    251                              L3_ENTRY_IPV6_MULTICASTm:L3_ENTRY_IPV6_UNICASTm) :          \
    252                            ((BCM_AP_L3_USE_EMBEDDED_NEXT_HOP(_u_, _intf_, _nhidx_))?    \
    253                              L3_ENTRY_IPV4_MULTICASTm:L3_ENTRY_IPV4_UNICASTm)
    254 
    255 #define BCM_AP_L3_IS_EMBEDDED_NH_TABLE(_mem_, _v6_)   \
    256     (_mem_ == L3_ENTRY_IPV4_MULTICASTm && !_v6_) || \
    257     (_mem_ == L3_ENTRY_IPV4_MULTICASTm && _v6_)
    258 
    259 #define  BCM_AP_L3_HOST_TABLE_FLD(_u_, _mem_, _v6_, _fld_)                                   \
    260               _fld_ = (_bcm_l3_fields_t *) INT_TO_PTR((_v6_) ?                                \
    261                        ((_mem_ == L3_ENTRY_IPV6_UNICASTm) ?                                   \
    262                          BCM_XGS3_L3_MEM_FIELDS(_u_,v6): BCM_XGS3_L3_MEM_FIELDS(_u_, v6_4)) : \
    263                        ((_mem_ == L3_ENTRY_IPV4_UNICASTm) ?                                   \
    264                          BCM_XGS3_L3_MEM_FIELDS(_u_,v4): BCM_XGS3_L3_MEM_FIELDS(_u_, v4_2)))
    265 
    266 #define BCM_AP_L3_HOST_ENTRY_BUF(_v6_, _mem_, _buf_, _v4ent_, _v4extent_, _v6ent_, _v6extent_)  \
    267             _buf_ = ((_v6_) ?                                                        \
    268                   ((_mem_ == L3_ENTRY_IPV6_UNICASTm) ? (uint32 *) &_v6ent_ :         \
    269                    (uint32 *) &_v6extent_) :                                         \
    270                   ((_mem_ == L3_ENTRY_IPV4_UNICASTm) ? (uint32 *) &_v4ent_ :         \
    271                    (uint32 *) &_v4extent_)) 
    272 
    273 
    274 /* L3 Internal Functions */
    275 /* Host table support */
    276 extern int _bcm_ap_l3_add(int unit, _bcm_l3_cfg_t *l3cfg, int nh_idx);
    277 extern int _bcm_ap_l3_get(int unit, _bcm_l3_cfg_t *l3cfg, int *nh_idx);
    278 extern int _bcm_ap_l3_del(int unit, _bcm_l3_cfg_t *l3cfg);
    279 extern int _bcm_ap_l3_del_match(int unit, int flags, void *pattern,
    280                        bcm_xgs3_ent_op_cb cmp_func,
    281                        bcm_l3_host_traverse_cb notify_cb, void *user_data);
    282 extern int _bcm_ap_l3_traverse(int unit, int flags, uint32 start, uint32 end,
    283                                  bcm_l3_host_traverse_cb cb, void *user_data);
    284 
    285 extern int _bcm_ap_l3_get_by_idx(int unit, void *dma_ptr, int idx,
    286                                    _bcm_l3_cfg_t *l3cfg, int *nh_idx);
    287 extern int bcm_ap_l3_conflict_get(int unit, bcm_l3_key_t *ipkey, bcm_l3_key_t *cf_array,
    288                                    int cf_max, int *cf_count);
    289 extern int bcm_ap_l3_replace(int unit, _bcm_l3_cfg_t *l3cfg);
    290 extern int bcm_ap_l3_del_intf(int unit, _bcm_l3_cfg_t *l3cfg, int negate);
    291 
    292 #ifdef ALPM_ENABLE
    293 /* ALPM */
    294 extern int _bcm_ap_alpm_add(int unit, _bcm_defip_cfg_t *lpm_cfg, 
    295                              int nh_ecmp_idx);
    296 extern int _bcm_ap_alpm_del(int unit, _bcm_defip_cfg_t *lpm_cfg);
    297 extern int _bcm_ap_alpm_get(int unit, _bcm_defip_cfg_t *lpm_cfg, int
    298                              *nh_ecmp_idx);
    299 extern int _bcm_ap_alpm_find(int unit, _bcm_defip_cfg_t *lpm_cfg, 
    300                               int *nh_ecmp_idx);
    301 extern int _bcm_ap_alpm_update_match(int unit, _bcm_l3_trvrs_data_t *trv_data);
    302 #endif
    303 
    304 
    305 /* L3 IPMC */
    306 extern int _bcm_ap_l3_ipmc_get_by_idx(int unit, void *dma_ptr, int idx,
    307                                        _bcm_l3_cfg_t *l3cfg);
    308 extern int _bcm_ap_l3_ipmc_get(int unit, _bcm_l3_cfg_t *l3cfg);
    309 extern int _bcm_ap_l3_ipmc_add(int unit, _bcm_l3_cfg_t *l3cfg);
    310 extern int _bcm_ap_l3_ipmc_del(int unit, _bcm_l3_cfg_t *l3cfg);
    311 extern int bcm_ap_ipmc_pim_bidir_init(int unit);
    312 extern int bcm_ap_ipmc_pim_bidir_detach(int unit);
    313 extern int bcm_ap_ipmc_rp_create(int unit, uint32 flags, int *rp_id);
    314 extern int bcm_ap_ipmc_rp_destroy(int unit, int rp_id);
    315 extern int bcm_ap_ipmc_rp_set(int unit, int rp_id, int intf_count,
    316         bcm_if_t *intf_array);
    317 extern int bcm_ap_ipmc_rp_get(int unit, int rp_id, int intf_max,
    318         bcm_if_t *intf_array, int *intf_count);
    319 extern int bcm_ap_ipmc_rp_add(int unit, int rp_id, bcm_if_t intf_id);
    320 extern int bcm_ap_ipmc_rp_delete(int unit, int rp_id, bcm_if_t intf_id);
    321 extern int bcm_ap_ipmc_rp_delete_all(int unit, int rp_id);
    322 extern int bcm_ap_ipmc_rp_ref_count_incr(int unit, int rp_id);
    323 extern int bcm_ap_ipmc_rp_ref_count_decr(int unit, int rp_id);
    324 extern int bcm_ap_ipmc_range_add(int unit, int *range_id,
    325         bcm_ipmc_range_t *range);
    326 extern int bcm_ap_ipmc_range_delete(int unit, int range_id);
    327 extern int bcm_ap_ipmc_range_delete_all(int unit);
    328 extern int bcm_ap_ipmc_range_get(int unit, int range_id,
    329         bcm_ipmc_range_t *range);
    330 extern int bcm_ap_ipmc_range_size_get(int unit, int *size);
    331 /* AP v6 reserved multicast */
    332 extern int  _bcm_ap_ipv6_reserved_multicast_addr_set(int unit, bcm_ip6_t ip6_addr,
    333                                                       bcm_ip6_t ip6_mask);
    334 extern int  _bcm_ap_ipv6_reserved_multicast_addr_get(int unit, bcm_ip6_t *ip6_addr,
    335                                                       bcm_ip6_t *ip6_mask);
    336 #if defined(INCLUDE_BFD)
    337 extern int bcmi_ap_bfd_init(int unit);
    338 #endif /* INCLUDE_BFD */
    339 
    340 #ifdef BCM_WARM_BOOT_SUPPORT
    341 extern int bcm_ap_ipmc_pim_bidir_scache_size_get(int unit, uint32 *size);
    342 extern int bcm_ap_ipmc_pim_bidir_sync(int unit, uint8 **scache_ptr);
    343 extern int bcm_ap_ipmc_pim_bidir_scache_recover(int unit, uint8 **scache_ptr); 
    344 extern int bcm_ap_ipmc_rp_ref_count_recover(int unit, int rp_id); 
    345 #endif /* BCM_WARM_BOOT_SUPPORT */
    346 #ifdef BCM_WARM_BOOT_SUPPORT_SW_DUMP
    347 extern void _bcm_ap_ipmc_pim_bidir_sw_dump(int unit);
    348 extern void _bcm_ap_vxlan_sw_dump(int unit);
    349 #endif /* BCM_WARM_BOOT_SUPPORT_SW_DUMP */
    350 
    351 /* Flex stat - L3 host table */
    352 extern bcm_error_t _bcm_ap_l3_host_stat_attach(
    353             int unit,
    354             bcm_l3_host_t *info,
    355             uint32 stat_counter_id);
    356 extern bcm_error_t _bcm_ap_l3_host_stat_detach(
    357             int unit,
    358             bcm_l3_host_t *info);
    359 extern bcm_error_t _bcm_ap_l3_host_stat_counter_get(
    360             int unit,
    361             int sync_mode,
    362             bcm_l3_host_t *info,
    363             bcm_l3_stat_t stat,
    364             uint32 num_entries,
    365             uint32 *counter_indexes,
    366             bcm_stat_value_t *counter_values);
    367 extern bcm_error_t _bcm_ap_l3_host_stat_counter_set(
    368             int unit,
    369             bcm_l3_host_t *info,
    370             bcm_l3_stat_t stat,
    371             uint32 num_entries,
    372             uint32 *counter_indexes,
    373             bcm_stat_value_t *counter_values);
    374 extern bcm_error_t _bcm_ap_l3_host_stat_id_get(
    375             int unit,
    376             bcm_l3_host_t *info,
    377             bcm_l3_stat_t stat,
    378             uint32 *stat_counter_id);
    379 
    380 /* Flex Stat - L3 Route defip */
    381 extern bcm_error_t _bcm_ap_l3_route_stat_attach (
    382             int                 unit,
    383             bcm_l3_route_t      *info,
    384             uint32              stat_counter_id);
    385 extern bcm_error_t    _bcm_ap_l3_route_stat_detach (
    386             int                 unit,
    387             bcm_l3_route_t      *info);
    388 
    389 extern bcm_error_t _bcm_ap_l3_route_stat_counter_get(
    390             int                 unit, 
    391             int                 sync_mode, 
    392             bcm_l3_route_t      *info,
    393             bcm_l3_route_stat_t stat, 
    394             uint32              num_entries, 
    395             uint32              *counter_indexes, 
    396             bcm_stat_value_t    *counter_values);
    397 
    398 extern bcm_error_t _bcm_ap_l3_route_stat_counter_set(
    399             int                 unit, 
    400             bcm_l3_route_t      *info,
    401             bcm_l3_route_stat_t stat, 
    402             uint32              num_entries, 
    403             uint32              *counter_indexes, 
    404             bcm_stat_value_t    *counter_values);
    405 extern bcm_error_t _bcm_ap_l3_route_stat_multi_get(
    406             int                 unit, 
    407             bcm_l3_route_t      *info,
    408             int                 nstat, 
    409             bcm_l3_route_stat_t    *stat_arr,
    410             uint64              *value_arr);
    411 
    412 extern bcm_error_t _bcm_ap_l3_route_stat_multi_get32(
    413             int                 unit, 
    414             bcm_l3_route_t      *info,
    415             int                 nstat, 
    416             bcm_l3_route_stat_t    *stat_arr,
    417             uint32              *value_arr);
    418 
    419 extern bcm_error_t _bcm_ap_l3_route_stat_multi_set(
    420             int                 unit, 
    421             bcm_l3_route_t      *info,
    422             int                 nstat, 
    423             bcm_l3_route_stat_t    *stat_arr,
    424             uint64              *value_arr);
    425 
    426 extern bcm_error_t _bcm_ap_l3_route_stat_multi_set32(
    427             int                 unit, 
    428             bcm_l3_route_t      *info,
    429             int                 nstat, 
    430             bcm_l3_route_stat_t  *stat_arr,
    431             uint32              *value_arr);
    432 extern bcm_error_t _bcm_ap_l3_route_stat_id_get(
    433             int                 unit,
    434             bcm_l3_route_t      *info,
    435             bcm_l3_route_stat_t stat, 
    436             uint32              *stat_counter_id);
    437 extern bcm_error_t _bcm_ap_ipmc_stat_attach(
    438             int unit,
    439             bcm_ipmc_addr_t *info,
    440             uint32 stat_counter_id);
    441 extern bcm_error_t _bcm_ap_ipmc_stat_detach(
    442             int unit,
    443             bcm_ipmc_addr_t *info);
    444 extern bcm_error_t _bcm_ap_ipmc_stat_counter_get(
    445             int unit,
    446             int sync_mode,
    447             bcm_ipmc_addr_t *info,
    448             bcm_ipmc_stat_t stat,
    449             uint32 num_entries,
    450             uint32 *counter_indexes,
    451             bcm_stat_value_t *counter_values);
    452 extern bcm_error_t _bcm_ap_ipmc_stat_counter_set(
    453             int unit,
    454             bcm_ipmc_addr_t *info,
    455             bcm_ipmc_stat_t stat,
    456             uint32 num_entries,
    457             uint32 *counter_indexes,
    458             bcm_stat_value_t *counter_values);
    459 extern bcm_error_t _bcm_ap_ipmc_stat_id_get(
    460             int unit,
    461             bcm_ipmc_addr_t *info,
    462             bcm_ipmc_stat_t stat,
    463             uint32 *stat_counter_id);
    464 extern  bcm_error_t  _bcm_ap_ipmc_stat_multi_get(
    465                             int                 unit, 
    466                             bcm_ipmc_addr_t     *info,
    467                             int                 nstat, 
    468                             bcm_ipmc_stat_t     *stat_arr,
    469                             uint64              *value_arr);
    470 extern bcm_error_t  _bcm_ap_ipmc_stat_multi_get32(
    471                             int                 unit, 
    472                             bcm_ipmc_addr_t     *info,
    473                             int                 nstat, 
    474                             bcm_ipmc_stat_t     *stat_arr,
    475                             uint32              *value_arr);
    476 extern bcm_error_t  _bcm_ap_ipmc_stat_multi_set(
    477                             int                 unit, 
    478                             bcm_ipmc_addr_t     *info,
    479                             int                 nstat, 
    480                             bcm_ipmc_stat_t     *stat_arr,
    481                             uint64              *value_arr);
    482 extern  bcm_error_t  _bcm_ap_ipmc_stat_multi_set32(
    483                             int                 unit, 
    484                             bcm_ipmc_addr_t     *info,
    485                             int                 nstat, 
    486                             bcm_ipmc_stat_t     *stat_arr,
    487                             uint32              *value_arr);
    488 
    489 extern int _bcm_ap_l3_ip4_options_free_resources(int unit);
    490 extern int _bcm_ap_l3_ip4_options_profile_init(int unit);
    491 extern int _bcm_ap_l3_ip4_options_profile_create(int unit, uint32 flags, 
    492                                    bcm_l3_ip4_options_action_t default_action, 
    493                                    int *ip4_options_profile_id);
    494 extern int _bcm_ap_l3_ip4_options_profile_destroy(int unit, 
    495                                                    int ip4_options_profile_id);
    496 extern int _bcm_ap_l3_ip4_options_profile_action_set(int unit,
    497                          int ip4_options_profile_id, 
    498                          int ip4_option, 
    499                          bcm_l3_ip4_options_action_t action);
    500 extern int _bcm_ap_l3_ip4_options_profile_action_get(int unit,
    501                          int ip4_options_profile_id, 
    502                          int ip4_option, 
    503                          bcm_l3_ip4_options_action_t *action);
    504 extern int _bcm_ap_l3_ip4_options_profile_multi_get(int unit, int array_size, 
    505                                       int *ip_options_ids_array, 
    506                                       int *array_count);
    507 extern int _bcm_ap_l3_ip4_options_profile_action_multi_get(int unit, 
    508                           uint32 flags,
    509                           int ip_option_profile_id, int array_size, 
    510                           bcm_l3_ip4_options_action_t *array, int *array_count);
    511 extern int _bcm_ap_l3_ip4_options_profile_id2idx(int unit, int profile_id, 
    512                                                   int *hw_idx);
    513 extern int _bcm_ap_l3_ip4_options_profile_idx2id(int unit, int hw_idx, 
    514                                                   int *profile_id);
    515 extern int _bcm_ap_vp_urpf_mode_set(int unit, bcm_port_t port, int arg);
    516 extern int _bcm_ap_vp_urpf_mode_get(int unit, bcm_port_t port, int *arg);
    517 extern int _bcm_ap_l3_intf_iif_profile_update(int unit, bcm_vlan_t vid,
    518                                                bcm_vlan_control_vlan_t *control);
    519 extern int _bcm_ap_l3_intf_iif_profile_get(int unit, bcm_vlan_t vid,
    520                                             bcm_vlan_control_vlan_t *control);
    521 #ifdef BCM_WARM_BOOT_SUPPORT
    522 extern int _bcm_ap_l3_ip4_options_profile_scache_len_get(int unit, 
    523                                                           int *wb_alloc_size);
    524 extern int _bcm_ap_l3_ip4_options_recover(int unit, uint8 **scache_ptr);
    525 
    526 extern int _bcm_ap_l3_ip4_options_sync(int unit, uint8 **scache_ptr);
    527 #endif /* BCM_WARM_BOOT_SUPPORT */
    528 
    529 /* VXLAN */
    530 extern int bcm_ap_vxlan_udpDestPort_set(int unit, int udpDestPort);
    531 extern int bcm_ap_vxlan_udpSourcePort_set(int unit, int hashEnable);
    532 extern int bcm_ap_vxlan_udpDestPort_get(int unit, int *udpDestPort);
    533 extern int bcm_ap_vxlan_udpSourcePort_get(int unit, int *hashEnable);
    534 extern int bcm_ap_vxlan_egress_get(int unit, bcm_l3_egress_t *egr, int nh_index);
    535 extern int bcm_ap_vxlan_egress_set(int unit, int nh_index, uint32 flags);
    536 extern int bcm_ap_vxlan_egress_reset(int unit, int nh_index);
    537 
    538 extern int _bcm_ap_vxlan_port_resolve(
    539            int unit, 
    540            bcm_gport_t l2gre_port_id, 
    541            bcm_if_t encap_id, 
    542            bcm_module_t *modid, 
    543            bcm_port_t *port,
    544            bcm_trunk_t *trunk_id, 
    545            int *id);
    546 
    547 extern  int  bcm_ap_vxlan_lock(int unit);
    548 extern void bcm_ap_vxlan_unlock(int unit);
    549 extern int bcm_ap_vxlan_init(int unit);
    550 extern int bcm_ap_vxlan_cleanup(int unit);
    551 extern int bcm_ap_vxlan_vpn_create(int unit, bcm_vxlan_vpn_config_t *info);
    552 extern int bcm_ap_vxlan_vpn_destroy(int unit, bcm_vpn_t l2vpn);
    553 extern int bcm_ap_vxlan_vpn_destroy_all(int unit);
    554 extern int bcm_ap_vxlan_vpn_traverse(int unit, bcm_vxlan_vpn_traverse_cb cb, void *user_data);
    555 extern int bcm_ap_vxlan_vpn_get( int unit, bcm_vpn_t l2vpn, bcm_vxlan_vpn_config_t *info);
    556 extern int bcm_ap_vxlan_port_add(int unit, bcm_vpn_t vpn, bcm_vxlan_port_t  *vxlan_port);
    557 extern int bcm_ap_vxlan_port_delete(int unit, bcm_vpn_t vpn, bcm_gport_t vxlan_port_id);
    558 extern int bcm_ap_vxlan_port_delete_all(int unit, bcm_vpn_t vpn);
    559 extern int bcm_ap_vxlan_port_get(int unit, bcm_vpn_t vpn, bcm_vxlan_port_t *vxlan_port);
    560 extern int bcm_ap_vxlan_port_get_all( int unit, bcm_vpn_t l2vpn, int port_max, bcm_vxlan_port_t *port_array, int *port_count);
    561 extern int bcm_ap_vxlan_tunnel_initiator_create(int unit, bcm_tunnel_initiator_t *info);
    562 extern int bcm_ap_vxlan_tunnel_initiator_destroy(int unit, bcm_gport_t vxlan_tunnel_id);
    563 extern int bcm_ap_vxlan_tunnel_initiator_destroy_all(int unit);
    564 extern int bcm_ap_vxlan_tunnel_initiator_get(int unit, bcm_tunnel_initiator_t *info);
    565 extern int bcm_ap_vxlan_tunnel_initiator_traverse(int unit, bcm_tunnel_initiator_traverse_cb cb, void *user_data);
    566 extern int bcm_ap_vxlan_tunnel_terminator_create(int unit, bcm_tunnel_terminator_t *info);
    567 extern int bcm_ap_vxlan_tunnel_terminator_update(int unit, bcm_tunnel_terminator_t *info);
    568 extern int bcm_ap_vxlan_tunnel_terminator_destroy(int unit, bcm_gport_t vxlan_tunnel_id);
    569 extern int bcm_ap_vxlan_tunnel_terminator_destroy_all(int unit);
    570 extern int bcm_ap_vxlan_tunnel_terminator_get( int unit, bcm_tunnel_terminator_t *info);
    571 extern int bcm_ap_vxlan_tunnel_terminator_traverse(int unit, bcm_tunnel_terminator_traverse_cb cb, void *user_data);
    572 extern int  _bcm_ap_vxlan_vpn_get(int unit, int vfi_index, bcm_vlan_t *vid);
    573 extern int bcm_ap_vxlan_multicast_leaf_entry_check(int unit, bcm_ip_t mc_ip_addr, bcm_ip_t  src_ip_addr, int enable_flag);
    574 extern int _bcm_ap_vxlan_vpn_is_eline( int unit, bcm_vpn_t l2vpn, uint8 *isEline);
    575 extern int bcm_ap_vxlan_port_learn_set(int unit, bcm_gport_t vxlan_port_id, uint32 flags);
    576 extern int bcm_ap_vxlan_port_learn_get(int unit, bcm_gport_t vxlan_port_id, uint32 *flags);
    577 extern int bcm_ap_vxlan_trunk_member_add (int unit, bcm_trunk_t trunk_id, 
    578                                              int trunk_member_count, bcm_port_t *trunk_member_array);
    579 extern int bcm_ap_vxlan_trunk_member_delete(int unit, bcm_trunk_t trunk_id, 
    580                                              int trunk_member_count, bcm_port_t *trunk_member_array); 
    581 extern int _bcm_ap_vxlan_port_get(int unit, bcm_vpn_t vpn, int vp,
    582 									bcm_vxlan_port_t  *vxlan_port);
    583 
    584 /* L2GRE */
    585 extern int bcm_ap_l2gre_match_add(int unit, bcm_l2gre_port_t *l2gre_port, int vp, bcm_vpn_t vpn);
    586 extern int bcm_ap_l2gre_match_delete(int unit,  int vp);
    587 extern int _bcm_ap_l2gre_eline_vp_configure (int unit, int vfi_index, int active_vp, 
    588                   source_vp_entry_t *svp, int tpid_enable, bcm_l2gre_port_t  *l2gre_port);
    589 extern int _bcm_ap_l2gre_elan_vp_configure (int unit, int vfi_index, int active_vp, 
    590                   source_vp_entry_t *svp, int tpid_enable, bcm_l2gre_port_t  *l2gre_port);
    591 extern int _bcm_ap_vxlan_port_get(int unit, bcm_vpn_t vpn, int vp,
    592                                   bcm_vxlan_port_t  *vxlan_port);
    593 
    594 /* Port Extender */
    595 extern int bcm_ap_extender_forward_add(int unit,
    596         bcm_extender_forward_t *extender_forward_entry);
    597 extern int bcm_ap_extender_forward_delete(int unit,
    598         bcm_extender_forward_t *extender_forward_entry);
    599 extern int bcm_ap_extender_forward_delete_all(int unit);
    600 extern int bcm_ap_extender_forward_get(int unit,
    601         bcm_extender_forward_t *extender_forward_entry);
    602 extern int bcm_ap_extender_forward_traverse(int unit,
    603         bcm_extender_forward_traverse_cb cb, void *user_data);
    604 
    605 /* VP LAG */
    606 extern int bcm_ap_vp_lag_init(int unit);
    607 extern void bcm_ap_vp_lag_deinit(int unit);
    608 extern int bcm_ap_vp_lag_create(int unit, uint32 flags, bcm_trunk_t *tid);
    609 extern int bcm_ap_vp_lag_info_get(int unit, int *ngroups_vp_lag,
    610         int *nports_vp_lag);
    611 extern int bcm_ap_vp_lag_set(int unit, bcm_trunk_t tid,
    612         bcm_trunk_info_t *trunk_info, int member_count,
    613         bcm_trunk_member_t *member_array);
    614 extern int bcm_ap_vp_lag_destroy(int unit, bcm_trunk_t tid);
    615 extern int bcm_ap_vp_lag_get(int unit, bcm_trunk_t tid,
    616         bcm_trunk_info_t *trunk_info, int member_max,
    617         bcm_trunk_member_t *member_array, int *member_count);
    618 extern int bcm_ap_tid_to_vp_lag_vp(int unit, bcm_trunk_t tid, int *vp_lag_vp);
    619 extern int bcm_ap_vp_lag_vp_to_tid(int unit, int vp_lag_vp, bcm_trunk_t *tid);
    620 extern int bcm_ap_vp_lag_find(int unit, bcm_port_t port, bcm_trunk_t *tid);
    621 extern int bcm_ap_vlan_vp_source_vp_lag_set(int unit, bcm_gport_t gport,
    622         int vp_lag_vp);
    623 extern int bcm_ap_vlan_vp_source_vp_lag_clear(int unit, bcm_gport_t gport,
    624         int vp_lag_vp);
    625 extern int bcm_ap_vlan_vp_source_vp_lag_get(int unit, bcm_gport_t gport,
    626         int *vp_lag_vp);
    627 extern int bcm_ap_niv_port_source_vp_lag_set(int unit, bcm_gport_t gport,
    628         int vp_lag_vp);
    629 extern int bcm_ap_niv_port_source_vp_lag_clear(int unit, bcm_gport_t gport,
    630         int vp_lag_vp);
    631 extern int bcm_ap_niv_port_source_vp_lag_get(int unit, bcm_gport_t gport,
    632         int *vp_lag_vp);
    633 extern int bcm_ap_extender_port_source_vp_lag_set(int unit, bcm_gport_t gport,
    634         int vp_lag_vp);
    635 extern int bcm_ap_extender_port_source_vp_lag_clear(int unit, bcm_gport_t gport,
    636         int vp_lag_vp);
    637 extern int bcm_ap_extender_port_source_vp_lag_get(int unit, bcm_gport_t gport,
    638         int *vp_lag_vp);
    639 extern int bcm_ap_vp_lag_status_get(int unit, int vp_lag_id, int *is_vp_lag,
    640         int *is_used, int *has_member);
    641 extern int _bcm_esw_num_vp_trunk_groups(int unit);
    642 #ifdef BCM_WARM_BOOT_SUPPORT
    643 extern int bcm_ap_vp_lag_reinit(int unit);
    644 #endif /* BCM_WARM_BOOT_SUPPORT */
    645 #ifdef BCM_WARM_BOOT_SUPPORT_SW_DUMP
    646 extern void bcm_ap_vp_lag_sw_dump(int unit);
    647 #endif /* BCM_WARM_BOOT_SUPPORT_SW_DUMP */
    648 
    649 extern int bcm_ap_multicast_l3_vp_init(int unit);
    650 extern int bcm_ap_multicast_l3_vp_detach(int unit);
    651 extern int bcm_ap_multicast_l3_vp_encap_get(int unit, bcm_multicast_t group,
    652         bcm_gport_t port, bcm_if_t intf, bcm_if_t *encap_id);
    653 extern int bcm_ap_multicast_l3_vp_next_hop_free(int unit, int intf);
    654 #ifdef BCM_WARM_BOOT_SUPPORT_SW_DUMP
    655 extern void bcm_ap_multicast_l3_vp_sw_dump(int unit);
    656 #endif /* BCM_WARM_BOOT_SUPPORT_SW_DUMP */
    657 
    658 /* ECMP resilient hashing */
    659 extern int bcm_ap_ecmp_rh_init(int unit);
    660 extern void bcm_ap_ecmp_rh_deinit(int unit);
    661 extern int bcm_ap_l3_egress_ecmp_rh_create(int unit,
    662         bcm_l3_egress_ecmp_t *ecmp, int intf_count, bcm_if_t *intf_array,
    663         int op, int count, bcm_if_t *intf);
    664 extern int bcm_ap_l3_egress_ecmp_rh_destroy(int unit, bcm_if_t mpintf);
    665 extern int bcm_ap_l3_egress_ecmp_rh_get(int unit, bcm_l3_egress_ecmp_t *ecmp);
    666 extern int bcm_ap_l3_egress_ecmp_rh_ethertype_set(int unit, uint32 flags,
    667         int ethertype_count, int *ethertype_array);
    668 extern int bcm_ap_l3_egress_ecmp_rh_ethertype_get(int unit, uint32 *flags,
    669         int ethertype_max, int *ethertype_array, int *ethertype_count);
    670 extern int bcm_ap_l3_egress_ecmp_rh_shared_copy(int unit, int old_ecmp_group,
    671         int new_ecmp_group);
    672 #ifdef BCM_WARM_BOOT_SUPPORT
    673 extern int bcm_ap_ecmp_rh_hw_recover(int unit);
    674 #endif /* BCM_WARM_BOOT_SUPPORT */
    675 #ifdef BCM_WARM_BOOT_SUPPORT_SW_DUMP
    676 extern void bcm_ap_ecmp_rh_sw_dump(int unit);
    677 #endif /* BCM_WARM_BOOT_SUPPORT_SW_DUMP */
    678 
    679 /* Proxy */
    680 extern int bcm_ap_proxy_egress_create(int unit, uint32 flags, bcm_proxy_egress_t *proxy_egr, 
    681                           bcm_if_t *proxy_intf_id);
    682 extern int  bcm_ap_proxy_egress_destroy(int unit, bcm_if_t proxy_intf_id);
    683 extern int  bcm_ap_proxy_egress_get(int unit, bcm_if_t proxy_intf_id, bcm_proxy_egress_t *proxy_egr);
    684 extern int _bcm_ap_proxy_nh_add(int unit, int idx, void *buf, int max_paths);
    685 extern int _bcm_ap_proxy_nh_get(int unit, int idx, bcm_proxy_egress_t *proxy_nh_entry);
    686 extern int bcm_ap_proxy_egress_traverse(int unit, bcm_proxy_egress_traverse_cb  cb,
    687                                                         void *user_data);
    688 
    689 #endif /* INCLUDE_L3 */
    690 
    691 extern int bcm_ap_cosq_init(int unit);
    692 
    693 extern int bcm_ap_cosq_detach(int unit, int software_state_only);
    694 
    695 extern int bcm_ap_cosq_config_set(int unit, int numq);
    696 
    697 extern int bcm_ap_cosq_config_get(int unit, int *numq);
    698 
    699 extern int bcm_ap_cosq_mapping_set(int unit, bcm_port_t gport, 
    700                         bcm_cos_t priority, bcm_cos_queue_t cosq);
    701 
    702 extern int bcm_ap_cosq_mapping_get(int unit, bcm_port_t gport,
    703                         bcm_cos_t priority, bcm_cos_queue_t *cosq);
    704 
    705 extern int bcm_ap_cosq_port_sched_set(int unit, bcm_pbmp_t pbm,
    706                            int mode, const int *weights, int delay);
    707 
    708 extern int bcm_ap_cosq_port_sched_get(int unit, bcm_pbmp_t pbm,
    709                            int *mode, int *weights, int *delay);
    710 
    711 extern int bcm_ap_cosq_priority_mapping_get_all(int unit, bcm_gport_t gport,
    712                                      int index, bcm_cosq_priority_mapping_t type,
    713                                      int pri_max, int *pri_array,
    714                                      int *pri_count);
    715 
    716 extern int bcm_ap_cosq_sched_weight_max_get(int unit, int mode, 
    717                                                 int *weight_max);
    718 
    719 extern int bcm_ap_cosq_discard_set(int unit, uint32 flags);
    720 
    721 extern int bcm_ap_cosq_discard_get(int unit, uint32 *flags);
    722 
    723 extern int
    724 bcm_ap_cosq_gport_discard_set(int unit, bcm_gport_t gport,
    725                                bcm_cos_queue_t cosq,
    726                                bcm_cosq_gport_discard_t *discard);
    727 
    728 extern int
    729 bcm_ap_cosq_gport_discard_get(int unit, bcm_gport_t gport,
    730                                bcm_cos_queue_t cosq,
    731                                bcm_cosq_gport_discard_t *discard);
    732 
    733 extern int
    734 _bcm_ap_cosq_pfc_class_resolve(bcm_switch_control_t sctype, int *type,
    735                                int *class);
    736 
    737 extern int
    738 bcm_ap_cosq_port_pfc_op(int unit, bcm_port_t port,
    739                         bcm_switch_control_t sctype, _bcm_cosq_op_t op,
    740                         bcm_gport_t *gport, int gport_count);
    741 
    742 extern int
    743 bcm_ap_cosq_port_pfc_get(int unit, bcm_port_t port,
    744                          bcm_switch_control_t sctype,
    745                          bcm_gport_t *gport, int gport_count,
    746                          int *actual_gport_count);
    747 
    748 extern int
    749 bcm_ap_cosq_gport_add(int unit, bcm_gport_t port, int numq, uint32 flags,
    750                       bcm_gport_t *gport);
    751 
    752 extern int
    753 bcm_ap_cosq_gport_detach(int unit, bcm_gport_t sched_gport,
    754                          bcm_gport_t input_gport, bcm_cos_queue_t cosq);
    755 
    756 extern int
    757 bcm_ap_cosq_discard_port_get(int unit, bcm_port_t port, 
    758                  bcm_cos_queue_t cosq, uint32 color, int *drop_start, 
    759                         int *drop_slope, int *average_time);
    760 
    761 extern int
    762 bcm_ap_cosq_gport_delete(int unit, bcm_gport_t gport);
    763 
    764 extern int
    765 bcm_ap_cosq_gport_get(int unit, bcm_gport_t gport, bcm_gport_t *port,
    766                       int *numq, uint32 *flags);
    767 
    768 extern int
    769 bcm_ap_cosq_gport_traverse(int unit, bcm_cosq_gport_traverse_cb cb,
    770                            void *user_data);
    771 
    772 extern int
    773 bcm_ap_cosq_discard_port_set(int unit, bcm_port_t port, 
    774                             bcm_cos_queue_t cosq,
    775                             uint32 color, int drop_start, int drop_slope,
    776                             int average_time);
    777 
    778 extern int
    779 bcm_ap_cosq_gport_attach(int unit, bcm_gport_t sched_gport,
    780                          bcm_gport_t input_gport, bcm_cos_queue_t cosq);
    781 
    782 extern int
    783 bcm_ap_cosq_gport_attach_get(int unit, bcm_gport_t sched_gport,
    784                              bcm_gport_t *input_gport, bcm_cos_queue_t *cosq);
    785 
    786 extern int
    787 bcm_ap_cosq_gport_child_get(int unit, bcm_gport_t in_gport,
    788                              bcm_cos_queue_t cosq, bcm_gport_t *out_gport);
    789 
    790 extern int
    791 bcm_ap_cosq_port_bandwidth_set(int unit, bcm_port_t port,
    792                                bcm_cos_queue_t cosq,
    793                                uint32 min_quantum, uint32 max_quantum,
    794                                uint32 burst_quantum, uint32 flags);
    795 
    796 extern int
    797 bcm_ap_cosq_port_bandwidth_get(int unit, bcm_port_t port,
    798                                bcm_cos_queue_t cosq,
    799                                uint32 *min_quantum, uint32 *max_quantum,
    800                                uint32 *burst_quantum, uint32 *flags);
    801 
    802 extern int
    803 bcm_ap_cosq_port_pps_set(int unit, bcm_port_t port, bcm_cos_queue_t cosq,
    804                          int pps);
    805 
    806 extern int
    807 bcm_ap_cosq_port_pps_get(int unit, bcm_port_t port, bcm_cos_queue_t cosq,
    808                          int *pps);
    809 
    810 extern int bcm_ap_cosq_port_burst_set(int unit, bcm_port_t port, 
    811                                        bcm_cos_queue_t cosq, int burst);
    812 
    813 extern int
    814 bcm_ap_cosq_stat_set(int unit, bcm_gport_t port, bcm_cos_queue_t cosq,
    815                      bcm_cosq_stat_t stat, uint64 value);
    816 
    817 extern int
    818 bcm_ap_cosq_stat_get(int unit, bcm_port_t port, bcm_cos_queue_t cosq,
    819                      bcm_cosq_stat_t stat, int sync_mode, uint64 *value);
    820 
    821 extern int
    822 bcm_ap_cosq_port_burst_get(int unit, bcm_port_t port, bcm_cos_queue_t cosq,
    823                            int *burst);
    824 
    825 extern int
    826 bcm_ap_cosq_control_set(int unit, bcm_gport_t gport, bcm_cos_queue_t cosq,
    827                         bcm_cosq_control_t type, int arg);
    828 
    829 extern int
    830 bcm_ap_cosq_control_get(int unit, bcm_gport_t gport, bcm_cos_queue_t cosq,
    831                         bcm_cosq_control_t type, int *arg);
    832 
    833 extern int
    834 bcm_ap_cosq_service_pool_set(int unit, bcm_service_pool_id_t id, 
    835                                       bcm_cosq_service_pool_t cosq_service_pool);
    836 
    837 extern int
    838 bcm_ap_cosq_service_pool_get(int unit, bcm_service_pool_id_t id, 
    839                                       bcm_cosq_service_pool_t *cosq_service_pool);
    840 
    841 extern int
    842 bcm_ap_cosq_gport_bandwidth_burst_set(int unit, bcm_gport_t gport,
    843                                       bcm_cos_queue_t cosq,
    844                                       uint32 kbits_burst_min, 
    845                                       uint32 kbits_burst_max);
    846 
    847 extern int
    848 bcm_ap_cosq_gport_bandwidth_burst_get(int unit, bcm_gport_t gport,
    849                                        bcm_cos_queue_t cosq,
    850                                        uint32 *kbits_burst_min,
    851                                        uint32 *kbits_burst_max);
    852 extern int
    853 bcm_ap_cosq_gport_bandwidth_set(int unit, bcm_gport_t gport,
    854                                 bcm_cos_queue_t cosq, uint32 kbits_sec_min,
    855                                 uint32 kbits_sec_max, uint32 flags);
    856 
    857 extern int
    858 bcm_ap_cosq_gport_bandwidth_get(int unit, bcm_gport_t gport,
    859                                 bcm_cos_queue_t cosq, uint32 *kbits_sec_min,
    860                                 uint32 *kbits_sec_max, uint32 *flags);
    861 
    862 extern int bcm_ap_cosq_congestion_queue_set(int unit, bcm_port_t port,
    863                                             bcm_cos_queue_t cosq, int index);
    864 extern int bcm_ap_cosq_congestion_queue_get(int unit, bcm_port_t port,
    865                                             bcm_cos_queue_t cosq, int *index);
    866 extern int bcm_ap_cosq_congestion_quantize_set(int unit, bcm_port_t port,
    867                                                bcm_cos_queue_t cosq,
    868                                                int weight_code, int setpoint);
    869 extern int bcm_ap_cosq_congestion_quantize_get(int unit, bcm_port_t port,
    870                                                bcm_cos_queue_t cosq,
    871                                                int *weight_code,
    872                                                int *setpoint);
    873 extern int bcm_ap_cosq_congestion_sample_int_set(int unit, bcm_port_t port,
    874                                                  bcm_cos_queue_t cosq,
    875                                                  int min, int max);
    876 extern int bcm_ap_cosq_congestion_sample_int_get(int unit, bcm_port_t port,
    877                                                  bcm_cos_queue_t cosq,
    878                                                  int *min, int *max);
    879 extern int bcm_ap_cosq_drop_status_enable_set(int unit, bcm_port_t port,
    880                                               int enable);
    881 extern int _bcm_ap_get_def_qbase(int unit, bcm_port_t inport, int qtype, 
    882                             int *pbase, int *pnumq);
    883 
    884 extern int bcm_ap_cosq_gport_sched_set(int unit, bcm_gport_t gport,
    885                                        bcm_cos_queue_t cosq, int mode,
    886                                        int weight);
    887 extern int bcm_ap_cosq_gport_sched_get(int unit, bcm_gport_t gport,
    888                                        bcm_cos_queue_t cosq, int *mode,
    889                                        int *weight);
    890 extern int
    891 _bcm_ap_cosq_port_resolve(int unit, bcm_gport_t gport, bcm_module_t *modid,
    892                           bcm_port_t *port, bcm_trunk_t *trunk_id, int *id,
    893                           int *qnum);
    894 
    895 extern int
    896 bcm_ap_cosq_gport_mapping_set(int unit, bcm_port_t ing_port,
    897                               bcm_cos_t int_pri, uint32 flags,
    898                               bcm_gport_t gport, bcm_cos_queue_t cosq);
    899 
    900 extern int 
    901 bcm_ap_cosq_gport_congestion_config_set(int unit, bcm_gport_t port, 
    902                                          bcm_cos_queue_t cosq, 
    903                                          bcm_cosq_congestion_info_t *config);
    904 extern int
    905 bcm_ap_cosq_gport_mapping_get(int unit, bcm_port_t ing_port,
    906                               bcm_cos_t int_pri, uint32 flags,
    907                               bcm_gport_t *gport, bcm_cos_queue_t *cosq);
    908 extern int 
    909 bcm_ap_cosq_gport_congestion_config_get(int unit, bcm_gport_t port, 
    910                                          bcm_cos_queue_t cosq, 
    911                                          bcm_cosq_congestion_info_t *config);
    912 
    913 extern int 
    914 bcm_ap_cosq_bst_profile_set(int unit, 
    915                              bcm_gport_t port, 
    916                              bcm_cos_queue_t cosq, 
    917                              bcm_bst_stat_id_t bid,
    918                              bcm_cosq_bst_profile_t *profile);
    919 
    920 extern int 
    921 bcm_ap_cosq_bst_profile_get(int unit, 
    922                              bcm_gport_t port, 
    923                              bcm_cos_queue_t cosq, 
    924                              bcm_bst_stat_id_t bid,
    925                              bcm_cosq_bst_profile_t *profile);
    926 
    927 extern int 
    928 bcm_ap_cosq_bst_stat_get(int unit, 
    929                               bcm_gport_t port, 
    930                               bcm_cos_queue_t cosq, 
    931                               bcm_bst_stat_id_t bid,
    932                               uint32 options,
    933                               uint64 *pvalue);
    934 
    935 extern int 
    936 bcm_ap_cosq_bst_stat_multi_get(int unit,
    937                                 bcm_gport_t port,
    938                                 bcm_cos_queue_t cosq,
    939                                 uint32 options,
    940                                 int max_values,
    941                                 bcm_bst_stat_id_t *id_list,
    942                                 uint64 *pvalues);
    943 extern int 
    944 bcm_ap_cosq_bst_stat_clear(int unit, 
    945                             bcm_gport_t port, 
    946                             bcm_cos_queue_t cosq, 
    947                             bcm_bst_stat_id_t bid);
    948 
    949 extern int 
    950 bcm_ap_cosq_bst_stat_sync(int unit, bcm_bst_stat_id_t bid);
    951 
    952 extern int bcm_ap_cosq_endpoint_create(
    953         int unit, 
    954         bcm_cosq_classifier_t *classifier, 
    955         int *classifier_id);
    956 extern int bcm_ap_cosq_endpoint_destroy(
    957         int unit, 
    958         int classifier_id);
    959 extern int bcm_ap_cosq_endpoint_get(
    960         int unit, 
    961         int classifier_id,
    962         bcm_cosq_classifier_t *classifier);
    963 extern int bcm_ap_cosq_endpoint_map_set(
    964         int unit, 
    965         bcm_port_t port, 
    966         int classifier_id, 
    967         bcm_gport_t queue_group, 
    968         int array_count, 
    969         bcm_cos_t *priority_array, 
    970         bcm_cos_queue_t *cosq_array);
    971 extern int bcm_ap_cosq_endpoint_map_get(
    972         int unit, 
    973         bcm_port_t port, 
    974         int classifier_id, 
    975         bcm_gport_t *queue_group, 
    976         int array_max, 
    977         bcm_cos_t *priority_array, 
    978         bcm_cos_queue_t *cosq_array, 
    979         int *array_count);
    980 extern int bcm_ap_cosq_endpoint_map_clear(
    981         int unit, 
    982         bcm_gport_t port, 
    983         int classifier_id);
    984 
    985 extern int
    986 bcm_ap_cosq_field_classifier_get(
    987     int unit, int classifier_id, bcm_cosq_classifier_t *classifier);
    988 
    989 extern int
    990 bcm_ap_cosq_field_classifier_id_create(
    991     int unit, bcm_cosq_classifier_t *classifier, int *classifier_id);
    992 
    993 extern int
    994 bcm_ap_cosq_field_classifier_id_destroy(
    995     int unit, int classifier_id);
    996 
    997 extern int
    998 bcm_ap_cosq_field_classifier_map_set(
    999     int unit, int classifier_id, int count,
   1000     bcm_cos_t *priority_array, bcm_cos_queue_t *cosq_array);
   1001 
   1002 extern int
   1003 bcm_ap_cosq_field_classifier_map_get(
   1004     int unit, int classifier_id,
   1005     int array_max, bcm_cos_t *priority_array,
   1006     bcm_cos_queue_t *cosq_array, int *array_count);
   1007 
   1008 extern int
   1009 bcm_ap_cosq_field_classifier_map_clear(
   1010     int unit, int classifier_id);
   1011 
   1012 extern int bcm_ap_cosq_sync(int unit);
   1013 extern int bcm_ap_cosq_reinit(int unit);
   1014 
   1015 extern void bcm_ap_cosq_sw_dump(int unit);
   1016 
   1017 extern int bcm_ap_cosq_cpu_cosq_enable_set(
   1018         int unit, 
   1019         bcm_cos_queue_t cosq, 
   1020         int enable);
   1021 
   1022 extern int bcm_ap_cosq_cpu_cosq_enable_get(
   1023         int unit, 
   1024         bcm_cos_queue_t cosq, 
   1025         int *enable);
   1026 
   1027 typedef enum {
   1028     _BCM_AP_COSQ_INDEX_STYLE_BUCKET,
   1029     _BCM_AP_COSQ_INDEX_STYLE_QCN,
   1030     _BCM_AP_COSQ_INDEX_STYLE_WRED,
   1031     _BCM_AP_COSQ_INDEX_STYLE_WRED_PORT,
   1032     _BCM_AP_COSQ_INDEX_STYLE_WRED_POOL,
   1033     _BCM_AP_COSQ_INDEX_STYLE_SCHEDULER,
   1034     _BCM_AP_COSQ_INDEX_STYLE_PERQ_XMT,
   1035     _BCM_AP_COSQ_INDEX_STYLE_UCAST_DROP,
   1036     _BCM_AP_COSQ_INDEX_STYLE_COS,
   1037     _BCM_AP_COSQ_INDEX_STYLE_UCAST_QUEUE,
   1038     _BCM_AP_COSQ_INDEX_STYLE_MCAST_QUEUE,
   1039     _BCM_AP_COSQ_INDEX_STYLE_EXT_UCAST_QUEUE,
   1040     _BCM_AP_COSQ_INDEX_STYLE_EGR_POOL,
   1041     _BCM_AP_COSQ_INDEX_STYLE_EGR_PERQ_UCAST,
   1042     _BCM_AP_COSQ_INDEX_STYLE_EGR_PERQ_MCAST,
   1043     _BCM_AP_COSQ_INDEX_STYLE_UC_EGR_POOL,
   1044     _BCM_AP_COSQ_INDEX_STYLE_UCAST_QUEUE_GROUP,
   1045     _BCM_AP_COSQ_INDEX_STYLE_COUNT
   1046 } _bcm_ap_cosq_index_style_t;
   1047 
   1048 extern int
   1049 _bcm_ap_cosq_index_resolve(int unit, bcm_port_t port, bcm_cos_queue_t cosq, 
   1050                            _bcm_ap_cosq_index_style_t style,                 
   1051                            bcm_port_t *local_port, int *index, int *count);
   1052 
   1053 /* Flexible hashing support routines */
   1054 extern int bcm_ap_switch_hash_entry_create( 
   1055                                 int unit, 
   1056                                 bcm_field_group_t group, 
   1057                                 bcm_hash_entry_t *entry_id);
   1058 extern int bcm_ap_switch_hash_entry_create_qset( 
   1059                                 int unit, 
   1060                                 bcm_field_qset_t qset, 
   1061                                 bcm_hash_entry_t *entry_id);
   1062 extern int bcm_ap_switch_hash_qualify_data (
   1063                                 int unit, 
   1064                                 bcm_hash_entry_t entry_id,
   1065                                 int qual_id, 
   1066                                 uint32 data, 
   1067                                 uint32 mask);
   1068 extern int bcm_ap_switch_hash_entry_remove (
   1069                                 int unit, 
   1070                                 bcm_hash_entry_t entry_id);
   1071 extern int bcm_ap_switch_hash_entry_reinstall (
   1072                                 int unit, 
   1073                                 bcm_hash_entry_t entry_id, 
   1074                                 uint32 offset, 
   1075                                 uint32 mask);
   1076 extern int bcm_ap_switch_hash_entry_install (
   1077                                 int unit, 
   1078                                 bcm_hash_entry_t entry_id, 
   1079                                 uint32 offset, 
   1080                                 uint32 mask);
   1081 extern int bcm_ap_switch_hash_entry_destroy (
   1082                                 int unit, 
   1083                                 bcm_hash_entry_t entry_id);
   1084 extern int bcm_ap_switch_hash_entry_detach(int unit);
   1085 extern int bcm_ap_switch_hash_entry_init (int unit);
   1086 
   1087 extern int bcm_ap_ing_vp_vlan_membership_add(int unit, 
   1088                       int vp, bcm_vlan_t vlan, uint32 flags);
   1089 extern int bcm_ap_egr_vp_vlan_membership_add(int unit, 
   1090                              int vp, bcm_vlan_t vlan, uint32 flags);
   1091 extern int bcm_ap_ing_vp_vlan_membership_delete(int unit,
   1092                              int vp, bcm_vlan_t vlan);
   1093 extern int bcm_ap_egr_vp_vlan_membership_delete(int unit,
   1094                              int vp, bcm_vlan_t vlan);
   1095 extern int bcm_ap_ing_vp_vlan_membership_get(int unit, 
   1096               int vp, bcm_vlan_t vlan, uint32 *flags);
   1097 extern int bcm_ap_egr_vp_vlan_membership_get(int unit, 
   1098               int vp, bcm_vlan_t vlan, uint32 *flags);
   1099 extern int bcm_ap_ing_vp_vlan_membership_get_all(int unit, bcm_vlan_t vlan,
   1100         SHR_BITDCL *vp_bitmap, int arr_size, int *flags_arr);
   1101 extern int bcm_ap_egr_vp_vlan_membership_get_all(int unit, bcm_vlan_t vlan,
   1102         SHR_BITDCL *vp_bitmap, int arr_size, int *flags_arr);
   1103 extern int bcm_ap_ing_vp_vlan_membership_delete_all(int unit, bcm_vlan_t vlan);
   1104 extern int bcm_ap_egr_vp_vlan_membership_delete_all(int unit, bcm_vlan_t vlan);
   1105 
   1106 /* Higig resilient hashing */
   1107 extern int bcm_ap_hg_rh_init(int unit);
   1108 extern void bcm_ap_hg_rh_deinit(int unit);
   1109 extern int bcm_ap_hg_rh_dynamic_size_encode(int dynamic_size,
   1110         int *encoded_value);
   1111 extern int bcm_ap_hg_rh_set(int unit, int hgtid,
   1112         _esw_trunk_add_info_t *add_info);
   1113 extern int bcm_ap_hg_rh_add(int unit, int hgtid,
   1114         _esw_trunk_add_info_t *add_info, bcm_trunk_member_t *new_member);
   1115 extern int bcm_ap_hg_rh_delete(int unit, int hgtid,
   1116         _esw_trunk_add_info_t *add_info, bcm_trunk_member_t *leaving_member);
   1117 extern int bcm_ap_hg_rh_free_resource(int unit, int hgtid);
   1118 extern int bcm_ap_hg_rh_status_get(int unit, int *rh_status);
   1119 extern int bcm_ap_hg_rh_dynamic_size_set(int unit, int hgtid, int dynamic_size);
   1120 extern int bcm_ap_hg_rh_ethertype_set(int unit, uint32 flags,
   1121         int ethertype_count, int *ethertype_array);
   1122 extern int bcm_ap_hg_rh_ethertype_get(int unit, uint32 *flags,
   1123         int ethertype_max, int *ethertype_array, int *ethertype_count);
   1124 #ifdef BCM_WARM_BOOT_SUPPORT
   1125 extern int bcm_ap_hg_rh_recover(int unit, int hgtid,
   1126         trunk_private_t *trunk_info);
   1127 #endif /* BCM_WARM_BOOT_SUPPORT */
   1128 #ifdef BCM_WARM_BOOT_SUPPORT_SW_DUMP
   1129 extern void bcm_ap_hg_rh_sw_dump(int unit);
   1130 #endif /* BCM_WARM_BOOT_SUPPORT_SW_DUMP */
   1131 
   1132 extern int bcm_ap_trunk_init(int unit);
   1133 
   1134 /* LAG resilient hashing */
   1135 extern int bcm_ap_lag_rh_init(int unit);
   1136 extern void bcm_ap_lag_rh_deinit(int unit);
   1137 extern int bcm_ap_lag_rh_dynamic_size_encode(int dynamic_size,
   1138         int *encoded_value);
   1139 extern int bcm_ap_lag_rh_set(int unit, int tid,
   1140         _esw_trunk_add_info_t *add_info, int num_rh_ports, int *mod_array,
   1141         int *port_array);
   1142 extern int bcm_ap_lag_rh_add(int unit, int tid,
   1143         _esw_trunk_add_info_t *add_info, int num_rh_ports, int *mod_array,
   1144         int *port_array, bcm_trunk_member_t *new_member);
   1145 extern int bcm_ap_lag_rh_delete(int unit, int tid,
   1146         _esw_trunk_add_info_t *add_info, int num_rh_ports, int *mod_array,
   1147         int *port_array, bcm_trunk_member_t *leaving_member);
   1148 extern int bcm_ap_lag_rh_free_resource(int unit, int tid);
   1149 extern int bcm_ap_lag_rh_dynamic_size_set(int unit, int tid, int dynamic_size);
   1150 extern int bcm_ap_lag_rh_ethertype_set(int unit, uint32 flags,
   1151         int ethertype_count, int *ethertype_array);
   1152 extern int bcm_ap_lag_rh_ethertype_get(int unit, uint32 *flags,
   1153         int ethertype_max, int *ethertype_array, int *ethertype_count);
   1154 #ifdef BCM_WARM_BOOT_SUPPORT
   1155 extern int bcm_ap_lag_rh_recover(int unit, int tid,
   1156         trunk_private_t *trunk_info);
   1157 #endif /* BCM_WARM_BOOT_SUPPORT */
   1158 #ifdef BCM_WARM_BOOT_SUPPORT_SW_DUMP
   1159 extern void bcm_ap_lag_rh_sw_dump(int unit);
   1160 #endif /* BCM_WARM_BOOT_SUPPORT_SW_DUMP */
   1161 
   1162 /* FCOE */
   1163 extern int bcm_ap_fcoe_init(int unit);
   1164 extern int bcm_ap_fcoe_cleanup(int unit);
   1165 extern int bcm_ap_fcoe_zone_add(int unit, bcm_fcoe_zone_entry_t *zone);
   1166 extern int bcm_ap_fcoe_zone_delete(int unit,
   1167                                     bcm_fcoe_zone_entry_t *zone);
   1168 extern int bcm_ap_fcoe_zone_delete_all (int unit);
   1169 extern int bcm_ap_fcoe_zone_delete_by_vsan (int unit,
   1170                                              bcm_fcoe_zone_entry_t *zone);
   1171 extern int bcm_ap_fcoe_zone_delete_by_sid (int unit,
   1172                                             bcm_fcoe_zone_entry_t *zone);
   1173 extern int bcm_ap_fcoe_zone_delete_by_did (int unit,
   1174                                             bcm_fcoe_zone_entry_t *zone);
   1175 extern int bcm_ap_fcoe_zone_get (int unit, bcm_fcoe_zone_entry_t *zone);
   1176 extern int bcm_ap_fcoe_route_add(int unit, bcm_fcoe_route_t *route);
   1177 extern int bcm_ap_fcoe_route_delete(int unit, bcm_fcoe_route_t *route);
   1178 extern int bcm_ap_fcoe_route_delete_by_prefix(int unit,
   1179                                                bcm_fcoe_route_t *route);
   1180 extern int bcm_ap_fcoe_route_delete_by_interface(int unit,
   1181                                                   bcm_fcoe_route_t *route);
   1182 extern int bcm_ap_fcoe_route_delete_all(int unit);
   1183 extern int bcm_ap_fcoe_route_find(int unit, bcm_fcoe_route_t *route);
   1184 extern int bcm_ap_fcoe_vsan_create(int unit, uint32 options, 
   1185                                     bcm_fcoe_vsan_t *vsan, 
   1186                                     bcm_fcoe_vsan_id_t *vsan_id);
   1187 extern int bcm_ap_fcoe_vsan_destroy(int unit,  bcm_fcoe_vsan_id_t vsan_id);
   1188 extern int bcm_ap_fcoe_vsan_destroy_all(int unit);
   1189 extern int bcm_ap_fcoe_control_vsan_get(int unit,  
   1190                                          uint32 vsan_id, 
   1191                                          bcm_fcoe_vsan_control_t type, 
   1192                                          int *arg);
   1193 extern int bcm_ap_fcoe_control_vsan_set(int unit, 
   1194                                          uint32 vsan_id, 
   1195                                          bcm_fcoe_vsan_control_t type, 
   1196                                          int arg);
   1197 extern int bcm_ap_fcoe_vsan_get(int unit, uint32 vsan_id, 
   1198                                  bcm_fcoe_vsan_t *vsan);
   1199 extern int bcm_ap_fcoe_vsan_set(int unit, uint32 vsan_id, 
   1200                                  bcm_fcoe_vsan_t *vsan);
   1201 extern int bcm_ap_fcoe_vsan_stat_attach(int                 unit,
   1202                                          bcm_fcoe_vsan_id_t  vsan,
   1203                                          uint32              stat_counter_id);
   1204 extern int bcm_ap_fcoe_vsan_stat_detach(int unit, bcm_fcoe_vsan_id_t  vsan);
   1205 extern int bcm_ap_fcoe_vsan_stat_counter_get(
   1206                                       int                  unit, 
   1207                                       int                  sync_mode, 
   1208                                       bcm_fcoe_vsan_id_t   vsan,
   1209                                       bcm_fcoe_vsan_stat_t stat, 
   1210                                       uint32               num_entries, 
   1211                                       uint32               *counter_indexes, 
   1212                                       bcm_stat_value_t     *counter_values);
   1213 extern int bcm_ap_fcoe_vsan_stat_counter_set(
   1214                                       int                  unit, 
   1215                                       bcm_fcoe_vsan_id_t   vsan,
   1216                                       bcm_fcoe_vsan_stat_t stat, 
   1217                                       uint32               num_entries, 
   1218                                       uint32               *counter_indexes, 
   1219                                       bcm_stat_value_t     *counter_values);
   1220 extern int bcm_ap_fcoe_vsan_stat_id_get(int                  unit,
   1221                                          bcm_fcoe_vsan_id_t   vsan,
   1222                                          bcm_fcoe_vsan_stat_t stat, 
   1223                                          uint32               *stat_counter_id);
   1224 extern int bcm_ap_fcoe_route_stat_attach(int                 unit,
   1225                                           bcm_fcoe_route_t    *route,
   1226                                           uint32              stat_counter_id);
   1227 extern int bcm_ap_fcoe_route_stat_detach(int unit, bcm_fcoe_route_t *route);
   1228 extern int bcm_ap_fcoe_route_stat_counter_get(
   1229                                        int                   unit, 
   1230                                        int                   sync_mode, 
   1231                                        bcm_fcoe_route_t      *route,
   1232                                        bcm_fcoe_route_stat_t stat, 
   1233                                        uint32                num_entries, 
   1234                                        uint32                *counter_indexes, 
   1235                                        bcm_stat_value_t      *counter_values);
   1236 extern int bcm_ap_fcoe_route_stat_counter_set (
   1237                                         int                   unit, 
   1238                                         bcm_fcoe_route_t      *route,
   1239                                         bcm_fcoe_route_stat_t stat, 
   1240                                         uint32                num_entries, 
   1241                                         uint32                *counter_indexes, 
   1242                                         bcm_stat_value_t      *counter_values);
   1243 extern int bcm_ap_fcoe_route_stat_id_get(
   1244                                         int                   unit,
   1245                                         bcm_fcoe_route_t      *route,
   1246                                         bcm_fcoe_route_stat_t stat, 
   1247                                         uint32                *stat_counter_id);
   1248 int bcm_ap_fcoe_intf_config_set(int unit, uint32 flags, bcm_if_t intf, 
   1249                                  bcm_fcoe_intf_config_t *cfg);
   1250 
   1251 int bcm_ap_fcoe_intf_config_get(int unit, uint32 flags, bcm_if_t intf, 
   1252                                  bcm_fcoe_intf_config_t *cfg);
   1253 extern int bcm_ap_fcoe_zone_traverse(int unit,
   1254                                       uint32 flags,
   1255                                       bcm_fcoe_zone_traverse_cb trav_fn,
   1256                                       void *user_data);
   1257 extern int bcm_ap_fcoe_vsan_traverse(int unit,
   1258                                       uint32 flags,
   1259                                       bcm_fcoe_vsan_traverse_cb trav_fn,
   1260                                       void *user_data);
   1261 extern int bcm_ap_fcoe_route_traverse(int unit,
   1262                                        uint32 flags,
   1263                                        bcm_fcoe_route_traverse_cb trav_fn,
   1264                                        void *user_data);
   1265 
   1266 /* QOS */
   1267 #define _BCM_QOS_MAP_TYPE_ING_VFT_PRI_MAP    6
   1268 #define _BCM_QOS_MAP_TYPE_EGR_VFT_PRI_MAP    7
   1269 #define _BCM_QOS_MAP_TYPE_EGR_VSAN_PRI_MAP   8
   1270 #define _BCM_QOS_MAP_TYPE_ING_L2_VLAN_ETAG_MAP   9
   1271 #define _BCM_QOS_MAP_TYPE_EGR_L2_VLAN_ETAG_MAP   10
   1272 #define _BCM_QOS_VFT_MAP_SHIFT               11
   1273 
   1274 #define QOS_MAP_IS_FCOE(map_id)                                                \
   1275   (  ((map_id >> _BCM_QOS_VFT_MAP_SHIFT) == _BCM_QOS_MAP_TYPE_ING_VFT_PRI_MAP) \
   1276   || ((map_id >> _BCM_QOS_VFT_MAP_SHIFT) == _BCM_QOS_MAP_TYPE_EGR_VFT_PRI_MAP) \
   1277   || ((map_id >> _BCM_QOS_VFT_MAP_SHIFT) == _BCM_QOS_MAP_TYPE_EGR_VSAN_PRI_MAP)\
   1278   )
   1279 
   1280 #define QOS_MAP_IS_L2_VLAN_ETAG(map_id)                                        \
   1281   (  ((map_id >> _BCM_QOS_VFT_MAP_SHIFT) == _BCM_QOS_MAP_TYPE_ING_L2_VLAN_ETAG_MAP) \
   1282   || ((map_id >> _BCM_QOS_VFT_MAP_SHIFT) == _BCM_QOS_MAP_TYPE_EGR_L2_VLAN_ETAG_MAP) \
   1283   )
   1284 
   1285 #define QOS_FLAGS_ARE_FCOE(flags) \
   1286   ( (flags & BCM_QOS_MAP_VFT) || (flags & BCM_QOS_MAP_VSAN) )
   1287 
   1288 extern int bcm_ap_qos_init(int unit);
   1289 extern int bcm_ap_qos_detach(int unit);
   1290 extern int bcm_ap_qos_map_create(int unit, uint32 flags, int *map_id);
   1291 extern int bcm_ap_qos_map_destroy(int unit, int map_id);
   1292 extern int bcm_ap_qos_map_add(int unit, uint32 flags, bcm_qos_map_t *map,
   1293                                int map_id);
   1294 extern int bcm_ap_qos_map_delete(int unit, uint32 flags, bcm_qos_map_t *map,
   1295                                   int map_id);
   1296 extern int bcm_ap_qos_port_map_set(int unit, bcm_gport_t port, int ing_map,
   1297                                     int egr_map);
   1298 extern int bcm_ap_qos_map_multi_get(int unit, uint32 flags,
   1299                                       int map_id, int array_size, 
   1300                                       bcm_qos_map_t *array, int *array_count);
   1301 extern int _bcm_ap_egr_port_set(int unit, bcm_port_t port, 
   1302                                  soc_field_t field, int value);
   1303 extern int bcm_ap_fcoe_fc_header_type_set(int unit, uint32 flags, uint8 r_ctl, 
   1304                                            bcm_fcoe_fc_header_type_t hdr_type);
   1305 extern int bcm_ap_fcoe_fc_header_type_get(int unit, uint32 flags, uint8 r_ctl, 
   1306                                            bcm_fcoe_fc_header_type_t *hdr_type);
   1307 
   1308 extern int bcm_ap_fcoe_vsan_translate_action_add(
   1309                                     int unit, 
   1310                                     bcm_fcoe_vsan_translate_key_config_t *key, 
   1311                                     bcm_fcoe_vsan_action_set_t *action);
   1312 extern int bcm_ap_fcoe_vsan_translate_action_delete(
   1313                                     int unit, 
   1314                                     bcm_fcoe_vsan_translate_key_config_t *key);
   1315 extern uint32 _bcm_ap_fcoe_ing_vft_pri_action_encode(
   1316                                     bcm_fcoe_vsan_action_t action);
   1317 extern uint32 _bcm_ap_fcoe_egr_vft_pri_action_encode(
   1318                                     bcm_fcoe_vsan_action_t action);
   1319 extern uint32 _bcm_ap_fcoe_egr_vft_tag_action_encode(
   1320                                     bcm_fcoe_vsan_action_t action);
   1321 extern int bcm_ap_port_dscp_map_set(int unit, bcm_port_t port, int srccp,
   1322                             int mapcp, int prio, int cng);
   1323 
   1324 /* L2 */
   1325 extern int _bcm_ap_l2_hit_retrieve(int unit, l2x_entry_t *l2x_entry,
   1326                                  int l2_hw_index);
   1327 
   1328 extern int
   1329 _bcm_ap_port_enqueue_set(int unit, bcm_port_t gport,
   1330                                     int enable);
   1331 
   1332 extern int
   1333 _bcm_ap_cosq_port_queue_state_check(int unit, bcm_port_t gport);
   1334 
   1335 extern int
   1336 _bcm_ap_port_enqueue_get(int unit, bcm_port_t gport,
   1337                                             int *enable);
   1338 extern int
   1339 _bcm_ap_cosq_safc_class_mapping_set(int unit,
   1340                     bcm_gport_t port,
   1341                     int array_count,
   1342                     bcm_cosq_safc_class_mapping_t *mapping_array);
   1343 extern  int
   1344 _bcm_ap_cosq_safc_class_mapping_get(int unit, bcm_gport_t port,
   1345                                      int array_max,
   1346                                      bcm_cosq_safc_class_mapping_t *mapping_array,
   1347                                      int *array_count);
   1348 
   1349 extern int
   1350 _bcm_ap_cosq_pfc_class_mapping_set(int unit,
   1351                     bcm_gport_t port,
   1352                     int array_count,
   1353                     bcm_cosq_pfc_class_mapping_t *mapping_array);
   1354 extern int 
   1355 _bcm_ap_cosq_pfc_class_mapping_get(int unit,
   1356       bcm_gport_t port,
   1357       int array_max,
   1358       int *array_count,
   1359       bcm_cosq_pfc_class_mapping_t *mapping_array);
   1360 
   1361 extern int
   1362 bcm_ap_cosq_default_llfc_profile_attach(int unit, bcm_gport_t port);
   1363 
   1364 extern int
   1365 bcm_ap_cosq_llfc_profile_detach(int unit, bcm_gport_t port);
   1366 
   1367 /* Subport functions */
   1368 extern int bcm_apache_subport_coe_init(int unit);
   1369 
   1370 /* Service Queuing functions */
   1371 extern int
   1372 bcm_ap_cosq_service_classifier_id_create(int unit,
   1373     bcm_cosq_classifier_t *classifier, int *classifier_id);
   1374 
   1375 extern int
   1376 bcm_ap_cosq_service_classifier_id_destroy(int unit,
   1377     int classifier_id);
   1378 
   1379 extern int
   1380 bcm_ap_cosq_service_classifier_get(int unit,
   1381     int classifier_id, bcm_cosq_classifier_t *classifier);
   1382 
   1383 extern int
   1384 bcm_ap_cosq_service_map_set(int unit,
   1385     bcm_port_t port, int classifier_id, bcm_gport_t queue_group,
   1386     int array_count, bcm_cos_t *priority_array, bcm_cos_queue_t *cosq_array);
   1387 
   1388 extern int
   1389 bcm_ap_cosq_service_map_get(int unit,
   1390     bcm_port_t port, int classifier_id, bcm_gport_t *queue_group,
   1391     int array_max, bcm_cos_t *priority_array, bcm_cos_queue_t *cosq_array,
   1392     int *array_count);
   1393 
   1394 extern int
   1395 bcm_ap_cosq_service_map_clear( int unit,
   1396     bcm_gport_t port, int classifier_id);
   1397 extern int bcm_ap_cosq_subport_flow_control_set(int unit, bcm_gport_t subport,
   1398                                                    bcm_gport_t sched_port);
   1399 extern int bcm_ap_cosq_subport_flow_control_get(int unit, bcm_gport_t subport,
   1400                                                   bcm_gport_t * sched_port);
   1401 extern int
   1402 _bcm_ap_cosq_localport_resolve(int unit, bcm_gport_t gport,
   1403                                bcm_port_t *local_port);
   1404 extern int
   1405 _bcm_ap_cosq_index_resolve(int unit, bcm_port_t port, bcm_cos_queue_t cosq, 
   1406                            _bcm_ap_cosq_index_style_t style,      
   1407                            bcm_port_t *local_port, int *index, int *count);
   1408 
   1409 /* OAM functions */
   1410 extern int
   1411 _bcm_apache_oam_drop_control_fp_encode(bcm_field_oam_drop_mep_type_t mep_type,
   1412                                        uint8 *data,
   1413                                        uint8 *mask);
   1414 
   1415 /* OOB FC Tx side global configuration API */
   1416 extern int bcm_ap_oob_fc_tx_config_set(
   1417     int unit,
   1418     bcm_oob_fc_tx_config_t *config);
   1419 
   1420 /* OOB FC Tx side global configuration get API */
   1421 extern int bcm_ap_oob_fc_tx_config_get(
   1422     int unit,
   1423     bcm_oob_fc_tx_config_t *config);
   1424 
   1425 extern int
   1426 _bcm_ap_oob_fc_tx_port_control_set(int unit, bcm_port_t port,
   1427                                    int status, int dir);
   1428 extern int
   1429 _bcm_ap_oob_fc_tx_port_control_get(int unit, bcm_port_t port,
   1430                                    int *status, int dir);
   1431 
   1432 /* OOB FC Tx side global info get API */
   1433 extern int bcm_ap_oob_fc_tx_info_get(
   1434     int unit,
   1435     bcm_oob_fc_tx_info_t *info);
   1436 
   1437 /*
   1438  * OOB FC Rx Interface side Traffic Class to Priority Mapping Multi Set
   1439  * API
   1440  */
   1441 extern int bcm_ap_oob_fc_rx_port_tc_mapping_multi_set(
   1442     int unit,
   1443     bcm_oob_fc_rx_intf_id_t intf_id,
   1444     bcm_gport_t gport,
   1445     int array_count,
   1446     uint32 *tc,
   1447     uint32 *pri_bmp);
   1448 
   1449 /*
   1450  * OOB FC Rx Interface side Traffic Class to Priority Mapping Multi Get
   1451  * API
   1452  */
   1453 extern int bcm_ap_oob_fc_rx_port_tc_mapping_multi_get(
   1454     int unit,
   1455     bcm_oob_fc_rx_intf_id_t intf_id,
   1456     bcm_gport_t gport,
   1457     int array_max,
   1458     uint32 *tc,
   1459     uint32 *pri_bmp,
   1460     int *array_count);
   1461 
   1462 /* OOB FC Rx Interface side Traffic Class to Priority Mapping set API */
   1463 extern int bcm_ap_oob_fc_rx_port_tc_mapping_set(
   1464     int unit,
   1465     bcm_oob_fc_rx_intf_id_t intf_id,
   1466     bcm_gport_t gport,
   1467     uint32 tc,
   1468     uint32 pri_bmp);
   1469 
   1470 /* OOB FC Rx Interface side Traffic Class to Priority Mapping get API */
   1471 extern int bcm_ap_oob_fc_rx_port_tc_mapping_get(
   1472     int unit,
   1473     bcm_oob_fc_rx_intf_id_t intf_id,
   1474     bcm_gport_t gport,
   1475     uint32 tc,
   1476     uint32 *pri_bmp);
   1477 
   1478 /* OOB FC Rx Interface side Configuration set API */
   1479 extern int bcm_ap_oob_fc_rx_config_set(
   1480     int unit,
   1481     bcm_oob_fc_rx_intf_id_t intf_id,
   1482     bcm_oob_fc_rx_config_t *config,
   1483     int array_count,
   1484     bcm_gport_t *gport_array);
   1485 
   1486 /* OOB FC Rx Interface side Configuration get API */
   1487 extern int bcm_ap_oob_fc_rx_config_get(
   1488     int unit,
   1489     bcm_oob_fc_rx_intf_id_t intf_id,
   1490     bcm_oob_fc_rx_config_t *config,
   1491     int array_max,
   1492     bcm_gport_t *gport_array,
   1493     int *array_count);
   1494 
   1495 /* OOB FC Rx Interface side Channel offset value for a port */
   1496 extern int bcm_ap_oob_fc_rx_port_offset_get(
   1497     int unit,
   1498     bcm_oob_fc_rx_intf_id_t intf_id,
   1499     bcm_gport_t gport,
   1500     uint32 *offset);
   1501 
   1502 extern int
   1503 bcmi_apache_port_fn_drv_init(int unit);
   1504 
   1505 extern int
   1506 _bcm_apache_port_mac_get(int unit, bcm_port_t port, int oui, uint32* mac);
   1507 
   1508 extern int
   1509 _bcm_apache_port_mac_set(int unit, bcm_port_t port, int oui, uint32 mac);
   1510 
   1511 /* tag/pri actions for ING_VLAN_TAG_ACTION_PROFILE table */
   1512 #define _BCM_AP_ING_TAG_ACTION_NONE              0 /* do not modify */
   1513 #define _BCM_AP_ING_TAG_CFI_ACTION_NONE          0 /* do not modify */
   1514 #define _BCM_AP_ING_TAG_PRI_ACTION_NONE          0 /* do not modify */
   1515 #define _BCM_AP_EGR_TAG_ACTION_NONE              0 /* do not modify */
   1516 #define _BCM_AP_EGR_TAG_CFI_ACTION_NONE          0 /* do not modify */
   1517 #define _BCM_AP_EGR_TAG_PRI_ACTION_NONE          0 /* do not modify */
   1518 
   1519 /* actions for ING VFT PRI (ING_VLAN_TAG_ACTION_PROFILE) */
   1520 #define _BCM_AP_ING_VFT_PRI_ACTION_NONE          0
   1521 #define _BCM_AP_ING_VFT_PRI_ACTION_USE_INNER_PRI 1
   1522 #define _BCM_AP_ING_VFT_PRI_ACTION_USE_OUTER_PRI 2
   1523 #define _BCM_AP_ING_VFT_PRI_ACTION_REPLACE       3  /* use VLAN_XLATE.XLATE::
   1524                                                         FCOE_VSAN_PRI */
   1525 
   1526 /* actions for EGR VFT PRI (EGR_VLAN_TAG_ACTION_PROFILE) */
   1527 #define _BCM_AP_EGR_VFT_PRI_ACTION_NONE              0
   1528 #define _BCM_AP_EGR_VFT_PRI_ACTION_USE_INTERNAL_IPRI 1
   1529 #define _BCM_AP_EGR_VFT_PRI_ACTION_USE_INTERNAL_OPRI 2
   1530 #define _BCM_AP_EGR_VFT_PRI_ACTION_REPLACE           3  /* use EVXLT.XLATE::
   1531                                                             FCOE_VSAN_PRI */
   1532 
   1533 /* actions for EGR VFT Tag (EGR_VLAN_TAG_ACTION_PROFILE) */
   1534 #define _BCM_AP_EGR_VFT_TAG_ACTION_NONE              0
   1535 #define _BCM_AP_EGR_VFT_TAG_ACTION_USE_INTERNAL_IVID 1
   1536 #define _BCM_AP_EGR_VFT_TAG_ACTION_USE_INTERNAL_OVID 2
   1537 #define _BCM_AP_EGR_VFT_TAG_ACTION_DELETE            3
   1538 #define _BCM_AP_EGR_VFT_TAG_ACTION_USE_INTERNAL_VSAN 4
   1539 #define _BCM_AP_EGR_VFT_TAG_ACTION_REPLACE           5  /* use EVXLT.XLATE::
   1540                                                             FCOE_VSAN_ID */
   1541 
   1542 #ifdef BCM_WARM_BOOT_SUPPORT
   1543 extern int _bcm_ap_fcoe_sync(int unit);
   1544 extern int _bcm_ap_fcoe_reinit(int unit);
   1545 #endif /* BCM_WARM_BOOT_SUPPORT */
   1546 
   1547 extern int
   1548 bcm_apache_dump_port_lls_sw( int unit, int port);
   1549 
   1550 extern int
   1551 _soc_apache_s1_scheduler_index(int unit, int port, int level, int hw_index);
   1552 
   1553 /*
   1554  * Port Functions
   1555  */
   1556 extern int
   1557 bcmi_apache_port_fn_drv_init(int unit);
   1558 extern int
   1559 bcmi_apache_port_lanes_get(int unit, bcm_port_t port, int *lanes);
   1560 extern int
   1561 bcmi_apache_port_lanes_set(int unit, bcm_port_t port, int lanes);
   1562 
   1563 
   1564 /*
   1565  * OBM Classifier functions.
   1566  */
   1567 
   1568 extern int
   1569 bcm_apache_switch_obm_classifier_mapping_multi_set(
   1570     int unit,
   1571     bcm_gport_t gport,
   1572     bcm_switch_obm_classifier_type_t switch_obm_classifier_type,
   1573     int array_count,
   1574     bcm_switch_obm_classifier_t *switch_obm_classifier);
   1575 
   1576 extern int
   1577 bcm_apache_switch_obm_classifier_mapping_multi_get(
   1578     int unit,
   1579     bcm_gport_t gport,
   1580     bcm_switch_obm_classifier_type_t switch_obm_classifier_type,
   1581     int array_max,
   1582     bcm_switch_obm_classifier_t *switch_obm_classifier,
   1583     int *array_count);
   1584 
   1585 extern int
   1586 bcm_apache_obm_classifier_port_control_set(
   1587     int unit,
   1588     bcm_port_t port,
   1589     bcm_port_control_t type,
   1590     int value);
   1591 
   1592 extern int
   1593 bcm_apache_obm_classifier_port_control_get(
   1594     int unit,
   1595     bcm_port_t port,
   1596     bcm_port_control_t type,
   1597     int *value);
   1598 
   1599 #endif /* BCM_APACHE_SUPPORT  */
   1600 
   1601 #endif /* !_BCM_INT_APACHE_H_ */