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 (27982B)


      1 /*! \file l3_intf.h
      2  *
      3  * BCM L3 intf module APIs and data structures used only internally.
      4  */
      5 /*
      6  * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file.
      7  * 
      8  * Copyright 2007-2020 Broadcom Inc. All rights reserved.
      9  */
     10 
     11 #ifndef BCMI_LTSW_MBCM_L3_INTF_H
     12 #define BCMI_LTSW_MBCM_L3_INTF_H
     13 
     14 #include <bcm/l3.h>
     15 #include <bcm_int/ltsw/flexctr.h>
     16 #include <bcm_int/ltsw/l3_intf_int.h>
     17 #include <bcm_int/ltsw/l3_intf.h>
     18 #include <bcm_int/ltsw/types.h>
     19 
     20 /*!
     21  * \brief Get the L3 interface table database.
     22  *
     23  * \param [in] unit Unit number.
     24  * \param [out] tbl_db L3 interface table databse.
     25  *
     26  * \retval SHR_E_NONE No errors.
     27  */
     28 typedef int (*l3_intf_tbl_db_get_f)(int unit,
     29                                     bcmint_ltsw_l3_intf_tbl_db_t *tbl_db);
     30 
     31 /*!
     32  * \brief Initialize L3 intf module.
     33  *
     34  * \param [in] unit Unit Number.
     35  *
     36  * \retval SHR_E_NONE No errors.
     37  * \retval !SHR_E_NONE Failure.
     38  */
     39 typedef int (*l3_intf_init_f)(int unit);
     40 
     41 /*!
     42  * \brief De-initialize L3 intf module.
     43  *
     44  * \param [in] unit Unit Number.
     45  *
     46  * \retval SHR_E_NONE No errors.
     47  * \retval !SHR_E_NONE Failure.
     48  */
     49 typedef int (*l3_intf_deinit_f)(int unit);
     50 
     51 /*!
     52  * \brief Get ingress interface id range.
     53  *
     54  * \param [in] unit Unit number.
     55  * \param [out] min Minimum interface id of the given type.
     56  * \param [out] max Maximum interface id of the given type.
     57  *
     58  * \retval SHR_E_NONE No errors.
     59  * \retval !SHR_E_NONE Failure.
     60  */
     61 typedef int (*l3_ing_intf_id_range_get_f)(int unit, int *min, int *max);
     62 
     63 /*!
     64  * \brief Get ingress class id range.
     65  *
     66  * \param [in] unit Unit number.
     67  * \param [out] min Minimum class id.
     68  * \param [out] max Maximum class id.
     69  * \param [out] width Number of bits of class id.
     70  *
     71  * \retval SHR_E_NONE No errors.
     72  * \retval !SHR_E_NONE Failure.
     73  */
     74 typedef int (*l3_ing_class_id_range_get_f)(int unit, int *min, int *max,
     75                                            int *width);
     76 
     77 /*!
     78  * \brief Create an L3 ingress interface.
     79  *
     80  * \param [in] unit Unit number.
     81  * \param [in] intf_info Interface info.
     82  *
     83  * \retval SHR_E_NONE No errors.
     84  * \retval !SHR_E_NONE Failure.
     85  */
     86 typedef int (*l3_ing_intf_create_f)(int unit,
     87                                     bcm_l3_ingress_t *intf_info,
     88                                     bcm_if_t *intf_id);
     89 
     90 /*!
     91  * \brief Destroy an L3 ingress interface.
     92  *
     93  * \param [in] unit Unit number.
     94  * \param [In] intf_id L3 ingress interface id.
     95  *
     96  * \retval SHR_E_NONE No errors.
     97  * \retval !SHR_E_NONE Failure.
     98  */
     99 typedef int (*l3_ing_intf_destroy_f)(int unit, bcm_if_t intf_id);
    100 
    101 /*!
    102  * \brief Get an ingress interface.
    103  *
    104  * \param [in] unit Unit number.
    105  * \param [In] intf_id L3 ingress interface id.
    106  * \param [OUT] ing_intf Ingress interface information.
    107  *
    108  * \retval SHR_E_NONE No errors.
    109  * \retval !SHR_E_NONE Failure.
    110  */
    111 typedef int (*l3_ing_intf_get_f)(int unit, bcm_if_t intf_id,
    112                                  bcm_l3_ingress_t *ing_intf);
    113 
    114 /*!
    115  * \brief Find an ingress interface.
    116  *
    117  * \param [in] unit Unit number.
    118  * \param [in] ing_intf Ingress interface information.
    119  * \param [OUT] intf_id L3 ingress interface id.
    120  *
    121  * \retval SHR_E_NONE No errors.
    122  * \retval !SHR_E_NONE Failure.
    123  */
    124 typedef int (*l3_ing_intf_find_f)(int unit, bcm_l3_ingress_t *ing_intf,
    125                                   bcm_if_t *intf_id);
    126 
    127 /*!
    128  * \brief Traverse all valid ingress interface.
    129  *
    130  * \param [in] unit Unit number.
    131  * \param [In] trav_fn Callback function.
    132  * \param [In] user_data User data to be passed to callback function.
    133  *
    134  * \retval SHR_E_NONE No errors.
    135  * \retval !SHR_E_NONE Failure.
    136  */
    137 typedef int (*l3_ing_intf_traverse_f)(int unit,
    138                                       bcm_l3_ingress_traverse_cb trav_fn,
    139                                       void *user_data);
    140 
    141 /*!
    142  * \brief Update rp_id profile of a given ingress interface.
    143  *
    144  * \param [in] unit Unit number.
    145  * \param [in] intf_id Ingress interface ID.
    146  * \param [in] rp_id Rendezvous point ID.
    147  * \param [in] set Set or unset the rp_id to rp_id_profile.
    148  *
    149  * \retval SHR_E_NONE No errors.
    150  * \retval !SHR_E_NONE Failure.
    151  */
    152 typedef int (*l3_ing_intf_rp_op_f)(int unit, int intf_id, int rp_id, int set);
    153 
    154 /*!
    155  * \brief Get rp_id of a given ingress interface.
    156  *
    157  * \param [in] unit Unit number.
    158  * \param [in] intf_id Ingress interface ID.
    159  * \param [out] rp_bmp Bitmap of rendezvous point ID.
    160  *
    161  * \retval SHR_E_NONE No errors.
    162  * \retval !SHR_E_NONE Failure.
    163  */
    164 typedef int (*l3_ing_intf_rp_get_f)(int unit, int intf_id, uint32_t *rp_bmp);
    165 
    166 /*!
    167  * \brief Attach flexctr action to the given L3 ingress interface.
    168  *
    169  * \param [in] unit Unit number.
    170  * \param [in] intf_id Interface ID of an Ingress L3 object.
    171  * \param [in] info Flex counter information.
    172  *
    173  * \retval SHR_E_NONE No errors.
    174  * \retval !SHR_E_NONE Failure.
    175  */
    176 typedef int (*l3_ing_intf_flexctr_attach_f)(
    177         int unit,
    178         bcm_if_t intf_id,
    179         bcmi_ltsw_flexctr_counter_info_t *info);
    180 
    181 /*!
    182  * \brief Detach flexctr action of the given L3 ingress interface.
    183  *
    184  * \param [in] unit Unit number.
    185  * \param [in] intf_id Interface ID of an Ingress L3 object.
    186  *
    187  * \retval SHR_E_NONE No errors.
    188  * \retval !SHR_E_NONE Failure.
    189  */
    190 typedef int (*l3_ing_intf_flexctr_detach_f)(int unit, bcm_if_t intf_id);
    191 
    192 /*!
    193  * \brief Get flex counter information of the given L3 ingress interface.
    194  *
    195  * \param [in] unit Unit number.
    196  * \param [in] intf_id Interface ID of an Ingress L3 object.
    197  * \param [out] info Flex counter information.
    198  *
    199  * \retval SHR_E_NONE No errors.
    200  * \retval !SHR_E_NONE Failure.
    201  */
    202 typedef int (*l3_ing_intf_flexctr_info_get_f)(
    203         int unit,
    204         bcm_if_t intf_id,
    205         bcmi_ltsw_flexctr_counter_info_t *info);
    206 
    207 /*!
    208  * \brief Get egress interface id for CPU.
    209  *
    210  * \param [in] unit Unit number.
    211  * \param [out] cpu_intf_id CPU interface id.
    212  *
    213  * \retval SHR_E_NONE No errors.
    214  * \retval !SHR_E_NONE Failure.
    215  */
    216 typedef int (*l3_egr_l2cpu_intf_id_get_f)(int unit, int *cpu_intf_id);
    217 
    218 /*!
    219  * \brief Get egress interface id range.
    220  *
    221  * \param [in] unit Unit number.
    222  * \param [in] type Egress interface type.
    223  * \param [out] min Minimum interface id of the given type.
    224  * \param [out] max Maximum interface id of the given type.
    225  *
    226  * \retval SHR_E_NONE No errors.
    227  * \retval !SHR_E_NONE Failure.
    228  */
    229 typedef int (*l3_egr_intf_id_range_get_f)(int unit,
    230                                           bcmi_ltsw_l3_egr_intf_type_t type,
    231                                           int *min, int *max);
    232 
    233 /*!
    234  * \brief Get egress interface LT index.
    235  *
    236  * \param [in] unit Unit number.
    237  * \param [in] intf_id Egress interface id.
    238  * \param [out] index LT index.
    239  * \param [out] type Egress interface type.
    240  *
    241  * \retval SHR_E_NONE No errors.
    242  * \retval !SHR_E_NONE Failure.
    243  */
    244 typedef int (*l3_egr_intf_to_index_f)(int unit, bcm_if_t intf_id, int *index,
    245                                       bcmi_ltsw_l3_egr_intf_type_t *type);
    246 
    247 /*!
    248  * \brief Get egress interface id from LT index.
    249  *
    250  * \param [in] unit Unit number.
    251  * \param [in] index LT index.
    252  * \param [in] type Egress interface type.
    253  * \param [out] intf_id Egress interface id.
    254  *
    255  * \retval SHR_E_NONE No errors.
    256  * \retval !SHR_E_NONE Failure.
    257  */
    258 typedef int (*l3_egr_index_to_intf_f)(int unit, int index,
    259                                       bcmi_ltsw_l3_egr_intf_type_t type,
    260                                       bcm_if_t *intf_id);
    261 
    262 /*!
    263  * \brief Create an L3 egress interface.
    264  *
    265  * \param [in] unit Unit number.
    266  * \param [in] intf_info Interface info.
    267  *
    268  * \retval SHR_E_NONE No errors.
    269  * \retval !SHR_E_NONE Failure.
    270  */
    271 typedef int (*l3_egr_intf_create_f)(int unit,
    272                                     bcmint_ltsw_l3_egr_intf_t *intf_info);
    273 
    274 /*!
    275  * \brief Get an L3 egress interface.
    276  *
    277  * \param [in] unit Unit number.
    278  * \param [in/out] intf_info Interface info.
    279  *
    280  * \retval SHR_E_NONE No errors.
    281  * \retval !SHR_E_NONE Failure.
    282  */
    283 typedef int (*l3_egr_intf_get_f)(int unit,
    284                                  bcmint_ltsw_l3_egr_intf_t *intf_info);
    285 
    286 /*!
    287  * \brief Find an L3 egress interface.
    288  *
    289  * \param [in] unit Unit number.
    290  * \param [in/out] intf_info Interface info.
    291  *
    292  * \retval SHR_E_NONE  errors.
    293  * \retval !SHR_E_NONE .
    294  */
    295 typedef int (*l3_egr_intf_find_f)(int unit,
    296                                   bcmint_ltsw_l3_egr_intf_t *intf_info);
    297 
    298 /*!
    299  * \brief Delete an L3 egress interface.
    300  *
    301  * \param [in] unit Unit number.
    302  * \param [in] intf_info Interface info.
    303  *
    304  * \retval SHR_E_NONE        No errors.
    305  * \retval !SHR_E_NONE       Failure.
    306  */
    307 typedef int (*l3_egr_intf_delete_f)(int unit,
    308                                     bcmint_ltsw_l3_egr_intf_t *intf_info);
    309 
    310 /*!
    311  * \brief Delete all L3 egress interfaces.
    312  *
    313  * \param [in] unit Unit number.
    314  *
    315  * \retval SHR_E_NONE No errors.
    316  * \retval !SHR_E_NONE Failure.
    317  */
    318 typedef int (*l3_egr_intf_delete_all_f)(int unit);
    319 
    320 /*!
    321  * \brief Attach flexctr action to the given L3 egress interface.
    322  *
    323  * \param [in] unit Unit number.
    324  * \param [in] intf_id Interface ID of an egress L3 object.
    325  * \param [in] info Flex counter information.
    326  *
    327  * \retval SHR_E_NONE No errors.
    328  * \retval !SHR_E_NONE Failure.
    329  */
    330 typedef int (*l3_egr_intf_flexctr_attach_f)(
    331         int unit,
    332         bcm_if_t intf_id,
    333         bcmi_ltsw_flexctr_counter_info_t *info);
    334 
    335 /*!
    336  * \brief Detach flexctr action of the given L3 egress interface.
    337  *
    338  * \param [in] unit Unit number.
    339  * \param [in] intf_id Interface ID of an egress L3 object.
    340  *
    341  * \retval SHR_E_NONE No errors.
    342  * \retval !SHR_E_NONE Failure.
    343  */
    344 typedef int (*l3_egr_intf_flexctr_detach_f)(int unit, bcm_if_t intf_id);
    345 
    346 /*!
    347  * \brief Get flex counter information of the given L3 egress interface.
    348  *
    349  * \param [in] unit Unit number.
    350  * \param [in] intf_id Interface ID of an engress L3 object.
    351  * \param [out] info Flex counter information.
    352  *
    353  * \retval SHR_E_NONE No errors.
    354  * \retval !SHR_E_NONE Failure.
    355  */
    356 typedef int (*l3_egr_intf_flexctr_info_get_f)(
    357         int unit,
    358         bcm_if_t intf_id,
    359         bcmi_ltsw_flexctr_counter_info_t *info);
    360 
    361 /*!
    362  * \brief Internal function to set L3 egress interface tunnel initiator field.
    363  *
    364  * \param [in] unit Unit number.
    365  * \param [in] intf_id Interface index.
    366  * \param [in] tnl_type Tunnel type.
    367  * \param [in] tnl_idx Tunnel initiator index.
    368  *
    369  * \retval SHR_E_NONE No errors.
    370  * \retval !SHR_E_NONE Failure.
    371  */
    372 typedef int (*l3_intf_tnl_init_set_f)(
    373     int unit,
    374     int intf_id,
    375     bcmi_ltsw_tunnel_type_t tnl_type,
    376     int tnl_idx);
    377 
    378 /*!
    379  * \brief Internal function to get L3 egress interface tunnel initiator field.
    380  *
    381  * \param [in] unit Unit number.
    382  * \param [in] intf_id Interface index.
    383  * \param [out] tnl_type Tunnel type.
    384  * \param [out] tnl_idx Tunnel initiator index.
    385  *
    386  * \retval SHR_E_NONE No errors.
    387  * \retval !SHR_E_NONE Failure.
    388  */
    389 typedef int (*l3_intf_tnl_init_get_f)(
    390     int unit,
    391     int intf_id,
    392     bcmi_ltsw_tunnel_type_t *tnl_type,
    393     int *tnl_idx);
    394 
    395 /*!
    396  * \brief Internal function to reset L3 egress interface tunnel initiator field.
    397  *
    398  * \param [in] unit Unit number.
    399  * \param [in] intf_id Interface index.
    400  *
    401  * \retval SHR_E_NONE No errors.
    402  * \retval !SHR_E_NONE Failure.
    403  */
    404 typedef int (*l3_intf_tnl_init_reset_f)(int unit, int intf_if);
    405 
    406 /*!
    407  * \brief Update the vfi information for a given vid.
    408  *
    409  * \param [in] unit Unit number.
    410  * \param [in] vid VFI ID.
    411  * \param [in] vfi_info VFI information.
    412  *
    413  * \retval SHR_E_NONE No errors.
    414  * \retval !SHR_E_NONE Failure.
    415  */
    416 typedef int (*l3_intf_vfi_update_f)(int unit, int vid,
    417                                     bcmi_ltsw_l3_intf_vfi_t *vfi_info);
    418 
    419 /*!
    420  * \brief Recover all MPLS information from L3 interface.
    421  *
    422  * \param [in] unit Unit number.
    423  * \param [in] cb Callback function.
    424  * \param [in] user_data User data of callback.
    425  *
    426  * \retval SHR_E_NONE No errors.
    427  * \retval !SHR_E_NONE Failure.
    428  */
    429 typedef int(*l3_intf_mpls_recover_all_f)(int unit,
    430                                          bcmi_ltsw_l3_intf_mpls_recover_cb cb,
    431                                          void *user_data);
    432 
    433 /*!
    434  * \brief Internal function to set L3 egress interface adaptation key field.
    435  *
    436  * \param [in] unit Unit number.
    437  * \param [in] intf_id Interface index.
    438  * \param [in] key_type Key type.
    439  *
    440  * \retval SHR_E_NONE No errors.
    441  * \retval !SHR_E_NONE Failure.
    442  */
    443 typedef int (*l3_intf_adapt_lookup_key_set_f)(
    444     int unit,
    445     int intf_id,
    446     int key_type);
    447 
    448 /*!
    449  * \brief L3 function vector driver.
    450  */
    451 typedef struct mbcm_ltsw_l3_intf_drv_s {
    452     /*! Get L3 interface table databse. */
    453     l3_intf_tbl_db_get_f l3_intf_tbl_db_get;
    454 
    455     /*! Initialize L3 intf module. */
    456     l3_intf_init_f l3_intf_init;
    457 
    458     /*! De-Initialize L3 intf Module. */
    459     l3_intf_deinit_f l3_intf_deinit;
    460 
    461     /*! Get ingress interface id range. */
    462     l3_ing_intf_id_range_get_f l3_ing_intf_id_range_get;
    463 
    464     /*! Get ingress class id range. */
    465     l3_ing_class_id_range_get_f l3_ing_class_id_range_get;
    466 
    467     /*! Create an L3 ingress interface. */
    468     l3_ing_intf_create_f l3_ing_intf_create;
    469 
    470     /*! Destroy an L3 ingress interface. */
    471     l3_ing_intf_destroy_f l3_ing_intf_destroy;
    472 
    473     /*! Get an L3 ingress interface. */
    474     l3_ing_intf_get_f l3_ing_intf_get;
    475 
    476     /*! Find an L3 ingress interface. */
    477     l3_ing_intf_find_f l3_ing_intf_find;
    478 
    479     /*! Traverse L3 ingress interface. */
    480     l3_ing_intf_traverse_f l3_ing_intf_traverse;
    481 
    482     /*! Add or delete a rp_id to rp_id_profile of a ingress interface. */
    483     l3_ing_intf_rp_op_f l3_ing_intf_rp_op;
    484 
    485     /*! Get rp_id of a ingress interface. */
    486     l3_ing_intf_rp_get_f l3_ing_intf_rp_get;
    487 
    488     /*! Attach flexctr action to the given L3 ingress interface. */
    489     l3_ing_intf_flexctr_attach_f l3_ing_intf_flexctr_attach;
    490 
    491     /*! Detach flexctr action of the given L3 ingress interface. */
    492     l3_ing_intf_flexctr_detach_f l3_ing_intf_flexctr_detach;
    493 
    494     /*! Get flex counter information of the given L3 ingress interface. */
    495     l3_ing_intf_flexctr_info_get_f l3_ing_intf_flexctr_info_get;
    496 
    497     /*! Get egress interface id for CPU. */
    498     l3_egr_l2cpu_intf_id_get_f l3_egr_l2cpu_intf_id_get;
    499 
    500     /*! Get egress interface id range. */
    501     l3_egr_intf_id_range_get_f l3_egr_intf_id_range_get;
    502 
    503     /*! Get LT index from egress interface id. */
    504     l3_egr_intf_to_index_f l3_egr_intf_to_index;
    505 
    506     /*! Get egress interface id from LT index. */
    507     l3_egr_index_to_intf_f l3_egr_index_to_intf;
    508 
    509     /*! Create an L3 egress interface. */
    510     l3_egr_intf_create_f l3_egr_intf_create;
    511 
    512     /*! Get an L3 egress interface. */
    513     l3_egr_intf_get_f l3_egr_intf_get;
    514 
    515     /*! Find an L3 egress interface. */
    516     l3_egr_intf_find_f l3_egr_intf_find;
    517 
    518     /*! Delete an L3 egress interface. */
    519     l3_egr_intf_delete_f l3_egr_intf_delete;
    520 
    521     /*! Delete all L3 egress interfaces. */
    522     l3_egr_intf_delete_all_f l3_egr_intf_delete_all;
    523 
    524     /*! Attach flexctr action to the given L3 egress interface. */
    525     l3_egr_intf_flexctr_attach_f l3_egr_intf_flexctr_attach;
    526 
    527     /*! Detach flexctr action of the given L3 egress interface. */
    528     l3_egr_intf_flexctr_detach_f l3_egr_intf_flexctr_detach;
    529 
    530     /*! Get flex counter information of the given L3 egress interface. */
    531     l3_egr_intf_flexctr_info_get_f l3_egr_intf_flexctr_info_get;
    532 
    533     /*! Set tunnel initiator index. */
    534     l3_intf_tnl_init_set_f l3_intf_tnl_init_set;
    535 
    536     /*! Get tunnel initiator index. */
    537     l3_intf_tnl_init_get_f l3_intf_tnl_init_get;
    538 
    539     /*! Reset tunnel initiator index. */
    540     l3_intf_tnl_init_reset_f l3_intf_tnl_init_reset;
    541 
    542     /*! Update the VFI information for a given vid. */
    543     l3_intf_vfi_update_f l3_intf_vfi_update;
    544 
    545     /*! Recover all MPLS information from L3 interface. */
    546     l3_intf_mpls_recover_all_f l3_intf_mpls_recover_all;
    547 
    548     /*! Set adaptation key. */
    549     l3_intf_adapt_lookup_key_set_f l3_intf_adapt_lookup_key_set;
    550 
    551 } mbcm_ltsw_l3_intf_drv_t;
    552 
    553 /*!
    554  * \brief Set the L3 driver of the device.
    555  *
    556  * \param [in] unit Unit number.
    557  * \param [in] drv Vlan driver to set.
    558  *
    559  * \retval SHR_E_NONE No errors.
    560  */
    561 extern int
    562 mbcm_ltsw_l3_intf_drv_set(int unit, mbcm_ltsw_l3_intf_drv_t *drv);
    563 
    564 /*!
    565  * \brief Get the L3 interface table database.
    566  *
    567  * \param [in] unit Unit number.
    568  * \param [out] tbl_db L3 interface table databse.
    569  *
    570  * \retval SHR_E_NONE No errors.
    571  */
    572 extern int
    573 mbcm_ltsw_l3_intf_tbl_db_get(int unit,
    574                              bcmint_ltsw_l3_intf_tbl_db_t *tbl_db);
    575 
    576 /*!
    577  * \brief Initialize L3 intf module.
    578  *
    579  * \param [in] unit Unit Number.
    580  *
    581  * \retval SHR_E_NONE No errors.
    582  * \retval !SHR_E_NONE Failure.
    583  */
    584 extern int
    585 mbcm_ltsw_l3_intf_init(int unit);
    586 
    587 /*!
    588  * \brief De-Initialize L3 intf module.
    589  *
    590  * \param [in] unit Unit Number.
    591  *
    592  * \retval SHR_E_NONE No errors.
    593  * \retval !SHR_E_NONE Failure.
    594  */
    595 extern int
    596 mbcm_ltsw_l3_intf_deinit(int unit);
    597 
    598 /*!
    599  * \brief Get ingress interface id range.
    600  *
    601  * \param [in] unit Unit number.
    602  * \param [out] min Minimum interface id of the given type.
    603  * \param [out] max Maximum interface id of the given type.
    604  *
    605  * \retval SHR_E_NONE No errors.
    606  * \retval !SHR_E_NONE Failure.
    607  */
    608 extern int
    609 mbcm_ltsw_l3_ing_intf_id_range_get(int unit, int *min, int *max);
    610 
    611 /*!
    612  * \brief Get ingress class id range.
    613  *
    614  * \param [in] unit Unit number.
    615  * \param [out] min Minimum class id.
    616  * \param [out] max Maximum class id.
    617  * \param [out] width Number of bits of class id.
    618  *
    619  * \retval SHR_E_NONE No errors.
    620  * \retval !SHR_E_NONE Failure.
    621  */
    622 extern int
    623 mbcm_ltsw_l3_ing_class_id_range_get(int unit, int *min, int *max, int *width);
    624 
    625 /*!
    626  * \brief Create an L3 ingress interface.
    627  *
    628  * \param [in] unit Unit number.
    629  * \param [in] intf_info Interface info.
    630  *
    631  * \retval SHR_E_NONE No errors.
    632  * \retval !SHR_E_NONE Failure.
    633  */
    634 extern int
    635 mbcm_ltsw_l3_ing_intf_create(int unit, bcm_l3_ingress_t *intf_info,
    636                              bcm_if_t *intf_id);
    637 
    638 /*!
    639  * \brief Destroy an L3 ingress interface.
    640  *
    641  * \param [in] unit Unit number.
    642  * \param [In] intf_id L3 ingress interface id.
    643  *
    644  * \retval SHR_E_NONE No errors.
    645  * \retval !SHR_E_NONE Failure.
    646  */
    647 extern int
    648 mbcm_ltsw_l3_ing_intf_destroy(int unit, bcm_if_t intf_id);
    649 
    650 /*!
    651  * \brief Get an ingress interface.
    652  *
    653  * \param [in] unit Unit number.
    654  * \param [In] intf_id L3 ingress interface id.
    655  * \param [OUT] ing_intf Ingress interface information.
    656  *
    657  * \retval SHR_E_NONE No errors.
    658  * \retval !SHR_E_NONE Failure.
    659  */
    660 extern int
    661 mbcm_ltsw_l3_ing_intf_get(int unit, bcm_if_t intf_id,
    662                           bcm_l3_ingress_t *ing_intf);
    663 
    664 /*!
    665  * \brief Find an ingress interface.
    666  *
    667  * \param [in] unit Unit number.
    668  * \param [in] ing_intf Ingress interface information.
    669  * \param [OUT] intf_id L3 ingress interface id.
    670  *
    671  * \retval SHR_E_NONE No errors.
    672  * \retval !SHR_E_NONE Failure.
    673  */
    674 extern int
    675 mbcm_ltsw_l3_ing_intf_find(int unit, bcm_l3_ingress_t *ing_intf,
    676                            bcm_if_t *intf_id);
    677 
    678 /*!
    679  * \brief Traverse all valid ingress interface.
    680  *
    681  * \param [in] unit Unit number.
    682  * \param [In] trav_fn Callback function.
    683  * \param [In] user_data User data to be passed to callback function.
    684  *
    685  * \retval SHR_E_NONE No errors.
    686  * \retval !SHR_E_NONE Failure.
    687  */
    688 extern int
    689 mbcm_ltsw_l3_ing_intf_traverse(int unit,
    690                                bcm_l3_ingress_traverse_cb trav_fn,
    691                                void *user_data);
    692 
    693 /*!
    694  * \brief Update rp_id profile of a given ingress interface.
    695  *
    696  * \param [in] unit Unit number.
    697  * \param [in] intf_id Ingress interface ID.
    698  * \param [in] rp_id Rendezvous point ID.
    699  * \param [in] set Set or unset the rp_id to rp_id_profile.
    700  *
    701  * \retval SHR_E_NONE No errors.
    702  * \retval !SHR_E_NONE Failure.
    703  */
    704 extern int
    705 mbcm_ltsw_l3_ing_intf_rp_op(int unit, int intf_id, int rp_id, int set);
    706 
    707 /*!
    708  * \brief Get rp_id of a given ingress interface.
    709  *
    710  * \param [in] unit Unit number.
    711  * \param [in] intf_id Ingress interface ID.
    712  * \param [out] rp_bmp Bitmap of rendezvous point ID.
    713  *
    714  * \retval SHR_E_NONE No errors.
    715  * \retval !SHR_E_NONE Failure.
    716  */
    717 extern int
    718 mbcm_ltsw_l3_ing_intf_rp_get(int unit, int intf_id, uint32_t *rp_bmp);
    719 
    720 /*!
    721  * \brief Attach flexctr action to the given L3 ingress interface.
    722  *
    723  * \param [in] unit Unit number.
    724  * \param [in] intf_id Interface ID of an Ingress L3 object.
    725  * \param [in] info Flex counter information.
    726  *
    727  * \retval SHR_E_NONE No errors.
    728  * \retval !SHR_E_NONE Failure.
    729  */
    730 extern int
    731 mbcm_ltsw_l3_ing_intf_flexctr_attach(int unit,
    732                                      bcm_if_t intf_id,
    733                                      bcmi_ltsw_flexctr_counter_info_t *info);
    734 
    735 /*!
    736  * \brief Detach flexctr action of the given L3 ingress interface.
    737  *
    738  * \param [in] unit Unit number.
    739  * \param [in] intf_id Interface ID of an Ingress L3 object.
    740  *
    741  * \retval SHR_E_NONE No errors.
    742  * \retval !SHR_E_NONE Failure.
    743  */
    744 extern int
    745 mbcm_ltsw_l3_ing_intf_flexctr_detach(int unit, bcm_if_t intf_id);
    746 
    747 /*!
    748  * \brief Get flex counter information of the given L3 ingress interface.
    749  *
    750  * \param [in] unit Unit number.
    751  * \param [in] intf_id Interface ID of an Ingress L3 object.
    752  * \param [out] info Flex counter information.
    753  *
    754  * \retval SHR_E_NONE No errors.
    755  * \retval !SHR_E_NONE Failure.
    756  */
    757 extern int
    758 mbcm_ltsw_l3_ing_intf_flexctr_info_get(int unit,
    759                                        bcm_if_t intf_id,
    760                                        bcmi_ltsw_flexctr_counter_info_t *info);
    761 
    762 /*!
    763  * \brief Get egress interface id for CPU.
    764  *
    765  * \param [in] unit Unit number.
    766  * \param [out] cpu_intf_id CPU interface id.
    767  *
    768  * \retval SHR_E_NONE No errors.
    769  * \retval !SHR_E_NONE Failure.
    770  */
    771 extern int
    772 mbcm_ltsw_l3_egr_l2cpu_intf_id_get(int unit, int *cpu_intf_id);
    773 
    774 /*!
    775  * \brief Get egress interface id range.
    776  *
    777  * \param [in] unit Unit number.
    778  * \param [in] type Egress interface type.
    779  * \param [out] min Minimum interface id of the given type.
    780  * \param [out] max Maximum interface id of the given type.
    781  *
    782  * \retval SHR_E_NONE No errors.
    783  * \retval !SHR_E_NONE Failure.
    784  */
    785 extern int
    786 mbcm_ltsw_l3_egr_intf_id_range_get(int unit,
    787                                    bcmi_ltsw_l3_egr_intf_type_t type,
    788                                    int *min, int *max);
    789 
    790 /*!
    791  * \brief Get egress interface LT index.
    792  *
    793  * \param [in] unit Unit number.
    794  * \param [in] intf_id Egress interface id.
    795  * \param [out] index LT index.
    796  * \param [out] type Egress interface type.
    797  *
    798  * \retval SHR_E_NONE No errors.
    799  * \retval !SHR_E_NONE Failure.
    800  */
    801 extern int
    802 mbcm_ltsw_l3_egr_intf_to_index(int unit, bcm_if_t intf_id, int *index,
    803                                bcmi_ltsw_l3_egr_intf_type_t *type);
    804 
    805 /*!
    806  * \brief Get egress interface id from LT index.
    807  *
    808  * \param [in] unit Unit number.
    809  * \param [in] index LT index.
    810  * \param [in] type Egress interface type.
    811  * \param [out] intf_id Egress interface id.
    812  *
    813  * \retval SHR_E_NONE No errors.
    814  * \retval !SHR_E_NONE Failure.
    815  */
    816 extern int
    817 mbcm_ltsw_l3_egr_index_to_intf(int unit, int index,
    818                                bcmi_ltsw_l3_egr_intf_type_t type,
    819                                bcm_if_t *intf_id);
    820 
    821 /*!
    822  * \brief Create an L3 egress interface.
    823  *
    824  * \param [in] unit Unit number.
    825  * \param [in] intf_info Interface info.
    826  *
    827  * \retval SHR_E_NONE No errors.
    828  * \retval !SHR_E_NONE Failure.
    829  */
    830 extern int
    831 mbcm_ltsw_l3_egr_intf_create(int unit, bcmint_ltsw_l3_egr_intf_t *intf_info);
    832 
    833 /*!
    834  * \brief Get an L3 egress interface.
    835  *
    836  * \param [in] unit Unit number.
    837  * \param [in/out] intf_info Interface info.
    838  *
    839  * \retval SHR_E_NONE No errors.
    840  * \retval !SHR_E_NONE Failure.
    841  */
    842 extern int
    843 mbcm_ltsw_l3_egr_intf_get(int unit, bcmint_ltsw_l3_egr_intf_t *intf_info);
    844 
    845 /*!
    846  * \brief Find an L3 egress interface.
    847  *
    848  * \param [in] unit Unit number.
    849  * \param [in/out] intf_info Interface info.
    850  *
    851  * \retval SHR_E_NONE No errors.
    852  * \retval !SHR_E_NONE Failure.
    853  */
    854 extern int
    855 mbcm_ltsw_l3_egr_intf_find(int unit, bcmint_ltsw_l3_egr_intf_t *intf_info);
    856 
    857 /*!
    858  * \brief Delete an L3 egress interface.
    859  *
    860  * \param [in] unit Unit number.
    861  * \param [in] intf_info Interface info.
    862  *
    863  * \retval SHR_E_NONE No errors.
    864  * \retval !SHR_E_NONE Failure.
    865  */
    866 extern int
    867 mbcm_ltsw_l3_egr_intf_delete(int unit, bcmint_ltsw_l3_egr_intf_t *intf_info);
    868 
    869 /*!
    870  * \brief Delete all L3 egress interfaces.
    871  *
    872  * \param [in] unit Unit number.
    873  *
    874  * \retval SHR_E_NONE No errors.
    875  * \retval !SHR_E_NONE Failure.
    876  */
    877 extern int
    878 mbcm_ltsw_l3_egr_intf_delete_all(int unit);
    879 
    880 /*!
    881  * \brief Attach flexctr action to the given L3 egress interface.
    882  *
    883  * \param [in] unit Unit number.
    884  * \param [in] intf_id Interface ID of an egress L3 object.
    885  * \param [in] info Flex counter information.
    886  *
    887  * \retval SHR_E_NONE No errors.
    888  * \retval !SHR_E_NONE Failure.
    889  */
    890 extern int
    891 mbcm_ltsw_l3_egr_intf_flexctr_attach(int unit,
    892                                      bcm_if_t intf_id,
    893                                      bcmi_ltsw_flexctr_counter_info_t *info);
    894 
    895 /*!
    896  * \brief Detach flexctr action of the given L3 egress interface.
    897  *
    898  * \param [in] unit Unit number.
    899  * \param [in] intf_id Interface ID of an egress L3 object.
    900  *
    901  * \retval SHR_E_NONE No errors.
    902  * \retval !SHR_E_NONE Failure.
    903  */
    904 extern int
    905 mbcm_ltsw_l3_egr_intf_flexctr_detach(int unit, bcm_if_t intf_id);
    906 
    907 /*!
    908  * \brief Get flex counter information of the given L3 egress interface.
    909  *
    910  * \param [in] unit Unit number.
    911  * \param [in] intf_id Interface ID of an egress L3 object.
    912  * \param [out] info Flex counter information.
    913  *
    914  * \retval SHR_E_NONE No errors.
    915  * \retval !SHR_E_NONE Failure.
    916  */
    917 extern int
    918 mbcm_ltsw_l3_egr_intf_flexctr_info_get(int unit,
    919                                        bcm_if_t intf_id,
    920                                        bcmi_ltsw_flexctr_counter_info_t *info);
    921 
    922 /*!
    923  * \brief Internal function to set L3 egress interface tunnel initiator field.
    924  *
    925  * \param [in] unit Unit number.
    926  * \param [in] intf_id Interface index.
    927  * \param [in] tnl_type Tunnel type.
    928  * \param [in] tnl_idx Tunnel initiator index.
    929  *
    930  * \retval SHR_E_NONE No errors.
    931  * \retval !SHR_E_NONE Failure.
    932  */
    933 extern int
    934 mbcm_ltsw_l3_intf_tnl_init_set(
    935     int unit,
    936     int intf_id,
    937     bcmi_ltsw_tunnel_type_t tnl_type,
    938     int tnl_idx);
    939 
    940 /*!
    941  * \brief Internal function to get L3 egress interface tunnel initiator field.
    942  *
    943  * \param [in] unit Unit number.
    944  * \param [in] intf_id Interface index.
    945  * \param [out] tnl_type Tunnel type.
    946  * \param [out] tnl_idx Tunnel initiator index.
    947  *
    948  * \retval SHR_E_NONE No errors.
    949  * \retval !SHR_E_NONE Failure.
    950  */
    951 extern int
    952 mbcm_ltsw_l3_intf_tnl_init_get(
    953     int unit,
    954     int intf_id,
    955     bcmi_ltsw_tunnel_type_t *tnl_type,
    956     int *tnl_idx);
    957 
    958 
    959 /*!
    960  * \brief Internal function to reset L3 egress interface tunnel initiator field.
    961  *
    962  * \param [in] unit Unit number.
    963  * \param [in] intf_id Interface index.
    964  *
    965  * \retval SHR_E_NONE No errors.
    966  * \retval !SHR_E_NONE Failure.
    967  */
    968 extern int
    969 mbcm_ltsw_l3_intf_tnl_init_reset(int unit, int intf_id);
    970 
    971 /*!
    972  * \brief Update the VFI information for a given vid.
    973  *
    974  * \param [in] unit Unit number.
    975  * \param [in] vid VFI ID.
    976  * \param [in] vfi_info VFI information.
    977  *
    978  * \retval SHR_E_NONE No errors.
    979  * \retval !SHR_E_NONE Failure.
    980  */
    981 extern int
    982 mbcm_ltsw_l3_intf_vfi_update(int unit, int vid,
    983                              bcmi_ltsw_l3_intf_vfi_t *vfi_info);
    984 
    985 /*!
    986  * \brief Recover all MPLS information from L3 interface.
    987  *
    988  * \param [in] unit Unit number.
    989  * \param [in] cb Callback function.
    990  * \param [in] user_data User data of callback.
    991  *
    992  * \retval SHR_E_NONE No errors.
    993  * \retval !SHR_E_NONE Failure.
    994  */
    995 extern int
    996 mbcm_ltsw_l3_intf_mpls_recover_all(int unit,
    997                                    bcmi_ltsw_l3_intf_mpls_recover_cb cb,
    998                                    void *user_data);
    999 
   1000 /*!
   1001  * \brief Internal function to set L3 egress interface adaptation key field.
   1002  *
   1003  * \param [in] unit Unit number.
   1004  * \param [in] intf_id Interface index.
   1005  * \param [in] key_type Key type.
   1006  *
   1007  * \retval SHR_E_NONE No errors.
   1008  * \retval !SHR_E_NONE Failure.
   1009  */
   1010 extern int
   1011 mbcm_ltsw_l3_intf_adapt_lookup_key_set(
   1012     int unit,
   1013     int intf_id,
   1014     int key_type);
   1015 
   1016 
   1017 #endif /* BCMI_LTSW_MBCM_L3_INTF_H */
   1018