openbcm

Git mirror of https://github.com/Broadcom-Network-Switching-Software/OpenBCM
git clone git://git.finwo.net/mirror/broadcom/openbcm
Log | Files | Refs | README

fabric.h (106313B)


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