trunk.h (30229B)
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 * DO NOT EDIT THIS FILE! 9 * This file is auto-generated. 10 * Edits to this file will be lost when it is regenerated. 11 */ 12 13 #ifndef __BCM_TRUNK_H__ 14 #define __BCM_TRUNK_H__ 15 16 #include <bcm/types.h> 17 #include <shared/trunk.h> 18 19 #define BCM_TRUNK_MAX_PORTCNT 256 /* Maximum number of ports in 20 a trunk group */ 21 #define BCM_TRUNK_FABRIC_MAX_PORTCNT 32 /* Maximum number of ports in 22 a fabric trunk group */ 23 #define BCM_TRUNK_UNSPEC_INDEX -1 /* Let software set 24 DLF/MC/IPMC. */ 25 26 /* Port Selection Criteria. */ 27 #define BCM_TRUNK_PSC_SRCMAC 1 /* Source MAC address. */ 28 #define BCM_TRUNK_PSC_DSTMAC 2 /* Destination MAC address. */ 29 #define BCM_TRUNK_PSC_SRCDSTMAC 3 /* Source+dest MAC address. */ 30 #define BCM_TRUNK_PSC_SRCIP 4 /* Source IP address. */ 31 #define BCM_TRUNK_PSC_DSTIP 5 /* Destination IP address. */ 32 #define BCM_TRUNK_PSC_SRCDSTIP 6 /* Source+dest IP address. */ 33 #define BCM_TRUNK_PSC_REDUNDANT 7 /* Redundant (xgs_fabric). */ 34 #define BCM_TRUNK_PSC_PORTINDEX 8 /* Port index. */ 35 #define BCM_TRUNK_PSC_PORTFLOW 9 /* Enhanced hashing. */ 36 #define BCM_TRUNK_PSC_VLANINDEX 10 /* Static port selection 37 based on VLAN ID. */ 38 #define BCM_TRUNK_PSC_DYNAMIC 11 /* Dynamic load balancing 39 normal mode. */ 40 #define BCM_TRUNK_PSC_DYNAMIC_ASSIGNED 12 /* Dynamic load balancing 41 assigned mode. */ 42 #define BCM_TRUNK_PSC_DYNAMIC_OPTIMAL 13 /* Dynamic load balancing 43 optimal mode. */ 44 #define BCM_TRUNK_PSC_ROUND_ROBIN 14 /* Round robin selection of 45 members. */ 46 #define BCM_TRUNK_PSC_DYNAMIC_RESILIENT 15 /* Resilient load balancing 47 mode. */ 48 #define BCM_TRUNK_PSC_RANDOMIZED 16 /* Randomized load balancing 49 mode. */ 50 #define BCM_TRUNK_PSC_SMOOTH_DIVISION 17 /* Use Smooth Division table 51 to choose members. */ 52 #define BCM_TRUNK_PSC_C_LAG 18 /* Use Consistent Lag tables 53 to choose members. */ 54 #define BCM_TRUNK_PSC_WEIGHTED_PROFILE 19 /* Use Weighted profile to 55 choose members. */ 56 57 /* 58 * BCM5675 has additional fields for hashing in trunk mode. 59 * BCM_TRUNK_PSC_EGRESS_VID and BCM_TRUNK_PSC_RANDOM are for software 60 * IPMC trunk resolution. 61 */ 62 #define BCM_TRUNK_PSC_IPMACSA 0x00010 /* Include IP: MAC source 63 address. */ 64 #define BCM_TRUNK_PSC_IPMACDA 0x00020 /* Include IP: MAC dest address. */ 65 #define BCM_TRUNK_PSC_IPTYPE 0x00040 /* Include IP: Ethertype. */ 66 #define BCM_TRUNK_PSC_IPVID 0x00080 /* Include IP: VLAN ID. */ 67 #define BCM_TRUNK_PSC_IPSA 0x00100 /* Include IP: source address. */ 68 #define BCM_TRUNK_PSC_IPDA 0x00200 /* Include IP: dest address. */ 69 #define BCM_TRUNK_PSC_L4SS 0x00400 /* Include TCP/UDP source socket. */ 70 #define BCM_TRUNK_PSC_L4DS 0x00800 /* Include TCP/UDP dest socket. */ 71 #define BCM_TRUNK_PSC_MACSA 0x01000 /* Include Non-IP: MAC source 72 address. */ 73 #define BCM_TRUNK_PSC_MACDA 0x02000 /* Include Non-IP: MAC dest 74 address. */ 75 #define BCM_TRUNK_PSC_TYPE 0x04000 /* Include Non-IP: Ethertype. */ 76 #define BCM_TRUNK_PSC_VID 0x08000 /* Include Non-IP: VLAN ID. */ 77 #define BCM_TRUNK_PSC_EGRESS_VID 0x10000 /* Include Egress VLAN ID. */ 78 #define BCM_TRUNK_PSC_RANDOM 0x20000 /* Include random number. */ 79 80 #define BCM_TRUNK_PSC_DEFAULT BCM_TRUNK_PSC_SRCDSTMAC 81 82 /* Backward compatibility. */ 83 #define BCM_RTAG_SRCMAC BCM_TRUNK_PSC_SRCMAC 84 #define BCM_RTAG_DSTMAC BCM_TRUNK_PSC_DSTMAC 85 #define BCM_RTAG_SRCDSTMAC BCM_TRUNK_PSC_SRCDSTMAC 86 #define BCM_RTAG_SRCIP BCM_TRUNK_PSC_SRCIP 87 #define BCM_RTAG_DSTIP BCM_TRUNK_PSC_DSTIP 88 #define BCM_RTAG_SRCDSTIP BCM_TRUNK_PSC_SRCDSTIP 89 #define BCM_TRUNK_DEF_RTAG BCM_TRUNK_PSC_DEFAULT 90 91 #define BCM_TRUNK_PSC_NAMES_INITIALIZER \ 92 { \ 93 "unknown", \ 94 "srcmac", \ 95 "destmac", \ 96 "srcdestmac", \ 97 "srcip", \ 98 "destip", \ 99 "srcdestip", \ 100 "redundant", \ 101 "portindex", \ 102 "portflow", \ 103 "invalid" \ 104 } 105 106 /* Trunk group set flags. */ 107 #define BCM_TRUNK_FLAG_FAILOVER_NEXT 0x0001 /* Failover port defaults 108 to the next port in 109 the trunk port list. */ 110 #define BCM_TRUNK_FLAG_FAILOVER_NEXT_LOCAL 0x0002 /* Failover port defaults 111 to the next local port 112 in the trunk port 113 list, if any. */ 114 #define BCM_TRUNK_FLAG_FAILOVER_ALL 0x0004 /* Failover ports default 115 to all other ports in 116 this trunk. */ 117 #define BCM_TRUNK_FLAG_FAILOVER_ALL_LOCAL 0x0008 /* Failover ports default 118 to all other local 119 ports in this trunk. */ 120 #define BCM_TRUNK_FLAG_FAILOVER BCM_TRUNK_FLAG_FAILOVER_NEXT_LOCAL /* Enable trunk failover 121 support (deprecated). */ 122 #define BCM_TRUNK_FLAG_WITH_ID 0x0010 /* Use the trunk ID 123 supplied by user. */ 124 #define BCM_TRUNK_FLAG_IPMC_CLEAVE 0x0020 /* Disable trunk 125 resolution for IPMC 126 packets in hardware. */ 127 #define BCM_TRUNK_FLAG_DYNAMIC_LOAD_DECREASE_RESET 0x0040 /* If set, historical 128 member load is reset 129 to the instantaneous 130 member load if the 131 latter is smaller. */ 132 #define BCM_TRUNK_FLAG_DYNAMIC_EXPECTED_LOAD_DECREASE_RESET 0x0080 /* If set, historical 133 expected member load 134 is reset to the 135 instantaneous expected 136 member load if the 137 latter is smaller. */ 138 #define BCM_TRUNK_FLAG_STACKING_TMD 0x0100 /* If set, Create trunk 139 which refer to 140 TM-domain Stacking 141 port. */ 142 #define BCM_TRUNK_FLAG_VP 0x0200 /* If set, Create a 143 virtual port trunk 144 group. */ 145 #define BCM_TRUNK_FLAG_MEMBER_SORT 0x0400 /* If set, Create a trunk 146 group with sorted 147 members. */ 148 #define BCM_TRUNK_FLAG_LOCAL 0x0800 /* If set, trunk can 149 contain only local 150 members. */ 151 #define BCM_TRUNK_FLAG_DONT_ALLOCATE_PP_PORTS 0x1000 /* If set, trunk will not 152 alocate pp ports by 153 default. */ 154 #define BCM_TRUNK_FLAG_WITH_VPLAG_ID 0x2000 /* If set, use the VPLAG 155 id supplied by the 156 user. */ 157 158 /* Trunk member flags. */ 159 #define BCM_TRUNK_MEMBER_INGRESS_DISABLE 0x0001 /* Member will not 160 receive traffic. 161 Receive traffic will 162 be treated as normal 163 port. 164 To drop all receive 165 traffic use: 166 bcm_port_discard_set, */ 167 #define BCM_TRUNK_MEMBER_EGRESS_DISABLE 0x0002 /* Member will not be a 168 part of the 169 distributor members to 170 be hashed. */ 171 #define BCM_TRUNK_MEMBER_EGRESS_DROP 0x0004 /* Member is part of the 172 distributor hash but 173 any traffic hashed to 174 this member will be 175 dropped. */ 176 #define BCM_TRUNK_MEMBER_UNICAST_EGRESS_DISABLE 0x0008 /* Member will not be a 177 part of the unicast 178 distributor members to 179 be hashed. */ 180 #define BCM_TRUNK_MEMBER_IPMC_EGRESS_DISABLE 0x0010 /* Member will not be a 181 part of the IPMC 182 distributor members to 183 be hashed. */ 184 #define BCM_TRUNK_MEMBER_L2MC_EGRESS_DISABLE 0x0020 /* Member will not be a 185 part of the L2MC 186 distributor members to 187 be hashed. */ 188 #define BCM_TRUNK_MEMBER_BCAST_EGRESS_DISABLE 0x0040 /* Member will not be a 189 part of the broadcast 190 distributor members to 191 be hashed. */ 192 #define BCM_TRUNK_MEMBER_DLF_EGRESS_DISABLE 0x0080 /* Member will not be a 193 part of the unknown 194 unicast or unknown 195 multicast distributor 196 members to be hashed. */ 197 #define BCM_TRUNK_MEMBER_MEMBER_DISABLE 0x0100 /* Member will not 198 recieve traffic as 199 result of hashing */ 200 201 /* 202 * Flags for configuring Ethertype eligibility for dynamic load 203 * balancing. 204 */ 205 #define BCM_TRUNK_DYNAMIC_ETHERTYPE_ELIGIBLE 0x01 /* If set, the specified 206 Ethertypes are 207 eligible, else 208 ineligible. */ 209 #define BCM_TRUNK_DYNAMIC_ETHERTYPE_INNER 0x02 /* Use packet's inner 210 Ethertype. */ 211 #define BCM_TRUNK_DYNAMIC_ETHERTYPE_TRUNK 0x04 /* Configure Ethertype 212 eligibility for trunk 213 dynamic load 214 balancing. */ 215 #define BCM_TRUNK_DYNAMIC_ETHERTYPE_FABRIC_TRUNK 0x08 /* Configure Ethertype 216 eligibility for Higig 217 trunk dynamic load 218 balancing. */ 219 #define BCM_TRUNK_DYNAMIC_ETHERTYPE_RESILIENT 0x10 /* If set, configure 220 Ethertype eligibility 221 for resilient load 222 balancing, else for 223 dynamic load 224 balancing. */ 225 226 /* Trunk Macro to support stacking trunk. */ 227 #define BCM_TRUNK_STACKING_TID_BIT 16 /* Bit offset which indicate the 228 tid is Stacking trunk. */ 229 #define BCM_TRUNK_STACKING_TID_SET(tid, peer_tmd) tid = peer_tmd | (1 << 16) /* Mark the tid as Stacking 230 trunk. */ 231 #define BCM_TRUNK_STACKING_TID_GET(tid) tid & ~(1 << 16) /* Get the tid from Stacking 232 trunk. */ 233 234 /* Resilient trunk flags. */ 235 #define BCM_TRUNK_RESILIENT_MATCH_HASH_KEY (1 << 0) /* Match on the hash key 236 value */ 237 #define BCM_TRUNK_RESILIENT_MATCH_MEMBER (1 << 1) /* Match on the interface 238 value */ 239 #define BCM_TRUNK_RESILIENT_MATCH_TRUNK_ID (1 << 2) /* Match on the Trunk-Id 240 value */ 241 #define BCM_TRUNK_RESILIENT_DELETE (1 << 3) /* Delete matched entries */ 242 #define BCM_TRUNK_RESILIENT_REPLACE (1 << 4) /* Replace matched 243 entries with 244 replace_entry */ 245 #define BCM_TRUNK_RESILIENT_COUNT (1 << 5) /* Count matched entries 246 in num_entries */ 247 248 /* Trunk profile information structure. */ 249 typedef struct bcm_trunk_psc_profile_info_s { 250 int weight_array[16]; /* Array of weights for members in trunk. */ 251 int weight_array_size; /* actual Number of members in weight array */ 252 uint32 psc_flags; /* BCM_TRUNK_PSC_xxx */ 253 int max_nof_members_in_profile; /* max number of members in a profile */ 254 } bcm_trunk_psc_profile_info_t; 255 256 /* Trunk group attributes structure. */ 257 typedef struct bcm_trunk_info_s { 258 uint32 flags; /* BCM_TRUNK_FLAG_xxx. */ 259 int psc; /* Port selection criteria. */ 260 bcm_trunk_psc_profile_info_t psc_info; /* Port selection criteria information. */ 261 int ipmc_psc; /* Port selection criteria for software 262 IPMC trunk resolution. */ 263 int dlf_index; /* DLF/broadcast port for trunk group. */ 264 int mc_index; /* Multicast port for trunk group. */ 265 int ipmc_index; /* IPMC port for trunk group. */ 266 int dynamic_size; /* Number of flows for dynamic load 267 balancing. Valid values are 512, 1k, 268 doubling up to 32k */ 269 int dynamic_age; /* Inactivity duration, in microseconds. */ 270 int dynamic_load_exponent; /* The exponent used in the 271 exponentially weighted moving average 272 calculation of historical member 273 load. */ 274 int dynamic_expected_load_exponent; /* The exponent used in the 275 exponentially weighted moving average 276 calculation of historical expected 277 member load. */ 278 bcm_trunk_t master_tid; /* Master trunk id. */ 279 } bcm_trunk_info_t; 280 281 /* Trunk ID infomation structure. */ 282 typedef struct bcm_trunk_id_info_s { 283 int pool_index; /* pool index of trunk_id */ 284 int group_index; /* group index of trunk_id */ 285 } bcm_trunk_id_info_t; 286 287 #define BCM_TRUNK_MAX_PP_PORTS 32 /* Maximal number of pp ports 288 accosiated with a single trunk */ 289 290 /* Trunk attributes structure. */ 291 typedef struct bcm_trunk_pp_port_allocation_info_s { 292 uint32 core_bitmap; 293 uint32 pp_port_per_core_array[BCM_TRUNK_MAX_PP_PORTS]; /* Array of pp ports per core. */ 294 } bcm_trunk_pp_port_allocation_info_t; 295 296 /* Initialize a trunk chip information structure. */ 297 typedef struct bcm_trunk_chip_info_s { 298 int trunk_group_count; /* Total number of (front panel) trunk groups. */ 299 int trunk_id_min; /* Minimum (front panel) trunk ID number. */ 300 int trunk_id_max; /* Maximum (front panel) trunk ID number. */ 301 int trunk_ports_max; /* Maximum number of ports per (front panel) 302 trunk group. */ 303 int trunk_fabric_id_min; /* Minimum fabric trunk ID number. */ 304 int trunk_fabric_id_max; /* Maximum fabric trunk ID number. */ 305 int trunk_fabric_ports_max; /* Maximum number of ports per fabric trunk 306 group. */ 307 int vp_id_min; /* Minimum virtual port trunk ID number. */ 308 int vp_id_max; /* Maximum virtual port trunk ID number. */ 309 int vp_ports_max; /* Maximum number of virtual ports per virtual 310 port trunk group. */ 311 } bcm_trunk_chip_info_t; 312 313 /* Structure describing a trunk member. */ 314 typedef struct bcm_trunk_member_s { 315 uint32 flags; /* BCM_TRUNK_MEMBER_xxx */ 316 bcm_gport_t gport; /* Trunk member GPORT ID. */ 317 int dynamic_scaling_factor; /* Dynamic load balancing threshold scaling 318 factor. */ 319 int dynamic_load_weight; /* Relative weight of historical load in 320 determining member quality. */ 321 int dynamic_queue_size_weight; /* Relative weight of queue size in 322 determining member quality. */ 323 } bcm_trunk_member_t; 324 325 /* Resilient trunk entry */ 326 typedef struct bcm_trunk_resilient_entry_s { 327 uint64 hash_key; /* Hash key. */ 328 bcm_trunk_t tid; /* Trunk. */ 329 bcm_trunk_member_t *member; /* Trunk member. */ 330 } bcm_trunk_resilient_entry_t; 331 332 /* bcm_trunk_info_t_init */ 333 extern void bcm_trunk_info_t_init( 334 bcm_trunk_info_t *trunk_info); 335 336 /* bcm_trunk_member_t_init */ 337 extern void bcm_trunk_member_t_init( 338 bcm_trunk_member_t *trunk_member); 339 340 #ifndef BCM_HIDE_DISPATCHABLE 341 342 /* Initialize the trunk module and SOC trunk hardware. */ 343 extern int bcm_trunk_init( 344 int unit); 345 346 /* Shut down (uninitialize) the trunk module. */ 347 extern int bcm_trunk_detach( 348 int unit); 349 350 /* Create the software data structure for a new trunk. */ 351 extern int bcm_trunk_create( 352 int unit, 353 uint32 flags, 354 bcm_trunk_t *tid); 355 356 /* Create VPLAG trunk with user provided VPLAG Port Id. */ 357 extern int bcm_trunk_with_vplag_create( 358 int unit, 359 uint32 flags, 360 bcm_trunk_t *tid, 361 bcm_gport_t *vplag_port_id); 362 363 /* Get VPLAG port Id for VPLAG trunk. */ 364 extern int bcm_trunk_vplag_get( 365 int unit, 366 bcm_trunk_t tid, 367 bcm_gport_t *vplag_port_id); 368 369 /* Get a trunk's Port Selection Criteria (PSC). */ 370 extern int bcm_trunk_psc_get( 371 int unit, 372 bcm_trunk_t tid, 373 int *psc); 374 375 /* Set a trunk's Port Selection Criteria (PSC). */ 376 extern int bcm_trunk_psc_set( 377 int unit, 378 bcm_trunk_t tid, 379 int psc); 380 381 /* 382 * Gets the underlying SOC device's trunk support limits, or bcmx system 383 * trunk limits. 384 */ 385 extern int bcm_trunk_chip_info_get( 386 int unit, 387 bcm_trunk_chip_info_t *ta_info); 388 389 /* Get the current parameters for the specified trunk group. */ 390 extern int bcm_trunk_get( 391 int unit, 392 bcm_trunk_t tid, 393 bcm_trunk_info_t *t_data, 394 int member_max, 395 bcm_trunk_member_t *member_array, 396 int *member_count); 397 398 /* Set member ports of a trunk group. */ 399 extern int bcm_trunk_set( 400 int unit, 401 bcm_trunk_t tid, 402 bcm_trunk_info_t *trunk_info, 403 int member_count, 404 bcm_trunk_member_t *member_array); 405 406 /* Removes a trunk group. */ 407 extern int bcm_trunk_destroy( 408 int unit, 409 bcm_trunk_t tid); 410 411 /* Expand a port bitmap to include all associated trunk member ports. */ 412 extern int bcm_trunk_bitmap_expand( 413 int unit, 414 bcm_pbmp_t *pbmp_ptr); 415 416 /* Add the specified trunk group to an existing MAC multicast entry. */ 417 extern int bcm_trunk_mcast_join( 418 int unit, 419 bcm_trunk_t tid, 420 bcm_vlan_t vid, 421 bcm_mac_t mac); 422 423 /* 424 * Retrieve the current bitmap of ports for which switching is enabled 425 * for trunking. 426 */ 427 extern int bcm_trunk_egress_get( 428 int unit, 429 bcm_trunk_t tid, 430 bcm_pbmp_t *pbmp); 431 432 /* Restrict trunk traffic only to specified trunk member ports. */ 433 extern int bcm_trunk_egress_set( 434 int unit, 435 bcm_trunk_t tid, 436 bcm_pbmp_t pbmp); 437 438 /* 439 * Retrieve the current state of trunk hashing override for unicast 440 * packets. 441 */ 442 extern int bcm_trunk_override_ucast_get( 443 int unit, 444 bcm_port_t port, 445 bcm_trunk_t tid, 446 int modid, 447 int *enable); 448 449 /* Configure the override mode of trunk hashing for unicast packets. */ 450 extern int bcm_trunk_override_ucast_set( 451 int unit, 452 bcm_port_t port, 453 bcm_trunk_t tid, 454 int modid, 455 int enable); 456 457 /* 458 * Retrieve the current state of trunk hashing override for multicast 459 * packets. 460 */ 461 extern int bcm_trunk_override_mcast_get( 462 int unit, 463 bcm_port_t port, 464 bcm_trunk_t tid, 465 int idx, 466 int *enable); 467 468 /* Configure the overriding of trunk hashing for multicast packets. */ 469 extern int bcm_trunk_override_mcast_set( 470 int unit, 471 bcm_port_t port, 472 bcm_trunk_t tid, 473 int idx, 474 int enable); 475 476 /* Retrieve the current state of trunk hashing override for IPMC packets. */ 477 extern int bcm_trunk_override_ipmc_get( 478 int unit, 479 bcm_port_t port, 480 bcm_trunk_t tid, 481 int idx, 482 int *enable); 483 484 /* Configure the overriding of trunk hashing for IPMC packets. */ 485 extern int bcm_trunk_override_ipmc_set( 486 int unit, 487 bcm_port_t port, 488 bcm_trunk_t tid, 489 int idx, 490 int enable); 491 492 /* 493 * Retrieve the current state of trunk hashing override for broadcast or 494 * unknown unicast packets. 495 */ 496 extern int bcm_trunk_override_vlan_get( 497 int unit, 498 bcm_port_t port, 499 bcm_trunk_t tid, 500 bcm_vlan_t vid, 501 int *enable); 502 503 /* 504 * Configure the overriding of trunk hashing for broadcast or unknown 505 * unicast packets. 506 */ 507 extern int bcm_trunk_override_vlan_set( 508 int unit, 509 bcm_port_t port, 510 bcm_trunk_t tid, 511 bcm_vlan_t vid, 512 int enable); 513 514 /* Retrieve the current weighted trunk hashing table. */ 515 extern int bcm_trunk_pool_get( 516 int unit, 517 bcm_port_t port, 518 bcm_trunk_t tid, 519 int *size, 520 int weights[BCM_TRUNK_MAX_PORTCNT]); 521 522 /* Configure the weighted trunk hashing table. */ 523 extern int bcm_trunk_pool_set( 524 int unit, 525 bcm_port_t port, 526 bcm_trunk_t tid, 527 int size, 528 const int weights[BCM_TRUNK_MAX_PORTCNT]); 529 530 #endif /* BCM_HIDE_DISPATCHABLE */ 531 532 /* Initialize a trunk chip information structure. */ 533 extern void bcm_trunk_chip_info_t_init( 534 bcm_trunk_chip_info_t *trunk_chip_info); 535 536 #ifndef BCM_HIDE_DISPATCHABLE 537 538 /* 539 * Get the trunk group ID for a given system port, specified by Module ID 540 * and Port number. 541 */ 542 extern int bcm_trunk_find( 543 int unit, 544 bcm_module_t modid, 545 bcm_gport_t gport, 546 bcm_trunk_t *tid); 547 548 /* Assign the failover port list for a specific trunk port. */ 549 extern int bcm_trunk_failover_set( 550 int unit, 551 bcm_trunk_t tid, 552 bcm_gport_t failport, 553 int psc, 554 uint32 flags, 555 int count, 556 bcm_gport_t *fail_to_array); 557 558 /* Retrieve the failover port list for a specific trunk port. */ 559 extern int bcm_trunk_failover_get( 560 int unit, 561 bcm_trunk_t tid, 562 bcm_gport_t failport, 563 int *psc, 564 uint32 *flags, 565 int array_size, 566 bcm_gport_t *fail_to_array, 567 int *array_count); 568 569 /* Add a member to a trunk group */ 570 extern int bcm_trunk_member_add( 571 int unit, 572 bcm_trunk_t tid, 573 bcm_trunk_member_t *member); 574 575 /* Delete a member from a trunk group */ 576 extern int bcm_trunk_member_delete( 577 int unit, 578 bcm_trunk_t tid, 579 bcm_trunk_member_t *member); 580 581 /* Delete all members from a trunk group */ 582 extern int bcm_trunk_member_delete_all( 583 int unit, 584 bcm_trunk_t tid); 585 586 #endif /* BCM_HIDE_DISPATCHABLE */ 587 588 /* bcm_trunk_resilient_traverse_cb */ 589 typedef int (*bcm_trunk_resilient_traverse_cb)( 590 int unit, 591 bcm_trunk_resilient_entry_t *entry, 592 void *user_data); 593 594 #ifndef BCM_HIDE_DISPATCHABLE 595 596 /* 597 * Traverse through the resilient trunk table and run callback at each 598 * valid entry. Possible replacement of the matched entries 599 */ 600 extern int bcm_trunk_resilient_traverse( 601 int unit, 602 uint32 flags, 603 bcm_trunk_resilient_entry_t *match_entry, 604 bcm_trunk_resilient_traverse_cb trav_fn, 605 void *user_data); 606 607 /* Replace trunk resilient entries matching given criteria */ 608 extern int bcm_trunk_resilient_replace( 609 int unit, 610 uint32 flags, 611 bcm_trunk_resilient_entry_t *match_entry, 612 int *num_entries, 613 bcm_trunk_resilient_entry_t *replace_entry); 614 615 #endif /* BCM_HIDE_DISPATCHABLE */ 616 617 #define BCM_TRUNK_DYNAMIC_MEMBER_FORCE_DOWN 0 618 #define BCM_TRUNK_DYNAMIC_MEMBER_FORCE_UP 1 619 #define BCM_TRUNK_DYNAMIC_MEMBER_HW 2 620 #define BCM_TRUNK_DYNAMIC_MEMBER_HW_DOWN 3 621 #define BCM_TRUNK_DYNAMIC_MEMBER_HW_UP 4 622 623 #ifndef BCM_HIDE_DISPATCHABLE 624 625 /* Set trunk member status */ 626 extern int bcm_trunk_member_status_set( 627 int unit, 628 bcm_gport_t member, 629 int status); 630 631 /* Get trunk member status */ 632 extern int bcm_trunk_member_status_get( 633 int unit, 634 bcm_gport_t member, 635 int *status); 636 637 /* Set Ethertype eligibility for dynamic load balancing */ 638 extern int bcm_trunk_ethertype_set( 639 int unit, 640 uint32 flags, 641 int ethertype_count, 642 int *ethertype_array); 643 644 /* Get Ethertype eligibility for dynamic load balancing */ 645 extern int bcm_trunk_ethertype_get( 646 int unit, 647 uint32 *flags, 648 int ethertype_max, 649 int *ethertype_array, 650 int *ethertype_count); 651 652 /* Attach already created AGM entry to a (fabric) trunk group. */ 653 extern int bcm_trunk_agm_attach( 654 int unit, 655 bcm_trunk_t trunk_id, 656 bcm_switch_agm_id_t agm_id); 657 658 /* Detach already created AGM entry from a (fabric) trunk group. */ 659 extern int bcm_trunk_agm_detach( 660 int unit, 661 bcm_trunk_t trunk_id, 662 bcm_switch_agm_id_t agm_id); 663 664 /* Retrieve a AGM id attached to a (fabric) trunk group. */ 665 extern int bcm_trunk_agm_attach_get( 666 int unit, 667 bcm_trunk_t trunk_id, 668 bcm_switch_agm_id_t *agm_id); 669 670 /* 671 * map a system port aggregate (SPA) to its corresponding system physical 672 * port 673 */ 674 extern int bcm_trunk_spa_to_system_phys_port_map_get( 675 int unit, 676 uint32 flags, 677 uint32 system_port_aggregate, 678 bcm_gport_t *gport); 679 680 /* Add a GPORT ID for the specified trunk */ 681 extern int bcm_trunk_gport_add( 682 int unit, 683 bcm_trunk_t tid, 684 bcm_gport_t gport); 685 686 /* Get all the GPORT ID for the specified trunk */ 687 extern int bcm_trunk_gport_get_all( 688 int unit, 689 bcm_trunk_t tid, 690 int gport_size, 691 bcm_gport_t *gport_array, 692 int *count); 693 694 /* Delete the GPORT ID for the specified trunk */ 695 extern int bcm_trunk_gport_delete( 696 int unit, 697 bcm_trunk_t tid, 698 bcm_gport_t gport); 699 700 /* Delete all the GPORT ID for the specified trunk */ 701 extern int bcm_trunk_gport_delete_all( 702 int unit, 703 bcm_trunk_t tid); 704 705 extern int bcm_trunk_pp_port_allocation_set( 706 int unit, 707 bcm_trunk_t trunk_id, 708 uint32 flags, 709 bcm_trunk_pp_port_allocation_info_t *allocation_info); 710 711 extern int bcm_trunk_pp_port_allocation_get( 712 int unit, 713 bcm_trunk_t trunk_id, 714 uint32 flags, 715 bcm_trunk_pp_port_allocation_info_t *allocation_info); 716 717 #endif /* BCM_HIDE_DISPATCHABLE */ 718 719 /* bcm_trunk_pp_port_allocation_info_t_init */ 720 extern void bcm_trunk_pp_port_allocation_info_t_init( 721 bcm_trunk_pp_port_allocation_info_t *allocation_info); 722 723 #define BCM_TRUNK_ID_SET(trunk_id, pool, group) _SHR_TRUNK_ID_SET(trunk_id, pool, group) 724 #define BCM_TRUNK_ID_POOL_GET(pool, trunk_id) _SHR_TRUNK_ID_POOL_GET(pool, trunk_id) 725 #define BCM_TRUNK_ID_GROUP_GET(group, trunk_id) _SHR_TRUNK_ID_GROUP_GET(group, trunk_id) 726 #define BCM_TRUNK_ID_IS_VALID(trunk_id) _SHR_TRUNK_ID_IS_VALID(trunk_id) 727 728 #endif /* __BCM_TRUNK_H__ */