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

stack.h (17025B)


      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_STACK_H__
     14 #define __BCM_STACK_H__
     15 
     16 #include <bcm/types.h>
     17 
     18 #define BCM_STK_MAX_MODULES                 (72)       /* Maximum number of
     19                                                           modules in stack. */
     20 #define BCM_STK_MODULE_MAX_ALL_REACHABLE    (0x1)      /* All Reachable flag for
     21                                                           stack module max. */
     22 
     23 /* module protocols indicate module communication types */
     24 typedef enum bcm_module_protocol_e {
     25     bcmModuleProtocolNone = 1, 
     26     bcmModuleProtocol1 = 2,         /* QE20 protocol - plane A */
     27     bcmModuleProtocol2 = 3,         /* QE20 protocol - plane B */
     28     bcmModuleProtocol3 = 4,         /* QE40 protocol - A/B */
     29     bcmModuleProtocol4 = 5,         /* QE40 protocol - A fic B local */
     30     bcmModuleProtocol5 = 6,         /* QE40 protocol - A fic */
     31     bcmModuleProtocolCustom1 = 7    /* Custom Device Protocol - A/B */
     32 } bcm_module_protocol_t;
     33 
     34 /* bcm_stk_module_control_t */
     35 typedef enum bcm_stk_module_control_e {
     36     bcmStkModuleAllReachableIgnore = 0, /* Ignore a MODULE ID during all
     37                                            reachable vector calculation */
     38     bcmStkModuleMHPriorityUse = 1       /* Use the Priority/Color from the
     39                                            Module Header */
     40 } bcm_stk_module_control_t;
     41 
     42 #ifndef BCM_HIDE_DISPATCHABLE
     43 
     44 /* Initialize the Stack Control subsystem. */
     45 extern int bcm_stk_init(
     46     int unit);
     47 
     48 /* Gets the list of ports currently in SL stack mode. */
     49 extern int bcm_stk_pbmp_get(
     50     int unit, 
     51     bcm_pbmp_t *cur_pbm, 
     52     bcm_pbmp_t *inactive_pbm);
     53 
     54 /* Set/Get SL stack flags for a port. */
     55 extern int bcm_stk_port_set(
     56     int unit, 
     57     bcm_port_t port, 
     58     uint32 flags);
     59 
     60 /* Set/Get SL stack flags for a port. */
     61 extern int bcm_stk_port_get(
     62     int unit, 
     63     bcm_port_t port, 
     64     uint32 *flags);
     65 
     66 #endif /* BCM_HIDE_DISPATCHABLE */
     67 
     68 /* bcm_stk_cb_f */
     69 typedef void (*bcm_stk_cb_f)(
     70     int unit, 
     71     bcm_port_t port, 
     72     uint32 flags, 
     73     void *cookie);
     74 
     75 #ifndef BCM_HIDE_DISPATCHABLE
     76 
     77 /* Register a function for stack port updates. */
     78 extern int bcm_stk_update_callback_register(
     79     int unit, 
     80     bcm_stk_cb_f cb, 
     81     void *cookie);
     82 
     83 /* Unregister a function for stack port updates. */
     84 extern int bcm_stk_update_callback_unregister(
     85     int unit, 
     86     bcm_stk_cb_f cb, 
     87     void *cookie);
     88 
     89 #endif /* BCM_HIDE_DISPATCHABLE */
     90 
     91 /* Flags for bcm_stk_port_set/get. */
     92 #define BCM_STK_CAPABLE         0x00000001 /* The port is stack capable, but may
     93                                               not be stacked currently (e.g.
     94                                               Dynamic SL front panel). */
     95 #define BCM_STK_ENABLE          0x00000002 /* The port is in stacking mode. */
     96 #define BCM_STK_INACTIVE        0x00000004 /* Explicitly set inactive to avoid
     97                                               undirected traffic to flow on this
     98                                               link. */
     99 #define BCM_STK_DUPLEX          0x00000008 /* This is a duplex connection. */
    100 #define BCM_STK_SIMPLEX         0x00000010 /* This is a simplex connection
    101                                               (exclusive to _DUPLEX) */
    102 #define BCM_STK_NONE            0x00000020 /* Not a stackable port (currently
    103                                               ignored). */
    104 #define BCM_STK_SL              0x00000040 /* Port is an SL (front panel) stack
    105                                               port (currently ignored). */
    106 #define BCM_STK_HG              0x00000080 /* Port is a HiGig stack port
    107                                               (currently ignored). */
    108 #define BCM_STK_INTERNAL        0x00000100 /* Port is an on-board device
    109                                               connection (set only; currently
    110                                               ignored). */
    111 #define BCM_STK_NO_LINK         0x00000200 /* Port does not have link. Not
    112                                               recorded; provided for callbacks.
    113                                               (set only; currently ignored). */
    114 #define BCM_STK_CUT             0x00000400 /* Port is a "cut" port that blocks
    115                                               multicast and broadcast traffic.
    116                                               (currently ignored). */
    117 #define BCM_STK_FLAGS_MASK      0x000007ff 
    118 
    119 #define BCM_STK_FLAGS_STR       \
    120 { \
    121     "capable", \
    122     "enable", \
    123     "inactive", \
    124     "duplex", \
    125     "simplex", \
    126     "none", \
    127     "sl", \
    128     "hg", \
    129     "internal", \
    130     "no_link", \
    131     "cut", \
    132     "" \
    133 } 
    134 
    135 /* bcm_stk_flags_str */
    136 extern char *bcm_stk_flags_str[];
    137 
    138 /* 
    139  * Pass this as the port parameter to set/get to use the unique IPIC_PORT
    140  * if present.
    141  */
    142 #define BCM_STK_USE_HG_IF       -1         
    143 
    144 #ifndef BCM_HIDE_DISPATCHABLE
    145 
    146 /* Set/Get SL stack mode status. */
    147 extern int bcm_stk_mode_set(
    148     int unit, 
    149     uint32 flags);
    150 
    151 /* Set/Get SL stack mode status. */
    152 extern int bcm_stk_mode_get(
    153     int unit, 
    154     uint32 *flags);
    155 
    156 /* Get or set the module ID of the local device. */
    157 extern int bcm_stk_my_modid_set(
    158     int unit, 
    159     int my_modid);
    160 
    161 /* Get or set the module ID of the local device. */
    162 extern int bcm_stk_my_modid_get(
    163     int unit, 
    164     int *my_modid);
    165 
    166 /* Get or set the module ID of the local device. */
    167 extern int bcm_stk_modid_set(
    168     int unit, 
    169     int modid);
    170 
    171 /* Get or set the module ID of the local device. */
    172 extern int bcm_stk_modid_get(
    173     int unit, 
    174     int *modid);
    175 
    176 #endif /* BCM_HIDE_DISPATCHABLE */
    177 
    178 /* module ID types */
    179 typedef enum bcm_stk_modid_type_e {
    180     bcmStkModidTypePrimary = 0,         /* primary module IDs */
    181     bcmStkModidTypeMultiNextHops = 1,   /* multiple next hops module IDs */
    182     bcmStkModidTypeCoe = 2              /* COE module IDs */
    183 } bcm_stk_modid_type_t;
    184 
    185 /* Structure for the configuration of the module. */
    186 typedef struct bcm_stk_modid_config_s {
    187     uint32 flags; 
    188     int modid; 
    189     int num_ports; 
    190     bcm_stk_modid_type_t modid_type; 
    191     int num_mods; 
    192 } bcm_stk_modid_config_t;
    193 
    194 /* bcm_stk_modid_config_t_init */
    195 extern void bcm_stk_modid_config_t_init(
    196     bcm_stk_modid_config_t *pconfig);
    197 
    198 #ifndef BCM_HIDE_DISPATCHABLE
    199 
    200 /* Sets the module id of the local device. */
    201 extern int bcm_stk_modid_config_set(
    202     int unit, 
    203     bcm_stk_modid_config_t *modid);
    204 
    205 /* Gets the module id of the local device. */
    206 extern int bcm_stk_modid_config_get(
    207     int unit, 
    208     bcm_stk_modid_config_t *modid);
    209 
    210 /* Adds the module id to the local device. */
    211 extern int bcm_stk_modid_config_add(
    212     int unit, 
    213     bcm_stk_modid_config_t *modid);
    214 
    215 /* Deletes the module id of the local device. */
    216 extern int bcm_stk_modid_config_delete(
    217     int unit, 
    218     bcm_stk_modid_config_t *modid);
    219 
    220 /* Deletes all the module ids added on the local device. */
    221 extern int bcm_stk_modid_config_delete_all(
    222     int unit);
    223 
    224 /* Gets all the module ids added on the local device. */
    225 extern int bcm_stk_modid_config_get_all(
    226     int unit, 
    227     int modid_max, 
    228     bcm_stk_modid_config_t *modid_array, 
    229     int *modid_count);
    230 
    231 /* Number of module identifiers used by device. */
    232 extern int bcm_stk_modid_count(
    233     int unit, 
    234     int *num_modid);
    235 
    236 /* Control module steering. */
    237 extern int bcm_stk_modport_set(
    238     int unit, 
    239     int modid, 
    240     int port);
    241 
    242 /* Control module steering. */
    243 extern int bcm_stk_modport_get(
    244     int unit, 
    245     int modid, 
    246     int *port);
    247 
    248 /* Get all ports in MODPORT entry for modid. */
    249 extern int bcm_stk_modport_get_all(
    250     int unit, 
    251     int modid, 
    252     int port_max, 
    253     int *port_array, 
    254     int *port_count);
    255 
    256 /* Clear module steering. */
    257 extern int bcm_stk_modport_clear(
    258     int unit, 
    259     int modid);
    260 
    261 /* Clear module steering. */
    262 extern int bcm_stk_modport_clear_all(
    263     int unit);
    264 
    265 /* Add or delete more than one path for a given destination module. */
    266 extern int bcm_stk_modport_add(
    267     int unit, 
    268     int modid, 
    269     bcm_port_t port);
    270 
    271 /* Add or delete more than one path for a given destination module. */
    272 extern int bcm_stk_modport_delete(
    273     int unit, 
    274     int modid, 
    275     bcm_port_t port);
    276 
    277 /* 
    278  * Set a destination path for a given destination module of the ingress
    279  * port.
    280  */
    281 extern int bcm_stk_port_modport_set(
    282     int unit, 
    283     bcm_port_t ing_port, 
    284     bcm_module_t dest_modid, 
    285     bcm_port_t dest_port);
    286 
    287 /* 
    288  * Get a destination path for a given destination module of the ingress
    289  * port.
    290  */
    291 extern int bcm_stk_port_modport_get(
    292     int unit, 
    293     bcm_port_t ing_port, 
    294     bcm_module_t dest_modid, 
    295     bcm_port_t *dest_port);
    296 
    297 /* 
    298  * Get all destination paths for a given destination module of the
    299  * ingress port.
    300  */
    301 extern int bcm_stk_port_modport_get_all(
    302     int unit, 
    303     bcm_port_t ing_port, 
    304     bcm_module_t dest_modid, 
    305     int dest_port_max, 
    306     bcm_port_t *dest_port_array, 
    307     int *dest_port_count);
    308 
    309 /* 
    310  * Clear all destination paths for a given destination module of the
    311  * ingress port.
    312  */
    313 extern int bcm_stk_port_modport_clear(
    314     int unit, 
    315     bcm_port_t ing_port, 
    316     bcm_module_t dest_modid);
    317 
    318 /* 
    319  * Clear destination paths for all destination modules of the ingress
    320  * port.
    321  */
    322 extern int bcm_stk_port_modport_clear_all(
    323     int unit, 
    324     bcm_port_t ing_port);
    325 
    326 /* Add one path for a given destination module of the ingress port. */
    327 extern int bcm_stk_port_modport_add(
    328     int unit, 
    329     bcm_port_t ing_port, 
    330     bcm_module_t dest_modid, 
    331     bcm_port_t dest_port);
    332 
    333 /* Delete one path for a given destination module of the ingress port. */
    334 extern int bcm_stk_port_modport_delete(
    335     int unit, 
    336     bcm_port_t ing_port, 
    337     bcm_module_t dest_modid, 
    338     bcm_port_t dest_port);
    339 
    340 /* Set, get, or delete Fabric unicast table entries. */
    341 extern int bcm_stk_ucbitmap_set(
    342     int unit, 
    343     int port, 
    344     int modid, 
    345     bcm_pbmp_t pbmp);
    346 
    347 /* Set, get, or delete Fabric unicast table entries. */
    348 extern int bcm_stk_ucbitmap_get(
    349     int unit, 
    350     int port, 
    351     int modid, 
    352     bcm_pbmp_t *pbmp);
    353 
    354 /* Set, get, or delete Fabric unicast table entries. */
    355 extern int bcm_stk_ucbitmap_del(
    356     int unit, 
    357     bcm_port_t port, 
    358     int modid, 
    359     bcm_pbmp_t pbmp);
    360 
    361 /* Set or get a fabric mapping between fabric and local space. */
    362 extern int bcm_stk_fmod_lmod_mapping_set(
    363     int unit, 
    364     bcm_port_t port, 
    365     bcm_module_t fmod, 
    366     bcm_module_t lmod);
    367 
    368 /* Set or get a fabric mapping between fabric and local space. */
    369 extern int bcm_stk_fmod_lmod_mapping_get(
    370     int unit, 
    371     bcm_port_t port, 
    372     bcm_module_t *fmod, 
    373     bcm_module_t *lmod);
    374 
    375 /* Set or get a fabric mapping between fabric and switch space. */
    376 extern int bcm_stk_fmod_smod_mapping_set(
    377     int unit, 
    378     bcm_port_t port, 
    379     bcm_module_t fmod, 
    380     bcm_module_t smod, 
    381     bcm_port_t sport, 
    382     uint32 nports);
    383 
    384 /* Set or get a fabric mapping between fabric and switch space. */
    385 extern int bcm_stk_fmod_smod_mapping_get(
    386     int unit, 
    387     bcm_port_t port, 
    388     bcm_module_t fmod, 
    389     bcm_module_t *smod, 
    390     bcm_port_t *sport, 
    391     uint32 *nports);
    392 
    393 /* Assign or get fabric port to a module mapping group. */
    394 extern int bcm_stk_port_modmap_group_set(
    395     int unit, 
    396     bcm_port_t port, 
    397     int group);
    398 
    399 /* Assign or get fabric port to a module mapping group. */
    400 extern int bcm_stk_port_modmap_group_get(
    401     int unit, 
    402     bcm_port_t port, 
    403     int *group);
    404 
    405 /* Retrieve the maximum module mapping group on a fabric. */
    406 extern int bcm_stk_port_modmap_group_max_get(
    407     int unit, 
    408     int *max_group);
    409 
    410 /* Enable/Disable or get module mapping on a fabric port. */
    411 extern int bcm_stk_modmap_enable_set(
    412     int unit, 
    413     bcm_port_t port, 
    414     int enable);
    415 
    416 /* Enable/Disable or get module mapping on a fabric port. */
    417 extern int bcm_stk_modmap_enable_get(
    418     int unit, 
    419     bcm_port_t port, 
    420     int *enable);
    421 
    422 #endif /* BCM_HIDE_DISPATCHABLE */
    423 
    424 /* Switch module mapping. */
    425 #define BCM_STK_MODMAP_SET      1          /* Global to local. */
    426 #define BCM_STK_MODMAP_GET      2          /* Local to global. */
    427 
    428 /* bcm_stk_modmap_cb_t */
    429 typedef int (*bcm_stk_modmap_cb_t)(
    430     int unit, 
    431     int setget, 
    432     bcm_module_t mod_in, 
    433     bcm_port_t port_in, 
    434     bcm_module_t *mod_out, 
    435     bcm_port_t *port_out);
    436 
    437 #ifndef BCM_HIDE_DISPATCHABLE
    438 
    439 /* Register a Module Mapping callback. */
    440 extern int bcm_stk_modmap_register(
    441     int unit, 
    442     bcm_stk_modmap_cb_t func);
    443 
    444 /* Register a Module Mapping callback. */
    445 extern int bcm_stk_modmap_unregister(
    446     int unit);
    447 
    448 /* Map or unmap a module identifier. */
    449 extern int bcm_stk_modmap_map(
    450     int unit, 
    451     int setget, 
    452     bcm_module_t mod_in, 
    453     bcm_port_t port_in, 
    454     bcm_module_t *mod_out, 
    455     bcm_port_t *port_out);
    456 
    457 /* 
    458  * Enable or disable arbitration and failover/redundancy algorithm for
    459  * the module
    460  */
    461 extern int bcm_stk_module_enable(
    462     int unit, 
    463     bcm_module_t modid, 
    464     int nports, 
    465     int enable);
    466 
    467 /* Map a System-Port to a Gport */
    468 extern int bcm_stk_sysport_gport_set(
    469     int unit, 
    470     bcm_gport_t sysport, 
    471     bcm_gport_t gport);
    472 
    473 /* Given a System-Port get the Gport */
    474 extern int bcm_stk_sysport_gport_get(
    475     int unit, 
    476     bcm_gport_t sysport, 
    477     bcm_gport_t *gport);
    478 
    479 /* Given a Gport get the System-Port */
    480 extern int bcm_stk_gport_sysport_get(
    481     int unit, 
    482     bcm_gport_t gport, 
    483     bcm_gport_t *sysport);
    484 
    485 /* Define modid in each TM-domain */
    486 extern int bcm_stk_modid_domain_add(
    487     int unit, 
    488     int modid, 
    489     int tm_domain);
    490 
    491 /* Delete modid from TM-domain */
    492 extern int bcm_stk_modid_domain_delete(
    493     int unit, 
    494     int modid, 
    495     int tm_domain);
    496 
    497 /* Get array of modid in a given TM-domain */
    498 extern int bcm_stk_modid_domain_get(
    499     int unit, 
    500     int tm_domain, 
    501     int mod_max, 
    502     int *mod_array, 
    503     int *mod_count);
    504 
    505 /* Define which TM-domain can be reachable by a stacking trunk */
    506 extern int bcm_stk_domain_stk_trunk_add(
    507     int unit, 
    508     int tm_domain, 
    509     bcm_trunk_t stk_trunk);
    510 
    511 /* Delete a path from stacking trunk to TM-domain */
    512 extern int bcm_stk_domain_stk_trunk_delete(
    513     int unit, 
    514     int tm_domain, 
    515     bcm_trunk_t stk_trunk);
    516 
    517 /* Get array of domains reached by a given stacking trunk */
    518 extern int bcm_stk_domain_stk_trunk_get(
    519     int unit, 
    520     bcm_trunk_t stk_trunk, 
    521     int domain_max, 
    522     int *domain_array, 
    523     int *domain_count);
    524 
    525 #endif /* BCM_HIDE_DISPATCHABLE */
    526 
    527 /* Flags for bcm_stk_system_gport_map_create/get/destroy. */
    528 #define BCM_STK_GPORT_MAP_WITH_ID   0x00000001 /* Add mapping with the specified
    529                                                   ID. */
    530 #define BCM_STK_GPORT_MAP_REPLACE   0x00000002 /* Replace existing mapping. */
    531 
    532 /* Structure for mapping gport to system port ID. */
    533 typedef struct bcm_stk_system_gport_map_s {
    534     uint32 flags; 
    535     bcm_module_t modid;         /* Destination module ID. */
    536     bcm_gport_t dest_gport;     /* Destination gport ID. */
    537     bcm_gport_t system_gport;   /* System gport ID */
    538 } bcm_stk_system_gport_map_t;
    539 
    540 #ifndef BCM_HIDE_DISPATCHABLE
    541 
    542 /* Create mapping from local gport id to system gport id */
    543 extern int bcm_stk_system_gport_map_create(
    544     int unit, 
    545     bcm_stk_system_gport_map_t *sys_gport_map);
    546 
    547 /* Get mapping from local gport id to system gport id */
    548 extern int bcm_stk_system_gport_map_get(
    549     int unit, 
    550     bcm_stk_system_gport_map_t *sys_gport_map);
    551 
    552 /* Destroy mapping from local gport id to system gport id */
    553 extern int bcm_stk_system_gport_map_destroy(
    554     int unit, 
    555     bcm_gport_t system_gport);
    556 
    557 /* Set remote mapping between local port and remote port, remote modid */
    558 extern int bcm_stk_modport_remote_map_set(
    559     int unit, 
    560     bcm_gport_t port, 
    561     uint32 flags, 
    562     int remote_modid, 
    563     bcm_port_t remote_port);
    564 
    565 /* Get remote mapping between local port and remote port, remote modid */
    566 extern int bcm_stk_modport_remote_map_get(
    567     int unit, 
    568     bcm_gport_t port, 
    569     uint32 flags, 
    570     int *remote_modid, 
    571     bcm_port_t *remote_port);
    572 
    573 /* Set maximum FAP ID for sending outgoing reachability cells */
    574 extern int bcm_stk_module_max_set(
    575     int unit, 
    576     uint32 flags, 
    577     bcm_module_t max_module);
    578 
    579 /* Get maximum FAP ID for sending outgoing reachability cells */
    580 extern int bcm_stk_module_max_get(
    581     int unit, 
    582     uint32 flags, 
    583     bcm_module_t *max_module);
    584 
    585 /* 
    586  * Set a specific MODULE-ID which will be excluded from the all reachable
    587  * calculation
    588  */
    589 extern int bcm_stk_module_control_set(
    590     int unit, 
    591     uint32 flags, 
    592     bcm_module_t module, 
    593     bcm_stk_module_control_t control, 
    594     int arg);
    595 
    596 /* 
    597  * Get a status for a MODULE-ID, regarding whether or not it is excluded
    598  * from all reachable vector calculation
    599  */
    600 extern int bcm_stk_module_control_get(
    601     int unit, 
    602     uint32 flags, 
    603     bcm_module_t module, 
    604     bcm_stk_module_control_t control, 
    605     int *arg);
    606 
    607 #endif /* BCM_HIDE_DISPATCHABLE */
    608 
    609 #endif /* __BCM_STACK_H__ */