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

trill.h (11094B)


      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-2020 Broadcom Inc. All rights reserved.
      6  *
      7  * Trill
      8  */
      9 
     10 #ifndef _BCM_INT_DPP_TRILL_H
     11 #define _BCM_INT_DPP_TRILL_H
     12 
     13 #include <shared/swstate/sw_state.h>
     14 #include <sal/types.h>
     15 #include <bcm/types.h>
     16 #include <soc/dpp/PPD/ppd_api_general.h>
     17 #include <shared/swstate/sw_state_hash_tbl.h>
     18 
     19 #define _BCM_PETRA_TRILL_MC_ROOT_NOF_SRC_RBRIDGE  10
     20 #define _BCM_PETRA_TRILL_MC_ROOT_NOF_VLAN         20
     21 
     22 #define _BCM_PETRA_TRILL_PORT_UNI                         0
     23 #define _BCM_PETRA_TRILL_PORT_MC                          1
     24 #define _BCM_PETRA_TRILL_PORT_MULTIPATH                   2
     25 
     26 #define _BCM_TRILL_PORTS_ALLOC_SIZE                20
     27 
     28 /* Used to identify trill fgl's tpid profile: outer tpid profile = inner tpid profile = 0x893B */
     29 #define _BCM_PETRA_TRILL_NATIVE_TPID  (0x893B)
     30 
     31 /* Default trill ethertype for device bringup */
     32 #define _BCM_PETRA_TRILL_ETHERTYPE_DEFAULT (0x22f3)
     33 
     34 /* virtual nickname gport define and macros */
     35 #define _BCM_DPP_GPORT_TRILL_VIRTUAL_NICK_NAME_INDEX_MASK  0x3
     36 #define _BCM_DPP_GPORT_TRILL_VIRTUAL_NICK_NAME_INDEX_SHIFT 16
     37 #define _BCM_DPP_GPORT_TRILL_NICK_NAME_MASK                0xFFFF
     38 
     39 /*trill port id: encoding: 0:15: nickname, 16:17: virtual index */
     40 #define _BCM_DPP_GPORT_TRILL_VIRTUAL_NICK_NAME_PORT_ID_SET(_gport, index, nick_name)  \
     41     BCM_GPORT_TRILL_PORT_ID_SET(_gport, nick_name | \
     42        (((index) & _BCM_DPP_GPORT_TRILL_VIRTUAL_NICK_NAME_INDEX_MASK) << _BCM_DPP_GPORT_TRILL_VIRTUAL_NICK_NAME_INDEX_SHIFT))
     43 
     44 #define _BCM_DPP_GPORT_TRILL_NICKNAME_GET(_gport) \
     45        (_gport & _BCM_DPP_GPORT_TRILL_NICK_NAME_MASK)
     46 
     47 #define _BCM_DPP_GPORT_TRILL_VIRTUAL_NICK_NAME_INDEX_GET(_gport) \
     48        (((_gport) >> _BCM_DPP_GPORT_TRILL_VIRTUAL_NICK_NAME_INDEX_SHIFT) & _BCM_DPP_GPORT_TRILL_VIRTUAL_NICK_NAME_INDEX_MASK)
     49 
     50 /* gport trill is virtual nickname if has an index != 0 (virtual nickname index) */
     51 #define BCM_GPORT_TRILL_PORT_ID_IS_VIRTUAL(_gport) \
     52        _BCM_DPP_GPORT_TRILL_VIRTUAL_NICK_NAME_INDEX_GET(_gport)
     53 
     54 /* gport trill is egress trill gport if:
     55  * - is trill gport
     56    - has a sub-type (aka encap-type): trill outlif */
     57 #define BCM_GPORT_TRILL_PORT_ID_IS_EGRESS(_gport) \
     58        BCM_GPORT_IS_TRILL_PORT(_gport) && BCM_GPORT_SUB_TYPE_IS_TRILL_OUTLIF(_gport)
     59 
     60 
     61 typedef struct _bcm_petra_trill_port_list_s {
     62     int                             allocated_cnt; 
     63     int                             port_cnt;  
     64     PARSER_HINT_ARR bcm_gport_t     *ports; 
     65 } bcm_petra_trill_port_list_t;
     66 
     67 
     68 /* Trill State structure */
     69 typedef struct bcm_dpp_trill_state_s {
     70     int                                         init;
     71     int                                         mask_set;
     72     SOC_PPC_AC_ID                               trill_out_ac;   
     73     SOC_PPC_LIF_ID                              trill_local_in_lif;
     74     int                                         trill_global_in_lif;
     75     int                                         last_used_id;   
     76     PARSER_HINT_PTR bcm_petra_trill_port_list_t *trill_ports;
     77     /* For each root a list of sources is saved*/
     78     int                                         mc_trill_route_info_db_htb_handle;
     79     /* For each root a list of routes is saved */
     80     int                                         mc_trill_root_src_db_htb_handle;
     81 } bcm_dpp_trill_state_t;
     82 
     83 /*The source rbridge info*/
     84 typedef struct _bcm_petra_trill_mc_src_info_s {
     85     bcm_trill_name_t    src_rbridge; 
     86     bcm_gport_t         port; 
     87 } _bcm_petra_trill_mc_src_info_t;
     88 
     89 
     90 typedef struct _bcm_petra_trill_mc_trill_src_list_s {
     91      int    nof_src_rbridge;
     92     _bcm_petra_trill_mc_src_info_t src_rbridge[_BCM_PETRA_TRILL_MC_ROOT_NOF_SRC_RBRIDGE ];
     93 } _bcm_petra_trill_mc_trill_src_list_t;
     94 
     95 
     96 /*The route info*/
     97 typedef struct _bcm_petra_trill_mc_route_info_s {
     98     uint32              flags; 
     99     bcm_trill_name_t    root_name; 
    100     bcm_vlan_t          vlan; 
    101     bcm_multicast_t     group;
    102 } _bcm_petra_trill_mc_route_info_t;
    103 
    104 typedef struct _bcm_petra_trill_mc_route_list_s {
    105      int    nof_routes;
    106     _bcm_petra_trill_mc_route_info_t route[_BCM_PETRA_TRILL_MC_ROOT_NOF_VLAN];
    107 } _bcm_petra_trill_mc_trill_route_list_t;
    108 
    109 typedef struct _bcm_petra_trill_info_s {
    110     int type;
    111     int fec_id;
    112     int use_cnt;  /* Used for fecless port (id = name) - Counts  ports that share the same name */
    113 } _bcm_petra_trill_info_t;
    114 
    115 typedef struct _bcm_petra_trill_vpn_info_s {
    116     uint32     flags; 
    117     bcm_vlan_t high_vid;                /* Outer vlan */
    118     bcm_vlan_t low_vid;                 /* Inner vlan */
    119 } _bcm_petra_trill_vpn_info_t;
    120 
    121 int
    122 _bcm_dpp_mc_to_trill_add(
    123     int	unit,
    124     bcm_multicast_t group, 
    125     bcm_gport_t port);
    126 
    127 int
    128 _bcm_dpp_mc_to_trill_remove(
    129     int unit,
    130     bcm_multicast_t group, 
    131     bcm_trill_name_t nick_name);
    132 
    133 int
    134 _bcm_dpp_dt_nickname_trill_get(
    135     int unit,
    136     bcm_gport_t trill_port_id, 
    137     int         *dt_nickname);
    138 
    139 int
    140 _bcm_dpp_mc_to_trill_get(
    141     int	unit,
    142     bcm_multicast_t group, 
    143     bcm_gport_t     *port);
    144 
    145 int
    146 _bcm_dpp_trill_port_add(
    147     int	unit,
    148     bcm_trill_port_t *trill_port,
    149     int              is_replace);
    150 
    151 int
    152 _bcm_dpp_trill_port_delete(
    153     int	unit,
    154     bcm_gport_t trill_port_id,
    155     int reset_local_info);
    156 
    157 int
    158 _bcm_petra_trill_port_fec_id_get (
    159     int unit, 
    160     bcm_gport_t trill_port_id, 
    161     int *fec_id);
    162 
    163 int
    164 _bcm_petra_add_to_trill_port_list(
    165      int unit,
    166      bcm_gport_t gport);
    167 
    168 int     _bcm_petra_trill_get_trill_out_ac(int unit, SOC_PPC_AC_ID *out_ac);
    169 int     _bcm_petra_trill_set_trill_out_ac(int unit, SOC_PPC_AC_ID out_ac);
    170 
    171 
    172 int     _bcm_dpp_trill_port_set_local_info(int unit, bcm_trill_name_t port_name, uint32 is_skip_ethernet);
    173 int     _bcm_dpp_trill_port_reset_local_info(int unit, bcm_trill_name_t port_name);
    174 int     _bcm_dpp_trill_port_is_local(int unit, bcm_trill_name_t port_name, uint32 *is_local);
    175 
    176 int     _bcm_dpp_trill_mc_route_get(int unit, bcm_trill_name_t root_name, _bcm_petra_trill_mc_route_info_t **route_list, int *cnt);
    177 
    178 int      bcm_petra_trill_init_data(int unit);
    179 int      bcm_petra_trill_deinit_data(int unit);
    180 int     _bcm_dpp_trill_alloc_port_id(int unit, int *id);
    181 
    182 
    183 int _ppd_trill_multicast_route_remove(
    184         int unit, 
    185         uint32              flags,
    186         bcm_trill_name_t    root_name, 
    187         bcm_vlan_t          vlan, 
    188         bcm_vlan_t          inner_vlan, 
    189         bcm_multicast_t     group,
    190         bcm_trill_name_t    src_name);
    191 
    192 int _ppd_trill_multicast_route_add(
    193         int unit, 
    194         uint32              flags,
    195         bcm_trill_name_t    root_name, 
    196         bcm_vlan_t          vlan, 
    197         bcm_vlan_t          inner_vlan, 
    198         bcm_multicast_t     group,
    199         bcm_trill_name_t    src_name, 
    200         bcm_gport_t         src_port);
    201 
    202 int _ppd_trill_multicast_route_get(
    203         int unit, 
    204         uint32              flags,
    205         bcm_trill_name_t    root_name, 
    206         bcm_vlan_t          vlan, 
    207         bcm_vlan_t          inner_vlan,     
    208         bcm_trill_name_t    src_name, 
    209         bcm_gport_t         src_port,
    210         bcm_multicast_t     *group,
    211         uint8               *found);
    212 
    213 /*
    214  * Function:
    215  *       _bcm_dpp_trill_gport_to_fwd_decision
    216  * Description:
    217  *         convert trill gport to forwarding decision (destination + editing information)
    218  * Parameters:
    219  *  unit -           [IN] DPP device unit number (driver internal).
    220  *  gport -          [IN] trill port
    221  *  mc_id    -       [IN] multicast id
    222  *  fwd_decsion -    [OUT] PPD forwarding decision
    223  * Returns:
    224  *       BCM_E_XXX
    225  */
    226 int 
    227 _bcm_dpp_trill_gport_to_fwd_decision(int unit, bcm_gport_t gport, bcm_multicast_t mc_id, SOC_PPC_FRWRD_DECISION_INFO  *fwd_decsion);
    228 
    229 #ifdef BCM_ARAD_SUPPORT 
    230 /* Function:
    231  *      _bcm_dpp_trill_config_vpn
    232  * Purpose:
    233  *      Set the vpn configuration.
    234  *     
    235  * Parameters:
    236  *      unit  - (IN)  Device Number
    237  *      vsi   - (IN)  VSI id
    238  *      port  - (IN)  port id
    239  * Returns:
    240  *      BCM_E_XXX
    241  */
    242 int _bcm_dpp_trill_config_vpn(
    243         int unit, 
    244         bcm_vlan_t vsi, 
    245         bcm_gport_t port);
    246 int _bcm_dpp_trill_unconfig_vpn(
    247         int unit, 
    248         bcm_vlan_t vsi, 
    249         bcm_gport_t port);
    250 
    251 /*
    252  * Function:
    253  *      _bcm_dpp_trill_config_vpn_access
    254  * Purpose:
    255  *      Set the vpn information - Access side.
    256  *      
    257  *      
    258  * Parameters:
    259  *      unit  - (IN)  Device Number
    260  *      vsi   - (IN)  VSI id
    261  *      port  - (IN)  port id
    262  * Returns:
    263  *      BCM_E_XXX
    264  */
    265 int _bcm_dpp_trill_config_vpn_access(
    266         int unit, 
    267         bcm_vlan_t vsi, 
    268         bcm_gport_t port);
    269 int _bcm_dpp_trill_delete_vpn_access(
    270         int unit, 
    271         bcm_vlan_t vsi, 
    272         bcm_gport_t port);
    273 
    274 /*
    275  * Function:
    276  *      _bcm_dpp_trill_config_vpn_network
    277  * Purpose:
    278  *      Set the vpn information - Network side.
    279  *      
    280  *      
    281  * Parameters:
    282  *      unit  - (IN)  Device Number
    283  *      vsi   - (IN)  VSI id
    284  *      port  - (IN)  port id
    285  * Returns:
    286  *      BCM_E_XXX
    287  */
    288 int _bcm_dpp_trill_config_vpn_network(
    289         int unit, 
    290         bcm_vlan_t vsi, 
    291         bcm_gport_t port);
    292 int _bcm_dpp_trill_delete_vpn_network(
    293         int unit, 
    294         bcm_vlan_t vsi, 
    295         bcm_gport_t port);
    296 /*
    297  * Function:
    298  *      _bcm_dpp_trill_vlan_editing_create
    299  * Purpose:
    300  *      map VSI to outer-vid and inner-vid
    301  * Parameters:
    302  *      unit  - (IN)  Device Number
    303  *      vsi   - (IN)  VSI id
    304  *      port  - (IN)  port id
    305  * Returns:
    306  *      BCM_E_XXX
    307  */
    308 int _bcm_dpp_trill_vlan_editing_create(int unit, bcm_vlan_t vsi, bcm_gport_t port);
    309 int _bcm_dpp_trill_vlan_editing_delete(int unit, bcm_vlan_t vsi, bcm_gport_t port);
    310 
    311 int _bcm_dpp_trill_get_vsi_info(
    312         int unit, 
    313         bcm_vlan_t vsi, 
    314         _bcm_petra_trill_vpn_info_t *vsi_info);
    315 
    316 
    317 int
    318 _bcm_dpp_trill_sw_db_hash_mc_trill_find(int unit, sw_state_htb_key_t key, sw_state_htb_data_t data, int remove);
    319 
    320 int 
    321 _bcm_dpp_trill_sw_db_hash_mc_trill_insert(int unit, sw_state_htb_key_t key, sw_state_htb_data_t data);
    322 int 
    323 _bcm_dpp_trill_sw_db_hash_trill_route_info_destroy(int unit);
    324 
    325 int 
    326 _bcm_dpp_trill_sw_db_hash_mc_trill_destroy(int unit);
    327 
    328 int
    329 _bcm_dpp_trill_sw_db_hash_trill_info_find(int unit, sw_state_htb_key_t key, sw_state_htb_data_t data, int remove);
    330 
    331 int 
    332 _bcm_dpp_trill_sw_db_hash_trill_info_insert(int unit, sw_state_htb_key_t key, sw_state_htb_data_t data);
    333 
    334 int 
    335 _bcm_dpp_trill_sw_db_hash_trill_vpn_insert(int unit, sw_state_htb_key_t key, sw_state_htb_data_t data);
    336 int
    337 _bcm_dpp_trill_sw_db_hash_trill_vpn_find(int unit, sw_state_htb_key_t key, sw_state_htb_data_t data, int remove);
    338 
    339 int _bcm_dpp_trill_sw_db_hash_trill_info_iterate(int unit, sw_state_htb_cb_t restore_cb);
    340 int _bcm_dpp_trill_sw_db_hash_mc_trill_iterate(int unit, sw_state_htb_cb_t restore_cb);
    341 int _bcm_dpp_trill_sw_db_hash_trill_route_info_iterate(int unit, sw_state_htb_cb_t restore_cb);
    342 int _bcm_dpp_trill_sw_db_hash_trill_src_iterate(int unit, sw_state_htb_cb_t restore_cb);
    343 int _bcm_dpp_trill_sw_db_hash_trill_vpn_iterate(int unit, sw_state_htb_cb_t restore_cb);
    344 
    345 
    346 /* Alocate a new trill port id*/
    347 #endif  /*BCM_ARAD_SUPPORT*/
    348 #endif /* _BCM_INT_DPP_TRILL_H */
    349