ft_msg.h (17257B)
1 /* 2 * 3 * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file. 4 * 5 * Copyright 2007-2019 Broadcom Inc. All rights reserved. 6 * 7 * File: shr_ft_msg.h 8 */ 9 10 #ifndef SHR_FT_MSG_H_ 11 #define SHR_FT_MSG_H_ 12 13 #include <soc/shared/ft.h> 14 15 #ifdef BCM_UKERNEL 16 #define __COMPILER_ATTR__ __attribute__ ((packed, aligned(4))) 17 #else 18 #define __COMPILER_ATTR__ 19 #endif 20 21 22 #define FT_MSG_BASE_VERSION 0x0 23 24 /* 25 * Enhanced shr_ft_msg_ctrl_group_flow_data_get_t msg to include: 26 * - inner_src_ip 27 * - inner_dst_ip 28 * - vnid 29 * - inner_l4_src_port 30 * - inner_l4_dst_port 31 * - inner_ip_protocol 32 * - custom_length 33 * - custom[] 34 */ 35 /* 36 * Enhanced shr_ft_msg_ctrl_group_flow_data_get_reply_t to add: 37 * - drop_reasons[] 38 * - num_drop_reasons 39 */ 40 /* 41 * Enhanced shr_ft_msg_ctrl_init_t to include: 42 * - fsp_reinject_max_length 43 */ 44 45 #define FT_MSG_VERSION_1 1 46 47 /* 48 * Enhanced shr_ft_msg_ctrl_group_flow_data_get_t to add: 49 * - in_port 50 */ 51 #define FT_MSG_VERSION_2 2 52 53 #define FT_MSG_VERSION FT_MSG_VERSION_2 54 55 extern uint32 ft_msg_version; 56 57 /* 58 * Per pipe info used for FT Initialization control message 59 */ 60 typedef struct __COMPILER_ATTR__ _ft_msg_ctrl_init_pipe_s { 61 /* Max flows */ 62 uint32 max_flows; 63 64 /* Size of reserved pools */ 65 uint16 ctr_pool_size[SHR_FT_MAX_CTR_POOLS]; 66 67 /* Reserved Flex counter pools per pipe */ 68 uint8 ctr_pools[SHR_FT_MAX_CTR_POOLS]; 69 70 /* Number of reserved counter pools */ 71 uint8 num_ctr_pools; 72 73 } shr_ft_msg_ctrl_init_pipe_t; 74 75 /* 76 * FT Initialization control message 77 */ 78 79 /* Enable flow start timestamp storing */ 80 #define SHR_FT_MSG_INIT_FLAGS_FLOW_START_TS (1 << 0) 81 82 /* Enable Elephant monitoring */ 83 #define SHR_FT_MSG_INIT_FLAGS_ELEPHANT (1 << 1) 84 85 /* Enable drop monitoring */ 86 #define SHR_FT_MSG_INIT_FLAGS_DROP_MONITOR (1 << 2) 87 88 typedef struct __COMPILER_ATTR__ shr_ft_msg_ctrl_init_s { 89 /* Initialization flags */ 90 uint32 flags; 91 92 /* Max number of groups */ 93 uint32 max_groups; 94 95 /* Local RX DMA channel */ 96 uint32 rx_channel; 97 98 /* Current time in seconds */ 99 uint32 cur_time_secs; 100 101 /* Export interval in msec */ 102 uint32 export_interval_msecs; 103 104 /* Scan interval in usec */ 105 uint32 scan_interval_usecs; 106 107 /* Aging timer tick in msec */ 108 uint32 age_timer_tick_msecs; 109 110 /* Per H/w pipe info */ 111 shr_ft_msg_ctrl_init_pipe_t pipe[SHR_FT_MAX_PIPES]; 112 113 /* Maximum length of the transmitted packet */ 114 uint16 max_export_pkt_length; 115 116 /* FSP re-inject max length */ 117 uint16 fsp_reinject_max_length; 118 119 /* Num ports in the device */ 120 uint8 num_pipes; 121 122 /* Number of elephant profiles */ 123 uint8 num_elph_profiles; 124 125 } shr_ft_msg_ctrl_init_t; 126 127 /* 128 * EM key format export 129 */ 130 typedef struct __COMPILER_ATTR__ shr_ft_msg_ctrl_em_qual_s { 131 /* Offsets into the key */ 132 uint16 offset[SHR_FT_EM_KEY_MAX_QUAL_PARTS]; 133 134 /* Width of qualifiers */ 135 uint8 width[SHR_FT_EM_KEY_MAX_QUAL_PARTS]; 136 137 /* Num offsets of the qualifier */ 138 uint8 num_parts; 139 } shr_ft_msg_ctrl_qual_parts_t; 140 141 typedef struct __COMPILER_ATTR__ shr_ft_msg_ctrl_em_key_format_s { 142 /* Offsets and width of each qual */ 143 shr_ft_msg_ctrl_qual_parts_t qual_parts[SHR_FT_EM_MAX_QUAL]; 144 145 /* Size of the key in bits */ 146 uint16 key_size; 147 148 /* Qualifiers */ 149 uint8 qual[SHR_FT_EM_MAX_QUAL]; 150 151 /* Number of qualifiers */ 152 uint8 num_qual; 153 } shr_ft_msg_ctrl_em_key_format_t; 154 155 /* 156 * EM qualifier info 157 */ 158 typedef struct __COMPILER_ATTR__ shr_ft_msg_ctrl_qual_info_s { 159 /* Width of the qualifier in bytes */ 160 uint16 width; 161 162 /* Offsets of each key part */ 163 uint16 part_offset[SHR_FT_EM_KEY_MAX_QUAL_PARTS]; 164 165 /* Width of each qualifier part */ 166 uint8 part_width[SHR_FT_EM_KEY_MAX_QUAL_PARTS]; 167 168 /* Qualifier */ 169 uint8 qual; 170 171 /* Num offsets of the qualifier */ 172 uint8 num_parts; 173 174 /* Base offset type of UDF */ 175 uint8 base_offset; 176 177 /* Relative offset in bytes of this chunk in the pkt */ 178 uint8 relative_offset; 179 180 } shr_ft_msg_ctrl_qual_info_t; 181 182 /* 183 * Tracking param info 184 */ 185 typedef struct __COMPILER_ATTR__ shr_ft_msg_ctrl_tp_info_s { 186 /* Tracking param */ 187 uint8 param; 188 189 /* Number of qualifiers that make up this param */ 190 uint8 num_qual; 191 192 /* Qualifiers */ 193 uint8 qual[SHR_FT_EM_MAX_QUAL]; 194 195 /* UDF or fixed qualifier */ 196 uint8 udf; 197 } shr_ft_msg_ctrl_tp_info_t; 198 199 200 /* 201 * EM group info 202 */ 203 typedef struct __COMPILER_ATTR__ shr_ft_msg_ctrl_em_group_create_s { 204 /* Offsets and width of each qual */ 205 shr_ft_msg_ctrl_qual_info_t qual_info[SHR_FT_EM_MAX_QUAL]; 206 207 /* Tracking param info */ 208 shr_ft_msg_ctrl_tp_info_t tp_info[SHR_FT_MAX_TP]; 209 210 /* Action set bitmap */ 211 uint32 aset; 212 213 /* Size of the key in bits */ 214 uint16 key_size; 215 216 /* EM group index */ 217 uint8 group_idx; 218 219 /* EM LT ID */ 220 uint8 lt_id[SHR_FT_MAX_PIPES]; 221 222 /* Number of pipes in the device */ 223 uint8 num_pipes; 224 225 /* Number of qualifiers */ 226 uint8 num_qual; 227 228 /* Number of tracking params */ 229 uint8 num_tp; 230 231 } shr_ft_msg_ctrl_em_group_create_t; 232 233 234 /* 235 * FT group create 236 */ 237 typedef struct __COMPILER_ATTR__ shr_ft_msg_ctrl_group_create_s { 238 /* Flags */ 239 uint32 flags; 240 241 /* Max flows that can be learned on this group */ 242 uint32 flow_limit; 243 244 /* Aging interval in msecs */ 245 uint32 aging_interval_msecs; 246 247 /* IPFIX domain id */ 248 uint32 domain_id; 249 250 /* Group Index */ 251 uint16 group_idx; 252 } shr_ft_msg_ctrl_group_create_t; 253 254 /* 255 * FT group get 256 */ 257 typedef struct __COMPILER_ATTR__ shr_ft_msg_ctrl_group_get_s { 258 /* Flags */ 259 uint32 flags; 260 261 /* Max flows that can be learned on this group */ 262 uint32 flow_limit; 263 264 /* Num flows that learnt on this group */ 265 uint32 flow_count; 266 267 /* Aging interval in msecs */ 268 uint32 aging_interval; 269 270 /* IPFIX domain id */ 271 uint32 domain_id; 272 273 /* Group Index */ 274 uint16 group_idx; 275 276 /* Elephant profile Id */ 277 uint16 elph_profile_id; 278 279 /* QoS profile Id */ 280 uint16 qos_profile_id; 281 282 /* Collector Id */ 283 uint16 collector_id; 284 285 /* Template Id */ 286 uint16 template_id; 287 288 } shr_ft_msg_ctrl_group_get_t; 289 290 /* 291 * FT group update 292 */ 293 typedef struct __COMPILER_ATTR__ shr_ft_msg_ctrl_group_update_s { 294 /* Flags */ 295 uint32 flags; 296 297 /* Indicates what is being updated */ 298 uint32 update; 299 300 /* Param value depending on the update */ 301 uint32 param0; 302 303 /* Group Index */ 304 uint16 group_idx; 305 } shr_ft_msg_ctrl_group_update_t; 306 307 /* 308 * Create IPFIX template 309 */ 310 typedef struct __COMPILER_ATTR__ shr_ft_msg_ctrl_template_create_s { 311 /* Flags */ 312 uint32 flags; 313 314 /* Software handle for template */ 315 uint16 id; 316 317 /* IPFIX set id */ 318 uint16 set_id; 319 320 /* Number of information elements */ 321 uint8 num_info_elems; 322 323 /* Information elements in the order they are to be exported */ 324 uint8 info_elems[SHR_FT_TEMPLATE_MAX_INFO_ELEMENTS]; 325 326 /* Size in bytes of the info elems */ 327 uint16 data_size[SHR_FT_TEMPLATE_MAX_INFO_ELEMENTS]; 328 } shr_ft_msg_ctrl_template_create_t; 329 330 /* 331 * Get IPFIX template 332 */ 333 typedef struct __COMPILER_ATTR__ shr_ft_msg_ctrl_template_get_s { 334 /* Flags */ 335 uint32 flags; 336 337 /* Software handle for template */ 338 uint16 id; 339 340 /* IPFIX set id */ 341 uint16 set_id; 342 343 /* Number of information elements */ 344 uint8 num_info_elems; 345 346 /* Information elements in the order they are to be exported */ 347 uint8 info_elems[SHR_FT_TEMPLATE_MAX_INFO_ELEMENTS]; 348 349 /* Size in bytes of the info elems */ 350 uint16 data_size[SHR_FT_TEMPLATE_MAX_INFO_ELEMENTS]; 351 } shr_ft_msg_ctrl_template_get_t; 352 353 /* Collector msg flags */ 354 #define SHR_FT_MSG_COLLECTOR_FLAGS_UDP_CHECKSUM_ENABLE (1 << 0) 355 356 /* 357 * Create collector 358 */ 359 typedef struct __COMPILER_ATTR__ shr_ft_msg_ctrl_collector_create_s { 360 /* Flags */ 361 uint32 flags; 362 363 /* Checksum of IP header excluding length */ 364 uint32 ip_base_checksum; 365 366 /* UDP psuedo header checksum */ 367 uint32 udp_base_checksum; 368 369 /* Component Id for Protobuf export */ 370 uint32 component_id; 371 372 /* Software handle for collector */ 373 uint16 id; 374 375 /* Length of the IPFIX encapsulation */ 376 uint16 encap_length; 377 378 /* Max size of the packet that can be sent to collector */ 379 uint16 mtu; 380 381 /* Offset to start of IP header in the encap */ 382 uint16 ip_offset; 383 384 /* Offset to start of UDP header in the encap */ 385 uint16 udp_offset; 386 387 /* Length of the system Id used in Protobuf export */ 388 uint16 system_id_length; 389 390 uint8 system_id[SHR_FT_PB_SYSTEM_ID_MAX_LENGTH]; 391 392 /* Collector encapsulation */ 393 uint8 encap[SHR_FT_MAX_COLLECTOR_ENCAP_LENGTH]; 394 } shr_ft_msg_ctrl_collector_create_t; 395 396 /* 397 * Get collector 398 */ 399 typedef struct __COMPILER_ATTR__ shr_ft_msg_ctrl_collector_get_s { 400 /* Flags */ 401 uint32 flags; 402 403 /* Checksum of IP header excluding length */ 404 uint32 ip_base_checksum; 405 406 /* UDP psuedo header checksum */ 407 uint32 udp_base_checksum; 408 409 /* Component Id for Protobuf export */ 410 uint32 component_id; 411 412 /* Software handle for collector */ 413 uint16 id; 414 415 /* Length of the IPFIX encapsulation */ 416 uint16 encap_length; 417 418 /* Collector encapsulation */ 419 uint16 encap[SHR_FT_MAX_COLLECTOR_ENCAP_LENGTH]; 420 421 /* Max size of the packet that can be sent to collector */ 422 uint16 mtu; 423 424 /* Offset to start of IP header in the encap */ 425 uint16 ip_offset; 426 427 /* Length of the system Id used in Protobuf export */ 428 uint16 system_id_length; 429 430 uint8 system_id[SHR_FT_PB_SYSTEM_ID_MAX_LENGTH]; 431 432 /* Offset to start of UDP header in the encap */ 433 uint16 udp_offset; 434 } shr_ft_msg_ctrl_collector_get_t; 435 436 /* 437 * Get data associated with a flow 438 */ 439 typedef struct __COMPILER_ATTR__ shr_ft_msg_ctrl_group_flow_data_get_s { 440 /* Source IP */ 441 uint32 src_ip; 442 443 /* Destination IP */ 444 uint32 dst_ip; 445 446 /* Source IP */ 447 uint32 inner_src_ip; 448 449 /* Destination IP */ 450 uint32 inner_dst_ip; 451 452 /* VNID */ 453 uint32 vnid; 454 455 /* Group Index */ 456 uint16 group_idx; 457 458 /* L4 source port */ 459 uint16 l4_src_port; 460 461 /* L4 destination port */ 462 uint16 l4_dst_port; 463 464 /* L4 source port */ 465 uint16 inner_l4_src_port; 466 467 /* L4 destination port */ 468 uint16 inner_l4_dst_port; 469 470 /* IP protocol */ 471 uint8 ip_protocol; 472 473 /* IP protocol */ 474 uint8 inner_ip_protocol; 475 476 /* Custom key length */ 477 uint8 custom_length; 478 479 /* Custom */ 480 uint8 custom[SHR_FT_CUSTOM_KEY_MAX_LENGTH]; 481 482 /* In port */ 483 uint16 in_port; 484 } shr_ft_msg_ctrl_group_flow_data_get_t; 485 486 /* 487 * Data associated with a flow 488 */ 489 typedef struct __COMPILER_ATTR__ shr_ft_msg_ctrl_group_flow_data_get_reply_s { 490 /* Upper 32 bits of the packet counter */ 491 uint32 pkt_count_upper; 492 493 /* Lower 32 bits of the packet counter */ 494 uint32 pkt_count_lower; 495 496 /* Upper 32 bits of the byte counter */ 497 uint32 byte_count_upper; 498 499 /* Lower 32 bits of the byte counter */ 500 uint32 byte_count_lower; 501 502 /* Upper 32 bits of the flow start timestamp */ 503 uint32 flow_start_ts_upper; 504 505 /* Lower 32 bits of the flow start timestamp */ 506 uint32 flow_start_ts_lower; 507 508 /* Upper 32 bits of the Observation timestamp */ 509 uint32 obs_ts_upper; 510 511 /* Lower 32 bits of the Observation timestamp */ 512 uint32 obs_ts_lower; 513 514 /* Drop reasons */ 515 uint16 drop_reasons[SHR_FT_DROP_REASONS_MAX_COUNT]; 516 517 /* Number of drop reasons */ 518 uint8 num_drop_reasons; 519 520 } shr_ft_msg_ctrl_group_flow_data_get_reply_t; 521 522 /* 523 * FT SER event 524 */ 525 typedef struct __COMPILER_ATTR__ shr_ft_msg_ctrl_ser_event_s { 526 /* Flags */ 527 uint32 flags; 528 529 /* Memory */ 530 uint32 mem; 531 532 /* Index */ 533 uint32 index; 534 535 /* Pipe */ 536 uint8 pipe; 537 } shr_ft_msg_ctrl_ser_event_t; 538 539 /* 540 * Start the transmission of the template set 541 */ 542 typedef struct __COMPILER_ATTR__ shr_ft_msg_ctrl_template_xmit_s { 543 /* Flags */ 544 uint32 flags; 545 546 /* Template id */ 547 uint16 template_id; 548 549 /* Collector id */ 550 uint16 collector_id; 551 552 /* Initial burst of packets to be sent out */ 553 uint16 initial_burst; 554 555 /* Transmit Interval */ 556 uint16 interval_secs; 557 558 /* Length of the encap */ 559 uint16 encap_length; 560 561 /* Template encap */ 562 uint8 encap[SHR_FT_MAX_TEMPLATE_SET_ENCAP_LENGTH]; 563 564 } shr_ft_msg_ctrl_template_xmit_t; 565 566 /* 567 * Elephant profile filter 568 */ 569 typedef struct __COMPILER_ATTR__ shr_ft_msg_ctrl_elph_profile_filter_s { 570 /* Upper 32 bits of the size threshold in bytes */ 571 uint32 size_threshold_bytes_upper_32; 572 573 /* Upper 32 bits of the size threshold in bytes */ 574 uint32 size_threshold_bytes_lower_32; 575 576 /* Low rate threshold in bytes/100usec */ 577 uint32 rate_low_threshold; 578 579 /* High rate threshold in bytes/100usec */ 580 uint32 rate_high_threshold; 581 582 /* Scan count */ 583 uint16 scan_count; 584 585 /* 1 - Rate has to increase every scan */ 586 uint8 incr_rate; 587 } shr_ft_msg_ctrl_elph_profile_filter_t; 588 589 /* 590 * Add an elephant profile 591 */ 592 typedef struct __COMPILER_ATTR__ shr_ft_msg_ctrl_elph_profile_create_s { 593 /* Filters arranged in order, 2 Promotions and 1 Demotion */ 594 shr_ft_msg_ctrl_elph_profile_filter_t filters[SHR_FT_ELPH_MAX_FILTERS]; 595 596 /* Profile Id */ 597 uint8 profile_idx; 598 599 /* Number of filters, added for completeness sake, must be always 3 */ 600 uint8 num_filters; 601 } shr_ft_msg_ctrl_elph_profile_create_t; 602 603 /* 604 * Get an elephant profile 605 */ 606 typedef struct __COMPILER_ATTR__ shr_ft_msg_ctrl_elph_profile_get_s { 607 /* Filters arranged in order, 2 Promotions and 1 Demotion */ 608 shr_ft_msg_ctrl_elph_profile_filter_t filters[SHR_FT_ELPH_MAX_FILTERS]; 609 610 /* Profile Id */ 611 uint8 profile_idx; 612 613 /* Number of filters, added for completeness sake, must be always 3 */ 614 uint8 num_filters; 615 } shr_ft_msg_ctrl_elph_profile_get_t; 616 617 /* 618 * Get learn stats 619 */ 620 typedef struct __COMPILER_ATTR__ shr_ft_msg_ctrl_stats_learn_s { 621 /* Counts corresponding to different stats */ 622 uint32 count[SHR_FT_LEARN_PKT_MAX_STATUS]; 623 624 /* Average time taken for each status */ 625 uint32 avg_usecs[SHR_FT_LEARN_PKT_MAX_STATUS]; 626 627 /* Number of status */ 628 uint16 num_status; 629 } shr_ft_msg_ctrl_stats_learn_t; 630 631 /* 632 * Get export stats 633 */ 634 typedef struct __COMPILER_ATTR__ shr_ft_msg_ctrl_stats_export_s { 635 /* Number of packets exported */ 636 uint32 num_pkts; 637 638 /* Number of flows exported */ 639 uint32 num_flows; 640 641 /* Current Export Timestamp*/ 642 uint32 ts; 643 644 /* Current IPFIX Sequence number */ 645 uint32 seq_num; 646 647 } shr_ft_msg_ctrl_stats_export_t; 648 649 /* 650 * Get age stats 651 */ 652 typedef struct __COMPILER_ATTR__ shr_ft_msg_ctrl_stats_age_s { 653 /* Number of flows aged */ 654 uint32 num_flows; 655 } shr_ft_msg_ctrl_stats_age_t; 656 657 /* 658 * Get elph stats 659 */ 660 typedef struct __COMPILER_ATTR__ shr_ft_msg_ctrl_stats_elph_s { 661 /* State transition counts */ 662 uint32 trans_count[SHR_FT_ELPH_FLOW_STATE_COUNT][SHR_FT_ELPH_ACTION_COUNT]; 663 664 /* Number of states */ 665 uint16 num_states; 666 667 /* Number of actions */ 668 uint16 num_actions; 669 } shr_ft_msg_ctrl_stats_elph_t; 670 671 /* 672 * Features supported by the SDK 673 */ 674 typedef struct __COMPILER_ATTR__ shr_ft_msg_ctrl_sdk_features_s { 675 /* Feature bitmap */ 676 uint32 features; 677 678 /* SDK cfg mode */ 679 uint8 cfg_mode; 680 } shr_ft_msg_ctrl_sdk_features_t; 681 682 /* 683 * Features supported by the uC 684 */ 685 typedef struct __COMPILER_ATTR__ shr_ft_msg_ctrl_uc_features_s { 686 /* Feature bitmap */ 687 uint32 features; 688 } shr_ft_msg_ctrl_uc_features_t; 689 690 /* 691 * Set actions on a group 692 */ 693 typedef struct __COMPILER_ATTR__ shr_ft_msg_ctrl_group_actions_set_s { 694 /* Action bitmap */ 695 uint32 actions; 696 697 /* Group Idx */ 698 uint16 group_idx; 699 700 /* CoSQ for FSP action */ 701 uint16 fsp_cosq; 702 } shr_ft_msg_ctrl_group_actions_set_t; 703 704 /* 705 * FT control messages 706 */ 707 typedef union shr_ft_msg_ctrl_s { 708 shr_ft_msg_ctrl_init_t init; 709 shr_ft_msg_ctrl_em_key_format_t em_key_format; 710 shr_ft_msg_ctrl_group_create_t group_create; 711 shr_ft_msg_ctrl_group_get_t group_get; 712 shr_ft_msg_ctrl_group_update_t group_update; 713 shr_ft_msg_ctrl_template_create_t template_create; 714 shr_ft_msg_ctrl_template_get_t template_get; 715 shr_ft_msg_ctrl_collector_create_t collector_create; 716 shr_ft_msg_ctrl_collector_get_t collector_get; 717 shr_ft_msg_ctrl_group_flow_data_get_t data_get; 718 shr_ft_msg_ctrl_group_flow_data_get_reply_t data_get_reply; 719 shr_ft_msg_ctrl_ser_event_t ser_event; 720 shr_ft_msg_ctrl_template_xmit_t tmpl_xmit; 721 shr_ft_msg_ctrl_elph_profile_create_t eprofile_create; 722 shr_ft_msg_ctrl_elph_profile_get_t eprofile_get; 723 shr_ft_msg_ctrl_stats_learn_t stats_learn; 724 shr_ft_msg_ctrl_stats_export_t stats_export; 725 shr_ft_msg_ctrl_stats_age_t stats_age; 726 shr_ft_msg_ctrl_stats_elph_t stats_elph; 727 shr_ft_msg_ctrl_sdk_features_t sdk_features; 728 shr_ft_msg_ctrl_uc_features_t uc_features; 729 shr_ft_msg_ctrl_em_group_create_t em_group_create; 730 shr_ft_msg_ctrl_group_actions_set_t group_actions_set; 731 } shr_ft_msg_ctrl_t; 732 733 734 #endif /* SHR_FT_MSG_H_ */