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_fib.h (58764B)


      1 /*! \file l3_fib.h
      2  *
      3  * BCM L3 fib 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_FIB_H
     12 #define BCMI_LTSW_MBCM_L3_FIB_H
     13 
     14 #include <bcm/l3.h>
     15 #include <bcm_int/ltsw/l3_fib.h>
     16 #include <bcm_int/ltsw/l3_fib_int.h>
     17 #include <bcm_int/ltsw/flexctr.h>
     18 #include <bcm_int/ltsw/uft.h>
     19 
     20 /*!
     21  * \brief Initialize L3 fib module.
     22  *
     23  * \param [in] unit Unit number.
     24  *
     25  * \retval SHR_E_NONE No errors.
     26  */
     27 typedef int (*l3_fib_init_f)(int unit);
     28 
     29 /*!
     30  * \brief De-Initialize L3 fib module.
     31  *
     32  * \param [in] unit Unit number.
     33  *
     34  * \retval SHR_E_NONE No errors.
     35  */
     36 typedef int (*l3_fib_deinit_f)(int unit);
     37 
     38 /*!
     39  * \brief Get the max vrf number.
     40  *
     41  * \param [in] unit Unit number.
     42  * \param [out] max_vrf Max vrf.
     43  *
     44  * \retval SHR_E_NONE No errors.
     45  */
     46 typedef int (*l3_fib_vrf_max_get_f)(int unit, uint32_t *max_vrf);
     47 
     48 /*!
     49  * \brief Add an entry to the L3 host table.
     50  *
     51  * \param [in] unit Unit number.
     52  * \param [in] fib L3 host entry information.
     53  *
     54  * \retval SHR_E_NONE No errors.
     55  */
     56 typedef int (*l3_host_add_f)(int unit, bcmi_ltsw_l3_fib_t *fib);
     57 
     58 /*!
     59  * \brief Delete an entry from L3 host table.
     60  *
     61  * \param [in] unit Unit number.
     62  * \param [in] fib L3 host entry information.
     63  *
     64  * \retval SHR_E_NONE No errors.
     65  */
     66 typedef int (*l3_host_delete_f)(int unit, bcmi_ltsw_l3_fib_t *fib);
     67 
     68 /*!
     69  * \brief Find a L3 host entry.
     70  *
     71  * \param [in] unit Unit number.
     72  * \param [in/out] fib L3 host entry information.
     73  *
     74  * \retval SHR_E_NONE No errors.
     75  */
     76 typedef int (*l3_host_find_f)(int unit, bcmi_ltsw_l3_fib_t *fib);
     77 
     78 /*!
     79  * \brief Delete entries that match or not match a specified L3 interface.
     80  *
     81  * \param [in] unit Unit number.
     82  * \param [in] fib L3 host entry information.
     83  * \param [in] negate Match L3 interface if negate is 0, otherwise not match.
     84  *
     85  * \retval SHR_E_NONE No errors.
     86  */
     87 typedef int (*l3_host_del_by_intf_f)(int unit, bcmi_ltsw_l3_fib_t *fib,
     88                                      int negate);
     89 
     90 /*!
     91  * \brief Delete all L3 host entries.
     92  *
     93  * \param [in] unit Unit number.
     94  * \param [in] attrib L3 FIB attributes.
     95  *
     96  * \retval SHR_E_NONE No errors.
     97  */
     98 typedef int (*l3_host_del_all_f)(int unit, uint32_t attrib);
     99 
    100 /*!
    101  * \brief Traverse host table.
    102  *
    103  * \param [in] unit Unit number.
    104  * \param [in] attrib Operation attributes.
    105  * \param [in] trav_fn User supplied callback function.
    106  * \param [in] cb Callback function to contruct ipmc info from fib.
    107  * \param [in] user_data User supplied cookie used in callback function.
    108  *
    109  * \retval SHR_E_NONE No errors.
    110  */
    111 typedef int (*l3_host_traverse_f)(int unit, uint32_t flags,
    112                                   uint32_t start, uint32_t end,
    113                                   bcm_l3_host_traverse_cb cb, void *user_data);
    114 
    115 /*!
    116  * \brief Add an entry to the L3 route table.
    117  *
    118  * \param [in] unit Unit number.
    119  * \param [in] fib L3 route entry information.
    120  *
    121  * \retval SHR_E_NONE No errors.
    122  */
    123 typedef int (*l3_route_add_f)(int unit, bcmi_ltsw_l3_fib_t *fib);
    124 
    125 /*!
    126  * \brief Delete an entry from L3 route table.
    127  *
    128  * \param [in] unit Unit number.
    129  * \param [in] fib L3 route entry information.
    130  *
    131  * \retval SHR_E_NONE No errors.
    132  */
    133 typedef int (*l3_route_delete_f)(int unit, bcmi_ltsw_l3_fib_t *fib);
    134 
    135 /*!
    136  * \brief Find a L3 route entry.
    137  *
    138  * \param [in] unit Unit number.
    139  * \param [in/out] fib L3 route entry information.
    140  *
    141  * \retval SHR_E_NONE No errors.
    142  */
    143 typedef int (*l3_route_find_f)(int unit, bool lpm, bcmi_ltsw_l3_fib_t *fib);
    144 
    145 /*!
    146  * \brief Delete entries that match or not match a specified L3 interface.
    147  *
    148  * \param [in] unit Unit number.
    149  * \param [in] fib L3 route entry information.
    150  * \param [in] negate Match L3 interface if negate is 0, otherwise not match.
    151  *
    152  * \retval SHR_E_NONE No errors.
    153  */
    154 typedef int (*l3_route_del_by_intf_f)(int unit, bcmi_ltsw_l3_fib_t *fib,
    155                                       int negate);
    156 
    157 /*!
    158  * \brief Delete all L3 route entries.
    159  *
    160  * \param [in] unit Unit number.
    161  * \param [in] attrib L3 FIB attributes.
    162  *
    163  * \retval SHR_E_NONE No errors.
    164  */
    165 typedef int (*l3_route_del_all_f)(int unit, uint32_t attrib);
    166 
    167 /*!
    168  * \brief Traverse unicast route table.
    169  *
    170  * \param [in] unit Unit number.
    171  * \param [in] flags Operation flags.
    172  * \param [in] start Callback called after this many L3 entries.
    173  * \param [in] end Callback called before this many L3 entries.
    174  * \param [in] cb User supplied callback function.
    175  * \param [in] user_data User supplied cookie used in callback function.
    176  *
    177  * \retval SHR_E_NONE No errors.
    178  */
    179 typedef int (*l3_route_traverse_f)(int unit, uint32_t flags,
    180                                    uint32_t start, uint32_t end,
    181                                    bcm_l3_route_traverse_cb cb,
    182                                    void *user_data);
    183 
    184 /*!
    185  * \brief Traverse multicast route table.
    186  *
    187  * \param [in] unit Unit number.
    188  * \param [in] attrib Operation attributes.
    189  * \param [in] trav_fn User supplied callback function.
    190  * \param [in] cb Callback function to contruct ipmc info from fib.
    191  * \param [in] user_data User supplied cookie used in callback function.
    192  *
    193  * \retval SHR_E_NONE No errors.
    194  */
    195 typedef int (*l3_ipmc_traverse_f)(int unit, uint32_t attrib,
    196                                   bcm_ipmc_traverse_cb trav_fn,
    197                                   bcmi_ltsw_l3_fib_to_ipmc_cb cb,
    198                                   void *user_data);
    199 
    200 /*!
    201  * \brief Attach flexctr action to the given VRF.
    202  *
    203  * \param [in] unit Unit number.
    204  * \param [in] vrf Virtual Router Instance.
    205  * \param [in] info Flex counter information.
    206  *
    207  * \retval SHR_E_NONE No errors.
    208  */
    209 typedef int (*l3_vrf_flexctr_attach_f)(
    210         int unit,
    211         bcm_vrf_t vrf,
    212         bcmi_ltsw_flexctr_counter_info_t *info);
    213 
    214 /*!
    215  * \brief Detach flexctr action of the given VRF.
    216  *
    217  * \param [in] unit Unit number.
    218  * \param [in] vrf Virtual Router Instance.
    219  *
    220  * \retval SHR_E_NONE No errors.
    221  */
    222 typedef int (*l3_vrf_flexctr_detach_f)(
    223         int unit,
    224         bcm_vrf_t vrf);
    225 
    226 /*!
    227  * \brief Get flex counter information of the given VRF.
    228  *
    229  * \param [in] unit Unit number.
    230  * \param [in] vrf Virtual Router Instance.
    231  * \param [out] info Flex counter information.
    232  *
    233  * \retval SHR_E_NONE No errors.
    234  * \retval !SHR_E_NONE Failure.
    235  */
    236 typedef int (*l3_vrf_flexctr_info_get_f)(
    237         int unit,
    238         bcm_vrf_t vrf,
    239         bcmi_ltsw_flexctr_counter_info_t *info);
    240 
    241 /*!
    242  * \brief Get IPv4 or IPv6 route count of the given VRF.
    243  *
    244  * \param [in] unit Unit number.
    245  * \param [in] vrf Virtual Router Instance.
    246  * \param [in] ipv6 Indicate ipv6 or ipv4.
    247  * \param [out] cnt  Route count.
    248  *
    249  * \retval SHR_E_NONE No errors.
    250  * \retval !SHR_E_NONE Failure.
    251  */
    252 typedef int (*l3_vrf_route_cnt_get_f)(int unit, bcm_vrf_t vrf,
    253                                       bool ipv6, uint32_t *cnt);
    254 
    255 /*!
    256  * \brief Traverse NAT host table.
    257  *
    258  * \param [in] unit Unit number.
    259  * \param [in] flags Flags to match during traverse.
    260  * \param [in] trav_fn User supplied callback function.
    261  * \param [in] cb Callback function to contruct NAT info from fib.
    262  * \param [in] user_data User supplied cookie used in callback function.
    263  *
    264  * \retval SHR_E_NONE No errors.
    265  */
    266 typedef int (*l3_nat_host_traverse_f)(int unit, uint32_t flags,
    267                                       bcm_l3_nat_ingress_traverse_cb trav_fn,
    268                                       bcmi_ltsw_l3_fib_to_nat_cb cb,
    269                                       void *user_data);
    270 
    271 /*!
    272  * \brief Get the FIB table database.
    273  *
    274  * \param [in] unit Unit number.
    275  * \param [out] tbl_db FIB table databse.
    276  *
    277  * \retval SHR_E_NONE No errors.
    278  */
    279 typedef int (*l3_fib_tbl_db_get_f)(int unit,
    280                                    bcmint_ltsw_l3_fib_tbl_db_t *tbl_db);
    281 
    282 /*
    283  * \brief Attach flexctr action to the given IPMC group.
    284  *
    285  * \param [in] unit Unit number.
    286  * \param [in] fib L3 forwarding info.
    287  * \param [in] info Flex counter information.
    288  *
    289  * \retval SHR_E_NONE No errors.
    290  */
    291 typedef int (*l3_mc_flexctr_attach_f)(
    292         int unit,
    293         bcmi_ltsw_l3_fib_t *fib,
    294         bcmi_ltsw_flexctr_counter_info_t *info);
    295 
    296 /*!
    297  * \brief Detach flexctr action of the given IPMC group.
    298  *
    299  * \param [in] unit Unit number.
    300  * \param [in] fib L3 forwarding info.
    301  *
    302  * \retval SHR_E_NONE No errors.
    303  */
    304 typedef int (*l3_mc_flexctr_detach_f)(
    305         int unit,
    306         bcmi_ltsw_l3_fib_t *fib);
    307 
    308 /*!
    309  * \brief Get flex counter information of the given IPMC group.
    310  *
    311  * \param [in] unit Unit number.
    312  * \param [in] fib L3 forwarding info.
    313  * \param [out] info Flex counter information.
    314  *
    315  * \retval SHR_E_NONE No errors.
    316  * \retval !SHR_E_NONE Failure.
    317  */
    318 typedef int (*l3_mc_flexctr_info_get_f)(
    319         int unit,
    320         bcmi_ltsw_l3_fib_t *fib,
    321         bcmi_ltsw_flexctr_counter_info_t *info);
    322 
    323 /*!
    324  * \brief Enable dropping L3 unicast packets if L3_IIF equals to L3_EIF.
    325  *
    326  * \param [in] unit Unit number.
    327  * \param [in] enable 1: Drop packets, 0: Do not drop packets.
    328  *
    329  * \retval SHR_E_NONE No errors.
    330  * \retval !SHR_E_NONE Failure.
    331  */
    332 typedef int (*l3_same_intf_drop_set_f)(
    333         int unit,
    334         int enable);
    335 
    336 /*!
    337  * \brief Get the drop setting for L3 unicast packets if L3_IIF equals to L3_EIF.
    338  *
    339  * \param [in] unit Unit number.
    340  * \param [out] enable 1: Drop packets, 0: Do not drop packets.
    341  *
    342  * \retval SHR_E_NONE No errors.
    343  * \retval !SHR_E_NONE Failure.
    344  */
    345 typedef int (*l3_same_intf_drop_get_f)(
    346         int unit,
    347         int *enable);
    348 
    349 /*!
    350  * \brief Age on L3 routing table, clear HIT bit of entry if set.
    351  *
    352  * \param [in] unit Unit number.
    353  * \param [in] age_out User supplied callback function.
    354  * \param [in] user_data  User provided cookie for callback.
    355  *
    356  * \retval SHR_E_NONE No errors.
    357  * \retval !SHR_E_NONE Failure.
    358  */
    359 typedef int (*l3_route_age_f)(int unit, bcm_l3_route_traverse_cb age_out,
    360                               void *user_data);
    361 
    362 /*!
    363  * \brief Attach flexctr action to the given L3 unicast route.
    364  *
    365  * \param [in] unit Unit number.
    366  * \param [in] fib L3 route info.
    367  * \param [in] info Flex counter information.
    368  *
    369  * \retval SHR_E_NONE No errors.
    370  */
    371 typedef int (*l3_route_flexctr_attach_f)(
    372     int unit,
    373     bcmi_ltsw_l3_fib_t *fib,
    374     bcmi_ltsw_flexctr_counter_info_t *info);
    375 
    376 /*!
    377  * \brief Detach flexctr action of the given L3 unicast route.
    378  *
    379  * \param [in] unit Unit number.
    380  * \param [in] fib L3 route info.
    381  *
    382  * \retval SHR_E_NONE No errors.
    383  */
    384 typedef int (*l3_route_flexctr_detach_f)(
    385     int unit,
    386     bcmi_ltsw_l3_fib_t *fib);
    387 
    388 /*!
    389  * \brief Get flex counter information of the given L3 unicast route.
    390  *
    391  * \param [in] unit Unit number.
    392  * \param [in] fib L3 route info.
    393  * \param [out] info Flex counter information.
    394  *
    395  * \retval SHR_E_NONE No errors.
    396  * \retval !SHR_E_NONE Failure.
    397  */
    398 typedef int (*l3_route_flexctr_info_get_f)(
    399     int unit,
    400     bcmi_ltsw_l3_fib_t *fib,
    401     bcmi_ltsw_flexctr_counter_info_t *info);
    402 
    403 /*!
    404  * \brief Set flex counter object value for the given L3 unicast route.
    405  *
    406  * \param [in] unit Unit number.
    407  * \param [in] fib L3 route info.
    408  * \param [in] value The flex counter object value.
    409  *
    410  * The flex counter object value could be used to generate counter index.
    411  *
    412  * \retval SHR_E_NONE No errors.
    413  * \retval !SHR_E_NONE Failure.
    414  */
    415 typedef int (*l3_route_flexctr_object_set_f)(
    416     int unit,
    417     bcmi_ltsw_l3_fib_t *fib,
    418     uint32_t value);
    419 
    420 /*!
    421  * \brief Get flex counter object value for the given L3 unicast route.
    422  *
    423  * \param [in] unit Unit Number.
    424  * \param [in] fib L3 route info.
    425  * \param [out] value The flex counter object value.
    426  *
    427  * \retval SHR_E_NONE No errors.
    428  * \retval !SHR_E_NONE Failure.
    429  */
    430 typedef int (*l3_route_flexctr_object_get_f)(
    431     int unit,
    432     bcmi_ltsw_l3_fib_t *fib,
    433     uint32_t *value);
    434 /*!
    435  * \brief Set flex counter object value for the given IPMC group.
    436  *
    437  * \param [in] unit Unit number.
    438  * \param [in] fib L3 route info.
    439  * \param [in] value The flex counter object value.
    440  *
    441  * The flex counter object value could be used to generate counter index.
    442  *
    443  * \retval SHR_E_NONE No errors.
    444  * \retval !SHR_E_NONE Failure.
    445  */
    446 typedef int (*l3_mc_flexctr_object_set_f)(
    447     int unit,
    448     bcmi_ltsw_l3_fib_t *fib,
    449     uint32_t value);
    450 
    451 /*!
    452  * \brief Get flex counter object value for the given IPMC group.
    453  *
    454  * \param [in] unit Unit Number.
    455  * \param [in] fib L3 route info.
    456  * \param [out] value The flex counter object value.
    457  *
    458  * \retval SHR_E_NONE No errors.
    459  * \retval !SHR_E_NONE Failure.
    460  */
    461 typedef int (*l3_mc_flexctr_object_get_f)(
    462     int unit,
    463     bcmi_ltsw_l3_fib_t *fib,
    464     uint32_t *value);
    465 
    466 /*!
    467  * \brief Clear hit bits of all L3 route entries if set.
    468  *
    469  * \param [in] unit Unit Number.
    470  *
    471  * \retval SHR_E_NONE No errors.
    472  * \retval !SHR_E_NONE Failure.
    473  */
    474 typedef int (*l3_route_hit_clear_f)(
    475     int unit);
    476 
    477 
    478 /*!
    479  * \brief Set L3_ALPM_CONTROL LT.
    480  *
    481  * \param [in] unit Unit number.
    482  * \param [in] alpm_temp ALPM template.
    483  *
    484  * \retval SHR_E_NONE No errors.
    485  * \retval !SHR_E_NONE Failure.
    486  */
    487 typedef int (*l3_alpm_control_set_f)(
    488     int unit,
    489     int alpm_temp,
    490     bcmi_ltsw_uft_mode_t uft_mode);
    491 
    492 /*!
    493  * \brief Clear hit bits of all host entries if set.
    494  *
    495  * \param [in] unit Unit Number.
    496  *
    497  * \retval SHR_E_NONE No errors.
    498  * \retval !SHR_E_NONE Failure.
    499  */
    500 typedef int (*l3_host_hit_clear_f)(
    501     int unit);
    502 
    503 /*!
    504  * \brief Adds a L3 AACL to the compression table.
    505  *
    506  * \param [in] unit Unit Number.
    507  * \param [in] options L3 AACL options. See BCM_L3_AACL_OPTIONS_xxx.
    508  * \param [in] aacl Pointer to bcm_l3_aacl_t struct which contains fields related to compression table.
    509  *
    510  * \retval SHR_E_NONE No errors.
    511  * \retval !SHR_E_NONE Failure.
    512  */
    513 typedef int (*l3_fib_aacl_add_f)(
    514     int unit,
    515     uint32_t options,
    516     bcm_l3_aacl_t *aacl);
    517 
    518 /*!
    519  * \brief Deletes a L3 AACL from the compression table.
    520  *
    521  * \param [in] unit Unit Number.
    522  * \param [in] aacl Pointer to bcm_l3_aacl_t struct which contains fields related to compression table.
    523  *
    524  * \retval SHR_E_NONE No errors.
    525  * \retval !SHR_E_NONE Failure.
    526  */
    527 typedef int (*l3_fib_aacl_delete_f)(
    528     int unit,
    529     bcm_l3_aacl_t *aacl);
    530 
    531 /*!
    532  * \brief Deletes all AACLs.
    533  *
    534  * \param [in] unit Unit Number.
    535  * \param [in] aacl Pointer to bcm_l3_aacl_t struct which contains fields related to compression table.
    536  *
    537  * \retval SHR_E_NONE No errors.
    538  * \retval !SHR_E_NONE Failure.
    539  */
    540 typedef int (*l3_fib_aacl_delete_all_f)(
    541     int unit,
    542     bcm_l3_aacl_t *aacl);
    543 
    544 /*!
    545  * \brief Finds information from the AACL table.
    546  *
    547  * \param [in] unit Unit Number.
    548  * \param [inout] aacl Pointer to bcm_l3_aacl_t struct which contains fields related to compression table.
    549  *
    550  * \retval SHR_E_NONE No errors.
    551  * \retval !SHR_E_NONE Failure.
    552  */
    553 typedef int (*l3_fib_aacl_find_f)(
    554     int unit,
    555     bcm_l3_aacl_t *aacl);
    556 
    557 /*!
    558  * \brief Traverse through the AACL table and run callback at each entry.
    559  *
    560  * \param [in] unit Unit Number.
    561  * \param [in] trav_fn Traverse call back function.
    562  * \param [in] user_data User data.
    563  *
    564  * \retval SHR_E_NONE No errors.
    565  * \retval !SHR_E_NONE Failure.
    566  */
    567 typedef int (*l3_fib_aacl_traverse_f)(
    568     int unit,
    569     bcm_l3_aacl_traverse_cb trav_fn,
    570     void *user_data);
    571 
    572 /*!
    573  * \brief Traverse through the AACL table and run callback at each entry.
    574  *
    575  * \param [in] unit Unit Number.
    576  * \param [in] flags L3 AACL flags. See BCM_L3_AACL_FLAGS_xxx.
    577  * \param [in] trav_fn Traverse call back function.
    578  * \param [in] user_data User data.
    579  *
    580  * \retval SHR_E_NONE No errors.
    581  * \retval !SHR_E_NONE Failure.
    582  */
    583 typedef int (*l3_fib_aacl_matched_traverse_f)(
    584     int unit,
    585     uint32_t flags,
    586     bcm_l3_aacl_traverse_cb trav_fn,
    587     void *user_data);
    588 
    589 /*!
    590  * \brief Route projection based on testDB.
    591  *
    592  * \param [in] unit Unit number.
    593  * \param [in] grp ALPM route group.
    594  * \param [out] prj_cnt Uni-dimensional projected maximum number of route.
    595  * \param [out] max_usage_lvl The level with maximum resource usage.
    596  * \param [out] max_usage Maximum resource usage.
    597  *
    598  * retval SHR_E_NONE No errors.
    599  * retval !SHR_E_NONE Failure.
    600  */
    601 typedef int (*l3_alpm_grp_prj_db_get_f)(
    602     int unit,
    603     bcm_l3_route_group_t grp,
    604     int *prj_cnt,
    605     int *max_usage_lvl,
    606     int *max_usage);
    607 
    608 /*!
    609  * \brief Performance LT operration.
    610  *
    611  * \param [in] unit Unit number.
    612  * \param [in] op Operation.
    613  * \param [in] vrf VRF.
    614  * \param [in] ip IP address.
    615  * \param [in] ip_mask  IP address mask.
    616  * \param [in] intf  Egress object.
    617  * \param [in] alpm_dmode  alpm data mode array.
    618  *
    619  * \retval SHR_E_NONE No errors.
    620  * \retval !SHR_E_NONE Failure.
    621  */
    622 typedef int (*l3_route_perf_v4_lt_op_f)(
    623     int unit,
    624     bcmi_ltsw_l3_route_perf_opcode_t op,
    625     int vrf,
    626     uint32 ip,
    627     uint32 ip_mask,
    628     int intf,
    629     int (*alpm_dmode)[2]);
    630 
    631 /*!
    632  * \brief Performance LT operration.
    633  *
    634  * \param [in] unit Unit number.
    635  * \param [in] op Operation.
    636  * \param [in] vrf VRF.
    637  * \param [in] v6 IPv6 address.
    638  * \param [in] v6_mask  IPv6 address mask.
    639  * \param [in] intf  Egress object.
    640  * \param [in] alpm_dmode  alpm data mode array.
    641  *
    642  * \retval SHR_E_NONE No errors.
    643  * \retval !SHR_E_NONE Failure.
    644  */
    645 typedef int (*l3_route_perf_v6_lt_op_f)(
    646     int unit,
    647     bcmi_ltsw_l3_route_perf_opcode_t op,
    648     int vrf,
    649     uint64_t *v6,
    650     uint64_t *v6_mask,
    651     int intf,
    652     int (*alpm_dmode)[2]);
    653 
    654 
    655 /*! L3 Fib function vector driver. */
    656 typedef struct mbcm_ltsw_l3_fib_drv_s {
    657 
    658     /*! FIB manager initialization. */
    659     l3_fib_init_f l3_fib_init;
    660 
    661     /*! FIB manager de-initialization. */
    662     l3_fib_deinit_f l3_fib_deinit;
    663 
    664     /*! Get max vrf number. */
    665     l3_fib_vrf_max_get_f l3_fib_vrf_max_get;
    666 
    667     /*! Add a L3 host entry for IPv4 unicast flow. */
    668     l3_host_add_f l3_host_ipv4_uc_add;
    669 
    670     /*! Delete a L3 host entry of IPv4 unicast flow. */
    671     l3_host_delete_f l3_host_ipv4_uc_delete;
    672 
    673     /*! Delete IPv4 unicast host entries based on IP prefix. */
    674     l3_host_delete_f l3_host_ipv4_uc_del_by_prefix;
    675 
    676     /*! Lookup a L3 host entry of IPv4 unicast flow. */
    677     l3_host_find_f l3_host_ipv4_uc_find;
    678 
    679     /*! Traverse IPv4 unicast host entries. */
    680     l3_host_traverse_f l3_host_ipv4_uc_traverse;
    681 
    682     /*! Add a L3 host entry for IPv4 multicast flow. */
    683     l3_host_add_f l3_host_ipv4_mc_add;
    684 
    685     /*! Delete a L3 host entry of IPv4 multicast flow. */
    686     l3_host_delete_f l3_host_ipv4_mc_delete;
    687 
    688     /*! Lookup a L3 host entry of IPv4 multicast flow. */
    689     l3_host_find_f l3_host_ipv4_mc_find;
    690 
    691     /*! Traverse IPv4 multicast host entries. */
    692     l3_ipmc_traverse_f l3_host_ipv4_mc_traverse;
    693 
    694     /*! Attach flex counter to L3 host IPv4 multicast entry. */
    695     l3_mc_flexctr_attach_f l3_host_ipv4_mc_flexctr_attach;
    696 
    697     /*! Detach flex counter from L3 host IPv4 multicast entry. */
    698     l3_mc_flexctr_detach_f l3_host_ipv4_mc_flexctr_detach;
    699 
    700     /*! Get flex counter info associated with L3 host IPv4 multicast entry. */
    701     l3_mc_flexctr_info_get_f l3_host_ipv4_mc_flexctr_info_get;
    702 
    703     /*! Add a L3 host entry for IPv6 unicast flow. */
    704     l3_host_add_f l3_host_ipv6_uc_add;
    705 
    706     /*! Delete a L3 host entry of IPv6 unicast flow. */
    707     l3_host_delete_f l3_host_ipv6_uc_delete;
    708 
    709     /*! Delete IPv6 unicast host entries based on IP prefix. */
    710     l3_host_delete_f l3_host_ipv6_uc_del_by_prefix;
    711 
    712     /*! Lookup a L3 host entry of IPv6 unicast flow. */
    713     l3_host_find_f l3_host_ipv6_uc_find;
    714 
    715     /*! Traverse IPv6 unicast host entries. */
    716     l3_host_traverse_f l3_host_ipv6_uc_traverse;
    717 
    718     /*! Add a L3 host entry for IPv6 multicast flow. */
    719     l3_host_add_f l3_host_ipv6_mc_add;
    720 
    721     /*! Delete a L3 host entry of IPv6 multicast flow. */
    722     l3_host_delete_f l3_host_ipv6_mc_delete;
    723 
    724     /*! Lookup a L3 host entry of IPv6 multicast flow. */
    725     l3_host_find_f l3_host_ipv6_mc_find;
    726 
    727     /*! Traverse IPv6 multicast host entries. */
    728     l3_ipmc_traverse_f l3_host_ipv6_mc_traverse;
    729 
    730     /*! Attach flex counter to L3 host IPv6 multicast entry. */
    731     l3_mc_flexctr_attach_f l3_host_ipv6_mc_flexctr_attach;
    732 
    733     /*! Detach flex counter from L3 host IPv6 multicast entry. */
    734     l3_mc_flexctr_detach_f l3_host_ipv6_mc_flexctr_detach;
    735 
    736     /*! Get flex counter info associated with L3 host IPv6 multicast entry. */
    737     l3_mc_flexctr_info_get_f l3_host_ipv6_mc_flexctr_info_get;
    738 
    739     /*! Delete L3 host entries that match or not match a specified L3 intf. */
    740     l3_host_del_by_intf_f l3_host_del_by_intf;
    741 
    742     /*! Delete all L3 host entries. */
    743     l3_host_del_all_f l3_host_del_all;
    744 
    745     /*! Add a L3 route entry for IPv4 unicast flow. */
    746     l3_route_add_f l3_route_ipv4_uc_add;
    747 
    748     /*! Delete a L3 route entry of IPv4 unicast flow. */
    749     l3_route_delete_f l3_route_ipv4_uc_delete;
    750 
    751     /*! Lookup a L3 route entry of IPv4 unicast flow. */
    752     l3_route_find_f l3_route_ipv4_uc_find;
    753 
    754     /*! Traverse IPv4 unicast route entries. */
    755     l3_route_traverse_f l3_route_ipv4_uc_traverse;
    756 
    757     /*! Add a L3 route entry for IPv4 multicast flow. */
    758     l3_route_add_f l3_route_ipv4_mc_add;
    759 
    760     /*! Delete a L3 route entry of IPv4 multicast flow. */
    761     l3_route_delete_f l3_route_ipv4_mc_delete;
    762 
    763     /*! Lookup a L3 route entry of IPv4 multicast flow. */
    764     l3_route_find_f l3_route_ipv4_mc_find;
    765 
    766     /*! Traverse IPv4 multicast route entries. */
    767     l3_ipmc_traverse_f l3_route_ipv4_mc_traverse;
    768 
    769     /*! Attach flex counter to L3 route IPv4 multicast entry. */
    770     l3_mc_flexctr_attach_f l3_route_ipv4_mc_flexctr_attach;
    771 
    772     /*! Detach flex counter from L3 route IPv4 multicast entry. */
    773     l3_mc_flexctr_detach_f l3_route_ipv4_mc_flexctr_detach;
    774 
    775     /*! Get flex counter info associated with L3 route IPv4 multicast entry. */
    776     l3_mc_flexctr_info_get_f l3_route_ipv4_mc_flexctr_info_get;
    777 
    778     /*! Add a L3 route entry for IPv6 unicast flow. */
    779     l3_route_add_f l3_route_ipv6_uc_add;
    780 
    781     /*! Delete a L3 route entry of IPv6 unicast flow. */
    782     l3_route_delete_f l3_route_ipv6_uc_delete;
    783 
    784     /*! Lookup a L3 route entry of IPv6 unicast flow. */
    785     l3_route_find_f l3_route_ipv6_uc_find;
    786 
    787     /*! Traverse IPv6 unicast route entries. */
    788     l3_route_traverse_f l3_route_ipv6_uc_traverse;
    789 
    790     /*! Add a L3 route entry for IPv6 multicast flow. */
    791     l3_route_add_f l3_route_ipv6_mc_add;
    792 
    793     /*! Delete a L3 route entry of IPv6 multicast flow. */
    794     l3_route_delete_f l3_route_ipv6_mc_delete;
    795 
    796     /*! Lookup a L3 route entry of IPv6 multicast flow. */
    797     l3_route_find_f l3_route_ipv6_mc_find;
    798 
    799     /*! Traverse IPv6 multicast route entries. */
    800     l3_ipmc_traverse_f l3_route_ipv6_mc_traverse;
    801 
    802     /*! Attach flex counter to L3 route IPv6 multicast entry. */
    803     l3_mc_flexctr_attach_f l3_route_ipv6_mc_flexctr_attach;
    804 
    805     /*! Detach flex counter from L3 route IPv6 multicast entry. */
    806     l3_mc_flexctr_detach_f l3_route_ipv6_mc_flexctr_detach;
    807 
    808     /*! Get flex counter info associated with L3 route IPv6 multicast entry. */
    809     l3_mc_flexctr_info_get_f l3_route_ipv6_mc_flexctr_info_get;
    810 
    811     /*! Delete L3 route entries that match or not match a specified L3 intf. */
    812     l3_route_del_by_intf_f l3_route_del_by_intf;
    813 
    814     /*! Delete all L3 route entries. */
    815     l3_route_del_all_f l3_route_del_all;
    816 
    817     /*! Attach flexctr action to the given VRF. */
    818     l3_vrf_flexctr_attach_f l3_vrf_flexctr_attach;
    819 
    820     /*! Detach flexctr action of the given VRF. */
    821     l3_vrf_flexctr_detach_f l3_vrf_flexctr_detach;
    822 
    823     /*! Get flex counter information of the given VRF. */
    824     l3_vrf_flexctr_info_get_f l3_vrf_flexctr_info_get;
    825 
    826     /*! Get IPv4 or IPv6 route count of the given VRF. */
    827     l3_vrf_route_cnt_get_f l3_vrf_route_cnt_get;
    828 
    829     /*! Traverse IPv4 host table for NAT entries. */
    830     l3_nat_host_traverse_f l3_nat_host_traverse;
    831 
    832     /*! Get FIB table databse. */
    833     l3_fib_tbl_db_get_f l3_fib_tbl_db_get;
    834 
    835     /*! Enable dropping L3 unicast packets if L3_IIF equals to L3_EIF. */
    836     l3_same_intf_drop_set_f l3_same_intf_drop_set;
    837 
    838     /*! Get the drop setting for L3 unicast packets if L3_IIF equals to L3_EIF. */
    839     l3_same_intf_drop_get_f l3_same_intf_drop_get;
    840 
    841     /*! Age hit bits of all L3 route entries. */
    842     l3_route_age_f l3_route_age;
    843 
    844     /* Attach L3 route flex counter. */
    845     l3_route_flexctr_attach_f l3_route_flexctr_attach;
    846 
    847     /* Detach L3 route flex counter. */
    848     l3_route_flexctr_detach_f l3_route_flexctr_detach;
    849 
    850     /* Get L3 route flex counter info. */
    851     l3_route_flexctr_info_get_f l3_route_flexctr_info_get;
    852 
    853     /* Set L3 route flex counter object value. */
    854     l3_route_flexctr_object_set_f l3_route_flexctr_object_set;
    855 
    856     /* Get L3 route flex counter object value. */
    857     l3_route_flexctr_object_get_f l3_route_flexctr_object_get;
    858 
    859     /* Attach IPMC group flex counter. */
    860     l3_mc_flexctr_attach_f l3_ipmc_flexctr_attach;
    861 
    862     /* Detach IPMC group flex counter. */
    863     l3_mc_flexctr_detach_f l3_ipmc_flexctr_detach;
    864 
    865     /* Get IPMC group flex counter info. */
    866     l3_mc_flexctr_info_get_f l3_ipmc_flexctr_info_get;
    867 
    868     /* Set IPMC group flex counter object value. */
    869     l3_mc_flexctr_object_set_f l3_ipmc_flexctr_object_set;
    870 
    871     /* Get IPMC group flex counter object value. */
    872     l3_mc_flexctr_object_get_f l3_ipmc_flexctr_object_get;
    873 
    874     /* Clear hit bits of all L3 route entries. */
    875     l3_route_hit_clear_f l3_route_hit_clear;
    876 
    877     /* Clear hit bits of all IPMC entries. */
    878     l3_host_hit_clear_f l3_host_hit_clear;
    879 
    880     /*! Age hit bits of all IPMC entries. */
    881     l3_ipmc_traverse_f l3_ipmc_age;
    882 
    883     /*! Set L3 ALPM control. */
    884     l3_alpm_control_set_f l3_alpm_control_set;
    885 
    886     /*! Adds a L3 AACL to the compression table. */
    887     l3_fib_aacl_add_f l3_fib_aacl_add;
    888 
    889     /*! Deletes a L3 AACL from the compression table. */
    890     l3_fib_aacl_delete_f l3_fib_aacl_delete;
    891 
    892     /*! Deletes all AACLs. */
    893     l3_fib_aacl_delete_all_f l3_fib_aacl_delete_all;
    894 
    895     /*! Finds information from the AACL table. */
    896     l3_fib_aacl_find_f l3_fib_aacl_find;
    897 
    898     /*! Traverse through the AACL table and run callback at each entry. */
    899     l3_fib_aacl_traverse_f l3_fib_aacl_traverse;
    900 
    901     /*! Traverse through the AACL table and run callback at each entry. */
    902     l3_fib_aacl_matched_traverse_f l3_fib_aacl_matched_traverse;
    903 
    904     /*! Route projection based on testDB. */
    905     l3_alpm_grp_prj_db_get_f l3_alpm_grp_prj_db_get;
    906 
    907     /*! Route performance LT operation. */
    908     l3_route_perf_v4_lt_op_f l3_route_perf_v4_lt_op;
    909 
    910     /*! Route performance LT operation. */
    911     l3_route_perf_v6_lt_op_f l3_route_perf_v6_lt_op;
    912 
    913 } mbcm_ltsw_l3_fib_drv_t;
    914 
    915 /*!
    916  * \brief Set the L3 fib driver of the device.
    917  *
    918  * \param [in] unit Unit number.
    919  * \param [in] drv L3 driver to set.
    920  *
    921  * \retval SHR_E_NONE No errors.
    922  */
    923 extern int
    924 mbcm_ltsw_l3_fib_drv_set(int unit, mbcm_ltsw_l3_fib_drv_t *drv);
    925 
    926 /*!
    927  * \brief Initialize L3 fib module.
    928  *
    929  * \param [in] unit Unit number.
    930  *
    931  * \retval SHR_E_NONE No errors.
    932  */
    933 extern int
    934 mbcm_ltsw_l3_fib_init(int unit);
    935 
    936 /*!
    937  * \brief De-Initialize L3 fib module.
    938  *
    939  * \param [in] unit Unit number.
    940  *
    941  * \retval SHR_E_NONE No errors.
    942  */
    943 extern int
    944 mbcm_ltsw_l3_fib_deinit(int unit);
    945 
    946 /*!
    947  * \brief Get the max vrf number.
    948  *
    949  * \param [in] unit Unit number.
    950  * \param [out] max_vrf Max vrf.
    951  *
    952  * \retval SHR_E_NONE No errors.
    953  */
    954 extern int
    955 mbcm_ltsw_l3_fib_vrf_max_get(int unit, uint32_t *max_vrf);
    956 
    957 /*!
    958  * \brief Add an entry to the L3 host table for IPv4 unicast.
    959  *
    960  * \param [in] unit Unit number.
    961  * \param [in] fib L3 host entry information.
    962  *
    963  * \retval SHR_E_NONE No errors.
    964  */
    965 extern int
    966 mbcm_ltsw_l3_host_ipv4_uc_add(int unit, bcmi_ltsw_l3_fib_t *fib);
    967 
    968 /*!
    969  * \brief Delete an entry of IPv4 unicast from L3 host table.
    970  *
    971  * \param [in] unit Unit number.
    972  * \param [in] fib L3 host entry information.
    973  *
    974  * \retval SHR_E_NONE No errors.
    975  */
    976 extern int
    977 mbcm_ltsw_l3_host_ipv4_uc_delete(int unit, bcmi_ltsw_l3_fib_t *fib);
    978 
    979 /*!
    980  * \brief Delete entries of IPv4 unicast based on IP prefix.
    981  *
    982  * \param [in] unit Unit number.
    983  * \param [in] fib L3 host entry information.
    984  *
    985  * \retval SHR_E_NONE No errors.
    986  */
    987 extern int
    988 mbcm_ltsw_l3_host_ipv4_uc_del_by_prefix(int unit, bcmi_ltsw_l3_fib_t *fib);
    989 
    990 /*!
    991  * \brief Find a L3 host entry for IPv4 unicast.
    992  *
    993  * \param [in] unit Unit number.
    994  * \param [in/out] fib L3 host entry information.
    995  *
    996  * \retval SHR_E_NONE No errors.
    997  */
    998 extern int
    999 mbcm_ltsw_l3_host_ipv4_uc_find(int unit, bcmi_ltsw_l3_fib_t *fib);
   1000 
   1001 /*!
   1002  * \brief Traverse IPv4 unicast host table.
   1003  *
   1004  * \param [in] unit Unit number.
   1005  * \param [in] flags Operation flags.
   1006  * \param [in] start Callback called after this many L3 entries.
   1007  * \param [in] end Callback called before this many L3 entries.
   1008  * \param [in] cb User supplied callback function.
   1009  * \param [in] user_data User supplied cookie used in callback function.
   1010  *
   1011  * \retval SHR_E_NONE No errors.
   1012  */
   1013 extern int
   1014 mbcm_ltsw_l3_host_ipv4_uc_traverse(int unit, uint32_t flags,
   1015                                    uint32_t start, uint32_t end,
   1016                                    bcm_l3_host_traverse_cb cb, void *user_data);
   1017 
   1018 /*!
   1019  * \brief Add an entry to the L3 host table for IPv4 multicast.
   1020  *
   1021  * \param [in] unit Unit number.
   1022  * \param [in] fib L3 host entry information.
   1023  *
   1024  * \retval SHR_E_NONE No errors.
   1025  */
   1026 extern int
   1027 mbcm_ltsw_l3_host_ipv4_mc_add(int unit, bcmi_ltsw_l3_fib_t *fib);
   1028 
   1029 /*!
   1030  * \brief Delete an entry of IPv4 multicast from L3 host table.
   1031  *
   1032  * \param [in] unit Unit number.
   1033  * \param [in] fib L3 host entry information.
   1034  *
   1035  * \retval SHR_E_NONE No errors.
   1036  */
   1037 extern int
   1038 mbcm_ltsw_l3_host_ipv4_mc_delete(int unit, bcmi_ltsw_l3_fib_t *fib);
   1039 
   1040 /*!
   1041  * \brief Find a L3 host entry for IPv4 multicast.
   1042  *
   1043  * \param [in] unit Unit number.
   1044  * \param [in/out] fib L3 host entry information.
   1045  *
   1046  * \retval SHR_E_NONE No errors.
   1047  */
   1048 extern int
   1049 mbcm_ltsw_l3_host_ipv4_mc_find(int unit, bcmi_ltsw_l3_fib_t *fib);
   1050 
   1051 /*!
   1052  * \brief Traverse IPv4 multicast host table.
   1053  *
   1054  * \param [in] unit Unit number.
   1055  * \param [in] attrib Operation attributes.
   1056  * \param [in] trav_fn User supplied callback function.
   1057  * \param [in] cb Callback function to contruct ipmc info from fib.
   1058  * \param [in] user_data User supplied cookie used in callback function.
   1059  *
   1060  * \retval SHR_E_NONE No errors.
   1061  */
   1062 extern int
   1063 mbcm_ltsw_l3_host_ipv4_mc_traverse(int unit, uint32_t attrib,
   1064                                    bcm_ipmc_traverse_cb trav_fn,
   1065                                    bcmi_ltsw_l3_fib_to_ipmc_cb cb,
   1066                                    void *user_data);
   1067 
   1068 /*
   1069  * \brief Attach flexctr action to the given IPMC group.
   1070  *
   1071  * \param [in] unit Unit number.
   1072  * \param [in] fib L3 forwarding info.
   1073  * \param [in] info Flex counter information.
   1074  *
   1075  * \retval SHR_E_NONE No errors.
   1076  */
   1077 extern int
   1078 mbcm_ltsw_l3_host_ipv4_mc_flexctr_attach(int unit,
   1079                                          bcmi_ltsw_l3_fib_t *fib,
   1080                                          bcmi_ltsw_flexctr_counter_info_t *ci);
   1081 
   1082 /*!
   1083  * \brief Detach flexctr action of the given IPMC group.
   1084  *
   1085  * \param [in] unit Unit number.
   1086  * \param [in] fib L3 forwarding info.
   1087  *
   1088  * \retval SHR_E_NONE No errors.
   1089  */
   1090 extern int
   1091 mbcm_ltsw_l3_host_ipv4_mc_flexctr_detach(int unit, bcmi_ltsw_l3_fib_t *fib);
   1092 
   1093 /*!
   1094  * \brief Get flex counter information of the given IPMC group.
   1095  *
   1096  * \param [in] unit Unit number.
   1097  * \param [in] fib L3 forwarding info.
   1098  * \param [out] info Flex counter information.
   1099  *
   1100  * \retval SHR_E_NONE No errors.
   1101  * \retval !SHR_E_NONE Failure.
   1102  */
   1103 extern int
   1104 mbcm_ltsw_l3_host_ipv4_mc_flexctr_info_get(int unit,
   1105                                        bcmi_ltsw_l3_fib_t *fib,
   1106                                        bcmi_ltsw_flexctr_counter_info_t *ci);
   1107 
   1108 /*!
   1109  * \brief Add an entry to the L3 host table for IPv6 unicast.
   1110  *
   1111  * \param [in] unit Unit number.
   1112  * \param [in] fib L3 host entry information.
   1113  *
   1114  * \retval SHR_E_NONE No errors.
   1115  */
   1116 extern int
   1117 mbcm_ltsw_l3_host_ipv6_uc_add(int unit, bcmi_ltsw_l3_fib_t *fib);
   1118 
   1119 /*!
   1120  * \brief Delete an entry of IPv6 unicast from L3 host table.
   1121  *
   1122  * \param [in] unit Unit number.
   1123  * \param [in] fib L3 host entry information.
   1124  *
   1125  * \retval SHR_E_NONE No errors.
   1126  */
   1127 extern int
   1128 mbcm_ltsw_l3_host_ipv6_uc_delete(int unit, bcmi_ltsw_l3_fib_t *fib);
   1129 
   1130 /*!
   1131  * \brief Delete entries of IPv6 unicast based on IP prefix.
   1132  *
   1133  * \param [in] unit Unit number.
   1134  * \param [in] fib L3 host entry information.
   1135  *
   1136  * \retval SHR_E_NONE No errors.
   1137  */
   1138 extern int
   1139 mbcm_ltsw_l3_host_ipv6_uc_del_by_prefix(int unit, bcmi_ltsw_l3_fib_t *fib);
   1140 
   1141 /*!
   1142  * \brief Find a L3 host entry for IPv6 unicast.
   1143  *
   1144  * \param [in] unit Unit number.
   1145  * \param [in/out] fib L3 host entry information.
   1146  *
   1147  * \retval SHR_E_NONE No errors.
   1148  */
   1149 extern int
   1150 mbcm_ltsw_l3_host_ipv6_uc_find(int unit, bcmi_ltsw_l3_fib_t *fib);
   1151 
   1152 /*!
   1153  * \brief Traverse IPv6 unicast host table.
   1154  *
   1155  * \param [in] unit Unit number.
   1156  * \param [in] flags Operation flags.
   1157  * \param [in] start Callback called after this many L3 entries.
   1158  * \param [in] end Callback called before this many L3 entries.
   1159  * \param [in] cb User supplied callback function.
   1160  * \param [in] user_data User supplied cookie used in callback function.
   1161  *
   1162  * \retval SHR_E_NONE No errors.
   1163  */
   1164 extern int
   1165 mbcm_ltsw_l3_host_ipv6_uc_traverse(int unit, uint32_t flags,
   1166                                    uint32_t start, uint32_t end,
   1167                                    bcm_l3_host_traverse_cb cb, void *user_data);
   1168 
   1169 /*!
   1170  * \brief Add an entry to the L3 host table for IPv6 multicast.
   1171  *
   1172  * \param [in] unit Unit number.
   1173  * \param [in] fib L3 host entry information.
   1174  *
   1175  * \retval SHR_E_NONE No errors.
   1176  */
   1177 extern int
   1178 mbcm_ltsw_l3_host_ipv6_mc_add(int unit, bcmi_ltsw_l3_fib_t *fib);
   1179 
   1180 /*!
   1181  * \brief Delete an entry of IPv6 multicast from L3 host table.
   1182  *
   1183  * \param [in] unit Unit number.
   1184  * \param [in] fib L3 host entry information.
   1185  *
   1186  * \retval SHR_E_NONE No errors.
   1187  */
   1188 extern int
   1189 mbcm_ltsw_l3_host_ipv6_mc_delete(int unit, bcmi_ltsw_l3_fib_t *fib);
   1190 
   1191 /*!
   1192  * \brief Find a L3 host entry for IPv6 multiicast.
   1193  *
   1194  * \param [in] unit Unit number.
   1195  * \param [in/out] fib L3 host entry information.
   1196  *
   1197  * \retval SHR_E_NONE No errors.
   1198  */
   1199 extern int
   1200 mbcm_ltsw_l3_host_ipv6_mc_find(int unit, bcmi_ltsw_l3_fib_t *fib);
   1201 
   1202 /*!
   1203  * \brief Traverse IPv6 multicast host table.
   1204  *
   1205  * \param [in] unit Unit number.
   1206  * \param [in] attrib Operation attributes.
   1207  * \param [in] trav_fn User supplied callback function.
   1208  * \param [in] cb Callback function to contruct ipmc info from fib.
   1209  * \param [in] user_data User supplied cookie used in callback function.
   1210  *
   1211  * \retval SHR_E_NONE No errors.
   1212  */
   1213 extern int
   1214 mbcm_ltsw_l3_host_ipv6_mc_traverse(int unit, uint32_t attrib,
   1215                                    bcm_ipmc_traverse_cb trav_fn,
   1216                                    bcmi_ltsw_l3_fib_to_ipmc_cb cb,
   1217                                    void *user_data);
   1218 
   1219 /*
   1220  * \brief Attach flexctr action to the given IPMC group.
   1221  *
   1222  * \param [in] unit Unit number.
   1223  * \param [in] fib L3 forwarding info.
   1224  * \param [in] info Flex counter information.
   1225  *
   1226  * \retval SHR_E_NONE No errors.
   1227  */
   1228 extern int
   1229 mbcm_ltsw_l3_host_ipv6_mc_flexctr_attach(int unit,
   1230                                          bcmi_ltsw_l3_fib_t *fib,
   1231                                          bcmi_ltsw_flexctr_counter_info_t *ci);
   1232 
   1233 /*!
   1234  * \brief Detach flexctr action of the given IPMC group.
   1235  *
   1236  * \param [in] unit Unit number.
   1237  * \param [in] fib L3 forwarding info.
   1238  *
   1239  * \retval SHR_E_NONE No errors.
   1240  */
   1241 extern int
   1242 mbcm_ltsw_l3_host_ipv6_mc_flexctr_detach(int unit, bcmi_ltsw_l3_fib_t *fib);
   1243 
   1244 /*!
   1245  * \brief Get flex counter information of the given IPMC group.
   1246  *
   1247  * \param [in] unit Unit number.
   1248  * \param [in] fib L3 forwarding info.
   1249  * \param [out] info Flex counter information.
   1250  *
   1251  * \retval SHR_E_NONE No errors.
   1252  * \retval !SHR_E_NONE Failure.
   1253  */
   1254 extern int
   1255 mbcm_ltsw_l3_host_ipv6_mc_flexctr_info_get(int unit,
   1256                                        bcmi_ltsw_l3_fib_t *fib,
   1257                                        bcmi_ltsw_flexctr_counter_info_t *ci);
   1258 
   1259 /*!
   1260  * \brief Delete entries that match or not match a specified L3 interface.
   1261  *
   1262  * \param [in] unit Unit number.
   1263  * \param [in] fib L3 host entry information.
   1264  * \param [in] negate Match L3 interface if negate is 0, otherwise not match.
   1265  *
   1266  * \retval SHR_E_NONE No errors.
   1267  */
   1268 extern int
   1269 mbcm_ltsw_l3_host_del_by_intf(int unit, bcmi_ltsw_l3_fib_t *fib, int negate);
   1270 
   1271 /*!
   1272  * \brief Delete all L3 host entries.
   1273  *
   1274  * \param [in] unit Unit number.
   1275  * \param [in] attrib L3 FIB attributes.
   1276  *
   1277  * \retval SHR_E_NONE No errors.
   1278  */
   1279 extern int
   1280 mbcm_ltsw_l3_host_del_all(int unit, uint32_t attrib);
   1281 
   1282 /*!
   1283  * \brief Add an entry to the L3 route table for IPv4 unicast.
   1284  *
   1285  * \param [in] unit Unit number.
   1286  * \param [in] fib L3 route entry information.
   1287  *
   1288  * \retval SHR_E_NONE No errors.
   1289  */
   1290 extern int
   1291 mbcm_ltsw_l3_route_ipv4_uc_add(int unit, bcmi_ltsw_l3_fib_t *fib);
   1292 
   1293 /*!
   1294  * \brief Delete an entry of IPv4 unicast from L3 route table.
   1295  *
   1296  * \param [in] unit Unit number.
   1297  * \param [in] fib L3 route entry information.
   1298  *
   1299  * \retval SHR_E_NONE No errors.
   1300  */
   1301 extern int
   1302 mbcm_ltsw_l3_route_ipv4_uc_delete(int unit, bcmi_ltsw_l3_fib_t *fib);
   1303 
   1304 /*!
   1305  * \brief Find a L3 route entry for IPv4 unicast.
   1306  *
   1307  * \param [in] unit Unit number.
   1308  * \param [in/out] fib L3 route entry information.
   1309  *
   1310  * \retval SHR_E_NONE No errors.
   1311  */
   1312 extern int
   1313 mbcm_ltsw_l3_route_ipv4_uc_find(int unit, bool lpm, bcmi_ltsw_l3_fib_t *fib);
   1314 
   1315 /*!
   1316  * \brief Traverse IPv4 unicast route table.
   1317  *
   1318  * \param [in] unit Unit number.
   1319  * \param [in] flags Operation flags.
   1320  * \param [in] start Callback called after this many L3 entries.
   1321  * \param [in] end Callback called before this many L3 entries.
   1322  * \param [in] cb User supplied callback function.
   1323  * \param [in] user_data User supplied cookie used in callback function.
   1324  *
   1325  * \retval SHR_E_NONE No errors.
   1326  */
   1327 extern int
   1328 mbcm_ltsw_l3_route_ipv4_uc_traverse(int unit, uint32_t flags,
   1329                                     uint32_t start, uint32_t end,
   1330                                     bcm_l3_route_traverse_cb cb,
   1331                                     void *user_data);
   1332 
   1333 /*!
   1334  * \brief Add an entry to the L3 route table for IPv4 multicast.
   1335  *
   1336  * \param [in] unit Unit number.
   1337  * \param [in] fib L3 route entry information.
   1338  *
   1339  * \retval SHR_E_NONE No errors.
   1340  */
   1341 extern int
   1342 mbcm_ltsw_l3_route_ipv4_mc_add(int unit, bcmi_ltsw_l3_fib_t *fib);
   1343 
   1344 /*!
   1345  * \brief Delete an entry of IPv4 multicast from L3 route table.
   1346  *
   1347  * \param [in] unit Unit number.
   1348  * \param [in] fib L3 route entry information.
   1349  *
   1350  * \retval SHR_E_NONE No errors.
   1351  */
   1352 extern int
   1353 mbcm_ltsw_l3_route_ipv4_mc_delete(int unit, bcmi_ltsw_l3_fib_t *fib);
   1354 
   1355 /*!
   1356  * \brief Find a L3 route entry for IPv4 multicast.
   1357  *
   1358  * \param [in] unit Unit number.
   1359  * \param [in/out] fib L3 route entry information.
   1360  *
   1361  * \retval SHR_E_NONE No errors.
   1362  */
   1363 extern int
   1364 mbcm_ltsw_l3_route_ipv4_mc_find(int unit, bool lpm, bcmi_ltsw_l3_fib_t *fib);
   1365 
   1366 /*!
   1367  * \brief Traverse IPv4 multicast route table.
   1368  *
   1369  * \param [in] unit Unit number.
   1370  * \param [in] attrib Operation attributes.
   1371  * \param [in] trav_fn User supplied callback function.
   1372  * \param [in] cb Callback function to contruct ipmc info from fib.
   1373  * \param [in] user_data User supplied cookie used in callback function.
   1374  *
   1375  * \retval SHR_E_NONE No errors.
   1376  */
   1377 extern int
   1378 mbcm_ltsw_l3_route_ipv4_mc_traverse(int unit, uint32_t attrib,
   1379                                     bcm_ipmc_traverse_cb trav_fn,
   1380                                     bcmi_ltsw_l3_fib_to_ipmc_cb cb,
   1381                                     void *user_data);
   1382 
   1383 /*
   1384  * \brief Attach flexctr action to the given IPMC group.
   1385  *
   1386  * \param [in] unit Unit number.
   1387  * \param [in] fib L3 forwarding info.
   1388  * \param [in] info Flex counter information.
   1389  *
   1390  * \retval SHR_E_NONE No errors.
   1391  */
   1392 extern int
   1393 mbcm_ltsw_l3_route_ipv4_mc_flexctr_attach(int unit,
   1394                                           bcmi_ltsw_l3_fib_t *fib,
   1395                                           bcmi_ltsw_flexctr_counter_info_t *ci);
   1396 
   1397 /*!
   1398  * \brief Detach flexctr action of the given IPMC group.
   1399  *
   1400  * \param [in] unit Unit number.
   1401  * \param [in] fib L3 forwarding info.
   1402  *
   1403  * \retval SHR_E_NONE No errors.
   1404  */
   1405 extern int
   1406 mbcm_ltsw_l3_route_ipv4_mc_flexctr_detach(int unit, bcmi_ltsw_l3_fib_t *fib);
   1407 
   1408 /*!
   1409  * \brief Get flex counter information of the given IPMC group.
   1410  *
   1411  * \param [in] unit Unit number.
   1412  * \param [in] fib L3 forwarding info.
   1413  * \param [out] info Flex counter information.
   1414  *
   1415  * \retval SHR_E_NONE No errors.
   1416  * \retval !SHR_E_NONE Failure.
   1417  */
   1418 extern int
   1419 mbcm_ltsw_l3_route_ipv4_mc_flexctr_info_get(int unit,
   1420                                         bcmi_ltsw_l3_fib_t *fib,
   1421                                         bcmi_ltsw_flexctr_counter_info_t *ci);
   1422 
   1423 /*!
   1424  * \brief Add an entry to the L3 route table for IPv6 unicast.
   1425  *
   1426  * \param [in] unit Unit number.
   1427  * \param [in] fib L3 route entry information.
   1428  *
   1429  * \retval SHR_E_NONE No errors.
   1430  */
   1431 extern int
   1432 mbcm_ltsw_l3_route_ipv6_uc_add(int unit, bcmi_ltsw_l3_fib_t *fib);
   1433 
   1434 /*!
   1435  * \brief Delete an entry of IPv6 unicast from L3 route table.
   1436  *
   1437  * \param [in] unit Unit number.
   1438  * \param [in] fib L3 route entry information.
   1439  *
   1440  * \retval SHR_E_NONE No errors.
   1441  */
   1442 extern int
   1443 mbcm_ltsw_l3_route_ipv6_uc_delete(int unit, bcmi_ltsw_l3_fib_t *fib);
   1444 
   1445 /*!
   1446  * \brief Find a L3 route entry for IPv6 unicast.
   1447  *
   1448  * \param [in] unit Unit number.
   1449  * \param [in/out] fib L3 route entry information.
   1450  *
   1451  * \retval SHR_E_NONE No errors.
   1452  */
   1453 extern int
   1454 mbcm_ltsw_l3_route_ipv6_uc_find(int unit, bool lpm, bcmi_ltsw_l3_fib_t *fib);
   1455 
   1456 /*!
   1457  * \brief Traverse IPv6 unicast route table.
   1458  *
   1459  * \param [in] unit Unit number.
   1460  * \param [in] flags Operation flags.
   1461  * \param [in] start Callback called after this many L3 entries.
   1462  * \param [in] end Callback called before this many L3 entries.
   1463  * \param [in] cb User supplied callback function.
   1464  * \param [in] user_data User supplied cookie used in callback function.
   1465  *
   1466  * \retval SHR_E_NONE No errors.
   1467  */
   1468 extern int
   1469 mbcm_ltsw_l3_route_ipv6_uc_traverse(int unit, uint32_t flags,
   1470                                     uint32_t start, uint32_t end,
   1471                                     bcm_l3_route_traverse_cb cb,
   1472                                     void *user_data);
   1473 
   1474 /*!
   1475  * \brief Add an entry to the L3 route table for IPv6 multicast.
   1476  *
   1477  * \param [in] unit Unit number.
   1478  * \param [in] fib L3 route entry information.
   1479  *
   1480  * \retval SHR_E_NONE No errors.
   1481  */
   1482 extern int
   1483 mbcm_ltsw_l3_route_ipv6_mc_add(int unit, bcmi_ltsw_l3_fib_t *fib);
   1484 
   1485 /*!
   1486  * \brief Delete an entry of IPv6 multicast from L3 route table.
   1487  *
   1488  * \param [in] unit Unit number.
   1489  * \param [in] fib L3 route entry information.
   1490  *
   1491  * \retval SHR_E_NONE No errors.
   1492  */
   1493 extern int
   1494 mbcm_ltsw_l3_route_ipv6_mc_delete(int unit, bcmi_ltsw_l3_fib_t *fib);
   1495 
   1496 /*!
   1497  * \brief Find a L3 route entry for IPv6 multiicast.
   1498  *
   1499  * \param [in] unit Unit number.
   1500  * \param [in/out] fib L3 route entry information.
   1501  *
   1502  * \retval SHR_E_NONE No errors.
   1503  */
   1504 extern int
   1505 mbcm_ltsw_l3_route_ipv6_mc_find(int unit, bool lpm, bcmi_ltsw_l3_fib_t *fib);
   1506 
   1507 /*!
   1508  * \brief Traverse IPv6 multicast route table.
   1509  *
   1510  * \param [in] unit Unit number.
   1511  * \param [in] attrib Operation attributes.
   1512  * \param [in] trav_fn User supplied callback function.
   1513  * \param [in] cb Callback function to contruct ipmc info from fib.
   1514  * \param [in] user_data User supplied cookie used in callback function.
   1515  *
   1516  * \retval SHR_E_NONE No errors.
   1517  */
   1518 extern int
   1519 mbcm_ltsw_l3_route_ipv6_mc_traverse(int unit, uint32_t attrib,
   1520                                     bcm_ipmc_traverse_cb trav_fn,
   1521                                     bcmi_ltsw_l3_fib_to_ipmc_cb cb,
   1522                                     void *user_data);
   1523 
   1524 /*
   1525  * \brief Attach flexctr action to the given IPMC group.
   1526  *
   1527  * \param [in] unit Unit number.
   1528  * \param [in] fib L3 forwarding info.
   1529  * \param [in] info Flex counter information.
   1530  *
   1531  * \retval SHR_E_NONE No errors.
   1532  */
   1533 extern int
   1534 mbcm_ltsw_l3_route_ipv6_mc_flexctr_attach(int unit,
   1535                                           bcmi_ltsw_l3_fib_t *fib,
   1536                                           bcmi_ltsw_flexctr_counter_info_t *ci);
   1537 
   1538 /*!
   1539  * \brief Detach flexctr action of the given IPMC group.
   1540  *
   1541  * \param [in] unit Unit number.
   1542  * \param [in] fib L3 forwarding info.
   1543  *
   1544  * \retval SHR_E_NONE No errors.
   1545  */
   1546 extern int
   1547 mbcm_ltsw_l3_route_ipv6_mc_flexctr_detach(int unit, bcmi_ltsw_l3_fib_t *fib);
   1548 
   1549 /*!
   1550  * \brief Get flex counter information of the given IPMC group.
   1551  *
   1552  * \param [in] unit Unit number.
   1553  * \param [in] fib L3 forwarding info.
   1554  * \param [out] info Flex counter information.
   1555  *
   1556  * \retval SHR_E_NONE No errors.
   1557  * \retval !SHR_E_NONE Failure.
   1558  */
   1559 extern int
   1560 mbcm_ltsw_l3_route_ipv6_mc_flexctr_info_get(int unit,
   1561                                         bcmi_ltsw_l3_fib_t *fib,
   1562                                         bcmi_ltsw_flexctr_counter_info_t *ci);
   1563 
   1564 /*!
   1565  * \brief Delete entries that match or not match a specified L3 interface.
   1566  *
   1567  * \param [in] unit Unit number.
   1568  * \param [in] fib L3 route entry information.
   1569  * \param [in] negate Match L3 interface if negate is 0, otherwise not match.
   1570  *
   1571  * \retval SHR_E_NONE No errors.
   1572  */
   1573 extern int
   1574 mbcm_ltsw_l3_route_del_by_intf(int unit, bcmi_ltsw_l3_fib_t *fib, int negate);
   1575 
   1576 /*!
   1577  * \brief Delete all L3 route entries.
   1578  *
   1579  * \param [in] unit Unit number.
   1580  * \param [in] attrib L3 FIB attributes.
   1581  *
   1582  * \retval SHR_E_NONE No errors.
   1583  */
   1584 extern int
   1585 mbcm_ltsw_l3_route_del_all(int unit, uint32_t attrib);
   1586 
   1587 /*!
   1588  * \brief Attach flexctr action to the given VRF.
   1589  *
   1590  * \param [in] unit Unit number.
   1591  * \param [in] vrf Virtual Router Instance.
   1592  * \param [in] info Flex counter information.
   1593  *
   1594  * \retval SHR_E_NONE No errors.
   1595  */
   1596 extern int
   1597 mbcm_ltsw_l3_vrf_flexctr_attach(
   1598         int unit,
   1599         bcm_vrf_t vrf,
   1600         bcmi_ltsw_flexctr_counter_info_t *info);
   1601 
   1602 /*!
   1603  * \brief Detach flexctr action of the given VRF.
   1604  *
   1605  * \param [in] unit Unit number.
   1606  * \param [in] vrf Virtual Router Instance.
   1607  *
   1608  * \retval SHR_E_NONE No errors.
   1609  */
   1610 extern int
   1611 mbcm_ltsw_l3_vrf_flexctr_detach(
   1612         int unit,
   1613         bcm_vrf_t vrf);
   1614 
   1615 /*!
   1616  * \brief Get flex counter information of the given VRF.
   1617  *
   1618  * \param [in] unit Unit number.
   1619  * \param [in] vrf Virtual Router Instance.
   1620  * \param [out] info Flex counter information.
   1621  *
   1622  * \retval SHR_E_NONE No errors.
   1623  * \retval !SHR_E_NONE Failure.
   1624  */
   1625 extern int
   1626 mbcm_ltsw_l3_vrf_flexctr_info_get(
   1627         int unit,
   1628         bcm_vrf_t vrf,
   1629         bcmi_ltsw_flexctr_counter_info_t *info);
   1630 
   1631 /*!
   1632  * \brief Get IPv4 or IPv6 route count of the given VRF.
   1633  *
   1634  * \param [in] unit Unit number.
   1635  * \param [in] vrf Virtual Router Instance.
   1636  * \param [in] ipv6 Indicate ipv6 or ipv4.
   1637  * \param [out] cnt  Route count.
   1638  *
   1639  * \retval SHR_E_NONE No errors.
   1640  * \retval !SHR_E_NONE Failure.
   1641  */
   1642 extern int
   1643 mbcm_ltsw_l3_vrf_route_cnt_get(int unit, bcm_vrf_t vrf,
   1644                                bool ipv6, uint32_t *cnt);
   1645 
   1646 /*!
   1647  * \brief Traverse NAT host table.
   1648  *
   1649  * \param [in] unit Unit number.
   1650  * \param [in] flags Flags to match during traverse.
   1651  * \param [in] trav_fn User supplied callback function.
   1652  * \param [in] cb Callback function to contruct NAT info from fib.
   1653  * \param [in] user_data User supplied cookie used in callback function.
   1654  *
   1655  * \retval SHR_E_NONE No errors.
   1656  */
   1657 extern int
   1658 mbcm_ltsw_l3_nat_host_traverse(int unit, uint32_t flags,
   1659                                bcm_l3_nat_ingress_traverse_cb trav_fn,
   1660                                bcmi_ltsw_l3_fib_to_nat_cb cb,
   1661                                void *user_data);
   1662 
   1663 /*!
   1664  * \brief Get the FIB table database.
   1665  *
   1666  * \param [in] unit Unit number.
   1667  * \param [out] tbl_db FIB table databse.
   1668  *
   1669  * \retval SHR_E_NONE No errors.
   1670  */
   1671 extern int
   1672 mbcm_ltsw_l3_fib_tbl_db_get(int unit,
   1673                             bcmint_ltsw_l3_fib_tbl_db_t *tbl_db);
   1674 
   1675 /*!
   1676  * \brief Enable dropping L3 unicast packets if L3_IIF equals to L3_EIF.
   1677  *
   1678  * \param [in] unit Unit number.
   1679  * \param [in] enable 1: Drop packets, 0: Do not drop packets.
   1680  *
   1681  * \retval SHR_E_NONE No errors.
   1682  * \retval !SHR_E_NONE Failure.
   1683  */
   1684 extern int
   1685 mbcm_ltsw_l3_same_intf_drop_set(int unit, int enable);
   1686 
   1687 /*!
   1688  * \brief Get the drop setting for L3 unicast packets if L3_IIF equals to L3_EIF.
   1689  *
   1690  * \param [in] unit Unit number.
   1691  * \param [out] enable 1: Drop packets, 0: Do not drop packets
   1692  *
   1693  * \retval SHR_E_NONE No errors.
   1694  * \retval !SHR_E_NONE Failure.
   1695  */
   1696 extern int
   1697 mbcm_ltsw_l3_same_intf_drop_get(int unit, int *enable);
   1698 
   1699 /*!
   1700  * \brief Set L3_ALPM_CONTROL LT.
   1701  *
   1702  * \param [in] unit Unit number.
   1703  * \param [in] alpm_temp ALPM template.
   1704  *
   1705  * \retval SHR_E_NONE No errors.
   1706  * \retval !SHR_E_NONE Failure.
   1707  */
   1708 extern int
   1709 mbcm_ltsw_l3_alpm_control_set(int unit, int alpm_temp,
   1710                               bcmi_ltsw_uft_mode_t uft_mode);
   1711 
   1712 /*!
   1713  * \brief Age on L3 routing table, clear HIT bit of entry if set.
   1714  *
   1715  * \param [in] unit Unit number.
   1716  * \param [in] age_out User supplied callback function.
   1717  * \param [in] user_data  User provided cookie for callback.
   1718  *
   1719  * \retval SHR_E_NONE No errors.
   1720  * \retval !SHR_E_NONE Failure.
   1721  */
   1722 extern int
   1723 mbcm_ltsw_l3_route_age(int unit, bcm_l3_route_traverse_cb age_out,
   1724                        void *user_data);
   1725 
   1726 /*!
   1727  * \brief Attach flexctr action to the given L3 unicast route.
   1728  *
   1729  * \param [in] unit Unit number.
   1730  * \param [in] fib L3 route info.
   1731  * \param [in] info Flex counter information.
   1732  *
   1733  * \retval SHR_E_NONE No errors.
   1734  */
   1735 extern int
   1736 mbcm_ltsw_l3_route_flexctr_attach(
   1737     int unit,
   1738     bcmi_ltsw_l3_fib_t *fib,
   1739     bcmi_ltsw_flexctr_counter_info_t *info);
   1740 
   1741 /*!
   1742  * \brief Detach flexctr action of the given L3 unicast route.
   1743  *
   1744  * \param [in] unit Unit number.
   1745  * \param [in] fib L3 route info.
   1746  *
   1747  * \retval SHR_E_NONE No errors.
   1748  */
   1749 extern int
   1750 mbcm_ltsw_l3_route_flexctr_detach(
   1751     int unit,
   1752     bcmi_ltsw_l3_fib_t *fib);
   1753 
   1754 /*!
   1755  * \brief Get flex counter information of the given L3 unicast route.
   1756  *
   1757  * \param [in] unit Unit number.
   1758  * \param [in] fib L3 route info.
   1759  * \param [out] info Flex counter information.
   1760  *
   1761  * \retval SHR_E_NONE No errors.
   1762  * \retval !SHR_E_NONE Failure.
   1763  */
   1764 extern int
   1765 mbcm_ltsw_l3_route_flexctr_info_get(
   1766     int unit,
   1767     bcmi_ltsw_l3_fib_t *fib,
   1768     bcmi_ltsw_flexctr_counter_info_t *info);
   1769 
   1770 /*!
   1771  * \brief Set flex counter object value for the given L3 unicast route.
   1772  *
   1773  * \param [in] unit Unit number.
   1774  * \param [in] fib L3 route info.
   1775  * \param [in] value The flex counter object value.
   1776  *
   1777  * The flex counter object value could be used to generate counter index.
   1778  *
   1779  * \retval SHR_E_NONE No errors.
   1780  * \retval !SHR_E_NONE Failure.
   1781  */
   1782 extern int
   1783 mbcm_ltsw_l3_route_flexctr_object_set(
   1784     int unit,
   1785 	bcmi_ltsw_l3_fib_t *fib,
   1786     uint32_t value);
   1787 
   1788 /*!
   1789  * \brief Get flex counter object value for the given L3 unicast route.
   1790  *
   1791  * \param [in] unit Unit Number.
   1792  * \param [in] fib L3 route info.
   1793  * \param [out] value The flex counter object value.
   1794  *
   1795  * \retval SHR_E_NONE No errors.
   1796  * \retval !SHR_E_NONE Failure.
   1797  */
   1798 extern int
   1799 mbcm_ltsw_l3_route_flexctr_object_get(
   1800     int unit,
   1801     bcmi_ltsw_l3_fib_t *fib,
   1802     uint32_t *value);
   1803 
   1804 /*!
   1805  * \brief Attach flexctr action to the given IPMC group.
   1806  *
   1807  * \param [in] unit Unit number.
   1808  * \param [in] fib IPMC group info.
   1809  * \param [in] info Flex counter information.
   1810  *
   1811  * \retval SHR_E_NONE No errors.
   1812  */
   1813 extern int
   1814 mbcm_ltsw_l3_ipmc_flexctr_attach(
   1815     int unit,
   1816     bcmi_ltsw_l3_fib_t *fib,
   1817     bcmi_ltsw_flexctr_counter_info_t *info);
   1818 
   1819 /*!
   1820  * \brief Detach flexctr action of the given IPMC group.
   1821  *
   1822  * \param [in] unit Unit number.
   1823  * \param [in] fib IPMC group info.
   1824  *
   1825  * \retval SHR_E_NONE No errors.
   1826  */
   1827 extern int
   1828 mbcm_ltsw_l3_ipmc_flexctr_detach(
   1829     int unit,
   1830     bcmi_ltsw_l3_fib_t *fib);
   1831 
   1832 /*!
   1833  * \brief Get flex counter information of the given IPMC group.
   1834  *
   1835  * \param [in] unit Unit number.
   1836  * \param [in] fib IPMC info.
   1837  * \param [out] info Flex counter information.
   1838  *
   1839  * \retval SHR_E_NONE No errors.
   1840  * \retval !SHR_E_NONE Failure.
   1841  */
   1842 extern int
   1843 mbcm_ltsw_l3_ipmc_flexctr_info_get(
   1844     int unit,
   1845     bcmi_ltsw_l3_fib_t *fib,
   1846     bcmi_ltsw_flexctr_counter_info_t *info);
   1847 
   1848 /*!
   1849  * \brief Set flex counter object value for the given IPMC group.
   1850  *
   1851  * \param [in] unit Unit number.
   1852  * \param [in] fib IPMC group info.
   1853  * \param [in] value The flex counter object value.
   1854  *
   1855  * The flex counter object value could be used to generate counter index.
   1856  *
   1857  * \retval SHR_E_NONE No errors.
   1858  * \retval !SHR_E_NONE Failure.
   1859  */
   1860 extern int
   1861 mbcm_ltsw_l3_ipmc_flexctr_object_set(
   1862     int unit,
   1863     bcmi_ltsw_l3_fib_t *fib,
   1864     uint32_t value);
   1865 
   1866 /*!
   1867  * \brief Get flex counter object value for the given IPMC group.
   1868  *
   1869  * \param [in] unit Unit Number.
   1870  * \param [in] fib IPMC group info.
   1871  * \param [out] value The flex counter object value.
   1872  *
   1873  * \retval SHR_E_NONE No errors.
   1874  * \retval !SHR_E_NONE Failure.
   1875  */
   1876 extern int
   1877 mbcm_ltsw_l3_ipmc_flexctr_object_get(
   1878     int unit,
   1879     bcmi_ltsw_l3_fib_t *fib,
   1880     uint32_t *value);
   1881 
   1882 /*!
   1883  * \brief Clear hit bits for all L3 route entries if set.
   1884  *
   1885  * \param [in] unit Unit Number.
   1886  *
   1887  * \retval SHR_E_NONE No errors.
   1888  * \retval !SHR_E_NONE Failure.
   1889  */
   1890 extern int
   1891 mbcm_ltsw_l3_route_hit_clear(
   1892     int unit);
   1893 
   1894 /*!
   1895  * \brief Clear hit bits for all host entries if set.
   1896  *
   1897  * \param [in] unit Unit Number.
   1898  *
   1899  * \retval SHR_E_NONE No errors.
   1900  * \retval !SHR_E_NONE Failure.
   1901  */
   1902 extern int
   1903 mbcm_ltsw_l3_host_hit_clear(
   1904     int unit);
   1905 
   1906 /*!
   1907  * \brief Public function to get IPMC v4 table size.
   1908  *
   1909  * \param [in] unit Unit Number.
   1910  * \param [out] size IPMC v4 table size.
   1911  *
   1912  * \retval SHR_E_NONE No errors.
   1913  * \retval !SHR_E_NONE Failure.
   1914  */
   1915 
   1916 extern int
   1917 mbcm_ltsw_l3_ipmc_v4_size_get(
   1918     int unit,
   1919     int *size);
   1920 
   1921 /*!
   1922  * \brief Public function to get current IPMC v4 entry count.
   1923  *
   1924  * \param [in] unit Unit Number.
   1925  * \param [out] count IPMC v4 entry count.
   1926  *
   1927  * \retval SHR_E_NONE No errors.
   1928  * \retval !SHR_E_NONE Failure.
   1929  */
   1930 extern int
   1931 mbcm_ltsw_l3_ipmc_v4_count_get(
   1932     int unit,
   1933     int *count);
   1934 
   1935 /*!
   1936  * \brief Public function to get IPMC v6 table size.
   1937  *
   1938  * \param [in] unit Unit Number.
   1939  * \param [out] size IPMC v6 table size.
   1940  *
   1941  * \retval SHR_E_NONE No errors.
   1942  * \retval !SHR_E_NONE Failure.
   1943  */
   1944 
   1945 extern int
   1946 mbcm_ltsw_l3_ipmc_v6_size_get(
   1947     int unit,
   1948     int *size);
   1949 
   1950 /*!
   1951  * \brief Public function to get current IPMC v6 entry count.
   1952  *
   1953  * \param [in] unit Unit Number.
   1954  * \param [out] count IPMC v6 entry count.
   1955  *
   1956  * \retval SHR_E_NONE No errors.
   1957  * \retval !SHR_E_NONE Failure.
   1958  */
   1959 extern int
   1960 mbcm_ltsw_l3_ipmc_v6_count_get(
   1961     int unit,
   1962     int *count);
   1963 
   1964 /*!
   1965  * \brief Age on IPMC table, clear HIT bit of entry if set.
   1966  *
   1967  * \param [in] unit Unit number.
   1968  * \param [in] attrib Operation attributes.
   1969  * \param [in] age_cb User supplied callback function.
   1970  * \param [in] cb Callback function to construct bcm_ipmc_addr_t from fib info.
   1971  * \param [in] user_data  User provided cookie for callback.
   1972  *
   1973  * \retval SHR_E_NONE No errors.
   1974  * \retval !SHR_E_NONE Failure.
   1975  */
   1976 extern int
   1977 mbcm_ltsw_l3_ipmc_age(
   1978     int unit,
   1979     uint32_t attrib,
   1980     bcm_ipmc_traverse_cb age_cb,
   1981     bcmi_ltsw_l3_fib_to_ipmc_cb cb,
   1982     void *user_data);
   1983 
   1984 /*!
   1985  * \brief Adds a L3 AACL to the compression table.
   1986  *
   1987  * \param [in] unit Unit Number.
   1988  * \param [in] options L3 AACL options. See BCM_L3_AACL_OPTIONS_xxx.
   1989  * \param [in] aacl Pointer to bcm_l3_aacl_t struct which contains fields related to compression table.
   1990  *
   1991  * \retval SHR_E_NONE No errors.
   1992  * \retval !SHR_E_NONE Failure.
   1993  */
   1994 extern int
   1995 mbcm_ltsw_l3_fib_aacl_add(
   1996     int unit,
   1997     uint32_t options,
   1998     bcm_l3_aacl_t *aacl);
   1999 
   2000 /*!
   2001  * \brief Deletes a L3 AACL from the compression table.
   2002  *
   2003  * \param [in] unit Unit Number.
   2004  * \param [in] aacl Pointer to bcm_l3_aacl_t struct which contains fields related to compression table.
   2005  *
   2006  * \retval SHR_E_NONE No errors.
   2007  * \retval !SHR_E_NONE Failure.
   2008  */
   2009 extern int
   2010 mbcm_ltsw_l3_fib_aacl_delete(
   2011     int unit,
   2012     bcm_l3_aacl_t *aacl);
   2013 
   2014 /*!
   2015  * \brief Deletes all AACLs.
   2016  *
   2017  * \param [in] unit Unit Number.
   2018  * \param [in] aacl Pointer to bcm_l3_aacl_t struct which contains fields related to compression table.
   2019  *
   2020  * \retval SHR_E_NONE No errors.
   2021  * \retval !SHR_E_NONE Failure.
   2022  */
   2023 extern int
   2024 mbcm_ltsw_l3_fib_aacl_delete_all(
   2025     int unit,
   2026     bcm_l3_aacl_t *aacl);
   2027 
   2028 /*!
   2029  * \brief Finds information from the AACL table.
   2030  *
   2031  * \param [in] unit Unit Number.
   2032  * \param [inout] aacl Pointer to bcm_l3_aacl_t struct which contains fields related to compression table.
   2033  *
   2034  * \retval SHR_E_NONE No errors.
   2035  * \retval !SHR_E_NONE Failure.
   2036  */
   2037 extern int
   2038 mbcm_ltsw_l3_fib_aacl_find(
   2039     int unit,
   2040     bcm_l3_aacl_t *aacl);
   2041 
   2042 /*!
   2043  * \brief Traverse through the AACL table and run callback at each entry.
   2044  *
   2045  * \param [in] unit Unit Number.
   2046  * \param [in] trav_fn Traverse call back function.
   2047  * \param [in] user_data User data.
   2048  *
   2049  * \retval SHR_E_NONE No errors.
   2050  * \retval !SHR_E_NONE Failure.
   2051  */
   2052 extern int
   2053 mbcm_ltsw_l3_fib_aacl_traverse(
   2054     int unit,
   2055     bcm_l3_aacl_traverse_cb trav_fn,
   2056     void *user_data);
   2057 
   2058 /*!
   2059  * \brief Traverse through the AACL table and run callback at each entry.
   2060  *
   2061  * \param [in] unit Unit Number.
   2062  * \param [in] flags L3 AACL flags. See BCM_L3_AACL_FLAGS_xxx.
   2063  * \param [in] trav_fn Traverse call back function.
   2064  * \param [in] user_data User data.
   2065  *
   2066  * \retval SHR_E_NONE No errors.
   2067  * \retval !SHR_E_NONE Failure.
   2068  */
   2069 extern int
   2070 mbcm_ltsw_l3_fib_aacl_matched_traverse(
   2071     int unit,
   2072     uint32_t flags,
   2073     bcm_l3_aacl_traverse_cb trav_fn,
   2074     void *user_data);
   2075 
   2076 /*!
   2077  * \brief Route projection based on testDB.
   2078  *
   2079  * \param [in] unit Unit number.
   2080  * \param [in] grp ALPM route group.
   2081  * \param [out] prj_cnt Uni-dimensional projected maximum number of route.
   2082  * \param [out] max_usage_lvl The level with maximum resource usage.
   2083  * \param [out] max_usage Maximum resource usage.
   2084  *
   2085  * retval SHR_E_NONE No errors.
   2086  * retval !SHR_E_NONE Failure.
   2087  */
   2088 extern int
   2089 mbcm_ltsw_l3_alpm_grp_prj_db_get(
   2090     int unit,
   2091     bcm_l3_route_group_t grp,
   2092     int *prj_cnt,
   2093     int *max_usage_lvl,
   2094     int *max_usage);
   2095 
   2096 /*!
   2097  * \brief Performance LT operration.
   2098  *
   2099  * \param [in] unit Unit number.
   2100  * \param [in] op Operation.
   2101  * \param [in] vrf VRF.
   2102  * \param [in] ip IP address.
   2103  * \param [in] ip_mask  IP address mask.
   2104  * \param [in] intf  Egress object.
   2105  * \param [in] alpm_dmode  alpm data mode array.
   2106  *
   2107  * \retval SHR_E_NONE No errors.
   2108  * \retval !SHR_E_NONE Failure.
   2109  */
   2110 int
   2111 mbcm_ltsw_l3_route_perf_v4_lt_op(
   2112     int unit,
   2113     bcmi_ltsw_l3_route_perf_opcode_t op,
   2114     int vrf,
   2115     uint32 ip,
   2116     uint32 ip_mask,
   2117     int intf,
   2118     int (*alpm_dmode)[2]);
   2119 
   2120 /*!
   2121  * \brief Performance LT operration.
   2122  *
   2123  * \param [in] unit Unit number.
   2124  * \param [in] op Operation.
   2125  * \param [in] vrf VRF.
   2126  * \param [in] v6 IPv6 address.
   2127  * \param [in] v6_mask  IPv6 address mask.
   2128  * \param [in] intf  Egress object.
   2129  * \param [in] alpm_dmode  alpm data mode array.
   2130  *
   2131  * \retval SHR_E_NONE No errors.
   2132  * \retval !SHR_E_NONE Failure.
   2133  */
   2134 int
   2135 mbcm_ltsw_l3_route_perf_v6_lt_op(
   2136     int unit,
   2137     bcmi_ltsw_l3_route_perf_opcode_t op,
   2138     int vrf,
   2139     uint64_t *v6,
   2140     uint64_t *v6_mask,
   2141     int intf,
   2142     int (*alpm_dmode)[2]);
   2143 
   2144 #endif /* BCMI_LTSW_MBCM_L3_FIB_H */