stg.h (10395B)
1 /* 2 * DO NOT EDIT THIS FILE! 3 * This file is auto-generated. 4 * Edits to this file will be lost when it is regenerated. 5 * 6 * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file. 7 * 8 * Copyright 2007-2020 Broadcom Inc. All rights reserved. 9 */ 10 11 #ifndef BCMINT_LTSW_MBCM_STG_H 12 #define BCMINT_LTSW_MBCM_STG_H 13 14 #include <bcm/types.h> 15 16 #include <bcm_int/ltsw/stg_int.h> 17 18 #include <shr/shr_bitop.h> 19 #include <sal/sal_types.h> 20 21 /*! 22 * \brief Get STG size information. 23 * 24 * \param [in] unit Unit Number. 25 * \param [out] stg_min Minimum STG index. 26 * \param [out] stg_max Maximum STG index. 27 * \param [out] vlan_count VLAN count. 28 * \param [out] vpn_count VPN count. 29 * \param [out] vpn_offset VPN offset. 30 * 31 * \retval SHR_E_NONE No errors. 32 * \retval !SHR_E_NONE Failure. 33 */ 34 typedef int (*stg_size_get_f)( 35 int unit, 36 bcm_stg_t *stg_min, 37 bcm_stg_t *stg_max, 38 int *vlan_count, 39 int *vpn_count, 40 int *vpn_offset); 41 42 /*! 43 * \brief Set STG into a specified VLAN. 44 * 45 * \param [in] unit Unit Number. 46 * \param [in] vid VLAN ID. 47 * \param [in] stg STG index. 48 * 49 * \retval SHR_E_NONE No errors. 50 * \retval !SHR_E_NONE Failure. 51 */ 52 typedef int (*stg_vlan_set_f)( 53 int unit, 54 bcm_vlan_t vid, 55 bcm_stg_t stg); 56 57 /*! 58 * \brief Get STG from a specified VLAN. 59 * 60 * \param [in] unit Unit Number. 61 * \param [in] vid VLAN ID. 62 * \param [out] stg STG index. 63 * 64 * \retval SHR_E_NONE No errors. 65 * \retval !SHR_E_NONE Failure. 66 */ 67 typedef int (*stg_vlan_get_f)( 68 int unit, 69 bcm_vlan_t vid, 70 bcm_stg_t *stg); 71 72 /*! 73 * \brief Initialize the state in a specified STG. 74 * 75 * \param [in] unit Unit Number. 76 * \param [in] stg STG index. 77 * 78 * \retval SHR_E_NONE No errors. 79 * \retval !SHR_E_NONE Failure. 80 */ 81 typedef int (*stg_stp_init_f)( 82 int unit, 83 bcm_stg_t stg); 84 85 /*! 86 * \brief Clear the state in a specified STG. 87 * 88 * \param [in] unit Unit Number. 89 * \param [in] stg STG index. 90 * 91 * \retval SHR_E_NONE No errors. 92 * \retval !SHR_E_NONE Failure. 93 */ 94 typedef int (*stg_stp_clear_f)( 95 int unit, 96 bcm_stg_t stg); 97 98 /*! 99 * \brief Set the spanning tree state for a port in specified STG. 100 * 101 * \param [in] unit Unit Number. 102 * \param [in] stg STG index. 103 * \param [in] port Port Number. 104 * \param [in] stp_state Spanning Tree State of port. 105 * 106 * \retval SHR_E_NONE No errors. 107 * \retval !SHR_E_NONE Failure. 108 */ 109 typedef int (*stg_stp_set_f)( 110 int unit, 111 bcm_stg_t stg, 112 bcm_port_t port, 113 int stp_state); 114 115 /*! 116 * \brief Retrieve the spanning tree state for a port in specified STG. 117 * 118 * \param [in] unit Unit Number. 119 * \param [in] stg STG index. 120 * \param [in] port Port Number. 121 * \param [out] stp_state Spanning Tree State of port. 122 * 123 * \retval SHR_E_NONE No errors. 124 * \retval !SHR_E_NONE Failure. 125 */ 126 typedef int (*stg_stp_get_f)( 127 int unit, 128 bcm_stg_t stg, 129 bcm_port_t port, 130 int *stp_state); 131 132 /*! 133 * \brief Recover SW state (STG usage bitmap and map) during warm boot. 134 * 135 * \param [in] unit Unit Number. 136 * \param [out] stg_bmp Bitmap of STGs. 137 * \param [out] uidx_first First user index of STG 138 * \param [out] uidx_next Next user index of STG 139 * 140 * \retval SHR_E_NONE No errors. 141 * \retval !SHR_E_NONE Failure. 142 */ 143 typedef int (*stg_reinit_f)( 144 int unit, 145 SHR_BITDCL *stg_bmp, 146 int *uidx_first, 147 int *uidx_next); 148 149 /*! 150 * \brief De-initialize the STG moudle. 151 * 152 * \param [in] unit Unit Number. 153 * \param [in] stg STG index. 154 * 155 * \retval SHR_E_NONE No errors. 156 * \retval !SHR_E_NONE Failure. 157 */ 158 typedef int (*stg_detach_f)( 159 int unit, 160 bcm_stg_t stg); 161 162 /*! 163 * \brief Set the state of STG check on a given port. 164 * 165 * \param [in] unit Unit Number. 166 * \param [in] port Port Number. 167 * \param [in] disable Disable or enable. 168 * \param [in] flags Direction flags. 169 * 170 * \retval SHR_E_NONE No errors. 171 * \retval !SHR_E_NONE Failure. 172 */ 173 typedef int (*stg_port_check_set_f)( 174 int unit, 175 bcm_port_t port, 176 int disable, 177 uint16_t flags); 178 179 /*! 180 * \brief Initialize STG moudle. 181 * 182 * \param [in] unit Unit Number. 183 * 184 * \retval SHR_E_NONE No errors. 185 * \retval !SHR_E_NONE Failure. 186 */ 187 typedef int (*stg_init_f)(int unit); 188 189 /*! 190 * \brief Display STG software information. 191 * 192 * \param [in] unit Unit Number. 193 * 194 * \retval SHR_E_NONE No errors. 195 * \retval !SHR_E_NONE Failure. 196 */ 197 typedef int (*stg_info_dump_f)(int unit); 198 199 /*! 200 * \brief Get STG lt info based on chip and NPL version. 201 * 202 * \param [in] unit Unit Number. 203 * \param [out] lt_db LT database. 204 * 205 * \retval SHR_E_NONE No errors. 206 * \retval !SHR_E_NONE Failure. 207 */ 208 typedef int (*stg_lt_db_get_f)( 209 int unit, 210 bcmint_stg_lt_db_t *lt_db); 211 212 /*! 213 * \brief Stg driver structure. 214 */ 215 typedef struct mbcm_ltsw_stg_drv_s { 216 217 /*! Get STG size information. */ 218 stg_size_get_f stg_size_get; 219 220 /*! Set STG into a specified VLAN. */ 221 stg_vlan_set_f stg_vlan_set; 222 223 /*! Get STG from a specified VLAN. */ 224 stg_vlan_get_f stg_vlan_get; 225 226 /*! Initialize the state in a specified STG. */ 227 stg_stp_init_f stg_stp_init; 228 229 /*! Clear the state in a specified STG. */ 230 stg_stp_clear_f stg_stp_clear; 231 232 /*! Set the spanning tree state for a port in specified STG. */ 233 stg_stp_set_f stg_stp_set; 234 235 /*! Retrieve the spanning tree state for a port in specified STG. */ 236 stg_stp_get_f stg_stp_get; 237 238 /*! Recover SW state (STG usage bitmap and map) during warm boot. */ 239 stg_reinit_f stg_reinit; 240 241 /*! De-initialize the STG moudle. */ 242 stg_detach_f stg_detach; 243 244 /*! Set the state of STG check on a given port. */ 245 stg_port_check_set_f stg_port_check_set; 246 247 /*! Initialize STG moudle. */ 248 stg_init_f stg_init; 249 250 /*! Display STG software information. */ 251 stg_info_dump_f stg_info_dump; 252 253 /*! Get STG lt info based on chip and NPL version. */ 254 stg_lt_db_get_f stg_lt_db_get; 255 256 } mbcm_ltsw_stg_drv_t; 257 258 /*! 259 * \brief Set the STG driver of the device. 260 * 261 * \param [in] unit Unit Number. 262 * \param [in] drv Stg driver to set. 263 * 264 * \retval SHR_E_NONE No errors. 265 * \retval !SHR_E_NONE Failure. 266 */ 267 extern int 268 mbcm_ltsw_stg_drv_set( 269 int unit, 270 mbcm_ltsw_stg_drv_t *drv); 271 272 /*! 273 * \brief Get STG size information. 274 * 275 * \param [in] unit Unit Number. 276 * \param [out] stg_min Minimum STG index. 277 * \param [out] stg_max Maximum STG index. 278 * \param [out] vlan_count VLAN count. 279 * \param [out] vpn_count VPN count. 280 * \param [out] vpn_offset VPN offset. 281 * 282 * \retval SHR_E_NONE No errors. 283 * \retval !SHR_E_NONE Failure. 284 */ 285 extern int 286 mbcm_ltsw_stg_size_get( 287 int unit, 288 bcm_stg_t *stg_min, 289 bcm_stg_t *stg_max, 290 int *vlan_count, 291 int *vpn_count, 292 int *vpn_offset); 293 294 /*! 295 * \brief Set STG into a specified VLAN. 296 * 297 * \param [in] unit Unit Number. 298 * \param [in] vid VLAN ID. 299 * \param [in] stg STG index. 300 * 301 * \retval SHR_E_NONE No errors. 302 * \retval !SHR_E_NONE Failure. 303 */ 304 extern int 305 mbcm_ltsw_stg_vlan_set( 306 int unit, 307 bcm_vlan_t vid, 308 bcm_stg_t stg); 309 310 /*! 311 * \brief Get STG from a specified VLAN. 312 * 313 * \param [in] unit Unit Number. 314 * \param [in] vid VLAN ID. 315 * \param [out] stg STG index. 316 * 317 * \retval SHR_E_NONE No errors. 318 * \retval !SHR_E_NONE Failure. 319 */ 320 extern int 321 mbcm_ltsw_stg_vlan_get( 322 int unit, 323 bcm_vlan_t vid, 324 bcm_stg_t *stg); 325 326 /*! 327 * \brief Initialize the state in a specified STG. 328 * 329 * \param [in] unit Unit Number. 330 * \param [in] stg STG index. 331 * 332 * \retval SHR_E_NONE No errors. 333 * \retval !SHR_E_NONE Failure. 334 */ 335 extern int 336 mbcm_ltsw_stg_stp_init( 337 int unit, 338 bcm_stg_t stg); 339 340 /*! 341 * \brief Clear the state in a specified STG. 342 * 343 * \param [in] unit Unit Number. 344 * \param [in] stg STG index. 345 * 346 * \retval SHR_E_NONE No errors. 347 * \retval !SHR_E_NONE Failure. 348 */ 349 extern int 350 mbcm_ltsw_stg_stp_clear( 351 int unit, 352 bcm_stg_t stg); 353 354 /*! 355 * \brief Set the spanning tree state for a port in specified STG. 356 * 357 * \param [in] unit Unit Number. 358 * \param [in] stg STG index. 359 * \param [in] port Port Number. 360 * \param [in] stp_state Spanning Tree State of port. 361 * 362 * \retval SHR_E_NONE No errors. 363 * \retval !SHR_E_NONE Failure. 364 */ 365 extern int 366 mbcm_ltsw_stg_stp_set( 367 int unit, 368 bcm_stg_t stg, 369 bcm_port_t port, 370 int stp_state); 371 372 /*! 373 * \brief Retrieve the spanning tree state for a port in specified STG. 374 * 375 * \param [in] unit Unit Number. 376 * \param [in] stg STG index. 377 * \param [in] port Port Number. 378 * \param [out] stp_state Spanning Tree State of port. 379 * 380 * \retval SHR_E_NONE No errors. 381 * \retval !SHR_E_NONE Failure. 382 */ 383 extern int 384 mbcm_ltsw_stg_stp_get( 385 int unit, 386 bcm_stg_t stg, 387 bcm_port_t port, 388 int *stp_state); 389 390 /*! 391 * \brief Recover SW state (STG usage bitmap and map) during warm boot. 392 * 393 * \param [in] unit Unit Number. 394 * \param [out] stg_bmp Bitmap of STGs. 395 * \param [out] uidx_first First user index of STG 396 * \param [out] uidx_next Next user index of STG 397 * 398 * \retval SHR_E_NONE No errors. 399 * \retval !SHR_E_NONE Failure. 400 */ 401 extern int 402 mbcm_ltsw_stg_reinit( 403 int unit, 404 SHR_BITDCL *stg_bmp, 405 int *uidx_first, 406 int *uidx_next); 407 408 /*! 409 * \brief De-initialize the STG moudle. 410 * 411 * \param [in] unit Unit Number. 412 * \param [in] stg STG index. 413 * 414 * \retval SHR_E_NONE No errors. 415 * \retval !SHR_E_NONE Failure. 416 */ 417 extern int 418 mbcm_ltsw_stg_detach( 419 int unit, 420 bcm_stg_t stg); 421 422 /*! 423 * \brief Set the state of STG check on a given port. 424 * 425 * \param [in] unit Unit Number. 426 * \param [in] port Port Number. 427 * \param [in] disable Disable or enable. 428 * \param [in] flags Direction flags. 429 * 430 * \retval SHR_E_NONE No errors. 431 * \retval !SHR_E_NONE Failure. 432 */ 433 extern int 434 mbcm_ltsw_stg_port_check_set( 435 int unit, 436 bcm_port_t port, 437 int disable, 438 uint16_t flags); 439 440 /*! 441 * \brief Initialize STG moudle. 442 * 443 * \param [in] unit Unit Number. 444 * 445 * \retval SHR_E_NONE No errors. 446 * \retval !SHR_E_NONE Failure. 447 */ 448 extern int 449 mbcm_ltsw_stg_init(int unit); 450 451 /*! 452 * \brief Display STG software information. 453 * 454 * \param [in] unit Unit Number. 455 * 456 * \retval SHR_E_NONE No errors. 457 * \retval !SHR_E_NONE Failure. 458 */ 459 extern int 460 mbcm_ltsw_stg_info_dump(int unit); 461 462 /*! 463 * \brief Get STG lt info based on chip and NPL version. 464 * 465 * \param [in] unit Unit Number. 466 * \param [out] lt_db LT database. 467 * 468 * \retval SHR_E_NONE No errors. 469 * \retval !SHR_E_NONE Failure. 470 */ 471 extern int 472 mbcm_ltsw_stg_lt_db_get( 473 int unit, 474 bcmint_stg_lt_db_t *lt_db); 475 476 #endif /* BCMINT_LTSW_MBCM_STG_H */