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

l3_intf.h (9885B)


      1 /*! \file l3_intf.h
      2  *
      3  * L3 intf header file.
      4  * This file contains L3 interface definitions internal to the BCM library.
      5  */
      6 /*
      7  * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file.
      8  * 
      9  * Copyright 2007-2020 Broadcom Inc. All rights reserved.
     10  */
     11 
     12 
     13 #ifndef BCMI_LTSW_L3_INTF_H
     14 #define BCMI_LTSW_L3_INTF_H
     15 #include <bcm_int/ltsw/types.h>
     16 
     17 /*! Egress interface type. */
     18 typedef enum bcmi_ltsw_l3_egr_intf_type_e {
     19 
     20     /*! Egress object for overlay forwarding. */
     21     BCMI_LTSW_L3_EGR_INTF_T_OL = 0,
     22 
     23     /*! Egress object for tunnel underlay forwarding. */
     24     BCMI_LTSW_L3_EGR_INTF_T_UL = 1,
     25 
     26     BCMI_LTSW_L3_EGR_INTF_T_CNT
     27 
     28 } bcmi_ltsw_l3_egr_intf_type_t;
     29 
     30 /*! VFI info associated with L3 interface. */
     31 typedef struct bcmi_ltsw_l3_intf_vfi_s {
     32      /*! Bitmap that indicate the info to be updated. */
     33     uint32_t flags;
     34 #define BCMI_LTSW_L3_INTF_VFI_F_TAG                    (1<<0)
     35 #define BCMI_LTSW_L3_INTF_VFI_F_TAG_ACTION             (1<<1)
     36 #define BCMI_LTSW_L3_INTF_VFI_F_MEMBERSHIP_PRFL_IDX    (1<<2)
     37 #define BCMI_LTSW_L3_INTF_VFI_F_UNTAG_PRFL_IDX         (1<<3)
     38 #define BCMI_LTSW_L3_INTF_VFI_F_STG                    (1<<4)
     39 
     40     /*! Vlan Tag. */
     41     uint16_t tag;
     42 
     43     /*! Tag action. 0: NOP; 1: add tag. */
     44     uint8_t tag_action;
     45 
     46     /*! Vlan membership profile index. */
     47     uint16_t membership_prfl_idx;
     48 
     49     /*! Untag port profile index. */
     50     uint16_t untag_prfl_idx;
     51 
     52     /*! Spanning tree group. */
     53     uint16_t stg;
     54 } bcmi_ltsw_l3_intf_vfi_t;
     55 
     56 #define BCMI_LTSW_L3_INTF_MAX_TM_STAT 2
     57 typedef struct bcmi_ltsw_l3_iif_profile_s {
     58     /* DSCP mapping ptr. */
     59     uint32_t dscp_ptr;
     60 
     61     /* Enable global route. */
     62     bool     global_route;
     63 
     64     /* Enable unknown IPv4 Multicast flow copy to CPU. */
     65     bool     unknown_ipmcv4_to_cpu;
     66 
     67     /* Enable unknown IPv6 Multicast flow copy to CPU. */
     68     bool     unknown_ipmcv6_to_cpu;
     69 
     70     /* Enable drop IPv6 header type 0. */
     71     bool     ipv6_type0_drop;
     72 
     73     /* Enable unknown src ip flow copy to CPU. */
     74     bool     unknown_src_to_cpu;
     75 
     76     /* Enable IPMC redirect  to CPU. */
     77     bool     icmp_redirect_to_cpu;
     78 
     79     /* Enable unknown ipmc flow copy to CPU. */
     80     bool     unknown_ipmc_as_l2mc;
     81 
     82     /* TM stat array. */
     83     uint32_t tm_stat_type[BCMI_LTSW_L3_INTF_MAX_TM_STAT];
     84 } bcmi_ltsw_l3_iif_profile_t;
     85 
     86 /*! MPLS info associated with L3 interface. */
     87 typedef struct bcmi_ltsw_l3_intf_mpls_s {
     88 
     89     /* VC label index. */
     90     int vc_label_index;
     91 } bcmi_ltsw_l3_intf_mpls_t;
     92 
     93 /*!
     94  * \brief Initialize L3 interface module.
     95  *
     96  * \param [in] unit Unit number.
     97  *
     98  * \retval SHR_E_NONE No errors.
     99  */
    100 extern int
    101 bcmi_ltsw_l3_intf_init(int unit);
    102 
    103 /*!
    104  * \brief De-Initialize L3 interface module.
    105  *
    106  * \param [in] unit Unit number.
    107  *
    108  * \retval SHR_E_NONE No errors.
    109  */
    110 extern int
    111 bcmi_ltsw_l3_intf_deinit(int unit);
    112 
    113 /*!
    114  * \brief Get the CPU interface index.
    115  *
    116  * \param [in] unit Unit number.
    117  *
    118  * \retval SHR_E_NONE No errors.
    119  */
    120 extern int
    121 bcmi_ltsw_l3_intf_l2tocpu_idx_get(int unit);
    122 
    123 /*!
    124  * \brief Validate the egress interface ID.
    125  *
    126  * \param [in] unit Unit number.
    127  * \param [in] intf_id egress interface ID.
    128  *
    129  * \retval SHR_E_NONE No errors.
    130  * \retval SHR_E_INIT L3 interface module not initialized.
    131  * \retval SHR_E_PARAM Invalid ingress interface ID.
    132  */
    133 extern int
    134 bcmi_ltsw_l3_egr_intf_id_validate(int unit, int intf_id);
    135 
    136 
    137 /*!
    138  * \brief Get egress interface id range.
    139  *
    140  * \param [in] unit Unit number.
    141  * \param [in] type Egress interface type.
    142  * \param [out] min Minimum interface id of the given type.
    143  * \param [out] max Maximum interface id of the given type.
    144  *
    145  * \retval SHR_E_NONE No errors.
    146  * \retval !SHR_E_NONE Failure.
    147  */
    148 extern int
    149 bcmi_ltsw_l3_egr_intf_id_range_get(int unit,
    150                                    bcmi_ltsw_l3_egr_intf_type_t type,
    151                                    int *min, int *max);
    152 
    153 /*!
    154  * \brief Get egress interface LT index.
    155  *
    156  * \param [in] unit Unit number.
    157  * \param [in] intf_id Egress interface id.
    158  * \param [out] index LT index.
    159  * \param [out] type Egress interface type.
    160  *
    161  * \retval SHR_E_NONE No errors.
    162  * \retval !SHR_E_NONE Failure.
    163  */
    164 extern int
    165 bcmi_ltsw_l3_egr_intf_to_index(int unit, bcm_if_t intf_id, int *index,
    166                                bcmi_ltsw_l3_egr_intf_type_t *type);
    167 
    168 /*!
    169  * \brief Get egress interface id from LT index.
    170  *
    171  * \param [in] unit Unit number.
    172  * \param [in] index LT index.
    173  * \param [in] type Egress interface type.
    174  * \param [out] intf_id Egress interface id.
    175  *
    176  * \retval SHR_E_NONE No errors.
    177  * \retval !SHR_E_NONE Failure.
    178  */
    179 extern int
    180 bcmi_ltsw_l3_egr_index_to_intf(int unit, int index,
    181                                bcmi_ltsw_l3_egr_intf_type_t type,
    182                                bcm_if_t *intf_id);
    183 
    184 /*!
    185  * \brief Internal function to set L3 egress interface tunnel initiator field.
    186  *
    187  * \param [in] unit Unit number.
    188  * \param [in] intf_id Interface index.
    189  * \param [in] tnl_type Tunnel type.
    190  * \param [in] tnl_idx Tunnel initiator index.
    191  *
    192  * \retval SHR_E_NONE No errors.
    193  * \retval !SHR_E_NONE Failure.
    194  */
    195 extern int
    196 bcmi_ltsw_l3_intf_tnl_init_set(
    197     int unit,
    198     int intf_id,
    199     bcmi_ltsw_tunnel_type_t tnl_type,
    200     int tnl_idx);
    201 
    202 /*!
    203  * \brief Internal function to get L3 egress interface tunnel initiator field.
    204  *
    205  * \param [in] unit number.
    206  * \param [in] intf_id index.
    207  * \param [out] tnl_type Tunnel type.
    208  * \param [out] tnl_idx initiator index.
    209  *
    210  * \retval SHR_E_NONE  errors.
    211  * \retval !SHR_E_NONE Failure.
    212  */
    213 extern int
    214 bcmi_ltsw_l3_intf_tnl_init_get(
    215     int unit,
    216     int intf_id,
    217     bcmi_ltsw_tunnel_type_t *tnl_type,
    218     int *tnl_idx);
    219 
    220 /*!
    221  * \brief Internal function to reset L3 egress interface tunnel initiator field.
    222  *
    223  * \param [in] unit Unit number.
    224  * \param [in] intf_id Interface index.
    225  *
    226  * \retval SHR_E_NONE No errors.
    227  * \retval !SHR_E_NONE Failure.
    228  */
    229 extern int
    230 bcmi_ltsw_l3_intf_tnl_init_reset(int unit, int intf_id);
    231 
    232 /*!
    233  * \brief Update the VFI information for a given vid.
    234  *
    235  * \param [in] unit Unit number.
    236  * \param [in] vid VFI ID.
    237  * \param [in] vfi_info VFI information.
    238  *
    239  * \retval SHR_E_NONE No errors.
    240  * \retval !SHR_E_NONE Failure.
    241  */
    242 extern int
    243 bcmi_ltsw_l3_intf_vfi_update(int unit, int vid,
    244                              bcmi_ltsw_l3_intf_vfi_t *vfi_info);
    245 
    246 /*!
    247  * \brief Validate the ingress interface ID.
    248  *
    249  * \param [in] unit Unit number.
    250  * \param [in] intf_id Ingress interface ID.
    251  *
    252  * \retval SHR_E_NONE No errors.
    253  * \retval SHR_E_INIT L3 interface module not initialized.
    254  * \retval SHR_E_PARAM Invalid ingress interface ID.
    255  */
    256 extern int
    257 bcmi_ltsw_l3_ing_intf_id_validate(int unit, int intf_id);
    258 
    259 /*!
    260  * \brief Get ingress interface id range.
    261  *
    262  * \param [in] unit Unit number.
    263  * \param [out] min Minimum interface id.
    264  * \param [out] max Maximum interface id.
    265  *
    266  * \retval SHR_E_NONE No errors.
    267  * \retval SHR_E_INIT L3 interface module not initialized.
    268  */
    269 extern int
    270 bcmi_ltsw_l3_ing_intf_id_range_get(int unit, int *min, int *max);
    271 
    272 /*!
    273  * \brief Get class id range.
    274  *
    275  * \param [in] unit Unit number.
    276  * \param [out] min Minimum class id.
    277  * \param [out] max Maximum class id.
    278  * \param [out] width Number of bits of class id.
    279  *
    280  * \retval SHR_E_NONE No errors.
    281  * \retval SHR_E_INIT L3 interface module not initialized.
    282  */
    283 extern int
    284 bcmi_ltsw_l3_ing_class_id_range_get(int unit, int *min, int *max, int *width);
    285 
    286 /*!
    287  * \brief Add rp_id to rpa_id_profile of the given ingress interface.
    288  *
    289  * \param [in] unit Unit number.
    290  * \param [in] intf_id Ingress interface id.
    291  * \param [in] rp_id Rendezvous point id.
    292  *
    293  * \retval SHR_E_NONE No errors.
    294  * \retval SHR_E_INIT L3 interface module not initialized.
    295  * \retval SHR_E_NOT_FOUND The ingress interface is not created.
    296  */
    297 extern int
    298 bcmi_ltsw_l3_ing_intf_rp_add(int unit, int intf_id, int rp_id);
    299 
    300 /*!
    301  * \brief Delete rp_id from rpa_id_profile of the given ingress interface.
    302  *
    303  * \param [in] unit Unit number.
    304  * \param [in] intf_id Ingress interface id.
    305  * \param [in] rp_id Rendezvous point id.
    306  *
    307  * \retval SHR_E_NONE No errors.
    308  * \retval SHR_E_INIT L3 interface module not initialized.
    309  * \retval SHR_E_NOT_FOUND The ingress interface is not created.
    310  */
    311 extern int
    312 bcmi_ltsw_l3_ing_intf_rp_delete(int unit, int intf_id, int rp_id);
    313 
    314 /*!
    315  * \brief Get all rp_id of the given ingress interface.
    316  *
    317  * \param [in] unit Unit number.
    318  * \param [in] intf_id Ingress interface id.
    319  * \param [out] rp_bmp Bitmap of rendezvous point id.
    320  *
    321  * \retval SHR_E_NONE No errors.
    322  * \retval SHR_E_INIT L3 interface module not initialized.
    323  * \retval SHR_E_NOT_FOUND The ingress interface is not created.
    324  */
    325 extern int
    326 bcmi_ltsw_l3_ing_intf_rp_get(int unit, int intf_id, uint32_t *rp_bmp);
    327 
    328 /*!
    329  * \brief Callback function to recover the MPLS information.
    330  *
    331  * \param [in] unit Unit number.
    332  * \param [in] mpls_info MPLS information.
    333  * \param [in] user_data User data of callback.
    334  */
    335 typedef int (*bcmi_ltsw_l3_intf_mpls_recover_cb)(
    336     int unit,
    337     bcmi_ltsw_l3_intf_mpls_t *mpls_info,
    338     void *user_data
    339 );
    340 
    341 /*!
    342  * \brief Recover all MPLS information from L3 interface.
    343  *
    344  * \param [in] unit Unit number.
    345  * \param [in] cb Callback function.
    346  * \param [in] user_data User data of callback.
    347  *
    348  * \retval SHR_E_NONE No errors.
    349  * \retval !SHR_E_NONE Failure.
    350  */
    351 extern int
    352 bcmi_ltsw_l3_intf_mpls_recover_all(int unit,
    353                                    bcmi_ltsw_l3_intf_mpls_recover_cb cb,
    354                                    void *user_data);
    355 
    356 /*!
    357  * \brief Internal function to set L3 egress interface adaptation key field.
    358  *
    359  * \param [in] unit Unit number.
    360  * \param [in] intf_id Interface index.
    361  * \param [in] key_type Key type.
    362  *
    363  * \retval SHR_E_NONE No errors.
    364  * \retval !SHR_E_NONE Failure.
    365  */
    366 extern int
    367 bcmi_ltsw_l3_intf_adapt_lookup_key_set(
    368     int unit,
    369     int intf_id,
    370     int key_type);
    371 
    372 #endif /* BCMI_LTSW_L3_INTF_H */
    373