obm.h (15978B)
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_OBM_H 12 #define BCMINT_LTSW_MBCM_OBM_H 13 14 #include <bcm/types.h> 15 #include <bcm/cosq.h> 16 17 #include <bcm_int/ltsw/obm.h> 18 19 /*! 20 * \brief Get OBM traffic class for max watermark mode 21 * 22 * \param [in] unit Unit Number. 23 * \param [in] port Port ID. 24 * \param [out] obm_wm_mode OBM traffic class for max watermark mode selection. 25 * 26 * \retval SHR_E_NONE No errors. 27 * \retval !SHR_E_NONE Failure. 28 */ 29 typedef int (*obm_port_max_usage_mode_get_f)( 30 int unit, 31 bcm_port_t port, 32 bcm_obm_max_watermark_mode_t *obm_wm_mode); 33 34 /*! 35 * \brief Set OBM traffic class for max watermark mode 36 * 37 * \param [in] unit Unit Number. 38 * \param [in] port Port ID. 39 * \param [in] obm_wm_mode OBM traffic class for max watermark mode selection. 40 * 41 * \retval SHR_E_NONE No errors. 42 * \retval !SHR_E_NONE Failure. 43 */ 44 typedef int (*obm_port_max_usage_mode_set_f)( 45 int unit, 46 bcm_port_t port, 47 bcm_obm_max_watermark_mode_t obm_wm_mode); 48 49 /*! 50 * \brief Determine which COS queue a given priority currently maps to 51 * 52 * \param [in] unit Unit Number. 53 * \param [in] port Port ID. 54 * \param [in] piority_type Lookup priority type. 55 * \param [in] priority Priority. 56 * \param [out] obm_tc OBM traffic class to be mapped. 57 * 58 * \retval SHR_E_NONE No errors. 59 * \retval !SHR_E_NONE Failure. 60 */ 61 typedef int (*obm_port_pri_traffic_class_mapping_get_f)( 62 int unit, 63 bcm_port_t port, 64 bcm_obm_lookup_priority_type_t piority_type, 65 int priority, 66 bcm_obm_traffic_class_t *obm_tc); 67 68 /*! 69 * \brief Determine which COS queue a given priority currently maps to 70 * 71 * \param [in] unit Unit Number. 72 * \param [in] port Port ID. 73 * \param [in] piority_type Lookup priority type. 74 * \param [in] priority Priority. 75 * \param [in] obm_tc OBM traffic class to be mapped. 76 * 77 * \retval SHR_E_NONE No errors. 78 * \retval !SHR_E_NONE Failure. 79 */ 80 typedef int (*obm_port_pri_traffic_class_mapping_set_f)( 81 int unit, 82 bcm_port_t port, 83 bcm_obm_lookup_priority_type_t piority_type, 84 int priority, 85 bcm_obm_traffic_class_t obm_tc); 86 87 /*! 88 * \brief Get port controls for OBM parsing 89 * 90 * \param [in] unit Unit Number. 91 * \param [in] port Port ID. 92 * \param [in] type Parse type. 93 * \param [out] arg arg. 94 * 95 * \retval SHR_E_NONE No errors. 96 * \retval !SHR_E_NONE Failure. 97 */ 98 typedef int (*obm_port_control_get_f)( 99 int unit, 100 bcm_port_t port, 101 bcmi_ltsw_obm_port_control_t type, 102 int *arg); 103 104 /*! 105 * \brief Set port controls for OBM parsing 106 * 107 * \param [in] unit Unit Number. 108 * \param [in] port Port ID. 109 * \param [in] type Parse type. 110 * \param [in] arg arg. 111 * 112 * \retval SHR_E_NONE No errors. 113 * \retval !SHR_E_NONE Failure. 114 */ 115 typedef int (*obm_port_control_set_f)( 116 int unit, 117 bcm_port_t port, 118 bcmi_ltsw_obm_port_control_t type, 119 int arg); 120 121 /*! 122 * \brief Get pm port controls for OBM parsing 123 * 124 * \param [in] unit Unit Number. 125 * \param [in] pm_id PM ID. 126 * \param [in] type Parse type. 127 * \param [out] arg arg. 128 * 129 * \retval SHR_E_NONE No errors. 130 * \retval !SHR_E_NONE Failure. 131 */ 132 typedef int (*obm_pm_port_control_get_f)( 133 int unit, 134 int pm_id, 135 bcmi_ltsw_obm_port_control_t type, 136 int *arg); 137 138 /*! 139 * \brief Set pm port controls for OBM parsing 140 * 141 * \param [in] unit Unit Number. 142 * \param [in] pm_id PM ID. 143 * \param [in] type Parse type. 144 * \param [in] arg arg. 145 * 146 * \retval SHR_E_NONE No errors. 147 * \retval !SHR_E_NONE Failure. 148 */ 149 typedef int (*obm_pm_port_control_set_f)( 150 int unit, 151 int pm_id, 152 bcmi_ltsw_obm_port_control_t type, 153 int arg); 154 155 /*! 156 * \brief Get the mapping of bcm_obm_code_point to bcm_obm_priority 157 * 158 * \param [in] unit Unit Number. 159 * \param [in] gport gport for a given port. 160 * \param [in] switch_obm_classifier_type type of switch_obm_classifier. 161 * \param [in] array_max Maximum number of elements in switch_obm_classifier. 162 * \param [out] switch_obm_classifier Array of bcm_switch_obm_classifier_t. 163 * \param [out] array_count Number of elements in switch_obm_classifier. 164 * 165 * \retval SHR_E_NONE No errors. 166 * \retval !SHR_E_NONE Failure. 167 */ 168 typedef int (*obm_classifier_mapping_multi_get_f)( 169 int unit, 170 bcm_gport_t gport, 171 bcm_switch_obm_classifier_type_t switch_obm_classifier_type, 172 int array_max, 173 bcm_switch_obm_classifier_t *switch_obm_classifier, 174 int *array_count); 175 176 /*! 177 * \brief Set the mapping of bcm_obm_code_point to bcm_obm_priority 178 * 179 * \param [in] unit Unit Number. 180 * \param [in] gport gport for a given port. 181 * \param [in] switch_obm_classifier_type type of switch_obm_classifier. 182 * \param [in] array_count Number of elements in switch_obm_classifier. 183 * \param [in] switch_obm_classifier Array of bcm_switch_obm_classifier_t. 184 * 185 * \retval SHR_E_NONE No errors. 186 * \retval !SHR_E_NONE Failure. 187 */ 188 typedef int (*obm_classifier_mapping_multi_set_f)( 189 int unit, 190 bcm_gport_t gport, 191 bcm_switch_obm_classifier_type_t switch_obm_classifier_type, 192 int array_count, 193 bcm_switch_obm_classifier_t *switch_obm_classifier); 194 195 /*! 196 * \brief Get OBM flow control configuration 197 * 198 * \param [in] unit Unit Number. 199 * \param [in] port Port ID. 200 * \param [in] obm_traffic_class OBM traffic classes. 201 * \param [in] max_pri_count Max count. 202 * \param [out] priority_list priority array. 203 * \param [out] pri_count Count. 204 * 205 * \retval SHR_E_NONE No errors. 206 * \retval !SHR_E_NONE Failure. 207 */ 208 typedef int (*obm_traffic_class_pfc_priority_mapping_get_f)( 209 int unit, 210 bcm_port_t port, 211 bcm_obm_traffic_class_t obm_traffic_class, 212 int max_pri_count, 213 int *priority_list, 214 int *pri_count); 215 216 /*! 217 * \brief Set OBM flow control configuration 218 * 219 * \param [in] unit Unit Number. 220 * \param [in] port Port ID. 221 * \param [in] obm_traffic_class OBM traffic classes. 222 * \param [in] max_pri_count Max count. 223 * \param [in] priority_list priority array. 224 * 225 * \retval SHR_E_NONE No errors. 226 * \retval !SHR_E_NONE Failure. 227 */ 228 typedef int (*obm_traffic_class_pfc_priority_mapping_set_f)( 229 int unit, 230 bcm_port_t port, 231 bcm_obm_traffic_class_t obm_traffic_class, 232 int max_pri_count, 233 int *priority_list); 234 235 /*! 236 * \brief Initialize the obm module. 237 * 238 * \param [in] unit Unit Number. 239 * 240 * \retval SHR_E_NONE No errors. 241 * \retval !SHR_E_NONE Failure. 242 */ 243 typedef int (*obm_init_f)(int unit); 244 245 /*! 246 * \brief Detach the obm module. 247 * 248 * \param [in] unit Unit Number. 249 * 250 * \retval SHR_E_NONE No errors. 251 * \retval !SHR_E_NONE Failure. 252 */ 253 typedef int (*obm_detach_f)(int unit); 254 255 /*! 256 * \brief Enable obm port flow control setting. 257 * 258 * \param [in] unit Unit Number. 259 * \param [in] lport Logical port ID. 260 * \param [in] fc_type Flow control type, 0: parse, 1: PFC. 261 * 262 * \retval SHR_E_NONE No errors. 263 * \retval !SHR_E_NONE Failure. 264 */ 265 typedef int (*obm_port_fc_enable_set_f)( 266 int unit, 267 int lport, 268 int fc_type); 269 270 /*! 271 * \brief OBM driver structure. 272 */ 273 typedef struct mbcm_ltsw_obm_drv_s { 274 275 /*! Get OBM traffic class for max watermark mode */ 276 obm_port_max_usage_mode_get_f obm_port_max_usage_mode_get; 277 278 /*! Set OBM traffic class for max watermark mode */ 279 obm_port_max_usage_mode_set_f obm_port_max_usage_mode_set; 280 281 /*! Determine which COS queue a given priority currently maps to */ 282 obm_port_pri_traffic_class_mapping_get_f obm_port_pri_traffic_class_mapping_get; 283 284 /*! Determine which COS queue a given priority currently maps to */ 285 obm_port_pri_traffic_class_mapping_set_f obm_port_pri_traffic_class_mapping_set; 286 287 /*! Get port controls for OBM parsing */ 288 obm_port_control_get_f obm_port_control_get; 289 290 /*! Set port controls for OBM parsing */ 291 obm_port_control_set_f obm_port_control_set; 292 293 /*! Get pm port controls for OBM parsing */ 294 obm_pm_port_control_get_f obm_pm_port_control_get; 295 296 /*! Set pm port controls for OBM parsing */ 297 obm_pm_port_control_set_f obm_pm_port_control_set; 298 299 /*! Get the mapping of bcm_obm_code_point to bcm_obm_priority */ 300 obm_classifier_mapping_multi_get_f obm_classifier_mapping_multi_get; 301 302 /*! Set the mapping of bcm_obm_code_point to bcm_obm_priority */ 303 obm_classifier_mapping_multi_set_f obm_classifier_mapping_multi_set; 304 305 /*! Get OBM flow control configuration */ 306 obm_traffic_class_pfc_priority_mapping_get_f obm_traffic_class_pfc_priority_mapping_get; 307 308 /*! Set OBM flow control configuration */ 309 obm_traffic_class_pfc_priority_mapping_set_f obm_traffic_class_pfc_priority_mapping_set; 310 311 /*! Initialize the obm module. */ 312 obm_init_f obm_init; 313 314 /*! Detach the obm module. */ 315 obm_detach_f obm_detach; 316 317 /*! Enable obm port flow control setting. */ 318 obm_port_fc_enable_set_f obm_port_fc_enable_set; 319 320 } mbcm_ltsw_obm_drv_t; 321 322 /*! 323 * \brief Set the OBM driver of the device. 324 * 325 * \param [in] unit Unit Number. 326 * \param [in] drv Obm driver to set. 327 * 328 * \retval SHR_E_NONE No errors. 329 * \retval !SHR_E_NONE Failure. 330 */ 331 extern int 332 mbcm_ltsw_obm_drv_set( 333 int unit, 334 mbcm_ltsw_obm_drv_t *drv); 335 336 /*! 337 * \brief Get OBM traffic class for max watermark mode 338 * 339 * \param [in] unit Unit Number. 340 * \param [in] port Port ID. 341 * \param [out] obm_wm_mode OBM traffic class for max watermark mode selection. 342 * 343 * \retval SHR_E_NONE No errors. 344 * \retval !SHR_E_NONE Failure. 345 */ 346 extern int 347 mbcm_ltsw_obm_port_max_usage_mode_get( 348 int unit, 349 bcm_port_t port, 350 bcm_obm_max_watermark_mode_t *obm_wm_mode); 351 352 /*! 353 * \brief Set OBM traffic class for max watermark mode 354 * 355 * \param [in] unit Unit Number. 356 * \param [in] port Port ID. 357 * \param [in] obm_wm_mode OBM traffic class for max watermark mode selection. 358 * 359 * \retval SHR_E_NONE No errors. 360 * \retval !SHR_E_NONE Failure. 361 */ 362 extern int 363 mbcm_ltsw_obm_port_max_usage_mode_set( 364 int unit, 365 bcm_port_t port, 366 bcm_obm_max_watermark_mode_t obm_wm_mode); 367 368 /*! 369 * \brief Determine which COS queue a given priority currently maps to 370 * 371 * \param [in] unit Unit Number. 372 * \param [in] port Port ID. 373 * \param [in] piority_type Lookup priority type. 374 * \param [in] priority Priority. 375 * \param [out] obm_tc OBM traffic class to be mapped. 376 * 377 * \retval SHR_E_NONE No errors. 378 * \retval !SHR_E_NONE Failure. 379 */ 380 extern int 381 mbcm_ltsw_obm_port_pri_traffic_class_mapping_get( 382 int unit, 383 bcm_port_t port, 384 bcm_obm_lookup_priority_type_t piority_type, 385 int priority, 386 bcm_obm_traffic_class_t *obm_tc); 387 388 /*! 389 * \brief Determine which COS queue a given priority currently maps to 390 * 391 * \param [in] unit Unit Number. 392 * \param [in] port Port ID. 393 * \param [in] piority_type Lookup priority type. 394 * \param [in] priority Priority. 395 * \param [in] obm_tc OBM traffic class to be mapped. 396 * 397 * \retval SHR_E_NONE No errors. 398 * \retval !SHR_E_NONE Failure. 399 */ 400 extern int 401 mbcm_ltsw_obm_port_pri_traffic_class_mapping_set( 402 int unit, 403 bcm_port_t port, 404 bcm_obm_lookup_priority_type_t piority_type, 405 int priority, 406 bcm_obm_traffic_class_t obm_tc); 407 408 /*! 409 * \brief Get port controls for OBM parsing 410 * 411 * \param [in] unit Unit Number. 412 * \param [in] port Port ID. 413 * \param [in] type Parse type. 414 * \param [out] arg arg. 415 * 416 * \retval SHR_E_NONE No errors. 417 * \retval !SHR_E_NONE Failure. 418 */ 419 extern int 420 mbcm_ltsw_obm_port_control_get( 421 int unit, 422 bcm_port_t port, 423 bcmi_ltsw_obm_port_control_t type, 424 int *arg); 425 426 /*! 427 * \brief Set port controls for OBM parsing 428 * 429 * \param [in] unit Unit Number. 430 * \param [in] port Port ID. 431 * \param [in] type Parse type. 432 * \param [in] arg arg. 433 * 434 * \retval SHR_E_NONE No errors. 435 * \retval !SHR_E_NONE Failure. 436 */ 437 extern int 438 mbcm_ltsw_obm_port_control_set( 439 int unit, 440 bcm_port_t port, 441 bcmi_ltsw_obm_port_control_t type, 442 int arg); 443 444 /*! 445 * \brief Get pm port controls for OBM parsing 446 * 447 * \param [in] unit Unit Number. 448 * \param [in] pm_id PM ID. 449 * \param [in] type Parse type. 450 * \param [out] arg arg. 451 * 452 * \retval SHR_E_NONE No errors. 453 * \retval !SHR_E_NONE Failure. 454 */ 455 extern int 456 mbcm_ltsw_obm_pm_port_control_get( 457 int unit, 458 int pm_id, 459 bcmi_ltsw_obm_port_control_t type, 460 int *arg); 461 462 /*! 463 * \brief Set pm port controls for OBM parsing 464 * 465 * \param [in] unit Unit Number. 466 * \param [in] pm_id PM ID. 467 * \param [in] type Parse type. 468 * \param [in] arg arg. 469 * 470 * \retval SHR_E_NONE No errors. 471 * \retval !SHR_E_NONE Failure. 472 */ 473 extern int 474 mbcm_ltsw_obm_pm_port_control_set( 475 int unit, 476 int pm_id, 477 bcmi_ltsw_obm_port_control_t type, 478 int arg); 479 480 /*! 481 * \brief Get the mapping of bcm_obm_code_point to bcm_obm_priority 482 * 483 * \param [in] unit Unit Number. 484 * \param [in] gport gport for a given port. 485 * \param [in] switch_obm_classifier_type type of switch_obm_classifier. 486 * \param [in] array_max Maximum number of elements in switch_obm_classifier. 487 * \param [out] switch_obm_classifier Array of bcm_switch_obm_classifier_t. 488 * \param [out] array_count Number of elements in switch_obm_classifier. 489 * 490 * \retval SHR_E_NONE No errors. 491 * \retval !SHR_E_NONE Failure. 492 */ 493 extern int 494 mbcm_ltsw_obm_classifier_mapping_multi_get( 495 int unit, 496 bcm_gport_t gport, 497 bcm_switch_obm_classifier_type_t switch_obm_classifier_type, 498 int array_max, 499 bcm_switch_obm_classifier_t *switch_obm_classifier, 500 int *array_count); 501 502 /*! 503 * \brief Set the mapping of bcm_obm_code_point to bcm_obm_priority 504 * 505 * \param [in] unit Unit Number. 506 * \param [in] gport gport for a given port. 507 * \param [in] switch_obm_classifier_type type of switch_obm_classifier. 508 * \param [in] array_count Number of elements in switch_obm_classifier. 509 * \param [in] switch_obm_classifier Array of bcm_switch_obm_classifier_t. 510 * 511 * \retval SHR_E_NONE No errors. 512 * \retval !SHR_E_NONE Failure. 513 */ 514 extern int 515 mbcm_ltsw_obm_classifier_mapping_multi_set( 516 int unit, 517 bcm_gport_t gport, 518 bcm_switch_obm_classifier_type_t switch_obm_classifier_type, 519 int array_count, 520 bcm_switch_obm_classifier_t *switch_obm_classifier); 521 522 /*! 523 * \brief Get OBM flow control configuration 524 * 525 * \param [in] unit Unit Number. 526 * \param [in] port Port ID. 527 * \param [in] obm_traffic_class OBM traffic classes. 528 * \param [in] max_pri_count Max count. 529 * \param [out] priority_list priority array. 530 * \param [out] pri_count Count. 531 * 532 * \retval SHR_E_NONE No errors. 533 * \retval !SHR_E_NONE Failure. 534 */ 535 extern int 536 mbcm_ltsw_obm_traffic_class_pfc_priority_mapping_get( 537 int unit, 538 bcm_port_t port, 539 bcm_obm_traffic_class_t obm_traffic_class, 540 int max_pri_count, 541 int *priority_list, 542 int *pri_count); 543 544 /*! 545 * \brief Set OBM flow control configuration 546 * 547 * \param [in] unit Unit Number. 548 * \param [in] port Port ID. 549 * \param [in] obm_traffic_class OBM traffic classes. 550 * \param [in] max_pri_count Max count. 551 * \param [in] priority_list priority array. 552 * 553 * \retval SHR_E_NONE No errors. 554 * \retval !SHR_E_NONE Failure. 555 */ 556 extern int 557 mbcm_ltsw_obm_traffic_class_pfc_priority_mapping_set( 558 int unit, 559 bcm_port_t port, 560 bcm_obm_traffic_class_t obm_traffic_class, 561 int max_pri_count, 562 int *priority_list); 563 564 /*! 565 * \brief Initialize the obm module. 566 * 567 * \param [in] unit Unit Number. 568 * 569 * \retval SHR_E_NONE No errors. 570 * \retval !SHR_E_NONE Failure. 571 */ 572 extern int 573 mbcm_ltsw_obm_init(int unit); 574 575 /*! 576 * \brief Detach the obm module. 577 * 578 * \param [in] unit Unit Number. 579 * 580 * \retval SHR_E_NONE No errors. 581 * \retval !SHR_E_NONE Failure. 582 */ 583 extern int 584 mbcm_ltsw_obm_detach(int unit); 585 586 /*! 587 * \brief Enable obm port flow control setting. 588 * 589 * \param [in] unit Unit Number. 590 * \param [in] lport Logical port ID. 591 * \param [in] fc_type Flow control type, 0: parse, 1: PFC. 592 * 593 * \retval SHR_E_NONE No errors. 594 * \retval !SHR_E_NONE Failure. 595 */ 596 extern int 597 mbcm_ltsw_obm_port_fc_enable_set( 598 int unit, 599 int lport, 600 int fc_type); 601 602 #endif /* BCMINT_LTSW_MBCM_OBM_H */