fabric.h (108072B)
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_FABRIC_H__ 11 #define __BCM_FABRIC_H__ 12 13 #include <bcm/types.h> 14 #include <bcm/port.h> 15 #include <shared/fabric.h> 16 17 #define BCM_FABRIC_PORT_EGRESS_MULTICAST (1U<<0) 18 #define BCM_FABRIC_PORT_INGRESS_MULTICAST (1U<<1) 19 20 #ifndef BCM_HIDE_DISPATCHABLE 21 22 /* Create a fabric port on the parent physical port */ 23 extern int bcm_fabric_port_create( 24 int unit, 25 bcm_gport_t parent_port, 26 int offset, 27 uint32 flags, 28 bcm_gport_t *port); 29 30 /* Destroy a fabric port */ 31 extern int bcm_fabric_port_destroy( 32 int unit, 33 bcm_gport_t parent_port); 34 35 /* Given a child port retrieve the parent port */ 36 extern int bcm_fabric_port_get( 37 int unit, 38 bcm_gport_t child_port, 39 uint32 flags, 40 bcm_gport_t *parent_port); 41 42 #endif /* BCM_HIDE_DISPATCHABLE */ 43 44 /* bcm_fabric_control_t */ 45 typedef enum bcm_fabric_control_e { 46 bcmFabricArbiterId = 0, /* Arbiter Identifier */ 47 bcmFabricActiveArbiterId = 1, /* Active Arbiter Identifier */ 48 bcmFabricArbiterConfig = 2, /* Arbiter NULL Grant Mechanism */ 49 bcmFabricMaximumFailedLinks = 3, /* Maximum Failed Links for load shared 50 data plane redundancy mode */ 51 bcmFabricActiveId = 4, /* Retrieves actual(versus provisioned) 52 Active Arbiter Identifier */ 53 bcmFabricRedundancyMode = 5, /* Fabric Redundancy Mode */ 54 bcmFabricMode = 6, /* Fabric Mode (QE fabric, QE TME) */ 55 bcmFabricManager = 7, /* Fabric Manager Mode (XBAR only, 56 ARB/XBAR, ARB capable/XBAR) */ 57 bcmFabricMcGroupSourceKnockout = 8, /* Multicast Group Source Knockout 58 Configuration. For get operation the 59 arg parameter direction In/Out */ 60 bcmFabricEgressQueueMin = 9, /* Local QID start index */ 61 bcmFabricEgressQueueMax = 10, /* Local QID end index */ 62 bcmFabricQueueMin = 11, /* FIC QID start index */ 63 bcmFabricQueueMax = 12, /* FIC QID end index */ 64 bcmFabricArbitrationMapFabric = 13, /* Arbitration Map for Fabric Queues */ 65 bcmFabricArbitrationMapSubscriber = 14, /* Arbitration Map for Subscriber Queues */ 66 bcmFabricArbitrationMapHierarchicalSubscriber = 15, /* Arbitration Map for higher level 67 schedulers/scheduling nodes */ 68 bcmFabricSubscriberCosLevels = 16, /* Maximum COS levels for subscriber 69 queues */ 70 bcmFabricSubscriberCosLevelAllocation = 17, /* Internal COS allocation for 71 subscriber queues */ 72 bcmFabricShaperQueueMin = 18, /* FIC QID start shaping index */ 73 bcmFabricShaperQueueMax = 19, /* FIC QID end shaping index */ 74 bcmFabricShaperQueueIncrement = 20, /* FIC QID shaping increment. 1 75 indicates shaping can be configured 76 on every queue, 4 indicates shaping 77 can be configured on every 4th queue, 78 0 indicates shaping on entire queue 79 group */ 80 bcmFabricShaperEgressQueueMin = 21, /* Local QID start shaping index */ 81 bcmFabricShaperEgressQueueMax = 22, /* Local QID end shaping index */ 82 bcmFabricShaperEgressQueueIncrement = 23, /* Local QID shaping increment. 1 83 indicates shaping can be configured 84 on every queue, 4 indicates shaping 85 can be configured on every 4th queue, 86 0 indicates shaping on entire queue 87 group */ 88 bcmFabricMulticastQueueMin = 24, /* Multicast QID start index */ 89 bcmFabricMulticastQueueMax = 25, /* Multicast QID end index */ 90 bcmFabricRecycleQueueMin = 26, /* Recycle QID start index */ 91 bcmFabricRecycleQueueMax = 27, /* Recycle QID end index */ 92 bcmFabricWatchdogQueueMin = 28, /* Watchdog QID start index */ 93 bcmFabricWatchdogQueueMax = 29, /* Watchdog QID end index */ 94 bcmFabricWatchdogQueueEnable = 30, /* Queue Watchdog Functionality 95 Enable/Disable setting (True/False) */ 96 bcmFabricTrafficManagementCosMode = 31, /* traffic management cos mode. Only 97 retreiving this configuration is 98 supported */ 99 bcmFabricCellSizeFixed = 32, /* fixed cell size configuration. TRUE 100 => fixed cell size, FALSE => variable 101 cell size */ 102 bcmFabricCellSizeMin = 33, /* minimum cell size configuration. 103 Configuration units are in bytes */ 104 bcmFabricCellSizeMax = 34, /* maximum cell size configuration. 105 Configuration units are in bytes */ 106 bcmFabricCreditSize = 35, /* credit worth size. Configuration 107 units are in bytes */ 108 bcmFabricCreditSizeRemoteDefault = 36, /* Default remote credit size */ 109 bcmFabricVsqCategory = 37, /* VSQ Catagory Mode */ 110 bcmFabricMulticastSchedulerMode = 38, /* 0 => Trafic Class only mode, 1 => 111 {Traffic class, group} mode */ 112 bcmFabricMcLowPrioMin = 39, /* Start index of low priority multicast 113 groups */ 114 bcmFabricMcLowPrioMax = 40, /* End index of low priority multicast 115 groups */ 116 bcmFabricMcMidPrioMin = 41, /* Start index of medium priority 117 multicast groups */ 118 bcmFabricMcMidPrioMax = 42, /* End index of medium priority 119 multicast groups */ 120 bcmFabricEnableMcLowPrioDrop = 43, /* Enable dropping low priority 121 mulicast */ 122 bcmFabricMcLowPrioDropThUp = 44, /* Dropping low priority multicast high 123 threshold */ 124 bcmFabricMcLowPrioDropThDown = 45, /* Dropping low priority multicast low 125 threshold */ 126 bcmFabricMcLowPrioDropSelect = 46, /* Select the highet priority to be 127 treated as low */ 128 bcmFabricTsApplicationHierachySetup = 47, /* Application manage ingress node 129 resources. 1 indicates application 130 manage, 0 indicate SDK auto manage */ 131 bcmFabricMaxPorts = 48, /* Maximum fabric ports to be supported 132 by SDK */ 133 bcmFabricEgressDropLimitBytes = 49, /* Total system-wide buffer drop limit */ 134 bcmFabricEgressRedDropLimitBytes = 50, /* Total system-wide Red drop limit */ 135 bcmFabricEgressYellowDropLimitBytes = 51, /* Total system-wide Yellow drop limit */ 136 bcmFabricDemandCalculationEnable = 52, /* Enable the demand calculation (on QE) */ 137 bcmFabricOperatingIntervalEnable = 53, /* Enable the start of epoch/operating 138 interval (on standby arbiter) */ 139 bcmFabricIngressLevel1NumSchedulers = 54, /* Number of ingress schedulers on level 140 1 */ 141 bcmFabricIngressLevel2NumSchedulers = 55, /* Number of ingress schedulers on level 142 2 */ 143 bcmFabricIngressLevel3NumSchedulers = 56, /* Number of ingress schedulers on level 144 3 */ 145 bcmFabricIngressLevel4NumSchedulers = 57, /* Number of ingress schedulers on level 146 4 */ 147 bcmFabricIngressLevel5NumSchedulers = 58, /* Number of ingress schedulers on level 148 5 */ 149 bcmFabricIngressLevel6NumSchedulers = 59, /* Number of ingress schedulers on level 150 6 */ 151 bcmFabricIngressLevel7NumSchedulers = 60, /* Number of ingress schedulers on level 152 7 */ 153 bcmFabricIngressLevel1SchedulerUpdateCycles = 61, /* Ingress scheduler update cycles on 154 level 1 */ 155 bcmFabricIngressLevel2SchedulerUpdateCycles = 62, /* Ingress scheduler update cycles on 156 level 2 */ 157 bcmFabricIngressLevel3SchedulerUpdateCycles = 63, /* Ingress scheduler update cycles on 158 level 3 */ 159 bcmFabricIngressLevel4SchedulerUpdateCycles = 64, /* Ingress scheduler update cycles on 160 level 4 */ 161 bcmFabricIngressLevel5SchedulerUpdateCycles = 65, /* Ingress scheduler update cycles on 162 level 5 */ 163 bcmFabricIngressLevel6SchedulerUpdateCycles = 66, /* Ingress scheduler update cycles on 164 level 6 */ 165 bcmFabricIngressLevel7SchedulerUpdateCycles = 67, /* Ingress scheduler update cycles on 166 level 7 */ 167 bcmFabricIsolate = 68, /* ArgValue: 1: Isolate the fabric 168 element from the system 0: Undo the 169 Isolation action */ 170 bcmFabricRCIControlSource = 69, /* In Dual switch mode on links that 171 emit 128B cells, it determines the 172 sources for RCI bits. Whether from 173 the Primary queue, from the Secondary 174 queue, the OR of both, or none */ 175 bcmFabricGCIControlSource = 70, /* In Dual switch mode on links that 176 emit 128B cells, it determines the 177 source for GCI bits. Whether from the 178 Primary queue, from the Secondary 179 queue, the MAX of both, or none */ 180 bcmFabricControlECNEnable = 71, /* Enable the support of ECN */ 181 bcmFabricOcbMulticastId1Min = 72, /* define the 1st Multicast range 182 minimum. If the Multicast Packet is 183 in this range, the start-of-packet is 184 offloaded to the OCB (On-Chip Buffer) */ 185 bcmFabricOcbMulticastId1Max = 73, /* define the 1st Multicast range 186 maximum */ 187 bcmFabricOcbMulticastId2Min = 74, /* define the 2nd Multicast range 188 minimum. */ 189 bcmFabricOcbMulticastId2Max = 75, /* define the 2nd Multicast range 190 maximum */ 191 bcmFabricShutdown = 76, /* performs graceful shutdown of the 192 device */ 193 bcmFabricRCIIncrementValue = 77, /* The value that will be added to RCI 194 bucket whenever a cell carrying RCI 195 indication arrives */ 196 bcmFabricGciLeakyBucketEnable = 78, /* Enable/Disable GCI leaky bucket 197 mechanism */ 198 bcmFabricGciBackoffEnable = 79, /* Enable/Disable GCI random backoff 199 mechanism */ 200 bcmFabricMinimalLinksToDestination = 80, /* Define minimum number of links to 201 destination */ 202 bcmFabricControlCellsEnable = 81, /* Enable/Disable fabric control cells */ 203 bcmFabricForceTdmBypassTrafficToFabric = 82, /* Force TDM bypass traffic to fabric or 204 not */ 205 bcmFabricControlRciThrottlingMode = 83, /* Used to set RCI Throttling mode, see */ 206 bcmFabricDelaySingleCellInFabricRx = 84, /* Enable/Disable delay of single cell 207 in fabric rx, to improve bus 208 utilization */ 209 bcmFabricControlDirectMcModidOffset = 85, /* The offset from which the modids of 210 the FAPs connected to the FE start. 211 Relevant for direct multicast mode 212 only */ 213 bcmFabricLocalRouteControlCellsEnable = 86 /* Enable/disable FE1 control traffic 214 directly to FAPs without going 215 through FE2 */ 216 } bcm_fabric_control_t; 217 218 /* bcm_fabric_mode_t */ 219 typedef enum bcm_fabric_mode_e { 220 bcmFabricModeTME = 0, /* QE Standalone/TME */ 221 bcmFabricModeFabric = 1, /* QE Uses external fabric device */ 222 bcmFabricModeArbiterCrossbar = 2, /* BM configured as both and arbiter and 223 a crossbar */ 224 bcmFabricModeCrossbar = 3, /* BM configured as a crossbar without 225 arbiter functionality */ 226 bcmFabricModeArbiterCapableCrossbar = 4 /* BM configured as xbar without arbiter 227 functionality, but capable of to 228 switching arbiter */ 229 } bcm_fabric_mode_t; 230 231 typedef enum bcm_fabric_pipe_e { 232 bcmFabricPipe0 = 0, /* pipe 0 */ 233 bcmFabricPipe1 = 1, /* pipe 1 */ 234 bcmFabricPipe2 = 2, /* pipe 2 */ 235 bcmFabricPipeAll = -1 /* all pipes */ 236 } bcm_fabric_pipe_t; 237 238 /* bcm_fabric_connection_mode_t */ 239 typedef enum bcm_fabric_connection_mode_e { 240 bcmFabricXbarConnectionModeA = 1, /* Plane A */ 241 bcmFabricXbarConnectionModeB = 2, /* Plane B */ 242 bcmFabricXbarConnectionModeC = 3 /* Worst Case Plane A/Plane B */ 243 } bcm_fabric_connection_mode_t; 244 245 typedef enum bcm_fabric_level_e { 246 bcmFabricLevelAll = -1, /* all levels */ 247 bcmFabricLevel0 = 0, /* level 0 */ 248 bcmFabricLevel1 = 1, /* level 1 */ 249 bcmFabricLevel2 = 2, /* level 2 */ 250 bcmFabricLevel3 = 3, /* level 3 */ 251 bcmFabricLevel4 = 4, /* level 4 */ 252 bcmFabricLevel5 = 5, /* level 5 */ 253 bcmFabricLevel6 = 6, /* level 6 */ 254 bcmFabricLevelNof = 7 255 } bcm_fabric_level_t; 256 257 typedef enum bcm_fabric_leaky_bucket_e { 258 bcmFabricLeakyBucketAll = -1, /* all Leaky Buckets */ 259 bcmFabricLeakyBucket0 = 0, /* Leaky Bucket 0 */ 260 bcmFabricLeakyBucket1 = 1, /* Leaky Bucket 1 */ 261 bcmFabricLeakyBucket2 = 2, /* Leaky Bucket 2 */ 262 bcmFabricLeakyBucket3 = 3, /* Leaky Bucket 3 */ 263 bcmFabricLeakyBucketNof = 4 264 } bcm_fabric_leaky_bucket_t; 265 266 typedef enum bcm_fabric_backoff_timer_e { 267 bcmFabricBackoffTimerAll = -1, /* all Backoff timers */ 268 bcmFabricBackoffTimer0 = 0, /* Backoff timer 0 */ 269 bcmFabricBackoffTimer1 = 1, /* Backoff timer 1 */ 270 bcmFabricBackoffTimer2 = 2, /* Backoff timer 2 */ 271 bcmFabricBackoffTimerNof = 3 272 } bcm_fabric_backoff_timer_t; 273 274 typedef enum bcm_fabric_phase_e { 275 bcmFabricPhaseAll = -1, /* all Phases */ 276 bcmFabricPhase0 = 0, /* Phase 0 */ 277 bcmFabricPhase1 = 1, /* Phase 1 */ 278 bcmFabricPhaseNof = 2 279 } bcm_fabric_phase_t; 280 281 typedef enum bcm_fabric_mc_shaper_e { 282 bcmFabricMcShaperAll = -1, /* all FMC shapers */ 283 bcmFabricMcShaperGfmc = 0, /* FMC-HP Shaper */ 284 bcmFabricMcShaperBfmc = 1, /* FMC-LP Shaper */ 285 bcmFabricMcShaperTotalFmc = 2, /* FMC-Total shaper */ 286 bcmFabricMcShaperNof = 3 287 } bcm_fabric_mc_shaper_t; 288 289 typedef enum bcm_fabric_cast_e { 290 bcmFabricCastAll = -1, /* all casts */ 291 bcmFabricCastUC = 0, /* Unicast */ 292 bcmFabricCastMC = 1, /* Multicast */ 293 bcmFabricCastNof = 2 294 } bcm_fabric_cast_t; 295 296 typedef enum bcm_fabric_priority_e { 297 bcmFabricPriorityAll = -1, /* All priorities */ 298 bcmFabricPriority0 = 0, /* Priority 0 */ 299 bcmFabricPriority1 = 1, /* Priority 1 */ 300 bcmFabricPriority2 = 2, /* Priority 2 */ 301 bcmFabricPriority3 = 3, /* Priority 3 */ 302 bcmFabricPriorityNof = 4 303 } bcm_fabric_priority_t; 304 305 /* BCM_FABRIC_XBAR_ABILITY_ flags */ 306 #define BCM_FABRIC_XBAR_ABILITY_PROTOCOL_A 1 /* Plane A */ 307 #define BCM_FABRIC_XBAR_ABILITY_PROTOCOL_B 2 /* Plane B */ 308 #define BCM_FABRIC_XBAR_ABILITY_PROTOCOL_C 3 /* Worst Case Plane 309 A/Plane B */ 310 311 /* bcm_fabric_redundancy_mode_t */ 312 typedef enum bcm_fabric_redundancy_mode_e { 313 bcmFabricRedManual = 0, /* Manual Mode */ 314 bcmFabricRed1Plus1Both = 1, /* 1+1 Control Plane and 1+1 Data Plane */ 315 bcmFabricRed1Plus1LS = 2, /* 1+1 Control Plane and Load Sharing Data Plane */ 316 bcmFabricRed1Plus1ELS = 3, /* 1+1 Control Planeand Enhanced Load Sharing 317 Data Plane */ 318 bcmFabricRedLS = 4, /* Load Sharing Data Plane */ 319 bcmFabricRedELS = 5 /* Enhanced Load Sharing Data Plane */ 320 } bcm_fabric_redundancy_mode_t; 321 322 /* fabric_traffic_management_cos_mode_t */ 323 typedef enum bcm_fabric_traffic_management_cos_mode_e { 324 bcmFabricTrafficManagementCosModeSimple = 0, /* Simple Mode. Hierarchy setup by SDK */ 325 bcmFabricTrafficManagementCosModeFlexible = 1, /* Flexible Mode. Hierarchy setup by 326 application */ 327 bcmFabricTrafficManagementCosModeHybrid = 2 /* Hybrid Mode. Hierarchy setup by SDK 328 and application can add to it */ 329 } bcm_fabric_traffic_management_cos_mode_t; 330 331 /* vsq catagory modes */ 332 typedef enum bcm_fabric_vsq_category_mode_e { 333 bcmFabricVsqCatagoryModeNone = 0, /* None. By default, all queues are 334 assigned to category 2 */ 335 bcmFabricVsqCatagoryMode1 = 1, /* Category 0: Spatial Multicast 336 Queues, Category 1: Ingress Shaping 337 Queues, Category 2: VoQ destination 338 based queues, Category 3: Egress TM 339 queues */ 340 bcmFabricVsqCatagoryMode2 = 2 /* Category 2: Unicast Queues, Category 341 0: all other queues */ 342 } bcm_fabric_vsq_category_mode_t; 343 344 /* Information passed back during callback of redundancy state change */ 345 typedef struct bcm_fabric_control_redundancy_info_s { 346 int active_arbiter_id; /* Active Arbiter Identifier. */ 347 uint64 xbars; /* xbar links that are being used. */ 348 } bcm_fabric_control_redundancy_info_t; 349 350 /* BCM_FABRIC_DISTRIBUTION_* flags. */ 351 #define BCM_FABRIC_DISTRIBUTION_WITH_ID 0x00000001 /* flag to create 352 distributionId that is 353 passed */ 354 355 /* Reference bcm_fabric_control_t, bcmFabricMcGroupSourceKnockout type. */ 356 #define BCM_FABRIC_MC_GROUP_SOURCE_KNOCKOUT_ENABLE 0x40000000 /* Indicates if source 357 knockout is enabled on 358 a multicast group */ 359 #define BCM_FABRIC_MC_GROUP_MASK 0x3FFFFFFF /* multicast group mask */ 360 361 /* 362 * Allows more specific control in bcm_fabric_packet_adjust_get/set. 363 * With neither flag, get will fetch the ingress (or egress if the chip 364 * does not support ingress) value, and set will set both values (of 365 * whichever the chip supports if it supports only one). ORing the 366 * INGRESS flag with the selector ID will cause ingress to be set or 367 * read. ORing the EGRESS flag with the selector will cause egress to be 368 * set or read. ORing both INGRESS and EGRESS flags with the selector ID 369 * will specifically set both, but is not valid for get. The GLOBAL flag 370 * indicates that the global adjust value (can be combined with ingress 371 * and egress as appropriate to the device) is to be accessed, rather 372 * than one of the indexed adjust values. 373 */ 374 #define BCM_FABRIC_PACKET_ADJUST_INGRESS 0x40000000 375 #define BCM_FABRIC_PACKET_ADJUST_EGRESS 0x20000000 376 #define BCM_FABRIC_PACKET_ADJUST_GLOBAL 0x10000000 377 #define BCM_FABRIC_PACKET_ADJUST_SELECTOR_MASK 0x0FFFFFFF 378 379 #ifndef BCM_HIDE_DISPATCHABLE 380 381 /* Initialize the BCM Fabric subsystem. */ 382 extern int bcm_fabric_init( 383 int unit); 384 385 /* Set fabric control attributes. */ 386 extern int bcm_fabric_control_set( 387 int unit, 388 bcm_fabric_control_t type, 389 int arg); 390 391 /* Set fabric control attributes. */ 392 extern int bcm_fabric_control_get( 393 int unit, 394 bcm_fabric_control_t type, 395 int *arg); 396 397 #endif /* BCM_HIDE_DISPATCHABLE */ 398 399 #define BCM_FABRIC_DISTRIBUTION_SCHED_ALL 0x00000000 400 #define BCM_FABRIC_DISTRIBUTION_SCHED_ANY 0x00000001 401 402 /* Multicast Fabric distribution feature control. */ 403 typedef enum bcm_fabric_distribution_control_e { 404 bcmFabricDistributionSched = 0 /* Multicast fabric forwarding - all nodes 405 must be available or any. */ 406 } bcm_fabric_distribution_control_t; 407 408 /* Specifies the bit position and length of a field in packets */ 409 typedef struct bcm_fabric_action_field_s { 410 uint16 offset; /* Bit offset of field in a packet */ 411 uint16 length; /* Bit length of field in a packet */ 412 } bcm_fabric_action_field_t; 413 414 /* Specifies where the predicate obtains its information for comparison */ 415 typedef enum bcm_fabric_predicate_type_e { 416 bcmFabricPredicateTypePacket = 0, /* Predicate is based upon packet 417 contents (field indicates which bits) */ 418 bcmFabricPredicateTypeInterface = 1, /* Predicate is based upon 'interface' 419 metadatum (field is ignored) */ 420 bcmFabricPredicateTypeSysport = 2, /* Predicate is based upon 'sysport' 421 metadatum (field is ignored) */ 422 bcmFabricPredicateTypeChannel = 3, /* Predicate is based upon 'channel' 423 metadatum (field is ignored) */ 424 bcmFabricPredicateTypeFifo = 4, /* Predicate is based upon 'fifo' 425 metadatum (field is ignored) */ 426 bcmFabricPredicateTypeSubport = 5, /* Predicate is based upon 'subport' 427 metadatum (field is ignored) */ 428 bcmFabricPredicateTypePacketClass = 6, /* Predicate is based upon 'packet 429 class' metadatum (field is ignored) */ 430 bcmFabricPredicateTypeFlags = 7 /* Predicate is based upon 'packet 431 flags' metadata (field is ignored) */ 432 } bcm_fabric_predicate_type_t; 433 434 #define BCM_FABRIC_PREDICATE_INFO_INGRESS 0x00000001 /* Predicate will be used 435 for ingress path 436 packets */ 437 #define BCM_FABRIC_PREDICATE_INFO_EGRESS 0x00000002 /* Predicate will be used 438 for egress path 439 packets */ 440 #define BCM_FABRIC_PREDICATE_INFO_WITH_ID 0x00000004 /* Predicate needs to be 441 created/replaced with 442 a specific ID */ 443 #define BCM_FABRIC_PREDICATE_INFO_REPLACE 0x00000008 /* Predicate needs to be 444 replaced instead of 445 created */ 446 #define BCM_FABRIC_PREDICATE_INFO_RANGE 0x00000010 /* Predicate comparison 447 is range instead of 448 equality-under-mask */ 449 450 typedef struct bcm_fabric_predicate_info_s { 451 uint32 flags; /* Flags controlling the creation and 452 the operation of the parser */ 453 bcm_fabric_predicate_type_t source; /* Indicates from where the predicate 454 will draw its comparison data */ 455 bcm_fabric_action_field_t field; /* Indicates the bit field location in 456 packets for packet type predicates; 457 is ignored for metadata type 458 predicates */ 459 uint32 data; /* Compare data for equality-under-mask 460 comparisons (ignored for range) */ 461 uint32 mask; /* Masking value used for 462 equality-under-mask comparisons 463 (ignored for range) */ 464 uint32 range_low; /* Lowest included value for range 465 comparisons (ignored for non-range) */ 466 uint32 range_high; /* Highest included value for range 467 comparisons (ignored for non-range) */ 468 } bcm_fabric_predicate_info_t; 469 470 /* Fabric predicate ID */ 471 typedef int bcm_fabric_predicate_t; 472 473 /* Callback used by bcm_fabric_predicate_traverse */ 474 typedef int (*bcm_fabric_predicate_traverse_cb)( 475 int unit, 476 bcm_fabric_predicate_t pred_id, 477 bcm_fabric_predicate_info_t *pred_info, 478 void *user_data); 479 480 /* Initialize a bcm_fabric_predicate_info_t to a 'safe' default value. */ 481 extern void bcm_fabric_predicate_info_t_init( 482 int unit, 483 bcm_fabric_predicate_info_t *pred_info); 484 485 #ifndef BCM_HIDE_DISPATCHABLE 486 487 /* Creates or replaces a fabric predicate */ 488 extern int bcm_fabric_predicate_create( 489 int unit, 490 bcm_fabric_predicate_info_t *pred_info, 491 bcm_fabric_predicate_t *pred_id); 492 493 /* Destroys a fabric predicate */ 494 extern int bcm_fabric_predicate_destroy( 495 int unit, 496 bcm_fabric_predicate_t pred_id); 497 498 /* Destroys all fabric predicates on a unit */ 499 extern int bcm_fabric_predicate_destroy_all( 500 int unit); 501 502 /* Gets a fabric predicate */ 503 extern int bcm_fabric_predicate_get( 504 int unit, 505 bcm_fabric_predicate_t pred_id, 506 bcm_fabric_predicate_info_t *pred_info); 507 508 /* Traverse all of the fabric predicates */ 509 extern int bcm_fabric_predicate_traverse( 510 int unit, 511 bcm_fabric_predicate_traverse_cb cb, 512 void *user_data); 513 514 #endif /* BCM_HIDE_DISPATCHABLE */ 515 516 /* Indicates source for queue index. */ 517 typedef enum bcm_fabric_action_queue_idx_from_e { 518 bcmFabricActionQueueIdxFromPacket = 0, /* Take queue index from queue field of 519 packet */ 520 bcmFabricActionQueueIdxFromReplicantId = 1, /* Take queue index from multicast 521 replicant ID */ 522 bcmFabricActionQueueIdxFromReplicantLookup = 2 /* Take queue index from result of 523 multicast replicant lookup */ 524 } bcm_fabric_action_queue_idx_from_t; 525 526 /* Indicates source data (and size) selection for insert action */ 527 typedef enum bcm_fabric_action_insert_e { 528 bcmFabricActionInsertRepId16 = 0, /* Insert 16-bit replicant ID from 529 multicast path */ 530 bcmFabricActionInsertRepId18 = 1, /* Insert 18-bit replicant ID from 531 multicast path, overwriting low two 532 bits of prior byte */ 533 bcmFabricActionInsertEncapId16 = 2, /* Insert 16-bit encapId from primary 534 lookup (based upon replicant ID) */ 535 bcmFabricActionInsertEncapId18 = 3, /* Insert 18-bit encapId from primary 536 lookup (based upon replicant ID), 537 overwriting low two bits of prior 538 byte */ 539 bcmFabricActionInsertQueueIndex16 = 4, /* Insert 16-bit queue index pulled from 540 packet by action */ 541 bcmFabricActionInsertQueueIndex18 = 5, /* Insert 18-bit queue index pulled from 542 packet by action, overwriting low two 543 bits of prior byte */ 544 bcmFabricActionInsertQueueId16 = 6, /* Insert 16-bit queue ID from secondary 545 lookup (based upon queue index pulled 546 from packet by action) */ 547 bcmFabricActionInsertQueueId18 = 7 /* Insert 18-bit queue ID from secondary 548 lookup (based upon queue index pulled 549 from packet by action), overwriting 550 low two bits of prior byte */ 551 } bcm_fabric_action_insert_t; 552 553 #define BCM_FABRIC_ACTION_INFO_INGRESS 0x00000001 /* Action will be used 554 for ingress path 555 packets */ 556 #define BCM_FABRIC_ACTION_INFO_EGRESS 0x00000002 /* Action will be used 557 for egress path 558 packets */ 559 #define BCM_FABRIC_ACTION_INFO_WITH_ID 0x00000004 /* Action needs to be 560 created/replaced with 561 a specific ID */ 562 #define BCM_FABRIC_ACTION_INFO_REPLACE 0x00000008 /* Action needs to be 563 replaced instead of 564 created */ 565 #define BCM_FABRIC_ACTION_INFO_QUEUE_DEFAULT 0x00000010 /* Use global default 566 queue instead of 567 deriving one from the 568 packet */ 569 #define BCM_FABRIC_ACTION_INFO_USE_TAG_OFFSET 0x00000020 /* Include HGX extension 570 queue tag in queue 571 selection process */ 572 #define BCM_FABRIC_ACTION_INFO_OVERWRITE_DEST 0x00000040 /* Overwrite packet 573 destination with 574 selected queue */ 575 #define BCM_FABRIC_ACTION_INFO_LENGTH_ADJUST 0x00000080 /* Use packet len_adj_idx 576 to select length 577 adjustment */ 578 #define BCM_FABRIC_ACTION_INFO_CLEAR_TEST_BIT 0x00000100 /* Clear the 'test' bit 579 in the packet header */ 580 #define BCM_FABRIC_ACTION_INFO_LOOKUP_ENCAPID 0x00000200 /* Lookup encapId from 581 multicast replicantId */ 582 #define BCM_FABRIC_ACTION_INFO_CLEAR_MC_BIT 0x00000400 /* Clear the 'multicast' 583 bit in the packet 584 header */ 585 #define BCM_FABRIC_ACTION_INFO_LEN_ADJ_ON_SHAPING 0x00000800 /* Apply length 586 adjustment to the data 587 sent to shaping */ 588 #define BCM_FABRIC_ACTION_INFO_LOOKUP_QUEUEID 0x00001000 /* Lookup queueId from 589 the queue index */ 590 #define BCM_FABRIC_ACTION_INFO_XGS_MODE 0x00002000 /* Overwrite packet 591 header destination 592 field according to the 593 FIFO into which the 594 packet is placed */ 595 #define BCM_FABRIC_ACTION_INFO_STAT0_ADJ_PER_PACKET 0x00004000 /* Adjust stat 0 per 596 frame */ 597 #define BCM_FABRIC_ACTION_INFO_STAT1_ADJ_PER_PACKET 0x00008000 /* Adjust stat 1 per 598 frame */ 599 #define BCM_FABRIC_ACTION_INFO_STAT_COMBINE 0x00010000 /* Combine stat 0 and 1 600 so stat 0 is low bits 601 and stat 1 is high 602 bits */ 603 604 /* Fabric action ID */ 605 typedef int bcm_fabric_action_t; 606 607 /* Fabric qsel ID */ 608 typedef int bcm_fabric_qsel_t; 609 610 /* Fabric qsel_offset ID */ 611 typedef int bcm_fabric_qsel_offset_t; 612 613 /* Fabric statistics segment ID */ 614 typedef int bcm_fabric_stats_segment_t; 615 616 /* Specifies the bit position and length of a field in packets */ 617 typedef struct bcm_fabric_action_info_s { 618 uint32 flags; /* Flags controlling the creation and 619 operation of the action */ 620 bcm_fabric_action_field_t queue_field_low; /* Selects bits from packet to be used 621 for low bits of queue index */ 622 bcm_fabric_action_field_t queue_field_high; /* Selects bits from packet to be used 623 for high bits of queue index */ 624 bcm_fabric_action_field_t qsel_offset_index_field; /* Selects bits from packet to be used 625 for qsel_offset index */ 626 int override_dp; /* Override value for packet drop 627 precedence; set -1 to use value from 628 packet */ 629 int override_ecn; /* Override value for packet ECN bits; 630 set -1 to use value from packet */ 631 bcm_fabric_action_field_t len_adj_index_field; /* Selects bits from packet to be used 632 for len_adj index */ 633 bcm_fabric_action_queue_idx_from_t queue_id_source; /* Selects whether to draw initial queue 634 index from packet or multicast path */ 635 uint32 queue_index_offset; /* Offset to apply to queue index during 636 lookup of queue_id */ 637 bcm_fabric_qsel_t qsel; /* Specifies the qsel that is to be used 638 for queue lookup; if this is zero, 639 the queue lookup is not performed and 640 qsel_offset will be chosen according 641 to the qsel_offset field rather than 642 read during the lookup */ 643 bcm_fabric_qsel_offset_t qsel_offset; /* Specifies the qsel_offset to use if 644 qsel is zero */ 645 bcm_fabric_action_field_t encap_id_field; /* Which bits in the packet to overwrite 646 with the encap_id */ 647 bcm_fabric_action_field_t queue_id_field; /* Which bits in the packet to overwrite 648 with the queue_id */ 649 int clear_ehv_bit; /* Which bit to clear for extended 650 header valid bit clear; use -1 to 651 inhibit */ 652 int clear_mp_bit; /* Which bit to clear for header MP bit 653 clear; use -1 to inhibit */ 654 int four_byte_remove_offset; /* Specifies the bit offset of a four 655 byte block to remove from the packet; 656 -1 indicates no removal */ 657 int header_bytes_remove; /* Specifies a number of bytes to remove 658 from the front of the packet; 0 659 indicates no removal */ 660 bcm_fabric_action_insert_t insert_dest_select; /* Specifies the source (and size) of 661 the insertion that will be done by an 662 interface that is configured to 663 perform a header insertion; the 664 configuration of each interface 665 determines whether the insertion is 666 actually performed for packets on 667 that interface */ 668 bcm_fabric_stats_segment_t stat0_segment; /* The statistics segment used for stat0 */ 669 bcm_fabric_predicate_type_t stat0_field_low_type; /* Indicate source of stat0 low bits */ 670 bcm_fabric_action_field_t stat0_field_low; /* Which bits from the packet select the 671 low bits of stat0 */ 672 bcm_fabric_predicate_type_t stat0_field_high_type; /* Indicates source of stat0 high bits */ 673 bcm_fabric_action_field_t stat0_field_high; /* Which bits from the packet select the 674 high bits of stat0 */ 675 int stat0_adjust; /* Adjustment applied to value for stat0 676 during statistics update */ 677 bcm_fabric_stats_segment_t stat1_segment; /* The statistics segment used for stat0 */ 678 bcm_fabric_predicate_type_t stat1_field_low_type; /* Indicates source of stat1 low bits */ 679 bcm_fabric_action_field_t stat1_field_low; /* Which bits from the packet select the 680 low bits of stat1 */ 681 bcm_fabric_predicate_type_t stat1_field_high_type; /* Indicates source of stat1 high bits */ 682 bcm_fabric_action_field_t stat1_field_high; /* Which bits from the packet select the 683 high bits of stat1 */ 684 int stat1_adjust; /* Adjustment applied to value for stat1 685 during statistics update */ 686 } bcm_fabric_action_info_t; 687 688 /* Callback used by bcm_fabric_action_traverse */ 689 typedef int (*bcm_fabric_action_traverse_cb)( 690 int unit, 691 bcm_fabric_action_t action_id, 692 bcm_fabric_action_info_t *action_info, 693 void *user_data); 694 695 /* Set default values to a bcm_fabric_action_info_t. */ 696 extern void bcm_fabric_action_info_t_init( 697 int unit, 698 bcm_fabric_action_info_t *action_info); 699 700 #ifndef BCM_HIDE_DISPATCHABLE 701 702 /* Create or replace a fabric action */ 703 extern int bcm_fabric_action_create( 704 int unit, 705 bcm_fabric_action_info_t *action_info, 706 bcm_fabric_action_t *action_id); 707 708 /* Destroy a fabric action */ 709 extern int bcm_fabric_action_destroy( 710 int unit, 711 bcm_fabric_action_t action_id); 712 713 /* Destroy all fabric actions on a unit */ 714 extern int bcm_fabric_action_destroy_all( 715 int unit); 716 717 /* Get information about an action */ 718 extern int bcm_fabric_action_get( 719 int unit, 720 bcm_fabric_action_t action_id, 721 bcm_fabric_action_info_t *action_info); 722 723 /* Traverse all of the fabric actions on a unit */ 724 extern int bcm_fabric_action_traverse( 725 int unit, 726 bcm_fabric_action_traverse_cb cb, 727 void *user_data); 728 729 #endif /* BCM_HIDE_DISPATCHABLE */ 730 731 #define BCM_FABRIC_PREDICATE_ACTION_INFO_INGRESS 0x00000001 /* Predicate will be used 732 for ingress path 733 packets */ 734 #define BCM_FABRIC_PREDICATE_ACTION_INFO_EGRESS 0x00000002 /* Predicate will be used 735 for egress path 736 packets */ 737 #define BCM_FABRIC_PREDICATE_ACTION_INFO_WITH_ID 0x00000004 /* Predicate needs to be 738 created/replaced with 739 a specific ID */ 740 #define BCM_FABRIC_PREDICATE_ACTION_INFO_REPLACE 0x00000008 /* Predicate needs to be 741 replaced instead of 742 created */ 743 744 #define BCM_FABRIC_PREDICATE_COUNT 32 /* Maximum number of supported 745 fabric predicates */ 746 747 /* 748 * Used to specify mask and data for predicates when connecting them to 749 * actions 750 */ 751 typedef SHR_BITDCL bcm_fabric_predicate_vector_t[_SHR_BITDCLSIZE(BCM_FABRIC_PREDICATE_COUNT)]; 752 753 #define BCM_FABRIC_PREDICATE_VECTOR_GET(_vec, _n) SHR_BITGET((_vec), (_n)) 754 #define BCM_FABRIC_PREDICATE_VECTOR_SET(_vec, _n) SHR_BITSET((_vec), (_n)) 755 #define BCM_FABRIC_PREDICATE_VECTOR_CLR(_vec, _n) SHR_BITCLR((_vec), (_n)) 756 757 /* Fabric predicate action ID */ 758 typedef int bcm_fabric_predicate_action_t; 759 760 typedef struct bcm_fabric_predicate_action_info_s { 761 uint32 flags; /* Flags indicating how this 762 predicate_action is to be 763 created/replaced */ 764 int priority; /* The priority for this 765 predicate_action */ 766 bcm_fabric_predicate_vector_t data; /* The value of the predicate vector for 767 this predicate_action */ 768 bcm_fabric_predicate_vector_t mask; /* Indicates which predicates are 769 significant in the data field */ 770 bcm_fabric_action_t action_id; /* Specifies the action to be taken when 771 the specified predicate condition is 772 met */ 773 } bcm_fabric_predicate_action_info_t; 774 775 /* Callback used by bcm_fabric_predicate_action_traverse */ 776 typedef int (*bcm_fabric_predicate_action_traverse_cb)( 777 int unit, 778 bcm_fabric_predicate_action_t predicate_action_id, 779 bcm_fabric_predicate_action_info_t *predicate_action_info, 780 void *user_data); 781 782 /* Set up default values for a bcm_fabric_predicate_action_info_t */ 783 extern void bcm_fabric_predicate_action_info_t_init( 784 int unit, 785 bcm_fabric_predicate_action_info_t *predicate_action_info); 786 787 #ifndef BCM_HIDE_DISPATCHABLE 788 789 /* Create or replace a fabric predicate_action rule. */ 790 extern int bcm_fabric_predicate_action_create( 791 int unit, 792 bcm_fabric_predicate_action_info_t *predicate_action, 793 bcm_fabric_predicate_action_t *predicate_action_id); 794 795 /* Read a fabric predicate action */ 796 extern int bcm_fabric_predicate_action_get( 797 int unit, 798 bcm_fabric_predicate_action_t predicate_action_id, 799 bcm_fabric_predicate_action_info_t *predicate_action_info); 800 801 /* Destroy a fabric predicate_action rule */ 802 extern int bcm_fabric_predicate_action_destroy( 803 int unit, 804 bcm_fabric_predicate_action_t predicate_action_id); 805 806 /* Destroy all predicate_action rules on a unit */ 807 extern int bcm_fabric_predicate_action_destroy_all( 808 int unit); 809 810 /* Traverse the fabric predicate_action rules on a unit */ 811 extern int bcm_fabric_predicate_action_traverse( 812 int unit, 813 bcm_fabric_predicate_action_traverse_cb cb, 814 void *user_data); 815 816 #endif /* BCM_HIDE_DISPATCHABLE */ 817 818 #define BCM_FABRIC_QSEL_INGRESS 0x00000001 /* qsel will be used for ingress path 819 packets */ 820 #define BCM_FABRIC_QSEL_EGRESS 0x00000002 /* qsel will be used for egress path 821 packets */ 822 #define BCM_FABRIC_QSEL_WITH_ID 0x00000004 /* qsel needs to be created/replaced 823 with a specific ID */ 824 #define BCM_FABRIC_QSEL_REPLACE 0x00000008 /* qsel needs to be replaced instead 825 of created */ 826 827 /* Callback used by bcm_fabric_qsel_traverse */ 828 typedef int (*bcm_fabric_qsel_traverse_cb)( 829 int unit, 830 bcm_fabric_qsel_t qsel_id, 831 uint32 flags, 832 int base, 833 int count, 834 void *user_data); 835 836 /* Callback used by bcm_fabric_qsel_entry_traverse */ 837 typedef int (*bcm_fabric_qsel_entry_traverse_cb)( 838 int unit, 839 bcm_fabric_qsel_t qsel_id, 840 int offset, 841 bcm_gport_t queue, 842 bcm_fabric_qsel_offset_t qsel_offset, 843 void *user_data); 844 845 #ifndef BCM_HIDE_DISPATCHABLE 846 847 /* Create a fabric qsel */ 848 extern int bcm_fabric_qsel_create( 849 int unit, 850 uint32 flags, 851 int base, 852 int count, 853 bcm_fabric_qsel_t *qsel_id); 854 855 /* Destroy a fabric qsel */ 856 extern int bcm_fabric_qsel_destroy( 857 int unit, 858 bcm_fabric_qsel_t qsel_id); 859 860 /* Destroy all fabric qsels on a unit */ 861 extern int bcm_fabric_qsel_destroy_all( 862 int unit); 863 864 /* Get information about a particular qsel */ 865 extern int bcm_fabric_qsel_get( 866 int unit, 867 bcm_fabric_qsel_t qsel_id, 868 uint32 *flags, 869 int *base, 870 int *count); 871 872 /* Traverse the qsels on a unit */ 873 extern int bcm_fabric_qsel_traverse( 874 int unit, 875 bcm_fabric_qsel_traverse_cb cb, 876 void *user_data); 877 878 /* 879 * Set/get the base queue and qsel_offset for a particular index within a 880 * qsel 881 */ 882 extern int bcm_fabric_qsel_entry_set( 883 int unit, 884 bcm_fabric_qsel_t qsel_id, 885 int offset, 886 bcm_gport_t queue, 887 bcm_fabric_qsel_offset_t qsel_offset_id); 888 889 /* 890 * Set/get the base queue and qsel_offset for a particular index within a 891 * qsel 892 */ 893 extern int bcm_fabric_qsel_entry_get( 894 int unit, 895 bcm_fabric_qsel_t qsel_id, 896 int offset, 897 bcm_gport_t *queue, 898 bcm_fabric_qsel_offset_t *qsel_offset_id); 899 900 /* Set/get a number of entries within a qsel. */ 901 extern int bcm_fabric_qsel_entry_multi_set( 902 int unit, 903 bcm_fabric_qsel_t qsel_id, 904 int offset, 905 int count, 906 bcm_gport_t *queue, 907 bcm_fabric_qsel_offset_t *qsel_offset_id); 908 909 /* Set/get a number of entries within a qsel. */ 910 extern int bcm_fabric_qsel_entry_multi_get( 911 int unit, 912 bcm_fabric_qsel_t qsel_id, 913 int offset, 914 int count, 915 bcm_gport_t *queue, 916 bcm_fabric_qsel_offset_t *qsel_offset_id); 917 918 /* Traverse the valid entries within a qsel */ 919 extern int bcm_fabric_qsel_entry_traverse( 920 int unit, 921 bcm_fabric_qsel_t qsel_id, 922 bcm_fabric_qsel_entry_traverse_cb cb, 923 void *user_data); 924 925 #endif /* BCM_HIDE_DISPATCHABLE */ 926 927 #define BCM_FABRIC_QSEL_OFFSET_INGRESS 0x00000001 /* qsel will be used for 928 ingress path packets */ 929 #define BCM_FABRIC_QSEL_OFFSET_EGRESS 0x00000002 /* qsel will be used for 930 egress path packets */ 931 #define BCM_FABRIC_QSEL_OFFSET_WITH_ID 0x00000004 /* qsel needs to be 932 created/replaced with a 933 specific ID */ 934 #define BCM_FABRIC_QSEL_OFFSET_REPLACE 0x00000008 /* qsel needs to be replaced 935 instead of created */ 936 937 /* Callback used by bcm_fabric_qsel_offset_traverse */ 938 typedef int (*bcm_fabric_qsel_offset_traverse_cb)( 939 int unit, 940 bcm_fabric_qsel_offset_t qsel_offset_id, 941 uint32 flags, 942 void *user_data); 943 944 /* Callback used by bcm_fabric_qsel_offset_entry_traverse */ 945 typedef int (*bcm_fabric_qsel_offset_entry_traverse_cb)( 946 int unit, 947 bcm_fabric_qsel_offset_t qsel_offset_id, 948 bcm_cos_t int_pri, 949 int offset, 950 void *user_data); 951 952 #ifndef BCM_HIDE_DISPATCHABLE 953 954 /* Create a fabric qsel_offset */ 955 extern int bcm_fabric_qsel_offset_create( 956 int unit, 957 uint32 flags, 958 bcm_fabric_qsel_offset_t *qsel_offset_id); 959 960 /* Destroy a fabric qsel_offset */ 961 extern int bcm_fabric_qsel_offset_destroy( 962 int unit, 963 bcm_fabric_qsel_offset_t qsel_offset_id); 964 965 /* Destroy all qsel_offsets on a unit */ 966 extern int bcm_fabric_qsel_offset_destroy_all( 967 int unit); 968 969 /* Traverse the qsel_offsets on a unit */ 970 extern int bcm_fabric_qsel_offset_traverse( 971 int unit, 972 bcm_fabric_qsel_offset_traverse_cb cb, 973 void *user_data); 974 975 /* Set/get an entry in a fabric qsel_offset */ 976 extern int bcm_fabric_qsel_offset_entry_set( 977 int unit, 978 bcm_fabric_qsel_offset_t qsel_offset_id, 979 bcm_cos_t int_pri, 980 int offset); 981 982 /* Set/get an entry in a fabric qsel_offset */ 983 extern int bcm_fabric_qsel_offset_entry_get( 984 int unit, 985 bcm_fabric_qsel_offset_t qsel_offset_id, 986 bcm_cos_t int_pri, 987 int *offset); 988 989 /* Traverse the entries of a qsel_offset */ 990 extern int bcm_fabric_qsel_offset_entry_traverse( 991 int unit, 992 bcm_fabric_qsel_offset_t qsel_offset_id, 993 bcm_fabric_qsel_offset_entry_traverse_cb cb, 994 void *user_data); 995 996 #endif /* BCM_HIDE_DISPATCHABLE */ 997 998 #define BCM_GROUP_MODID_BIT \ 999 (1U<<31) /* Group indicator bit */ 1000 #define BCM_LOCAL_MODID_BIT \ 1001 (1U<<30) /* Local modid indicator bit */ 1002 #define BCM_FABRIC_GROUP_MODID_SET(id) \ 1003 id = id | BCM_GROUP_MODID_BIT; /* The macro will internally 1004 add group_base to define a 1005 separate number space 1006 representing a FAPs group */ 1007 #define BCM_FABRIC_LOCAL_MODID_SET(id) \ 1008 id = id | BCM_LOCAL_MODID_BIT; /* The macro will internally 1009 add local_base to define a 1010 separate number space 1011 representing a local index 1012 of a single Module */ 1013 #define BCM_FABRIC_MODID_IS_GROUP(modid) \ 1014 (modid & BCM_GROUP_MODID_BIT ? 1 : 0) /* True if the modid 1015 represents a FAPs group */ 1016 #define BCM_FABRIC_MODID_IS_LOCAL(modid) \ 1017 (modid & BCM_LOCAL_MODID_BIT ? 1 : 0) /* True if the modid 1018 represents a Module local 1019 index */ 1020 #define BCM_FABRIC_MODID_IS_MODULE(modid) \ 1021 !BCM_FABRIC_MODID_IS_GROUP(modid) && !BCM_FABRIC_MODID_IS_LOCAL(modid) /* True if the modid 1022 represents a Module index */ 1023 #define BCM_FABRIC_GROUP_MODID_UNSET(id) \ 1024 id & ~BCM_GROUP_MODID_BIT /* Clear group indicator */ 1025 #define BCM_FABRIC_LOCAL_MODID_UNSET(id) \ 1026 id & ~BCM_LOCAL_MODID_BIT /* Clear local modid 1027 indicator */ 1028 1029 #ifndef BCM_HIDE_DISPATCHABLE 1030 1031 /* Set of Modules belong to a group */ 1032 extern int bcm_fabric_modid_group_set( 1033 int unit, 1034 bcm_module_t group, 1035 int modid_count, 1036 bcm_module_t *modid_array); 1037 1038 /* Get of Modules belong to a group */ 1039 extern int bcm_fabric_modid_group_get( 1040 int unit, 1041 bcm_module_t group, 1042 int modid_max_count, 1043 bcm_module_t *modid_array, 1044 int *modid_count); 1045 1046 /* Find the relevant group for a given module id */ 1047 extern int bcm_fabric_modid_group_find( 1048 int unit, 1049 bcm_module_t modid, 1050 bcm_module_t *group); 1051 1052 /* Mapping\Getting a Module ID to local space */ 1053 extern int bcm_fabric_modid_local_mapping_set( 1054 int unit, 1055 bcm_module_t local_modid, 1056 bcm_module_t modid); 1057 1058 /* Mapping\Getting a Module ID to local space */ 1059 extern int bcm_fabric_modid_local_mapping_get( 1060 int unit, 1061 bcm_module_t local_modid, 1062 bcm_module_t *modid); 1063 1064 /* Update links topology, set all the links connected to a destination */ 1065 extern int bcm_fabric_link_topology_set( 1066 int unit, 1067 bcm_module_t destination, 1068 int links_count, 1069 bcm_port_t *links_array); 1070 1071 /* Get links topology. */ 1072 extern int bcm_fabric_link_topology_get( 1073 int unit, 1074 bcm_module_t destination, 1075 int max_links_count, 1076 int *links_count, 1077 bcm_port_t *links_array); 1078 1079 /* Set the replications of the multicast group in the fabric element */ 1080 extern int bcm_fabric_multicast_set( 1081 int unit, 1082 bcm_multicast_t group, 1083 uint32 flags, 1084 uint32 destid_count, 1085 bcm_module_t *destid_array); 1086 1087 /* Get the replications of the multicast group in the fabric element */ 1088 extern int bcm_fabric_multicast_get( 1089 int unit, 1090 bcm_multicast_t group, 1091 uint32 flags, 1092 int destid_count_max, 1093 int *destid_count, 1094 bcm_module_t *destid_array); 1095 1096 #endif /* BCM_HIDE_DISPATCHABLE */ 1097 1098 #define BCM_FABRIC_MAX_MULTICAST_MODULES (192) /* Max number of MC 1099 modules */ 1100 1101 #define BCM_FABRIC_MAX_MULTICAST_TABLE_ENTRY_SIZE (194) /* max MCT entry size */ 1102 1103 typedef SHR_BITDCL bcm_fabric_module_vector_t[_SHR_BITDCLSIZE(BCM_FABRIC_MAX_MULTICAST_TABLE_ENTRY_SIZE)]; 1104 1105 #define BCM_FABRIC_MODULE_VEC_GET(vec, modid) SHR_BITGET(vec, modid) 1106 #define BCM_FABRIC_MODULE_VEC_SET(vec, modid) SHR_BITSET(vec, modid) 1107 #define BCM_FABRIC_MODULE_VEC_CLR(vec, modid) SHR_BITCLR(vec, modid) 1108 #define BCM_FABRIC_MODULE_VEC_ZERO(vec) \ 1109 sal_memset(vec, 0, SHR_BITALLOCSIZE(BCM_FABRIC_MAX_MULTICAST_TABLE_ENTRY_SIZE)) 1110 1111 /* bcm_fabric_multicast_* flags */ 1112 #define BCM_FABRIC_MULTICAST_SET_ONLY _SHR_FABRIC_MULTICAST_SET_ONLY 1113 #define BCM_FABRIC_MULTICAST_COMMIT_ONLY _SHR_FABRIC_MULTICAST_COMMIT_ONLY 1114 #define BCM_FABRIC_MULTICAST_STATUS_ONLY _SHR_FABRIC_MULTICAST_STATUS_ONLY 1115 1116 #ifndef BCM_HIDE_DISPATCHABLE 1117 1118 /* Set replications of the multicast groups in the fabric element */ 1119 extern int bcm_fabric_multicast_multi_set( 1120 int unit, 1121 uint32 flags, 1122 uint32 ngroups, 1123 bcm_multicast_t *groups, 1124 bcm_fabric_module_vector_t *dest_array); 1125 1126 /* 1127 * Get a set of replications of the multicast groups in the fabric 1128 * element 1129 */ 1130 extern int bcm_fabric_multicast_multi_get( 1131 int unit, 1132 uint32 flags, 1133 uint32 ngroups, 1134 bcm_multicast_t *groups, 1135 bcm_fabric_module_vector_t *dest_array); 1136 1137 #endif /* BCM_HIDE_DISPATCHABLE */ 1138 1139 /* FabricLinkCellFormat flags */ 1140 #define BCM_FABRIC_LINK_CELL_FORMAT_VSC256_V1 _SHR_FABRIC_LINK_CELL_FORMAT_VSC256_V1 /* VS256_V1 cell format */ 1141 #define BCM_FABRIC_LINK_CELL_FORMAT_VSC128 _SHR_FABRIC_LINK_CELL_FORMAT_VSC128 /* VSC128 cell format */ 1142 #define BCM_FABRIC_LINK_CELL_FORMAT_VSC256_V2 _SHR_FABRIC_LINK_CELL_FORMAT_VSC256_V2 /* VS256_V2 cell format */ 1143 1144 typedef enum bcm_fabric_link_control_e { 1145 bcmFabricLinkCellFormat = 0, /* VSC256 or VSC128 */ 1146 bcmFabricLinkCellInterleavingEnable = 1, /* Enable controls and data cells 1147 interleaving (only if link partner is 1148 Arad/Petra-B/FE1600) */ 1149 bcmFabricLinkPrimaryWeight = 2, /* Sets primary arbitrations weight for 1150 MAC-TX access, in Dual-switch mode. 1151 This mode supports two queues per 1152 link: Primary queue for Data traffic 1153 and Secondary queue for TDM traffic. 1154 The bandwidth allocation between the 1155 two types of traffic can be 1156 controlled by assigning Weights for 1157 each queue type, in the 1158 0:[NUMBER_OF_LINKS-1] range. Lower 1159 weight implies higher priority weight 1160 0 is taken as strict priority. */ 1161 bcmFabricLinkSecondaryWeight = 3, /* Sets secondary arbitrations weight 1162 for MAC-TX access, in Dual-switch 1163 mode. This mode supports two queues 1164 per link: Primary queue for Data 1165 traffic and Secondary queue for TDM 1166 traffic. The bandwidth allocation 1167 between the two types of traffic can 1168 be controlled by assigning Weights 1169 for each queue type, in the 1170 0:[NUMBER_OF_LINKS-1] range. Lower 1171 weight implies higher priority weight 1172 0 is taken as strict priority. */ 1173 bcmFabricLinkIsSecondaryOnly = 4, /* Sets the link to support Secondary 1174 (TDM) queue only (relevant only to 1175 VCS128 links) */ 1176 bcmFabricLLFControlSource = 5, /* In Dual switch mode, on links that 1177 emit 128B cells, it determined the 1178 source for LLFC bits. Whether from 1179 the Primary queue, from the Secondary 1180 queue, the OR of both, or none */ 1181 bcmFabricLinkRepeaterDestinationLink = 6, /* For each input link, defines the 1182 output link that the traffic is 1183 forwarded to. Only relevant when 1184 setting the operation mode to 1185 'repeater mode'. The driver validates 1186 that the mapping is symmetric */ 1187 bcmFabricLinkIsolate = 7, /* 1: The link may be enabled in the 1188 SerDes level and in the MAC level, 1189 however, it's link partner will see 1190 the link as disabled, and will not 1191 use it for traffic distribution 0: 1192 Undo the isolation operation */ 1193 bcmFabricLinkPcpEnable = 8, /* Enable/disable Packet Cell Packing */ 1194 bcmFabricLinkTxTrafficDisable = 9, /* Enable/disable Sending cells over 1195 specific link */ 1196 bcmFabricLinkRepeaterEnable = 10, /* Enable/disable repeater link - enable 1197 means that the link is connected to 1198 repeater device */ 1199 bcmFabricLinkRetimerConnect = 11, /* Connect/Disconnect retimer links. */ 1200 bcmFabricLinkRetimerFecEnable = 12 /* Enable FEC on a retimer link. This 1201 configuration can be set only prior 1202 to setting the link into retimer. */ 1203 } bcm_fabric_link_control_t; 1204 1205 #ifndef BCM_HIDE_DISPATCHABLE 1206 1207 /* Set\Get fabric-link attribute per link. \br */ 1208 extern int bcm_fabric_link_control_set( 1209 int unit, 1210 bcm_port_t link, 1211 bcm_fabric_link_control_t type, 1212 int arg); 1213 1214 /* Set\Get fabric-link attribute per link. \br */ 1215 extern int bcm_fabric_link_control_get( 1216 int unit, 1217 bcm_port_t link, 1218 bcm_fabric_link_control_t type, 1219 int *arg); 1220 1221 #endif /* BCM_HIDE_DISPATCHABLE */ 1222 1223 typedef struct bcm_fabric_link_remote_pipe_mapping_s { 1224 uint32 num_of_remote_pipes; /* Number of pipes supported by the 1225 remote device */ 1226 bcm_fabric_pipe_t *remote_pipe_mapping; /* The mapping from remote pipe 1227 (represented by the index) to the 1228 local pipe (represented by the value 1229 stored in this index) */ 1230 uint32 remote_pipe_mapping_max_size; /* Max size of remote_pipe_mapping */ 1231 } bcm_fabric_link_remote_pipe_mapping_t; 1232 1233 /* 1234 * Initialize a bcm_fabric_link_remote_pipe_mapping_t to a 'safe' default 1235 * value. 1236 */ 1237 extern void bcm_fabric_link_remote_pipe_mapping_t_init( 1238 bcm_fabric_link_remote_pipe_mapping_t *pipe_mapping); 1239 1240 #ifndef BCM_HIDE_DISPATCHABLE 1241 1242 /* 1243 * Set/get per link the mapping between the local pipe to the remote 1244 * pipe. 1245 */ 1246 extern int bcm_fabric_link_remote_pipe_mapping_set( 1247 int unit, 1248 bcm_port_t port, 1249 bcm_fabric_link_remote_pipe_mapping_t *mapping_config); 1250 1251 /* 1252 * Set/get per link the mapping between the local pipe to the remote 1253 * pipe. 1254 */ 1255 extern int bcm_fabric_link_remote_pipe_mapping_get( 1256 int unit, 1257 bcm_port_t port, 1258 bcm_fabric_link_remote_pipe_mapping_t *mapping_config); 1259 1260 #endif /* BCM_HIDE_DISPATCHABLE */ 1261 1262 /* fabric link threshold types */ 1263 typedef enum bcm_fabric_link_threshold_type_e { 1264 bcmFabricLinkRxFifoLLFC = 0, /* the threshold that initiates link 1265 level flow control when the receiving 1266 FIFO is overloaded */ 1267 bcmFabricLinkFE1TxBypassLLFC = 1, /* Only relevant for FE1 links. When the 1268 transmitting threshold is overloaded; 1269 the receiving FIFOs of all the FE1 1270 links start generating link level 1271 flow control */ 1272 bcmFabricLinkRciFC = 2, /* The TX FIFO threshold; that initiates 1273 the Route Congestion Indication flow 1274 control */ 1275 bcmFabricLinkTxGciLvl1FC = 3, /* The TX FIFO threshold that initiates 1276 the Global Congestion Indication 1277 level 1 Flow Vontrol. */ 1278 bcmFabricLinkTxGciLvl2FC = 4, /* The TX FIFO threshold that initiates 1279 the Global Congestion Indication 1280 level 2 Flow Vontrol. */ 1281 bcmFabricLinkTxGciLvl3FC = 5, /* The TX FIFO threshold that initiates 1282 the Global Congestion Indication 1283 level 3 Flow Vontrol. */ 1284 bcmFabricLinkRxGciLvl1FC = 6, /* The RX FIFO threshold that initiates 1285 the Global Congestion Indication 1286 level 1 Flow Control. */ 1287 bcmFabricLinkRxGciLvl2FC = 7, /* The RX FIFO threshold that initiates 1288 the Global Congestion Indication 1289 level 2 Flow Control. */ 1290 bcmFabricLinkRxGciLvl3FC = 8, /* The RX FIFO threshold that initiates 1291 the Global Congestion Indication 1292 level 3 Flow Control. */ 1293 bcmFabricLinkTxPrio0Drop = 9, /* The TX FIFO threshold; that initiate 1294 the priority 0 packet dropping. */ 1295 bcmFabricLinkTxPrio1Drop = 10, /* The TX FIFO threshold; that initiate 1296 the priority 1 packet dropping. */ 1297 bcmFabricLinkTxPrio2Drop = 11, /* The TX FIFO threshold; that initiate 1298 the priority 2 packet dropping. */ 1299 bcmFabricLinkTxPrio3Drop = 12, /* The TX FIFO threshold; that initiate 1300 the priority 3 packet dropping. */ 1301 bcmFabricLinkRxPrio0Drop = 13, /* The RX FIFO threshold that initiate 1302 the priority 0 packet dropping. */ 1303 bcmFabricLinkRxPrio1Drop = 14, /* The RX FIFO threshold that initiate 1304 the priority 1 packet dropping. */ 1305 bcmFabricLinkRxPrio2Drop = 15, /* The RX FIFO threshold that initiate 1306 the priority 2 packet dropping. */ 1307 bcmFabricLinkRxPrio3Drop = 16, /* The RX FIFO threshold that initiate 1308 the priority 3 packet dropping. */ 1309 bcmFabricLinkGciLeakyBucket1Congestion = 17, /* Configure GCI leaky bucket 1 1310 congestion threshold */ 1311 bcmFabricLinkGciLeakyBucket2Congestion = 18, /* Configure GCI leaky bucket 2 1312 congestion threshold */ 1313 bcmFabricLinkGciLeakyBucket3Congestion = 19, /* Configure GCI leaky bucket 3 1314 congestion threshold */ 1315 bcmFabricLinkGciLeakyBucket4Congestion = 20, /* Configure GCI leaky bucket 4 1316 congestion threshold */ 1317 bcmFabricLinkGciLeakyBucket1Full = 21, /* Configure GCI leaky bucket 1 full 1318 value */ 1319 bcmFabricLinkGciLeakyBucket2Full = 22, /* Configure GCI leaky bucket 2 full 1320 value */ 1321 bcmFabricLinkGciLeakyBucket3Full = 23, /* Configure GCI leaky bucket 3 full 1322 value */ 1323 bcmFabricLinkGciLeakyBucket4Full = 24, /* Configure GCI leaky bucket 4 full 1324 value */ 1325 bcmFabricLinkRxRciLvl1FC = 25, /* The RX FIFO threshold that initiates 1326 the Route Congestion Indication level 1327 1 Flow Control. */ 1328 bcmFabricLinkRxRciLvl2FC = 26, /* The RX FIFO threshold that initiates 1329 the Route Congestion Indication level 1330 2 Flow Control. */ 1331 bcmFabricLinkRxRciLvl3FC = 27, /* The RX FIFO threshold that initiates 1332 the Route Congestion Indication level 1333 3 Flow Control. */ 1334 bcmFabricLinkRxFull = 28, /* Configure threshold for max FIFO 1335 size, beyond this threshold, packets 1336 will be dropped. */ 1337 bcmFabricLinkRxFifoSize = 29, /* Configure the FIFO size, this is a 1338 static configuration. */ 1339 bcmFabricLinkRxMcLowPrioDrop = 30, /* Configure the multicast low priority 1340 cells drop thresholds. */ 1341 bcmFabricLinkMidGciLvl1FC = 31, /* Configure the Mid GCI threshold for 1342 level 1 flow control. */ 1343 bcmFabricLinkMidGciLvl2FC = 32, /* Configure the Mid GCI threshold for 1344 level 2 flow control. */ 1345 bcmFabricLinkMidGciLvl3FC = 33, /* Configure the Mid GCI threshold for 1346 level 3 flow control. */ 1347 bcmFabricLinkMidRciLvl1FC = 34, /* Configure the Mid RCI threshold for 1348 level 1 flow control. */ 1349 bcmFabricLinkMidRciLvl2FC = 35, /* Configure the Mid RCI threshold for 1350 level 2 flow control. */ 1351 bcmFabricLinkMidRciLvl3FC = 36, /* Configure the Mid RCI threshold for 1352 level 3 flow control. */ 1353 bcmFabricLinkMidPrio0Drop = 37, /* Configure the maximum threshold for 1354 DCM priorty 0 drops, above this 1355 threshold the dcm will drop cells 1356 recieved from DCH. */ 1357 bcmFabricLinkMidPrio1Drop = 38, /* Configure the maximum threshold for 1358 DCM priorty 1 drops, above this 1359 threshold the dcm will drop cells 1360 recieved from DCH. */ 1361 bcmFabricLinkMidPrio2Drop = 39, /* Configure the maximum threshold for 1362 DCM priorty 2 drops, above this 1363 threshold the dcm will drop cells 1364 recieved from DCH. */ 1365 bcmFabricLinkMidPrio3Drop = 40, /* Configure the maximum threshold for 1366 DCM priorty 3 drops, above this 1367 threshold the dcm will drop cells 1368 recieved from DCH. */ 1369 bcmFabricLinkMidAlmostFull = 41, /* Configure threshold for almost full, 1370 beyond this threshold, flow control 1371 will be sent back to the DCH. */ 1372 bcmFabricLinkMidFifoSize = 42, /* Configure the FIFO depth (size). */ 1373 bcmFabricLinkTxRciLvl1FC = 43, /* The TX FIFO threshold that initiates 1374 the Route Congestion Indication level 1375 1 Flow Control. */ 1376 bcmFabricLinkTxRciLvl2FC = 44, /* The TX FIFO threshold that initiates 1377 the Route Congestion Indication level 1378 2 Flow Control. */ 1379 bcmFabricLinkTxRciLvl3FC = 45, /* The TX FIFO threshold that initiates 1380 the Route Congestion Indication level 1381 3 Flow Control. */ 1382 bcmFabricLinkTxAlmostFull = 46, /* Configure threshold for almost full, 1383 beyond this threshold, flow control 1384 will be sent back to the DCM. */ 1385 bcmFabricLinkTxFifoSize = 47, /* Configure DCL FIFO depth (size). */ 1386 bcmFabricLinkMidFull = 48 /* Configure threshold for max FIFO 1387 size, beyond this threshold, packets 1388 will be dropped. */ 1389 } bcm_fabric_link_threshold_type_t; 1390 1391 #ifndef BCM_HIDE_DISPATCHABLE 1392 1393 /* Add\Delete thresholds set */ 1394 extern int bcm_fabric_link_threshold_add( 1395 int unit, 1396 uint32 flags, 1397 int *fifo_type); 1398 1399 /* Add\Delete thresholds set */ 1400 extern int bcm_fabric_link_threshold_delete( 1401 int unit, 1402 int fifo_type); 1403 1404 /* Set\Get fifo_type thresholds */ 1405 extern int bcm_fabric_link_thresholds_set( 1406 int unit, 1407 int fifo_type, 1408 uint32 count, 1409 bcm_fabric_link_threshold_type_t *type, 1410 int *value); 1411 1412 /* Set\Get fifo_type thresholds */ 1413 extern int bcm_fabric_link_thresholds_get( 1414 int unit, 1415 int fifo_type, 1416 uint32 count, 1417 bcm_fabric_link_threshold_type_t *type, 1418 int *value); 1419 1420 /* Set\Get fifo_type thresholds per pipe */ 1421 extern int bcm_fabric_link_thresholds_pipe_set( 1422 int unit, 1423 int fifo_type, 1424 bcm_fabric_pipe_t pipe, 1425 uint32 flags, 1426 uint32 count, 1427 bcm_fabric_link_threshold_type_t *type, 1428 int *value); 1429 1430 /* Set\Get fifo_type thresholds per pipe */ 1431 extern int bcm_fabric_link_thresholds_pipe_get( 1432 int unit, 1433 int fifo_type, 1434 bcm_fabric_pipe_t pipe, 1435 uint32 flags, 1436 uint32 count, 1437 bcm_fabric_link_threshold_type_t *type, 1438 int *value); 1439 1440 #endif /* BCM_HIDE_DISPATCHABLE */ 1441 1442 #define BCM_FABRIC_LINK_TH_FE1_LINKS_ONLY 0x00000001 /* Only apply the 1443 settings for the FE1 1444 links. FE1 and FE3 1445 links with the same 1446 type, will have 1447 different values */ 1448 #define BCM_FABRIC_LINK_TH_FE3_LINKS_ONLY 0x00000002 /* Only apply the 1449 settings for the FE3 1450 links. FE1 and FE3 1451 links with the same 1452 type, will have 1453 different values */ 1454 #define BCM_FABRIC_LINK_TH_PRIM_ONLY 0x00000004 /* Only apply the 1455 settings to the 1456 Primary switching 1457 context */ 1458 #define BCM_FABRIC_LINK_TH_SCND_ONLY 0x00000008 /* Only apply the 1459 settings to the 1460 Secondary switching 1461 context */ 1462 #define BCM_FABRIC_LINK_THRESHOLD_WITH_ID 0x00000010 1463 #define BCM_FABRIC_LINK_THRESHOLD_RX_FIFO_ONLY 0x00000020 /* Only apply the 1464 settings to the RX 1465 links */ 1466 #define BCM_FABRIC_LINK_THRESHOLD_TX_FIFO_ONLY 0x00000040 /* Only apply the 1467 settings to the TX 1468 links */ 1469 1470 #define BCM_FABRIC_LINK_STATUS_CRC_ERROR _SHR_FABRIC_LINK_STATUS_CRC_ERROR /* Non-zero CRC rate */ 1471 #define BCM_FABRIC_LINK_STATUS_SIZE_ERROR _SHR_FABRIC_LINK_STATUS_SIZE_ERROR /* Non-zero size 1472 error-count */ 1473 #define BCM_FABRIC_LINK_STATUS_CODE_GROUP_ERROR _SHR_FABRIC_LINK_STATUS_CODE_GROUP_ERROR /* Non-zero code group 1474 error-count */ 1475 #define BCM_FABRIC_LINK_STATUS_MISALIGN _SHR_FABRIC_LINK_STATUS_MISALIGN /* Link down, 1476 misalignment error */ 1477 #define BCM_FABRIC_LINK_STATUS_NO_SIG_LOCK _SHR_FABRIC_LINK_STATUS_NO_SIG_LOCK /* Link down, SerDes 1478 signal lock error */ 1479 #define BCM_FABRIC_LINK_STATUS_NO_SIG_ACCEP _SHR_FABRIC_LINK_STATUS_NO_SIG_ACCEP /* Link up, but not 1480 accepting reachability 1481 cells */ 1482 #define BCM_FABRIC_LINK_STATUS_ERRORED_TOKENS _SHR_FABRIC_LINK_STATUS_ERRORED_TOKENS /* Low value, indicates 1483 bad link connectivity 1484 or link down, based on 1485 reachability cells */ 1486 1487 #ifndef BCM_HIDE_DISPATCHABLE 1488 1489 /* 1490 * Attach list of links to a thresholds set (fifo_type) \br 1491 * Retrieve list of links attached with a thresholds set (fifo_type) 1492 */ 1493 extern int bcm_fabric_link_thresholds_attach( 1494 int unit, 1495 int fifo_type, 1496 uint32 links_count, 1497 bcm_port_t *links); 1498 1499 /* 1500 * Attach list of links to a thresholds set (fifo_type) \br 1501 * Retrieve list of links attached with a thresholds set (fifo_type) 1502 */ 1503 extern int bcm_fabric_link_thresholds_retrieve( 1504 int unit, 1505 int fifo_type, 1506 uint32 links_count_max, 1507 bcm_port_t *links, 1508 uint32 *links_count); 1509 1510 /* Get the status of the link */ 1511 extern int bcm_fabric_link_status_get( 1512 int unit, 1513 bcm_port_t link_id, 1514 uint32 *link_status, 1515 uint32 *errored_token_count); 1516 1517 #endif /* BCM_HIDE_DISPATCHABLE */ 1518 1519 typedef enum bcm_fabric_device_type_e { 1520 bcmFabricDeviceTypeUnknown = 0, /* Unknown device type */ 1521 bcmFabricDeviceTypeFE13 = 1, /* FE13 device type */ 1522 bcmFabricDeviceTypeFE2 = 2, /* FE2 device type */ 1523 bcmFabricDeviceTypeFAP = 3, /* FAP device type */ 1524 bcmFabricDeviceTypeFE1 = 4, /* FE1 device type */ 1525 bcmFabricDeviceTypeFE3 = 5, /* FE3 device type */ 1526 bcmFabricDeviceTypeFIP = 6, /* FIP device type */ 1527 bcmFabricDeviceTypeFOP = 7 /* FOP device type */ 1528 } bcm_fabric_device_type_t; 1529 1530 typedef struct bcm_fabric_link_connectivity_s { 1531 uint32 module_id; /* remote module ID. */ 1532 uint32 link_id; /* remote link id. The ID of the link 1533 partner in the remote module. 1534 BCM_FABRIC_LINK_NO_CONNECTIVITY: The 1535 connection is invalid */ 1536 bcm_fabric_device_type_t device_type; /* remote device type */ 1537 } bcm_fabric_link_connectivity_t; 1538 1539 #define BCM_FABRIC_LINK_NO_CONNECTIVITY _SHR_FABRIC_LINK_NO_CONNECTIVITY /* FABRIC_LINK_NO_CONNECTIVITY */ 1540 1541 #ifndef BCM_HIDE_DISPATCHABLE 1542 1543 /* 1544 * Retrieves the current link-partner information of a link for all 1545 * existing links 1546 */ 1547 extern int bcm_fabric_link_connectivity_status_get( 1548 int unit, 1549 int link_partner_max, 1550 bcm_fabric_link_connectivity_t *link_partner_array, 1551 int *link_partner_count); 1552 1553 /* Retrieves the current link-partner information of a single link. */ 1554 extern int bcm_fabric_link_connectivity_status_single_get( 1555 int unit, 1556 bcm_port_t link_id, 1557 bcm_fabric_link_connectivity_t *link_partner_info); 1558 1559 /* Retrieves the links through which a remote module ID is reachable */ 1560 extern int bcm_fabric_reachability_status_get( 1561 int unit, 1562 int moduleid, 1563 int links_max, 1564 uint32 *links_array, 1565 int *links_count); 1566 1567 #endif /* BCM_HIDE_DISPATCHABLE */ 1568 1569 /* bandwidth profile configuration */ 1570 typedef struct bcm_fabric_bandwidth_profile_s { 1571 int num_links; /* number of links/serdes */ 1572 int rci; /* route congestion indication */ 1573 uint32 max_kbps; /* maximum bandwidth (in kbps) */ 1574 } bcm_fabric_bandwidth_profile_t; 1575 1576 #ifndef BCM_HIDE_DISPATCHABLE 1577 1578 /* Set retrieve fabric bandwidth profile on unit level */ 1579 extern int bcm_fabric_bandwidth_profile_set( 1580 int unit, 1581 int profile_count, 1582 bcm_fabric_bandwidth_profile_t *profile_array); 1583 1584 /* Set retrieve fabric bandwidth profile on unit level */ 1585 extern int bcm_fabric_bandwidth_profile_get( 1586 int unit, 1587 int profile_count, 1588 bcm_fabric_bandwidth_profile_t *profile_array); 1589 1590 /* Set retrieve fabric bandwidth profile per core */ 1591 extern int bcm_fabric_bandwidth_core_profile_set( 1592 int unit, 1593 int core, 1594 uint32 flags, 1595 int profile_count, 1596 bcm_fabric_bandwidth_profile_t *profile_array); 1597 1598 /* Set retrieve fabric bandwidth profile per core */ 1599 extern int bcm_fabric_bandwidth_core_profile_get( 1600 int unit, 1601 int core, 1602 uint32 flags, 1603 int profile_count, 1604 bcm_fabric_bandwidth_profile_t *profile_array); 1605 1606 #endif /* BCM_HIDE_DISPATCHABLE */ 1607 1608 #define BCM_FABRIC_TDM_USER_FIELD_MAX_SIZE 6 /* Maximum size of user 1609 field */ 1610 1611 /* TDM editing flags */ 1612 #define BCM_FABRIC_TDM_EDITING_INGRESS 0x0001 /* Ingress direction */ 1613 #define BCM_FABRIC_TDM_EDITING_EGRESS 0x0002 /* Egress Direction */ 1614 #define BCM_FABRIC_TDM_EDITING_UNICAST 0x0004 /* Unicast */ 1615 #define BCM_FABRIC_TDM_EDITING_MULTICAST 0x0008 /* Multicast */ 1616 #define BCM_FABRIC_TDM_EDITING_NON_SYMMETRIC_CRC 0x0010 /* asymmetric CRC, 1617 add/remove CRC based 1618 on ingress/egress 1619 flags */ 1620 1621 /* bcm_fabric_tdm_editing_type_t */ 1622 typedef enum bcm_fabric_tdm_editing_type_e { 1623 bcmFabricTdmEditingAppend = 0, /* append internal forwarding header 1624 (FTMH) to all received TDM packets. 1625 Configuration applied to ingress 1626 port. If set destination forwarding 1627 must be configured (egress port). */ 1628 bcmFabricTdmEditingRemove = 1, /* remove forwarding header to all the 1629 transmitted packets at this egress 1630 port. */ 1631 bcmFabricTdmEditingNoChange = 2, /* do not change the forwarding header. 1632 For ingress the forwarding header is 1633 not changed (forwarding header added 1634 by upstream device). For egress 1635 forwarding header not changed (i.e 1636 not changed/removed) and is passed to 1637 downstream device. */ 1638 bcmFabricTdmEditingCustomExternal = 3 /* External custom header. In ingress 1639 direction embed external custom 1640 header in the added forwading header. 1641 Embedded fields will replace user 1642 specified fields. In the egress 1643 direction, extract external custom 1644 overhead from user specified fields 1645 of the removed forwarding header. */ 1646 } bcm_fabric_tdm_editing_type_t; 1647 1648 /* tdm editing configuration */ 1649 typedef struct bcm_fabric_tdm_editing_s { 1650 uint32 flags; /* flag values. Valid for Ingress and 1651 Egress configuration */ 1652 bcm_fabric_tdm_editing_type_t type; /* editing type. Valid for Ingress and 1653 Egress configuration */ 1654 bcm_gport_t destination_port; /* destination port. Valid for Ingress 1655 unicast configuration. 1656 (BCM_FABRIC_TDM_EDITING_UNICAST and 1657 TDM_EDITING_INGRESS flag has to be 1658 specified. Also reference type 1659 field). */ 1660 bcm_multicast_t multicast_id; /* Multicast Id. Valid for Ingress 1661 multicast configuration. 1662 (BCM_FABRIC_TDM_EDITING_MULTICAST and 1663 BCM_FABRIC_TDM_EDITING_INGRESS flag 1664 has to be specified. Also reference 1665 type field. */ 1666 uint8 user_field[BCM_FABRIC_TDM_USER_FIELD_MAX_SIZE]; /* user field values. Valid for Ingress 1667 configuration. 1668 (BCM_FABRIC_TDM_EDITING_INGRESS flag 1669 has to be specified) */ 1670 int user_field_count; /* count of total number of bits. Valid 1671 for Ingress configuration 1672 (BCM_FABRIC_TDM_EDITING_INGRESS flag 1673 has to be specified) */ 1674 int add_packet_crc; /* TRUE =>add CRC, FALSE => do not add 1675 CRC */ 1676 } bcm_fabric_tdm_editing_t; 1677 1678 /* Initialize bcm_fabric_tdm_editing_t to a 'safe' default value. */ 1679 extern void bcm_fabric_tdm_editing_t_init( 1680 bcm_fabric_tdm_editing_t *editing); 1681 1682 #ifndef BCM_HIDE_DISPATCHABLE 1683 1684 /* TDM configuration */ 1685 extern int bcm_fabric_tdm_editing_set( 1686 int unit, 1687 bcm_gport_t gport, 1688 bcm_fabric_tdm_editing_t *editing); 1689 1690 /* TDM configuration */ 1691 extern int bcm_fabric_tdm_editing_get( 1692 int unit, 1693 bcm_gport_t gport, 1694 bcm_fabric_tdm_editing_t *editing); 1695 1696 #endif /* BCM_HIDE_DISPATCHABLE */ 1697 1698 #define BCM_FABRIC_TDM_MAX_LINKS 64 /* maximum fabric links */ 1699 1700 /* tdm editing configuration */ 1701 typedef struct bcm_fabric_tdm_direct_routing_s { 1702 int links_count; /* number of links. setting a link count 1703 of zero implies no direct routing */ 1704 bcm_gport_t links[BCM_FABRIC_TDM_MAX_LINKS]; /* link specification */ 1705 } bcm_fabric_tdm_direct_routing_t; 1706 1707 #ifndef BCM_HIDE_DISPATCHABLE 1708 1709 /* TDM routing configuration */ 1710 extern int bcm_fabric_tdm_direct_routing_set( 1711 int unit, 1712 bcm_gport_t gport, 1713 bcm_fabric_tdm_direct_routing_t *routing_info); 1714 1715 /* TDM routing configuration */ 1716 extern int bcm_fabric_tdm_direct_routing_get( 1717 int unit, 1718 bcm_gport_t gport, 1719 bcm_fabric_tdm_direct_routing_t *routing_info); 1720 1721 #endif /* BCM_HIDE_DISPATCHABLE */ 1722 1723 /* Discard aging flags */ 1724 #define BCM_FABRIC_CONFIG_DISCARD_AGING_ACTION_ONLY 0x0001 /* If set, only aging can 1725 set discard aging. 1726 Otherwise, also other 1727 mechanizems. */ 1728 1729 /* bcm_fabric_age_mode_t */ 1730 typedef enum bcm_fabric_age_mode_e { 1731 bcmFabricAgeModeReset = 0, /* size is reset to 0 */ 1732 bcmFabricAgeModeDecrement = 1 /* size is decremented by 1 */ 1733 } bcm_fabric_age_mode_t; 1734 1735 /* bcm_fabric_module_control_t */ 1736 typedef enum bcm_fabric_module_control_e { 1737 bcmFabricModuleControlFSMSeqNumberEnable = 0, /* Fabric Status Message sequence 1738 numbers mechanism enable/disable */ 1739 bcmFabricModuleControlMcTopologySwControlEnable = 1 1740 } bcm_fabric_module_control_t; 1741 1742 /* Aging configuration */ 1743 typedef struct bcm_fabric_config_discard_s { 1744 uint32 flags; /* BCM_FABRIC_CONFIG_DISCARD_XXX flags */ 1745 int enable; /* Enable Aging period functionality */ 1746 int age; /* Unit in millisecond. Every 'age' outgoing 1747 local port size is monitored. If it was 1748 not updated during parameter age, it is 1749 updated according to age_mode */ 1750 bcm_fabric_age_mode_t age_mode; /* Defines the action if outgoing local port 1751 size was not updated by VoQs after 1752 aging_period */ 1753 } bcm_fabric_config_discard_t; 1754 1755 #ifndef BCM_HIDE_DISPATCHABLE 1756 1757 /* 1758 * Set discard aging configuration. Configuration to enable, disable 1759 * aging and its settings. 1760 */ 1761 extern int bcm_fabric_config_discard_set( 1762 int unit, 1763 bcm_fabric_config_discard_t *discard); 1764 1765 /* 1766 * Set discard aging configuration. Configuration to enable, disable 1767 * aging and its settings. 1768 */ 1769 extern int bcm_fabric_config_discard_get( 1770 int unit, 1771 bcm_fabric_config_discard_t *discard); 1772 1773 /* Per module configuration */ 1774 extern int bcm_fabric_module_control_set( 1775 int unit, 1776 uint32 flags, 1777 bcm_module_t modid, 1778 bcm_fabric_module_control_t control, 1779 int value); 1780 1781 /* Per module configuration */ 1782 extern int bcm_fabric_module_control_get( 1783 int unit, 1784 uint32 flags, 1785 bcm_module_t modid, 1786 bcm_fabric_module_control_t control, 1787 int *value); 1788 1789 #endif /* BCM_HIDE_DISPATCHABLE */ 1790 1791 /* 1792 * Credit watchdog control, allowed values to: 1793 * bcm_fabric_control_set(unit, bcmFabricWatchdogQueueEnable, value) 1794 */ 1795 #define BCM_FABRIC_WATCHDOG_QUEUE_DISABLE 0 /* credit watchdog will 1796 be disabled */ 1797 #define BCM_FABRIC_WATCHDOG_QUEUE_ENABLE_NORMAL 1 /* credit watchdog will 1798 be enabled in normal 1799 mode */ 1800 #define BCM_FABRIC_WATCHDOG_QUEUE_ENABLE_FAST_STATUS_MESSAGE 2 /* credit watchdog will 1801 be enabled in 1802 aggressive status 1803 message mode */ 1804 #define BCM_FABRIC_WATCHDOG_QUEUE_ENABLE_COMMON_STATUS_MESSAGE 3 /* credit watchdog will 1805 be enabled in common 1806 status message mode */ 1807 #define BCM_FABRIC_WATCHDOG_QUEUE_ENABLE_MIN BCM_FABRIC_WATCHDOG_QUEUE_DISABLE 1808 #define BCM_FABRIC_WATCHDOG_QUEUE_ENABLE_MAX BCM_FABRIC_WATCHDOG_QUEUE_ENABLE_COMMON_STATUS_MESSAGE 1809 1810 /* bcm_fabric_priority_* flags */ 1811 #define BCM_FABRIC_QUEUE_PRIORITY_HIGH_ONLY _SHR_FABRIC_QUEUE_PRIORITY_HIGH_ONLY 1812 #define BCM_FABRIC_QUEUE_PRIORITY_LOW_ONLY _SHR_FABRIC_QUEUE_PRIORITY_LOW_ONLY 1813 #define BCM_FABRIC_PRIORITY_MULTICAST _SHR_FABRIC_PRIORITY_MULTICAST 1814 #define BCM_FABRIC_PRIORITY_TDM _SHR_FABRIC_PRIORITY_TDM 1815 #define BCM_FABRIC_PRIORITY_OCB_MIX_ONLY _SHR_FABRIC_PRIORITY_OCB_MIX_ONLY 1816 #define BCM_FABRIC_PRIORITY_OCB_ONLY_ONLY _SHR_FABRIC_PRIORITY_OCB_ONLY_ONLY 1817 1818 #ifndef BCM_HIDE_DISPATCHABLE 1819 1820 /* Allow configuration of the fabric cell priority */ 1821 extern int bcm_fabric_priority_set( 1822 int unit, 1823 uint32 flags, 1824 bcm_cos_t ingress_pri, 1825 bcm_color_t color, 1826 int fabric_priority); 1827 1828 /* Getting fabric cell priority configuration. */ 1829 extern int bcm_fabric_priority_get( 1830 int unit, 1831 uint32 flags, 1832 bcm_cos_t ingress_pri, 1833 bcm_color_t color, 1834 int *fabric_priority); 1835 1836 #endif /* BCM_HIDE_DISPATCHABLE */ 1837 1838 /* Fabric route */ 1839 typedef struct bcm_fabric_route_s { 1840 uint32 pipe_id; /* Origin fabric pipe */ 1841 int number_of_hops; /* Corresponds to the number of routing hops (number 1842 traversed links) */ 1843 int *hop_ids; /* Traversed links */ 1844 } bcm_fabric_route_t; 1845 1846 /* Initialize a bcm_fabric_route_t to a 'safe' default value. */ 1847 extern void bcm_fabric_route_t_init( 1848 bcm_fabric_route_t *fabric_route); 1849 1850 #ifndef BCM_HIDE_DISPATCHABLE 1851 1852 /* Receive fabric route cells */ 1853 extern int bcm_fabric_route_rx( 1854 int unit, 1855 uint32 flags, 1856 uint32 data_out_max_size, 1857 uint32 *data_out, 1858 uint32 *data_out_size); 1859 1860 /* Send fabric route cells */ 1861 extern int bcm_fabric_route_tx( 1862 int unit, 1863 uint32 flags, 1864 bcm_fabric_route_t *route, 1865 uint32 data_in_size, 1866 uint32 *data_in); 1867 1868 #endif /* BCM_HIDE_DISPATCHABLE */ 1869 1870 /* Packet Cell Packing (pcp) mode. */ 1871 typedef enum bcm_fabric_pcp_mode_e { 1872 bcmFabricPcpModeNoPacking = 0, /* No packing */ 1873 bcmFabricPcpModeSimple = 1, /* Simple Packing */ 1874 bcmFabricPcpModeContinuous = 2 /* Continuous Packing */ 1875 } bcm_fabric_pcp_mode_t; 1876 1877 /* Fabric pcp mode configuration */ 1878 typedef struct bcm_fabric_pcp_mode_config_s { 1879 bcm_fabric_pcp_mode_t pcp_mode; /* Mode of Packet Cell Packing (PCP) */ 1880 } bcm_fabric_pcp_mode_config_t; 1881 1882 #ifndef BCM_HIDE_DISPATCHABLE 1883 1884 /* Set/Get PCP mode per VOQ/destination device. */ 1885 extern int bcm_fabric_pcp_dest_mode_config_set( 1886 int unit, 1887 uint32 flags, 1888 bcm_module_t modid, 1889 bcm_fabric_pcp_mode_config_t *pcp_config); 1890 1891 /* Set/Get PCP mode per VOQ/destination device. */ 1892 extern int bcm_fabric_pcp_dest_mode_config_get( 1893 int unit, 1894 uint32 flags, 1895 bcm_module_t modid, 1896 bcm_fabric_pcp_mode_config_t *pcp_config); 1897 1898 #endif /* BCM_HIDE_DISPATCHABLE */ 1899 1900 /* Configure all-reachable minimum number of links. */ 1901 #define BCM_FABRIC_DESTINATION_LINK_MIN_ALL_REACHABLE 1 1902 1903 #ifndef BCM_HIDE_DISPATCHABLE 1904 1905 /* Configure minimum number of links per destination device. */ 1906 extern int bcm_fabric_destination_link_min_set( 1907 int unit, 1908 uint32 flags, 1909 bcm_module_t module_id, 1910 int num_of_links); 1911 1912 /* Configure minimum number of links per destination device. */ 1913 extern int bcm_fabric_destination_link_min_get( 1914 int unit, 1915 uint32 flags, 1916 bcm_module_t module_id, 1917 int *num_of_links); 1918 1919 #endif /* BCM_HIDE_DISPATCHABLE */ 1920 1921 /* severity counter to indicate severity level thresholds. */ 1922 #define BCM_FABRIC_NUM_OF_RCI_LEVELS 7 1923 1924 /* RCI indication level factor. */ 1925 #define BCM_FABRIC_NUM_OF_RCI_SEVERITIES 3 1926 1927 /* Fabric RCI configuration */ 1928 typedef struct bcm_fabric_rci_config_s { 1929 uint32 rci_core_level_thresholds[BCM_FABRIC_NUM_OF_RCI_LEVELS]; /* thresholds for severity counter of 1930 RCI - per core */ 1931 uint32 rci_device_level_thresholds[BCM_FABRIC_NUM_OF_RCI_LEVELS]; /* thresholds for severity counter of 1932 RCI - per device */ 1933 uint32 rci_severity_factors[BCM_FABRIC_NUM_OF_RCI_SEVERITIES]; /* RCI severity level factor */ 1934 uint32 rci_high_score_fabric_rx_queue; /* RCI score of fabric FIFO */ 1935 uint32 rci_high_score_fabric_rx_local_queue; /* RCI score of fabric local FIFO */ 1936 uint32 rci_threshold_num_of_congested_links; /* number of congested links to be used 1937 as treshold */ 1938 uint32 rci_high_score_congested_links; /* high score to be used when number of 1939 congested links reaches threshold */ 1940 } bcm_fabric_rci_config_t; 1941 1942 #ifndef BCM_HIDE_DISPATCHABLE 1943 1944 /* configure RCI related information */ 1945 extern int bcm_fabric_rci_config_set( 1946 int unit, 1947 bcm_fabric_rci_config_t rci_config); 1948 1949 /* configure RCI related information */ 1950 extern int bcm_fabric_rci_config_get( 1951 int unit, 1952 bcm_fabric_rci_config_t *rci_config); 1953 1954 #endif /* BCM_HIDE_DISPATCHABLE */ 1955 1956 /* Initialize a bcm_fabric_rci_config_t to a 'safe' default value. */ 1957 extern void bcm_fabric_rci_config_t_init( 1958 bcm_fabric_rci_config_t *rci_config); 1959 1960 #ifndef BCM_HIDE_DISPATCHABLE 1961 1962 /* Set the replications in the fabric element to external faps */ 1963 extern int bcm_fabric_static_replication_set( 1964 int unit, 1965 bcm_port_t port, 1966 uint32 flags, 1967 uint32 destid_count, 1968 bcm_module_t *destid_array); 1969 1970 #endif /* BCM_HIDE_DISPATCHABLE */ 1971 1972 /* fabric_threshold_type */ 1973 typedef enum bcm_fabric_threshold_type_e { 1974 bcmFabricMidTagDropClassTh = _SHR_FABRIC_MID_TAG_DROP_CLASS_TH, /* Ingress Admission Thresholds */ 1975 bcmFabricTxLinkLoadDropPipeTh = _SHR_FABRIC_TX_LINK_LOAD_DROP_PIPE_TH, 1976 bcmFabricTxFragGuaranteedPipeTh = _SHR_FABRIC_TX_FRAG_GUARANTEED_PIPE_TH, 1977 bcmFabricSharedDropClassTh = _SHR_FABRIC_SHARED_DROP_CLASS_TH, 1978 bcmFabricSharedMcCopiesDropPrioTh = _SHR_FABRIC_SHARED_MC_COPIES_DROP_PRIO_TH, 1979 bcmFabricMidFragDropClassTh = _SHR_FABRIC_MID_FRAG_DROP_CLASS_TH, 1980 bcmFabricSharedBankMcDropPrioTh = _SHR_FABRIC_SHARED_BANK_MC_DROP_PRIO_TH, /* DTL Admission Thresholds */ 1981 bcmFabricTxTagDropClassTh = _SHR_FABRIC_TX_TAG_DROP_CLASS_TH, 1982 bcmFabricTxFragDropClassTh = _SHR_FABRIC_TX_FRAG_DROP_CLASS_TH, 1983 bcmFabricTxTagGciPipeTh = _SHR_FABRIC_TX_TAG_GCI_PIPE_TH, /* GCI Generation */ 1984 bcmFabricTxFragGciPipeTh = _SHR_FABRIC_TX_FRAG_GCI_PIPE_TH, 1985 bcmFabricMidTagGciPipeTh = _SHR_FABRIC_MID_TAG_GCI_PIPE_TH, 1986 bcmFabricMidFragGciPipeTh = _SHR_FABRIC_MID_FRAG_GCI_PIPE_TH, 1987 bcmFabricSharedGciPipeTh = _SHR_FABRIC_SHARED_GCI_PIPE_TH, 1988 bcmFabricSharedFragCopiesGciPipeTh = _SHR_FABRIC_SHARED_FRAG_COPIES_GCI_PIPE_TH, 1989 bcmFabricTxFragGuaranteedRciPipeTh = _SHR_FABRIC_TX_FRAG_GUARANTEED_RCI_PIPE_TH, /* RCI Generation */ 1990 bcmFabricTxLinkLoadRciPipeTh = _SHR_FABRIC_TX_LINK_LOAD_RCI_PIPE_TH, 1991 bcmFabricTxTagRciPipeTh = _SHR_FABRIC_TX_TAG_RCI_PIPE_TH, 1992 bcmFabricTxFragRciPipeTh = _SHR_FABRIC_TX_FRAG_RCI_PIPE_TH, 1993 bcmFabricMidTagRciPipeTh = _SHR_FABRIC_MID_TAG_RCI_PIPE_TH, 1994 bcmFabricMidFragRciPipeTh = _SHR_FABRIC_MID_FRAG_RCI_PIPE_TH, 1995 bcmFabricSharedRciPipeTh = _SHR_FABRIC_SHARED_RCI_PIPE_TH, 1996 bcmFabricMidMcCopiesFcPrioTh = _SHR_FABRIC_MID_MC_COPIES_FC_PRIO_TH, /* FC Generation */ 1997 bcmFabricMidTagFcPipeTh = _SHR_FABRIC_MID_TAG_FC_PIPE_TH, 1998 bcmFabricMidFragFcPipeTh = _SHR_FABRIC_MID_FRAG_FC_PIPE_TH, 1999 bcmFabricSharedFcPipeTh = _SHR_FABRIC_SHARED_FC_PIPE_TH, 2000 bcmFabricTxTagFcPipeTh = _SHR_FABRIC_TX_TAG_FC_PIPE_TH, 2001 bcmFabricTxFragFcPipeTh = _SHR_FABRIC_TX_FRAG_FC_PIPE_TH, 2002 bcmFabricMidMaskFcPipeTh = _SHR_FABRIC_MID_MASK_FC_PIPE_TH, 2003 bcmFabricTxFE1BypassLLFCFcPipeTh = _SHR_FABRIC_TX_FE1_BYPASS_LLFCFC_PIPE_TH, 2004 bcmFabricRxFragDropPipeTh = _SHR_FABRIC_RX_FRAG_DROP_PIPE_TH, /* DCH Legacy Thresholds */ 2005 bcmFabricRxMcLowPrioDropPipeTh = _SHR_FABRIC_RX_MC_LOW_PRIO_DROP_PIPE_TH, 2006 bcmFabricRxFragGciPipeTh = _SHR_FABRIC_RX_FRAG_GCI_PIPE_TH, 2007 bcmFabricRxLLFCFcPipeTh = _SHR_FABRIC_RX_LLFCFC_PIPE_TH, 2008 bcmFabricRxWfqDynamicWeightPipeTh = _SHR_FABRIC_RX_WFQ_DYNAMIC_WEIGHT_PIPE_TH, /* Dynamic weights */ 2009 bcmFabricMidWfqDynamicWeightPipeTh = _SHR_FABRIC_MID_WFQ_DYNAMIC_WEIGHT_PIPE_TH, 2010 bcmFabricTxWfqDynamicWeightPipeTh = _SHR_FABRIC_TX_WFQ_DYNAMIC_WEIGHT_PIPE_TH 2011 } bcm_fabric_threshold_type_t; 2012 2013 /* Fabric threshold ID */ 2014 typedef uint32 bcm_fabric_threshold_id_t; 2015 2016 #ifndef BCM_HIDE_DISPATCHABLE 2017 2018 /* Configure all fabric flow control and drop thresholds. */ 2019 extern int bcm_fabric_profile_threshold_set( 2020 int unit, 2021 int profile_id, 2022 bcm_fabric_threshold_id_t threshold_id, 2023 bcm_fabric_threshold_type_t threshold_type, 2024 uint32 flags, 2025 int value); 2026 2027 /* Configure all fabric flow control and drop thresholds. */ 2028 extern int bcm_fabric_profile_threshold_get( 2029 int unit, 2030 int profile_id, 2031 bcm_fabric_threshold_id_t threshold_id, 2032 bcm_fabric_threshold_type_t threshold_type, 2033 uint32 flags, 2034 int *value); 2035 2036 #endif /* BCM_HIDE_DISPATCHABLE */ 2037 2038 /* Threshold indication flags for modifying only special sets of links. */ 2039 #define BCM_FABRIC_LINK_TH_LR_ONLY _BCM_FABRIC_LINK_TH_LR_ONLY 2040 #define BCM_FABRIC_LINK_TH_NLR_ONLY _BCM_FABRIC_LINK_TH_NLR_ONLY 2041 2042 /* Threshold special selectors for all priorities and all levels. */ 2043 #define BCM_FABRIC_PRIO_ALL -1 2044 #define BCM_FABRIC_LEVEL_ALL -1 2045 2046 #define BCM_FABRIC_TH_INDEX_PIPE_LEVEL_SET(pipe, level) _SHR_FABRIC_TH_INDEX_PIPE_LEVEL_SET(pipe, level) 2047 #define BCM_FABRIC_TH_INDEX_CAST_PRIO_SET(cast, prio) _SHR_FABRIC_TH_INDEX_CAST_PRIO_SET(cast, prio) 2048 #define BCM_FABRIC_TH_INDEX_FMC_SLOW_START_PHASE_SET(fmc_shaper, slow_start_phase) _SHR_FABRIC_TH_INDEX_FMC_SLOW_START_PHASE_SET(fmc_shaper, slow_start_phase) 2049 2050 #ifndef BCM_HIDE_DISPATCHABLE 2051 2052 /* The following API associate links with profile (0,1). */ 2053 extern int bcm_fabric_link_profile_set( 2054 int unit, 2055 int profile_id, 2056 uint32 flags, 2057 uint32 links_count, 2058 bcm_port_t *links); 2059 2060 /* The following API retrieves the threshold profile for given links. */ 2061 extern int bcm_fabric_link_profile_get( 2062 int unit, 2063 int profile_id, 2064 uint32 flags, 2065 uint32 links_count_max, 2066 uint32 *links_count, 2067 bcm_port_t *links); 2068 2069 #endif /* BCM_HIDE_DISPATCHABLE */ 2070 2071 /* Selector for configuring all pipes */ 2072 #define BCM_FABRIC_PIPE_ALL _SHR_FABRIC_PIPE_ALL 2073 2074 #ifndef BCM_HIDE_DISPATCHABLE 2075 2076 /* Enables MC local route for multiple MC groups. */ 2077 extern int bcm_fabric_multicast_local_route_set( 2078 int unit, 2079 uint32 flags, 2080 uint32 nof_groups, 2081 bcm_multicast_t *groups, 2082 int *enable); 2083 2084 /* Get MC local route state for multiple MC groups. */ 2085 extern int bcm_fabric_multicast_local_route_get( 2086 int unit, 2087 uint32 flags, 2088 uint32 nof_groups, 2089 bcm_multicast_t *groups, 2090 int *enable); 2091 2092 #endif /* BCM_HIDE_DISPATCHABLE */ 2093 2094 /* Fabric cell header field types. */ 2095 typedef enum bcm_fabric_cell_header_field_type_e { 2096 bcmFabricCellHeaderFieldTypeSourceDevice = _shr_dnxc_fabric_cell_header_field_type_source_device, /* Fabric cell header field type 2097 fip/source device unit ID. */ 2098 bcmFabricCellHeaderFieldTypeFIPLink = _shr_dnxc_fabric_cell_header_field_type_fip_link, /* Fabric cell header field type fip 2099 link. */ 2100 bcmFabricCellHeaderFieldTypePipe = _shr_dnxc_fabric_cell_header_field_type_pipe, /* Fabric cell header field type pipe. */ 2101 bcmFabricCellHeaderFieldTypeNof = _shr_dnxc_fabric_cell_header_field_type_nof /* Number of fabric cell header field 2102 types exposed. */ 2103 } bcm_fabric_cell_header_field_type_t; 2104 2105 /* Allowed flags for bcm_fabric_route_rx API */ 2106 #define BCM_FABRIC_CELL_RX_HEADER_PREPEND _SHR_FABRIC_CELL_RX_HEADER_PREPEND 2107 2108 /* Fabric topology type. */ 2109 typedef enum bcm_fabric_topology_type_e { 2110 bcmFabricTopologyLB = 0, /* Load balancing topology. */ 2111 bcmFabricTopologyMC = 1, /* Multicast topology. */ 2112 bcmFabricTopologyAll = 2 /* All. */ 2113 } bcm_fabric_topology_type_t; 2114 2115 #ifndef BCM_HIDE_DISPATCHABLE 2116 2117 /* Configure links topology. */ 2118 extern int bcm_fabric_link_topology_config_set( 2119 int unit, 2120 uint32 flags, 2121 bcm_module_t destination, 2122 bcm_fabric_topology_type_t type, 2123 int links_count, 2124 bcm_port_t *links_array); 2125 2126 /* Get the configured links topology. */ 2127 extern int bcm_fabric_link_topology_config_get( 2128 int unit, 2129 uint32 flags, 2130 bcm_module_t destination, 2131 bcm_fabric_topology_type_t type, 2132 int links_count_max, 2133 int *links_count, 2134 bcm_port_t *links_array); 2135 2136 #endif /* BCM_HIDE_DISPATCHABLE */ 2137 2138 typedef struct bcm_fabric_rci_resolution_key_s { 2139 int pipe; 2140 uint32 shared_rci; 2141 uint32 guaranteed_rci; 2142 } bcm_fabric_rci_resolution_key_t; 2143 2144 typedef struct bcm_fabric_rci_resolution_config_s { 2145 uint32 resolved_rci; 2146 } bcm_fabric_rci_resolution_config_t; 2147 2148 #ifndef BCM_HIDE_DISPATCHABLE 2149 2150 extern int bcm_fabric_rci_resolution_set( 2151 int unit, 2152 uint32 flags, 2153 bcm_fabric_rci_resolution_key_t *key, 2154 bcm_fabric_rci_resolution_config_t *config); 2155 2156 extern int bcm_fabric_rci_resolution_get( 2157 int unit, 2158 uint32 flags, 2159 bcm_fabric_rci_resolution_key_t *key, 2160 bcm_fabric_rci_resolution_config_t *config); 2161 2162 #endif /* BCM_HIDE_DISPATCHABLE */ 2163 2164 /* RCI throttling mode */ 2165 typedef enum bcm_fabric_control_rci_throttling_mode_e { 2166 bcmFabricControlRciThrottlingModeGlobal = 0, /* Global(default) mode with no Biasing */ 2167 bcmFabricControlRciThrottlingModeDeviceBiasing = 1, /* Device-Biasing mode */ 2168 bcmFabricControlRciThrottlingModeFlowBiasing = 2 /* Flow-Biasing mode */ 2169 } bcm_fabric_control_rci_throttling_mode_t; 2170 2171 /* RCI throttling probability mode */ 2172 typedef enum bcm_fabric_rci_biasing_probability_mode_e { 2173 bcmFabricRciDevBiasingModeDiscard = 0, /* Device-Biasing Discard probability */ 2174 bcmFabricRciDevBiasingModeReplicate = 1, /* Device-Biasing Replicate probability */ 2175 bcmFabricRciFlowBiasingModeUninstall = 2 /* Flow-Biasing Uninstall probability */ 2176 } bcm_fabric_rci_biasing_probability_mode_t; 2177 2178 /* Hold the RCI throttling profile info */ 2179 typedef struct bcm_fabric_rci_biasing_probability_info_s { 2180 bcm_gport_t gport; /* Target gport, for core and future 2181 use. */ 2182 int is_remote; /* For local or fabric (remote) flows. */ 2183 int is_high_prio; /* For high or low priority flows. */ 2184 bcm_fabric_rci_biasing_probability_mode_t probability_type; /* Probability type see . */ 2185 } bcm_fabric_rci_biasing_probability_info_t; 2186 2187 #ifndef BCM_HIDE_DISPATCHABLE 2188 2189 /* API for managing RCI mechanism probabilities info */ 2190 extern int bcm_fabric_rci_biasing_probability_set( 2191 int unit, 2192 uint32 flags, 2193 bcm_fabric_rci_biasing_probability_info_t *probability_info, 2194 int probability[BCM_FABRIC_NUM_OF_RCI_LEVELS]); 2195 2196 /* API for managing RCI mechanism probabilities info */ 2197 extern int bcm_fabric_rci_biasing_probability_get( 2198 int unit, 2199 uint32 flags, 2200 bcm_fabric_rci_biasing_probability_info_t *probability_info, 2201 int probability[BCM_FABRIC_NUM_OF_RCI_LEVELS]); 2202 2203 #endif /* BCM_HIDE_DISPATCHABLE */ 2204 2205 /* 2206 * LCI shaper modes, allowed values to: bcm_fabric_cgm_control_set(unit, 2207 * flags, bcmFabricCgmLciShaperMode, control_id, value) 2208 */ 2209 #define BCM_FABRIC_CGM_LCI_SHAPER_MODE_DYNAMIC 0 2210 #define BCM_FABRIC_CGM_LCI_SHAPER_MODE_STATIC 1 2211 2212 /* Fabric CGM controls types */ 2213 typedef enum bcm_fabric_cgm_control_type_e { 2214 bcmFabricCgmRciLinkPipeLevelTh = 0, /* RCI controls */ 2215 bcmFabricCgmRciEgressPipeLevelTh = 1, 2216 bcmFabricCgmRciTotalEgressPipeLevelTh = 2, 2217 bcmFabricCgmRciLocalLevelTh = 3, 2218 bcmFabricCgmRciTotalLocalLevelTh = 4, 2219 bcmFabricCgmRciLinkLevelFactor = 5, 2220 bcmFabricCgmRciEgressLevelFactor = 6, 2221 bcmFabricCgmRciHighSeverityMinLinksParam = 7, 2222 bcmFabricCgmRciHighSeverityFactor = 8, 2223 bcmFabricCgmRciCoreLevelMappingTh = 9, 2224 bcmFabricCgmRciDeviceLevelMappingTh = 10, 2225 bcmFabricCgmGciLeakyBucketEn = 11, 2226 bcmFabricCgmGciLeakyBucketSizeLeakyBucketTh = 12, 2227 bcmFabricCgmGciLeakyBucketFCLeakyBucketTh = 13, 2228 bcmFabricCgmGciBackoffEn = 14, 2229 bcmFabricCgmGciBackoffLevelTh = 15, 2230 bcmFabricCgmSlowStartEn = 16, 2231 bcmFabricCgmSlowStartRateShaperPhaseParam = 17, 2232 bcmFabricCgmLlfcPipeTh = 18, 2233 bcmFabricCgmDropFabricClassTh = 19, 2234 bcmFabricCgmDropMeshMcPriorityTh = 20, 2235 bcmFabricCgmEgressDropTdmLatencyEn = 21, 2236 bcmFabricCgmEgressDropTdmLatencyTh = 22, 2237 bcmFabricCgmEgressDropMcLowPrioEn = 23, 2238 bcmFabricCgmEgressDropMcLowPrioTh = 24, 2239 bcmFabricCgmEgressDropMcLowPrioSelect = 25, 2240 bcmFabricCgmFcIngressTh = 26, 2241 bcmFabricCgmEgressDynamicWfqTh = 27, 2242 bcmFabricCgmLciShaperMode = 28, 2243 bcmFabricCgmLciShaperStaticRateInGbps = 29, 2244 bcmFabricCgmNof = 30 2245 } bcm_fabric_cgm_control_type_t; 2246 2247 /* Fabric CGM control index */ 2248 typedef uint32 bcm_fabric_cgm_control_id_t; 2249 2250 #ifndef BCM_HIDE_DISPATCHABLE 2251 2252 /* Configure Fabric CGM. */ 2253 extern int bcm_fabric_cgm_control_set( 2254 int unit, 2255 uint32 flags, 2256 bcm_fabric_cgm_control_type_t control_type, 2257 bcm_fabric_cgm_control_id_t control_id, 2258 int value); 2259 2260 /* Configure Fabric CGM. */ 2261 extern int bcm_fabric_cgm_control_get( 2262 int unit, 2263 uint32 flags, 2264 bcm_fabric_cgm_control_type_t control_type, 2265 bcm_fabric_cgm_control_id_t control_id, 2266 int *value); 2267 2268 #endif /* BCM_HIDE_DISPATCHABLE */ 2269 2270 #define BCM_FABRIC_STAT_INDEX_DEVICE_SET _SHR_FABRIC_STAT_INDEX_DEVICE_SET() 2271 #define BCM_FABRIC_STAT_INDEX_LINK_SET(link) _SHR_FABRIC_STAT_INDEX_LINK_SET(link) 2272 #define BCM_FABRIC_STAT_INDEX_LINK_PIPE_SET(link, pipe) _SHR_FABRIC_STAT_INDEX_LINK_PIPE_SET(link,pipe) 2273 2274 /* Fabric stat counter types */ 2275 typedef enum bcm_fabric_stat_e { 2276 bcmFabricStatDeviceReachDrop = 0, /* Device Reachability drop counter */ 2277 bcmFabricStatDeviceGlobalDrop = 1, /* Device Global drop counter */ 2278 bcmFabricStatQueueLinkPipeCurrOccupancyBytes = 2, /* Current occupancy, per link and pipe 2279 in bytes */ 2280 bcmFabricStatQueueLinkMaxWmkLevel = 3, /* RCI watermark level per link */ 2281 bcmFabricStatDeviceRciWmkLvl = 4, /* Device Max RCI level */ 2282 bcmFabricStatNof = 5 2283 } bcm_fabric_stat_t; 2284 2285 /* Fabric stat index */ 2286 typedef uint32 bcm_fabric_stat_index_t; 2287 2288 #ifndef BCM_HIDE_DISPATCHABLE 2289 2290 /* Get SAI Fabric counters. */ 2291 extern int bcm_fabric_stat_get( 2292 int unit, 2293 uint32 flags, 2294 bcm_fabric_stat_index_t index, 2295 bcm_fabric_stat_t stat, 2296 uint64 *value); 2297 2298 #endif /* BCM_HIDE_DISPATCHABLE */ 2299 2300 #endif /* __BCM_FABRIC_H__ */