sat.h (30817B)
1 /* 2 * 3 * 4 * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file. 5 * 6 * Copyright 2007-2020 Broadcom Inc. All rights reserved. 7 * 8 */ 9 10 #ifndef __BCM_SAT_H__ 11 #define __BCM_SAT_H__ 12 13 #include <bcm/types.h> 14 #include <bcm/pkt.h> 15 16 /* SAT endpoint flags */ 17 #define BCM_SAT_ENDPOINT_WITH_ID 0x01 /* Use the specified 18 endpoint ID */ 19 #define BCM_SAT_ENDPOINT_REPLACE 0x02 /* Replace an existing 20 SAT endpoint */ 21 #define BCM_SAT_ENDPOINT_UPMEP 0x04 /* Endpoint associated 22 with SAT UP-MEP */ 23 #define BCM_SAT_ENDPOINT_DOWNMEP 0x08 /* Endpoint associated 24 with SAT DOWN-MEP */ 25 #define BCM_SAT_ENDPOINT_MATCH_INNER_VLAN 0x10 /* Selection of SAT MEP 26 based on C VLAN */ 27 #define BCM_SAT_ENDPOINT_MATCH_OUTER_VLAN 0x20 /* Selection of SAT MEP 28 based on C VLAN */ 29 30 /* SAT action flags */ 31 #define BCM_SAT_ACTION_FWD_ACTION_DROP 0x01 /* Forward action for the 32 SAT packet is to drop */ 33 #define BCM_SAT_ACTION_FWD_ACTION_REDIRECT 0x02 /* Forward action for the 34 SAT packet is redirect 35 to DGLP port */ 36 #define BCM_SAT_ACTION_FWD_ACTION_LLF 0x04 /* Forward action for the 37 SAT packet is perform 38 latching loop back 39 function (LLF) and 40 redirect packet to 41 SGLP port */ 42 #define BCM_SAT_ACTION_COPY_TO_CPU 0x08 /* Copy SAT packet to CPU */ 43 #define BCM_SAT_ACTION_SAMPLE_TIMESTAMP 0x10 /* Sample time stamp into 44 the OLP header */ 45 46 /* SAT Timestamp Formats */ 47 typedef enum bcm_sat_timestamp_format_e { 48 bcmSATTimestampFormatIEEE1588v1 = 0x00, /* Low-order 64 bits of the IEEE 49 1588-2008 (1588v2) Precision Time 50 Protocol timestamp format [IEEE1588] */ 51 bcmSATTimestampFormatNTP = 0x01 /* Network Time Protocol version 4 52 64-bit timestamp format [RFC5905] */ 53 } bcm_sat_timestamp_format_t; 54 55 /* SAT endpoint ID type */ 56 typedef int bcm_sat_endpoint_t; 57 58 /* SAT endpoint object. */ 59 typedef struct bcm_sat_endpoint_info_s { 60 bcm_sat_endpoint_t ep_id; /* The ID associated with this endpoint */ 61 uint32 flags; /* The flags associated with this 62 endpoint */ 63 bcm_gport_t src_gport; /* The source gport associated with this 64 endpoint */ 65 bcm_vlan_t outer_vlan; /* Outer-most VLAN tag (vlanID+ 3bits 66 dot1p +CFI) associated with this 67 endpoint */ 68 bcm_vlan_t inner_vlan; /* Configure with CVLAN tag (vlanID+ 69 3bits dot1p +CFI) for two-tag 70 operation or set to 0 for one-tag */ 71 bcm_mac_t dst_mac_address; /* The destination MAC address 72 associated with this endpoint */ 73 bcm_mac_t src_mac_address; /* The source MAC address associated 74 with this endpoint */ 75 uint16 ether_type; /* Ether type of the packet */ 76 uint32 action_flags; /* SAT action flags */ 77 uint8 pkt_pri; /* Egress priority marking for packet 78 redirected to DGPP */ 79 bcm_gport_t dest_gport; /* Local endpoint SAT PDUs are forwarded 80 to this OLP destination port for 81 processing */ 82 bcm_sat_timestamp_format_t timestamp_format; /* SAT timestamp format */ 83 uint16 session_id; /* SAT session ID to identify the test 84 among the MEPs */ 85 } bcm_sat_endpoint_info_t; 86 87 /* Callback function type for SAT endpoint traversal */ 88 typedef int (*bcm_sat_endpoint_traverse_cb)( 89 int unit, 90 bcm_sat_endpoint_info_t *endpoint_info, 91 void *user_data); 92 93 #ifndef BCM_HIDE_DISPATCHABLE 94 95 /* Create or replace a SAT endpoint object. */ 96 extern int bcm_sat_endpoint_create( 97 int unit, 98 bcm_sat_endpoint_info_t *endpoint_info); 99 100 /* Get a SAT endpoint object. */ 101 extern int bcm_sat_endpoint_get( 102 int unit, 103 bcm_sat_endpoint_t endpoint, 104 uint32 flags, 105 bcm_sat_endpoint_info_t *endpoint_info); 106 107 /* Destroy a SAT endpoint object. */ 108 extern int bcm_sat_endpoint_destroy( 109 int unit, 110 bcm_sat_endpoint_t endpoint, 111 uint32 flags); 112 113 /* Destroy all SAT endpoint objects. */ 114 extern int bcm_sat_endpoint_destroy_all( 115 int unit, 116 uint32 flags); 117 118 /* Traverse the set of SAT endpoints. */ 119 extern int bcm_sat_endpoint_traverse( 120 int unit, 121 uint32 flags, 122 bcm_sat_endpoint_traverse_cb cb, 123 void *user_data); 124 125 #endif /* BCM_HIDE_DISPATCHABLE */ 126 127 /* Miscellaneous SAT defines */ 128 #define BCM_SAT_GTF_NUM_OF_PRIORITIES 2 /* Number of element in 129 gtf */ 130 #define BCM_SAT_PAYLOAD_MAX_PATTERN_SIZE 8 /* SAT payload pattern 131 max size */ 132 #define BCM_SAT_GTF_PACKET_LENGTH_NUM_OF_PATTERNS 8 /* Number of pattern of 133 GTF packet length */ 134 #define BCM_SAT_GTF_PACKET_MAX_PATTERN_LENGTH 32 /* SAT packet max pattern 135 length */ 136 #define BCM_SAT_GTF_MAX_STAMPS 3 /* Max stamps of SAT GTF */ 137 #define BCM_SAT_CTF_IDENTIFIER_ANY 0xFFFFFFFF /* SAT ctf idenifier */ 138 #define BCM_SAT_CTF_STAT_MAX_NUM_OF_BINS 10 /* SAT ctf bins number */ 139 140 /* SAT config flags */ 141 #define BCM_SAT_CONFIG_CRC_REVERSED_DATA 0x01 /* During CRC calculation 142 the packet data bits 143 are reversed */ 144 #define BCM_SAT_CONFIG_CRC_INVERT 0x02 /* During CRC calculation 145 the result is inverted 146 and reversed before 147 stamping */ 148 #define BCM_SAT_CONFIG_CRC_HIGH_RESET 0x04 /* During CRC 149 calculations, reset 150 CRC value is taken to 151 be 32'hffffffff */ 152 #define BCM_SAT_CONFIG_PRBS_USE_NXOR 0x08 /* During PRBS 153 calculations the next 154 bit is created using 155 NXOR (and not XOR) */ 156 #define BCM_SAT_CONFIG_TWAMP_MODE 0x10 /* Mapped to two ctf 157 flows with consecutive 158 IDs when twamp_mode 159 set. */ 160 161 /* SAT GTF create flags */ 162 #define BCM_SAT_GTF_WITH_ID 0x01 /* Use the specified gtf ID */ 163 164 /* SAT GTF packet config flags */ 165 #define BCM_SAT_GTF_PACKET_EDIT_ADD_END_TLV 0x01 /* If set, add an END TLV 166 at the end of the 167 packet */ 168 #define BCM_SAT_GTF_PACKET_EDIT_ADD_CRC 0x02 /* If set, add CRC */ 169 170 /* SAT GTF rate pattern flags */ 171 #define BCM_SAT_GTF_RATE_PATTERN_STOP_INTERVAL_EQ_BURST 0x01 /* If set, INTERVAL state 172 limit is set to the 173 configuration, 174 otherwise to the 175 number of packets sent 176 in BURST state */ 177 178 /* SAT GTF rate flags */ 179 #define BCM_SAT_GTF_RATE_IN_BYTES 0x0 /* If set, gtf rate is 180 configured in bytes 181 per second */ 182 #define BCM_SAT_GTF_RATE_IN_PACKETS 0x01 /* If set, gtf rate is 183 configured in packets 184 per second */ 185 #define BCM_SAT_GTF_RATE_WITH_GRANULARITY 0x02 /* If set, the 186 granularity can be 187 changed; if not, 188 granularity will be 1 */ 189 190 /* SAT CTF create flags */ 191 #define BCM_SAT_CTF_WITH_ID 0x01 /* Use the specified ctf ID */ 192 193 /* SAT CTF packet config flags */ 194 #define BCM_SAT_CTF_PACKET_INFO_ADD_END_TLV 0x01 /* If set, add end tlv, 195 otherwise not add end 196 tlv */ 197 #define BCM_SAT_CTF_PACKET_INFO_ADD_CRC 0x02 /* If set, add crc, 198 otherwise not add crc */ 199 200 /* SAT CTF Stat Get flags */ 201 #define BCM_SAT_CTF_STAT_DO_NOT_CLR_ON_READ 0x01 /* If set, do not clear 202 counter when reading, 203 otherwise clear 204 counter */ 205 206 /* SAT CTF Report Config flags */ 207 #define BCM_SAT_CTF_REPORT_ADD_SEQ_NUM 0x01 /* If set, add sequence 208 number to reports */ 209 #define BCM_SAT_CTF_REPORT_ADD_DELAY 0x02 /* If set, add delay to 210 reports */ 211 212 /* SAT gtf ID type */ 213 typedef int bcm_sat_gtf_t; 214 215 /* SAT ctf ID type */ 216 typedef int bcm_sat_ctf_t; 217 218 /* SAT GTF Priority */ 219 typedef enum bcm_sat_gtf_pri_e { 220 bcmSatGtfPriAll = -1, /* Relevant to both CIR generator and EIR generator */ 221 bcmSatGtfPriCir = 0, /* Only relevant to CIR generator */ 222 bcmSatGtfPriEir = 1 /* Only relevant to EIR generator */ 223 } bcm_sat_gtf_pri_t; 224 225 /* SAT Header Type */ 226 typedef enum bcm_sat_header_type_e { 227 bcmSatHeaderUserDefined = 0, /* User defined SAT header */ 228 bcmSatHeaderY1731 = 1, /* SAT Header defined by Y1731 */ 229 bcmSatHeaderMEF = 2, /* SAT Header defined by MEF */ 230 bcmSatHeadersCount = 3 /* Always Last. Not a usable value. */ 231 } bcm_sat_header_type_t; 232 233 /* SAT Payload Type */ 234 typedef enum bcm_sat_payload_type_e { 235 bcmSatPayloadConstant8Bytes = 0, /* 8 byte repeatable pattern */ 236 bcmSatPayloadConstant4Bytes = 1, /* 4 byte repeatable pattern */ 237 bcmSatPayloadPRBS = 2, /* PRBS-31 */ 238 bcmSatPayloadsCount = 3 /* Always Last. Not a usable value. */ 239 } bcm_sat_payload_type_t; 240 241 /* SAT Stamp Type */ 242 typedef enum bcm_sat_stamp_type_e { 243 bcmSatStampInvalid = 0, /* Invalid stamp type */ 244 bcmSatStampConstant2Bit = 1, /* 2 bit stamp - constant value to stamp 245 into the packet */ 246 bcmSatStampCounter8Bit = 2, /* 8 bit counter */ 247 bcmSatStampCounter16Bit = 3, /* 16 bit counter */ 248 bcmSatStampConstant16Bit = 4, /* 16 bit stamp - constant value to stamp 249 into the packet */ 250 bcmSatStampCount = 5 /* Always Last. Not a usable value. */ 251 } bcm_sat_stamp_type_t; 252 253 /* SAT Stamp Field */ 254 typedef enum bcm_sat_stamp_field_e { 255 bcmSatStampFieldUserDefined = 0, /* Stamp user defined field */ 256 bcmSatStampFieldTc = 1, /* Stamp Tc */ 257 bcmSatStampFieldDp = 2, /* Stamp Dp */ 258 bcmSatStampFieldSrcMac = 3, /* Stamp Src Mac */ 259 bcmSatStampFieldDestMac = 4, /* Stamp Dest Mac */ 260 bcmSatStampFieldInnerVlan = 5, /* Stamp Inner Vlan */ 261 bcmSatStampFieldOuterVlan = 6, /* Stamp Outer Vlan */ 262 bcmSatStampFieldsCount = 7 /* Always Last. Not a usable value. */ 263 } bcm_sat_stamp_field_t; 264 265 /* SAT gtf rate pattern mode */ 266 typedef enum bcm_sat_gtf_rate_pattern_mode_e { 267 bcmSatGtfRatePatternContinues = 0, /* Plain */ 268 bcmSatGtfRatePatternSimpleBurst = 1, /* Burst only */ 269 bcmSatGtfRatePatternCombined = 2, /* Combined mode */ 270 bcmSatGtfRatePatternInterval = 3, /* Interval mode */ 271 bcmSatGtfRatePatternsCount = 4 /* Always Last. Not a usable value. */ 272 } bcm_sat_gtf_rate_pattern_mode_t; 273 274 /* SAT gtf counter types */ 275 typedef enum bcm_sat_gtf_stat_counter_e { 276 bcmSatGtfStatPacketCount = 0, /* Count number of packets transmitted */ 277 bcmSatGtfStatCount = 1 /* Always Last. Not a usable value. */ 278 } bcm_sat_gtf_stat_counter_t; 279 280 /* SAT event types */ 281 typedef enum bcm_sat_event_type_e { 282 bcmSATEventReport = 0, 283 bcmSATEventCount = 1 /* Always Last. Not a usable value. */ 284 } bcm_sat_event_type_t; 285 286 /* Sat common configuration Object */ 287 typedef struct bcm_sat_config_s { 288 bcm_sat_timestamp_format_t timestamp_format; /* SAT timestamp format */ 289 uint32 config_flags; 290 uint32 seq_number_wrap_around; /* SEQ number wrap-around */ 291 } bcm_sat_config_t; 292 293 /* 294 * Offsets of payload, timestamp and sequence number in user defined 295 * header 296 */ 297 typedef struct bcm_sat_header_user_define_offsets_s { 298 int payload_offset; /* Payload offset */ 299 int timestamp_offset; /* Timestamp offset */ 300 int seq_number_offset; /* Sequence number offset */ 301 int crc_byte_offset; /* offset of CRC covered byte */ 302 int packet_length_compensation; /* Adjust the GTF bandwidth */ 303 } bcm_sat_header_user_define_offsets_t; 304 305 /* Configure sat payload */ 306 typedef struct bcm_sat_payload_s { 307 bcm_sat_payload_type_t payload_type; /* Payload type */ 308 uint8 payload_pattern[BCM_SAT_PAYLOAD_MAX_PATTERN_SIZE]; /* Payload pattern */ 309 } bcm_sat_payload_t; 310 311 /* Configure sat stamp */ 312 typedef struct bcm_sat_stamp_s { 313 bcm_sat_stamp_type_t stamp_type; /* Stamp type */ 314 bcm_sat_stamp_field_t field_type; /* Stamp field type */ 315 uint32 inc_step; /* Increment step - by what value the 316 counter should be incremented */ 317 uint32 inc_period_packets; /* Increment period - counter may be 318 incremented every 1/2/4/8 packets */ 319 uint32 value; /* Stamp value */ 320 uint32 offset; /* Stamp offset in bits - where to stamp 321 the counter, beginning from start of 322 packet */ 323 } bcm_sat_stamp_t; 324 325 /* Configure sat packet of gtf */ 326 typedef struct bcm_sat_gtf_packet_edit_s { 327 uint32 packet_length[BCM_SAT_GTF_PACKET_LENGTH_NUM_OF_PATTERNS]; /* Packet length */ 328 uint32 packet_length_pattern[BCM_SAT_GTF_PACKET_MAX_PATTERN_LENGTH]; /* Packet length pattern */ 329 uint32 pattern_length; /* Pattern length */ 330 bcm_sat_stamp_t stamps[BCM_SAT_GTF_MAX_STAMPS]; /* Configurae stamp */ 331 uint32 number_of_stamps; /* Number of stamps valid in stamps */ 332 uint32 number_of_ctfs; /* Number of CTFs which collect 333 information from the current gtf */ 334 uint32 flags; 335 } bcm_sat_gtf_packet_edit_t; 336 337 /* Sat gtf packet config */ 338 typedef struct bcm_sat_gtf_packet_config_s { 339 bcm_sat_header_type_t sat_header_type; /* Sat header type */ 340 bcm_pkt_t header_info; /* Sat header info */ 341 bcm_sat_payload_t payload; /* Sat payload */ 342 bcm_sat_gtf_packet_edit_t packet_edit[BCM_SAT_GTF_NUM_OF_PRIORITIES]; /* Packet edit for each element of the 343 gtf */ 344 uint32 packet_context_id; /* Core ID for jericho */ 345 bcm_sat_header_user_define_offsets_t offsets; /* Offsets of payload, timestamp and 346 sequence number in user defined 347 header */ 348 } bcm_sat_gtf_packet_config_t; 349 350 /* Configure sat gtf bandwidth */ 351 typedef struct bcm_sat_gtf_bandwidth_s { 352 uint32 flags; 353 uint32 rate; /* traffic rate. Units: kbps */ 354 uint32 max_burst; /* traffic burst. Units: kbit */ 355 uint32 granularity; /* packet per second */ 356 } bcm_sat_gtf_bandwidth_t; 357 358 /* Configure sat gtf rate pattern */ 359 typedef struct bcm_sat_gtf_rate_pattern_s { 360 bcm_sat_gtf_rate_pattern_mode_t rate_pattern_mode; /* rate pattern mode */ 361 uint32 high_threshold; /* High threshold */ 362 uint32 low_threshold; /* Lower threshold */ 363 uint32 stop_iter_count; /* Stop Iterations */ 364 uint32 stop_burst_count; /* Stop Burst count - Burst state is 365 left when number of packets 366 transmitted in this state is 367 greater-equal than this value */ 368 uint32 stop_interval_count; /* Stop interval count */ 369 uint32 burst_packet_weight; /* Burst Pkt Weight - on each packet 370 transmitted in Burst state packet 371 counter increased by this value */ 372 uint32 interval_packet_weight; /* Inteval Packet weight - on each 373 packet transmitted in Interval state 374 packet counter increased by this 375 value */ 376 uint32 flags; 377 } bcm_sat_gtf_rate_pattern_t; 378 379 /* Sat ctf packet config */ 380 typedef struct bcm_sat_ctf_packet_info_s { 381 bcm_sat_header_type_t sat_header_type; /* Sat header type */ 382 bcm_sat_payload_t payload; /* Sat payload */ 383 uint32 flags; 384 bcm_sat_header_user_define_offsets_t offsets; /* Offsets of payload, timestamp and 385 sequence number in user defined 386 header */ 387 } bcm_sat_ctf_packet_info_t; 388 389 /* Sat ctf is recognized by this parameters */ 390 typedef struct bcm_sat_ctf_identifier_s { 391 uint32 tc; /* Class of service */ 392 uint32 color; /* Color */ 393 uint32 trap_id; /* Trap ID */ 394 uint32 session_id; /* SAT session ID */ 395 } bcm_sat_ctf_identifier_t; 396 397 /* Sat ctf bin limit */ 398 typedef struct bcm_sat_ctf_bin_limit_s { 399 uint32 bin_select; /* bin select */ 400 uint32 bin_limit; /* bin limit */ 401 } bcm_sat_ctf_bin_limit_t; 402 403 /* Sat ctf stat object for configuration */ 404 typedef struct bcm_sat_ctf_stat_config_s { 405 uint32 use_global_bin_config; /* Use global bin config */ 406 uint32 bin_min_delay; /* Bin min delay, for linear bins */ 407 uint32 bin_step; /* Bin step, for linear bins */ 408 uint32 update_counters_in_unvavail_state; /* Update counters in unavail state */ 409 } bcm_sat_ctf_stat_config_t; 410 411 /* Sat ctf stat */ 412 typedef struct bcm_sat_ctf_stat_s { 413 uint64 received_packet_cnt; /* Counter packet counter */ 414 uint64 out_of_order_packet_cnt; /* Counter for out of order packet */ 415 uint64 err_packet_cnt; /* Counter for error packet */ 416 uint64 received_octet_cnt; /* Counter for received octet */ 417 uint64 out_of_order_octet_cnt; /* Counter for out of order octet */ 418 uint64 err_octet_cnt; /* Counter for error octet */ 419 uint64 last_packet_delay; /* counter for last packet delay */ 420 uint64 bin_delay_counters[BCM_SAT_CTF_STAT_MAX_NUM_OF_BINS]; /* Counters for bin delay */ 421 uint64 accumulated_delay_count; /* Counter for accumulated delay */ 422 uint64 max_packet_delay; /* max packet delay */ 423 uint64 min_packet_delay; /* min packet delay */ 424 uint64 time_of_day_stamp; /* Time of day stamp */ 425 uint64 sec_in_avail_state_counter; /* Counter for sec in avail state */ 426 uint64 last_packet_seq_number; /* Last received packet sequence number */ 427 } bcm_sat_ctf_stat_t; 428 429 /* Sat gtf stat */ 430 typedef struct bcm_sat_gtf_stat_multi_s { 431 uint64 transmitted_packet_cnt; /* Counter transmitted packet */ 432 uint64 transmitted_byte_cnt; /* Counter transmitted byte */ 433 } bcm_sat_gtf_stat_multi_t; 434 435 /* Sat ctf state for configuration */ 436 typedef struct bcm_sat_ctf_availability_config_s { 437 uint32 switch_state_num_of_slots; /* Number of slot */ 438 uint32 switch_state_threshold_per_slot; /* Threshold per slot */ 439 } bcm_sat_ctf_availability_config_t; 440 441 /* Sat ctf report object */ 442 typedef struct bcm_sat_ctf_report_config_s { 443 uint32 report_sampling_percent; /* Report sampling percent */ 444 uint32 flags; 445 } bcm_sat_ctf_report_config_t; 446 447 /* Sat ctf report event data */ 448 typedef struct bcm_sat_report_event_data_s { 449 int sequence_number; /* Sequence number */ 450 int sequence_number_valid; /* Sequence number valid */ 451 int delay; /* Delay */ 452 int delay_valid; /* Delay valid */ 453 bcm_sat_ctf_t ctf_id; /* SAT CTF id */ 454 } bcm_sat_report_event_data_t; 455 456 /* Initialize a bcm_sat_header_user_define_offsets_t structure. */ 457 extern void bcm_sat_header_user_define_offsets_t_init( 458 bcm_sat_header_user_define_offsets_t *offsets); 459 460 /* Initialize a bcm_sat_payload_t structure. */ 461 extern void bcm_sat_payload_t_init( 462 bcm_sat_payload_t *payload); 463 464 /* Initialize a bcm_sat_config_t structure. */ 465 extern void bcm_sat_config_t_init( 466 bcm_sat_config_t *conf); 467 468 /* Initialize a bcm_sat_stamp_t structure. */ 469 extern void bcm_sat_stamp_t_init( 470 bcm_sat_stamp_t *stamp); 471 472 /* Initialize a bcm_sat_gtf_packet_edit_t structure. */ 473 extern void bcm_sat_gtf_packet_edit_t_init( 474 bcm_sat_gtf_packet_edit_t *packet_edit); 475 476 /* Initialize a bcm_sat_gtf_packet_config_t structure. */ 477 extern void bcm_sat_gtf_packet_config_t_init( 478 bcm_sat_gtf_packet_config_t *pkt_cfg); 479 480 /* Initialize a bcm_sat_gtf_bandwidth_t structure. */ 481 extern void bcm_sat_gtf_bandwidth_t_init( 482 bcm_sat_gtf_bandwidth_t *bw); 483 484 /* Initialize a bcm_sat_gtf_rate_pattern_t structure. */ 485 extern void bcm_sat_gtf_rate_pattern_t_init( 486 bcm_sat_gtf_rate_pattern_t *rate_pattern); 487 488 /* Initialize a bcm_sat_endpoint_info_t structure. */ 489 extern void bcm_sat_endpoint_info_t_init( 490 bcm_sat_endpoint_info_t *endpoint_info); 491 492 #ifndef BCM_HIDE_DISPATCHABLE 493 494 /* Set common configuration. */ 495 extern int bcm_sat_config_set( 496 int unit, 497 bcm_sat_config_t *conf); 498 499 /* Get common configuration. */ 500 extern int bcm_sat_config_get( 501 int unit, 502 bcm_sat_config_t *conf); 503 504 /* Create SAT GTF object. */ 505 extern int bcm_sat_gtf_create( 506 int unit, 507 uint32 flags, 508 bcm_sat_gtf_t *gtf_id); 509 510 /* Destroy a SAT GTF object. */ 511 extern int bcm_sat_gtf_destroy( 512 int unit, 513 bcm_sat_gtf_t gtf_id); 514 515 /* Destroy all SAT GTF objects. */ 516 extern int bcm_sat_gtf_destroy_all( 517 int unit); 518 519 #endif /* BCM_HIDE_DISPATCHABLE */ 520 521 /* Gtf callback function prototype. */ 522 typedef int (*bcm_sat_gtf_traverse_cb)( 523 int unit, 524 bcm_sat_gtf_t gtf_id, 525 void *user_data); 526 527 #ifndef BCM_HIDE_DISPATCHABLE 528 529 /* Traverse all the gtfs. */ 530 extern int bcm_sat_gtf_traverse( 531 int unit, 532 bcm_sat_gtf_traverse_cb cb, 533 void *user_data); 534 535 /* Set gtf packet format. */ 536 extern int bcm_sat_gtf_packet_config( 537 int unit, 538 bcm_sat_gtf_t gtf_id, 539 bcm_sat_gtf_packet_config_t *config); 540 541 /* Set gtf packet format. */ 542 extern int bcm_sat_gtf_packet_config_set( 543 int unit, 544 bcm_sat_gtf_t gtf_id, 545 bcm_sat_gtf_packet_config_t *config); 546 547 /* Set gtf packet format. */ 548 extern int bcm_sat_gtf_packet_config_get( 549 int unit, 550 bcm_sat_gtf_t gtf_id, 551 bcm_sat_gtf_packet_config_t *config); 552 553 /* Set gtf bandwidth. */ 554 extern int bcm_sat_gtf_bandwidth_set( 555 int unit, 556 bcm_sat_gtf_t gtf_id, 557 int priority, 558 bcm_sat_gtf_bandwidth_t *bw); 559 560 /* Get gtf bandwidth. */ 561 extern int bcm_sat_gtf_bandwidth_get( 562 int unit, 563 bcm_sat_gtf_t gtf_id, 564 int priority, 565 bcm_sat_gtf_bandwidth_t *bw); 566 567 /* Set gtf rate pattern. */ 568 extern int bcm_sat_gtf_rate_pattern_set( 569 int unit, 570 bcm_sat_gtf_t gtf_id, 571 int priority, 572 bcm_sat_gtf_rate_pattern_t *config); 573 574 /* Get gtf rate pattern. */ 575 extern int bcm_sat_gtf_rate_pattern_get( 576 int unit, 577 bcm_sat_gtf_t gtf_id, 578 int priority, 579 bcm_sat_gtf_rate_pattern_t *config); 580 581 /* Start gtf packet generation. */ 582 extern int bcm_sat_gtf_packet_start( 583 int unit, 584 bcm_sat_gtf_t gtf_id, 585 bcm_sat_gtf_pri_t priority); 586 587 /* Stop gtf packet generation. */ 588 extern int bcm_sat_gtf_packet_stop( 589 int unit, 590 bcm_sat_gtf_t gtf_id, 591 bcm_sat_gtf_pri_t priority); 592 593 /* Get gtf Statistics. */ 594 extern int bcm_sat_gtf_stat_get( 595 int unit, 596 bcm_sat_gtf_t gtf_id, 597 int priority, 598 uint32 flags, 599 bcm_sat_gtf_stat_counter_t type, 600 uint64 *value); 601 602 /* Get gtf multi Statistics. */ 603 extern int bcm_sat_gtf_stat_multi_get( 604 int unit, 605 bcm_sat_gtf_t gtf_id, 606 bcm_sat_gtf_stat_multi_t *stat); 607 608 /* Create SAT CTF object. */ 609 extern int bcm_sat_ctf_create( 610 int unit, 611 uint32 flags, 612 bcm_sat_ctf_t *ctf_id); 613 614 /* Destroy a SAT CTF object. */ 615 extern int bcm_sat_ctf_destroy( 616 int unit, 617 bcm_sat_ctf_t ctf_id); 618 619 /* Destroy all SAT CTF objects. */ 620 extern int bcm_sat_ctf_destroy_all( 621 int unit); 622 623 #endif /* BCM_HIDE_DISPATCHABLE */ 624 625 /* Ctf callback function prototype. */ 626 typedef int (*bcm_sat_ctf_traverse_cb)( 627 int unit, 628 bcm_sat_ctf_t ctf_id, 629 void *user_data); 630 631 #ifndef BCM_HIDE_DISPATCHABLE 632 633 /* Traverse all the ctfs. */ 634 extern int bcm_sat_ctf_traverse( 635 int unit, 636 bcm_sat_ctf_traverse_cb cb, 637 void *user_data); 638 639 /* Set ctf packet format. */ 640 extern int bcm_sat_ctf_packet_config( 641 int unit, 642 bcm_sat_ctf_t ctf_id, 643 bcm_sat_ctf_packet_info_t *packet_info); 644 645 #endif /* BCM_HIDE_DISPATCHABLE */ 646 647 /* Initialize a bcm_sat_ctf_packet_info_t structure. */ 648 extern void bcm_sat_ctf_packet_info_t_init( 649 bcm_sat_ctf_packet_info_t *packet_info); 650 651 /* Initialize a bcm_sat_ctf_identifier_t structure. */ 652 extern void bcm_sat_ctf_identifier_t_init( 653 bcm_sat_ctf_identifier_t *identifier); 654 655 /* Initialize a bcm_sat_ctf_bin_limit_t structure. */ 656 extern void bcm_sat_ctf_bin_limit_t_init( 657 bcm_sat_ctf_bin_limit_t *bins); 658 659 /* Initialize a bcm_sat_ctf_stat_config_t structure. */ 660 extern void bcm_sat_ctf_stat_config_t_init( 661 bcm_sat_ctf_stat_config_t *stat_cfg); 662 663 /* Initialize a bcm_sat_ctf_stat_t structure. */ 664 extern void bcm_sat_ctf_stat_t_init( 665 bcm_sat_ctf_stat_t *stat); 666 667 /* Initialize a bcm_sat_ctf_availability_config_t structure. */ 668 extern void bcm_sat_ctf_availability_config_t_init( 669 bcm_sat_ctf_availability_config_t *config); 670 671 /* Initialize a bcm_sat_ctf_report_config_t structure. */ 672 extern void bcm_sat_ctf_report_config_t_init( 673 bcm_sat_ctf_report_config_t *reports); 674 675 #ifndef BCM_HIDE_DISPATCHABLE 676 677 /* Map identifier to ctf. */ 678 extern int bcm_sat_ctf_identifier_map( 679 int unit, 680 bcm_sat_ctf_identifier_t *identifier, 681 bcm_sat_ctf_t ctf_id); 682 683 /* Unmap identifier to ctf. */ 684 extern int bcm_sat_ctf_identifier_unmap( 685 int unit, 686 bcm_sat_ctf_identifier_t *identifier); 687 688 /* Add specific trap ID. */ 689 extern int bcm_sat_ctf_trap_add( 690 int unit, 691 uint32 trap_id); 692 693 /* Remove specific trap ID. */ 694 extern int bcm_sat_ctf_trap_remove( 695 int unit, 696 uint32 trap_id); 697 698 /* Destroy all Trap objects. */ 699 extern int bcm_sat_ctf_trap_remove_all( 700 int unit); 701 702 /* Set ctf bin limit configuration. */ 703 extern int bcm_sat_ctf_bin_limit_set( 704 int unit, 705 int bins_count, 706 bcm_sat_ctf_bin_limit_t *bins); 707 708 /* Get ctf bin limit configuration. */ 709 extern int bcm_sat_ctf_bin_limit_get( 710 int unit, 711 int max_bins_count, 712 bcm_sat_ctf_bin_limit_t *bins, 713 int *bins_count); 714 715 /* Configure ctf stat. */ 716 extern int bcm_sat_ctf_stat_config_set( 717 int unit, 718 bcm_sat_ctf_t ctf_id, 719 bcm_sat_ctf_stat_config_t *stat); 720 721 /* Get ctf stat values. */ 722 extern int bcm_sat_ctf_stat_get( 723 int unit, 724 bcm_sat_ctf_t ctf_id, 725 uint32 flags, 726 bcm_sat_ctf_stat_t *stat); 727 728 /* Set ctf availability. */ 729 extern int bcm_sat_ctf_availability_config_set( 730 int unit, 731 bcm_sat_ctf_t ctf_id, 732 bcm_sat_ctf_availability_config_t *config); 733 734 /* Map trap data to session ID. */ 735 extern int bcm_sat_ctf_trap_data_to_session_map( 736 int unit, 737 uint32 trap_data, 738 uint32 trap_data_mask, 739 uint32 session_id); 740 741 /* Unmap trap data to session ID. */ 742 extern int bcm_sat_ctf_trap_data_to_session_unmap( 743 int unit, 744 uint32 trap_data, 745 uint32 trap_data_mask); 746 747 /* Set ctf report configuration. */ 748 extern int bcm_sat_ctf_reports_config_set( 749 int unit, 750 bcm_sat_ctf_t ctf_id, 751 bcm_sat_ctf_report_config_t *reports); 752 753 #endif /* BCM_HIDE_DISPATCHABLE */ 754 755 /* Callback function type for SAT event handling */ 756 typedef int (*bcm_sat_event_cb)( 757 int unit, 758 bcm_sat_event_type_t event_type, 759 void *user_provided_struct, 760 void *user_data); 761 762 #ifndef BCM_HIDE_DISPATCHABLE 763 764 /* Register a handler for SAT events. */ 765 extern int bcm_sat_event_register( 766 int unit, 767 bcm_sat_event_type_t event_type, 768 bcm_sat_event_cb cb, 769 void *user_data); 770 771 /* Unregister a handler for SAT events. */ 772 extern int bcm_sat_event_unregister( 773 int unit, 774 bcm_sat_event_type_t event_type, 775 bcm_sat_event_cb cb); 776 777 #endif /* BCM_HIDE_DISPATCHABLE */ 778 779 #endif /* __BCM_SAT_H__ */