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

brd_chassis_int.h (6094B)


      1 /* 
      2  * 
      3  * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file.
      4  * 
      5  * Copyright 2007-2019 Broadcom Inc. All rights reserved.
      6  *
      7  * File:        brd_chassis_int.h
      8  * Purpose:     Internal chassis support
      9  */
     10 
     11 #ifndef   _BRD_CHASSIS_INT_H_
     12 #define   _BRD_CHASSIS_INT_H_
     13 
     14 #include <appl/cpudb/cpudb.h>
     15 #include <appl/stktask/topology.h>
     16 
     17 #if defined(INCLUDE_CHASSIS)
     18 
     19 /* Chassis board programming */
     20 
     21 extern int chassis_ast_cfm_xgs2(topo_cpu_t *tp_cpu, cpudb_ref_t db_ref);
     22 extern int chassis_ast_xgs2_48g(topo_cpu_t *tp_cpu, cpudb_ref_t db_ref);
     23 extern int chassis_ast_xgs2_6x(topo_cpu_t *tp_cpu, cpudb_ref_t db_ref);
     24 extern int chassis_ast_xgs3_12x(topo_cpu_t *tp_cpu, cpudb_ref_t db_ref);
     25 extern int chassis_ast_xgs3_48g(topo_cpu_t *tp_cpu, cpudb_ref_t db_ref);
     26 extern int chassis_ast_cfm_xgs3(topo_cpu_t *tp_cpu, cpudb_ref_t db_ref);
     27 extern int chassis_ast_56800_12x(topo_cpu_t *tp_cpu, cpudb_ref_t db_ref);
     28 
     29 extern int chassis_smlb_cfm_xgs2(topo_cpu_t *tp_cpu, cpudb_ref_t db_ref);
     30 extern int chassis_smlb_xgs2_48g(topo_cpu_t *tp_cpu, cpudb_ref_t db_ref);
     31 extern int chassis_smlb_xgs2_6x(topo_cpu_t *tp_cpu, cpudb_ref_t db_ref);
     32 extern int chassis_smlb_xgs3_12x(topo_cpu_t *tp_cpu, cpudb_ref_t db_ref);
     33 extern int chassis_smlb_xgs3_48g(topo_cpu_t *tp_cpu, cpudb_ref_t db_ref);
     34 extern int chassis_smlb_cfm_xgs3(topo_cpu_t *tp_cpu, cpudb_ref_t db_ref);
     35 extern int chassis_smlb_56800_12x(topo_cpu_t *tp_cpu, cpudb_ref_t db_ref);
     36 
     37 extern int chassis_cfm_xgs2(topo_cpu_t *tp_cpu, cpudb_ref_t db_ref);
     38 extern int chassis_cfm_xgs3(topo_cpu_t *tp_cpu, cpudb_ref_t db_ref);
     39 extern int chassis_lm6x(topo_cpu_t *tp_cpu, cpudb_ref_t db_ref);
     40 extern int chassis_lm_xgs2_48g(topo_cpu_t *tp_cpu, cpudb_ref_t db_ref);
     41 extern int chassis_lm_xgs3_48g(topo_cpu_t *tp_cpu, cpudb_ref_t db_ref);
     42 extern int chassis_lm_xgs3_12x(topo_cpu_t *tp_cpu, cpudb_ref_t db_ref);
     43 extern int chassis_lm_56800_12x(topo_cpu_t *tp_cpu, cpudb_ref_t db_ref);
     44 
     45 /* Chassis common functions */
     46 
     47 #define LB_FLAGS (CPUDB_BASE_F_CHASSIS | \
     48                   CPUDB_BASE_F_LOAD_BALANCE | \
     49                   CPUDB_BASE_F_CHASSIS_AST)
     50 
     51 #define CHASSIS_AST(flag) ((flag & LB_FLAGS) == LB_FLAGS)
     52 
     53 #define CHASSIS_SM(flag)  ((flag & LB_FLAGS) == \
     54                           (CPUDB_BASE_F_CHASSIS | CPUDB_BASE_F_LOAD_BALANCE))
     55 
     56 
     57 /* Assumes CFM slot IDs are consecutive and less than LM slot IDs */
     58 #define NUM_CFM                 2
     59 #define NUM_LM                  8
     60 #define CFM_SLOT_OFFSET         0
     61 #define LM_SLOT_OFFSET         (CFM_SLOT_OFFSET + NUM_CFM)
     62 #define NUM_SLOT               (NUM_CFM + NUM_LM)
     63 
     64 #define MODIDS_PER_CFM          1
     65 #define MODIDS_PER_LM           6
     66 
     67 #define IS_CFM_SLOT(slot)      ((slot >= CFM_SLOT_OFFSET) \
     68                                && (slot < LM_SLOT_OFFSET))
     69 
     70 #define IS_LM_SLOT(slot)       ((slot >= LM_SLOT_OFFSET) \
     71                                && (slot < (LM_SLOT_OFFSET + NUM_LM)))
     72 
     73 #define LM_SLOT_ID             LM_SLOT_OFFSET
     74 
     75 typedef struct bcm_board_cfm_data_s {
     76     int          slot;       /* Slot id */
     77     bcm_module_t modid;      /* Mod id */
     78 } bcm_board_cfm_data_t;
     79 
     80 typedef struct bcm_board_cfm_info_s {
     81     int count;          /* Number of valid entries */
     82     int master;         /* Index of master info in cfm[] */
     83     int is_master;      /* True if caller is a CFM master */
     84     bcm_board_cfm_data_t cfm[NUM_CFM];
     85 } bcm_board_cfm_info_t;
     86 
     87 
     88 /* Map from slot-id to base module ID */
     89 extern int topo_chassis_slot_to_mod_base[NUM_SLOT];
     90 
     91 /* Get first mod-id on the given slot (CFM or LM) */
     92 #define MODID_OFFSET_GET(_slot)    (topo_chassis_slot_to_mod_base[_slot])
     93 
     94 /* Get number of mod-ids reserved for given slot (CFM or LM) */
     95 #define NUM_MODIDS_GET(_slot)  \
     96     ((IS_CFM_SLOT(_slot)) ? MODIDS_PER_CFM : MODIDS_PER_LM)
     97 
     98 /* Get CFM mod-id (only one) */
     99 #define CFM_MODID(_slot)     (MODID_OFFSET_GET(_slot))
    100 
    101 /* Iterate thru all LMs */
    102 #define FOREACH_LM_SLOT(_slot)    \
    103     for (_slot = LM_SLOT_OFFSET; _slot < NUM_SLOT; _slot++)
    104 
    105 /* Iterate thru mod-ids on the given slot (LM or CFM) */
    106 #define FOREACH_MODID(_slot, _modid)                                 \
    107     for (_modid = MODID_OFFSET_GET(_slot);                           \
    108          _modid < (MODID_OFFSET_GET(_slot) + NUM_MODIDS_GET(_slot)); \
    109          _modid++)
    110 
    111 /* Iterate thru mod-ids on all other LMs */
    112 #define FOREACH_OTHER_MODID(_this, _slot, _mod) \
    113     FOREACH_LM_SLOT(_slot)                      \
    114         if (_this != _slot)                     \
    115             FOREACH_MODID(_slot, _mod)
    116 
    117 
    118 typedef int (*modport_set_f) (int unit, int dst_modid, bcm_port_t stk_port);
    119 typedef int (*int_sp_set_f)  (int unit, int dst_unit, bcm_port_t stk_port);
    120 
    121 /* List of stack ports */
    122 #define STK_PORTS_MAX    CPUDB_STK_PORTS_MAX
    123 typedef struct {
    124     int             port_cnt;
    125     bcm_port_t      port[STK_PORTS_MAX];
    126 } sp_list_t;
    127 
    128 /* Defines destination (unit or slot) and the corresponding stack port list */
    129 typedef struct {
    130     int              dst;
    131     sp_list_t        sp;
    132 } dst_t;
    133 
    134 /* Defines a unit to local units connectivity */
    135 typedef struct {
    136     modport_set_f    modport_set_fn;
    137     int_sp_set_f     internal_sp_set_fn;
    138     int              unit_cnt;
    139     dst_t            unit[BCM_LOCAL_UNITS_MAX];
    140 } to_unit_t;
    141 
    142 /* Defines a unit to slot connectivity */
    143 /* Notes: allows external or internal stack ports */
    144 typedef struct {
    145     modport_set_f    modport_set_fn;
    146     int              slot_cnt;
    147     dst_t            slot[NUM_LM];  /* Assumes more LM than CFM slots */
    148 } to_slot_t;
    149 
    150 
    151 #define ENABLE_FLOOD          0
    152 #define DISABLE_FLOOD         (BCM_PORT_FLOOD_BLOCK_BCAST |         \
    153                                BCM_PORT_FLOOD_BLOCK_UNKNOWN_UCAST | \
    154                                BCM_PORT_FLOOD_BLOCK_UNKNOWN_MCAST)
    155 
    156 
    157 extern int bcm_board_cfm_info(cpudb_ref_t db_ref, bcm_board_cfm_info_t *info);
    158 extern int _bcm_board_setup_trunk_lm_xgs3_48g(void);
    159 extern int bcm_board_chassis_setup(cpudb_ref_t db_ref);
    160 extern int topo_chassis_modids_assign(cpudb_ref_t db_ref);
    161 
    162 #endif /* INCLUDE_CHASSIS  */
    163 
    164 
    165 
    166 
    167 #endif /* _BRD_CHASSIS_INT_H_ */