switch.h (30798B)
1 /*! \file switch.h 2 * 3 * MBCM switch control module interfaces. 4 */ 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 MBCM_LTSW_SC_H 12 #define MBCM_LTSW_SC_H 13 14 #include <bcm_int/ltsw/switch.h> 15 #include <bcm_int/ltsw/switch_int.h> 16 17 #include <bcmlt/bcmlt.h> 18 19 /*! Device-wide switch control set function prototype. */ 20 typedef int (*mbcm_ltsw_sc_set_f)(int unit, bcm_switch_control_t type, int arg); 21 22 /*! Device-wide switch control get function prototype. */ 23 typedef int (*mbcm_ltsw_sc_get_f)(int unit, bcm_switch_control_t type, int *arg); 24 25 /*! Port base switch control set function prototype. */ 26 typedef int (*mbcm_ltsw_scp_set_f)(int unit, int port, bcm_switch_control_t type, 27 int arg); 28 29 /*! Port base switch control get function prototype. */ 30 typedef int (*mbcm_ltsw_scp_get_f)(int unit, int port, bcm_switch_control_t type, 31 int *arg); 32 33 /*! Add switch protocol control entry */ 34 typedef int (*mbcm_ltsw_spc_add_f)(int unit, uint32_t options, 35 bcm_switch_pkt_protocol_match_t *match, 36 bcm_switch_pkt_control_action_t *action, 37 int priority); 38 39 /*! Get switch protocol control entry */ 40 typedef int (*mbcm_ltsw_spc_get_f)(int unit, 41 bcm_switch_pkt_protocol_match_t *match, 42 bcm_switch_pkt_control_action_t *action, 43 int *priority); 44 45 /*! Delete switch protocol control entry */ 46 typedef int (*mbcm_ltsw_spc_del_f)(int unit, 47 bcm_switch_pkt_protocol_match_t *match); 48 49 /*! Traverse switch protocol control entries. */ 50 typedef int (*mbcm_ltsw_spc_trav_f)(int unit, 51 bcm_switch_pkt_protocol_control_traverse_cb, 52 void *user_data); 53 54 /*! Delete all switch protocol control entries. */ 55 typedef int (*mbcm_ltsw_spc_del_all_f)(int unit); 56 57 /*! Add an entry into packet integrity check table. */ 58 typedef int (*mbcm_ltsw_pkt_integrity_check_add_f)(int unit, uint32_t options, 59 bcm_switch_pkt_integrity_match_t *match, 60 bcm_switch_pkt_control_action_t *action, 61 int priority); 62 63 /*! Get an entry from packet integrity check table. */ 64 typedef int (*mbcm_ltsw_pkt_integrity_check_get_f)(int unit, 65 bcm_switch_pkt_integrity_match_t *match, 66 bcm_switch_pkt_control_action_t *action, 67 int *priority); 68 69 /*! Delete an entry from packet integrity check table. */ 70 typedef int (*mbcm_ltsw_pkt_integrity_check_delete_f)(int unit, 71 bcm_switch_pkt_integrity_match_t *match); 72 73 /*! Configure a switch drop event monitor. */ 74 typedef int (*mbcm_ltsw_switch_drop_event_mon_set_f)(int unit, 75 bcm_switch_drop_event_mon_t *monitor); 76 77 /*! Get a switch drop event monitor configuration. */ 78 typedef int (*mbcm_ltsw_switch_drop_event_mon_get_f)(int unit, 79 bcm_switch_drop_event_mon_t *monitor); 80 81 /*! Configure a switch trace event monitor. */ 82 typedef int (*mbcm_ltsw_switch_trace_event_mon_set_f)(int unit, 83 bcm_switch_trace_event_mon_t *monitor); 84 85 /*! Get a switch trace event monitor configuration. */ 86 typedef int (*mbcm_ltsw_switch_trace_event_mon_get_f)(int unit, 87 bcm_switch_trace_event_mon_t *monitor); 88 89 /*! Covert a drop event enum value to Logical Table symbol string. */ 90 typedef int (*mbcm_ltsw_switch_drop_event_to_symbol_f)(int unit, 91 bcm_pkt_drop_event_t drop_event, 92 const char **table, const char **symbol); 93 94 /*! Covert a trace event enum value to Logical Table symbol string. */ 95 typedef int (*mbcm_ltsw_switch_trace_event_to_symbol_f)(int unit, 96 bcm_pkt_trace_event_t trace_event, 97 const char **table, const char **symbol); 98 99 /*! Get the variant specific database. */ 100 typedef int (*switch_db_get_f)(int unit, bcmint_switch_db_t *switch_db); 101 102 /*! Switch protocol packet control initialization. */ 103 typedef int (*mbcm_ltsw_switch_protocol_init_f)(int unit); 104 105 /*! Switch protocol packet control operations handler. */ 106 typedef int (*mbcm_ltsw_switch_protocol_handle_f)(int unit, 107 bcmlt_opcode_t opcode, 108 bcm_switch_pkt_protocol_match_t *match, 109 bcm_switch_pkt_control_action_t *action, 110 int *priority); 111 112 /*! Switch packet integrity check initialization. */ 113 typedef int (*mbcm_ltsw_switch_pkt_integrity_check_init_f)(int unit); 114 115 /*! Switch packet integrity check operations handler. */ 116 typedef int (*mbcm_ltsw_switch_pkt_integrity_handle_f)(int unit, 117 bcmlt_opcode_t opcode, 118 bcm_switch_pkt_integrity_match_t *match, 119 bcm_switch_pkt_control_action_t *action, 120 int *priority); 121 122 /*! Switch trace event monitor initialization. */ 123 typedef int (*mbcm_ltsw_switch_mon_trace_event_init_f)(int unit); 124 125 /*! Switch module initialization. */ 126 typedef int (*mbcm_ltsw_switch_init_f)(int unit); 127 128 /*! Switch module detach. */ 129 typedef int (*mbcm_ltsw_switch_detach_f)(int unit); 130 131 /*! Create an EP Recirculate profile. */ 132 typedef int (*mbcm_ltsw_switch_ep_recirc_profile_create_f)(int unit, 133 bcm_switch_ep_recirc_profile_t *recirc_profile, 134 int *recirc_profile_id); 135 136 /*! Destroy an EP Recirculate profile. */ 137 typedef int (*mbcm_ltsw_switch_ep_recirc_profile_destroy_f)(int unit, 138 int recirc_profile_id); 139 140 /*! Get all EP Recirculate profile ids. */ 141 typedef int (*mbcm_ltsw_switch_ep_recirc_profile_get_all_f)(int unit, 142 int *recirc_profile_id_array, 143 int *count); 144 145 /*! Get an EP Recirculate profile. */ 146 typedef int (*mbcm_ltsw_switch_ep_recirc_profile_get_f)(int unit, 147 int recirc_profile_id, 148 bcm_switch_ep_recirc_profile_t *recirc_profile); 149 150 /*! Set drop event based EP Recirculate control. */ 151 typedef int (*mbcm_ltsw_switch_ep_recirc_drop_event_control_set_f)( 152 int unit, 153 bcm_switch_ep_recirc_drop_event_control_t *drop_event_ctrl); 154 155 156 /*! Get drop event based EP Recirculate control. */ 157 typedef int (*mbcm_ltsw_switch_ep_recirc_drop_event_control_get_f)( 158 int unit, 159 bcm_switch_ep_recirc_drop_event_control_t *drop_event_ctrl); 160 161 /*! Set trace event based EP Recirculate control. */ 162 typedef int (*mbcm_ltsw_switch_ep_recirc_trace_event_control_set_f)( 163 int unit, 164 bcm_switch_ep_recirc_trace_event_control_t *trace_event_ctrl); 165 166 /*! Get trace event based EP Recirculate control. */ 167 typedef int (*mbcm_ltsw_switch_ep_recirc_trace_event_control_get_f)( 168 int unit, 169 bcm_switch_ep_recirc_trace_event_control_t *trace_event_ctrl); 170 171 /*! Enable/disable an egress trace event to trigger EP Recirculate. */ 172 typedef int (*mbcm_ltsw_switch_ep_recirc_trace_event_enable_set_f)( 173 int unit, 174 bcm_pkt_trace_event_t trace_event, 175 int enable); 176 177 /*! Get all enabled egress trace event for EP Recirculate. */ 178 typedef int (*mbcm_ltsw_switch_ep_recirc_trace_event_enable_get_all_f)( 179 int unit, 180 bcm_pkt_trace_event_t *trace_event_array, 181 int *count); 182 183 /*! Get enabled status of an egress trace event for EP Recirculate. */ 184 typedef int (*mbcm_ltsw_switch_ep_recirc_trace_event_enable_get_f)( 185 int unit, 186 bcm_pkt_trace_event_t trace_event, 187 int *enable); 188 189 /* Set a mirror instance id to an EP recirculate profile entry. */ 190 typedef int (*mbcm_ltsw_switch_ep_recirc_profile_mirror_instance_set_f)( 191 int unit, 192 int recirc_profile_id, 193 int mirror_instance_id); 194 195 /* Get the mirror instance id from EP recirculate profile entries. */ 196 typedef int (*mbcm_ltsw_switch_ep_recirc_profile_mirror_instance_get_f)( 197 int unit, 198 int *mirror_instance_id); 199 200 /*! 201 * \brief Switch control module driver function vector. 202 * 203 * Provides driver function access. 204 */ 205 typedef struct mbcm_ltsw_sc_drv_s { 206 207 /*! Set per port control. */ 208 mbcm_ltsw_sc_set_f sc_set; 209 210 /*! Get per port control. */ 211 mbcm_ltsw_sc_get_f sc_get; 212 213 /*! Set switch-wide control. */ 214 mbcm_ltsw_scp_set_f scp_set; 215 216 /*! get switch-wide control. */ 217 mbcm_ltsw_scp_get_f scp_get; 218 219 /*! Add switch protocol control entry */ 220 mbcm_ltsw_spc_add_f spc_add; 221 222 /*! Get switch protocol control entry */ 223 mbcm_ltsw_spc_get_f spc_get; 224 225 /*! Delete switch protocol control entry */ 226 mbcm_ltsw_spc_del_f spc_del; 227 228 /*! Traverse switch protocol control entries. */ 229 mbcm_ltsw_spc_trav_f spc_trav; 230 231 /*! Delete all switch protocol control entries. */ 232 mbcm_ltsw_spc_del_all_f spc_del_all; 233 234 /*! Add an entry into packet integrity check table. */ 235 mbcm_ltsw_pkt_integrity_check_add_f switch_pkt_integrity_check_add; 236 237 /*! Get an entry from packet integrity check table. */ 238 mbcm_ltsw_pkt_integrity_check_get_f switch_pkt_integrity_check_get; 239 240 /*! Delete an entry from packet integrity check table. */ 241 mbcm_ltsw_pkt_integrity_check_delete_f switch_pkt_integrity_check_delete; 242 243 /*! Configure a switch drop event monitor. */ 244 mbcm_ltsw_switch_drop_event_mon_set_f switch_drop_event_mon_set; 245 246 /*! Get a switch drop event monitor configuration. */ 247 mbcm_ltsw_switch_drop_event_mon_get_f switch_drop_event_mon_get; 248 249 /*! Configure a switch trace event monitor. */ 250 mbcm_ltsw_switch_trace_event_mon_set_f switch_trace_event_mon_set; 251 252 /*! Get a switch trace event monitor configuration. */ 253 mbcm_ltsw_switch_trace_event_mon_get_f switch_trace_event_mon_get; 254 255 /*! Covert a drop event enum value to Logical Table symbol string. */ 256 mbcm_ltsw_switch_drop_event_to_symbol_f switch_drop_event_to_symbol; 257 258 /*! Covert a trace event enum value to Logical Table symbol string. */ 259 mbcm_ltsw_switch_trace_event_to_symbol_f switch_trace_event_to_symbol; 260 261 /*! Get the variant specific database. */ 262 switch_db_get_f switch_db_get; 263 264 /*! Switch protocol packet control initialization. */ 265 mbcm_ltsw_switch_protocol_init_f switch_protocol_init; 266 267 /*! Switch protocol packet control operations handler. */ 268 mbcm_ltsw_switch_protocol_handle_f switch_protocol_handle; 269 270 /*! Switch packet integrity check initialization. */ 271 mbcm_ltsw_switch_pkt_integrity_check_init_f switch_pkt_integrity_check_init; 272 273 /*! Switch packet integrity check operations handler. */ 274 mbcm_ltsw_switch_pkt_integrity_handle_f switch_pkt_integrity_handle; 275 276 /*! Switch trace event monitor initialization. */ 277 mbcm_ltsw_switch_mon_trace_event_init_f switch_mon_trace_event_init; 278 279 /*! Switch module initialization. */ 280 mbcm_ltsw_switch_init_f switch_init; 281 282 /*! Switch module detach. */ 283 mbcm_ltsw_switch_detach_f switch_detach; 284 285 /*! Create an EP Recirculate profile. */ 286 mbcm_ltsw_switch_ep_recirc_profile_create_f switch_ep_recirc_profile_create; 287 288 /*! Destroy an EP Recirculate profile. */ 289 mbcm_ltsw_switch_ep_recirc_profile_destroy_f switch_ep_recirc_profile_destroy; 290 291 /*! Get all EP Recirculate profile ids. */ 292 mbcm_ltsw_switch_ep_recirc_profile_get_all_f switch_ep_recirc_profile_get_all; 293 294 /*! Get an EP Recirculate profile. */ 295 mbcm_ltsw_switch_ep_recirc_profile_get_f switch_ep_recirc_profile_get; 296 297 /*! Set drop event based EP Recirculate control. */ 298 mbcm_ltsw_switch_ep_recirc_drop_event_control_set_f switch_ep_recirc_drop_event_control_set; 299 300 /*! Get drop event based EP Recirculate control. */ 301 mbcm_ltsw_switch_ep_recirc_drop_event_control_get_f switch_ep_recirc_drop_event_control_get; 302 303 /*! Set trace event based EP Recirculate control. */ 304 mbcm_ltsw_switch_ep_recirc_trace_event_control_set_f switch_ep_recirc_trace_event_control_set; 305 306 /*! Get trace event based EP Recirculate control. */ 307 mbcm_ltsw_switch_ep_recirc_trace_event_control_get_f switch_ep_recirc_trace_event_control_get; 308 309 /*! Enable/disable an egress trace event to trigger EP Recirculate. */ 310 mbcm_ltsw_switch_ep_recirc_trace_event_enable_set_f switch_ep_recirc_trace_event_enable_set; 311 312 /*! Get all enabled egress trace event for EP Recirculate. */ 313 mbcm_ltsw_switch_ep_recirc_trace_event_enable_get_all_f switch_ep_recirc_trace_event_enable_get_all; 314 315 /*! Get enabled status of an egress trace event for EP Recirculate. */ 316 mbcm_ltsw_switch_ep_recirc_trace_event_enable_get_f switch_ep_recirc_trace_event_enable_get; 317 318 /* Set a mirror instance id to an EP recirculate profile entry. */ 319 mbcm_ltsw_switch_ep_recirc_profile_mirror_instance_set_f switch_ep_recirc_profile_mirror_instance_set; 320 321 /* Get the mirror instance id from EP recirculate profile entries. */ 322 mbcm_ltsw_switch_ep_recirc_profile_mirror_instance_get_f switch_ep_recirc_profile_mirror_instance_get; 323 324 } mbcm_ltsw_sc_drv_t; 325 326 /*! 327 * \brief Hook a SC driver onto the unit. 328 * 329 * \param [in] unit Unit number. 330 * \param [in] drv SC driver to set. 331 * 332 * \retval SHR_E_NONE No errors. 333 */ 334 extern int 335 mbcm_ltsw_sc_drv_set(int unit, mbcm_ltsw_sc_drv_t *drv); 336 337 /*! 338 * \brief Configure a port based control. 339 * 340 * \param [in] unit Unit number 341 * \param [in] port Port number. 342 * \param [in] type Control type. 343 * \param [in] arg Control value. 344 * 345 * \retval SHR_E_NONE No errors. 346 * \retval SHR_E_NOT_FOUND Entry not found. 347 */ 348 extern int 349 mbcm_ltsw_scp_set(int unit, int port, bcm_switch_control_t type, int arg); 350 351 /*! 352 * \brief Retrieve a port based control setting. 353 * 354 * \param [in] unit Unit number 355 * \param [in] port Port number. 356 * \param [in] type Control type. 357 * \param [out] arg Control value. 358 * 359 * \retval SHR_E_NONE No errors. 360 * \retval SHR_E_NOT_FOUND Entry not found. 361 */ 362 extern int 363 mbcm_ltsw_scp_get(int unit, int port, bcm_switch_control_t type, int *arg); 364 365 /*! 366 * \brief Configure a device-wide control. 367 * 368 * \param [in] unit Unit number 369 * \param [in] type Control type. 370 * \param [in] arg Control value. 371 * 372 * \retval SHR_E_NONE No errors. 373 * \retval SHR_E_NOT_FOUND Entry not found. 374 */ 375 extern int 376 mbcm_ltsw_sc_set(int unit, bcm_switch_control_t type, int arg); 377 378 /*! 379 * \brief Retrieve a device-wide control setting. 380 * 381 * \param [in] unit Unit number 382 * \param [in] type Control type. 383 * \param [out] arg Control value. 384 * 385 * \retval SHR_E_NONE No errors. 386 * \retval SHR_E_NOT_FOUND Entry not found. 387 */ 388 extern int 389 mbcm_ltsw_sc_get(int unit, bcm_switch_control_t type, int *arg); 390 391 /*! 392 * \brief Add a protocol control entry. 393 * 394 * \param [in] unit Unit number 395 * \param [in] options Options flags. 396 * \param [in] match Protocol match structure. 397 * \param [in] action Packet control action structure. 398 * \param [in] priority Entry priority. 399 * 400 * \retval SHR_E_NONE No errors. 401 */ 402 extern int 403 mbcm_ltsw_spc_add(int unit, uint32_t options, 404 bcm_switch_pkt_protocol_match_t *match, 405 bcm_switch_pkt_control_action_t *action, 406 int priority); 407 408 /*! 409 * \brief Get action and priority for a protocol control entry. 410 * 411 * \param [in] unit Unit number 412 * \param [in] match Protocol match structure. 413 * \param [out] action Packet control action structure. 414 * \param [out] priority Entry priority. 415 * 416 * \retval SHR_E_NONE No errors. 417 */ 418 extern int 419 mbcm_ltsw_spc_get(int unit, 420 bcm_switch_pkt_protocol_match_t *match, 421 bcm_switch_pkt_control_action_t *action, 422 int *priority); 423 424 /*! 425 * \brief Delete a protocol control entry. 426 * 427 * \param [in] unit Unit number 428 * \param [in] match Protocol match structure. 429 * 430 * \retval SHR_E_NONE No errors. 431 */ 432 extern int 433 mbcm_ltsw_spc_delete(int unit, bcm_switch_pkt_protocol_match_t *match); 434 435 /*! 436 * \brief Traverse switch protocol control entries. 437 * 438 * \param [in] unit Unit number 439 * \param [in] cb Protocol control traverse callback function. 440 * \param [in] user_data User data to be passed to callback function. 441 * 442 * \retval SHR_E_NONE No errors. 443 */ 444 extern int 445 mbcm_ltsw_spc_traverse(int unit, bcm_switch_pkt_protocol_control_traverse_cb cb, 446 void *user_data); 447 448 /*! 449 * \brief Delete all protocol control entries. 450 * 451 * \param [in] unit Unit number 452 * 453 * \retval SHR_E_NONE No errors. 454 */ 455 extern int 456 mbcm_ltsw_spc_delete_all(int unit); 457 458 /*! 459 * \brief Add an entry into packet integrity check table. 460 * 461 * \param [in] unit Unit number. 462 * \param [in] option Options flag. 463 * \param [in] match Pointer to a packet integrity match attribute structure. 464 * \param [in] action Pointer to a packet control action structure. 465 * \param [in] priority Entry priority. 466 * 467 * \retval SHR_E_NONE on success and error code otherwise. 468 */ 469 extern int 470 mbcm_ltsw_switch_pkt_integrity_check_add(int unit, uint32 options, 471 bcm_switch_pkt_integrity_match_t *match, 472 bcm_switch_pkt_control_action_t *action, 473 int priority); 474 475 /*! 476 * \brief Get an entry from packet integrity check table. 477 * 478 * \param [in] unit Unit number. 479 * \param [in] match Pointer to a packet integrity match attribute structure. 480 * \param [out] action Pointer to a packet control action structure. 481 * \param [out] priority Entry priority. 482 * 483 * \retval SHR_E_NONE on success and error code otherwise. 484 */ 485 extern int 486 mbcm_ltsw_switch_pkt_integrity_check_get(int unit, 487 bcm_switch_pkt_integrity_match_t *match, 488 bcm_switch_pkt_control_action_t *action, 489 int *priority); 490 491 /*! 492 * \brief Delete an entry from packet integrity check table. 493 * 494 * \param [in] unit Unit number. 495 * \param [in] match Pointer to a packet integrity match structure. 496 * 497 * \retval SHR_E_NONE on success and error code otherwise. 498 */ 499 extern int 500 mbcm_ltsw_switch_pkt_integrity_check_delete(int unit, 501 bcm_switch_pkt_integrity_match_t *match); 502 503 /*! 504 * \brief Configure a switch drop event monitor. 505 * 506 * This function configures monitor for a given drop event. The caller must specify 507 * a switch drop event and the associated actions in the monitor structure. 508 * 509 * \param [in] unit Unit number. 510 * \param [in] monitor Pointer to a switch drop event monitor structure. 511 * 512 * \retval SHR_E_NONE on success and error code otherwise. 513 */ 514 extern int 515 mbcm_ltsw_switch_drop_event_mon_set(int unit, bcm_switch_drop_event_mon_t *monitor); 516 517 /*! 518 * \brief Get a switch drop event monitor configuration. 519 * 520 * This function get monitor configuration for a given drop event. The caller must specify 521 * a drop event in the monitor structure. The associated actions will be returned. 522 * 523 * \param [in] unit Unit number. 524 * \param [inout] monitor Pointer to a switch drop event monitor structure. 525 * 526 * \retval SHR_E_NONE on success and error code otherwise. 527 */ 528 extern int 529 mbcm_ltsw_switch_drop_event_mon_get(int unit, bcm_switch_drop_event_mon_t *monitor); 530 531 /*! 532 * \brief Configure a switch trace event monitor. 533 * 534 * This function configures monitor for a given trace event. The caller must specify a 535 * switch trace event and the associated actions in the monitor structure. 536 * 537 * \param [in] unit Unit number. 538 * \param [in] monitor Pointer to a switch trace event monitor structure. 539 * 540 * \retval SHR_E_NONE on success and error code otherwise. 541 */ 542 extern int 543 mbcm_ltsw_switch_trace_event_mon_set(int unit, bcm_switch_trace_event_mon_t *monitor); 544 545 546 /*! 547 * \brief Get a switch trace event monitor configuration. 548 * 549 * This function get monitor configuration for a given trace event. The caller must specify 550 * a trace event in the monitor structure. The associated actions will be returned. 551 * 552 * \param [in] unit Unit number. 553 * \param [inout] monitor Pointer to a switch trace event monitor structure. 554 * 555 * \retval SHR_E_NONE on success and error code otherwise. 556 */ 557 extern int 558 mbcm_ltsw_switch_trace_event_mon_get(int unit, bcm_switch_trace_event_mon_t *monitor); 559 560 /*! 561 * \brief Covert a drop event enum value to Logical Table symbol string. 562 * 563 * \param [in] unit Unit number. 564 * \param [in] drop_event Drop event enum value. 565 * \param [out] table Logical Table name. 566 * \param [out] symbol Logical Table symbol string. 567 * 568 * \retval SHR_E_NONE Success. 569 * \retval SHR_E_PARAM Invalid drop event enum value. 570 * \retval SHR_E_NOT_FOUND Symbol string not found for the specified drop event. 571 */ 572 extern int 573 mbcm_ltsw_switch_drop_event_to_symbol(int unit, bcm_pkt_drop_event_t drop_event, 574 const char **table, const char **symbol); 575 576 /*! 577 * \brief Covert a trace event enum value to Logical Table symbol string. 578 * 579 * \param [in] unit Unit number. 580 * \param [in] trace_event Trace event enum value. 581 * \param [out] table Logical Table name. 582 * \param [out] symbol Logical Table symbol string. 583 * 584 * \retval SHR_E_NONE Success. 585 * \retval SHR_E_PARAM Invalid trace event enum value. 586 * \retval SHR_E_NOT_FOUND Symbol string not found for the specified trace event. 587 */ 588 extern int 589 mbcm_ltsw_switch_trace_event_to_symbol(int unit, bcm_pkt_trace_event_t trace_event, 590 const char **table, const char **symbol); 591 592 /*! 593 * \brief Set a mirror instance id to an EP recirculate profile entry. 594 * 595 * \param [in] unit Unit number. 596 * \param [in] recirc_profile_id EP Recirculate profile id. 597 * \param [in] id Mirror instance id. 598 * 599 * \retval SHR_E_NONE Success. 600 * \retval !SHR_E_NONE Failure. 601 */ 602 extern int 603 mbcm_ltsw_switch_ep_recirc_profile_mirror_instance_set(int unit, 604 int recirc_profile_id, 605 int id); 606 607 /*! 608 * \brief Get the variant specific database. 609 * 610 * \param [in] unit Unit Number. 611 * \param [out] switch_db Switch database structure. 612 * 613 * \retval SHR_E_NONE No errors. 614 * \retval !SHR_E_NONE Failure. 615 */ 616 extern int 617 mbcm_ltsw_switch_db_get(int unit, bcmint_switch_db_t *switch_db); 618 619 /*! 620 * \brief Switch protocol packet control initialization. 621 * 622 * \param [in] unit Unit Number. 623 * 624 * \retval SHR_E_NONE No errors. 625 * \retval !SHR_E_NONE Failure. 626 */ 627 extern int 628 mbcm_ltsw_switch_protocol_init(int unit); 629 630 /*! 631 * \brief Switch protocol packet control operations handler. 632 * 633 * \param [in] unit Unit Number. 634 * 635 * \retval SHR_E_NONE No errors. 636 * \retval !SHR_E_NONE Failure. 637 */ 638 extern int 639 mbcm_ltsw_switch_protocol_handle(int unit, bcmlt_opcode_t opcode, 640 bcm_switch_pkt_protocol_match_t *match, 641 bcm_switch_pkt_control_action_t *action, 642 int *priority); 643 644 645 /*! 646 * \brief Switch packet integrity check initialization. 647 * 648 * \param [in] unit Unit Number. 649 * 650 * \retval SHR_E_NONE No errors. 651 * \retval !SHR_E_NONE Failure. 652 */ 653 extern int 654 mbcm_ltsw_switch_pkt_integrity_check_init(int unit); 655 656 /*! 657 * \brief Switch packet integrity check operations handler. 658 * 659 * \param [in] unit Unit Number. 660 * 661 * \retval SHR_E_NONE No errors. 662 * \retval !SHR_E_NONE Failure. 663 */ 664 extern int 665 mbcm_ltsw_switch_pkt_integrity_handle(int unit, bcmlt_opcode_t opcode, 666 bcm_switch_pkt_integrity_match_t *match, 667 bcm_switch_pkt_control_action_t *action, 668 int *priority); 669 670 /*! 671 * \brief Switch trace event monitor initialization. 672 * 673 * \param [in] unit Unit Number. 674 * 675 * \retval SHR_E_NONE No errors. 676 * \retval !SHR_E_NONE Failure. 677 */ 678 extern int 679 mbcm_ltsw_switch_mon_trace_event_init(int unit); 680 681 /*! 682 * \brief Switch module init. 683 * 684 * \param [in] unit Unit number 685 * 686 * \retval SHR_E_NONE on success and error code otherwise. 687 */ 688 extern int 689 mbcm_ltsw_switch_init(int unit); 690 691 /*! 692 * \brief Switch module detach. 693 * 694 * \param [in] unit Unit number 695 * 696 * \retval SHR_E_NONE on success and error code otherwise. 697 */ 698 extern int 699 mbcm_ltsw_switch_detach(int unit); 700 701 /*! 702 * \brief Create an EP Recirculate profile. 703 * 704 * \param [in] unit Unit number. 705 * \param [in/out] recirc_profile The EP Recirculate profile config structure. 706 * \param [out] recirc_profile_id The EP Recirculate config profile id. 707 * 708 * \retval SHR_E_NONE Success. 709 * \retval !SHR_E_NONE Failure. 710 */ 711 extern int 712 mbcm_ltsw_switch_ep_recirc_profile_create( 713 int unit, 714 bcm_switch_ep_recirc_profile_t *recirc_profile, 715 int *recirc_profile_id); 716 717 /*! 718 * \brief Destroy an EP Recirculate profile. 719 * 720 * \param [in] unit Unit number. 721 * \param [in] recirc_profile_id The EP Recirculate config profile id. 722 * 723 * \retval SHR_E_NONE Success. 724 * \retval !SHR_E_NONE Failure. 725 */ 726 extern int 727 mbcm_ltsw_switch_ep_recirc_profile_destroy( 728 int unit, 729 int recirc_profile_id); 730 731 /*! 732 * \brief Get all EP Recirculate profile ids. 733 * 734 * If recirc_profile_id_array == NULL, count will be OUT for the number of 735 * profiles; if the size cannot fit, it will only copy according to the size. 736 * 737 * \param [in] unit Unit number. 738 * \param [out] recirc_profile_id_array EP Recirculate profile id array. 739 * \param [in/out] count Count of the EP Recirculate profiles. 740 * 741 * \retval BCM_E_NONE on success and error code otherwise. 742 */ 743 extern int 744 mbcm_ltsw_switch_ep_recirc_profile_get_all( 745 int unit, 746 int *recirc_profile_id_array, 747 int *count); 748 749 /*! 750 * \brief Get an EP Recirculate profile. 751 * 752 * \param [in] unit Unit number. 753 * \param [in] recirc_profile_id The EP Recirculate profile id. 754 * \param [out] recirc_profile The EP Recirculate profile. 755 * 756 * \retval SHR_E_NONE Success. 757 * \retval !SHR_E_NONE Failure. 758 */ 759 extern int 760 mbcm_ltsw_switch_ep_recirc_profile_get( 761 int unit, 762 int recirc_profile_id, 763 bcm_switch_ep_recirc_profile_t *recirc_profile); 764 765 /*! 766 * \brief Set drop event based EP Recirculate control. 767 * 768 * \param [in] unit Unit number. 769 * \param [in] drop_event_ctrl The recirculate drop event control. 770 * 771 * \retval SHR_E_NONE Success. 772 * \retval !SHR_E_NONE Failure. 773 */ 774 extern int 775 mbcm_ltsw_switch_ep_recirc_drop_event_control_set( 776 int unit, 777 bcm_switch_ep_recirc_drop_event_control_t *drop_event_ctrl); 778 779 780 /*! 781 * \brief Get drop event based EP Recirculate control. 782 * 783 * \param [in] unit Unit number. 784 * \param [out] drop_event_ctrl The recirculate drop event control. 785 * 786 * \retval SHR_E_NONE Success. 787 * \retval !SHR_E_NONE Failure. 788 */ 789 extern int 790 mbcm_ltsw_switch_ep_recirc_drop_event_control_get( 791 int unit, 792 bcm_switch_ep_recirc_drop_event_control_t *drop_event_ctrl); 793 794 /*! 795 * \brief Set trace event based EP Recirculate control. 796 * 797 * \param [in] unit Unit number. 798 * \param [in] trace_event_ctrl The recirculate trace event control. 799 * 800 * \retval SHR_E_NONE Success. 801 * \retval !SHR_E_NONE Failure. 802 */ 803 extern int 804 mbcm_ltsw_switch_ep_recirc_trace_event_control_set( 805 int unit, 806 bcm_switch_ep_recirc_trace_event_control_t *trace_event_ctrl); 807 808 /*! 809 * \brief Get trace event based EP Recirculate control. 810 * 811 * \param [in] unit Unit number. 812 * \param [out] trace_event_ctrl The recirculate trace event control. 813 * 814 * \retval SHR_E_NONE Success. 815 * \retval !SHR_E_NONE Failure. 816 */ 817 extern int 818 mbcm_ltsw_switch_ep_recirc_trace_event_control_get( 819 int unit, 820 bcm_switch_ep_recirc_trace_event_control_t *trace_event_ctrl); 821 822 /*! 823 * \brief Enable/disable an egress trace event to trigger EP Recirculate. 824 * 825 * Users need to refer to related documents for the currently supported 826 * trace event types. 827 * 828 * \param [in] unit Unit number. 829 * \param [in] trace_event The trace event. 830 * \param [in] enable The enabled status of the trace event. 831 * 832 * 833 * \retval SHR_E_NONE Success. 834 * \retval !SHR_E_NONE Failure. 835 */ 836 extern int 837 mbcm_ltsw_switch_ep_recirc_trace_event_enable_set( 838 int unit, 839 bcm_pkt_trace_event_t trace_event, 840 int enable); 841 842 /*! 843 * \brief Get all enabled egress trace event for EP Recirculate. 844 * 845 * If trace_event_array == NULL, count will be OUT for the number of 846 * events; if the size cannot fit, it will only copy according to the size; 847 * 848 * \param [in] unit Unit number. 849 * \param [out] trace_event_array Trace event array. 850 * \param [in/out] count Count of the enabled trace events. 851 * 852 * \retval BCM_E_NONE on success and error code otherwise. 853 */ 854 extern int 855 mbcm_ltsw_switch_ep_recirc_trace_event_enable_get_all( 856 int unit, 857 bcm_pkt_trace_event_t *trace_event_array, 858 int *count); 859 860 /*! 861 * \brief Get enabled status of an egress trace event for EP Recirculate. 862 * 863 * Users need to refer to related documents for the currently supported 864 * trace event types. 865 * 866 * \param [in] unit Unit number. 867 * \param [in] trace_event The trace event. 868 * \param [out] enable The enabled status of the trace event. 869 * 870 * \retval SHR_E_NONE Success. 871 * \retval !SHR_E_NONE Failure. 872 */ 873 extern int 874 mbcm_ltsw_switch_ep_recirc_trace_event_enable_get( 875 int unit, 876 bcm_pkt_trace_event_t trace_event, 877 int *enable); 878 879 /*! 880 * \brief Set a mirror instance id to an EP recirculate profile entry. 881 * 882 * \param [in] unit Unit number. 883 * \param [in] recirc_profile_id EP Recirculate profile id. 884 * \param [in] mirror_instance_id Mirror instance id. 885 * 886 * \retval SHR_E_NONE Success. 887 * \retval !SHR_E_NONE Failure. 888 */ 889 extern int 890 mbcm_ltsw_switch_ep_recirc_profile_mirror_instance_set( 891 int unit, 892 int recirc_profile_id, 893 int mirror_instance_id); 894 895 /*! 896 * \brief Get the mirror instance id from EP recirculate profile entries. 897 * 898 * \param [in] unit Unit number. 899 * \param [out] mirror_instance_id Mirror instance id. 900 * 901 * \retval SHR_E_NONE Success. 902 * \retval !SHR_E_NONE Failure. 903 */ 904 extern int 905 mbcm_ltsw_switch_ep_recirc_profile_mirror_instance_get( 906 int unit, 907 int *mirror_instance_id); 908 909 #endif /* MBCM_LTSW_SC_H */