l2.h (5222B)
1 /* 2 * ! \file bcm_int/dnx/l2/l2.h Internal DNX L2 APIs 3 PIs This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file. 4 PIs 5 PIs Copyright 2007-2020 Broadcom Inc. All rights reserved. 6 */ 7 8 #ifndef L2_H_INCLUDED 9 /* 10 * { 11 */ 12 #define L2_H_INCLUDED 13 14 #ifndef BCM_DNX_SUPPORT 15 #error "This file is for use by DNX (JR2) family only!" 16 #endif 17 18 /* 19 * Include files. 20 * { 21 */ 22 #include <bcm_int/dnx/algo/l2/algo_l2.h> 23 #include <bcm_int/dnx/l2/l2_learn.h> 24 25 #include <bcm/l2.h> 26 27 /* 28 * } 29 */ 30 31 /* 32 * DEFINES 33 * { 34 */ 35 36 /** Strength of a static transplantable entry in the MACT. Entry that do not age out but can be transplanted */ 37 #define STATIC_TRANSPLANTABLE_MACT_ENTRY_STRENGTH 0 38 39 /** Strength of a dynamic entry in the MACT */ 40 #define DYNAMIC_MACT_ENTRY_STRENGTH 1 41 42 /** Strength of a static entry in the MACT */ 43 #define STATIC_MACT_ENTRY_STRENGTH 2 44 45 /** Number of maximum registered callbacks per unit */ 46 #define DNX_L2_CB_MAX 4 47 48 #define DEFAULT_NOF_AGE_CYCLES 8 49 50 /** Callbacks handling */ 51 typedef struct 52 { 53 /** Callback routine */ 54 bcm_l2_addr_callback_t callback; 55 /** User defined data */ 56 void *userdata; 57 } dnx_l2_cb_entry_t; 58 59 typedef struct 60 { 61 /**Callback entry */ 62 dnx_l2_cb_entry_t entry[DNX_L2_CB_MAX]; 63 /** Number of callback entries */ 64 int count; 65 } dnx_l2_cbs_t; 66 67 extern dnx_l2_cbs_t dnx_l2_cbs[BCM_MAX_NUM_UNITS]; 68 69 /* 70 * } 71 */ 72 73 /** 74 * \brief - Initialize L2 module. 75 * 76 * \param [in] unit - Unit-ID 77 * 78 * \return 79 * shr_error_e 80 * 81 * \remark 82 * * None 83 * \see 84 * * None 85 */ 86 shr_error_e dnx_l2_module_init( 87 int unit); 88 89 /** 90 * \brief - Deinitialize L2 module. 91 * 92 * \param [in] unit - Unit-ID 93 * 94 * \return 95 * shr_error_e 96 * 97 * \remark 98 * * None 99 * \see 100 * * None 101 */ 102 shr_error_e dnx_l2_module_deinit( 103 int unit); 104 105 /** 106 * \brief - Update the number of meta cycles until an entry with the given vlan is aged out. 107 * Possible number of meta cycles are: 0 (no aging), 1, 2, ..., 8, 10, 12, 14, 16, 32, 64, 128 108 * 109 * \param [in] unit - unit id 110 * \param [in] vsi - fid to update its number of aging cycles before age out. 111 * \param [in] is_lif - age configuration per LIF. 112 * \param [in] nof_meta_cycles_for_ageout - time in units of meta cycles until the vsi's entries are aged out. 113 * e.g. if the meta cycle was configured to 10 seconds and nof_meta_cycles_for_ageout=2, the entries will be delete/aged out 114 * after 20 seconds. 115 * 116 * 117 * \return 118 * shr_error_e 119 * 120 * \remark 121 * * None 122 * \see 123 * * None 124 */ 125 shr_error_e dnx_l2_nof_age_cycles_before_ageout_set( 126 int unit, 127 int vsi, 128 int is_lif, 129 int nof_meta_cycles_for_ageout); 130 131 /** 132 * \brief - Retrieve the number of meta cycles until an entry with the given vlan is aged out. 133 * Possible number of meta cycles are: 0 (no aging), 1, 2, ..., 8, 10, 12, 14, 16, 32, 64, 128 134 * 135 * \param [in] unit - unit id 136 * \param [in] vsi - vsi to fetch its number of aging cycles before age out. 137 * \param [out] nof_meta_cycles_for_ageout - time in units of meta cycles until the vsi's entries are aged out. 138 * 139 * \return 140 * shr_error_e 141 * 142 * \remark 143 * * None 144 * \see 145 * * None 146 */ 147 shr_error_e dnx_l2_nof_age_cycles_before_ageout_get( 148 int unit, 149 int vsi, 150 int *nof_meta_cycles_for_ageout); 151 152 /** 153 * \brief - Set the aging profiles to default values according to the learn mode. 154 * 155 * \param [in] unit - unit id 156 * \param [in] learn_mode - type of learn that is configured 157 * 158 * \return 159 * shr_error_e 160 * 161 * \remark 162 * * None 163 * \see 164 * * None 165 */ 166 shr_error_e dnx_aging_profile_init( 167 int unit, 168 dnx_learn_mode_t learn_mode); 169 170 /** 171 * \brief - Scan all MAC addresses and decrement age-status in case that aging is disabled and age machine is not still working. 172 * Manual triggering of the age machine is possible only when automatic aging is disabled. 173 * 174 * \param [in] unit - Relevant unit 175 * 176 * \return 177 * shr_error_e 178 * 179 * \remark 180 * * None 181 * \see 182 * * None 183 */ 184 shr_error_e dnx_l2_age_scan_set( 185 int unit); 186 /** 187 * \brief - Enable/Disable the limit check when the CPU is adding a MACT entry. 188 * Both limits per FID and the global MACT limit are enabled/disabled. 189 * 190 * \param [in] unit - Relevant unit 191 * \param [in] enable - '1' means limits are checked. '0' means limits are forced for CPU and MACT entry. 192 * 193 * \return 194 * shr_error_e 195 * 196 * \remark 197 * * None 198 * \see 199 * * None 200 */ 201 shr_error_e dnx_l2_learn_limit_to_cpu_set( 202 int unit, 203 uint32 enable); 204 205 /** 206 * \brief - Return whether the limits on the MACT are forced on CPU MACT additions. 207 * 208 * \param [in] unit - Relevant unit 209 * \param [out] is_enabled - '1' means limits are checked. '0' means limits are not forced for CPU add MACT entry. 210 * 211 * \return 212 * shr_error_e 213 * 214 * \remark 215 * * None 216 * \see 217 * * None 218 */ 219 shr_error_e dnx_l2_learn_limit_to_cpu_get( 220 int unit, 221 int *is_enabled); 222 223 /** 224 * \brief - Set the properties of a VSI to default values 225 * 226 * \param [in] unit - unit id 227 * \param [in] vsi - vsi to update 228 * 229 * \return 230 * shr_error_e 231 * 232 * \remark 233 * * None 234 * \see 235 * * None 236 */ 237 shr_error_e dnx_vsi_profile_set_to_default( 238 int unit, 239 int vsi); 240 241 /* 242 * } 243 */ 244 #endif /* L2_H_INCLUDED */