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_cosq.h (6451B)


      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_cosq.h
      8  * Purpose:     Resource allocation for cosq.
      9  */
     10 
     11 #ifndef  INCLUDE_ALLOC_MNGR_COSQ_H
     12 #define  INCLUDE_ALLOC_MNGR_COSQ_H
     13 
     14 #include <bcm_int/dpp/alloc_mngr.h>
     15 #include <bcm_int/dpp/alloc_mngr_lif.h>
     16 
     17 #define BCM_DPP_AM_RES_POOL_COSQ_E2E_DYNAMIC_PER_REGION 3
     18 #define BCM_DPP_AM_RES_TYPE_COSQ_E2E_DYNAMIC_PER_REGION 3
     19 #define BCM_DPP_AM_RES_POOL_COSQ_E2E_DYNAMIC_PER_REGION_MAX_ENTRIES (DPP_DEVICE_COSQ_TOTAL_FLOW_REGIONS(unit) * BCM_DPP_AM_RES_POOL_COSQ_E2E_DYNAMIC_PER_REGION)
     20 #define BCM_DPP_AM_RES_POOL_COSQ_E2E_DYNAMIC_CONNECTOR_OFFSET 0
     21 #define BCM_DPP_AM_RES_POOL_COSQ_E2E_DYNAMIC_SE_OFFSET 1
     22 #define BCM_DPP_AM_RES_POOL_COSQ_E2E_DYNAMIC_SYNC_OFFSET 2
     23 
     24 #define BCM_DPP_AM_RES_POOL_COSQ_E2E_TOTAL_DYNAMIC_ARAD (SOC_TMC_COSQ_TOTAL_FLOW_REGIONS*BCM_DPP_AM_RES_TYPE_COSQ_E2E_DYNAMIC_PER_REGION)
     25 #define BCM_DPP_AM_RES_TYPE_COSQ_E2E_TOTAL_DYNAMIC_ARAD (SOC_TMC_COSQ_TOTAL_FLOW_REGIONS*BCM_DPP_AM_RES_TYPE_COSQ_E2E_DYNAMIC_PER_REGION)
     26 
     27 
     28 #define BCM_DPP_AM_RES_POOL_COSQ_QUEUE_TOTAL_DYNAMIC_ARAD 96
     29 #define BCM_DPP_AM_RES_TYPE_COSQ_QUEUE_TOTAL_DYNAMIC_ARAD 96
     30 
     31 /*Cosq scheduler E2E*/
     32 #define BCM_DPP_AM_COSQ_SCH_MAX_ALLOCATION_STAGES 18
     33 #define BCM_DPP_AM_COSQ_SCH_MAX_ALLOCATION_REGIONS_TYPES_PER_FLOW_TYPE 4
     34 #define BCM_DPP_AM_COSQ_SCH_NOF_ALLOCATION_SCHEMES 48
     35 #define _BCM_DPP_AM_COSQ_GET_POOL_INDEX(flow_id,pool_offset) SOC_TMC_SCH_FLOW_TO_1K_ID((flow_id)) * BCM_DPP_AM_RES_POOL_COSQ_E2E_DYNAMIC_PER_REGION + (pool_offset)
     36 #define _BCM_DPP_AM_COSQ_GET_REGION_INDEX_FROM_POOL_INDEX(pool_index) ((pool_index)/BCM_DPP_AM_RES_POOL_COSQ_E2E_DYNAMIC_PER_REGION)
     37 #define _BCM_DPP_AM_COSQ_GET_REGION_INDEX_FROM_FLOW_INDEX(flow_id) _BCM_DPP_AM_COSQ_GET_REGION_INDEX_FROM_POOL_INDEX(_BCM_DPP_AM_COSQ_GET_POOL_INDEX(flow_id, 0))
     38 #define _BCM_DPP_AM_COSQ_GET_FLOW_INDEX_FROM_REMOTE_CORE_INDEX(base_flow_id, nof_remote_cores, core) (base_flow_id + (1024/nof_remote_cores)*core)
     39 #define _BCM_DPP_AM_COSQ_RESOURCE_CHECK_BREAK -1
     40 #define _BCM_DPP_AM_COSQ_PER_TYPE_ALL_ALLOCATED_RESOURCE_FIND_MAX_STAGES 4
     41 #define _BCM_DPP_AM_COSQ_QUARTET_LEN 4
     42 
     43 #define DPP_DEVICE_QAX_COSQ_FLOW_REGION_API_OFFSET 64 /* The offset between user defined regions to hw regions */
     44 #define DPP_DEVICE_QUX_COSQ_FLOW_REGION_API_OFFSET 96 /* The offset between user defined regions to hw regions */
     45 
     46 
     47 
     48 /* The resouces order is:
     49    - Normal resources
     50    - Cosq pools 
     51    */
     52 #define DPP_AM_RES_COSQ_START(_unit)   (dpp_am_res_count)
     53 
     54 #define DPP_AM_RES_ID_IS_COSQ(_unit, _res_id)  \
     55     (_res_id >= DPP_AM_RES_COSQ_START(_unit))
     56 
     57 
     58 /*
     59  * TM (COSQ)
     60  */
     61 int 
     62 _bcm_dpp_am_cosq_get_first_base_pool_id(int unit, int *curr_index) ;
     63 int
     64 bcm_dpp_am_cosq_init(int unit);
     65 
     66 int
     67 bcm_dpp_am_ingress_voq_allocate(int unit,
     68                                 int core,
     69                                 uint32 flags,
     70                                 int is_non_contiguous,
     71                                 int num_cos,
     72                                 int queue_config_type,
     73                                 int *voq_base);
     74 
     75 int
     76 bcm_dpp_am_ingress_voq_deallocate(int unit,
     77                                   int core,
     78                                   uint32 flags,
     79                                   int is_non_contiguous,
     80                                   int num_cos,
     81                                   int voq_base);
     82 
     83 int
     84 bcm_dpp_am_cosq_scheduler_allocate(int unit,
     85                                        int core,
     86                                        uint32 nof_remote_cores,
     87                                        uint32 flags,
     88                                        int is_composite,
     89                                        int is_enhanced,
     90                                        int is_dual,
     91                                        int is_non_contiguous,
     92                                        int num_cos,
     93                                        SOC_TMC_AM_SCH_FLOW_TYPE flow_type,
     94                                        uint8* src_modid,
     95                                        int *flow_id);
     96 int
     97 bcm_dpp_am_cosq_scheduler_deallocate(int unit,
     98                                        int core,
     99                                        uint32 flags,
    100                                        int is_composite,
    101                                        int is_enhanced,
    102                                        int is_dual,
    103                                        int is_non_contiguous,
    104                                        int num_cos,
    105                                        SOC_TMC_AM_SCH_FLOW_TYPE flow_type,
    106                                        int flow_id);
    107 int 
    108 bcm_dpp_am_cosq_get_region_type(int unit,
    109                            int core,
    110                            int flow_id,
    111                            int *region_type);
    112 
    113 int 
    114 bcm_dpp_am_cosq_fetch_quad(int unit,
    115                            int core,
    116                            int flow_id,
    117                            int region_type,
    118                            bcm_dpp_am_cosq_quad_allocation_t *is_allocated);
    119 
    120 
    121 int     
    122 bcm_dpp_am_cosq_fetch_allocated_resources(int unit,
    123                                         int core,
    124                                         SOC_TMC_AM_SCH_FLOW_TYPE flow_type,
    125                                         bcm_dpp_am_cosq_pool_ref_t* allocated_ref);
    126 
    127 int
    128 bcm_dpp_am_cosq_queue_region_config_get(int unit,
    129                                         int core,
    130                                         int *queue_region_config,
    131                                         int queue_config_type);
    132 int
    133 _bcm_dpp_am_cosq_process_queue_region(int unit, 
    134                                       int core,
    135                                       int queue_config_type,
    136                                       int *queue_region_config);
    137 
    138 
    139 int
    140 _bcm_dpp_resources_fill_type_cosq(int unit, int core, _dpp_res_type_cosq_t* dpp_res_cosq_type);
    141 
    142 int
    143 _bcm_dpp_resources_fill_pool_cosq(int unit, int core, _dpp_res_pool_cosq_t* dpp_res_cosq_pool);
    144 
    145 int sw_state_bcm_dpp_am_cosq_pool_ref_t_get (int unit, int core, bcm_dpp_am_cosq_pool_ref_type_t type, bcm_dpp_am_cosq_pool_ref_field_t field, int idx, int *result);
    146 int sw_state_bcm_dpp_am_cosq_pool_ref_t_set (int unit, int core, bcm_dpp_am_cosq_pool_ref_type_t type, bcm_dpp_am_cosq_pool_ref_field_t field, int idx, int value);
    147 
    148 #endif /*INCLUDE_ALLOC_MNGR_COSQ_H*/