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


      1 /*! \file l3_fib.h
      2  *
      3  * L3 FIB header file.
      4  * This file contains L3 FIB definitions internal to the BCM library.
      5  */
      6 /*
      7  * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file.
      8  * 
      9  * Copyright 2007-2020 Broadcom Inc. All rights reserved.
     10  */
     11 
     12 #ifndef BCMI_LTSW_L3_FIB_H
     13 #define BCMI_LTSW_L3_FIB_H
     14 
     15 #include <sal/sal_types.h>
     16 #include <bcm/ipmc.h>
     17 #include <bcm/nat.h>
     18 #include <bcm_int/ltsw/flexctr.h>
     19 
     20 /*!
     21  * \name Attributes of FIB entries to be operated.
     22  * \anchor BCMI_LTSW_L3_FIB_ATTR_xxx
     23  */
     24 
     25 /*! \{ */
     26 /*! Operate IPv4 entries. */
     27 #define BCMI_LTSW_L3_FIB_ATTR_IPV4          (1<<0)
     28 /*! Operate IPv6 entries. */
     29 #define BCMI_LTSW_L3_FIB_ATTR_IPV6          (1<<1)
     30 /*! Operate host entries. */
     31 #define BCMI_LTSW_L3_FIB_ATTR_HOST          (1<<2)
     32 /*! Operate network entries. */
     33 #define BCMI_LTSW_L3_FIB_ATTR_NETWORK       (1<<3)
     34 /*! Operate unicast entries. */
     35 #define BCMI_LTSW_L3_FIB_ATTR_UC            (1<<4)
     36 /*! Operate multicast entries. */
     37 #define BCMI_LTSW_L3_FIB_ATTR_MC            (1<<5)
     38 /*! Operate multicast (S,G) entries. */
     39 #define BCMI_LTSW_L3_FIB_ATTR_SRC_GROUP     (1<<6)
     40 /*! Operate multicast (*,G) entries. */
     41 #define BCMI_LTSW_L3_FIB_ATTR_STAR_GROUP    (1<<7)
     42 /*! Operate NAT host entries. */
     43 #define BCMI_LTSW_L3_FIB_ATTR_NAT           (1<<8)
     44 /*! \} */
     45 
     46 /*!
     47  * \name Operation flag of FIB object.
     48  * \anchor BCMI_LTSW_L3_FIB_OBJ_F_xxx
     49  */
     50 
     51 /*! \{ */
     52 /*! Count in unit of base-entry (IPv4 Unicast). */
     53 #define BCMI_LTSW_L3_FIB_OBJ_F_BASE_ENTRIES (1 << 0)
     54 /*! \} */
     55 
     56 /*!
     57  * \name Internal flags of FIB object with other modules.
     58  * \anchor BCMI_LTSW_L3_FIB_F_xxx
     59  */
     60 
     61 /*! \{ */
     62 /*! Copy packets to CPU on IPMC RPF failure. */
     63 #define BCMI_LTSW_L3_FIB_F_IPMC_RPF_FAIL_TOCPU           (1 << 0)
     64 /*! Drop packets on IPMC RPF failure. */
     65 #define BCMI_LTSW_L3_FIB_F_IPMC_RPF_FAIL_DROP            (1 << 1)
     66 /*! Do not source port check this entry. */
     67 #define BCMI_LTSW_L3_FIB_F_IPMC_SOURCE_PORT_NOCHECK      (1 << 2)
     68 /*! When set, perform RPF check.. */
     69 #define BCMI_LTSW_L3_FIB_F_IPMC_POST_LOOKUP_RPF_CHECK    (1 << 3)
     70 
     71 /*! \} */
     72 
     73 /* L3 FIB objects. */
     74 typedef enum bcmi_ltsw_l3_fib_object_e {
     75     BCMI_LTSW_L3_FIB_OBJ_HOST_MAX,
     76     BCMI_LTSW_L3_FIB_OBJ_HOST_USED,
     77     BCMI_LTSW_L3_FIB_OBJ_HOST_V4_MAX,
     78     BCMI_LTSW_L3_FIB_OBJ_HOST_V4_USED,
     79     BCMI_LTSW_L3_FIB_OBJ_HOST_V6_MAX,
     80     BCMI_LTSW_L3_FIB_OBJ_HOST_V6_USED,
     81     BCMI_LTSW_L3_FIB_OBJ_HOST_MC_MAX,
     82     BCMI_LTSW_L3_FIB_OBJ_HOST_MC_USED,
     83     BCMI_LTSW_L3_FIB_OBJ_HOST_MC_V4_MAX,
     84     BCMI_LTSW_L3_FIB_OBJ_HOST_MC_V4_USED,
     85     BCMI_LTSW_L3_FIB_OBJ_HOST_MC_V6_MAX,
     86     BCMI_LTSW_L3_FIB_OBJ_HOST_MC_V6_USED,
     87     BCMI_LTSW_L3_FIB_OBJ_HOST_UC_V4_MAX,
     88     BCMI_LTSW_L3_FIB_OBJ_HOST_UC_V4_USED,
     89     BCMI_LTSW_L3_FIB_OBJ_HOST_UC_V6_MAX,
     90     BCMI_LTSW_L3_FIB_OBJ_HOST_UC_V6_USED,
     91     BCMI_LTSW_L3_FIB_OBJ_HOST_MC_SG_V4_MAX,
     92     BCMI_LTSW_L3_FIB_OBJ_HOST_MC_SG_V4_USED,
     93     BCMI_LTSW_L3_FIB_OBJ_HOST_MC_SG_V6_MAX,
     94     BCMI_LTSW_L3_FIB_OBJ_HOST_MC_SG_V6_USED,
     95     BCMI_LTSW_L3_FIB_OBJ_HOST_MC_G_V4_MAX,
     96     BCMI_LTSW_L3_FIB_OBJ_HOST_MC_G_V4_USED,
     97     BCMI_LTSW_L3_FIB_OBJ_HOST_MC_G_V6_MAX,
     98     BCMI_LTSW_L3_FIB_OBJ_HOST_MC_G_V6_USED,
     99     BCMI_LTSW_L3_FIB_OBJ_ROUTE_MAX,
    100     BCMI_LTSW_L3_FIB_OBJ_ROUTE_USED,
    101     BCMI_LTSW_L3_FIB_OBJ_ROUTE_V4_MAX,
    102     BCMI_LTSW_L3_FIB_OBJ_ROUTE_V4_USED,
    103     BCMI_LTSW_L3_FIB_OBJ_ROUTE_V6_64_MAX,
    104     BCMI_LTSW_L3_FIB_OBJ_ROUTE_V6_64_USED,
    105     BCMI_LTSW_L3_FIB_OBJ_ROUTE_V6_128_MAX,
    106     BCMI_LTSW_L3_FIB_OBJ_ROUTE_V6_128_USED,
    107     BCMI_LTSW_L3_FIB_OBJ_CNT
    108 } bcmi_ltsw_l3_fib_object_t;
    109 
    110 /*!
    111  * \brief Covers all info needed to config L3 table
    112  *
    113  * This data structure covers all info needed to config L3 table
    114  */
    115 typedef struct bcmi_ltsw_l3_fib_s {
    116 
    117     /*! See <bcm/l3.h> BCM_L3_*. */
    118     uint32_t flags;
    119 
    120     /*! See <bcm/l3.h> BCM_L3_FLAGS2_*. */
    121     uint32_t flags2;
    122 
    123     /*! See <bcm/l3.h> BCM_L3_FLAGS3_*. */
    124     uint32_t flags3;
    125 
    126     /*! See <ltsw/l3_fib.h> BCMI_LTSW_L3_FIB_*. */
    127     uint32_t int_flags;
    128 
    129     /*! Indicate a network route entry. */
    130     int network;
    131 
    132     /*! Virtual Router Instance. */
    133     bcm_vrf_t vrf;
    134 
    135     /*! Virtual Router Instance mask. */
    136     bcm_vrf_t vrf_mask;
    137 
    138     /*! IPv4 address. */
    139     bcm_ip_t ip_addr;
    140 
    141     /*! IPv4 address mask. */
    142     bcm_ip_t ip_addr_mask;
    143 
    144     /*! IPv6 address. */
    145     bcm_ip6_t ip6_addr;
    146 
    147     /*! IPv6 address mask. */
    148     bcm_ip6_t ip6_addr_mask;
    149 
    150     /*! Source IPv4 address. */
    151     bcm_ip_t sip_addr;
    152 
    153     /*! Source IPv4 address mask. */
    154     bcm_ip_t sip_addr_mask;
    155 
    156     /*! Source IPv6 address. */
    157     bcm_ip6_t sip6_addr;
    158 
    159     /*! Source IPv6 address mask. */
    160     bcm_ip6_t sip6_addr_mask;
    161 
    162     /*! Overlay L3 interface number. */
    163     bcm_if_t ol_intf;
    164 
    165     /*! Underlay L3 interface number. */
    166     bcm_if_t ul_intf;
    167 
    168     /*! Multicast pacekt MTU. */
    169     int mtu;
    170 
    171     /*! Multicast group id. */
    172     bcm_multicast_t mc_group;
    173 
    174     /*! Rendezvous Point Router ID. */
    175     int rpa_id;
    176 
    177     /*! Key ingress interface. */
    178     bcm_if_t l3_iif;
    179 
    180     /*! Expected ingress interface. */
    181     bcm_if_t expected_l3_iif;
    182 
    183     /*! NAT ID. */
    184     uint32_t nat_id;
    185 
    186     /*! Realm ID for NAT. */
    187     int realm_id;
    188 
    189     /*! Classification lookup class ID. */
    190     int class_id;
    191 
    192     /*! Internal Priority value. */
    193     int int_pri;
    194 
    195     /*! Trunk indicator. */
    196     bool is_trunk;
    197 
    198     /*! Trunk ID or port ID. */
    199     int port_tgid;
    200 
    201     /*! Module ID. */
    202     int mod_id;
    203 
    204     /*! ALPM associated data mode. */
    205     uint8_t alpm_data_mode;
    206 
    207     /*! Flex counter action index. */
    208     uint32_t flex_ctr_action_index;
    209 
    210     /*! Flex counter object index. */
    211     uint32_t flex_ctr_object_index;
    212 
    213     /*! INT action profile ID. */
    214     uint32_t int_act_profile_id;
    215 
    216     /*! INT OPAQUE DATA profile ID. */
    217     uint32_t int_opaque_data_profile_id;
    218 
    219     /*! Opaque control ID. */
    220     int opaque_ctrl_id;
    221 } bcmi_ltsw_l3_fib_t;
    222 
    223 typedef enum bcmi_ltsw_l3_route_perf_opcode_s {
    224     BCMI_LTSW_RP_OPCODE_ADD = 0,
    225     BCMI_LTSW_RP_OPCODE_UPD = 1,
    226     BCMI_LTSW_RP_OPCODE_GET = 2,
    227     BCMI_LTSW_RP_OPCODE_DEL = 3,
    228     BCMI_LTSW_RP_OPCODE_NUM = 4
    229 } bcmi_ltsw_l3_route_perf_opcode_t;
    230 
    231 /*!
    232  * \brief Definition of callback to construct bcm_ipmc_addr_t from fib info.
    233  *
    234  * \param [in] unit Unit number.
    235  * \param [in] unit fib L3 fib info.
    236  * \param [in] ipmc IPMC info.
    237  *
    238  * \retval SHR_E_NONE No errors.
    239  */
    240 typedef int (*bcmi_ltsw_l3_fib_to_ipmc_cb)(int unit,
    241                                            bcmi_ltsw_l3_fib_t *fib,
    242                                            bcm_ipmc_addr_t *ipmc);
    243 
    244 /*!
    245  * \brief Definition of callback to construct bcm_l3_nat_ingress_t from fib.
    246  *
    247  * \param [in] unit Unit number.
    248  * \param [in] unit fib L3 fib info.
    249  * \param [in] nat NAT info.
    250  *
    251  * \retval SHR_E_NONE No errors.
    252  */
    253 typedef int (*bcmi_ltsw_l3_fib_to_nat_cb)(int unit,
    254                                           bcmi_ltsw_l3_fib_t *fib,
    255                                           bcm_l3_nat_ingress_t *nat);
    256 
    257 /*!
    258  * \brief Initialize L3 fib module.
    259  *
    260  * \param [in] unit Unit number.
    261  *
    262  * \retval SHR_E_NONE No errors.
    263  */
    264 extern int
    265 bcmi_ltsw_l3_fib_init(int unit);
    266 
    267 /*!
    268  * \brief De-Initialize L3 fib module.
    269  *
    270  * \param [in] unit Unit number.
    271  *
    272  * \retval SHR_E_NONE No errors.
    273  */
    274 extern int
    275 bcmi_ltsw_l3_fib_deinit(int unit);
    276 
    277 /*!
    278  * \brief Get the max VRF ID of a given unit.
    279  *
    280  * \param [in] unit Unit number.
    281  * \param [out] max_vrf Max VRF ID.
    282  *
    283  * \retval SHR_E_NONE No errors.
    284  */
    285 extern int
    286 bcmi_ltsw_l3_vrf_max_get(int unit, uint32_t *max_vrf);
    287 
    288 /*!
    289  * \brief Add an L3 multicast entry.
    290  *
    291  * \param [in] unit Unit number.
    292  * \param [in] fib L3 forwarding info.
    293  *
    294  * \retval SHR_E_NONE No errors.
    295  * \retval !SHR_E_NONE Failure.
    296  */
    297 extern int
    298 bcmi_ltsw_l3_fib_mc_add(int unit, bcmi_ltsw_l3_fib_t *fib);
    299 
    300 /*!
    301  * \brief Delete an L3 multicast entry.
    302  *
    303  * \param [in] unit Unit number.
    304  * \param [in] fib L3 forwarding info.
    305  *
    306  * \retval SHR_E_NONE No errors.
    307  * \retval !SHR_E_NONE Failure.
    308  */
    309 extern int
    310 bcmi_ltsw_l3_fib_mc_delete(int unit, bcmi_ltsw_l3_fib_t *fib);
    311 
    312 /*!
    313  * \brief Delete L3 multicast entries that match the given attributes.
    314  *
    315  * \param [in] unit Unit number.
    316  * \param [in] attrib Operation attributes.
    317  *
    318  * The attrib specify the types of L3 multicast entries to be deleted.
    319  * See the definition of BCMI_LTSW_L3_FIB_ATTR_xxx.
    320  *
    321  * \retval SHR_E_NONE No errors.
    322  * \retval !SHR_E_NONE Failure.
    323  */
    324 extern int
    325 bcmi_ltsw_l3_fib_mc_delete_all(int unit, uint32_t attrib);
    326 
    327 /*!
    328  * \brief Find an L3 multicast entry.
    329  *
    330  * \param [in] unit Unit number.
    331  * \param [in] fib L3 forwarding info.
    332  *
    333  * \retval SHR_E_NONE No errors.
    334  * \retval !SHR_E_NONE Failure.
    335  */
    336 extern int
    337 bcmi_ltsw_l3_fib_mc_find(int unit, bcmi_ltsw_l3_fib_t *fib);
    338 
    339 /*!
    340  * \brief Traverse L3 multicast entries that match the given attributes.
    341  *
    342  * \param [in] unit Unit number.
    343  * \param [in] attrib Operation attributes.
    344  * \param [in] trav_fn User supplied callback function.
    345  * \param [in] cb Callback function to construct bcm_ipmc_addr_t from fib info.
    346  * \param [in] user_data User supplied cookie used in parameter in
    347  *                       callback function.
    348  *
    349  * The attrib specify the types of L3 multicast entries to be deleted.
    350  * See the definition of BCMI_LTSW_L3_FIB_ATTR_xxx.
    351  *
    352  * \retval SHR_E_NONE No errors.
    353  * \retval !SHR_E_NONE Failure.
    354  */
    355 extern int
    356 bcmi_ltsw_l3_fib_mc_traverse(int unit, uint32_t attrib,
    357                              bcm_ipmc_traverse_cb trav_fn,
    358                              bcmi_ltsw_l3_fib_to_ipmc_cb cb,
    359                              void *user_data);
    360 
    361 /*!
    362  * \brief Age out the IPMC entry.
    363  *
    364  * Age out the IPMC entry by clearing the HIT bit when appropriate,
    365  * the IPMC entry itself is removed if HIT bit is not set.
    366  *
    367  * \param [in] unit Unit number.
    368  * \param [in] attrib Operation attributes.
    369  * \param [in] age_cb User supplied callback function.
    370  * \param [in] cb Callback function to construct bcm_ipmc_addr_t from fib info.
    371  * \param [in] user_data User supplied cookie used in parameter in
    372  *                       callback function.
    373  *
    374  * The attrib specify the types of L3 multicast entries to be aged.
    375  * See the definition of BCMI_LTSW_L3_FIB_ATTR_xxx.
    376  *
    377  * \retval SHR_E_NONE No errors.
    378  * \retval !SHR_E_NONE Failure.
    379  */
    380 extern int
    381 bcmi_ltsw_l3_fib_mc_age(int unit, uint32_t attrib,
    382                         bcm_ipmc_traverse_cb age_cb,
    383                         bcmi_ltsw_l3_fib_to_ipmc_cb cb,
    384                         void *user_data);
    385 
    386 /*!
    387  * \brief Attach counter entries to the given IPMC group.
    388  *
    389  * \param [in] unit Unit number.
    390  * \param [in] fib L3 forwarding info.
    391  * \param [in] ci Flex counter info.
    392  *
    393  * \retval SHR_E_NONE No errors.
    394  */
    395 extern int
    396 bcmi_ltsw_l3_fib_mc_flexctr_attach(int unit, bcmi_ltsw_l3_fib_t *fib,
    397                                    bcmi_ltsw_flexctr_counter_info_t *ci);
    398 
    399 /*!
    400  * \brief Detach counter entries to the given IPMC group.
    401  *
    402  * \param [in] unit Unit number.
    403  * \param [in] fib L3 forwarding info.
    404  *
    405  * \retval SHR_E_NONE No errors.
    406  */
    407 extern int
    408 bcmi_ltsw_l3_fib_mc_flexctr_detach(int unit, bcmi_ltsw_l3_fib_t *fib);
    409 
    410 /*!
    411  * \brief Get counter info associated with given IPMC group.
    412  *
    413  * \param [in] unit Unit number.
    414  * \param [in] fib L3 forwarding info.
    415  * \param [out] ci Flex counter info.
    416  *
    417  * \retval SHR_E_NONE No errors.
    418  */
    419 extern int
    420 bcmi_ltsw_l3_fib_mc_flexctr_info_get(int unit, bcmi_ltsw_l3_fib_t *fib,
    421                                      bcmi_ltsw_flexctr_counter_info_t *ci);
    422 
    423 /*!
    424  * \brief Add an L3 NAT host entry.
    425  *
    426  * \param [in] unit Unit number.
    427  * \param [in] fib L3 forwarding info.
    428  *
    429  * \retval SHR_E_NONE No errors.
    430  * \retval !SHR_E_NONE Failure.
    431  */
    432 extern int
    433 bcmi_ltsw_l3_nat_host_add(int unit, bcmi_ltsw_l3_fib_t *fib);
    434 
    435 /*!
    436  * \brief Delete an L3 NAT host entry.
    437  *
    438  * \param [in] unit Unit number.
    439  * \param [in] fib L3 forwarding info.
    440  *
    441  * \retval SHR_E_NONE No errors.
    442  * \retval !SHR_E_NONE Failure.
    443  */
    444 extern int
    445 bcmi_ltsw_l3_nat_host_delete(int unit, bcmi_ltsw_l3_fib_t *fib);
    446 
    447 /*!
    448  * \brief Delete all L3 NAT host entries.
    449  *
    450  * \param [in] unit Unit number.
    451  *
    452  * \retval SHR_E_NONE No errors.
    453  * \retval !SHR_E_NONE Failure.
    454  */
    455 extern int
    456 bcmi_ltsw_l3_nat_host_delete_all(int unit);
    457 
    458 /*!
    459  * \brief Find an L3 NAT host entry.
    460  *
    461  * \param [in] unit Unit number.
    462  * \param [in] fib L3 forwarding info.
    463  *
    464  * \retval SHR_E_NONE No errors.
    465  * \retval !SHR_E_NONE Failure.
    466  */
    467 extern int
    468 bcmi_ltsw_l3_nat_host_find(int unit, bcmi_ltsw_l3_fib_t *fib);
    469 
    470 /*!
    471  * \brief Traverse L3 NAT host entries.
    472  *
    473  * \param [in] unit Unit number.
    474  * \param [in] flags Flags to match during traverse.
    475  * \param [in] trav_fn User supplied callback function.
    476  * \param [in] cb Callback function to construct bcm_l3_nat_ingress_t from fib.
    477  * \param [in] user_data User supplied cookie used in parameter in
    478  *                       callback function.
    479  *
    480  * \retval SHR_E_NONE No errors.
    481  * \retval !SHR_E_NONE Failure.
    482  */
    483 extern int
    484 bcmi_ltsw_l3_nat_host_traverse(int unit, uint32_t flags,
    485                                bcm_l3_nat_ingress_traverse_cb trav_fn,
    486                                bcmi_ltsw_l3_fib_to_nat_cb cb,
    487                                void *user_data);
    488 
    489 /*!
    490  * \brief Clear hit bits of all L3 route entries if set.
    491  *
    492  * \param [in] unit Unit Number.
    493  *
    494  * \retval SHR_E_NONE No errors.
    495  * \retval !SHR_E_NONE Failure.
    496  */
    497 extern int
    498 bcmi_ltsw_l3_route_hit_clear(int unit);
    499 
    500 /*!
    501  * \brief Clear hit bits of all host entries if set.
    502  *
    503  * \param [in] unit Unit Number.
    504  *
    505  * \retval SHR_E_NONE No errors.
    506  * \retval !SHR_E_NONE Failure.
    507  */
    508 extern int
    509 bcmi_ltsw_l3_host_hit_clear(int unit);
    510 
    511 /*!
    512  * \brief Public function to get IPMC v4 table size.
    513  *
    514  * \param [in] unit Unit Number.
    515  * \param [out] size IPMC v4 table size.
    516  *
    517  * \retval SHR_E_NONE No errors.
    518  * \retval !SHR_E_NONE Failure.
    519  */
    520 
    521 extern int
    522 bcmi_ltsw_l3_ipmc_v4_size_get(
    523     int unit,
    524     int *size);
    525 
    526 /*!
    527  * \brief Public function to get current IPMC v4 entry count.
    528  *
    529  * \param [in] unit Unit Number.
    530  * \param [out] count IPMC v4 entry count.
    531  *
    532  * \retval SHR_E_NONE No errors.
    533  * \retval !SHR_E_NONE Failure.
    534  */
    535 extern int
    536 bcmi_ltsw_l3_ipmc_v4_count_get(
    537     int unit,
    538     int *count);
    539 
    540 /*!
    541  * \brief Public function to get IPMC v6 table size.
    542  *
    543  * \param [in] unit Unit Number.
    544  * \param [out] size IPMC v6 table size.
    545  *
    546  * \retval SHR_E_NONE No errors.
    547  * \retval !SHR_E_NONE Failure.
    548  */
    549 
    550 extern int
    551 bcmi_ltsw_l3_ipmc_v6_size_get(
    552     int unit,
    553     int *size);
    554 
    555 /*!
    556  * \brief Public function to get current IPMC v6 entry count.
    557  *
    558  * \param [in] unit Unit Number.
    559  * \param [out] count IPMC v6 entry count.
    560  *
    561  * \retval SHR_E_NONE No errors.
    562  * \retval !SHR_E_NONE Failure.
    563  */
    564 extern int
    565 bcmi_ltsw_l3_ipmc_v6_count_get(
    566     int unit,
    567     int *count);
    568 
    569 /*!
    570  * \brief Public function to get current IPMC entry count.
    571  *
    572  * \param [in] unit Unit Number.
    573  * \param [out] count IPMC entry count.
    574  *
    575  * \retval SHR_E_NONE No errors.
    576  * \retval !SHR_E_NONE Failure.
    577  */
    578 extern int
    579 bcmi_ltsw_l3_ipmc_count_get(
    580     int unit,
    581     int *count);
    582 
    583 /*!
    584  * \brief Get flex counter information of the given IPMC group.
    585  *
    586  * \param [in] unit Unit number.
    587  * \param [in] fib IPMC group info.
    588  * \param [out] info Flex counter information.
    589  *
    590  * \retval SHR_E_NONE No errors.
    591  * \retval !SHR_E_NONE Failure.
    592  */
    593 extern int
    594 bcmi_ltsw_l3_ipmc_flexctr_info_get(
    595     int unit,
    596     bcmi_ltsw_l3_fib_t *fib,
    597     bcmi_ltsw_flexctr_counter_info_t *info);
    598 
    599 /*!
    600  * \brief Attach flexctr action to the given IPMC group.
    601  *
    602  * \param [in] unit Unit number.
    603  * \param [in] fib IPMC group info.
    604  * \param [in] info Flex counter information.
    605  *
    606  * \retval SHR_E_NONE No errors.
    607  */
    608 extern int
    609 bcmi_ltsw_l3_ipmc_flexctr_attach(
    610     int unit,
    611     bcmi_ltsw_l3_fib_t *fib,
    612     bcmi_ltsw_flexctr_counter_info_t *info);
    613 
    614 /*!
    615  * \brief Detach flexctr action of the given IPMC group.
    616  *
    617  * \param [in] unit Unit number.
    618  * \param [in] fib IPMC group info.
    619  *
    620  * \retval SHR_E_NONE No errors.
    621  */
    622 extern int
    623 bcmi_ltsw_l3_ipmc_flexctr_detach(
    624     int unit,
    625     bcmi_ltsw_l3_fib_t *fib);
    626 
    627 /*!
    628  * \brief Set flex counter object value for the given IPMC group.
    629  *
    630  * \param [in] unit Unit number.
    631  * \param [in] fib L3 route info.
    632  * \param [in] value The flex counter object value.
    633  *
    634  * The flex counter object value could be used to generate counter index.
    635  *
    636  * \retval SHR_E_NONE No errors.
    637  * \retval !SHR_E_NONE Failure.
    638  */
    639 extern int
    640 bcmi_ltsw_l3_ipmc_flexctr_object_set(
    641     int unit,
    642     bcmi_ltsw_l3_fib_t *fib,
    643     uint32_t value);
    644 
    645 /*!
    646  * \brief Get flex counter object value for the given IPMC group.
    647  *
    648  * \param [in] unit Unit Number.
    649  * \param [in] fib L3 route info.
    650  * \param [out] value The flex counter object value.
    651 *
    652 * \retval SHR_E_NONE No errors.
    653 * \retval !SHR_E_NONE Failure.
    654 */
    655 extern int
    656 bcmi_ltsw_l3_ipmc_flexctr_object_get(
    657     int unit,
    658     bcmi_ltsw_l3_fib_t *fib,
    659     uint32_t *value);
    660 
    661 /*!
    662  * \brief Get the statistics of the given FIB object.
    663  *
    664  * \param [in] unit Unit number.
    665  * \param [in] object L3 FIB object.
    666  * \param [in] flags Operation flag.
    667  * \param [out] entries Entry number of given object.
    668  *
    669  * \retval SHR_E_NONE No errors.
    670  * \retval !SHR_E_NONE Failure.
    671  */
    672 extern int
    673 bcmi_ltsw_l3_fib_object_cnt_get(
    674     int unit,
    675     bcmi_ltsw_l3_fib_object_t object,
    676     uint32_t flags,
    677     int *entries);
    678 
    679 /*!
    680  * \brief Enable dropping L3 unicast packets if L3_IIF equals to L3_EIF.
    681  *
    682  * \param [in] unit Unit number.
    683  * \param [in] enable 1: Drop packets, 0: Do not drop packets.
    684  *
    685  * \retval SHR_E_NONE No errors.
    686  * \retval !SHR_E_NONE Failure.
    687  */
    688 extern int
    689 bcmi_ltsw_l3_same_intf_drop_set(int unit, int enable);
    690 
    691 /*!
    692  * \brief Get the drop setting for L3 unicast packets if L3_IIF equals to L3_EIF.
    693  *
    694  * \param [in] unit Unit number.
    695  * \param [out] enable 1: Drop packets, 0: Do not drop packets
    696  *
    697  * \retval SHR_E_NONE No errors.
    698  * \retval !SHR_E_NONE Failure.
    699  */
    700 extern int
    701 bcmi_ltsw_l3_same_intf_drop_get(int unit, int *enable);
    702 
    703 /*!
    704  * \brief Uni-dimensional ALPM route projection based on current route trend.
    705  *
    706  * \param [in] unit Unit number.
    707  * \param [in] grp Route group.
    708  * \param [out] cnt Projection route number.
    709  * \param [out] max_usage_level The level with maximum resource usage.
    710  * \param [out] max_usage Maximum resource usage.
    711  *
    712  * \retval SHR_E_NONE No error.
    713  * \retval !SHR_E_NONE Failure.
    714  */
    715 extern int
    716 bcmi_ltsw_l3_route_grp_projection(int unit, bcm_l3_route_group_t grp,
    717                                   int *prj_cnt, int *max_usage_lvl,
    718                                   int *max_usage);
    719 
    720 /*!
    721  * \brief ALPM route projection based on testDB.
    722  *
    723  * \param [in] unit Unit number.
    724  * \param [in] grp Route group.
    725  * \param [in] v4v6_ratio Expected V4_route_cnt/V6_route_cnt ratio.
    726  * \param [out] uni_prj_cnt Uni-dimensional projected maximum number of route.
    727  * \param [out] mix_prj_cnt Mixed DB route projection.
    728  * \param [out] max_usage_level The level with maximum resource usage.
    729  * \param [out] max_usage Maximum resource usage.
    730  *
    731  * \retval SHR_E_NONE No error.
    732  * \retval !SHR_E_NONE Failure.
    733  */
    734 extern int
    735 bcmi_ltsw_l3_route_grp_testdb(int unit, bcm_l3_route_group_t grp,
    736                               int v4v6_ratio, int *uni_prj_cnt,
    737                               int *mix_prj_cnt, int *max_usage_lvl,
    738                               int *max_usage);
    739 
    740 /*!
    741  * \brief Performance LT operration.
    742  *
    743  * \param [in] unit Unit number.
    744  * \param [in] op Operation.
    745  * \param [in] vrf VRF.
    746  * \param [in] ip IP address.
    747  * \param [in] ip_mask  IP address mask.
    748  * \param [in] intf  Egress object.
    749  * \param [in] alpm_dmode  alpm data mode array.
    750  *
    751  * \retval SHR_E_NONE No errors.
    752  * \retval !SHR_E_NONE Failure.
    753  */
    754 extern int
    755 bcmi_l3_route_perf_v4_lt_op(
    756     int unit,
    757     bcmi_ltsw_l3_route_perf_opcode_t op,
    758     int vrf,
    759     uint32 ip,
    760     uint32 ip_mask,
    761     int intf,
    762     int (*alpm_dmode)[2]);
    763 
    764 /*!
    765  * \brief Performance LT operration.
    766  *
    767  * \param [in] unit Unit number.
    768  * \param [in] op Operation.
    769  * \param [in] vrf VRF.
    770  * \param [in] v6 IPv6 address.
    771  * \param [in] v6_mask  IPv6 address mask.
    772  * \param [in] intf  Egress object.
    773  * \param [in] alpm_dmode  alpm data mode array.
    774  *
    775  * \retval SHR_E_NONE No errors.
    776  * \retval !SHR_E_NONE Failure.
    777  */
    778 extern int
    779 bcmi_l3_route_perf_v6_lt_op(
    780     int unit,
    781     bcmi_ltsw_l3_route_perf_opcode_t op,
    782     int vrf,
    783     uint64_t *v6,
    784     uint64_t *v6_mask,
    785     int intf,
    786     int (*alpm_dmode)[2]);
    787 
    788 #endif /* BCMI_LTSW_L3_FIB_H */