fabric.h (8358B)
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 /* 7 * ! \file bcm_int/dnx/fabric/fabric.h 8 * Reserved.$ 9 */ 10 11 #ifndef _DNX_FABRIC_H_INCLUDED_ 12 /* 13 * { 14 */ 15 #define _DNX_FABRIC_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_error.h> 22 #include <soc/dnx/dbal/auto_generated/dbal_defines_fields.h> 23 #include <soc/dnx/dnx_data/auto_generated/dnx_data_device.h> 24 25 #define DNX_FABRIC_FMAC_EMULATION_NOT_SUPPORTED(unit) \ 26 (dnx_data_device.emulation.feature_get(unit, dnx_data_device_emulation_fmac_supported) == FALSE) 27 28 /* 29 * Typedefs: 30 * { 31 */ 32 /** 33 * \brief 34 * Which part to configure wfq weights opon 35 */ 36 typedef enum 37 { 38 /** 39 * Configure both ingress and egress 40 */ 41 DNX_FABRIC_WFQ_TYPE_ALL = 0, 42 /** 43 * Configure ingress 44 */ 45 DNX_FABRIC_WFQ_TYPE_CONTEXT_INGRESS = 1, 46 /** 47 * Configure egress 48 */ 49 DNX_FABRIC_WFQ_TYPE_PIPE_EGRESS = 2 50 } dnx_fabric_wfq_type_e; 51 52 /** 53 * \brief 54 * Indicates how the fabric interface is connected. 55 */ 56 typedef enum 57 { 58 /** 59 * Indicates single FAP in the system, without other FAPs of FEs 60 */ 61 DNX_FABRIC_CONNECT_MODE_SINGLE_FAP = 0, 62 /** 63 * Indicates Fabric interface is connected to other FAPs directly. 64 * No FEs in the system. 65 */ 66 DNX_FABRIC_CONNECT_MODE_MESH = 1, 67 /** 68 * Indicates Fabric interface is connected to FE device. 69 */ 70 DNX_FABRIC_CONNECT_MODE_FE = 2, 71 DNX_FABRIC_NOF_CONNECT_MODES 72 } dnx_fabric_connect_mode_e; 73 /* 74 * } 75 */ 76 77 /************* 78 * FUNCTIONS * 79 */ 80 81 /** 82 * \brief 83 * Configure ALDWP value. 84 * ALDWP = Active Link Down Watchdog Period. 85 * \param [in] unit - 86 * The unit number. 87 * \return 88 * See \ref shr_error_e 89 * \remark 90 * * Called as part of the initialization sequence. 91 * \see 92 * * None. 93 */ 94 shr_error_e dnx_fabric_aldwp_config( 95 int unit); 96 97 /** 98 * \brief 99 * Create load balancing periodic event. 100 * 101 * \param [in] unit - 102 * The unit number. 103 * \return 104 * \retval See \ref shr_error_e 105 * \remark 106 * * None 107 * \see 108 * * None 109 */ 110 shr_error_e dnx_fabric_load_balance_thread_init( 111 int unit); 112 113 /** 114 * \brief 115 * Destroy load balancing periodic event. 116 * 117 * \param [in] unit - 118 * The unit number. 119 * \return 120 * \retval See \ref shr_error_e 121 * \remark 122 * * None 123 * \see 124 * * None 125 */ 126 shr_error_e dnx_fabric_load_balance_thread_deinit( 127 int unit); 128 129 /** 130 * \brief 131 * Initialize dnx fabric module. 132 * 133 * \param [in] unit - 134 * The unit number. 135 * \return 136 * \retval See \ref shr_error_e 137 * \remark 138 * * None 139 * \see 140 * * None 141 */ 142 shr_error_e dnx_fabric_init( 143 int unit); 144 145 /** 146 * \brief 147 * Deinitialize dnx fabric module. 148 * 149 * \param [in] unit - 150 * The unit number. 151 * \return 152 * \retval See \ref shr_error_e 153 * \remark 154 * * None 155 * \see 156 * * None 157 */ 158 shr_error_e dnx_fabric_deinit( 159 int unit); 160 161 /** 162 * \brief 163 * Set link isolation, i.e. 164 * Isolate/Activate a fabric link by stop/enable sending 165 * reachability messages. 166 * \param [in] unit - 167 * The unit number. 168 * \param [in] link - 169 * Fabric link to isolate/activate. 170 * \param [in] enable - 171 * Isolate/Activate the link. 172 * 1 - isolate the link. 173 * 0 - activate the link. 174 * \return 175 * See \ref shr_error_e 176 * \remark 177 * * None. 178 * \see 179 * * None. 180 */ 181 shr_error_e dnx_fabric_link_isolation_set( 182 int unit, 183 int link, 184 int enable); 185 186 /** 187 * \brief 188 * Disable fabric control cells during init sequence (Stop receiving and transmitting control cells). 189 * This function is used as a wrapper for init sequence since init sequence invokes functions only with 190 * 'unit' argument. 191 * \param [in] unit - 192 * The unit number. 193 * \return 194 * shr_error_e 195 * \remark 196 * This function should be invoked during init sequence as one of the first steps (before HW is accessed). 197 * Meaning that this function should be invoked right after access is initiliazed. 198 * The reason to disable traffic before any access is because some HW configurations must not be done during traffic, 199 * so it's expected from the application to re-enable fabric control cells after it's done with all the required configurations. 200 * \see 201 * * None 202 */ 203 shr_error_e dnx_fabric_control_cells_disable( 204 int unit); 205 206 /** 207 * \brief 208 * Disable/Enable Tx traffic on a fabric link. 209 * \param [in] unit - 210 * The unit number. 211 * \param [in] link - 212 * Fabric link to disable/enable tx traffic upon. 213 * \param [in] disable - 214 * Disable/enable tx traffic on the link. 215 * 1 - disable tx traffix. 216 * 0 - enable tx traffix. 217 * \return 218 * See \ref shr_error_e 219 * \remark 220 * * There is no 'get' function since this information is also written 221 * into sw_state, so when we want a 'get' we read it from sw_state 222 * directly. 223 * \see 224 * * None. 225 */ 226 shr_error_e dnx_fabric_link_tx_traffic_disable_set( 227 int unit, 228 int link, 229 int disable); 230 231 /** 232 * \brief 233 * Set weight for WFQs in fabric pipes. 234 * \param [in] unit - 235 * The unit number. 236 * \param [in] pipe - 237 * The pipe number (0/1/2) to configure. 238 * \param [in] weight - 239 * The weight to configure. 240 * \param [in] fabric_wfq_type - 241 * Which WFQ to configure: 242 * Ingress (FDT) 243 * Egress (FDR) 244 * All (Ingress+Egress) 245 * \return 246 * See \ref shr_error_e 247 * \remark 248 * * None. 249 * \see 250 * * None. 251 */ 252 shr_error_e dnx_fabric_wfq_set( 253 int unit, 254 int pipe, 255 int weight, 256 dnx_fabric_wfq_type_e fabric_wfq_type); 257 258 /** 259 * \brief 260 * Get weight for WFQs in fabric pipes. 261 * \param [in] unit - 262 * The unit number. 263 * \param [in] pipe - 264 * The pipe number (0/1/2) to get WFQ configurations. 265 * \param [out] weight - 266 * The configured weight 267 * \param [in] fabric_wfq_type - 268 * Which WFQ to get configurations: 269 * Ingress (FDT) 270 * Egress (FDR) 271 * All (assuming Ingress+Egress was configured the same) 272 * \return 273 * See \ref shr_error_e 274 * \remark 275 * * None. 276 * \see 277 * * None. 278 */ 279 shr_error_e dnx_fabric_wfq_get( 280 int unit, 281 int pipe, 282 int *weight, 283 dnx_fabric_wfq_type_e fabric_wfq_type); 284 285 /** 286 * \brief 287 * Set dynamic-WFQ weight. 288 * There are 2 sets of WFQs: 289 * 1) For normal scenario. 290 * 2) For congested scenario. 291 * Each input ('leg') of the WFQs can be set with weight. 292 * \param [in] unit - 293 * The unit number. 294 * \param [in] fabric_wfq_fifo - 295 * Which input ('leg') of the WFQ to configure the weight. 296 * \param [in] is_congested - 297 * 1 - Configure WFQ for congested scenario. 298 * 0 - Configure WFQ for normal scenario. 299 * \param [in] weight - 300 * The weight to configure. 301 * \return 302 * See \ref shr_error_e 303 * \remark 304 * * Moving between the 'sets' is according to the local unicast congestion 305 * compared to a configured threshold (which is set using the CGM API). 306 * \see 307 * * None. 308 */ 309 shr_error_e dnx_fabric_wfq_dynamic_set( 310 int unit, 311 dbal_enum_value_field_fabric_wfq_fifo_e fabric_wfq_fifo, 312 int is_congested, 313 int weight); 314 315 /** 316 * \brief 317 * Get dynamic-WFQ weight. 318 * There are 2 sets of WFQs: 319 * 1) For normal scenario. 320 * 2) For congested scenario. 321 * Each input ('leg') of the WFQs can be set with weight. 322 * \param [in] unit - 323 * The unit number. 324 * \param [in] fabric_wfq_fifo - 325 * Which input ('leg') of the WFQ to configure the weight. 326 * \param [in] is_congested - 327 * 1 - Configure WFQ for congested scenario. 328 * 0 - Configure WFQ for normal scenario. 329 * \param [in] weight - 330 * The weight to configure. 331 * \return 332 * See \ref shr_error_e 333 * \remark 334 * * Moving between the 'sets' is according to the local unicast congestion 335 * compared to a configured threshold (which is set using the CGM API). 336 * \see 337 * * None. 338 */ 339 shr_error_e dnx_fabric_wfq_dynamic_get( 340 int unit, 341 dbal_enum_value_field_fabric_wfq_fifo_e fabric_wfq_fifo, 342 int is_congested, 343 int *weight); 344 345 /** 346 * \brief 347 * Set fabric blocks to power down 348 * \param [in] unit - 349 * The unit number. 350 * \param [in] power_down - 351 * power down indication 352 * \return 353 * See \ref shr_error_e 354 * \remark 355 * \see 356 * * None. 357 */ 358 shr_error_e dnx_fabric_blocks_power_down_set( 359 int unit, 360 int power_down); 361 362 #endif /*_DNX_FABRIC_H_INCLUDED_*/