algo_failover.h (5618B)
1 /* 2 * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file. 3 * 4 * Copyright 2007-2020 Broadcom Inc. All rights reserved. 5 */ 6 /** \file bcm_int/dnx/algo/failover/algo_failover.h 7 * 8 * Reserved.$ 9 */ 10 11 #ifndef _DNX_ALGO_FAILOVER_H_INCLUDED_ 12 /* 13 * { 14 */ 15 #define _DNX_ALGO_FAILOVER_H_INCLUDED_ 16 17 #ifndef BCM_DNX_SUPPORT 18 #error "This file is for use by DNX (JR2) family only!" 19 #endif 20 21 #include <shared/shrextend/shrextend_debug.h> 22 #include <bcm_int/dnx/algo/res_mngr/res_mngr.h> 23 #include <bcm_int/dnx/algo/swstate/auto_generated/access/algo_failover_access.h> 24 25 /* 26 * MACROs 27 * { 28 */ 29 #define DNX_ALGO_FAILOVER_RES_FEC_PATH_SELECT "DNX_ALGO_FAILOVER_RES_FEC_PATH_SELECT" 30 #define DNX_ALGO_FAILOVER_RES_ING_PATH_SELECT "DNX_ALGO_FAILOVER_RES_ING_PATH_SELECT" 31 #define DNX_ALGO_FAILOVER_RES_EGR_PATH_SELECT "DNX_ALGO_FAILOVER_RES_EGR_PATH_SELECT" 32 33 /* 34 * } 35 * MACROs 36 */ 37 /** 38 * \brief Wrapper function for allocation manager which creates tagged allocation bitmap for failover FEC path select. 39 * The tag will represent FEC hierarchy, 40 * each bank in FEC path select will be tagged upon allocating the first element in the bank. 41 * Refer to resource_tag_bitmap_create() for details about the input parameters. 42 */ 43 shr_error_e dnx_algo_failover_fec_path_select_bitmap_create( 44 int unit, 45 uint32 module_id, 46 resource_tag_bitmap_t * res_tag_bitmap, 47 dnx_algo_res_create_data_t * create_data, 48 void *extra_arguments, 49 uint32 nof_elements, 50 uint32 alloc_flags); 51 52 /** 53 * \brief Wrapper function for allocation manager which allocating failover FEC path select. 54 * The tag represents FEC hierarchy, 55 * each bank in FEC path select will be tagged upon allocating the first element in the bank. 56 * Refer to resource_tag_bitmap_allocate() for details about the input parameters. 57 * extra_arguments - pointer to uint32 which represents the tag 58 */ 59 shr_error_e dnx_algo_failover_fec_path_select_bitmap_allocate( 60 int unit, 61 uint32 module_id, 62 resource_tag_bitmap_t res_tag_bitmap, 63 uint32 flags, 64 void *extra_arguments, 65 int *element); 66 67 /** 68 * \brief Wrapper function for resource manager which frees failover FEC path select. 69 * The tag represents FEC hierarchy, 70 * each bank in FEC path select will be tagged upon allocating the first element in the bank. 71 * Refer to resource_tag_bitmap_free() for details about the input parameters. 72 * extra_arguments - pointer to uint32 which represents the tag 73 */ 74 shr_error_e dnx_algo_failover_fec_path_select_bitmap_free( 75 int unit, 76 uint32 module_id, 77 resource_tag_bitmap_t res_tag_bitmap, 78 int element); 79 80 /** 81 * \brief Wrapper function for allocation manager which allocating several failover FEC path select. 82 * The tag represents FEC hierarchy, 83 * each bank in FEC path select will be tagged upon allocating the first element in the bank. 84 * Refer to resource_tag_bitmap_allocate() for details about the input parameters. 85 * extra_arguments - pointer to uint32 which represents the tag 86 */ 87 shr_error_e dnx_algo_failover_fec_path_select_bitmap_several_allocate( 88 int unit, 89 uint32 module_id, 90 resource_tag_bitmap_t res_tag_bitmap, 91 uint32 flags, 92 uint32 nof_elements, 93 void *extra_arguments, 94 int *element); 95 96 /** 97 * \brief Wrapper function for resource manager which frees several failover FEC path select. 98 * The tag represents FEC hierarchy, 99 * each bank in FEC path select will be tagged upon allocating the first element in the bank. 100 * Refer to resource_tag_bitmap_free() for details about the input parameters. 101 * extra_arguments - pointer to uint32 which represents the tag 102 */ 103 shr_error_e dnx_algo_failover_fec_path_select_bitmap_several_free( 104 int unit, 105 uint32 module_id, 106 resource_tag_bitmap_t res_tag_bitmap, 107 uint32 nof_elements, 108 int element); 109 110 /** 111 * \brief 112 * Reserves a bank of memory from failover module at ecmp bank resolution for the use of the ecmp extended 113 * \param [in] unit - The unit number. 114 * \param [in] bank_id - The bank ID that is going to be reserved. 115 * Valid bank IDs are 0 to 3. 116 * \return 117 * See shr_error_e 118 * \remark 119 * * None 120 * \see 121 * * None 122 */ 123 shr_error_e dnx_algo_failover_fec_bank_for_ecmp_extended_allocate( 124 int unit, 125 int bank_id); 126 127 /** 128 * \brief 129 * Frees a bank of memory from failover module at ecmp bank resolution which previously allocated by ecmp extended 130 * \param [in] unit - The unit number. 131 * \param [in] bank_id - The bank ID that is going to be freed. 132 * Valid bank IDs are 0 to 3. 133 * \return 134 * See shr_error_e 135 * \remark 136 * * None 137 * \see 138 * * None 139 */ 140 shr_error_e dnx_algo_failover_fec_bank_for_ecmp_extended_free( 141 int unit, 142 int bank_id); 143 144 /** 145 * \brief - get resource allocation manager name given failover type. 146 * 147 * \param [in] unit - The unit number. 148 * \param [in] failover_type - DNX_FAILOVER_TYPE_XXX 149 * \param [out] name - name used as an handle to resource manager 150 * \return 151 * See shr_error_e 152 * \remark 153 * * None 154 * \see 155 * * None 156 */ 157 shr_error_e dnx_algo_failover_res_name_get( 158 int unit, 159 int failover_type, 160 char **name); 161 162 /** 163 * \brief Initialize dnx algo failover module. 164 * 165 * \param [in] unit - The unit number. 166 * 167 * \return 168 * See shr_error_e 169 * \remark 170 * * None 171 * \see 172 * * None 173 */ 174 shr_error_e dnx_algo_failover_init( 175 int unit); 176 177 #endif /*_DNX_ALGO_FAILOVER_H_INCLUDED_*/