alloc_mngr_glif.h (4598B)
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_glif.h 8 * Purpose: Resource allocation for gloal lif. 9 */ 10 11 #ifndef INCLUDE_ALLOC_MNGR_GLIF_H 12 #define INCLUDE_ALLOC_MNGR_GLIF_H 13 14 #include <bcm_int/dpp/alloc_mngr_lif.h> 15 16 /************* 17 * INCLUDES * 18 */ 19 /* { */ 20 21 /* } */ 22 /************* 23 * DEFINES * 24 */ 25 /* { */ 26 27 /* Allocation flags */ 28 #define _BCM_DPP_GLOBAL_LIF_MAPPING_INGRESS (0x1) 29 #define _BCM_DPP_GLOBAL_LIF_MAPPING_EGRESS (0x2) 30 #define _BCM_DPP_GLOBAL_LIF_MAPPING_IN_EG_DIRECTIONS (_BCM_DPP_GLOBAL_LIF_MAPPING_INGRESS | _BCM_DPP_GLOBAL_LIF_MAPPING_EGRESS) 31 #define _BCM_DPP_GLOBAL_LIF_MAPPING_GLOBAL_TO_LOCAL (0X4) 32 #define _BCM_DPP_GLOBAL_LIF_MAPPING_LOCAL_TO_GLOBAL (0X8) 33 #define _BCM_DPP_GLOBAL_LIF_MAPPING_GLOB_LOC_DIRECTIONS (_BCM_DPP_GLOBAL_LIF_MAPPING_GLOBAL_TO_LOCAL | _BCM_DPP_GLOBAL_LIF_MAPPING_LOCAL_TO_GLOBAL) 34 35 /* All flags except for direction flags will be used to indicate type */ 36 #define _BCM_DPP_GLOBAL_LIF_MAPPING_DIRECTIONS (_BCM_DPP_GLOBAL_LIF_MAPPING_GLOB_LOC_DIRECTIONS | _BCM_DPP_GLOBAL_LIF_MAPPING_IN_EG_DIRECTIONS) 37 #define _BCM_DPP_GLOBAL_LIF_MAPPING_TYPES (-1 & ~_BCM_DPP_GLOBAL_LIF_MAPPING_DIRECTIONS) 38 39 /* Maximum number of virtual lifs */ 40 #define _BCM_DPP_MAX_VIRTUAL_LIF(unit) (2 * SOC_DPP_DEFS_GET(unit, nof_global_lifs)) 41 42 /* Maximum number of entries in global lif bank. */ 43 #define _BCM_DPP_AM_GLOBAL_LIF_NOF_ENTRIES_PER_BANK ((int)ARAD_PP_EG_ENCAP_NOF_ENTRIES_PER_HALF_EEDB_BANK(unit)) 44 45 46 47 /* } */ 48 /************* 49 * MACROS * 50 */ 51 /* { */ 52 53 /* Ingress global lif defines. */ 54 #define _BCM_DPP_AM_NOF_GLOBAL_IN_LIFS(_unit) (SOC_DPP_CONFIG(_unit)->pp.nof_global_in_lifs) 55 56 #define _BCM_DPP_AM_GLOBAL_IN_LIF_ID_IS_LEGAL(_unit, _global_lif_id) \ 57 (((_global_lif_id) < _BCM_DPP_AM_NOF_GLOBAL_IN_LIFS(_unit)) \ 58 && ((_global_lif_id) >= 0)) 59 60 /* Egress global lif defines. */ 61 #define _BCM_DPP_AM_NOF_GLOBAL_OUT_LIFS(_unit) (SOC_DPP_CONFIG(_unit)->pp.nof_global_out_lifs) 62 63 #define _BCM_DPP_AM_GLOBAL_OUT_LIF_ID_IS_LEGAL(_unit, _global_lif_id) \ 64 (((_global_lif_id) < _BCM_DPP_AM_NOF_GLOBAL_OUT_LIFS(_unit)) \ 65 && ((_global_lif_id) >= 0)) 66 67 /* } */ 68 /************* 69 * TYPE DEFS * 70 */ 71 /* { */ 72 73 typedef struct { 74 PARSER_HINT_ARR int *ingress_lif_to_global_lif; 75 int ingress_global_lif_to_lif_htb_handle; 76 int egress_lif_to_global_lif_htb_handle; 77 SHR_BITDCL *global_lif_sync_indication; 78 int global_lif_egress_count; 79 int global_lif_ingress_count; 80 } bcm_dpp_alloc_mngr_glif_info_t; 81 82 /* } */ 83 /************* 84 * GLOBALS * 85 */ 86 /* { */ 87 88 /* } */ 89 /************* 90 * FUNCTIONS * 91 */ 92 /* { */ 93 94 /* Global lif mapping */ 95 96 /* Init global lif mapping module. */ 97 int 98 _bcm_dpp_global_lif_mapping_init(int unit); 99 100 /* Deinit global lif mapping module. */ 101 int 102 _bcm_dpp_global_lif_mapping_deinit(int unit); 103 104 /* Map between a global lif to a local lif and vice versa */ 105 int 106 _bcm_dpp_global_lif_mapping_create(int unit, uint32 flags, int global_lif, int local_lif); 107 108 /* Remove mapping between a global lif to a local lif and vice versa */ 109 int 110 _bcm_dpp_global_lif_mapping_remove(int unit, uint32 flags, int global_lif, int local_lif); 111 112 /* Find mapping between a local lif to a global lif */ 113 int 114 _bcm_dpp_global_lif_mapping_local_to_global_get(int unit, uint32 flags, int local_lif, int *global_lif); 115 116 /* Find mapping between a global lif to a local lif */ 117 int 118 _bcm_dpp_global_lif_mapping_global_to_local_get(int unit, int flags, int global_lif, int *local_lif); 119 120 /** GLOBAL LIF ALLOCATION - START **/ 121 122 uint32 123 _bcm_dpp_am_global_lif_init(int unit); 124 125 uint32 126 _bcm_dpp_am_global_sync_lif_internal_alloc(int unit, uint32 flags, int *global_lif); 127 128 uint32 129 _bcm_dpp_am_global_sync_lif_internal_dealloc(int unit, int global_lif); 130 131 uint32 132 _bcm_dpp_am_global_lif_non_sync_internal_alloc(int unit, uint32 alloc_flags, uint8 is_ingress, int *global_lif); 133 134 uint32 135 _bcm_dpp_am_global_lif_non_sync_internal_dealloc(int unit, int is_ingress, int global_lif); 136 137 uint32 138 _bcm_dpp_am_global_egress_lif_internal_is_allocated(int unit, int global_lif); 139 140 uint32 141 _bcm_dpp_am_global_ingress_lif_internal_is_allocated(int unit, int global_lif); 142 143 uint32 144 _bcm_dpp_am_global_lif_set_direct_bank(int unit, int eedb_bank_id, uint8 is_direct_bank); 145 146 /* } */ 147 148 #endif /* INCLUDE_ALLOC_MNGR_GLIF_H */