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

alloc_mngr.h (94314B)


      1 /*
      2  * 
      3  * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file.
      4  * 
      5  * Copyright 2007-2020 Broadcom Inc. All rights reserved.
      6  *
      7  * File:        alloc_mngr.h
      8  * Purpose:     Resource allocation manager for SOC_SAND chips.
      9  */
     10 
     11 #ifndef  INCLUDE_ALLOC_MNGR_H
     12 #define  INCLUDE_ALLOC_MNGR_H
     13 
     14 #include <soc/dpp/PPD/ppd_api_general.h>
     15 #include <soc/dpp/TMC/tmc_api_end2end_scheduler.h>
     16 #include <soc/dpp/TMC/tmc_api_tdm.h>
     17 #include <soc/dpp/TMC/tmc_api_cnm.h>
     18 #include <soc/dpp/PPD/ppd_api_eg_encap.h>
     19 #include <soc/dpp/PPD/ppd_api_oam.h>
     20 #include <soc/dpp/PPD/ppd_api_vsi.h>
     21 #include <soc/dpp/PPD/ppd_api_ptp.h>
     22 #include <soc/dpp/PPC/ppc_api_mymac.h>
     23 #include <soc/dpp/drv.h>
     24 #include <soc/dpp/QAX/QAX_PP/qax_pp_eg_encap_access.h>
     25 #include <bcm_int/dpp/alloc_mngr_shr.h>
     26 #include <bcm_int/dpp/alloc_mngr_lif.h>
     27 #include <bcm_int/dpp/cosq.h>
     28 #include <bcm_int/dpp/utils.h>
     29 #include <bcm_int/dpp/port.h>
     30 #include <bcm_int/dpp/l2.h>
     31 #include <bcm_int/dpp/l3.h>
     32 #include <bcm_int/dpp/vlan.h>
     33 #include <bcm_int/dpp/rx.h>
     34 #include <bcm/rx.h>
     35 #include <bcm/l2.h>
     36 #include <shared/shr_template.h>
     37 #include <shared/swstate/sw_state_resmgr.h>
     38 
     39 #define _BCM_LAST_USER_DEFINE (SOC_PPC_TRAP_CODE_USER_DEFINED_LAST)
     40 
     41 #define BCM_DPP_AM_TEMPLATE_FLAG_CHECK      (1)
     42 
     43 #define BCM_DPP_AM_METER_GROUP_ANY      (2)
     44 #define BCM_DPP_AM_METER_CORE_ANY		(SOC_DPP_CONFIG(unit)->meter.nof_meter_cores)
     45 
     46 
     47 
     48 /* LLVP profiles. */
     49 #define _DPP_AM_TEMPLATE_TPID_PROFILE_LOW_ID (0)
     50 #define _DPP_AM_TEMPLATE_TPID_PROFILE_COUNT(unit) (SOC_DPP_DEFS_GET(unit, llvp_profiles_count))
     51 #define _DPP_AM_TEMPLATE_TPID_PROFILE_MAX_ENTITIES(unit) (_BCM_PETRA_NOF_LOCAL_PORTS(unit))
     52 #define _DPP_AM_TEMPLATE_TPID_PROFILE_SIZE   (sizeof(uint32))
     53 /* TPID profile Encoding : AC-Key-Map-Type[15:14] , PORT-DTAG-MODE[13:12] , Tag-Type[11:8] , Accept-mode[7:0] */
     54 #define _DPP_AM_TEMPLATE_PORT_ACC_MODE_SHIFT   (0)
     55 #define _DPP_AM_TEMPLATE_PORT_ACC_MODE_MASK    (0xFF)
     56 
     57 #define _DPP_AM_TEMPLATE_PORT_TAG_TYPE_SHIFT   (8)
     58 #define _DPP_AM_TEMPLATE_PORT_TAG_TYPE_MASK    (0xF)
     59 
     60 #define _DPP_AM_TEMPLATE_PORT_DTAG_MODE_SHIFT  (12)
     61 #define _DPP_AM_TEMPLATE_PORT_DTAG_MODE_MASK   (0x3)
     62 
     63 #define _DPP_AM_TEMPLATE_PORT_AC_KEY_MAP_TYPE_SHIFT (14)
     64 #define _DPP_AM_TEMPLATE_PORT_AC_KEY_MAP_TYPE_MASK  (0x3)
     65 
     66 /* TTL Scoping */
     67 
     68 
     69 /* Egress action profile - number of entities pointing to it without counting the Field entries */
     70 #define BCM_DPP_AM_TRAP_EGRESS_MAX_ENTITIES_NO_FIELD (SOC_PPC_NOF_TRAP_EG_TYPES_ARAD + 3) 
     71 
     72 /* Egress thresh */
     73 #define _DPP_AM_TEMPLATE_COSQ_EGR_THRESH_COUNT(unit) (16)
     74 
     75 /* CRPS compensation profiles size */
     76 #define _DPP_CRPS_COMPENSATION_PROFILES_SIZE SOC_IS_QAX(unit) ? (8):(16)
     77 #define _DPP_STAT_INTERFACE_COMPENSATION_PROFILES_SIZE SOC_IS_QAX(unit) ? (8):(16)
     78 
     79 
     80 /* Scheduler adjust size (compensation) final delta mapping  */
     81 #define _DPP_AM_TEMPLATE_SCHEDULER_ADJUST_SIZE_FINAL_DELTA_PROFILE_LOW_ID       (0)
     82 #define _DPP_AM_TEMPLATE_SCHEDULER_ADJUST_SIZE_FINAL_DELTA_PROFILE_COUNT        (32) /* support up to 32 different compensation values */
     83 #define _DPP_AM_TEMPLATE_SCHEDULER_ADJUST_SIZE_FINAL_DELTA_MAX_ENTITIES         (256)
     84 #define _DPP_AM_TEMPLATE_SCHEDULER_ADJUST_SIZE_FINAL_DELTA_CLS_SIZE             (sizeof(int))
     85 
     86 /* IP tunnel encapsulation mode - Jericho B0, QAX and above */
     87 #define _DPP_AM_TEMPLATE_IP_TUNNEL_ENCAPSULATION_MODE_DUMMY_TEMPLATE (4)    /* encapsulation mode dummy profile*/
     88 
     89 typedef int (*dpp_am_cosq_flow_region_set_f)(int, int, int, int, int, int);
     90 typedef int (*dpp_am_cosq_queue_region_set_f)(int, int, int, int, int);
     91 
     92 typedef struct dpp_am_cosq_resource_info_s {
     93     dpp_am_cosq_flow_region_set_f      dpp_am_cosq_flow_region_set;
     94     dpp_am_cosq_queue_region_set_f     dpp_am_cosq_queue_region_set;
     95 } dpp_am_cosq_resource_info_t;
     96 
     97 
     98 typedef struct {
     99     uint32  cir;
    100     uint32  eir;
    101     uint32  max_cir;
    102     uint32  max_eir;    
    103     uint32  cbs;
    104     uint32  ebs;
    105     uint32  flags;
    106     uint32  mode;
    107     uint32  entropy_id;
    108     uint32  ir_rev_exp; /* relevant only for MEF mode (cascade) */
    109     uint32  mark_black;
    110 } bcm_dpp_am_meter_entry_t;
    111 
    112 
    113 typedef struct _dpp_res_pool_cosq_s {
    114     int dpp_res_pool_cosq_connector_cont;
    115     int dpp_res_pool_cosq_connector_non_cont_region_type_1;
    116     int dpp_res_pool_cosq_connector_non_cont_region_type_2;
    117     int dpp_res_pool_cosq_se_cl_fq_region_type_1;
    118     int dpp_res_pool_cosq_se_cl_fq_region_type_2;
    119     int dpp_res_pool_cosq_se_cl_hr;
    120     int dpp_res_pool_cosq_fq_connector_region_type_2_sync;
    121     int dpp_res_pool_cosq_hr_connector_region_type_2_sync;
    122     int dpp_res_pool_cosq_e2e_end;
    123     int dpp_res_pool_cosq_queue_unicast_cont;
    124     int dpp_res_pool_cosq_queue_unicast_non_cont;
    125     int dpp_res_pool_cosq_queue_multicast_cont;
    126     int dpp_res_pool_cosq_queue_multicast_non_cont;
    127     int dpp_res_pool_cosq_queue_isq_cont;
    128     int dpp_res_pool_cosq_queue_isq_non_cont;
    129     int dpp_res_pool_cosq_queue_dynamic_start;
    130     int dpp_res_pool_cosq_queue_dynamic_end;
    131 } _dpp_res_pool_cosq_t;
    132 
    133 #define _BCM_DPP_AM_LIF_NOF_BANKS (16) /* Number of banks 64K/4K */
    134 
    135 typedef struct bcm_dpp_am_cosq_quad_allocation_s {
    136     int flow1;
    137     int flow2;
    138     int flow3;
    139     int flow4;
    140 }bcm_dpp_am_cosq_quad_allocation_t;
    141 
    142 typedef struct _dpp_res_type_cosq_s {
    143     int dpp_res_type_cosq_connector_cont;
    144     int dpp_res_type_cosq_connector_non_cont_region_type_1;
    145     int dpp_res_type_cosq_connector_non_cont_region_type_2;
    146     int dpp_res_type_cosq_se_cl_fq_region_type_1;
    147     int dpp_res_type_cosq_se_cl_fq_region_type_2;
    148     int dpp_res_type_cosq_se_cl_hr;
    149     int dpp_res_type_cosq_fq_connector_region_type_2_sync;
    150     int dpp_res_type_cosq_hr_connector_region_type_2_sync;
    151     int dpp_res_type_cosq_e2e_end;
    152     int dpp_res_type_cosq_queue_unicast_cont;
    153     int dpp_res_type_cosq_queue_unicast_non_cont;
    154     int dpp_res_type_cosq_queue_multicast_cont;
    155     int dpp_res_type_cosq_queue_multicast_non_cont;
    156     int dpp_res_type_cosq_queue_isq_cont;
    157     int dpp_res_type_cosq_queue_isq_non_cont;
    158     int dpp_res_type_cosq_queue_dynamic_start;
    159     int dpp_res_type_cosq_queue_dynamic_end;
    160 } _dpp_res_type_cosq_t;
    161 
    162 /* allocation mngr structs */
    163 /* Egress encapsulation start definiations */
    164 typedef struct bcm_dpp_am_egress_encap_s {
    165   SHR_BITDCL             *egress_encap_banks;  /* Bitmap of existing Egress Encapsulation banks */
    166   uint8                   egress_encap_count;   /* Number of existing Egress Encapsulation banks */
    167   uint8                   init; /* Indicate egress encap was initialized */
    168 } bcm_dpp_am_egress_encap_t;
    169 
    170 /* Ingress LIF start definitions */
    171 typedef struct bcm_dpp_am_ingress_lif_s {
    172   SHR_BITDCL             *ingress_lif_banks;  /* Bitmap of existing Ingress LIF banks */
    173   uint8                   ingress_lif_count;   /* Number of existing Ingress LIF banks */
    174   uint8                   init; /* Indicate ingress lif was initialized */
    175 } bcm_dpp_am_ingress_lif_t;
    176 
    177 typedef struct bcm_dpp_am_sync_lif_s {
    178   SHR_BITDCL           *sync_lif_banks;  /* Bitmap of sync LIF banks */
    179   uint8                 init; /* Indicate sync lif was initialized */
    180 } bcm_dpp_am_sync_lif_t;
    181 
    182 typedef struct {
    183     uint8 fec_bank_groups[SOC_DPP_DEFS_MAX(NOF_FEC_BANKS)];
    184     PARSER_HINT_ARR int *resource_to_pool_map;
    185     PARSER_HINT_ARR int *template_to_pool_map;
    186     bcm_dpp_am_egress_encap_t egress_encap;
    187     bcm_dpp_am_ingress_lif_t  ingress_lif;
    188     bcm_dpp_am_sync_lif_t     sync_lif;
    189     int egr_thresh_map[SOC_DPP_DEFS_MAX(NOF_LOGICAL_PORTS)];
    190     int egr_interface_unicast_thresh_map[SOC_DPP_IMP_DEFS_MAX(NOF_CORE_INTERFACES)*SOC_DPP_DEFS_MAX(NOF_CORES)];
    191     int egr_interface_multicast_thresh_map[SOC_DPP_IMP_DEFS_MAX(NOF_CORE_INTERFACES)*SOC_DPP_DEFS_MAX(NOF_CORES)];
    192 #ifdef BCM_88470_A0
    193     SHR_BITDCL fec_is_cascaded[_SHR_BITDCLSIZE(SOC_DPP_DEFS_MAX(NOF_FECS))];
    194 #endif /*BCM_88470_A0*/
    195 } bcm_dpp_alloc_mngr_info_t;
    196 
    197 int
    198 bcm_dpp_am_attach(
    199     int unit);
    200 
    201 int
    202 bcm_dpp_am_clear(
    203     int unit);
    204 
    205 int
    206 bcm_dpp_am_detach(
    207     int unit);
    208 
    209 int
    210 bcm_dpp_am_vlan_vsi_alloc(
    211     int unit,
    212     bcm_vlan_t vid,
    213     SOC_PPC_VSI_ID *vsi,
    214     SOC_PPC_LIF_ID *lif);
    215 
    216 int
    217 bcm_dpp_am_vlan_vsi_dealloc(
    218     int unit,
    219     bcm_vlan_t vid,
    220     SOC_PPC_VSI_ID vsi,
    221     SOC_PPC_LIF_ID lif);
    222 
    223 
    224  /*
    225   * L2 VPN
    226   */
    227 int
    228 bcm_dpp_am_l2_vpn_vsi_alloc(
    229         int unit,
    230         uint32 flags,
    231         bcm_vlan_t *vsi);
    232 int
    233 bcm_dpp_am_l2_vpn_vsi_dealloc(
    234         int unit,
    235         bcm_vlan_t vsi);
    236 int
    237   bcm_dpp_am_l2_vpn_vsi_is_alloced(
    238       int unit,
    239       bcm_vlan_t vsi);
    240 
    241 #define _BCM_DPP_AM_L2_VPN_AC_TYPE_DEFAULT           (0)
    242 #define _BCM_DPP_AM_L2_VPN_AC_TYPE_PON_3_TAGS_DATA   (1)
    243 #define _BCM_DPP_AM_L2_VPN_AC_TYPE_PON_3_TAGS_OUT_AC (2)
    244 #ifdef BCM_88660_A0
    245 #define _BCM_DPP_AM_L2_VPN_AC_TYPE_BIG_OUT_AC        (3)
    246 #endif
    247 
    248 int
    249 bcm_dpp_am_l2_vpn_ac_alloc(
    250         int unit,
    251         uint32 types,
    252         uint32 flags,
    253         SOC_PPC_LIF_ID *lif);
    254 
    255 int
    256 bcm_dpp_am_l2_vpn_ac_dealloc(
    257         int unit,
    258         uint32 types,
    259         uint32 flags,
    260         SOC_PPC_LIF_ID lif);
    261 
    262 int
    263 bcm_dpp_trill_lif_alloc(
    264         int unit,
    265         uint32 flags,
    266         SOC_PPC_LIF_ID *lif);
    267 int
    268 bcm_dpp_trill_lif_is_alloced(
    269         int unit,
    270         SOC_PPC_LIF_ID lif);
    271 int
    272 bcm_dpp_trill_lif_dealloc(
    273         int unit,
    274         uint32 flags,
    275         SOC_PPC_LIF_ID lif);
    276 
    277 
    278 #define _BCM_DPP_AM_L2_AC_TYPE_VLAN_VSI              (0)
    279 #define _BCM_DPP_AM_L2_AC_TYPE_VLAN_EDITING          (1)
    280 #define _BCM_DPP_AM_L2_AC_TYPE_ISID                  (2)
    281 #define _BCM_DPP_AM_L2_AC_TYPE_INITIAL_VLAN          (3)
    282 #define _BCM_DPP_AM_L2_AC_TYPE_DOUBLE                (4)
    283 int
    284 bcm_dpp_am_l2_ac_alloc(
    285         int unit,
    286         uint32 types,
    287         uint32 flags,
    288         SOC_PPC_LIF_ID *lif);
    289 
    290 int
    291 bcm_dpp_am_l2_ac_dealloc(
    292         int unit,
    293         uint32 lif_type,
    294         SOC_PPC_LIF_ID lif);
    295 
    296 int
    297 bcm_dpp_am_l2_ac_is_alloced(
    298         int unit,
    299         SOC_PPC_AC_ID out_ac);
    300 
    301 int
    302 bcm_dpp_am_out_ac_dealloc(
    303         int unit,
    304         uint32 types,
    305         uint32 flags,
    306         SOC_PPC_AC_ID out_ac);
    307 
    308 int
    309 bcm_dpp_am_out_ac_is_alloced(
    310         int unit,
    311         SOC_PPC_AC_ID out_ac);
    312 
    313 /* DATA, Mirror , ERSPAN */
    314 int
    315 bcm_dpp_am_eg_data_erspan_alloc(
    316         int unit,
    317         uint32 flags,
    318         uint32 *eg_data_erspan);
    319 
    320 int
    321 bcm_dpp_am_eg_data_erspan_dealloc(
    322         int unit,
    323         uint32 flags,
    324         uint32 eg_data_erspan);
    325 
    326 int
    327 bcm_dpp_am_eg_data_erspan_is_alloced(
    328         int unit,
    329         uint32 eg_data_erspan);
    330 
    331 int
    332 bcm_dpp_am_ipv6_tunnel_alloc(
    333         int unit,
    334         uint32 flags,
    335         uint32 *outlif);
    336 
    337 int
    338 bcm_dpp_am_ipv6_tunnel_dealloc(
    339         int unit,
    340         uint32 flags,
    341         uint32 ipv6_tunnel);
    342 
    343 int
    344 bcm_dpp_am_ipv6_tunnel_is_alloced(
    345         int unit,
    346         uint32 ipv6_tunnel);
    347 
    348 extern int
    349 bcm_dpp_am_qos_ing_elsp_dealloc(
    350         int unit,
    351         uint32 flags,
    352         int qos_id);
    353 
    354 extern int
    355 bcm_dpp_am_qos_ing_elsp_is_alloced(
    356         int unit,
    357         int qos_id);
    358 
    359 extern int
    360 bcm_dpp_am_qos_ing_lif_cos_dealloc(
    361         int unit,
    362         uint32 flags,
    363         int qos_id);
    364 
    365 extern int
    366 bcm_dpp_am_qos_ing_lif_cos_is_alloced(
    367         int unit,
    368         int qos_id);
    369 
    370 extern int
    371 bcm_dpp_am_qos_ing_pcp_vlan_dealloc(
    372         int unit,
    373         uint32 flags,
    374         int qos_id);
    375 
    376 extern int
    377 bcm_dpp_am_qos_ing_pcp_vlan_is_alloced(
    378         int unit,
    379         int qos_id);
    380 
    381 extern int
    382 bcm_dpp_am_qos_ing_color_dealloc(
    383         int unit,
    384         uint32 flags,
    385         int qos_id);
    386 
    387 extern int
    388 bcm_dpp_am_qos_ing_color_is_alloced(
    389         int unit,
    390         int qos_id);
    391 
    392 extern int
    393 bcm_dpp_am_qos_egr_remark_id_dealloc(
    394         int unit,
    395         uint32 flags,
    396         int qos_id);
    397 
    398 extern int
    399 bcm_dpp_am_qos_egr_remark_id_is_alloced(
    400         int unit,
    401         int qos_id);
    402 
    403 extern int
    404 bcm_dpp_am_qos_egr_mpls_php_id_dealloc(
    405         int unit,
    406         uint32 flags,
    407         int qos_id);
    408 
    409 extern int
    410 bcm_dpp_am_qos_egr_mpls_php_id_is_alloced(
    411         int unit,
    412         int qos_id);
    413 
    414 extern int
    415 bcm_dpp_am_qos_egr_pcp_vlan_dealloc(
    416         int unit,
    417         uint32 flags,
    418         int qos_id);
    419 
    420 extern int
    421 bcm_dpp_am_qos_egr_pcp_vlan_is_alloced(
    422         int unit,
    423         int qos_id);
    424 
    425 extern int
    426 bcm_dpp_am_qos_ing_cos_opcode_dealloc(
    427         int unit,
    428         uint32 flags,
    429         int qos_id);
    430 
    431 extern int
    432 bcm_dpp_am_qos_ing_cos_opcode_is_alloced(
    433         int unit,
    434         int qos_id);
    435 
    436 extern int
    437 bcm_dpp_am_qos_egr_l2_i_tag_dealloc(
    438         int unit,
    439         uint32 flags,
    440         int qos_id);
    441 
    442 extern int
    443 bcm_dpp_am_qos_egr_l2_i_tag_is_alloced(
    444         int unit,
    445         int qos_id);
    446 
    447 #ifdef BCM_88660
    448 extern int
    449 bcm_dpp_am_qos_egr_dscp_exp_marking_dealloc(
    450         int unit,
    451         uint32 flags,
    452         int qos_id);
    453 
    454 extern int
    455 bcm_dpp_am_qos_egr_dscp_exp_marking_is_alloced(
    456         int unit,
    457         int qos_id);
    458 #endif /* BCM_88660 */
    459 
    460 extern int
    461 bcm_dpp_am_meter_dealloc(
    462         int unit,
    463 		int core,
    464         uint32 flags,
    465         int meter_group,
    466         int nof_meters,
    467         int meter_id);
    468 
    469 extern int
    470 bcm_dpp_am_meter_is_alloced(
    471         int unit,
    472 		int core,
    473         int meter_group,
    474         int nof_meters,
    475         int meter_id);
    476 
    477 
    478 #ifdef BCM_ARAD_SUPPORT
    479 
    480 int
    481 bcm_dpp_am_ecmp_alloc(
    482     int unit,
    483     uint32 flags,
    484     bcm_ecmp_t *ecmp_id);
    485 
    486 int
    487 bcm_dpp_am_ecmp_dealloc(
    488     int unit,
    489     bcm_ecmp_t ecmp_id);
    490 
    491 int
    492 bcm_dpp_am_ecmp_is_alloced(
    493     int unit,
    494     bcm_ecmp_t ecmp_id);
    495 
    496 #endif /* BCM_ARAD_SUPPORT */
    497 
    498 
    499 
    500 int
    501 bcm_dpp_am_rp_alloc(
    502     int unit,
    503     uint32 flags,
    504     int *rp_id);
    505 
    506 int
    507 bcm_dpp_am_rp_dealloc(
    508     int unit,
    509     int rp_id);
    510 
    511 
    512 int
    513 bcm_dpp_am_rp_is_alloced(
    514     int unit,
    515     int rp_id);
    516 
    517 
    518 int
    519 bcm_dpp_am_failover_dealloc(
    520     int unit,
    521     int32 failover_type,
    522     int32 nof_dealloc_ids,
    523     bcm_failover_t failover_id);
    524 
    525 int
    526 bcm_dpp_am_failover_is_alloced(
    527     int unit,
    528     int32 failover_type,
    529     bcm_failover_t failover_id);
    530 
    531 #define _BCM_DPP_AM_L2_PWE_TERM_DEFAULT        (0) /* Default */
    532 #define _BCM_DPP_AM_L2_PWE_TERM_INDEXED_1      (2) /* Indexed 1 */
    533 #define _BCM_DPP_AM_L2_PWE_TERM_INDEXED_2      (3) /* Indexed 2 */
    534 #define _BCM_DPP_AM_L2_PWE_TERM_INDEXED_3      (4) /* Indexed 3 */
    535 #define _BCM_DPP_AM_L2_PWE_TERM_INDEXED_1_2    (5) /* Indexed 1,2 */
    536 #define _BCM_DPP_AM_L2_PWE_TERM_INDEXED_1_3    (6) /* Indexed 1,3 */
    537 
    538 
    539 int
    540 bcm_dpp_am_l2_vpn_pwe_lif_dealloc(
    541         int unit,
    542         SOC_PPC_LIF_ID lif);
    543 
    544 int
    545 bcm_dpp_am_l2_vpn_pwe_eep_dealloc(
    546         int unit,
    547         uint32 eep);
    548 
    549 int
    550 bcm_dpp_am_mc_dealloc(
    551         int unit,
    552         SOC_TMC_MULT_ID mc_id,
    553         uint8 is_egress);
    554 
    555 int
    556 bcm_dpp_am_mc_is_alloced(
    557         int unit,
    558         SOC_TMC_MULT_ID mc_id,
    559         uint8 is_egress);
    560 
    561 /* 
    562  * OAM
    563  */
    564 
    565 /* OAM MEP entry type */
    566 #define BCM_DPP_AM_OAM_MEP_DB_ENTRY_TYPE_MEP (1)
    567 
    568 int
    569 bcm_dpp_am_oam_ma_id_alloc(
    570         int unit,
    571         uint32 flags, /* flags may be SW_STATE_RES_ALLOC_WITH_ID or 0; */
    572         uint32  *ma_id);
    573 
    574 int
    575 bcm_dpp_am_oam_ma_id_dealloc(
    576         int unit,
    577         uint32 ma_id);
    578 
    579 int
    580 bcm_dpp_am_oam_ma_id_is_alloced(
    581         int unit,
    582         uint32 ma_id);
    583 
    584 
    585 
    586 int
    587 bcm_dpp_am_oam_mep_id_short_alloc(
    588         int unit,
    589         uint32 flags, /* flags may be SW_STATE_RES_ALLOC_WITH_ID or 0; */
    590         uint32  *mep_id);
    591 
    592 int
    593 bcm_dpp_am_oam_mep_id_short_dealloc(
    594         int unit,
    595         uint32 mep_id);
    596 
    597 int
    598 bcm_dpp_am_oam_mep_id_short_is_alloced(
    599         int unit,
    600         uint32 mep_id);
    601 
    602 int
    603 bcm_dpp_am_oam_mep_id_long_alloc_non_48_maid(
    604         int unit,
    605         uint32 flags, /* flags may be SW_STATE_RES_ALLOC_WITH_ID or 0; */
    606         uint32  *mep_id);
    607 
    608 int
    609 bcm_dpp_am_oam_mep_id_long_dealloc_non_48_maid(
    610         int unit,
    611         uint32 mep_id);
    612 
    613 int
    614 bcm_dpp_am_oam_mep_id_long_is_alloced_non_48_maid(
    615         int unit,
    616         uint32 mep_id);
    617 
    618 int
    619 bcm_dpp_am_oam_mep_id_long_alloc_48_maid(
    620         int unit,
    621         uint32 flags, /* flags may be SW_STATE_RES_ALLOC_WITH_ID or 0; */
    622         uint32  *mep_id);
    623 
    624 int
    625 bcm_dpp_am_oam_mep_id_long_dealloc_48_maid(
    626         int unit,
    627         uint32 mep_id);
    628 
    629 int
    630 bcm_dpp_am_oam_mep_id_long_is_alloced_48_maid(
    631         int unit,
    632         uint32 mep_id);
    633 
    634 int
    635 bcm_dpp_am_oam_mep_id_long_alloc(
    636         int unit,
    637         uint32 flags, /* flags may be SW_STATE_RES_ALLOC_WITH_ID or 0; */
    638         uint32  *mep_id);
    639 
    640 int
    641 bcm_dpp_am_oam_mep_id_long_dealloc(
    642         int unit,
    643         uint32 mep_id);
    644 
    645 int
    646 bcm_dpp_am_oam_mep_id_long_is_alloced(
    647         int unit,
    648         uint32 mep_id);
    649 
    650 int
    651 bcm_dpp_am_qax_oam_mep_id_alloc(
    652         int unit,
    653         uint32 flags, /* flags may be SW_STATE_RES_ALLOC_WITH_ID or 0; */
    654         uint8 type,
    655         uint32  *mep_id);
    656 
    657 int
    658 bcm_dpp_am_qax_oam_mep_id_dealloc(
    659         int unit,
    660         uint32 mep_id);
    661 
    662 int
    663 bcm_dpp_am_qax_oam_mep_id_is_alloced(
    664         int unit,
    665         uint32 mep_id);
    666 
    667 int
    668 bcm_dpp_am_oam_rmep_id_alloc(
    669         int unit,
    670         uint32 flags, /* flags may be SW_STATE_RES_ALLOC_WITH_ID or 0; */
    671         uint32 *rmep_id);
    672 
    673 int
    674 bcm_dpp_am_oam_rmep_id_dealloc(
    675         int unit,
    676         uint32 rmep_id);
    677 
    678 int
    679 bcm_dpp_am_oam_rmep_id_is_alloced(
    680         int unit,
    681         uint32 rmep_id);
    682 
    683 int
    684 bcm_dpp_am_oam_mep_id_jumbo_tlv_alloc(
    685         int unit,
    686         uint32 flags, /* flags may be SW_STATE_RES_ALLOC_WITH_ID or 0; */
    687         uint32  *mep_id);
    688 
    689 int
    690 bcm_dpp_am_oam_mep_id_jumbo_tlv_dealloc(
    691         int unit,
    692         uint32 mep_id);
    693 
    694 int
    695 bcm_dpp_am_oam_mep_id_jumbo_tlv_is_alloced(
    696         int unit,
    697         uint32 mep_id);
    698 
    699 
    700 int
    701 bcm_dpp_am_oam_mep_id_no_jumbo_tlv_alloc(
    702         int unit,
    703         uint32 flags, /* flags may be SW_STATE_RES_ALLOC_WITH_ID or 0; */
    704         uint32  *mep_id);
    705 
    706 int
    707 bcm_dpp_am_oam_mep_id_no_jumbo_tlv_dealloc(
    708         int unit,
    709         uint32 mep_id);
    710 
    711 int
    712 bcm_dpp_am_oam_mep_id_no_jumbo_tlv_is_alloced(
    713         int unit,
    714         uint32 mep_id);
    715 
    716 int
    717 bcm_dpp_am_oam_trap_code_upmep_ftmh_header_alloc(
    718         int unit,
    719         uint32 flags, /* flags may be SW_STATE_RES_ALLOC_WITH_ID or 0; */
    720         uint32 *trap_code);
    721 
    722 int
    723 bcm_dpp_am_oam_trap_code_upmep_ftmh_header_dealloc(
    724         int unit,
    725         uint32 trap_code);
    726 
    727 /*
    728  *Returns: 
    729  *      BCM_E_NOT_FOUND if the element is not in use
    730  *      BCM_E_EXISTS if the element is in use
    731  *      BCM_E_PARAM if the element is not valid
    732  *      BCM_E_* as appropriate otherwise
    733  */
    734 int
    735 bcm_dpp_am_oam_sd_sf_id_alloc(
    736         int unit,
    737         uint32 flags, 
    738         uint32  *sd_sf_id);
    739 
    740 int
    741 bcm_dpp_am_oam_sd_sf_id_dealloc(
    742         int unit,
    743         uint32 sd_sf_id);
    744 
    745 int
    746 bcm_dpp_am_oam_sd_sf_id_is_alloced(
    747         int unit,
    748         uint32 sd_sf_id);
    749 
    750 int
    751 bcm_dpp_am_oam_y_1711_sd_sf_id_alloc(
    752         int unit,
    753         uint32 flags, 
    754         uint32  *y_1711_sd_sf_id);
    755 
    756 int
    757 bcm_dpp_am_oam_y_1711_sd_sf_id_dealloc(
    758         int unit,
    759         uint32 y_1711_sd_sf_id);
    760 
    761 int
    762 bcm_dpp_am_oam_y_1711_sd_sf_id_is_alloced(
    763         int unit,
    764         uint32 y_1711_sd_sf_id);
    765 
    766 int _bcm_dpp_am_template_oam_sd_sf_profile_alloc(
    767     int unit,
    768     int flags,
    769     const SOC_PPC_OAM_OAMP_SD_SF_PROFILE_DB *data, 
    770     int *is_allocated,
    771     int *profile_ndx);
    772 
    773 int _bcm_dpp_am_template_oam_sd_sf_profile_free(
    774     int unit, 
    775     int profile_ndx, 
    776     int *is_last);
    777 
    778 int _bcm_dpp_am_template_oam_sd_sf_profile_data_get(
    779     int unit, 
    780     int profile_ndx, 
    781     SOC_PPC_OAM_OAMP_SD_SF_PROFILE_DB* data);
    782 
    783 
    784 /* OAM - End */
    785 
    786 /* 
    787  * L3
    788  */
    789 #define _BCM_DPP_AM_L3_LIF_MPLS_TERM                (0) /* MPLS termination Default */
    790 #define _BCM_DPP_AM_L3_LIF_IP_TERM                  (1)
    791 #define _BCM_DPP_AM_L3_LIF_MPLS_TERM_INDEXED_1      (2) /* Indexed 1 */
    792 #define _BCM_DPP_AM_L3_LIF_MPLS_TERM_INDEXED_2      (3) /* Indexed 2 */
    793 #define _BCM_DPP_AM_L3_LIF_MPLS_TERM_INDEXED_3      (4) /* Indexed 3 */
    794 #define _BCM_DPP_AM_L3_LIF_MPLS_TERM_INDEXED_1_2    (5) /* Indexed 1,2 */
    795 #define _BCM_DPP_AM_L3_LIF_MPLS_TERM_INDEXED_1_3    (6) /* Indexed 1,2 */
    796 #define _BCM_DPP_AM_L3_LIF_MPLS_TERM_FRR            (7) /* FRR entry */
    797 #define _BCM_DPP_AM_L3_LIF_MPLS_TERM_EXPLICIT_NULL  (8) /* Explicit NULL (label 0 and 2) */
    798 #define _BCM_DPP_AM_L3_LIF_MPLS_TERM_DUMMY          (9) /* Dummy termination for mLDP*/
    799 
    800 
    801 int
    802 bcm_dpp_am_l3_lif_type_to_app_type(uint32 type, bcm_dpp_am_ingress_lif_app_t *app_type);
    803 
    804 int
    805 bcm_dpp_am_l3_lif_alloc(
    806         int unit,
    807         uint32 types,
    808         uint32 flags,
    809         int *lif);
    810 
    811 int
    812 bcm_dpp_am_l3_lif_is_allocated(
    813         int unit,
    814         uint32 types,
    815         uint32 flags,
    816         int lif);
    817 
    818 
    819 
    820 int
    821 bcm_dpp_am_l3_lif_dealloc(
    822         int unit,
    823         int lif);
    824 int
    825 bcm_dpp_am_l3_eep_dealloc(
    826         int unit,
    827         int eep);
    828 
    829 int
    830 bcm_dpp_am_l3_eep_is_alloced(
    831         int unit,
    832         int eep);
    833 
    834 
    835 int
    836 bcm_dpp_am_l3_lif_ip_tnl_dealloc(
    837         int unit,
    838         SOC_PPC_LIF_ID lif);
    839 
    840 
    841 
    842 int
    843 bcm_dpp_am_ip_tunnel_eep_is_alloced(
    844         int unit,
    845         uint32 flags,
    846         int eep);
    847 
    848 
    849 int
    850 bcm_dpp_am_ip_tunnel_eep_dealloc(
    851         int unit,
    852         uint32 flags,
    853         int eep);
    854 
    855 int
    856 bcm_dpp_am_mpls_eep_is_alloced(
    857         int unit,
    858         int eep);
    859 
    860 
    861 int
    862 bcm_dpp_am_mpls_eep_dealloc(
    863         int unit,
    864         int eep);
    865 
    866 int
    867 bcm_dpp_am_ip_tunnel_glbl_src_ip_is_alloced(
    868         int unit,
    869         int idx);
    870 
    871 
    872 int
    873 bcm_dpp_am_ip_tunnel_glbl_src_ip_dealloc(
    874         int unit,
    875         int idx);
    876 
    877 int
    878 bcm_dpp_am_ip_tunnel_glbl_ttl_is_alloced(
    879         int unit,
    880         int idx);
    881 
    882 
    883 int
    884 bcm_dpp_am_ip_tunnel_glbl_ttl_dealloc(
    885         int unit,
    886         int idx);
    887 
    888 
    889 int
    890 bcm_dpp_am_ip_tunnel_glbl_tos_is_alloced(
    891         int unit,
    892         int idx);
    893 
    894 
    895 int
    896 bcm_dpp_am_ip_tunnel_glbl_tos_dealloc(
    897         int unit,
    898         int idx);
    899 
    900 /* Get a simple indexing for egress traps */
    901 int
    902 _bcm_dpp_am_eg_trap_index_get(
    903         int unit,
    904         SOC_PPC_TRAP_EG_TYPE trap_id, /* from the enum */
    905         uint32 *trap_index); /* 0...NOF_TRAPS */
    906 
    907 
    908 int _bcm_dpp_am_template_trap_egress_init(
    909         int unit,
    910         int template_init_id,
    911         SOC_SAND_OUT SOC_PPC_TRAP_EG_ACTION_PROFILE_INFO *init_data);
    912 
    913 int _bcm_dpp_am_trap_dealloc(
    914         int unit,
    915         int flags,
    916         int trap_id,
    917         int elem);
    918 
    919 int
    920 _bcm_dpp_am_snoop_dealloc(
    921         int unit,
    922         int flags,
    923         int snoop_cmnd, 
    924         int elem);
    925 
    926 
    927 int _bcm_dpp_am_trap_is_alloced(
    928         int unit,
    929         int trap_id);
    930 
    931 int
    932 _bcm_dpp_am_snoop_is_alloced(
    933         int unit,
    934         int snoop_cmnd);
    935 
    936 
    937 int _bcm_dpp_am_template_trap_egress_data_get(
    938         int unit,
    939         SOC_PPC_TRAP_EG_TYPE trap_id, /* Enum trap */
    940         uint32 egress_trap_entry, /* Egress Trap or Field Entry */                                              
    941         SOC_SAND_OUT SOC_PPC_TRAP_EG_ACTION_PROFILE_INFO *data);
    942 
    943 extern int
    944 _bcm_dpp_am_template_trap_egress_free(int unit,
    945                                       int template);
    946 
    947 int _bcm_dpp_am_template_trap_egress_exchange(
    948         int unit,
    949         int flags,
    950         SOC_PPC_TRAP_EG_TYPE trap_id, /* Enum trap */
    951         uint32 egress_trap_entry, /* Egress Trap or Field Entry */
    952         SOC_SAND_IN SOC_PPC_TRAP_EG_ACTION_PROFILE_INFO *data,
    953         int *old_template,
    954         int *is_last,
    955         int *template,
    956         int *is_allocated);
    957 
    958 
    959 int
    960 _bcm_dpp_am_template_trap_egress_profile_mapping_get(
    961         int unit,
    962         SOC_PPC_TRAP_EG_TYPE trap_id, /* Enum trap */
    963         uint32 egress_trap_entry, /* Egress Trap or Field Entry */
    964         SOC_SAND_OUT uint32 *profile);
    965 
    966 /*
    967  * l2 vpn
    968  */
    969 int
    970 bcm_dpp_am_voq_connector_alloc(
    971         int unit,
    972         uint32 flags,
    973         SOC_TMC_SCH_FLOW_ID *flow_id);
    974 
    975 int
    976 bcm_dpp_am_voq_connector_dealloc(
    977         int unit,
    978         uint32 flags,
    979         SOC_TMC_SCH_FLOW_ID flow_id);
    980 
    981 int
    982 bcm_dpp_am_queue_alloc(
    983         int unit,
    984         uint32 flags,
    985         uint32 *queue_id);
    986 
    987 int
    988 bcm_dpp_am_queue_dealloc(
    989         int unit,
    990         uint32 flags,
    991         uint32 queue_id);
    992 
    993 int
    994 bcm_dpp_am_fp_db_alloc(
    995         int unit,
    996         uint32 flags,
    997         uint32 *db_id);
    998 
    999 int
   1000 bcm_dpp_am_fp_db_dealloc(
   1001         int unit,
   1002         uint32 flags,
   1003         uint32 db_id);
   1004 
   1005 int
   1006 bcm_dpp_am_fp_range_checker_alloc(
   1007         int unit,
   1008         uint32 flags,
   1009         uint32 *rc_id);
   1010 
   1011 int
   1012 bcm_dpp_am_fp_range_checker_dealloc(
   1013         int unit,
   1014         uint32 flags,
   1015         uint32 rc_id);
   1016 int
   1017 bcm_dpp_am_vsq_src_port_alloc(
   1018     int unit,
   1019     int core_id,
   1020     uint32 flags,
   1021     int src_pp_port,
   1022     int *vsq_index);
   1023 int
   1024 bcm_dpp_am_vsq_src_port_free(
   1025     int unit,
   1026     int core_id,
   1027     int vsq_index);
   1028 int
   1029 bcm_dpp_am_pg_init(
   1030    int unit
   1031    );
   1032 int
   1033 bcm_dpp_am_pg_alloc(
   1034     int unit,
   1035     int core_id,
   1036     uint32 flags,
   1037     int numq,
   1038     int *pg_base);
   1039 int
   1040 bcm_dpp_am_pg_check(
   1041     int unit, 
   1042     int core_id, 
   1043     int pg_base);
   1044 int
   1045 bcm_dpp_am_pg_get(
   1046     int unit,
   1047     int core_id,
   1048     int pg_base,
   1049     int *numq
   1050     );
   1051 int
   1052 bcm_dpp_am_pg_free(
   1053     int unit,
   1054     int core_id,
   1055     int pg_base);
   1056 /* 
   1057  * Template management - Start
   1058  */ 
   1059 /* Cosq Egress Thresh - Start */
   1060   /* 
   1061    * Port level drop & fc thresholds type
   1062    * pointed by tm-port,
   1063    * used by bcm_petra_cosq_threshold_set
   1064    */
   1065 int _bcm_dpp_am_template_cosq_egr_thresh_init(int unit,
   1066                                               int core,
   1067                                               int template_init_id,
   1068                                               bcm_dpp_cosq_egress_thresh_key_info_t *egr_thresh_data_init);
   1069 int _bcm_dpp_am_template_cosq_egr_thresh_data_get(int unit,
   1070                                                   int core,
   1071                                                   int port,
   1072                                                   bcm_dpp_cosq_egress_thresh_key_info_t * data);
   1073 int _bcm_dpp_am_template_cosq_egr_thresh_exchange(int unit, 
   1074                                                  int core,
   1075                                                  int port, 
   1076                                                  bcm_dpp_cosq_egress_thresh_key_info_t * data, 
   1077                                                  int *old_template,
   1078                                                  int *is_last, 
   1079                                                  int *template,
   1080                                                  int *is_allocated);
   1081 int _bcm_dpp_am_template_cosq_egr_thresh_ref_get(int unit, int template, uint32 *ref_count);
   1082 
   1083 int _bcm_dpp_am_template_cosq_egr_thresh_allocate_group(int unit, uint32 flags, bcm_dpp_cosq_egress_thresh_key_info_t *data, int ref_count, int *is_allocated, int *template);
   1084 
   1085 int _bcm_dpp_am_template_cosq_egr_thresh_tdata_get(int unit, int template, bcm_dpp_cosq_egress_thresh_key_info_t *data);
   1086 
   1087 /* Cosq Egress Thresh - End */
   1088 
   1089 /* Cosq Egress Interface Unicast Thresh - Start */
   1090   /* 
   1091         * Port level drop & fc thresholds type ?
   1092         * pointed by tm-port, ?
   1093         * used by bcm_petra_cosq_threshold_set ?
   1094    */
   1095 int _bcm_dpp_am_template_cosq_egr_interface_unicast_thresh_init(int unit,
   1096                                                                 int core,
   1097                                               int template_init_id,
   1098                                               bcm_dpp_cosq_egress_interface_unicast_thresh_key_info_t *egr_interface_unicast_thresh_data_init);
   1099 int _bcm_dpp_am_template_cosq_egr_interface_unicast_thresh_data_get(int unit,
   1100                                                                     int core,
   1101                                                   int interface_id,
   1102                                                   bcm_dpp_cosq_egress_interface_unicast_thresh_key_info_t * data);
   1103 int _bcm_dpp_am_template_cosq_egr_interface_unicast_thresh_exchange(int unit, 
   1104                                                                     int core, 
   1105                                                  int interface_id, 
   1106                                                  bcm_dpp_cosq_egress_interface_unicast_thresh_key_info_t * data, 
   1107                                                  int *old_template,
   1108                                                  int *is_last, 
   1109                                                  int *template,
   1110                                                  int *is_allocated);
   1111 /* Cosq Egress Interface Unicast Thresh - End */
   1112 
   1113 /* Cosq Egress Interface Multicast Thresh - Start */
   1114   /* 
   1115         * Port level drop & fc thresholds type ?
   1116         * pointed by tm-port, ?
   1117         * used by bcm_petra_cosq_threshold_set ?
   1118    */
   1119 int _bcm_dpp_am_template_cosq_egr_interface_multicast_thresh_init(int unit,
   1120                                                                   int core,
   1121                                               int template_init_id,
   1122                                               bcm_dpp_cosq_egress_interface_multicast_thresh_key_info_t *egr_interface_multicast_thresh_data_init);
   1123 int _bcm_dpp_am_template_cosq_egr_interface_multicast_thresh_data_get(int unit,
   1124                                                                       int core,
   1125                                                   int interface_id,
   1126                                                   bcm_dpp_cosq_egress_interface_multicast_thresh_key_info_t * data);
   1127 int _bcm_dpp_am_template_cosq_egr_interface_multicast_thresh_exchange(int unit, 
   1128                                                                       int core,
   1129                                                  int interface_id, 
   1130                                                  bcm_dpp_cosq_egress_interface_multicast_thresh_key_info_t * data, 
   1131                                                  int *old_template,
   1132                                                  int *is_last, 
   1133                                                  int *template,
   1134                                                  int *is_allocated);
   1135 /* Cosq Egress Interface Multicast Thresh - End */
   1136 
   1137 /* mirror action profile. Data represents CPU-trap-code*/
   1138 /* In cases where CPU-trap-code is not used the flag
   1139    SHR_TEMPLATE_MANAGE_IGNORE_DATA should set and a new profile will be allocated (if available).
   1140    In such cases data, is_allocated may be NULL.*/
   1141 int _bcm_dpp_am_template_mirror_action_profile_alloc(int unit, int flags, uint32 *data, int *is_allocated, int *profile);
   1142 int _bcm_dpp_am_template_mirror_action_profile_free(int unit, int profile, int *is_last);
   1143 int _bcm_dpp_am_template_mirror_action_profile_get(int unit, int mirror_profile, uint32 *data);
   1144 int _bcm_dpp_am_template_mirror_action_profile_ref_get(int unit, int profile, uint32 *ref_count);
   1145 
   1146 /* User defined trap - Start */
   1147   /*
   1148    * user defined traps, (60 traps) 
   1149    * considering only destination info 
   1150    */
   1151 
   1152 int _bcm_dpp_am_template_user_defined_traps_init(int unit,
   1153                                           int template_init_id,
   1154                                           const bcm_dpp_user_defined_traps_t *data);
   1155 
   1156 int _bcm_dpp_am_template_user_defined_trap_free(int unit, 
   1157                                                 int port, 
   1158                                                 int* is_last, 
   1159                                                 int *user_defined_trap);
   1160 int _bcm_dpp_am_template_user_defined_trap_exchange(int unit,
   1161                                                     int port,
   1162                                                     bcm_dpp_user_defined_traps_t * data,
   1163                                                     int *old_template,
   1164                                                     int *is_last,
   1165                                                     int *template,
   1166                                                     int *is_allocated);
   1167 
   1168 /* User defined trap - End */
   1169 
   1170 /* Snoop Command - Start */
   1171 
   1172 /* Set mapping - since get mapping it is SW check */ 
   1173 int _bcm_dpp_am_template_snoop_cmd_init(int unit,int template_init_id,const bcm_dpp_snoop_t* data);
   1174                                           
   1175 int _bcm_dpp_am_template_snoop_cmd_allocate(int unit,
   1176                                             uint32 flags,
   1177                                             int port,
   1178                                             const bcm_dpp_snoop_t* data,
   1179                                             int *is_allocated,
   1180                                             int *snoop_cmd);
   1181 int _bcm_dpp_am_template_snoop_cmd_free(int unit,
   1182                                         int port,
   1183                                         int *is_last,
   1184                                         int *snoop_cmd);
   1185 int _bcm_dpp_am_template_snoop_cmd_exchange(int unit,
   1186                                             int port,
   1187                                             bcm_dpp_snoop_t * data,
   1188                                             int *old_snoop_cmd,
   1189                                             int *is_last,
   1190                                             int *new_snoop_cmd,
   1191                                             int *is_allocated);
   1192 int _bcm_dpp_am_template_snoop_cmd_data_get(int unit,
   1193                                             int port,
   1194                                             bcm_dpp_snoop_t * data);
   1195 /* Snoop Command - End */
   1196 
   1197 /* TPID profile - Start */
   1198 int _bcm_dpp_am_template_tpid_profile_init(int unit,
   1199                                            int template_init_id,
   1200                                            _bcm_petra_tpid_profile_t profile_type, int accept_mode, _bcm_petra_dtag_mode_t dtag_mode, _bcm_petra_ac_key_map_type_t ac_key_map_type);
   1201 
   1202 int _bcm_dpp_am_template_tpid_profile_data_get(int unit,
   1203                                                int pp_port,
   1204                                                int core,
   1205                                                _bcm_petra_tpid_profile_t *tpid_profile, int *accept_mode, _bcm_petra_dtag_mode_t* dtag_mode, _bcm_petra_ac_key_map_type_t *ac_key_map_type);
   1206 
   1207 int _bcm_dpp_am_template_tpid_profile_allocate(int unit,
   1208                                                uint32 flags,
   1209                                                int port,
   1210                                                _bcm_petra_tpid_profile_t profile_type, int accept_mode, _bcm_petra_dtag_mode_t dtag_mode, _bcm_petra_ac_key_map_type_t ac_key_map_type,
   1211                                                int *is_allocated,
   1212                                                int *tpid_profile);
   1213 
   1214 int _bcm_dpp_am_template_tpid_profile_free(int unit,
   1215                                            int pp_port,
   1216                                            int core,
   1217                                            int *is_last,
   1218                                            int *tpid_profile);
   1219 
   1220 int _bcm_dpp_am_template_tpid_profile_exchange(int unit,
   1221                                                int pp_port,
   1222                                                int core,
   1223                                                _bcm_petra_tpid_profile_t profile_type, int accept_mode, _bcm_petra_dtag_mode_t dtag_mode, _bcm_petra_ac_key_map_type_t ac_key_map_type, 
   1224                                                int *old_tpid_profile,
   1225                                                int *is_last,
   1226                                                int *new_tpid_profile,
   1227                                                int *is_allocated);
   1228 
   1229 int _bcm_dpp_am_template_tpid_profile_ref_get(int unit, int template, uint32 *ref_count);
   1230 
   1231 int _bcm_dpp_am_template_tpid_profile_tdata_get(int unit, int template, uint32 *data);
   1232 
   1233 
   1234 /* TPID profile - End */
   1235 
   1236 /* COSQ Egress queue mapping - Start */
   1237 int _bcm_dpp_am_template_egress_queue_mapping_init(int unit,
   1238                                                    int template_init_id,
   1239                                                    int core,
   1240                                                    const bcm_dpp_cosq_egress_queue_mapping_info_t* mapping_profile);
   1241 
   1242 int _bcm_dpp_am_template_egress_queue_mapping_data_get(int unit,
   1243                                                        uint32 tm_port,
   1244                                                        int core,
   1245                                                        bcm_dpp_cosq_egress_queue_mapping_info_t * mapping_profile);
   1246 
   1247 int _bcm_dpp_am_template_egress_queue_mapping_exchange(int unit, 
   1248                                                        uint32 tm_port, 
   1249                                                        int core,
   1250                                                        CONST bcm_dpp_cosq_egress_queue_mapping_info_t * mapping_profile, 
   1251                                                        int *old_profile, 
   1252                                                        int *is_last, 
   1253                                                        int *new_profile,
   1254                                                        int *is_allocated);
   1255 
   1256 /* COSQ Egress queue mapping - End */
   1257 
   1258 /* NRDY threshold - Start */
   1259 int _bcm_dpp_am_template_nrdy_threshold_alloc(int unit, int core, int flags, uint32 *data, int *is_allocated, int *profile);
   1260 
   1261 int _bcm_dpp_am_template_nrdy_threshold_free(int unit, int core, int profile, int *is_last);
   1262 
   1263 int _bcm_dpp_am_template_nrdy_threshold_exchange(int unit, int core, uint32 tm_port, int flags, uint32 *data,
   1264                                              int *old_profile, int *is_last, int *profile, int *is_allocated);
   1265 
   1266 /* NRDY threshold - End */
   1267 
   1268 /* VLAN Edit Profile mapping Ingress & Egress - Start */
   1269 int _bcm_dpp_am_template_vlan_edit_profile_mapping_init(int unit,
   1270                                                         int template_init_id,
   1271                                                         const bcm_dpp_vlan_edit_profile_mapping_info_t *mapping_profile);
   1272 
   1273 int _bcm_dpp_am_template_vlan_edit_profile_mapping_data_get(int unit,
   1274                                                             SOC_PPC_LIF_ID lif_id, 
   1275                                                             bcm_dpp_vlan_edit_profile_mapping_info_t *mapping_profile);
   1276 
   1277 int _bcm_dpp_am_template_vlan_edit_profile_mapping_data_get_by_template(int unit,
   1278                                                                            int template_id, 
   1279                                                                            bcm_dpp_vlan_edit_profile_mapping_info_t *mapping_profile);
   1280 
   1281 int _bcm_dpp_am_template_vlan_edit_profile_mapping_exchange(int unit, 
   1282                                                             SOC_PPC_LIF_ID lif_id, 
   1283                                                             bcm_dpp_vlan_edit_profile_mapping_info_t *mapping_profile, 
   1284                                                             int *old_profile, 
   1285                                                             int *is_last, 
   1286                                                             int *new_profile,
   1287                                                             int *is_allocated);
   1288 
   1289 int _bcm_dpp_am_template_vlan_edit_profile_mapping_dummy_allocate(int unit, 
   1290                                                             uint32 flags, 
   1291                                                             bcm_dpp_vlan_edit_profile_mapping_info_t *mapping_profile, 
   1292                                                             int *template_id, 
   1293                                                             int *is_allocated);
   1294 
   1295 int _bcm_dpp_am_template_vlan_edit_profile_mapping_free(int unit, SOC_PPC_LIF_ID lif_id, int *old_template,int *is_last);
   1296 
   1297 int _bcm_dpp_am_template_vlan_edit_profile_eg_mapping_init(int unit,
   1298                                                            int template_init_id,
   1299                                                            const bcm_dpp_vlan_egress_edit_profile_info_t *mapping_profile);
   1300 
   1301 int _bcm_dpp_am_template_vlan_edit_profile_eg_mapping_data_get(int unit,
   1302                                                                SOC_PPC_AC_ID out_ac, 
   1303                                                                bcm_dpp_vlan_egress_edit_profile_info_t *mapping_profile);
   1304 
   1305 int _bcm_dpp_am_template_vlan_edit_profile_eg_mapping_data_get_by_template(int unit,
   1306                                                                            int template_id, 
   1307                                                                            bcm_dpp_vlan_egress_edit_profile_info_t *mapping_profile);
   1308 
   1309 
   1310 int _bcm_dpp_am_template_vlan_edit_profile_eg_mapping_exchange(int unit, 
   1311                                                                SOC_PPC_AC_ID out_ac, 
   1312                                                                bcm_dpp_vlan_egress_edit_profile_info_t *mapping_profile, 
   1313                                                                int *old_profile, 
   1314                                                                int *is_last, 
   1315                                                                int *new_profile,
   1316                                                                int *is_allocated);
   1317 /* VLAN Edit Profile mapping - End */
   1318 /* L2 reserved MC - Start */
   1319 
   1320 int _bcm_dpp_am_template_l2_cache_rm_init(int unit,int template_init_id,_bcm_petra_l2_rsrvd_mc_profile_info_t *init_data);
   1321 
   1322 int _bcm_dpp_am_template_l2_cache_rm_data_get(int unit, int port, _bcm_petra_l2_rsrvd_mc_profile_info_t * data);
   1323 
   1324 int _bcm_dpp_am_template_l2_cache_rm_exchange(int unit, int flag,  int port, _bcm_petra_l2_rsrvd_mc_profile_info_t * data, int *old_template, int *is_last, int *template,int *is_allocated);
   1325 int _bcm_dpp_am_template_l2_cache_rm_clear(int unit);
   1326 
   1327 /* L2 reserved MC - End */
   1328 
   1329 /* TPID classify - Start (LLVP PORT profile) */
   1330 int _bcm_dpp_am_template_port_tpid_class_init(int unit,int template_init_id,_bcm_dpp_port_tpid_class_info_t *init_data);
   1331 
   1332 int _bcm_dpp_am_template_port_tpid_class_data_get(int unit, int port, _bcm_dpp_port_tpid_class_info_t * data);
   1333 int _bcm_dpp_am_template_port_tpid_class_eg_data_get(int unit, int port, _bcm_dpp_port_tpid_class_info_t * data);
   1334 
   1335 int _bcm_dpp_am_template_port_tpid_class_exchange(int unit, int flag,  int port, _bcm_dpp_port_tpid_class_info_t * data, int *old_template, int *is_last, int *template,int *is_allocated);
   1336 int _bcm_dpp_am_template_port_tpid_class_clear(int unit);
   1337 int _bcm_dpp_am_template_port_tpid_class_eg_exchange(int unit, int flags, int port, _bcm_dpp_port_tpid_class_info_t * data, int *old_template, int *is_last, int *template,int *is_allocated);
   1338 
   1339 /* TPID classify */
   1340 
   1341 /* tpid egress acceptable frame type - Start */
   1342 
   1343 int _bcm_dpp_am_template_port_tpid_class_egress_acceptable_frame_type_init(int unit,int template_init_id, _bcm_dpp_port_tpid_class_acceptable_frame_type_info_t *init_data);
   1344 
   1345 int _bcm_dpp_am_template_port_tpid_class_egress_acceptable_frame_type_data_get(int unit, int port, _bcm_dpp_port_tpid_class_acceptable_frame_type_info_t *data);
   1346 
   1347 int _bcm_dpp_am_template_port_tpid_class_egress_acceptable_frame_type_exchange(int unit, int flags, int port, _bcm_dpp_port_tpid_class_acceptable_frame_type_info_t *data, int *old_template, int *is_last, int *template,int *is_allocated);
   1348 
   1349 int _bcm_dpp_am_template_port_tpid_class_egress_acceptable_frame_type_clear(int unit);
   1350 
   1351 /* tpid egress classify acceptable frame type  - End */
   1352 
   1353 /* Trap- L2 reserved MC - Start */
   1354 
   1355 int _bcm_dpp_am_template_l2_trap_rm_init(int unit,int template_init_id,bcm_dpp_user_defined_traps_t* init_data);
   1356 
   1357 int _bcm_dpp_am_template_l2_trap_rm_data_get(int unit, int port, int mac_lsb, bcm_dpp_user_defined_traps_t* data);
   1358 
   1359 int _bcm_dpp_am_template_l2_trap_rm_exchange(int unit, int flag, int port, int mac_lsb, bcm_dpp_user_defined_traps_t* data, int *old_template, int *is_last, int *template,int *is_allocated, int flag_with_id);
   1360 
   1361 int _bcm_dpp_am_template_l2_trap_rm_port_profile_mapping_get(int unit, int port, int mac_lsb, int *trap_code);
   1362 
   1363 int _bcm_dpp_am_template_l2_trap_rm_clear(int unit);
   1364 
   1365 /* Trap- L2 reserved MC - end */
   1366 
   1367 /* VSI PROFILE egress - Start */
   1368 int _bcm_dpp_am_template_vsi_egress_profile_init(int unit, bcm_dpp_vsi_egress_profile_t* init_data);
   1369 int _bcm_dpp_am_template_vsi_egress_profile_data_get(int unit, int vsi, bcm_dpp_vsi_egress_profile_t* data);
   1370 int _bcm_dpp_am_template_vsi_egress_profile_mapping_get(int unit, int vsi, int *profile);
   1371 int _bcm_dpp_am_template_vsi_egress_profile_exchange(int unit, int flags, int vsi, bcm_dpp_vsi_egress_profile_t * data,
   1372                                              int *old_template, int *is_last, int *template, int *is_allocated);
   1373 
   1374 /* VSI PROFILE egress - End */
   1375 
   1376 /* L2CP PROFILE egress - Start */
   1377 int _bcm_dpp_am_template_l2cp_egress_profile_init(int unit, bcm_dpp_vsi_egress_profile_t* init_data);
   1378 int _bcm_dpp_am_template_l2cp_egress_profile_mapping_get(int unit, int outlif, int *profile);
   1379 int _bcm_dpp_am_template_l2cp_egress_profile_data_get(int unit, int outlif, bcm_dpp_l2cp_egress_profile_t * data);
   1380 int _bcm_dpp_am_template_l2cp_egress_profile_exchange(int unit, int flags, int outlif, bcm_dpp_l2cp_egress_profile_t * data,
   1381                             int *old_template, int *is_last, int *template, int *is_allocated);
   1382 int _bcm_dpp_am_template_l2cp_egress_profile_clear(int unit);
   1383 
   1384 
   1385 
   1386 /* L2CP PROFILE egress - End */
   1387 
   1388 
   1389 /* VSI PROFILE ingress - Start */
   1390 int _bcm_dpp_am_template_vsi_ingress_profile_init(int unit, bcm_dpp_vsi_ingress_profile_t* init_data);
   1391 int _bcm_dpp_am_template_vsi_ingress_profile_data_get(int unit, int vsi, bcm_dpp_vsi_ingress_profile_t* data);
   1392 int _bcm_dpp_am_template_vsi_ingress_profile_mapping_get(int unit, int vsi, int *profile);
   1393 int _bcm_dpp_am_template_vsi_ingress_profile_exchange(int unit, int flags, int vsi, bcm_dpp_vsi_ingress_profile_t * data,
   1394                                              int *old_template, int *is_last, int *template, int *is_allocated);
   1395 
   1396 /* VSI PROFILE ingress - End */
   1397 
   1398 /* OAM ICC MAP - Start */
   1399 int _bcm_dpp_am_template_oam_icc_map_ndx_alloc(int unit, int flags, SOC_PPC_OAM_ICC_MAP_DATA *data, int *is_allocated, int *icc_ndx);
   1400 int _bcm_dpp_am_template_oam_icc_map_ndx_free(int unit, int icc_ndx, int *is_last);
   1401 /*int _bcm_dpp_am_template_oam_icc_map_ndx_data_get(int unit, int mep_id, SOC_PPC_OAM_ICC_MAP_DATA* data);
   1402 int _bcm_dpp_am_template_oam_icc_map_ndx_get(int unit, int mep_id, int *icc_map_reg_index);
   1403 int _bcm_dpp_am_template_oam_icc_map_ndx_exchange(int unit, int flags, int mep_id, SOC_PPC_OAM_ICC_MAP_DATA * data,
   1404                                              int *old_icc_ndx, int *is_last, int *icc_ndx, int *is_allocated);*/
   1405 /* OAM ICC MAP - End */
   1406 
   1407 
   1408 /* OAM SA MAC address (Jericho)*/
   1409 int _bcm_dpp_am_template_oam_sa_mac_address_alloc(int unit, int flags, uint8 *data, int *is_allocated, int *profile);
   1410 int _bcm_dpp_am_template_oam_sa_mac_address_free(int unit, int profile, int *is_last);
   1411 int _bcm_dpp_am_template_oam_sa_mac_address_get(int unit, int profile, uint8* data);
   1412 
   1413 
   1414 /* OAMP punt event hendling profile - Start */
   1415 int _bcm_dpp_am_template_oam_punt_event_hendling_profile_alloc(int unit, int flags, SOC_PPC_OAM_OAMP_PUNT_PROFILE_DATA *data, int *is_allocated, int *profile);
   1416 int _bcm_dpp_am_template_oam_punt_event_hendling_profile_free(int unit, int profile, int *is_last);
   1417 /* OAMP punt event hendling profile - End */
   1418 
   1419 
   1420 /* BFD Flags - Start */  
   1421 int _bcm_dpp_am_template_bfd_flags_profile_alloc(int unit, int flags, const uint32 *data, int *is_allocated, int *profile_ndx); 
   1422 int _bcm_dpp_am_template_bfd_flags_profile_free(int unit, int profile_ndx, int *is_last); 
   1423 int _bcm_dpp_am_template_bfd_flags_profile_data_get(int unit, int profile_ndx, uint32 * data);
   1424 /* BFD Flags - End */
   1425 
   1426 /* OAM mep profile non accelerated - Start */
   1427 int _bcm_dpp_am_template_oam_mep_profile_non_accelerated_alloc(int unit, int flags, SOC_PPC_OAM_LIF_PROFILE_DATA *data, int *is_allocated, int *profile);
   1428 int _bcm_dpp_am_template_oam_mep_profile_non_accelerated_free(int unit, int profile, int *is_last);
   1429 int _bcm_dpp_am_template_oam_mep_profile_non_accelerated_data_get(int unit, int mep_id, uint8 is_passive, SOC_PPC_OAM_LIF_PROFILE_DATA* data);
   1430 int _bcm_dpp_am_template_oam_mep_profile_data_validate(int unit, int mep_id, uint8 is_passive, SOC_PPC_OAM_LIF_PROFILE_DATA* data, int *valid);
   1431 int _bcm_dpp_am_template_oam_mep_profile_non_accelerated_data_from_profile_get(int unit, int profile, SOC_PPC_OAM_LIF_PROFILE_DATA* data);
   1432 int _bcm_dpp_am_template_oam_mep_profile_non_accelerated_mapping_get(int unit, int mep_id, int is_passive, int *profile);
   1433 int _bcm_dpp_am_template_oam_mep_profile_non_accelerated_exchange(int unit, int flags, int mep_id, int is_passive, SOC_PPC_OAM_LIF_PROFILE_DATA * data,
   1434                                              int *old_profile, int *is_last, int *profile, int *is_allocated);
   1435 /* OAM mep profile non accelerated - End */
   1436 
   1437 /* OAM mep profile accelerated - Start */
   1438 int _bcm_dpp_am_template_oam_mep_profile_accelerated_alloc(int unit, int flags, SOC_PPC_OAM_LIF_PROFILE_DATA *data, int *is_allocated, int *profile);
   1439 int _bcm_dpp_am_template_oam_mep_profile_accelerated_free(int unit, int profile, int *is_last);
   1440 int _bcm_dpp_am_template_oam_mep_profile_accelerated_data_get(int unit, int mep_id, SOC_PPC_OAM_LIF_PROFILE_DATA* data);
   1441 int _bcm_dpp_am_template_oam_mep_profile_accelerated_mapping_get(int unit, int mep_id, int *profile);
   1442 int _bcm_dpp_am_template_oam_mep_profile_accelerated_exchange(int unit, int flags, int mep_id, SOC_PPC_OAM_LIF_PROFILE_DATA * data,
   1443                                              int *old_profile, int *is_last, int *profile, int *is_allocated);
   1444 /* OAM mep profile accelerated - End */
   1445 
   1446 /* BFD mep profile non accelerated - Start */
   1447 int _bcm_dpp_am_template_bfd_mep_profile_non_accelerated_alloc(int unit, int flags, SOC_PPC_OAM_LIF_PROFILE_DATA *data, int *is_allocated, int *profile);
   1448 int _bcm_dpp_am_template_bfd_mep_profile_non_accelerated_free(int unit, int profile, int *is_last);
   1449 int _bcm_dpp_am_template_bfd_mep_profile_non_accelerated_data_get(int unit, int mep_id, SOC_PPC_OAM_LIF_PROFILE_DATA* data);
   1450 int _bcm_dpp_am_template_bfd_mep_profile_non_accelerated_mapping_get(int unit, int mep_id, int *profile);
   1451 int _bcm_dpp_am_template_bfd_mep_profile_non_accelerated_exchange(int unit, int flags, int mep_id, SOC_PPC_OAM_LIF_PROFILE_DATA * data,
   1452                                              int *old_profile, int *is_last, int *profile, int *is_allocated);
   1453 /* BFD mep profile non accelerated - End */
   1454 
   1455 /* BFD mep profile accelerated - Start */
   1456 int _bcm_dpp_am_template_bfd_mep_profile_accelerated_alloc(int unit, int flags, SOC_PPC_OAM_LIF_PROFILE_DATA *data, int *is_allocated, int *profile);
   1457 int _bcm_dpp_am_template_bfd_mep_profile_accelerated_free(int unit, int profile, int *is_last);
   1458 int _bcm_dpp_am_template_bfd_mep_profile_accelerated_data_get(int unit, int mep_id, SOC_PPC_OAM_LIF_PROFILE_DATA* data);
   1459 int _bcm_dpp_am_template_bfd_mep_profile_accelerated_data_from_profile_get(int unit, int profile, SOC_PPC_OAM_LIF_PROFILE_DATA* data);
   1460 int _bcm_dpp_am_template_bfd_mep_profile_accelerated_mapping_get(int unit, int mep_id, int *profile);
   1461 int _bcm_dpp_am_template_bfd_mep_profile_accelerated_exchange(int unit, int flags, int mep_id, SOC_PPC_OAM_LIF_PROFILE_DATA * data,
   1462                                              int *old_profile, int *is_last, int *profile, int *is_allocated);
   1463 /* BFD mep profile accelerated - End */
   1464 
   1465 /* OAM Priority - Start */
   1466 int _bcm_dpp_am_template_oam_tx_priority_alloc(int unit, int flags, const SOC_PPC_OAMP_TX_ITMH_ATTRIBUTES *data, int *is_allocated, int *profile_ndx);
   1467 int _bcm_dpp_am_template_oam_tx_priority_free(int unit, int profile_ndx, int *is_last);
   1468 int _bcm_dpp_am_template_oam_tx_priority_data_get(int unit, int profile_ndx, SOC_PPC_OAMP_TX_ITMH_ATTRIBUTES* data);
   1469 int _bcm_dpp_am_template_oam_tx_priority_exchange(int unit, int flags, const SOC_PPC_OAMP_TX_ITMH_ATTRIBUTES *data, int *is_allocated, int *profile_ndx, int old_profile_ndx, int *is_last);
   1470 /* OAM Priority - End */
   1471 
   1472 /* BFD IPV4 DIP - Start */
   1473 int _bcm_dpp_am_template_bfd_ip_dip_alloc(int unit, int flags, const SOC_SAND_PP_IPV6_ADDRESS *data, int *is_allocated, int *profile_ndx);
   1474 int _bcm_dpp_am_template_bfd_ip_dip_free(int unit, int profile_ndx, int *is_last);
   1475 int _bcm_dpp_am_template_bfd_ip_dip_data_get(int unit, int profile_ndx, SOC_SAND_PP_IPV6_ADDRESS* data);
   1476 /* BFD IPV4 DIP - End */
   1477 
   1478 /* BFD Push profile - Start */
   1479 int _bcm_dpp_am_template_mpls_pwe_push_profile_alloc(int unit, int flags, const SOC_PPC_MPLS_PWE_PROFILE_DATA *data, int *is_allocated, int *mpls_pwe_profile);
   1480 int _bcm_dpp_am_template_mpls_pwe_push_profile_data_get(int unit, int mpls_pwe_profile, SOC_PPC_MPLS_PWE_PROFILE_DATA* data);
   1481 int _bcm_dpp_am_template_mpls_pwe_push_profile_free(int unit, int mpls_pwe_profile, int *is_last);
   1482 /* BFD Push profile - End */
   1483 
   1484 /* BFD Req interval pointer - Start */
   1485 int _bcm_dpp_am_template_bfd_req_interval_pointer_alloc(int unit, int flags, const uint32 *data, int *is_allocated, int *rx_rate_pointer);
   1486 int _bcm_dpp_am_template_bfd_req_interval_pointer_data_get(int unit, int rx_rate_pointer, uint32* data);
   1487 int _bcm_dpp_am_template_bfd_req_interval_pointer_free(int unit, int rx_rate_pointer, int *is_last);
   1488 /* BFD Req interval pointer - End */
   1489 
   1490 /* BFD TOS TTL profile - Start */
   1491 int _bcm_dpp_am_template_bfd_tos_ttl_profile_alloc(int unit, int flags, const SOC_PPC_BFD_IP_MULTI_HOP_TOS_TTL_DATA *data, int *is_allocated, int *tos_ttl_profile);
   1492 int _bcm_dpp_am_template_bfd_tos_ttl_profile_data_get(int unit, int tos_ttl_profile, SOC_PPC_BFD_IP_MULTI_HOP_TOS_TTL_DATA* data);
   1493 int _bcm_dpp_am_template_bfd_tos_ttl_profile_free(int unit, int tos_ttl_profile, int *is_last);
   1494 /* BFD TOS TTL profile - End */
   1495 
   1496 /* BFD src ip profile - Start */ 
   1497 int _bcm_dpp_am_template_bfd_src_ip_profile_alloc(int unit, int flags, const uint32 *data, int *is_allocated, int *src_ip_add_profile);
   1498 int _bcm_dpp_am_template_bfd_src_ip_profile_data_get(int unit, int src_ip_add_profile, uint32* data);
   1499 int _bcm_dpp_am_template_bfd_src_ip_profile_free(int unit, int src_ip_add_profile, int *is_last);
   1500 /* BFD src ip profile - End */
   1501 
   1502 /* oamp_pe_gen_mem MAID48 - Start */
   1503 int _bcm_dpp_am_template_oamp_pe_gen_mem_maid48_alloc(int unit, int flags, uint8 *data, int *is_allocated, int *maid_48);
   1504 int _bcm_dpp_am_template_oamp_pe_gen_mem_maid48_data_get(int unit, int maid_48, uint8* data);
   1505 int _bcm_dpp_am_template_oamp_pe_gen_mem_maid48_free(int unit, int maid_48, int *is_last);
   1506 /* oamp_pe_gen_mem MAID48 - End */
   1507 
   1508 /* OAM Local port to system port */
   1509 int _bcm_dpp_am_template_oam_local_port_2_sys_port_alloc(int unit, int flags, const uint32* data, int *is_allocated, int *profile_ndx);
   1510 int _bcm_dpp_am_template_oam_local_port_2_sys_port_data_get(int unit, int local_port, uint32 *data);
   1511 /** Delete by MEP-ID. MEP-DB entry must be active. */
   1512 int _bcm_dpp_am_template_oam_local_port_2_sys_port_free(int unit, int profile, int *is_last);
   1513 
   1514 /* OAM OAMP PE gen memory. Used by server.*/
   1515 /** MEP_DB.local_port is the profile, 
   1516     but the actual data of MEP_DB.local_port is the src mac address LSB.
   1517     The data returned here is the actual local port.*/
   1518 int _bcm_dpp_am_template_oam_oamp_pe_gen_mem_alloc(int unit, int flags, const uint32* data, int *is_allocated, int *profile_ndx);
   1519 int _bcm_dpp_am_template_oam_oamp_pe_gen_mem_data_get(int unit, int local_port, uint32 *data); 
   1520 /** Delete by MEP-ID. MEP-DB entry must be active. */
   1521 int _bcm_dpp_am_template_oam_oamp_pe_gen_mem_free(int unit, int mep_id, int *is_last);
   1522 
   1523 
   1524 
   1525 /*OAM - manage LMM  DA NIC tables, ARAD+, start. */
   1526 int _bcm_dpp_am_template_oam_lmm_nic_tables_alloc(int unit, int flags, uint32* lsbytes, int *is_allocated, int *profile_ndx);
   1527 /**   Profiles are found by endpoint_id. profile_ndx returns
   1528  *    the profile used in the HW. */
   1529 int _bcm_dpp_am_template_oam_lmm_nic_tables_free(int unit, int mep_id, int *profile_ndx, int *is_last);
   1530 int _bcm_dpp_am_template_oam_lmm_nic_tables_get(int unit, int mep_id, int *profile_ndx, uint32* lsbytes);
   1531 /*OAM - manage LMM  DA NIC tables, ARAD+, end */
   1532 
   1533 /*OAM - manage LMM  DA OUI tables, ARAD+, start */
   1534 int _bcm_dpp_am_template_oam_lmm_oui_tables_alloc(int unit, int flags, uint32* msbytes, int *is_allocated, int *profile_ndx);
   1535 /**   Profiles are found by endpoint_id. profile_ndx returns
   1536  *    the profile used in the HW. */
   1537 int _bcm_dpp_am_template_oam_lmm_oui_tables_free(int unit, int mep_id, int *profile_ndx, int *is_last);
   1538 int _bcm_dpp_am_template_oam_lmm_oui_tables_get(int unit, int mep_id, int *profile_ndx, uint32* msbytes);
   1539 /*OAM - manage LMM  DA OUI tables, ARAD+, end */
   1540 
   1541 /*OAM - manage LMM/DMM mep profile, ARAD+, start */
   1542 
   1543 /* alloc function for each component that uses the mep profile*/
   1544 
   1545 int _bcm_dpp_am_template_oam_eth1731_mep_profile_alloc(int unit, SOC_PPC_OAM_ETH1731_MEP_PROFILE_ENTRY* data,int flags, int *is_allocated, int *profile_ndx);
   1546 int _bcm_dpp_am_template_oam_eth_1731_mep_profile_RDI_alloc(int unit,SOC_PPC_OAM_ETH1731_MEP_PROFILE_ENTRY *data  , int *is_allocated, int *profile_ndx);
   1547 /* Two modes for the following functions:
   1548    is_first==1 : an entry with only relevant fields matching will be found.
   1549    is_first==0 : data will be updated to reflect changes inserted by other components.
   1550    Either case only relevant  fields (including lmm_da_out_prof) must be properly set in advanced.*/
   1551 int _bcm_dpp_am_template_oam_eth_1731_mep_profile_loss_alloc(int unit, int mep_id,SOC_PPC_OAM_ETH1731_MEP_PROFILE_ENTRY *data , int *is_allocated, int *profile_ndx, 
   1552                                                              int *old_profile, int *is_last, int is_first, uint8 is_scan_count_updated);
   1553 int _bcm_dpp_am_template_oam_eth_1731_mep_profile_delay_alloc(int unit, int mep_id ,SOC_PPC_OAM_ETH1731_MEP_PROFILE_ENTRY *data, int *is_allocated, int *profile_ndx, 
   1554                                                              int *old_profile, int *is_last , int is_first, uint8 is_scan_count_update);
   1555 int _bcm_oam_am_template_oam_eth_1731_mep_profile_loopback_alloc(int unit, int mep_id ,SOC_PPC_OAM_ETH1731_MEP_PROFILE_ENTRY *data, int *is_allocated, int *profile_ndx, 
   1556                                                              int *old_profile, int *is_last, int is_first, uint8 is_scan_count_update);
   1557 
   1558 int _bcm_dpp_am_template_oam_eth1731_mep_profile_free(int unit,int mep_id,  int *profile_ndx, int *is_last);
   1559 int _bcm_dpp_am_template_oam_eth1731_mep_profile_get(int unit , int mep_id , int* profile_ndx,SOC_PPC_OAM_ETH1731_MEP_PROFILE_ENTRY* data);
   1560 int _bcm_dpp_am_template_oam_eth1731_mep_profile_exchange(int unit,  int old_profile_indx,SOC_PPC_OAM_ETH1731_MEP_PROFILE_ENTRY* data, int *is_allocated,int *is_last, int *profile_ndx);
   1561 /*OAM - manage LMM/DMM mep profile, ARAD+, start */
   1562 
   1563 
   1564 /* Prog Trap - Start */
   1565 int _bcm_dpp_am_template_l2_prog_trap_init(int unit,int template_init_id,SOC_PPC_LLP_TRAP_PROG_TRAP_QUALIFIER *init_data);
   1566 int _bcm_dpp_am_template_l2_prog_trap_data_get(int unit, int port, int type, SOC_PPC_LLP_TRAP_PROG_TRAP_QUALIFIER *qual, bcm_dpp_user_defined_traps_t *trap_res);
   1567 int _bcm_dpp_am_template_l2_prog_trap_alloc(int unit, int flags, SOC_PPC_LLP_TRAP_PROG_TRAP_QUALIFIER *qual, bcm_dpp_user_defined_traps_t *trap_res, int *template,int *is_allocated, bcm_dpp_rx_virtual_traps_t *virtual_traps_p, int is_virtual_traps_p_set);
   1568 int _bcm_dpp_am_template_l2_prog_trap_free(int unit, int is_virtual_traps_p_set, int type, int *template, int *is_last);
   1569 int _bcm_dpp_am_template_l2_prog_trap_ppc_index_get(int unit, int type, int *trap_index);
   1570 int _bcm_dpp_am_template_l2_prog_trap_clear(int unit);
   1571 
   1572 /* Prog Trap - End */
   1573 
   1574 /* L2, VSI/FID --> event-handle-profile --> handle info (BCM_L2_ADDR_DIST_XXX flags) - Start */
   1575 int _bcm_dpp_am_template_l2_event_handle_init(int unit,int event_handle, int init_handle_flags);
   1576 int _bcm_dpp_am_template_l2_event_handle_fid_profile_mapping_get(int unit, int vsi, int *event_handle_profile);
   1577 int _bcm_dpp_am_template_l2_event_handle_data_get(int unit, int vsi, int *handle_flags);
   1578 int _bcm_dpp_am_template_l2_event_handle_exchange(int unit, int flags, int vsi, int handle_flags, int *old_template, int *is_last, int *new_profile,int *is_allocated);
   1579 int _bcm_dpp_am_template_l2_event_handle_clear(int unit);
   1580 /* L2, FID-profile --> even-handle-profile --> handle info (BCM_L2_ADDR_DIST_XXX flags) - End */
   1581 
   1582 
   1583 /* L2, VSI/FID --> learn-profile --> <even-handle-profile, limit> - Start */
   1584 int _bcm_dpp_am_template_l2_learn_profile_init(int unit,int learn_profile_id, int limit, int event_handle_profile, int fid_aging_profile);
   1585 int _bcm_dpp_am_template_l2_learn_profile_mapping_get(int unit, int vsi, int *learn_profile);
   1586 int _bcm_dpp_am_template_l2_learn_limit_active(int unit, int *is_active);
   1587 int _bcm_dpp_am_template_l2_learn_profile_data_get(int unit, int vsi, int *limit, int *event_handle_profile, int *fid_aging_profile);
   1588 int _bcm_dpp_am_template_l2_learn_profile_exchange(int unit, int flags, int vsi, int limit,int event_handle_profile, int fid_aging_profile, int *old_template, int *is_last, int *new_profile,int *is_allocated);
   1589 int _bcm_dpp_am_template_l2_learn_profile_clear(int unit);
   1590 /* L2, VSI/FID --> learn-profile --> <even-handle-profile, limit> - End */
   1591 
   1592 /* L2, VSI/FID --> fid-aging-profile -->  - Start */
   1593 /* L2, FID-profile --> fid-aging-profile --> aging info (BCM_L2_ADDR_DIST_XXX flags) - End */
   1594 
   1595 /* Ingress queue rate class - Start */
   1596 int _bcm_dpp_am_template_queue_rate_cls_init(int unit,int template_init_id,const bcm_dpp_cosq_ingress_rate_class_info_t* data_rate_cls);
   1597 int _bcm_dpp_am_template_queue_rate_cls_data_get(int unit, int core, int queue,bcm_dpp_cosq_ingress_rate_class_info_t * data_rate_cls);
   1598 int _bcm_dpp_am_template_queue_rate_cls_exchange(int unit, int core, int queue, bcm_dpp_cosq_ingress_rate_class_info_t * data_rate_cls, int *old_rate_cls, int *is_last, int *new_rate_cls,int *is_allocated);
   1599 int _bcm_dpp_am_template_queue_rate_cls_exchange_test(int unit, int core, int queue, bcm_dpp_cosq_ingress_rate_class_info_t * data_rate_cls, int *old_rate_cls, int *is_last, int *new_rate_cls,int *is_allocated);
   1600 int _bcm_dpp_am_template_queue_rate_cls_ref_get(int unit, int template, uint32 *ref_count);
   1601 int _bcm_dpp_am_template_queue_rate_cls_allocate_group(int unit, uint32 flags, bcm_dpp_cosq_ingress_rate_class_info_t *data_rate_cls, int ref_count, int *is_allocated, int *template);
   1602 int _bcm_dpp_am_template_queue_rate_cls_tdata_get(int unit, int template, bcm_dpp_cosq_ingress_rate_class_info_t *data_rate_cls);
   1603 
   1604 /* Ingress queue rate class - End */
   1605 
   1606 
   1607 /* VSQ PG TC mapping profile - Start */
   1608 int _bcm_dpp_am_template_vsq_pg_tc_mapping_profile_init(int unit, int core_id, uint32 pg_tc_bitmap);
   1609 int _bcm_dpp_am_template_vsq_pg_tc_mapping_profile_data_get(int unit, int core_id, int pg_tc_profile, uint32 *pg_tc_bitmap);
   1610 int _bcm_dpp_am_template_vsq_pg_tc_mapping_exchange(int unit, int core_id, uint32 pg_tc_bitmap, int old_pg_tc_profile, int *is_last, int *new_pg_tc_profile,int *is_allocated);
   1611 /* VSQ PG TC mapping profile - End*/
   1612 
   1613 /* VSQ queue rate class - Start */
   1614 
   1615 int _bcm_dpp_am_template_vsq_rate_cls_init(int unit,int template_init_id,const bcm_dpp_cosq_vsq_rate_class_info_t* data_rate_cls);
   1616 int _bcm_dpp_am_template_vsq_rate_cls_data_get(int unit, int core_id, int vsq_id, bcm_dpp_cosq_vsq_rate_class_info_t * data_rate_cls);
   1617 int _bcm_dpp_am_template_vsq_rate_cls_exchange(int unit, int core_id, int vsq_id, bcm_dpp_cosq_vsq_rate_class_info_t * data_rate_cls, int *old_rate_cls, int *is_last, int *new_rate_cls,int *is_allocated);
   1618 int _bcm_dpp_am_template_vsq_rate_cls_ref_get(int unit, int template, SOC_TMC_ITM_VSQ_GROUP vsq_group, uint32 *ref_count);
   1619 int _bcm_dpp_am_template_vsq_rate_cls_allocate_group(int unit, uint32 flags, SOC_TMC_ITM_VSQ_GROUP vsq_group, bcm_dpp_cosq_vsq_rate_class_info_t *data_rate_cls, int ref_count, int *is_allocated, int *template);
   1620 int _bcm_dpp_am_template_vsq_rate_cls_tdata_get(int unit, int template, SOC_TMC_ITM_VSQ_GROUP vsq_group, bcm_dpp_cosq_vsq_rate_class_info_t *data_rate_cls);
   1621 
   1622 /* VSQ queue rate class - End */
   1623 
   1624 /* System RED drop probability value class - Start */
   1625 
   1626 int _bcm_dpp_am_template_system_red_dp_pr_init(int unit,int template_init_id,const bcm_dpp_cosq_ingress_system_red_dp_pr_info_t* data_sys_red_dp_pr);
   1627 int _bcm_dpp_am_template_system_red_dp_pr_data_get(int unit,int dp_pr,bcm_dpp_cosq_ingress_system_red_dp_pr_info_t * data_sys_red_dp_pr);
   1628 int _bcm_dpp_am_template_system_red_dp_pr_exchange(int unit, int dp_pr, bcm_dpp_cosq_ingress_system_red_dp_pr_info_t *data_sys_red_dp_pr, int *old_sys_red_dp_pr, int *is_last, int *new_sys_red_dp_pr,int *is_allocated);
   1629 int _bcm_dpp_am_template_system_red_dp_pr_ref_get(int unit, int template, uint32 *ref_count);
   1630 int _bcm_dpp_am_template_system_red_dp_pr_allocate_group(int unit, uint32 flags, bcm_dpp_cosq_ingress_system_red_dp_pr_info_t *data_sys_red_dp_pr, int ref_count, int *is_allocated, int *template);
   1631 int _bcm_dpp_am_template_system_red_dp_pr_tdata_get(int unit, int template, bcm_dpp_cosq_ingress_system_red_dp_pr_info_t *data_sys_red_dp_pr);
   1632 
   1633 /* System RED drop probability value class - End */
   1634 
   1635 
   1636 /* Ingress queue discount class - Start */
   1637 
   1638 int _bcm_dpp_am_template_queue_discount_cls_init(int unit, int template_init_id,const SOC_TMC_ITM_CR_DISCOUNT_INFO* data_discount_cls);
   1639 int _bcm_dpp_am_template_queue_discount_cls_mapping_get(int unit, int core, int queue, int *discount_cls);
   1640 int _bcm_dpp_am_template_queue_discount_cls_data_get(int unit, int core, int queue,SOC_TMC_ITM_CR_DISCOUNT_INFO * data_discount_cls);
   1641 int _bcm_dpp_am_template_queue_discount_cls_exchange(int unit, int core, int queue, SOC_TMC_ITM_CR_DISCOUNT_INFO * data_discount_cls, int *old_discount_cls, int *is_last, int *new_discount_cls,int *is_allocated);
   1642 int _bcm_dpp_am_template_queue_discount_cls_ref_get(int unit, int core, int template, uint32 *ref_count);
   1643 int _bcm_dpp_am_template_queue_discount_cls_allocate_group(int unit, int core, uint32 flags, SOC_TMC_ITM_CR_DISCOUNT_INFO *data_discount_cls, int ref_count, int *is_allocated, int *template);
   1644 int _bcm_dpp_am_template_queue_discount_cls_tdata_get(int unit, int core, int template, SOC_TMC_ITM_CR_DISCOUNT_INFO *data_discount_cls);
   1645 
   1646 /* Ingress queue discount class - End */
   1647 
   1648 /* Ingress pp port discount class - Start */
   1649 
   1650 int _bcm_dpp_am_template_pp_port_discount_cls_init(int unit, int template_init_id,const SOC_TMC_ITM_CR_DISCOUNT_INFO* data_discount_cls);
   1651 int _bcm_dpp_am_template_pp_port_discount_cls_mapping_get(int unit, int core, int port, int *discount_cls);
   1652 int _bcm_dpp_am_template_pp_port_discount_cls_data_get(int unit, int core, int port,SOC_TMC_ITM_CR_DISCOUNT_INFO * data_discount_cls);
   1653 int _bcm_dpp_am_template_pp_port_discount_cls_exchange(int unit, int core, int port, SOC_TMC_ITM_CR_DISCOUNT_INFO * data_discount_cls, int *old_discount_cls, int *is_last, int *new_discount_cls,int *is_allocated);
   1654 int _bcm_dpp_am_template_pp_port_discount_cls_ref_get(int unit, int core, int template, uint32 *ref_count);
   1655 int _bcm_dpp_am_template_pp_port_discount_cls_allocate_group(int unit, int core, uint32 flags, SOC_TMC_ITM_CR_DISCOUNT_INFO *data_discount_cls, int ref_count, int *is_allocated, int *template);
   1656 int _bcm_dpp_am_template_pp_port_discount_cls_tdata_get(int unit, int core, int template, SOC_TMC_ITM_CR_DISCOUNT_INFO *data_discount_cls);
   1657 
   1658 /* Ingress pp port discount class - End */
   1659 
   1660 /* Egress port discount class - Start */
   1661 int _bcm_dpp_am_template_egress_port_discount_cls_free(int unit, int core, uint32 tm_port, int* is_last);
   1662 int _bcm_dpp_am_template_egress_port_discount_cls_init(int unit, int core, uint32 tm_port, const SOC_TMC_PORT_EGR_HDR_CR_DISCOUNT_INFO* data_discount_cls);
   1663 int _bcm_dpp_am_template_egress_port_discount_cls_data_get(int unit,int core, uint32 tm_port, SOC_TMC_PORT_EGR_HDR_CR_DISCOUNT_INFO * data_discount_cls);
   1664 int _bcm_dpp_am_template_egress_port_discount_cls_exchange(int unit, int core, uint32 tm_port, SOC_TMC_PORT_EGR_HDR_CR_DISCOUNT_INFO * data_discount_cls, int *old_discount_cls, int *is_last, int *new_discount_cls,int *is_allocated);
   1665 /* int _bcm_dpp_am_template_egress_port_discount_cls_ref_get(int unit, int template, uint32 *ref_count); */
   1666 int _bcm_dpp_am_template_egress_port_discount_cls_per_header_type_ref_get(int unit, int core, int template , SOC_TMC_PORT_HEADER_TYPE header_type ,uint32 *ref_count);
   1667 /* int _bcm_dpp_am_template_egress_port_discount_cls_allocate_group(int unit, uint32 flags, SOC_TMC_PORT_EGR_HDR_CR_DISCOUNT_INFO *data_discount_cls, int ref_count, int *is_allocated, int *template); */
   1668 /* int _bcm_dpp_am_template_egress_port_discount_cls_tdata_get(int unit, int template, SOC_TMC_PORT_EGR_HDR_CR_DISCOUNT_INFO *data_discount_cls); */
   1669 int _bcm_dpp_am_template_egress_port_discount_cls_per_header_type_tdata_get(int unit, int core, int template, SOC_TMC_PORT_HEADER_TYPE header_type, SOC_TMC_PORT_EGR_HDR_CR_DISCOUNT_INFO *data_discount_cls);
   1670 
   1671 /* Egress port discount class - End */
   1672 
   1673 /* COSQ Port hr flow control profile - Start */
   1674 
   1675 int _bcm_dpp_am_template_cosq_port_hr_fc_profile_mapping_set(int unit, int core, int port, int profile);
   1676 int _bcm_dpp_am_template_cosq_port_hr_fc_init(int unit, int core, int template_init_id, int *fc_data_init);
   1677 
   1678 int _bcm_dpp_am_template_cosq_port_hr_fc_data_get(int unit, int core, int port, int *data);
   1679 
   1680 int _bcm_dpp_am_template_cosq_port_hr_fc_exchange(int unit, int core, int port, int *data, int *old_template, int *is_last, int *template, int *is_allocated);
   1681 
   1682 int _bcm_dpp_am_template_cosq_hr_fc_ref_get(int unit, int core, int template, uint32 *ref_count);
   1683 
   1684 int _bcm_dpp_am_template_cosq_hr_fc_allocate_group(int unit, int core, uint32 flags, int *data, int ref_count, int *is_allocated, int *template);
   1685 
   1686 /* COSQ Port Hr flow control profile - End */
   1687 
   1688 
   1689 /* COSQ CL scheduler profile - Start */
   1690 
   1691 int _bcm_dpp_am_template_cosq_sched_class_init(int unit);
   1692 
   1693 int _bcm_dpp_am_template_cosq_sched_class_allocate(int unit, int core, int flags, int *data, int *is_allocated, int *class_template);
   1694 
   1695 int _bcm_dpp_am_template_cosq_sched_class_free(int unit, int core, int class_template, int *is_last);
   1696 
   1697 int _bcm_dpp_am_template_cosq_sched_class_data_get(int unit, int core, int class_template, int *data);
   1698 
   1699 int _bcm_dpp_am_template_cosq_sched_class_exchange(int unit, int core, int flags,int *data, int old_class_template, int *is_last, int *class_template, int *is_allocated);
   1700 
   1701 int _bcm_dpp_am_template_cosq_sched_class_ref_get(int unit, int core, int template, uint32 *ref_count);
   1702 
   1703 int _bcm_dpp_am_template_cosq_sched_class_allocate_group(int unit, int core, uint32 flags, int *data, int ref_count, int *is_allocated, int *template);
   1704 
   1705 /* COSQ CL scheduler profile - End */
   1706 
   1707 
   1708 /* MPLS push profile - Start */
   1709 int _bcm_dpp_am_template_mpls_push_profile_exchange(int unit, int push_profile, SOC_PPC_EG_ENCAP_PUSH_PROFILE_INFO *push_profile_info,  int *is_last, int *new_push_profile,int *is_allocated, uint8 with_id);
   1710 int _bcm_dpp_am_template_mpls_push_profile_free(int unit, int push_profile, int *is_last);
   1711 int _bcm_dpp_am_template_mpls_push_profile_is_profile_allocated(int unit, int profile, int *is_allocated);
   1712 /* MPLS push profile - End */
   1713 
   1714 /* LIF term profile - Start */
   1715 int _bcm_dpp_am_template_lif_term_init(int unit,int template_init_id,const SOC_PPC_MPLS_TERM_PROFILE_INFO* term_profile);
   1716 int _bcm_dpp_am_template_lif_term_data_get(int unit, SOC_PPC_LIF_ID lif_id, SOC_PPC_MPLS_TERM_PROFILE_INFO *term_profile_info);
   1717 int _bcm_dpp_am_template_lif_term_profile_exchange(int unit, SOC_PPC_LIF_ID lif_id, int is_pwe_lif, SOC_PPC_MPLS_TERM_PROFILE_INFO *term_profile_info,  int *old_template, int *is_last, int *new_term_profile,int *is_allocated);
   1718 /* LIF term profile - End */
   1719 
   1720 /* SA drop profile - Start */
   1721 int _bcm_dpp_am_template_port_mact_sa_drop_init(int unit,int template_init_id,const _bcm_petra_port_mact_mgmt_action_profile_t* action_profile);
   1722 int _bcm_dpp_am_template_port_mact_sa_drop_data_get(int unit,int core_id,int port,_bcm_petra_port_mact_mgmt_action_profile_t* action_profile);
   1723 int _bcm_dpp_am_template_port_mact_sa_drop_exchange(int unit, int core_id, int port, _bcm_petra_port_mact_mgmt_action_profile_t* action_profile, int *old_template, int *is_last, int *new_template,int *is_allocated);
   1724 /* SA drop profile - End */
   1725 
   1726 /* DA unknown profile - Start */
   1727 int _bcm_dpp_am_template_port_mact_da_unknown_init(int unit,int template_init_id,const _bcm_petra_port_mact_mgmt_action_profile_t* action_profile);
   1728 int _bcm_dpp_am_template_port_mact_da_unknown_data_get(int unit,int core_id, int port,_bcm_petra_port_mact_mgmt_action_profile_t* action_profile);
   1729 int _bcm_dpp_am_template_port_mact_da_unknown_exchange(int unit, int core_id, int port, _bcm_petra_port_mact_mgmt_action_profile_t* action_profile, int *old_template, int *is_last, int *new_template,int *is_allocated);
   1730 /* SA drop profile - End */
   1731 
   1732 /* meter profile - Start */
   1733 int _bcm_dpp_am_template_meter_init(int unit, int template_init_id, bcm_dpp_am_meter_entry_t *meter_profile_info);
   1734 int _bcm_dpp_am_template_meter_data_get(int unit,int core_id, int meter_profile,int group, bcm_dpp_am_meter_entry_t *meter_profile_info);
   1735 int _bcm_dpp_am_template_meter_exchange(int unit, int core_id, int meter_profile, int group, bcm_dpp_am_meter_entry_t *meter_profile_info,  int *is_last, int *new_meter_profile, int change_profile, int *is_allocated);
   1736 /* meter profile - End */
   1737 
   1738 
   1739 /* Fabric TDM direct routing - Start */
   1740 int _bcm_dpp_am_template_fabric_tdm_link_ptr_init(int unit,int template_init_id,const SOC_TMC_TDM_DIRECT_ROUTING_INFO* routing_info);
   1741 int _bcm_dpp_am_template_fabric_tdm_link_ptr_data_get(int unit,int port,SOC_TMC_TDM_DIRECT_ROUTING_INFO* routing_info);
   1742 int _bcm_dpp_am_template_fabric_tdm_link_ptr_exchange(int unit, int port, SOC_TMC_TDM_DIRECT_ROUTING_INFO * routing_info, int *old_link_ptr, int *is_last, int *new_link_ptr,int *is_allocated);
   1743 /* Fabric TDM direct routing - End */
   1744 
   1745 /* L2 flooding per LIF - start */
   1746 int _bcm_dpp_am_template_l2_flooding_init(int unit,int template_init_id,const bcm_dpp_vlan_flooding_profile_info_t* flooding_info);
   1747 int _bcm_dpp_am_template_l2_flooding_data_get(int unit, SOC_PPC_LIF_ID lif_index, bcm_dpp_vlan_flooding_profile_info_t* flooding_info);
   1748 int _bcm_dpp_am_template_l2_flooding_exchange(int unit, SOC_PPC_LIF_ID lif_index, bcm_dpp_vlan_flooding_profile_info_t* flooding_info, int *old_template, int *is_last, int *new_template,int *is_allocated);
   1749 /* L2 flooding per LIF - end */
   1750 
   1751 /* Port protocol to vlan,tc - start */
   1752 int _bcm_dpp_am_template_vlan_port_protocol_init(int unit,int template_init_id,const bcm_dpp_vlan_port_protocol_entries_t* port_protocol_info);
   1753 int _bcm_dpp_am_template_vlan_port_protocol_data_get(int unit, int port, bcm_dpp_vlan_port_protocol_entries_t* port_protocol_info);
   1754 int _bcm_dpp_am_template_vlan_port_protocol_exchange(int unit, int port, bcm_dpp_vlan_port_protocol_entries_t* port_protocol_info, int *old_template, int *is_last, int *new_template,int *is_allocated);
   1755 /* Port protocol to vlan,tc - end */
   1756 
   1757 
   1758 /* IP tunnel to SIP, TTL, TOS - start */
   1759 int _bcm_dpp_am_template_ip_tunnel_init(int unit,int sip_profile ,SOC_PPC_EG_ENCAP_IP_TUNNEL_SRC_IP *sip_val, int ttl_profile, int ttl_val, int tos_profile, int tos_val, int tunnel_template_profile, SOC_PPC_EG_ENCAP_IP_TUNNEL_SIZE_PROTOCOL_TEMPLATE_INFO *tunnel_template_val);
   1760 int _bcm_dpp_am_template_ip_tunnel_data_get(int unit, int tunnel_id, SOC_PPC_EG_ENCAP_IP_TUNNEL_SRC_IP *sip_val, int *ttl_val, int *tos_val);
   1761 int _bcm_dpp_am_template_ip_tunnel_exchange(int unit, int tunnel_id, int is_new_ip_tunnel, SOC_PPC_EG_ENCAP_IP_TUNNEL_SRC_IP *sip, int ttl, int tos, int *sip_template, int *ttl_template, int *tos_template,int *is_allocated);
   1762 int _bcm_dpp_am_template_ip_tunnel_exchange_test(int unit, int tunnel_id, int is_new_ip_tunnel, SOC_PPC_EG_ENCAP_IP_TUNNEL_SRC_IP *sip, int ttl, int tos, int *sip_template, int *ttl_template, int *tos_template,int *is_allocated);
   1763 
   1764 /* l3_rif_mac_termination_combination - Start */
   1765 int _bcm_dpp_am_template_l3_rif_mac_termination_combination_init(int unit, uint32 *profile_info, int template);
   1766 int _bcm_dpp_am_template_l3_rif_mac_termination_combination_data_get(int unit, int profile_id, uint32 *profile_info);
   1767 int _bcm_dpp_am_template_l3_rif_mac_termination_combination_exchange(int unit, int old_profile_id, int *old_is_last, uint32 *new_profile_info, uint8 *new_mapping_profile,int *is_allocated, uint8 with_id);
   1768 int _bcm_dpp_am_template_l3_rif_mac_termination_combination_alloc(int unit, int flags, uint32 *profile_info, uint8 *new_profile, int *is_allocated);
   1769 int _bcm_dpp_am_template_l3_rif_mac_termination_combination_free(int unit, uint32 profile, int *is_last);
   1770 int _bcm_dpp_am_template_l3_rif_mac_termination_combination_profile_get(int unit, uint32 profile_info, uint8* profile_id);
   1771 int _bcm_dpp_am_template_l3_rif_mac_termination_combination_ref_get(int unit, int profile, uint32 *ref_count);
   1772 /* l3_rif_mac_termination_combination - end */
   1773 
   1774 /* PTP port profile - start */
   1775 int _bcm_dpp_am_template_ptp_port_profile_init(int unit, SOC_PPC_PTP_IN_PP_PORT_PROFILE profile_ndx, SOC_PPC_PTP_PORT_INFO *profile_data);
   1776 int _bcm_dpp_am_template_ptp_port_profile_deinit(int unit, SOC_PPC_PTP_IN_PP_PORT_PROFILE profile_ndx);
   1777 int _bcm_dpp_am_template_ptp_port_profile_exchange(int unit, int port_ndx, SOC_PPC_PTP_PORT_INFO *new_profile_data, SOC_PPC_PTP_IN_PP_PORT_PROFILE *new_profile_ndx);
   1778 int _bcm_dpp_am_template_ptp_port_profile_tdata_get(int unit, SOC_PPC_PTP_IN_PP_PORT_PROFILE profile_ndx, SOC_PPC_PTP_PORT_INFO* profile_data);
   1779 /* PTP port profile - end */
   1780 
   1781 #ifdef BCM_88660_A0
   1782 /* VRRP info */
   1783 int _bcm_dpp_am_template_vrrp_alloc(int unit, SOC_PPC_VRRP_CAM_INFO *cam_info, int *is_allocated, int *profile_ndx);
   1784 int _bcm_dpp_am_template_vrrp_alloc_all(int unit, int profile_index);
   1785 int _bcm_dpp_am_template_vrrp_get(int unit, int profile_ndx, SOC_PPC_VRRP_CAM_INFO *cam_info);
   1786 int _bcm_dpp_am_template_vrrp_dealloc(int unit, int profile_ndx, int *is_last);
   1787 int _bcm_dpp_am_template_vrrp_dealloc_all(int unit, int profile_index);
   1788 int _bcm_dpp_am_template_vrrp_index_get(int unit, SOC_PPC_VRRP_CAM_INFO *cam_info, int *profile_ndx);
   1789 #endif /*BCM_88660_A0 */
   1790 
   1791 /* RIF profile info */
   1792 /* Only fill the drop, oam_lif_set, outlif_profile entries before calling alloc/index_get */
   1793 int _bcm_dpp_am_template_out_rif_profile_init(int unit,int template_id,QAX_PP_EG_ENCAP_ACCESS_OUT_RIF_PROFILE_ENTRY_FORMAT *rif_profile);
   1794 int _bcm_dpp_am_template_out_rif_profile_alloc(int unit, QAX_PP_EG_ENCAP_ACCESS_OUT_RIF_PROFILE_ENTRY_FORMAT *rif_profile, int *is_first, int *profile_ndx);
   1795 int _bcm_dpp_am_template_out_rif_profile_get(int unit, int profile_ndx, QAX_PP_EG_ENCAP_ACCESS_OUT_RIF_PROFILE_ENTRY_FORMAT *rif_profile);
   1796 int _bcm_dpp_am_template_out_rif_profile_dealloc(int unit, int profile_ndx, int *is_last);
   1797 int _bcm_dpp_am_template_out_rif_profile_index_get(int unit, QAX_PP_EG_ENCAP_ACCESS_OUT_RIF_PROFILE_ENTRY_FORMAT *rif_profile, int *profile_ndx);
   1798 int _bcm_dpp_am_template_out_rif_profile_exchange(int unit, int flags,int outrif_profile_index,QAX_PP_EG_ENCAP_ACCESS_OUT_RIF_PROFILE_ENTRY_FORMAT *new_profile, int *is_last, int *new_profile_index,int *is_first);
   1799 
   1800 /* For roo link layer format: eth_type_index table */
   1801 int bcm_dpp_am_template_eedb_roo_ll_format_eth_type_index_alloc(int unit, int flags, SOC_PPC_EG_ENCAP_ETHER_TYPE_INDEX_INFO *data, int *is_allocated, int *eth_type_index_ndx);
   1802 int bcm_dpp_am_template_eedb_roo_ll_format_eth_type_index_get(int unit, int eth_type_index_ndx, SOC_PPC_EG_ENCAP_ETHER_TYPE_INDEX_INFO* data);
   1803 int bcm_dpp_am_template_eedb_roo_ll_format_eth_type_index_free(int unit, int eth_type_index_ndx, int *is_last); 
   1804 int bcm_dpp_am_template_eedb_roo_ll_format_eth_type_index_exchange(int unit, int flags, int old_index_ndx,SOC_PPC_EG_ENCAP_ETHER_TYPE_INDEX_INFO *data,int *new_index_ndx,int * is_last, int *is_allocated);
   1805 int bcm_dpp_am_template_eedb_roo_ll_format_eth_type_index_ref_count_get(int unit, int eth_type_index_ndx, uint32 *count);
   1806 int bcm_dpp_am_template_eedb_roo_ll_format_eth_type_index_index_get(int unit,SOC_PPC_EG_ENCAP_ETHER_TYPE_INDEX_INFO *data, int *index);
   1807 
   1808 
   1809 /* For ip tunnel encapsulation mode. From Jericho B0, QAX. */
   1810 int bcm_dpp_am_template_ip_tunnel_encapsulation_mode_get(int unit, int encapsulation_mode, SOC_PPC_EG_ENCAP_IP_TUNNEL_SIZE_PROTOCOL_TEMPLATE_INFO* data); 
   1811 int bcm_dpp_am_template_ip_tunnel_encapsulation_mode_alloc(int unit, int flags, SOC_PPC_EG_ENCAP_IP_TUNNEL_SIZE_PROTOCOL_TEMPLATE_INFO* data, int* is_allocated, int *encapsulation_mode); 
   1812 int bcm_dpp_am_template_ip_tunnel_encapsulation_mode_exchange(int unit, int old_encapsulation_mode, SOC_PPC_EG_ENCAP_IP_TUNNEL_SIZE_PROTOCOL_TEMPLATE_INFO* data, int *old_is_last, int *new_encapsulation_mode,int *is_allocated, uint32 flags);
   1813 int bcm_dpp_am_template_ip_tunnel_encapsulation_mode_exchange_test(int unit, int old_encapsulation_mode, SOC_PPC_EG_ENCAP_IP_TUNNEL_SIZE_PROTOCOL_TEMPLATE_INFO* data, int *old_is_last, int *new_encapsulation_mode,int *is_allocated, uint32 flags);
   1814 int bcm_dpp_am_template_ip_tunnel_encapsulation_mode_free(int unit, int encapsulation_mode, int *is_last); 
   1815 
   1816 /* credit adjust size scheduler final delta, relevant only for Jericho */
   1817 int _bcm_dpp_am_template_scheduler_adjust_size_final_delta_mapping_init(int unit, int template_init_id, int *final_delta);
   1818 int _bcm_dpp_am_template_scheduler_adjust_size_final_delta_mapping_data_get(int unit, int core, int delta , int *final_delta);
   1819 int _bcm_dpp_am_template_scheduler_adjust_size_final_delta_mapping_exchange(int unit, int core, int delta, int *final_delta, int *old_profile, int *is_last, int *new_profile,int *is_allocated);
   1820 
   1821 /* For mapping to LIF profile an MTU profile. From Jericho B0, QAX, QUX. */
   1822 int _bcm_dpp_am_template_lif_mtu_profile_init(int unit, uint32 template_init_id, uint32 *mtu_val);
   1823 int _bcm_dpp_am_template_lif_mtu_profile_exchange(int unit, uint32 *mtu_val,
   1824                                         uint32 *old_profile, int *is_last, uint32 *new_profile,int *is_allocated);
   1825 
   1826 /* For seamless BFD non-accelerated endpoints - managing the SRC IP address - JERICHO and above.*/
   1827 int _bcm_dpp_am_template_sbfd_non_acc_src_ip_profile_alloc(int unit, int flags, const uint32 *data, int *is_allocated, int *src_ip_add_profile);
   1828 int _bcm_dpp_am_template_sbfd_non_acc_src_ip_profile_data_get(int unit, int src_ip_add_profile, uint32* data);
   1829 int _bcm_dpp_am_template_sbfd_non_acc_src_ip_profile_free(int unit, int src_ip_add_profile, int *is_last);
   1830 int _bcm_dpp_am_template_sbfd_non_acc_src_ip_profile_exchange(int unit, int flags, const uint32 *data, int *is_allocated, int *src_ip_add_profile, int old_src_ip_add_profile, int *is_last);
   1831 
   1832 /* 
   1833  * Template management - End
   1834  */ 
   1835 
   1836 
   1837 /* Resource manager flags */
   1838 
   1839 #define BCM_DPP_AM_FLAG_ALLOC_WITH_ID               (SW_STATE_RES_ALLOC_WITH_ID) /*0x00000001*/
   1840 /* if exist then reuse, can be set only if with id is present */
   1841 #define BCM_DPP_AM_FLAG_ALLOC_REPLACE               (SW_STATE_RES_ALLOC_REPLACE) /*0x00000004*/
   1842 #define BCM_DPP_AM_FLAG_ALLOC_EG_DECOUPLED_EVEN     (0x00000004)
   1843 #define BCM_DPP_AM_FLAG_ALLOC_INGRESS               (0x00000002)
   1844 #define BCM_DPP_AM_FLAG_ALLOC_EGRESS                (0x00000004)
   1845 
   1846 #define BCM_DPP_AM_FLAG_ALLOC_RESERVE               (0x00010000)
   1847 #define SOC_DPP_OAM_LOCAL_PORT_2_SYSTEM_PORT_RESERVED_VALUE (-1)
   1848 
   1849 /* relevant for IP tunnel allocation if present then allocate tunnel for IPv6 otherwise allocate for IPv4 */
   1850 #define BCM_DPP_AM_FLAG_ALLOC_IPV6                  (0x00020000)
   1851 #define BCM_DPP_AM_FLAG_ALLOC_EGRESS_ARP_POINTED    (0x00040000)
   1852 
   1853 
   1854 
   1855 /* Template manager falgs */
   1856 #define BCM_DPP_AM_TEMPLATE_FLAG_ALLOC_WITH_ID      (SHR_TEMPLATE_MANAGE_SET_WITH_ID) /*0x00000001*/
   1857 
   1858 
   1859 
   1860 int
   1861 bcm_dpp_am_fec_dealloc(
   1862     int unit,
   1863     uint32 flags,
   1864     int size,/*non-zero for protection or ECMP*/
   1865     SOC_PPC_FEC_ID fec_id);
   1866 
   1867 int
   1868 bcm_dpp_am_fec_is_alloced(
   1869     int unit,
   1870     uint32 flags,
   1871     int size,/*use 2 for protection*/
   1872     SOC_PPC_FEC_ID fec_id);
   1873 
   1874 int bcm_dpp_am_fec_get_usage(int unit, SOC_PPC_FEC_ID fec_id, _bcm_dpp_am_fec_alloc_usage *usage);
   1875 
   1876 int
   1877 bcm_dpp_am_local_inlif_alloc(
   1878     int unit,
   1879     int core_id,/*bank_id*/
   1880     uint32 flags,
   1881     uint8 *tag,
   1882     int *inlif_id);
   1883 
   1884 int
   1885 bcm_dpp_am_local_inlif_dealloc(
   1886     int unit,
   1887     int core_id,
   1888     uint32 flags,
   1889     int inlif_id);
   1890 
   1891 int
   1892 bcm_dpp_am_local_inlif_is_alloc(
   1893     int unit,
   1894     int core_id,
   1895     uint32 flags,
   1896     int inlif_id);
   1897 
   1898 int
   1899 bcm_dpp_am_local_inlif_tag_get(
   1900     int unit,
   1901     int core_id,
   1902     uint32 flags,
   1903     int inlif_id,
   1904     uint8 *tag_id);
   1905 
   1906 int
   1907 bcm_dpp_am_local_inlif_range_set(
   1908     int unit, 
   1909     int core_id, 
   1910     uint32 flags, 
   1911     uint8 tag_id, 
   1912     int start, 
   1913     int count);
   1914 
   1915 int
   1916 bcm_dpp_am_local_outlif_alloc(
   1917     int unit,
   1918     int core_id,/*bank_id*/
   1919     uint32 flags,
   1920     uint8 *tag,
   1921     int *outif_id);
   1922 
   1923 int
   1924 bcm_dpp_am_local_outlif_alloc_align(
   1925     int unit,
   1926     int core_id,/*bank_id*/
   1927     uint32 flags,
   1928     uint8 *tag, 
   1929     int align, 
   1930     int offset, 
   1931     int count,
   1932     int *outlif_id);
   1933 
   1934 int
   1935 bcm_dpp_am_local_outlif_dealloc(
   1936     int unit,
   1937     int core_id,
   1938     uint32 flags,
   1939     int count,
   1940     int outlif_id);
   1941 
   1942 int
   1943 bcm_dpp_am_local_outlif_is_alloc(
   1944     int unit,
   1945     int core_id,
   1946     uint32 flags,
   1947     int outif_id);
   1948 
   1949 int 
   1950 bcm_dpp_am_local_outlif_range_set(
   1951     int unit, 
   1952     int core_id, 
   1953     uint32 flags, 
   1954     uint8 tag_id, 
   1955     int start, 
   1956     int count); 
   1957 
   1958 int
   1959 bcm_dpp_am_l3_intf_vsi_alloc(
   1960     int unit,
   1961         uint32 flags,
   1962         bcm_vlan_t vid,
   1963     uint32   *l3_rif);
   1964 
   1965 int
   1966 bcm_dpp_am_l3_intf_vsi_dealloc(
   1967     int unit,
   1968         uint32 flags,
   1969     bcm_vlan_t vid,
   1970     uint32 l3_rif);
   1971 
   1972 /*int
   1973 bcm_dpp_am_fec_protection_peer_get(*/
   1974 int
   1975 bcm_dpp_am_vlan_to_vsi(
   1976     int unit,
   1977     bcm_vlan_t vid,
   1978     SOC_PPC_VSI_ID *vsi);
   1979 
   1980 /*
   1981  * Ethernet policer
   1982  */
   1983 
   1984 int
   1985 bcm_dpp_am_policer_dealloc(
   1986     int unit,
   1987 	int core_id,
   1988     uint32 flags,
   1989     int size,
   1990     int policer_id);
   1991 
   1992 int
   1993 bcm_dpp_am_policer_is_alloc(
   1994     int unit,
   1995 	int core_id,
   1996     int size,
   1997     int policer_id);
   1998 
   1999 /* TM */
   2000 int _bcm_dpp_am_template_ingress_uc_tc_mapping_data_get(int unit,int core_id, int dest_ndx,SOC_TMC_ITM_TC_MAPPING *tc_mapping);
   2001 int _bcm_dpp_am_template_ingress_uc_tc_mapping_init(int unit,int template_init_id,const SOC_TMC_ITM_TC_MAPPING* tc_mapping);
   2002 int _bcm_dpp_am_template_ingress_uc_tc_mapping_exchange(int unit, int core_id, int dest_ndx, SOC_TMC_ITM_TC_MAPPING *tc_mapping, uint32 *old_mapping_profile, int *is_last, int *new_mapping_profile,int *is_allocated);
   2003 int _bcm_dpp_am_template_ingress_flow_tc_mapping_data_get(int unit, int core_id, int dest_ndx,SOC_TMC_ITM_TC_MAPPING *tc_mapping);
   2004 int _bcm_dpp_am_template_ingress_flow_tc_mapping_init(int unit, int template_init_id, const SOC_TMC_ITM_TC_MAPPING* tc_mapping);
   2005 int _bcm_dpp_am_template_ingress_flow_tc_mapping_exchange(int unit, int core_id, int dest_ndx, SOC_TMC_ITM_TC_MAPPING *tc_mapping, uint32 *old_mapping_profile, int *is_last, int *new_mapping_profile,int *is_allocated);
   2006 
   2007 int _bcm_dpp_am_template_fc_generic_pfc_mapping_init(int unit, int priority, int template_id, SOC_TMC_FC_PFC_GENERIC_BITMAP *generic_bm);
   2008 int _bcm_dpp_am_template_fc_generic_pfc_mapping_data_get(int unit, int priority, int generic_bm_id, SOC_TMC_FC_PFC_GENERIC_BITMAP *generic_bm);
   2009 int _bcm_dpp_am_template_fc_generic_pfc_mapping_exchange(int unit, int priority, int old_generic_bm_id, SOC_TMC_FC_PFC_GENERIC_BITMAP *new_generic_bm, int *is_last, int *new_mapping_profile,int *is_allocated);
   2010 
   2011 int _bcm_dpp_am_template_ttl_scope_init(int unit, int template_init_id, uint16 *ttl);
   2012 int _bcm_dpp_am_template_ttl_scope_exchange(int unit, int ttl_scope_index, uint16 *ttl, int *is_last, int *new_ttl_scope_index, int *is_allocated);
   2013 int _bcm_dpp_am_template_ttl_scope_index_ttl_mapping_get(int unit, int ttl_scope_index, uint16 *ttl);
   2014 
   2015 int _bcm_dpp_am_template_pool_cnm_queue_init(int unit, SOC_TMC_CNM_CP_PROFILE_INFO *profile_info, int template);
   2016 int _bcm_dpp_am_template_pool_cnm_queue_profile_data_get(int unit, int profile_id, SOC_TMC_CNM_CP_PROFILE_INFO *profile_info);
   2017 int _bcm_dpp_am_template_pool_cnm_queue_profile_exchange(int unit,int old_profile_id, SOC_TMC_CNM_CP_PROFILE_INFO *new_profile_info, int *new_mapping_profile,int *is_allocated);
   2018 
   2019 int _bcm_dpp_am_template_crps_pktSize_compensation_init(int unit, int core ,_dpp_am_template_t template_id, int delta, int template);
   2020 int _bcm_dpp_am_template_crps_pktSize_compensation_exchange(int unit, int core, _dpp_am_template_t template_id, int port, int data, int old_template, int *is_last, int *template,int *is_allocated);
   2021 
   2022 int _bcm_dpp_am_template_stat_interface_pktSize_compensation_init(int unit, int core ,_dpp_am_template_t template_id, int delta, int template);
   2023 int _bcm_dpp_am_template_stat_interface_pktSize_compensation_exchange(int unit, int core, _dpp_am_template_t template_id, int port, int data, int old_template, int *is_last, int *template,int *is_allocated);
   2024 /*
   2025  * PON
   2026  */
   2027 int
   2028 bcm_dpp_am_pon_channel_profile_alloc(
   2029         int unit,
   2030         uint32 flags, /* flags should be SW_STATE_RES_ALLOC_WITH_ID; */
   2031         uint16 *pon_channel_profile);
   2032 
   2033 int
   2034 bcm_dpp_am_pon_channel_profile_dealloc(
   2035         int unit,
   2036         uint16 pon_channel_profile);
   2037 
   2038 int
   2039 bcm_dpp_am_pon_channel_profile_is_alloced(
   2040         int unit,
   2041         uint16 pon_channel_profile);
   2042 
   2043 /*
   2044  * Ingress and Egress VLAN edit
   2045  */
   2046 int
   2047 bcm_dpp_am_vlan_edit_action_id_dealloc(
   2048     int unit,
   2049     uint32 flags,
   2050     int action_id);
   2051 
   2052 int
   2053 bcm_dpp_am_vlan_edit_action_id_is_alloc(
   2054     int unit,
   2055     uint32 flags,
   2056     int action_id);
   2057 
   2058 int
   2059 bcm_dpp_am_vlan_edit_action_id_dealloc_all(
   2060     int unit,
   2061     uint32 flags);
   2062 
   2063 int
   2064 bcm_dpp_am_trill_virtual_nick_name_alloc(
   2065     int unit,
   2066     uint32 flags,
   2067     int *virtual_nick_name_index);
   2068 
   2069 int
   2070 bcm_dpp_am_trill_virtual_nick_name_dealloc(
   2071     int unit,
   2072     uint32 flags,
   2073     int virtual_nick_name_index);
   2074 
   2075 int
   2076 bcm_dpp_am_trill_virtual_nick_name_is_alloc(
   2077     int unit,
   2078     uint32 flags,
   2079     int virtual_nick_name_index);
   2080 
   2081 
   2082 /* 
   2083  * Global lif functions - Start
   2084  */
   2085 
   2086 /* Egress global lif */
   2087 int bcm_dpp_am_global_lif_alloc(int unit, uint32 flags, int *global_lif);
   2088 int bcm_dpp_am_global_lif_is_alloced(int unit, uint32 flags, int global_lif);
   2089 int bcm_dpp_am_global_lif_dealloc(int unit, uint32 flags, int global_lif);
   2090 
   2091 int _bcm_dpp_lif_id_is_mapped(int unit, int global_lif, uint8 *is_mapped);
   2092 
   2093 int _bcm_dpp_global_lif_id_is_sync(int unit, int global_lif, uint8 *is_sync);
   2094 
   2095 
   2096 
   2097 /* 
   2098  * Global lif functions - End
   2099  */
   2100 
   2101 
   2102 
   2103 
   2104 /*
   2105  * Trill eep functions - Start 
   2106  */
   2107 
   2108 #define _BCM_DPP_AM_TRILL_EEP_TYPE_DEFAULT (0) /* Default Trill EEDB entries */
   2109 #define _BCM_DPP_AM_TRILL_EEP_TYPE_ROO     (1) /* Trill EEDB entries for ROO  */
   2110 
   2111 int bcm_dpp_am_trill_eep_alloc(int unit, uint32 types, uint32 flags, int *eep); 
   2112 int bcm_dpp_am_trill_eep_is_alloc(int unit, int eep); 
   2113 int bcm_dpp_am_trill_eep_dealloc(int unit, int eep); 
   2114 
   2115 
   2116 /*
   2117  * Trill eep functions - End 
   2118  */
   2119 
   2120 /* 
   2121  * map_encap_intpri_color functions - Start
   2122  */ 
   2123 
   2124 int bcm_dpp_am_map_encap_intpri_color_alloc(int unit, uint32 flags, int *qos_id);
   2125 int bcm_dpp_am_map_encap_intpri_color_dealloc(int unit, uint32 flags, int qos_id);
   2126 int bcm_dpp_am_map_encap_intpri_color_is_alloced(int unit, int qos_id);
   2127 
   2128 /*
   2129  * map_encap_intpri_color functions - End
   2130  */
   2131 
   2132 /*
   2133  * ipsec_sa_id functions - Start
   2134  */
   2135 
   2136 int bcm_dpp_am_ipsec_sa_id_alloc     (int unit, uint32 flags,  uint32  *sa_id);
   2137 int bcm_dpp_am_ipsec_sa_id_dealloc   (int unit, uint32 sa_id);
   2138 int bcm_dpp_am_ipsec_sa_id_is_alloced(int unit, uint32 sa_id);
   2139 
   2140 /* 
   2141  * ipsec_sa_id functions - Start
   2142  */ 
   2143 
   2144 /*
   2145  * ipsec_tunnel_id functions - Start
   2146  */
   2147 
   2148 int bcm_dpp_am_ipsec_tunnel_id_alloc     (int unit, uint32 flags,  uint32  *tunnel_id);
   2149 int bcm_dpp_am_ipsec_tunnel_id_dealloc   (int unit, uint32 tunnel_id);
   2150 int bcm_dpp_am_ipsec_tunnel_id_is_alloced(int unit, uint32 tunnel_id);
   2151 
   2152 /*
   2153  * ipsec_tunnel_id functions - Start
   2154  */
   2155 
   2156 
   2157 extern bcm_dpp_am_pool_info_t *_bcm_dpp_pool_info[BCM_MAX_NUM_UNITS];
   2158 extern bcm_dpp_am_template_info_t *_bcm_dpp_template_info[BCM_MAX_NUM_UNITS];
   2159 extern bcm_dpp_am_cosq_res_info_t cosq_res_info[BCM_MAX_NUM_UNITS][SOC_DPP_DEFS_MAX(NOF_CORES)];
   2160 
   2161 /*
   2162  *  Following macros provide declaration of various resource calls.
   2163  */
   2164 #define _MGR_ALLOC(_type) \
   2165 extern int \
   2166 bcm_dpp_##_type##_alloc(int unit, uint32 flags, int count, int *elem);
   2167 #define _MGR_ALLOC_ALIGN(_type) \
   2168 extern int \
   2169 bcm_dpp_##_type##_alloc_align(int unit, \
   2170                               uint32 flags, \
   2171                               int align, \
   2172                               int offset, \
   2173                               int count, \
   2174                               int *elem);
   2175 #define _MGR_FREE(_type) \
   2176 extern int \
   2177 bcm_dpp_##_type##_free(int unit, int count, int elem);
   2178 #define _MGR_CHECK(_type) \
   2179 extern int \
   2180 bcm_dpp_##_type##_check(int unit, int count, int elem);
   2181 #define _MGR_ALLOC_GROUP(_type) \
   2182 extern int \
   2183 bcm_dpp_##_type##_alloc_group(int unit, \
   2184                               uint32 grp_flags, \
   2185                               int grp_size, \
   2186                               int *grp_done, \
   2187                               const uint32 *elem_flags, \
   2188                               const int *elem_count, \
   2189                               int *elem);
   2190 #define _MGR_ALLOC_ALIGN_GROUP(_type) \
   2191 extern int \
   2192 bcm_dpp_##_type##_alloc_align_group(int unit, \
   2193                                     uint32 grp_flags, \
   2194                                     int grp_size, \
   2195                                     int *grp_done, \
   2196                                     const uint32 *elem_flags, \
   2197                                     const int *elem_align, \
   2198                                     const int *elem_offset, \
   2199                                     const int *elem_count, \
   2200                                     int *elem);
   2201 #define _MGR_FREE_GROUP(_type) \
   2202 extern int \
   2203 bcm_dpp_##_type##_free_group(int unit, \
   2204                              uint32 grp_flags, \
   2205                              int grp_size, \
   2206                              int *grp_done, \
   2207                              const int *elem_count, \
   2208                              const int *elem);
   2209 #define _MGR_CHECK_GROUP(_type) \
   2210 extern int \
   2211 bcm_dpp_##_type##_check_group(int unit, \
   2212                               uint32 grp_flags, \
   2213                               int grp_size, \
   2214                               int *grp_done, \
   2215                               const int *elem_count, \
   2216                               const int *elem, \
   2217                               int *status);
   2218 #define _MGR_ALL_ACTIONS(_type) \
   2219 _MGR_ALLOC(_type) \
   2220 _MGR_ALLOC_ALIGN(_type) \
   2221 _MGR_ALLOC_GROUP(_type) \
   2222 _MGR_ALLOC_ALIGN_GROUP(_type) \
   2223 _MGR_FREE(_type) \
   2224 _MGR_FREE_GROUP(_type) \
   2225 _MGR_CHECK(_type) \
   2226 _MGR_CHECK_GROUP(_type)
   2227 /*
   2228  *  NOTE: must update the below list whenever changing resource types.
   2229  */
   2230 _MGR_ALL_ACTIONS(vsi_vlan)
   2231 _MGR_ALL_ACTIONS(vsi_mstp)
   2232 _MGR_ALL_ACTIONS(vsi_dynamic)
   2233 _MGR_ALL_ACTIONS(lif_vlan)
   2234 _MGR_ALL_ACTIONS(lif_dynamic)
   2235 _MGR_ALL_ACTIONS(vd_dynamic)
   2236 _MGR_ALL_ACTIONS(mc_vlan)
   2237 _MGR_ALL_ACTIONS(mc_dynamic)
   2238 _MGR_ALL_ACTIONS(mirror_action_profile)
   2239 _MGR_ALL_ACTIONS(fec_global)
   2240 _MGR_ALL_ACTIONS(fec_local)
   2241 _MGR_ALL_ACTIONS(eep_global)
   2242 _MGR_ALL_ACTIONS(eep_local)
   2243 /*
   2244  *  Don't export the declaration macros.
   2245  */
   2246 #undef _MGR_ALLOC
   2247 #undef _MGR_ALLOC_ALIGN
   2248 #undef _MGR_FREE
   2249 #undef _MGR_CHECK
   2250 #undef _MGR_ALLOC_GROUP
   2251 #undef _MGR_ALLOC_ALIGN_GROUP
   2252 #undef _MGR_FREE_GROUP
   2253 #undef _MGR_CHECK_GROUP
   2254 #undef _MGR_ALL_ACTIONS
   2255 
   2256 
   2257 #endif /* INCLUDE_ALLOC_MNGR_H */