oob.c (35767B)
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-2019 Broadcom Inc. All rights reserved. 6 * 7 * OOB Flow Control and OOB Stats 8 * Purpose: API to set different OOB Flow Control and OOB Stats registers. 9 */ 10 11 #include <sal/core/libc.h> 12 13 #include <soc/drv.h> 14 #include <soc/mem.h> 15 #include <soc/debug.h> 16 17 #include <bcm/error.h> 18 #include <bcm/oob.h> 19 20 #include <bcm_int/esw/oob.h> 21 #include <bcm_int/esw/tomahawk.h> 22 #include <bcm_int/esw/trident3.h> 23 #include <bcm_int/esw/katana2.h> 24 #include <bcm_int/esw/apache.h> 25 #include <bcm_int/esw_dispatch.h> 26 #include <bcm_int/esw/stat.h> 27 28 #if defined(BCM_TOMAHAWK2_SUPPORT) 29 #include <soc/tomahawk2.h> 30 #endif 31 32 #if defined(BCM_TRIDENT3_SUPPORT) 33 #include <soc/trident3.h> 34 #endif 35 #if defined(BCM_TOMAHAWK3_SUPPORT) 36 #include <bcm_int/esw/tomahawk3.h> 37 #endif 38 39 #ifdef BCM_WARM_BOOT_SUPPORT 40 #include <bcm_int/esw/switch.h> 41 #endif /* BCM_WARM_BOOT_SUPPORT */ 42 43 _bcm_oob_unit_driver_t *_bcm_oob_unit_driver[BCM_MAX_NUM_UNITS]; 44 45 46 /* 47 * Function: 48 * _bcm_oob_deinit 49 * Purpose: 50 * Deinitialize OOB driver functions. 51 * Parameters: 52 * unit - (IN) StrataSwitch unit number. 53 * Returns: 54 * BCM_E_XXX 55 */ 56 void _bcm_oob_deinit(int unit) 57 { 58 _bcm_oob_unit_driver_t *oob_driver; 59 60 oob_driver = _BCM_OOB_UNIT_DRIVER(unit); 61 if (oob_driver == NULL) { 62 return; 63 } 64 65 sal_free(oob_driver); 66 _BCM_OOB_UNIT_DRIVER(unit) = NULL; 67 68 return; 69 } 70 71 72 /* 73 * Function: 74 * _bcm_oob_init 75 * Purpose: 76 * Initialize OOB driver functions. 77 * Parameters: 78 * unit - (IN) StrataSwitch unit number. 79 * Returns: 80 * BCM_E_XXX 81 */ 82 int _bcm_oob_init(int unit) 83 { 84 _bcm_oob_unit_driver_t *oob_driver; 85 int oob_supported = 0; 86 int rv = BCM_E_NONE; 87 _bcm_oob_deinit(unit); 88 oob_driver = _BCM_OOB_UNIT_DRIVER(unit); 89 90 if (oob_driver == NULL) { 91 oob_driver = sal_alloc(sizeof(_bcm_oob_unit_driver_t), "oob_unit_driver"); 92 if (oob_driver == NULL) { 93 return BCM_E_MEMORY; 94 } 95 } 96 97 sal_memset(oob_driver, 0, sizeof(_bcm_oob_unit_driver_t)); 98 99 _BCM_OOB_UNIT_DRIVER(unit) = oob_driver; 100 101 #if defined(BCM_TRIDENT3_SUPPORT) 102 if (SOC_IS_TRIDENT3X(unit)) { 103 rv = bcm_oob_td3_init(unit); 104 if (BCM_FAILURE(rv)) { 105 (void)_bcm_oob_deinit(unit); 106 return rv; 107 } 108 oob_supported = 1; 109 } 110 #endif 111 #if defined(BCM_TOMAHAWK3_SUPPORT) 112 if (SOC_IS_TOMAHAWK3(unit)) { 113 rv = bcm_oob_th3_init(unit); 114 if (BCM_FAILURE(rv)) { 115 (void)_bcm_oob_deinit(unit); 116 return rv; 117 } 118 oob_supported = 1; 119 } 120 #endif 121 #if defined(BCM_TOMAHAWK_SUPPORT) 122 if (SOC_IS_TOMAHAWKX(unit) && !SOC_IS_TOMAHAWK3(unit)) { 123 rv = bcm_oob_th_init(unit); 124 if (BCM_FAILURE(rv)) { 125 (void)_bcm_oob_deinit(unit); 126 return rv; 127 } 128 oob_supported = 1; 129 } 130 #endif 131 #if defined(BCM_KATANA2_SUPPORT) 132 if (SOC_IS_KATANA2(unit)) { 133 rv = bcm_oob_kt2_init(unit); 134 if (BCM_FAILURE(rv)) { 135 (void)_bcm_oob_deinit(unit); 136 return rv; 137 } 138 oob_supported = 1; 139 } 140 #endif 141 #if defined(BCM_APACHE_SUPPORT) 142 if (SOC_IS_APACHE(unit)) { 143 rv = bcm_oob_ap_init(unit); 144 if (BCM_FAILURE(rv)) { 145 (void)_bcm_oob_deinit(unit); 146 return rv; 147 } 148 oob_supported = 1; 149 } 150 #endif 151 if (oob_supported == 0) { 152 return BCM_E_UNAVAIL; 153 } 154 return rv; 155 } 156 157 #if defined(BCM_TOMAHAWK3_SUPPORT) 158 int bcm_oob_th3_init(int unit) 159 { 160 _bcm_oob_unit_driver_t *oob_driver; 161 162 oob_driver = _BCM_OOB_UNIT_DRIVER(unit); 163 if (oob_driver == NULL) { 164 return BCM_E_MEMORY; 165 } 166 167 /* Initializing Driver functions for OOB FC */ 168 oob_driver->fc_tx_config_set = bcm_th3_oob_fc_tx_config_set; 169 oob_driver->fc_tx_config_get = bcm_th3_oob_fc_tx_config_get; 170 oob_driver->fc_tx_info_get = bcm_th3_oob_fc_tx_info_get; 171 /* OOBSTAT and OOB RX are not supported in TH3 */ 172 oob_driver->fc_rx_port_tc_mapping_multi_set = NULL; 173 oob_driver->fc_rx_port_tc_mapping_multi_get = NULL; 174 oob_driver->fc_rx_port_tc_mapping_set = NULL; 175 oob_driver->fc_rx_port_tc_mapping_get = NULL; 176 oob_driver->fc_rx_config_set = NULL; 177 oob_driver->fc_rx_config_get = NULL; 178 oob_driver->fc_rx_port_offset_get = NULL; 179 180 oob_driver->stats_config_set = NULL; 181 oob_driver->stats_config_get = NULL; 182 oob_driver->stats_pool_mapping_multi_set = NULL; 183 oob_driver->stats_pool_mapping_multi_get = NULL; 184 oob_driver->stats_pool_mapping_set = NULL; 185 oob_driver->stats_pool_mapping_get = NULL; 186 oob_driver->stats_queue_mapping_multi_set = NULL; 187 oob_driver->stats_queue_mapping_multi_get = NULL; 188 oob_driver->stats_queue_mapping_set = NULL; 189 oob_driver->stats_queue_mapping_get = NULL; 190 191 #ifdef BCM_WARM_BOOT_SUPPORT 192 if(SOC_WARM_BOOT(unit)) { 193 return BCM_E_NONE; 194 } 195 #endif 196 /* oob port mapping init if not warmboot*/ 197 BCM_IF_ERROR_RETURN(bcm_th3_oob_port_mapping_init(unit)); 198 return BCM_E_NONE; 199 } 200 #endif 201 202 #if defined(BCM_TOMAHAWK_SUPPORT) 203 /* 204 * Function: 205 * _bcm_oob_th_init 206 * Purpose: 207 * Initialize OOB driver functions 208 * for Tomahawk (BCM56960). 209 * Parameters: 210 * unit - (IN) StrataSwitch unit number. 211 * Returns: 212 * BCM_E_XXX 213 */ 214 int 215 bcm_oob_th_init(int unit) 216 { 217 _bcm_oob_unit_driver_t *oob_driver; 218 219 oob_driver = _BCM_OOB_UNIT_DRIVER(unit); 220 if (oob_driver == NULL) { 221 return BCM_E_MEMORY; 222 } 223 224 /* Initializing Driver functions for OOB FC */ 225 oob_driver->fc_tx_config_set = bcm_th_oob_fc_tx_config_set; 226 oob_driver->fc_tx_config_get = bcm_th_oob_fc_tx_config_get; 227 oob_driver->fc_tx_info_get = bcm_th_oob_fc_tx_info_get; 228 oob_driver->fc_rx_port_tc_mapping_multi_set = bcm_th_oob_fc_rx_port_tc_mapping_multi_set; 229 oob_driver->fc_rx_port_tc_mapping_multi_get = bcm_th_oob_fc_rx_port_tc_mapping_multi_get; 230 oob_driver->fc_rx_port_tc_mapping_set = bcm_th_oob_fc_rx_port_tc_mapping_set; 231 oob_driver->fc_rx_port_tc_mapping_get = bcm_th_oob_fc_rx_port_tc_mapping_get; 232 oob_driver->fc_rx_config_set = bcm_th_oob_fc_rx_config_set; 233 oob_driver->fc_rx_config_get = bcm_th_oob_fc_rx_config_get; 234 oob_driver->fc_rx_port_offset_get = bcm_th_oob_fc_rx_port_offset_get; 235 236 /* oob stats init */ 237 if (1 != soc_property_get(unit, spn_BUFFER_STATS_COLLECT_TYPE, 1)) { 238 return BCM_E_NONE; 239 } 240 /* Initializing Driver functions for OOB Stats */ 241 oob_driver->stats_config_set = bcm_th_oob_stats_config_set; 242 oob_driver->stats_config_get = bcm_th_oob_stats_config_get; 243 oob_driver->stats_pool_mapping_multi_set = bcm_th_oob_stats_pool_mapping_multi_set; 244 oob_driver->stats_pool_mapping_multi_get = bcm_th_oob_stats_pool_mapping_multi_get; 245 oob_driver->stats_pool_mapping_set = bcm_th_oob_stats_pool_mapping_set; 246 oob_driver->stats_pool_mapping_get = bcm_th_oob_stats_pool_mapping_get; 247 oob_driver->stats_queue_mapping_multi_set = bcm_th_oob_stats_queue_mapping_multi_set; 248 oob_driver->stats_queue_mapping_multi_get = bcm_th_oob_stats_queue_mapping_multi_get; 249 oob_driver->stats_queue_mapping_set = bcm_th_oob_stats_queue_mapping_set; 250 oob_driver->stats_queue_mapping_get = bcm_th_oob_stats_queue_mapping_get; 251 252 #if defined(BCM_TOMAHAWK2_SUPPORT) 253 if (SOC_IS_TOMAHAWK2(unit)) { 254 uint32 flag; 255 256 #ifdef BCM_WARM_BOOT_SUPPORT 257 if (SOC_WARM_BOOT(unit)) { 258 int config, hw_mode; 259 260 /* get oob config from HW */ 261 SOC_IF_ERROR_RETURN(soc_tomahawk2_mmu_pstats_mode_get(unit, &flag)); 262 263 /* HW config is different with config property */ 264 if (!(flag & _TH2_MMU_PSTATS_ENABLE) || 265 (flag & _TH2_MMU_PSTATS_PKT_MOD)) { 266 LOG_ERROR(BSL_LS_SOC_COMMON, 267 (BSL_META_U(unit, 268 "WARMBOOT ERROR.\n" 269 "Current buffer stats mode is not oob.\n"))); 270 return BCM_E_INIT; 271 } 272 273 hw_mode = (flag & _TH2_MMU_PSTATS_HWM_MOD) ? 1 : 0; 274 275 config = soc_property_get(unit, spn_BUFFER_STATS_COLLECT_MODE, 0); 276 if (config != hw_mode) { 277 LOG_WARN(BSL_LS_SOC_COMMON, 278 (BSL_META_U(unit, 279 "WARMBOOT WARNING.\n" 280 "Config mode %d. HW mode %d.\n"), 281 config, hw_mode)); 282 } 283 284 /* Reset oob mode in warmboot */ 285 SOC_IF_ERROR_RETURN(soc_tomahawk2_mmu_pstats_mode_set(unit, flag)); 286 } else 287 #endif 288 { 289 flag = _TH2_MMU_PSTATS_ENABLE; 290 if (soc_property_get(unit, spn_BUFFER_STATS_COLLECT_MODE, 0)) { 291 flag |= _TH2_MMU_PSTATS_HWM_MOD; 292 if (soc_property_get(unit, "oob_pstats_hw_cor_en", 1)) { 293 flag |= _TH2_MMU_PSTATS_RESET_ON_READ; 294 } 295 } 296 SOC_IF_ERROR_RETURN(soc_tomahawk2_mmu_pstats_mode_set(unit, flag)); 297 } 298 } 299 #endif 300 301 return BCM_E_NONE; 302 } 303 #endif 304 305 #if defined(BCM_TRIDENT3_SUPPORT) 306 /* 307 * Function: 308 * _bcm_oob_td3_init 309 * Purpose: 310 * Initialize OOB driver functions 311 * for Trident3 (BCM56870). 312 * Parameters: 313 * unit - (IN) StrataSwitch unit number. 314 * Returns: 315 * BCM_E_XXX 316 */ 317 int 318 bcm_oob_td3_init(int unit) 319 { 320 _bcm_oob_unit_driver_t *oob_driver; 321 322 oob_driver = _BCM_OOB_UNIT_DRIVER(unit); 323 if (oob_driver == NULL) { 324 return BCM_E_MEMORY; 325 } 326 327 /* Initializing Driver functions for OOB FC */ 328 oob_driver->fc_tx_config_set = bcm_td3_oob_fc_tx_config_set; 329 oob_driver->fc_tx_config_get = bcm_td3_oob_fc_tx_config_get; 330 oob_driver->fc_tx_info_get = bcm_td3_oob_fc_tx_info_get; 331 oob_driver->fc_rx_port_tc_mapping_multi_set = bcm_td3_oob_fc_rx_port_tc_mapping_multi_set; 332 oob_driver->fc_rx_port_tc_mapping_multi_get = bcm_td3_oob_fc_rx_port_tc_mapping_multi_get; 333 oob_driver->fc_rx_port_tc_mapping_set = bcm_td3_oob_fc_rx_port_tc_mapping_set; 334 oob_driver->fc_rx_port_tc_mapping_get = bcm_td3_oob_fc_rx_port_tc_mapping_get; 335 oob_driver->fc_rx_config_set = bcm_td3_oob_fc_rx_config_set; 336 oob_driver->fc_rx_config_get = bcm_td3_oob_fc_rx_config_get; 337 oob_driver->fc_rx_port_offset_get = bcm_td3_oob_fc_rx_port_offset_get; 338 339 /* oob stats init */ 340 if (1 != soc_property_get(unit, spn_BUFFER_STATS_COLLECT_TYPE, 1)) { 341 return BCM_E_NONE; 342 } 343 /* Initializing Driver functions for OOB Stats */ 344 oob_driver->stats_config_set = bcm_td3_oob_stats_config_set; 345 oob_driver->stats_config_get = bcm_td3_oob_stats_config_get; 346 oob_driver->stats_pool_mapping_multi_set = bcm_td3_oob_stats_pool_mapping_multi_set; 347 oob_driver->stats_pool_mapping_multi_get = bcm_td3_oob_stats_pool_mapping_multi_get; 348 oob_driver->stats_pool_mapping_set = bcm_td3_oob_stats_pool_mapping_set; 349 oob_driver->stats_pool_mapping_get = bcm_td3_oob_stats_pool_mapping_get; 350 oob_driver->stats_queue_mapping_multi_set = bcm_td3_oob_stats_queue_mapping_multi_set; 351 oob_driver->stats_queue_mapping_multi_get = bcm_td3_oob_stats_queue_mapping_multi_get; 352 oob_driver->stats_queue_mapping_set = bcm_td3_oob_stats_queue_mapping_set; 353 oob_driver->stats_queue_mapping_get = bcm_td3_oob_stats_queue_mapping_get; 354 355 #if defined(BCM_TRIDENT3_SUPPORT) 356 if (SOC_IS_TRIDENT3X(unit)) { 357 uint32 flag; 358 359 #ifdef BCM_WARM_BOOT_SUPPORT 360 if (SOC_WARM_BOOT(unit)) { 361 int config, hw_mode; 362 363 /* get oob config from HW */ 364 SOC_IF_ERROR_RETURN(soc_trident3_mmu_pstats_mode_get(unit, &flag)); 365 366 /* HW config is different with config property */ 367 if (!(flag & _TD3_MMU_PSTATS_ENABLE) || 368 (flag & _TD3_MMU_PSTATS_PKT_MOD)) { 369 LOG_ERROR(BSL_LS_SOC_COMMON, 370 (BSL_META_U(unit, 371 "WARMBOOT ERROR.\n" 372 "Current buffer stats mode is not oob.\n"))); 373 return BCM_E_INIT; 374 } 375 376 hw_mode = (flag & _TD3_MMU_PSTATS_HWM_MOD) ? 1 : 0; 377 378 config = soc_property_get(unit, spn_BUFFER_STATS_COLLECT_MODE, 0); 379 if (config != hw_mode) { 380 LOG_WARN(BSL_LS_SOC_COMMON, 381 (BSL_META_U(unit, 382 "WARMBOOT WARNING.\n" 383 "Config mode %d. HW mode %d.\n"), 384 config, hw_mode)); 385 } 386 387 /* Reset oob mode in warmboot */ 388 SOC_IF_ERROR_RETURN(soc_trident3_mmu_pstats_mode_set(unit, flag)); 389 } else 390 #endif 391 { 392 flag = _TD3_MMU_PSTATS_ENABLE; 393 if (soc_property_get(unit, spn_BUFFER_STATS_COLLECT_MODE, 0)) { 394 flag |= _TD3_MMU_PSTATS_HWM_MOD; 395 if (soc_property_get(unit, "oob_pstats_hw_cor_en", 1)) { 396 flag |= _TD3_MMU_PSTATS_RESET_ON_READ; 397 } 398 } 399 SOC_IF_ERROR_RETURN(soc_trident3_mmu_pstats_mode_set(unit, flag)); 400 } 401 } 402 #endif 403 404 return BCM_E_NONE; 405 } 406 #endif 407 #if defined(BCM_APACHE_SUPPORT) 408 /* 409 * Function: 410 * _bcm_oob_ap_init 411 * Purpose: 412 * Initialize OOB driver functions 413 * for Tomahawk (BCM56960). 414 * Parameters: 415 * unit - (IN) StrataSwitch unit number. 416 * Returns: 417 * BCM_E_XXX 418 */ 419 int 420 bcm_oob_ap_init(int unit) 421 { 422 _bcm_oob_unit_driver_t *oob_driver; 423 424 oob_driver = _BCM_OOB_UNIT_DRIVER(unit); 425 if (oob_driver == NULL) { 426 return BCM_E_MEMORY; 427 } 428 429 /* Initializing Driver functions for OOB FC */ 430 oob_driver->fc_tx_config_set = bcm_ap_oob_fc_tx_config_set; 431 oob_driver->fc_tx_config_get = bcm_ap_oob_fc_tx_config_get; 432 oob_driver->fc_tx_info_get = bcm_ap_oob_fc_tx_info_get; 433 oob_driver->fc_rx_port_tc_mapping_multi_set = bcm_ap_oob_fc_rx_port_tc_mapping_multi_set; 434 oob_driver->fc_rx_port_tc_mapping_multi_get = bcm_ap_oob_fc_rx_port_tc_mapping_multi_get; 435 oob_driver->fc_rx_port_tc_mapping_set = bcm_ap_oob_fc_rx_port_tc_mapping_set; 436 oob_driver->fc_rx_port_tc_mapping_get = bcm_ap_oob_fc_rx_port_tc_mapping_get; 437 oob_driver->fc_rx_config_set = bcm_ap_oob_fc_rx_config_set; 438 oob_driver->fc_rx_config_get = bcm_ap_oob_fc_rx_config_get; 439 oob_driver->fc_rx_port_offset_get = bcm_ap_oob_fc_rx_port_offset_get; 440 /* Note that Stats related APIs are not supported on apache */ 441 442 443 return BCM_E_NONE; 444 } 445 #endif 446 #if defined(BCM_KATANA2_SUPPORT) 447 /* 448 * Function: 449 * _bcm_oob_kt2_init 450 * Purpose: 451 * Initialize OOB driver functions 452 * for Katana_2 (BCM56450). 453 * Parameters: 454 * unit - (IN) StrataSwitch unit number. 455 * Returns: 456 * BCM_E_XXX 457 */ 458 int 459 bcm_oob_kt2_init(int unit) 460 { 461 _bcm_oob_unit_driver_t *oob_driver; 462 463 oob_driver = _BCM_OOB_UNIT_DRIVER(unit); 464 if (oob_driver == NULL) { 465 return BCM_E_MEMORY; 466 } 467 468 /* Initializing Driver functions for OOB FC */ 469 oob_driver->fc_tx_config_set = bcm_kt2_oob_fc_tx_config_set; 470 oob_driver->fc_tx_config_get = bcm_kt2_oob_fc_tx_config_get; 471 oob_driver->fc_tx_info_get = bcm_kt2_oob_fc_tx_info_get; 472 oob_driver->fc_rx_port_tc_mapping_multi_set = bcm_kt2_oob_fc_rx_port_tc_mapping_multi_set; 473 oob_driver->fc_rx_port_tc_mapping_multi_get = bcm_kt2_oob_fc_rx_port_tc_mapping_multi_get; 474 oob_driver->fc_rx_port_tc_mapping_set = bcm_kt2_oob_fc_rx_port_tc_mapping_set; 475 oob_driver->fc_rx_port_tc_mapping_get = bcm_kt2_oob_fc_rx_port_tc_mapping_get; 476 oob_driver->fc_rx_config_set = bcm_kt2_oob_fc_rx_config_set; 477 oob_driver->fc_rx_config_get = bcm_kt2_oob_fc_rx_config_get; 478 oob_driver->fc_rx_port_offset_get = bcm_kt2_oob_fc_rx_port_offset_get; 479 /* Note that Stats related APIs are not supported on Kt2 */ 480 return BCM_E_NONE; 481 } 482 #endif 483 484 /* 485 * Function: 486 * bcm_esw_oob_fc_tx_config_set 487 * Purpose: 488 * Set OOB FC Tx global configuration. 489 * Parameters: 490 * unit - (IN) StrataSwitch unit number. 491 * config - (IN) OOB FC Tx global configuration 492 * Returns: 493 * BCM_E_XXX 494 */ 495 int 496 bcm_esw_oob_fc_tx_config_set( 497 int unit, 498 bcm_oob_fc_tx_config_t *config) 499 { 500 if (!soc_feature(unit, soc_feature_oob_fc)) { 501 return BCM_E_UNAVAIL; 502 } 503 504 if (_bcm_oob_unit_driver[unit]->fc_tx_config_set == NULL) { 505 return BCM_E_UNAVAIL; 506 } 507 508 return _bcm_oob_unit_driver[unit]->fc_tx_config_set(unit, 509 config); 510 } 511 512 /* 513 * Function: 514 * bcm_esw_oob_fc_tx_config_get 515 * Purpose: 516 * Get OOB FC Tx global configuration. 517 * Parameters: 518 * unit - (IN) StrataSwitch unit number. 519 * config - (OUT) OOB FC Tx global configuration 520 * Returns: 521 * BCM_E_XXX 522 */ 523 int 524 bcm_esw_oob_fc_tx_config_get( 525 int unit, 526 bcm_oob_fc_tx_config_t *config) 527 { 528 if (!soc_feature(unit, soc_feature_oob_fc)) { 529 return BCM_E_UNAVAIL; 530 } 531 532 if (_bcm_oob_unit_driver[unit]->fc_tx_config_get == NULL) { 533 return BCM_E_UNAVAIL; 534 } 535 536 return _bcm_oob_unit_driver[unit]->fc_tx_config_get(unit, 537 config); 538 } 539 540 /* 541 * Function: 542 * bcm_esw_oob_fc_tx_info_get 543 * Purpose: 544 * Get OOB FC Tx global information. 545 * Parameters: 546 * unit - (IN) StrataSwitch unit number. 547 * info - (OUT) OOB FC Tx global information 548 * Returns: 549 * BCM_E_XXX 550 */ 551 int 552 bcm_esw_oob_fc_tx_info_get( 553 int unit, 554 bcm_oob_fc_tx_info_t *info) 555 { 556 if (!soc_feature(unit, soc_feature_oob_fc)) { 557 return BCM_E_UNAVAIL; 558 } 559 560 if (_bcm_oob_unit_driver[unit]->fc_tx_info_get == NULL) { 561 return BCM_E_UNAVAIL; 562 } 563 564 return _bcm_oob_unit_driver[unit]->fc_tx_info_get(unit, 565 info); 566 } 567 568 /* 569 * Function: 570 * bcm_esw_oob_fc_rx_port_tc_mapping_multi_set 571 * Purpose: 572 * Set the per port traffic class to priority 573 * mapping for each OOB FC Rx Interface. 574 * Parameters: 575 * unit - (IN) StrataSwitch unit number 576 * intf_id - (IN) OOB FC Rx Interface Number 577 * gport - (IN) Modport type gport 578 * array_count - (IN) Number of elements in Traffic Class array 579 * tc - (IN) Traffic Class array[0-7] 580 * pri_bmp - (IN) Priority Bitmap Array[0-7] 581 * Returns: 582 * BCM_E_XXX 583 */ 584 int 585 bcm_esw_oob_fc_rx_port_tc_mapping_multi_set( 586 int unit, 587 bcm_oob_fc_rx_intf_id_t intf_id, 588 bcm_gport_t gport, 589 int array_count, 590 uint32 *tc, 591 uint32 *pri_bmp) 592 { 593 if (!soc_feature(unit, soc_feature_oob_fc)) { 594 return BCM_E_UNAVAIL; 595 } 596 597 if (_bcm_oob_unit_driver[unit]->fc_rx_port_tc_mapping_multi_set == NULL) { 598 return BCM_E_UNAVAIL; 599 } 600 601 return _bcm_oob_unit_driver[unit]->fc_rx_port_tc_mapping_multi_set( 602 unit, intf_id, gport, array_count, tc, pri_bmp); 603 } 604 605 /* 606 * Function: 607 * bcm_esw_oob_fc_rx_port_tc_mapping_multi_get 608 * Purpose: 609 * Set the per port traffic class to priority 610 * mapping for each OOB FC Rx Interface. 611 * Parameters: 612 * unit - (IN) StrataSwitch unit number 613 * intf_id - (IN) OOB FC Rx Interface Number 614 * gport - (IN) Modport type gport 615 * array_max - (IN) Maximum Length tc and pri_bmp array 616 * tc - (OUT) Traffic Class array[0-7] 617 * pri_bmp - (OUT) Priority Bitmap Array[0-7] 618 * array_count - (OUT) Number of elements in Traffic Class array 619 * Returns: 620 * BCM_E_XXX 621 */ 622 int 623 bcm_esw_oob_fc_rx_port_tc_mapping_multi_get( 624 int unit, 625 bcm_oob_fc_rx_intf_id_t intf_id, 626 bcm_gport_t gport, 627 int array_max, 628 uint32 *tc, 629 uint32 *pri_bmp, 630 int *array_count) 631 { 632 if (!soc_feature(unit, soc_feature_oob_fc)) { 633 return BCM_E_UNAVAIL; 634 } 635 636 if (_bcm_oob_unit_driver[unit]->fc_rx_port_tc_mapping_multi_get == NULL) { 637 return BCM_E_UNAVAIL; 638 } 639 640 return _bcm_oob_unit_driver[unit]->fc_rx_port_tc_mapping_multi_get( 641 unit, intf_id, gport, array_max, tc, 642 pri_bmp, array_count); 643 } 644 645 /* 646 * Function: 647 * bcm_esw_oob_fc_rx_port_tc_mapping_set 648 * Purpose: 649 * Set the per port traffic class to priority 650 * mapping for each OOB FC Rx Interface. 651 * Parameters: 652 * unit - (IN) StrataSwitch unit number 653 * intf_id - (IN) OOB FC Rx Interface Number 654 * gport - (IN) Modport type gport 655 * tc - (IN) Traffic Class array[0-7] 656 * pri_bmp - (IN) Priority Bitmap Array[0-7] 657 * Returns: 658 * BCM_E_XXX 659 */ 660 int 661 bcm_esw_oob_fc_rx_port_tc_mapping_set( 662 int unit, 663 bcm_oob_fc_rx_intf_id_t intf_id, 664 bcm_gport_t gport, 665 uint32 tc, 666 uint32 pri_bmp) 667 { 668 if (!soc_feature(unit, soc_feature_oob_fc)) { 669 return BCM_E_UNAVAIL; 670 } 671 672 if (_bcm_oob_unit_driver[unit]->fc_rx_port_tc_mapping_set == NULL) { 673 return BCM_E_UNAVAIL; 674 } 675 676 return _bcm_oob_unit_driver[unit]->fc_rx_port_tc_mapping_set( 677 unit, intf_id, gport, tc, pri_bmp); 678 } 679 680 /* 681 * Function: 682 * bcm_esw_oob_fc_rx_port_tc_mapping_get 683 * Purpose: 684 * Set the per port traffic class to priority 685 * mapping for each OOB FC Rx Interface. 686 * Parameters: 687 * unit - (IN) StrataSwitch unit number 688 * intf_id - (IN) OOB FC Rx Interface Number 689 * gport - (IN) Modport type gport 690 * tc - (IN) Traffic Class array[0-7] 691 * pri_bmp - (OUT) Priority Bitmap Array[0-7] 692 * Returns: 693 * BCM_E_XXX 694 */ 695 int 696 bcm_esw_oob_fc_rx_port_tc_mapping_get( 697 int unit, 698 bcm_oob_fc_rx_intf_id_t intf_id, 699 bcm_gport_t gport, 700 uint32 tc, 701 uint32 *pri_bmp) 702 { 703 if (!soc_feature(unit, soc_feature_oob_fc)) { 704 return BCM_E_UNAVAIL; 705 } 706 707 if (_bcm_oob_unit_driver[unit]->fc_rx_port_tc_mapping_get == NULL) { 708 return BCM_E_UNAVAIL; 709 } 710 711 return _bcm_oob_unit_driver[unit]->fc_rx_port_tc_mapping_get( 712 unit, intf_id, gport, tc, 713 pri_bmp); 714 } 715 716 /* 717 * Function: 718 * bcm_esw_oob_fc_rx_config_set 719 * Purpose: 720 * Set the configuration and enable 721 * each OOB FC Rx Interface. 722 * Parameters: 723 * unit - (IN) StrataSwitch unit number 724 * intf_id - (IN) OOB FC Rx Interface Number 725 * config - (IN) OOB FC Rx Interface Config 726 * array_count - (IN) Number of gports in the gport array 727 * gport_array - (IN) Array of modport type gport 728 * Returns: 729 * BCM_E_XXX 730 */ 731 int 732 bcm_esw_oob_fc_rx_config_set( 733 int unit, 734 bcm_oob_fc_rx_intf_id_t intf_id, 735 bcm_oob_fc_rx_config_t *config, 736 int array_count, 737 bcm_gport_t *gport_array) 738 { 739 if (!soc_feature(unit, soc_feature_oob_fc)) { 740 return BCM_E_UNAVAIL; 741 } 742 743 if (_bcm_oob_unit_driver[unit]->fc_rx_config_set == NULL) { 744 return BCM_E_UNAVAIL; 745 } 746 747 return _bcm_oob_unit_driver[unit]->fc_rx_config_set( 748 unit, intf_id, config, 749 array_count, gport_array); 750 } 751 752 /* 753 * Function: 754 * bcm_esw_oob_fc_rx_config_get 755 * Purpose: 756 * Get the configuration and status 757 * each OOB FC Rx Interface. 758 * Parameters: 759 * unit - (IN) StrataSwitch unit number 760 * intf_id - (IN) OOB FC Rx Interface Number 761 * config - (OUT) OOB FC Rx Interface Config 762 * array_max - (IN) Maximum Lenght of Gport array passed 763 * gport_array - (OUT) Array of modport type gport 764 * array_count - (OUT) Number of gports returned in the gport array 765 * Returns: 766 * BCM_E_XXX 767 */ 768 int 769 bcm_esw_oob_fc_rx_config_get( 770 int unit, 771 bcm_oob_fc_rx_intf_id_t intf_id, 772 bcm_oob_fc_rx_config_t *config, 773 int array_max, 774 bcm_gport_t *gport_array, 775 int *array_count) 776 { 777 if (!soc_feature(unit, soc_feature_oob_fc)) { 778 return BCM_E_UNAVAIL; 779 } 780 781 if (_bcm_oob_unit_driver[unit]->fc_rx_config_get == NULL) { 782 return BCM_E_UNAVAIL; 783 } 784 785 return _bcm_oob_unit_driver[unit]->fc_rx_config_get( 786 unit, intf_id, config, 787 array_max, gport_array, array_count); 788 } 789 790 /* 791 * Function: 792 * bcm_esw_oob_fc_rx_port_offset_get 793 * Purpose: 794 * Get the Channel offset value for a given port 795 * on each OOB FC Rx Interface. 796 * Parameters: 797 * unit - (IN) StrataSwitch unit number 798 * intf_id - (IN) OOB FC Rx Interface Number 799 * gport - (IN) Modport type gport 800 * offset - (OUT) Channel offset value in HCFC message 801 * Returns: 802 * BCM_E_XXX 803 */ 804 int 805 bcm_esw_oob_fc_rx_port_offset_get( 806 int unit, 807 bcm_oob_fc_rx_intf_id_t intf_id, 808 bcm_gport_t gport, 809 uint32 *offset) 810 { 811 if (!soc_feature(unit, soc_feature_oob_fc)) { 812 return BCM_E_UNAVAIL; 813 } 814 815 if (_bcm_oob_unit_driver[unit]->fc_rx_port_offset_get == NULL) { 816 return BCM_E_UNAVAIL; 817 } 818 819 return _bcm_oob_unit_driver[unit]->fc_rx_port_offset_get( 820 unit, intf_id, gport, offset); 821 } 822 823 /* 824 * Function: 825 * bcm_esw_oob_stats_config_set 826 * Purpose: 827 * Set the global configuration setting 828 * for OOB STATS. 829 * Parameters: 830 * unit - (IN) StrataSwitch unit number 831 * config - (IN) OOB Stats Configuration structure 832 * Returns: 833 * BCM_E_XXX 834 */ 835 int bcm_esw_oob_stats_config_set( 836 int unit, 837 bcm_oob_stats_config_t *config) 838 { 839 if (!soc_feature(unit, soc_feature_oob_stats)) { 840 return BCM_E_UNAVAIL; 841 } 842 843 if (_bcm_oob_unit_driver[unit]->stats_config_set == NULL) { 844 return BCM_E_UNAVAIL; 845 } 846 847 return _bcm_oob_unit_driver[unit]->stats_config_set(unit, 848 config); 849 } 850 851 /* 852 * Function: 853 * bcm_esw_oob_stats_config_get 854 * Purpose: 855 * Get the global configuration setting 856 * for OOB STATS. 857 * Parameters: 858 * unit - (IN) StrataSwitch unit number 859 * config - (OUT) OOB Stats Configuration structure 860 * Returns: 861 * BCM_E_XXX 862 */ 863 int bcm_esw_oob_stats_config_get( 864 int unit, 865 bcm_oob_stats_config_t *config) 866 { 867 if (!soc_feature(unit, soc_feature_oob_stats)) { 868 return BCM_E_UNAVAIL; 869 } 870 871 if (_bcm_oob_unit_driver[unit]->stats_config_get == NULL) { 872 return BCM_E_UNAVAIL; 873 } 874 875 return _bcm_oob_unit_driver[unit]->stats_config_get(unit, 876 config); 877 } 878 879 /* 880 * Function: 881 * bcm_esw_oob_stats_pool_mapping_multi_set 882 * Purpose: 883 * Set the service pool id at a given index in the memory 884 * so that OOB Stats will be reported in the same order 885 * as the service pool ids are programmed in the memory. 886 * Parameters: 887 * unit - (IN) StrataSwitch unit number 888 * array_count - (IN) Number of elements in array 889 * offset_array - (IN) Indexes at which service pool 890 * in the service pool list needs to be added 891 * dir_array - (IN) Direction array 892 * pool_array - (IN) Service Pool ID array 893 * Returns: 894 * BCM_E_XXX 895 */ 896 int bcm_esw_oob_stats_pool_mapping_multi_set( 897 int unit, int array_count, int *offset_array, 898 uint8 *dir_array, bcm_service_pool_id_t *pool_array) 899 { 900 if (!soc_feature(unit, soc_feature_oob_stats)) { 901 return BCM_E_UNAVAIL; 902 } 903 904 if (_bcm_oob_unit_driver[unit]->stats_pool_mapping_multi_set == NULL) { 905 return BCM_E_UNAVAIL; 906 } 907 908 return _bcm_oob_unit_driver[unit]->stats_pool_mapping_multi_set(unit, 909 array_count, offset_array, 910 dir_array, pool_array); 911 } 912 913 /* 914 * Function: 915 * bcm_esw_oob_stats_pool_mapping_multi_get 916 * Purpose: 917 * Get the service pool id at a given index in the memory. 918 * OOB Stats will be reported in the same order 919 * as the service pool ids are programmed in the memory. 920 * Parameters: 921 * unit - (IN) StrataSwitch unit number 922 * array_max - (IN) Number of elements in array 923 * offset_array - (IN) Indexes at which service pool 924 * in the service pool list needs to be added 925 * dir_array - (OUT) Direction array 926 * pool_array - (OUT) Service Pool ID array 927 * array_count - (OUT) Number of elements returned in the array 928 * Returns: 929 * BCM_E_XXX 930 */ 931 int bcm_esw_oob_stats_pool_mapping_multi_get( 932 int unit, int array_max, int *offset_array, uint8 *dir_array, 933 bcm_service_pool_id_t *pool_array, int *array_count) 934 { 935 if (!soc_feature(unit, soc_feature_oob_stats)) { 936 return BCM_E_UNAVAIL; 937 } 938 939 if (_bcm_oob_unit_driver[unit]->stats_pool_mapping_multi_get == NULL) { 940 return BCM_E_UNAVAIL; 941 } 942 943 return _bcm_oob_unit_driver[unit]->stats_pool_mapping_multi_get(unit, 944 array_max, offset_array, dir_array, 945 pool_array, array_count); 946 } 947 948 /* 949 * Function: 950 * bcm_esw_oob_stats_pool_mapping_set 951 * Purpose: 952 * Set the service pool id at a given index in the memory 953 * so that OOB Stats will be reported in the same order 954 * as the service pool ids are programmed in the memory. 955 * Parameters: 956 * unit - (IN) StrataSwitch unit number 957 * offset - (IN) Index at which service pool 958 * in the service pool list needs to be added 959 * dir - (IN) Direction 960 * pool - (IN) Service Pool ID 961 * Returns: 962 * BCM_E_XXX 963 */ 964 int bcm_esw_oob_stats_pool_mapping_set( 965 int unit, int offset, uint8 dir, 966 bcm_service_pool_id_t pool) 967 { 968 if (!soc_feature(unit, soc_feature_oob_stats)) { 969 return BCM_E_UNAVAIL; 970 } 971 972 if (_bcm_oob_unit_driver[unit]->stats_pool_mapping_set == NULL) { 973 return BCM_E_UNAVAIL; 974 } 975 976 return _bcm_oob_unit_driver[unit]->stats_pool_mapping_set(unit, 977 offset, dir, pool); 978 } 979 980 /* 981 * Function: 982 * bcm_esw_oob_stats_pool_mapping_get 983 * Purpose: 984 * Get the service pool id at a given index in the memory. 985 * OOB Stats will be reported in the same order 986 * as the service pool ids are programmed in the memory. 987 * Parameters: 988 * unit - (IN) StrataSwitch unit number 989 * offset - (IN) Index at which service pool 990 * in the service pool list needs to be added 991 * dir - (OUT) Direction 992 * pool - (OUT) Service Pool ID 993 * Returns: 994 * BCM_E_XXX 995 */ 996 int bcm_esw_oob_stats_pool_mapping_get( 997 int unit, int offset, uint8 *dir, 998 bcm_service_pool_id_t *pool) 999 { 1000 if (!soc_feature(unit, soc_feature_oob_stats)) { 1001 return BCM_E_UNAVAIL; 1002 } 1003 1004 if (_bcm_oob_unit_driver[unit]->stats_pool_mapping_get == NULL) { 1005 return BCM_E_UNAVAIL; 1006 } 1007 1008 return _bcm_oob_unit_driver[unit]->stats_pool_mapping_get(unit, 1009 offset, dir, pool); 1010 } 1011 1012 /* 1013 * Function: 1014 * bcm_esw_oob_stats_queue_mapping_multi_set 1015 * Purpose: 1016 * Set the queue id at a given index in the memory 1017 * so that OOB Stats will be reported in the same order 1018 * as the queue ids are programmed in the memory. 1019 * Parameters: 1020 * unit - (IN) StrataSwitch unit number 1021 * array_count - (IN) Number of elements in array 1022 * offset_array - (IN) Indexes at which Queue Id 1023 * in the queue list needs to be added 1024 * gport_array - (IN) Queue gport array 1025 * Returns: 1026 * BCM_E_XXX 1027 */ 1028 int bcm_esw_oob_stats_queue_mapping_multi_set( 1029 int unit, int array_count, int *offset_array, 1030 bcm_gport_t *gport_array) 1031 { 1032 if (!soc_feature(unit, soc_feature_oob_stats)) { 1033 return BCM_E_UNAVAIL; 1034 } 1035 1036 if (_bcm_oob_unit_driver[unit]->stats_queue_mapping_multi_set == NULL) { 1037 return BCM_E_UNAVAIL; 1038 } 1039 1040 return _bcm_oob_unit_driver[unit]->stats_queue_mapping_multi_set(unit, 1041 array_count, offset_array, 1042 gport_array); 1043 } 1044 1045 /* 1046 * Function: 1047 * bcm_esw_oob_stats_queue_mapping_multi_get 1048 * Purpose: 1049 * Get the UC queue id at a given index in the memory. 1050 * OOB Stats will be reported in the same order 1051 * as the UC queue ids are programmed in the memory. 1052 * Parameters: 1053 * unit - (IN) StrataSwitch unit number 1054 * array_max - (IN) Maximum number of elements in array 1055 * offset_array - (IN) Indexes at which Queue Id 1056 * in the queue list needs to be added 1057 * gport_array - (OUT) Queue gport array 1058 * array_count - (OUT) Number of elements in array 1059 * Returns: 1060 * BCM_E_XXX 1061 */ 1062 int bcm_esw_oob_stats_queue_mapping_multi_get( 1063 int unit, int array_max, int *offset_array, 1064 bcm_gport_t *gport_array, int *array_count) 1065 { 1066 if (!soc_feature(unit, soc_feature_oob_stats)) { 1067 return BCM_E_UNAVAIL; 1068 } 1069 1070 if (_bcm_oob_unit_driver[unit]->stats_queue_mapping_multi_get == NULL) { 1071 return BCM_E_UNAVAIL; 1072 } 1073 1074 return _bcm_oob_unit_driver[unit]->stats_queue_mapping_multi_get(unit, 1075 array_max, offset_array, 1076 gport_array, array_count); 1077 } 1078 1079 /* 1080 * Function: 1081 * bcm_esw_oob_stats_queue_mapping_set 1082 * Purpose: 1083 * Set the queue id at a given index in the memory 1084 * so that OOB Stats will be reported in the same order 1085 * as the queue ids are programmed in the memory. 1086 * Parameters: 1087 * unit - (IN) StrataSwitch unit number 1088 * offset - (IN) Index at which Queue Id 1089 * in the queue list needs to be added 1090 * gport - (IN) Queue gport 1091 * Returns: 1092 * BCM_E_XXX 1093 */ 1094 int bcm_esw_oob_stats_queue_mapping_set( 1095 int unit, int offset, bcm_gport_t gport) 1096 { 1097 if (!soc_feature(unit, soc_feature_oob_stats)) { 1098 return BCM_E_UNAVAIL; 1099 } 1100 1101 if (_bcm_oob_unit_driver[unit]->stats_queue_mapping_set == NULL) { 1102 return BCM_E_UNAVAIL; 1103 } 1104 1105 return _bcm_oob_unit_driver[unit]->stats_queue_mapping_set(unit, 1106 offset, gport); 1107 } 1108 1109 /* 1110 * Function: 1111 * bcm_esw_oob_stats_queue_mapping_get 1112 * Purpose: 1113 * Get the UC queue id at a given index in the memory. 1114 * OOB Stats will be reported in the same order 1115 * as the UC queue ids are programmed in the memory. 1116 * Parameters: 1117 * unit - (IN) StrataSwitch unit number 1118 * offset - (IN) Index at which Queue Id 1119 * in the queue list needs to be added 1120 * gport - (OUT) Queue gport 1121 * Returns: 1122 * BCM_E_XXX 1123 */ 1124 int bcm_esw_oob_stats_queue_mapping_get( 1125 int unit, int offset, bcm_gport_t *gport) 1126 { 1127 if (!soc_feature(unit, soc_feature_oob_stats)) { 1128 return BCM_E_UNAVAIL; 1129 } 1130 1131 if (_bcm_oob_unit_driver[unit]->stats_queue_mapping_get == NULL) { 1132 return BCM_E_UNAVAIL; 1133 } 1134 1135 return _bcm_oob_unit_driver[unit]->stats_queue_mapping_get(unit, 1136 offset, gport); 1137 }