stat.h (17634B)
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_STAT_H 12 #define BCMINT_LTSW_MBCM_STAT_H 13 14 #include <bcm/types.h> 15 #include <bcm/stat.h> 16 17 #include <bcm_int/ltsw/stat_int.h> 18 #include <bcm_int/ltsw/stat.h> 19 20 #include <sal/sal_types.h> 21 22 /*! 23 * \brief Initializes the stat module. 24 * 25 * \param [in] unit Unit Number. 26 * 27 * \retval SHR_E_NONE No errors. 28 * \retval !SHR_E_NONE Failure. 29 */ 30 typedef int (*stat_init_f)(int unit); 31 32 /*! 33 * \brief De-initializes the stat module. 34 * 35 * \param [in] unit Unit Number. 36 * 37 * \retval SHR_E_NONE No errors. 38 * \retval !SHR_E_NONE Failure. 39 */ 40 typedef int (*stat_detach_f)(int unit); 41 42 /*! 43 * \brief Get the variant specific database. 44 * 45 * \param [in] unit Unit Number. 46 * \param [out] stat_db Stat database structure. 47 * 48 * \retval SHR_E_NONE No errors. 49 * \retval !SHR_E_NONE Failure. 50 */ 51 typedef int (*stat_db_get_f)( 52 int unit, 53 bcmint_stat_db_t *stat_db); 54 55 /*! 56 * \brief Get the chip specific device informaiton. 57 * 58 * \param [in] unit Unit Number. 59 * \param [out] devinfo Stat device information structure. 60 * 61 * \retval SHR_E_NONE No errors. 62 * \retval !SHR_E_NONE Failure. 63 */ 64 typedef int (*stat_dev_info_get_f)( 65 int unit, 66 const bcmint_stat_dev_info_t **devinfo); 67 68 /*! 69 * \brief Initializes the stat index for counter mapping table. 70 * 71 * \param [in] unit Unit Number. 72 * \param [in] dev_info Stat device information structure. 73 * 74 * \retval SHR_E_NONE No errors. 75 * \retval !SHR_E_NONE Failure. 76 */ 77 typedef int (*stat_index_init_f)( 78 int unit, 79 const bcmint_stat_dev_info_t *dev_info); 80 81 /*! 82 * \brief De-initializes the stat LT entries. 83 * 84 * \param [in] unit Unit Number. 85 * 86 * \retval SHR_E_NONE No errors. 87 * \retval !SHR_E_NONE Failure. 88 */ 89 typedef int (*stat_lt_detach_f)(int unit); 90 91 /*! 92 * \brief Initializes the statistic on port. 93 * 94 * \param [in] unit Unit Number. 95 * \param [in] port Port Number. 96 * 97 * \retval SHR_E_NONE No errors. 98 * \retval !SHR_E_NONE Failure. 99 */ 100 typedef int (*stat_port_attach_f)( 101 int unit, 102 bcm_port_t port); 103 104 /*! 105 * \brief De-initializes the statistic on port. 106 * 107 * \param [in] unit Unit Number. 108 * \param [in] port Port Number. 109 * 110 * \retval SHR_E_NONE No errors. 111 * \retval !SHR_E_NONE Failure. 112 */ 113 typedef int (*stat_port_detach_f)( 114 int unit, 115 bcm_port_t port); 116 117 /*! 118 * \brief Clear the port based statistics. 119 * 120 * \param [in] unit Unit Number. 121 * \param [in] port Port Number. 122 * 123 * \retval SHR_E_NONE No errors. 124 * \retval !SHR_E_NONE Failure. 125 */ 126 typedef int (*stat_clear_f)( 127 int unit, 128 bcm_port_t port); 129 130 /*! 131 * \brief Clear the specific statistics. 132 * 133 * \param [in] unit Unit Number. 134 * \param [in] port Port Number. 135 * \param [in] stat_id SNMP statistics type. 136 * 137 * \retval SHR_E_NONE No errors. 138 * \retval !SHR_E_NONE Failure. 139 */ 140 typedef int (*stat_clear_single_f)( 141 int unit, 142 bcm_port_t port, 143 bcm_stat_val_t stat_id); 144 145 /*! 146 * \brief Get the specified statistic from the port. 147 * 148 * \param [in] unit Unit Number. 149 * \param [in] port Port Number. 150 * \param [in] sync_mode Sync mode. 151 * \param [in] stat_id SNMP statistics type. 152 * \param [out] val 64-bit counter value. 153 * 154 * \retval SHR_E_NONE No errors. 155 * \retval !SHR_E_NONE Failure. 156 */ 157 typedef int (*stat_get_f)( 158 int unit, 159 bcm_port_t port, 160 bool sync_mode, 161 bcm_stat_val_t stat_id, 162 uint64_t *val); 163 164 /*! 165 * \brief Get the dedicated counter associated with a given drop event. 166 * 167 * \param [in] unit Unit Number. 168 * \param [in] sync_mode Sync mode. 169 * \param [in] type Drop event type. 170 * \param [out] val 64-bit counter value. 171 * 172 * \retval SHR_E_NONE No errors. 173 * \retval !SHR_E_NONE Failure. 174 */ 175 typedef int (*stat_drop_event_counter_get_f)( 176 int unit, 177 bool sync_mode, 178 bcm_pkt_drop_event_t type, 179 uint64_t *val); 180 181 /*! 182 * \brief Clear the dedicated counter associated with a given drop event. 183 * 184 * \param [in] unit Unit Number. 185 * \param [in] type Drop event type. 186 * \param [in] val 64-bit counter value. Set val to 0 to clear the counter. 187 * 188 * \retval SHR_E_NONE No errors. 189 * \retval !SHR_E_NONE Failure. 190 */ 191 typedef int (*stat_drop_event_counter_set_f)( 192 int unit, 193 bcm_pkt_drop_event_t type, 194 uint64_t val); 195 196 /*! 197 * \brief Get the dedicated counter associated with a given trace event. 198 * 199 * \param [in] unit Unit Number. 200 * \param [in] sync_mode Sync mode. 201 * \param [in] type Trace event type. 202 * \param [out] val 64-bit counter value. 203 * 204 * \retval SHR_E_NONE No errors. 205 * \retval !SHR_E_NONE Failure. 206 */ 207 typedef int (*stat_trace_event_counter_get_f)( 208 int unit, 209 bool sync_mode, 210 bcm_pkt_trace_event_t type, 211 uint64_t *val); 212 213 /*! 214 * \brief Clear the dedicated counter associated with a given trace event. 215 * 216 * \param [in] unit Unit Number. 217 * \param [in] type Trace event type. 218 * \param [in] val 64-bit counter value. Set val to 0 to clear the counter. 219 * 220 * \retval SHR_E_NONE No errors. 221 * \retval !SHR_E_NONE Failure. 222 */ 223 typedef int (*stat_trace_event_counter_set_f)( 224 int unit, 225 bcm_pkt_trace_event_t type, 226 uint64_t val); 227 228 /*! 229 * \brief Initializes the counter control information. 230 * 231 * \param [in] unit Unit Number. 232 * 233 * \retval SHR_E_NONE No errors. 234 * \retval !SHR_E_NONE Failure. 235 */ 236 typedef int (*stat_counter_control_init_f)(int unit); 237 238 /*! 239 * \brief Get the counter control information structure. 240 * 241 * \param [in] unit Unit Number. 242 * \param [out] info Counter control information structure. 243 * 244 * \retval SHR_E_NONE No errors. 245 * \retval !SHR_E_NONE Failure. 246 */ 247 typedef int (*stat_counter_control_get_f)( 248 int unit, 249 bcmi_ltsw_stat_counter_control_t *info); 250 251 /*! 252 * \brief Add a certain packet type to debug counter to count. 253 * 254 * \param [in] unit Unit Number. 255 * \param [in] port Port Number. 256 * \param [in] stat_id SNMP statistics type. 257 * \param [in] trigger The counter select value (see include/bcm/stat.h for bit definitions). 258 * 259 * \retval SHR_E_NONE No errors. 260 * \retval !SHR_E_NONE Failure. 261 */ 262 typedef int (*stat_custom_add_f)( 263 int unit, 264 bcm_port_t port, 265 bcm_stat_val_t stat_id, 266 bcm_custom_stat_trigger_t trigger); 267 268 /*! 269 * \brief Check if certain packet types is part of debug counter. 270 * 271 * \param [in] unit Unit Number. 272 * \param [in] port Port Number. 273 * \param [in] stat_id SNMP statistics type. 274 * \param [in] trigger The counter select value (see include/bcm/stat.h for bit definitions). 275 * \param [out] result Result of a query. 0 if positive, -1 if negative. 276 * 277 * \retval SHR_E_NONE No errors. 278 * \retval !SHR_E_NONE Failure. 279 */ 280 typedef int (*stat_custom_check_f)( 281 int unit, 282 bcm_port_t port, 283 bcm_stat_val_t stat_id, 284 bcm_custom_stat_trigger_t trigger, 285 int *result); 286 287 /*! 288 * \brief Delete a certain packet type from debug counter. 289 * 290 * \param [in] unit Unit Number. 291 * \param [in] port Port Number. 292 * \param [in] stat_id SNMP statistics type. 293 * \param [in] trigger The counter select value (see include/bcm/stat.h for bit definitions). 294 * 295 * \retval SHR_E_NONE No errors. 296 * \retval !SHR_E_NONE Failure. 297 */ 298 typedef int (*stat_custom_delete_f)( 299 int unit, 300 bcm_port_t port, 301 bcm_stat_val_t stat_id, 302 bcm_custom_stat_trigger_t trigger); 303 304 /*! 305 * \brief Delete all packet types from debug counter. 306 * 307 * \param [in] unit Unit Number. 308 * \param [in] port Port Number. 309 * \param [in] stat_id SNMP statistics type. 310 * 311 * \retval SHR_E_NONE No errors. 312 * \retval !SHR_E_NONE Failure. 313 */ 314 typedef int (*stat_custom_delete_all_f)( 315 int unit, 316 bcm_port_t port, 317 bcm_stat_val_t stat_id); 318 319 /*! 320 * \brief Stat driver structure. 321 */ 322 typedef struct mbcm_ltsw_stat_drv_s { 323 324 /*! Initializes the stat module. */ 325 stat_init_f stat_init; 326 327 /*! De-initializes the stat module. */ 328 stat_detach_f stat_detach; 329 330 /*! Get the variant specific database. */ 331 stat_db_get_f stat_db_get; 332 333 /*! Get the chip specific device informaiton. */ 334 stat_dev_info_get_f stat_dev_info_get; 335 336 /*! Initializes the stat index for counter mapping table. */ 337 stat_index_init_f stat_index_init; 338 339 /*! De-initializes the stat LT entries. */ 340 stat_lt_detach_f stat_lt_detach; 341 342 /*! Initializes the statistic on port. */ 343 stat_port_attach_f stat_port_attach; 344 345 /*! De-initializes the statistic on port. */ 346 stat_port_detach_f stat_port_detach; 347 348 /*! Clear the port based statistics. */ 349 stat_clear_f stat_clear; 350 351 /*! Clear the specific statistics. */ 352 stat_clear_single_f stat_clear_single; 353 354 /*! Get the specified statistic from the port. */ 355 stat_get_f stat_get; 356 357 /*! Get the dedicated counter associated with a given drop event. */ 358 stat_drop_event_counter_get_f stat_drop_event_counter_get; 359 360 /*! Clear the dedicated counter associated with a given drop event. */ 361 stat_drop_event_counter_set_f stat_drop_event_counter_set; 362 363 /*! Get the dedicated counter associated with a given trace event. */ 364 stat_trace_event_counter_get_f stat_trace_event_counter_get; 365 366 /*! Clear the dedicated counter associated with a given trace event. */ 367 stat_trace_event_counter_set_f stat_trace_event_counter_set; 368 369 /*! Initializes the counter control information. */ 370 stat_counter_control_init_f stat_counter_control_init; 371 372 /*! Get the counter control information structure. */ 373 stat_counter_control_get_f stat_counter_control_get; 374 375 /*! Add a certain packet type to debug counter to count. */ 376 stat_custom_add_f stat_custom_add; 377 378 /*! Check if certain packet types is part of debug counter. */ 379 stat_custom_check_f stat_custom_check; 380 381 /*! Delete a certain packet type from debug counter. */ 382 stat_custom_delete_f stat_custom_delete; 383 384 /*! Delete all packet types from debug counter. */ 385 stat_custom_delete_all_f stat_custom_delete_all; 386 387 } mbcm_ltsw_stat_drv_t; 388 389 /*! 390 * \brief Set the STAT driver of the device. 391 * 392 * \param [in] unit Unit Number. 393 * \param [in] drv Stat driver to set. 394 * 395 * \retval SHR_E_NONE No errors. 396 * \retval !SHR_E_NONE Failure. 397 */ 398 extern int 399 mbcm_ltsw_stat_drv_set( 400 int unit, 401 mbcm_ltsw_stat_drv_t *drv); 402 403 /*! 404 * \brief Initializes the stat module. 405 * 406 * \param [in] unit Unit Number. 407 * 408 * \retval SHR_E_NONE No errors. 409 * \retval !SHR_E_NONE Failure. 410 */ 411 extern int 412 mbcm_ltsw_stat_init(int unit); 413 414 /*! 415 * \brief De-initializes the stat module. 416 * 417 * \param [in] unit Unit Number. 418 * 419 * \retval SHR_E_NONE No errors. 420 * \retval !SHR_E_NONE Failure. 421 */ 422 extern int 423 mbcm_ltsw_stat_detach(int unit); 424 425 /*! 426 * \brief Get the variant specific database. 427 * 428 * \param [in] unit Unit Number. 429 * \param [out] stat_db Stat database structure. 430 * 431 * \retval SHR_E_NONE No errors. 432 * \retval !SHR_E_NONE Failure. 433 */ 434 extern int 435 mbcm_ltsw_stat_db_get( 436 int unit, 437 bcmint_stat_db_t *stat_db); 438 439 /*! 440 * \brief Get the chip specific device informaiton. 441 * 442 * \param [in] unit Unit Number. 443 * \param [out] devinfo Stat device information structure. 444 * 445 * \retval SHR_E_NONE No errors. 446 * \retval !SHR_E_NONE Failure. 447 */ 448 extern int 449 mbcm_ltsw_stat_dev_info_get( 450 int unit, 451 const bcmint_stat_dev_info_t **devinfo); 452 453 /*! 454 * \brief Initializes the stat index for counter mapping table. 455 * 456 * \param [in] unit Unit Number. 457 * \param [in] dev_info Stat device information structure. 458 * 459 * \retval SHR_E_NONE No errors. 460 * \retval !SHR_E_NONE Failure. 461 */ 462 extern int 463 mbcm_ltsw_stat_index_init( 464 int unit, 465 const bcmint_stat_dev_info_t *dev_info); 466 467 /*! 468 * \brief De-initializes the stat LT entries. 469 * 470 * \param [in] unit Unit Number. 471 * 472 * \retval SHR_E_NONE No errors. 473 * \retval !SHR_E_NONE Failure. 474 */ 475 extern int 476 mbcm_ltsw_stat_lt_detach(int unit); 477 478 /*! 479 * \brief Initializes the statistic on port. 480 * 481 * \param [in] unit Unit Number. 482 * \param [in] port Port Number. 483 * 484 * \retval SHR_E_NONE No errors. 485 * \retval !SHR_E_NONE Failure. 486 */ 487 extern int 488 mbcm_ltsw_stat_port_attach( 489 int unit, 490 bcm_port_t port); 491 492 /*! 493 * \brief De-initializes the statistic on port. 494 * 495 * \param [in] unit Unit Number. 496 * \param [in] port Port Number. 497 * 498 * \retval SHR_E_NONE No errors. 499 * \retval !SHR_E_NONE Failure. 500 */ 501 extern int 502 mbcm_ltsw_stat_port_detach( 503 int unit, 504 bcm_port_t port); 505 506 /*! 507 * \brief Clear the port based statistics. 508 * 509 * \param [in] unit Unit Number. 510 * \param [in] port Port Number. 511 * 512 * \retval SHR_E_NONE No errors. 513 * \retval !SHR_E_NONE Failure. 514 */ 515 extern int 516 mbcm_ltsw_stat_clear( 517 int unit, 518 bcm_port_t port); 519 520 /*! 521 * \brief Clear the specific statistics. 522 * 523 * \param [in] unit Unit Number. 524 * \param [in] port Port Number. 525 * \param [in] stat_id SNMP statistics type. 526 * 527 * \retval SHR_E_NONE No errors. 528 * \retval !SHR_E_NONE Failure. 529 */ 530 extern int 531 mbcm_ltsw_stat_clear_single( 532 int unit, 533 bcm_port_t port, 534 bcm_stat_val_t stat_id); 535 536 /*! 537 * \brief Get the specified statistic from the port. 538 * 539 * \param [in] unit Unit Number. 540 * \param [in] port Port Number. 541 * \param [in] sync_mode Sync mode. 542 * \param [in] stat_id SNMP statistics type. 543 * \param [out] val 64-bit counter value. 544 * 545 * \retval SHR_E_NONE No errors. 546 * \retval !SHR_E_NONE Failure. 547 */ 548 extern int 549 mbcm_ltsw_stat_get( 550 int unit, 551 bcm_port_t port, 552 bool sync_mode, 553 bcm_stat_val_t stat_id, 554 uint64_t *val); 555 556 /*! 557 * \brief Get the dedicated counter associated with a given drop event. 558 * 559 * \param [in] unit Unit Number. 560 * \param [in] sync_mode Sync mode. 561 * \param [in] type Drop event type. 562 * \param [out] val 64-bit counter value. 563 * 564 * \retval SHR_E_NONE No errors. 565 * \retval !SHR_E_NONE Failure. 566 */ 567 extern int 568 mbcm_ltsw_stat_drop_event_counter_get( 569 int unit, 570 bool sync_mode, 571 bcm_pkt_drop_event_t type, 572 uint64_t *val); 573 574 /*! 575 * \brief Clear the dedicated counter associated with a given drop event. 576 * 577 * \param [in] unit Unit Number. 578 * \param [in] type Drop event type. 579 * \param [in] val 64-bit counter value. Set val to 0 to clear the counter. 580 * 581 * \retval SHR_E_NONE No errors. 582 * \retval !SHR_E_NONE Failure. 583 */ 584 extern int 585 mbcm_ltsw_stat_drop_event_counter_set( 586 int unit, 587 bcm_pkt_drop_event_t type, 588 uint64_t val); 589 590 /*! 591 * \brief Get the dedicated counter associated with a given trace event. 592 * 593 * \param [in] unit Unit Number. 594 * \param [in] sync_mode Sync mode. 595 * \param [in] type Trace event type. 596 * \param [out] val 64-bit counter value. 597 * 598 * \retval SHR_E_NONE No errors. 599 * \retval !SHR_E_NONE Failure. 600 */ 601 extern int 602 mbcm_ltsw_stat_trace_event_counter_get( 603 int unit, 604 bool sync_mode, 605 bcm_pkt_trace_event_t type, 606 uint64_t *val); 607 608 /*! 609 * \brief Clear the dedicated counter associated with a given trace event. 610 * 611 * \param [in] unit Unit Number. 612 * \param [in] type Trace event type. 613 * \param [in] val 64-bit counter value. Set val to 0 to clear the counter. 614 * 615 * \retval SHR_E_NONE No errors. 616 * \retval !SHR_E_NONE Failure. 617 */ 618 extern int 619 mbcm_ltsw_stat_trace_event_counter_set( 620 int unit, 621 bcm_pkt_trace_event_t type, 622 uint64_t val); 623 624 /*! 625 * \brief Initializes the counter control information. 626 * 627 * \param [in] unit Unit Number. 628 * 629 * \retval SHR_E_NONE No errors. 630 * \retval !SHR_E_NONE Failure. 631 */ 632 extern int 633 mbcm_ltsw_stat_counter_control_init(int unit); 634 635 /*! 636 * \brief Get the counter control information structure. 637 * 638 * \param [in] unit Unit Number. 639 * \param [out] info Counter control information structure. 640 * 641 * \retval SHR_E_NONE No errors. 642 * \retval !SHR_E_NONE Failure. 643 */ 644 extern int 645 mbcm_ltsw_stat_counter_control_get( 646 int unit, 647 bcmi_ltsw_stat_counter_control_t *info); 648 649 /*! 650 * \brief Add a certain packet type to debug counter to count. 651 * 652 * \param [in] unit Unit Number. 653 * \param [in] port Port Number. 654 * \param [in] stat_id SNMP statistics type. 655 * \param [in] trigger The counter select value (see include/bcm/stat.h for bit definitions). 656 * 657 * \retval SHR_E_NONE No errors. 658 * \retval !SHR_E_NONE Failure. 659 */ 660 extern int 661 mbcm_ltsw_stat_custom_add( 662 int unit, 663 bcm_port_t port, 664 bcm_stat_val_t stat_id, 665 bcm_custom_stat_trigger_t trigger); 666 667 /*! 668 * \brief Check if certain packet types is part of debug counter. 669 * 670 * \param [in] unit Unit Number. 671 * \param [in] port Port Number. 672 * \param [in] stat_id SNMP statistics type. 673 * \param [in] trigger The counter select value (see include/bcm/stat.h for bit definitions). 674 * \param [out] result Result of a query. 0 if positive, -1 if negative. 675 * 676 * \retval SHR_E_NONE No errors. 677 * \retval !SHR_E_NONE Failure. 678 */ 679 extern int 680 mbcm_ltsw_stat_custom_check( 681 int unit, 682 bcm_port_t port, 683 bcm_stat_val_t stat_id, 684 bcm_custom_stat_trigger_t trigger, 685 int *result); 686 687 /*! 688 * \brief Delete a certain packet type from debug counter. 689 * 690 * \param [in] unit Unit Number. 691 * \param [in] port Port Number. 692 * \param [in] stat_id SNMP statistics type. 693 * \param [in] trigger The counter select value (see include/bcm/stat.h for bit definitions). 694 * 695 * \retval SHR_E_NONE No errors. 696 * \retval !SHR_E_NONE Failure. 697 */ 698 extern int 699 mbcm_ltsw_stat_custom_delete( 700 int unit, 701 bcm_port_t port, 702 bcm_stat_val_t stat_id, 703 bcm_custom_stat_trigger_t trigger); 704 705 /*! 706 * \brief Delete all packet types from debug counter. 707 * 708 * \param [in] unit Unit Number. 709 * \param [in] port Port Number. 710 * \param [in] stat_id SNMP statistics type. 711 * 712 * \retval SHR_E_NONE No errors. 713 * \retval !SHR_E_NONE Failure. 714 */ 715 extern int 716 mbcm_ltsw_stat_custom_delete_all( 717 int unit, 718 bcm_port_t port, 719 bcm_stat_val_t stat_id); 720 721 #endif /* BCMINT_LTSW_MBCM_STAT_H */