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_vrrp.h (9652B)


      1 /** \file bcm_int/dnx/l3/l3_vrrp.h Internal DNX L3 APIs
      2 PIs This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file.
      3 PIs 
      4 PIs Copyright 2007-2020 Broadcom Inc. All rights reserved.
      5  */
      6 
      7 #ifndef L3_VRRP_H_INCLUDED
      8 /*
      9  * {
     10  */
     11 #define L3_VRRP_H_INCLUDED
     12 
     13 #ifndef BCM_DNX_SUPPORT
     14 #error "This file is for use by DNX (JR2) family only!"
     15 #endif
     16 
     17 /*
     18  * Include files.
     19  * {
     20  */
     21 #include <bcm/types.h>
     22 #include <bcm/switch.h>
     23 #include <bcm_int/dnx/algo/l3/algo_l3.h>
     24 #include <src/bcm/dnx/init/init_pp.h>
     25 /*
     26  * }
     27  */
     28 
     29 /*
     30  * DEFINES
     31  * {
     32  */
     33 
     34 /*
     35  * }
     36  */
     37 /*
     38  * Enumeration.
     39  * {
     40  */
     41 
     42 /*
     43  * }
     44  */
     45 
     46 /*
     47  * MACROs
     48  * {
     49  */
     50 
     51 /**
     52  * \brief - list of supported L3 protocols for VRRP
     53  */
     54 
     55 /*
     56  * }
     57  */
     58 /*
     59  * Globals
     60  * {
     61  */
     62 
     63 /*
     64  * }
     65  */
     66 
     67 /*
     68  * Structures
     69  * {
     70  */
     71 
     72 /*
     73  * }
     74  */
     75 
     76 /*
     77  * Function declaration
     78  * {
     79  */
     80 
     81 /**
     82  * \brief - init procedure for l3_vrrp (multiple my mac) module.
     83  * * Set default groups members (IPV4, IPV6 and the rest)
     84  * * Init template and allocation managers for TCAM usage
     85  * * Activate MyMac EXEM table - Set FFCs, VMV
     86  *
     87  * \param [in] unit - The unit number.
     88  * \return
     89  *   \retval Zero if no error was detected
     90  *   \retval Negative if error was detected. See \ref shr_error_e
     91  */
     92 shr_error_e dnx_l3_vrrp_init(
     93     int unit);
     94 
     95 /**
     96  * \brief Get l3 protocol group for multiple my mac (vrrp)
     97  *
     98  * \param [in] unit - Relevant unit
     99  * \param [out] group_members - combination (flags) of l3 protocols (can be either input or output).
    100  * \param [out] group_id - group ID (can be either input or output)
    101  *
    102  * \return
    103  *   shr_error_e
    104  *
    105  * \remark
    106  *   * None
    107  * \see
    108  *   * None
    109  */
    110 shr_error_e dnx_l3_vrrp_protocol_group_get(
    111     int unit,
    112     uint32 *group_members,
    113     bcm_l3_protocol_group_id_t * group_id);
    114 
    115 /**
    116  * \brief Set l3 protocol group for multiple my mac (vrrp)
    117  *
    118  * \param [in] unit - Relevant unit
    119  * \param [in] group_members - combination (flags) of l3 protocols.
    120  * \param [in] group_id - group ID to set
    121  *
    122  * \return
    123  *   shr_error_e
    124  *
    125  * \remark
    126  *   * None
    127  * \see
    128  *   * None
    129  */
    130 shr_error_e dnx_l3_vrrp_protocol_group_set(
    131     int unit,
    132     uint32 group_members,
    133     bcm_l3_protocol_group_id_t group_id);
    134 
    135 /**
    136  * \brief Given protocol flags, returns the minimal group_id - group_mask combination that contains all flags.
    137  *
    138  * \param [in] unit - Relevant unit
    139  * \param [in] members_flags - combination (flags) of l3 protocols.
    140  * \param [in] exact_match - If set, returns error in case the groups contain more than just the asked protocols.
    141  * \param [out] group_id - Group_id containing the flags
    142  * \param [out] group_mask - Minimal mask required to contain the flags.
    143  *
    144  * \return
    145  *   shr_error_e
    146  *
    147  * \remark
    148  *   * None
    149  * \see
    150  *   * None
    151  */
    152 shr_error_e dnx_l3_vrrp_members_to_protocol_group_get(
    153     int unit,
    154     uint32 *members_flags,
    155     uint8 exact_match,
    156     uint32 *group_id,
    157     uint32 *group_mask);
    158 
    159 /**
    160  * \brief - Allocate and set a TCAM entry according to the given tcam_info:
    161  * 1. Allocate either a single or for all VSIs a tcam entry
    162  * 2. Commit the entry to HW if it's new
    163  * 3. Update VSI VRID members bitmap with the new allocated member
    164  *
    165  * \param [in] unit - Relevant unit
    166  * \param [in] tcam_info - vrrp tcam data.
    167  * \param [in] vlan - Matching vsi.
    168  * \param [out] tcam_index - Returned tcam allcoated index (profile)
    169  *
    170  * \return
    171  *   shr_error_e
    172  *
    173  * \remark
    174  *   * None
    175  * \see
    176  *   * None
    177  */
    178 shr_error_e dnx_l3_vrrp_setting_add(
    179     int unit,
    180     algo_dnx_l3_vrrp_tcam_key_t * tcam_info,
    181     int vlan,
    182     uint32 *tcam_index);
    183 
    184 /**
    185  * \brief - Deallocate and clear a TCAM entry according to the given tcam_info:
    186  * 1. Deallocate either a single or for all VSIs a tcam entry
    187  * 2. Clear the entry in HW if it's the last
    188  * 3. Update VSI VRID members bitmap without the deallocated member
    189  *
    190  * \param [in] unit - Relevant unit
    191  * \param [in] tcam_info - vrrp tcam data.
    192  * \param [in] vlan - Matching vsi.
    193  *
    194  * \return
    195  *   shr_error_e
    196  *
    197  * \remark
    198  *   * None
    199  * \see
    200  *   * None
    201  */
    202 shr_error_e dnx_l3_vrrp_setting_delete(
    203     int unit,
    204     algo_dnx_l3_vrrp_tcam_key_t * tcam_info,
    205     int vlan);
    206 
    207 /**
    208  * \brief - Get protocol group (group id can be masked) members (set of l3 protocols). The members are represented as
    209  * a bitmap of protocols.
    210  * The mapping is maintained in a dedicated SW state db.
    211  *
    212  * \param [in] unit - Relevant unit
    213  * \param [in] group_id - protocol group id.
    214  * \param [in] group_mask -protocol group mask.
    215  * \param [out] members_bmp - protocol layer bitmap (\see dbal_enum_value_field_layer_types_e).
    216  *
    217  * \return
    218  *   shr_error_e
    219  *
    220  * \remark
    221  *   * None
    222  * \see
    223  *   * None
    224  */
    225 shr_error_e dnx_l3_vrrp_protocol_group_members_sw_get(
    226     int unit,
    227     int group_id,
    228     int group_mask,
    229     uint32 *members_bmp);
    230 
    231 /**
    232  * \brief - Clear and deallocate EXEM based TCAM profile according to its data
    233  *
    234  * \param [in] unit - Relevant unit
    235  * \param [in] tcam_info - tcam info to clear.
    236  *
    237  * \return
    238  *   shr_error_e
    239  *
    240  * \remark
    241  *   * None
    242  * \see
    243  *   * None
    244  */
    245 shr_error_e dnx_l3_vrrp_exem_based_tcam_info_clear(
    246     int unit,
    247     algo_dnx_l3_vrrp_tcam_key_t * tcam_info);
    248 
    249 /**
    250  * \brief - add EXEM SOURCE-PORT Multiple MY-MAC entry
    251  *
    252  * \param [in] unit - Relevant unit
    253  * \param [in] port - logical source port. relevant for src-port result type
    254  * \param [in] mac_da - destination mac address
    255  * \param [out] index - allocated EXEM sw index
    256  *
    257  * \return
    258  *   shr_error_e
    259  *
    260  * \remark
    261  *   * None
    262  * \see
    263  *   * None
    264  */
    265 shr_error_e dnx_l3_vrrp_exem_source_port_my_mac_add(
    266     int unit,
    267     bcm_port_t port,
    268     bcm_mac_t mac_da,
    269     int *index);
    270 
    271 /**
    272  * \brief - add EXEM per port protocold entry
    273  *
    274  * \param [in] unit - Relevant unit
    275  * \param [in] port - logical source port. relevant for src-port result type
    276  * \param [in] protocol - ethernet type
    277  * \param [out] index - allocated EXEM sw index
    278  *
    279  * \return
    280  *   shr_error_e
    281  *
    282  * \remark
    283  *   * None
    284  * \see
    285  *   * None
    286  */
    287 shr_error_e dnx_l3_vrrp_exem_source_port_protocol_add(
    288     int unit,
    289     bcm_port_t port,
    290     uint32 protocol,
    291     int *index);
    292 
    293 /**
    294  * \brief - add EXEM VSI Multiple MY-MAC entry
    295  *
    296  * \param [in] unit - Relevant unit
    297  * \param [in] vlan - VSI. relevant for vsi result type
    298  * \param [in] mac_da - destination mac address
    299  * \param [out] index - allocated EXEM sw index
    300  *
    301  * \return
    302  *   shr_error_e
    303  *
    304  * \remark
    305  *   * None
    306  * \see
    307  *   * None
    308  */
    309 shr_error_e dnx_l3_vrrp_exem_vsi_my_mac_add(
    310     int unit,
    311     bcm_vlan_t vlan,
    312     bcm_mac_t mac_da,
    313     int *index);
    314 
    315 /**
    316  * \brief - Remove EXEM Multiple MY-MAC entry from SW EXEM table and HW EXEM table and deallocate it from resource
    317  * Manager.
    318  *
    319  * \param [in] unit - Relevant unit
    320  * \param [in] index - index to sw db of the entry to remove
    321  *
    322  * \return
    323  *   shr_error_e
    324  *
    325  * \remark
    326  *   * None
    327  * \see
    328  *   * None
    329  */
    330 shr_error_e dnx_l3_vrrp_exem_multi_my_mac_delete(
    331     int unit,
    332     int index);
    333 
    334 /**
    335  * \brief - Get EXEM multiple my mac entry from SW DB according to provided index.
    336  * An entry is either SOURCE-PORT or VSI
    337  *
    338  * \param [in] unit - Relevant unit
    339  * \param [in] index - index to sw db
    340  * \param [out] result_type - type of the retrieved entry
    341  * \param [out] vlan - entry vsi id (relevant for VSI entry)
    342  * \param [out] core - entry core id (relevent for port entry)
    343  * \param [out] pp_port - entry pp_port (relevent for port entry)
    344  * \param [out] mac_da - entry mac address (relevant for both types)
    345  * \param [out] protocol - entry protocol (relevant for one types)
    346  *
    347  * \return
    348  *   shr_error_e
    349  *
    350  * \remark
    351  *   * None
    352  * \see
    353  *   * None
    354  */
    355 shr_error_e dnx_l3_vrrp_exem_multi_my_mac_get(
    356     int unit,
    357     int index,
    358     dbal_enum_value_result_type_l3_vrrp_exem_db_sw_e * result_type,
    359     bcm_vlan_t * vlan,
    360     int *core,
    361     uint32 *pp_port,
    362     bcm_mac_t mac_da,
    363     dbal_enum_value_field_layer_types_e * protocol);
    364 
    365 /**
    366  * \brief - Set (write to HW) valid VRRP TCAM entry.
    367  *
    368  * \param [in] unit - Unit ID
    369  * \param [in] index - TCAM index (entry ID)
    370  * \param [in] tcam_info - VRRP TCAM key (mac DA and protocol group)
    371  * \param [in] da_profile - da profile of vrrp entry
    372  *
    373  * \return
    374  *   \retval Zero if no error was detected
    375  *   \retval Negative if error was detected. See \ref shr_error_e
    376  * \see
    377  */
    378 shr_error_e dnx_l3_vrrp_tcam_info_set(
    379     int unit,
    380     int index,
    381     algo_dnx_l3_vrrp_tcam_key_t * tcam_info,
    382     int da_profile);
    383 
    384 /**
    385  * \brief - Set (write to HW) valid VRRP TCAM entry for port+protocol
    386  * ignore mac.
    387  *
    388  * \param [in] unit - Unit ID
    389  * \param [in] protocol - protocol
    390  *
    391  * \return
    392  *   \retval Zero if no error was detected
    393  *   \retval Negative if error was detected. See \ref shr_error_e
    394  * \see
    395  */
    396 shr_error_e dnx_l3_vrrp_port_protocol_tcam_info_set(
    397     int unit,
    398     uint32 protocol);
    399 
    400 /**
    401  * \brief - Clear (write to HW) valid VRRP TCAM entry.
    402  *
    403  * \param [in] unit - Unit ID
    404  * \param [in] index - TCAM index (entry ID)
    405  *
    406  * \return
    407  *   \retval Zero if no error was detected
    408  *   \retval Negative if error was detected. See \ref shr_error_e
    409  * \see
    410  */
    411 shr_error_e dnx_l3_vrrp_tcam_info_clear(
    412     int unit,
    413     int index);
    414 
    415 /**
    416  * \brief - given a l2 mac address determine whether it's a vrrp protocol mac address
    417  * \param [in] unit - Unit ID
    418  * \param [in] mac - l2 mac address
    419  * \param [out] is_vrrp - TRUE is address if VRRP, FALSE otherwise
    420  *
    421  * \return
    422  *   \retval Zero if no error was detected
    423  *   \retval Negative if error was detected. See \ref shr_error_e
    424  * \see
    425  */
    426 shr_error_e dnx_l2_station_mac_is_vrrp_mac(
    427     int unit,
    428     bcm_mac_t mac,
    429     uint8 *is_vrrp);
    430 
    431 /*
    432  * }
    433  */
    434 #endif /* L3_VRRP_H_INCLUDED */