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


      1 /*
      2  * ! \file bcm_int/dnx/l3/l3.h Internal DNX L3 APIs
      3 PIs This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file.
      4 PIs 
      5 PIs Copyright 2007-2020 Broadcom Inc. All rights reserved.
      6  */
      7 
      8 #ifndef L3_H_INCLUDED
      9 /*
     10  * {
     11  */
     12 #define L3_H_INCLUDED
     13 
     14 #ifndef BCM_DNX_SUPPORT
     15 #error "This file is for use by DNX (JR2) family only!"
     16 #endif
     17 
     18 /*
     19  * DEFINES
     20  * {
     21  */
     22 
     23 #define L3_MAC_ADDR_SIZE_IN_BYTES          (6)
     24 
     25 /** bits 1-6 are relevant so masking all the rest and shifting to right */
     26 #define L3_INTF_MY_MAC_ETH_PREFIX(mymac) ((mymac >> 1) & 0x3F)
     27 /*
     28  * }
     29  */
     30 /*
     31  * TYPEDEFS
     32  * {
     33  */
     34 
     35 /**
     36  * \brief - Initialize L3 module. \n
     37  *
     38  * \par DIRECT_INPUT:
     39  *   \param [in] unit - Unit-ID
     40  * \par INDIRECT INPUT:
     41  * \par DIRECT OUTPUT:
     42  *   shr_error_e
     43  */
     44 shr_error_e dnx_l3_module_init(
     45     int unit);
     46 
     47 /**
     48  * \brief
     49  *   Allow/Forbid the Strict UC RPF packets or the SIP-based MC
     50  *   RPF packets to be forwarded by default route entry.
     51  * \param [in] unit - The unit number.
     52  * \param [in] is_uc_switch -
     53  *      * 0 - the MC RPF switch will be modified.
     54  *      * 1 - the UC RPF switch will be modified.
     55  * \param [in] value -
     56  *      * 0 - forbid default route of strict UC RPF packets
     57  *      * 1 - allow default route of strict UC RPF packets
     58  * \return
     59  *   \retval Zero if no error was detected
     60  *   \retval Negative if error was detected. See \ref shr_error_e
     61  * \see
     62  *  * bcmSwitchL3UrpfDefaultRoute
     63  *  * bcmSwitchL3McRpfDefaultRoute
     64  */
     65 shr_error_e dnx_l3_rpf_default_route_set(
     66     int unit,
     67     int is_uc_switch,
     68     int value);
     69 
     70 /**
     71  * \brief
     72  *   Receive the setting of whether the Strict UC RPF packets
     73  *   or the SIP-based MC RPF packets are going to be forwarded
     74  *   by default route entry.
     75  * \param [in] unit - The unit number.
     76  * \param [in] is_uc_switch -
     77  *      * 0 - the MC RPF switch will be received.
     78  *      * 1 - the UC RPF switch will be received.
     79  * \param [out] value -
     80  *      * 0 - default route of RPF packets is forbidden.
     81  *      * 1 - default route of RPF packets is allowed.
     82  * \return
     83  *   \retval Zero if no error was detected
     84  *   \retval Negative if error was detected. See \ref shr_error_e
     85  * \see
     86  *  * bcmSwitchL3UrpfDefaultRoute
     87  *  * bcmSwitchL3McRpfDefaultRoute
     88  */
     89 shr_error_e dnx_l3_rpf_default_route_get(
     90     int unit,
     91     int is_uc_switch,
     92     int *value);
     93 
     94 /**
     95 * \brief
     96 *   Allocate entry for input mac address using template algorithm and get corresponding index (provided by the algorithm)  
     97 *   and an indication on whether this mac address has already been allocated.
     98 * \param [in] unit -  
     99 *   The Unit number.
    100 * \param [in] is_arp -
    101 *   Whether it is mymac that is required for ARP entry.
    102 * \param [in] l3a_mac_addr -  
    103 *   Requested mac address to be checked.
    104 * \param [in] mymac_prefix  -  
    105 *   Valid pointer to mac address prefix provided by the algorithm.
    106 * \param [in] is_first_mymac_reference  -  
    107 *    Boolean. 1 - algorithm allocated new entry, 0 - mac address already allocated.
    108 * \return
    109 *   \retval Zero if no error was detected
    110 *   \retval Negative if error was detected. See \ref shr_error_e
    111 * \remark
    112 *   * None
    113 * \see
    114 *   * None
    115 */
    116 shr_error_e dnx_l3_intf_egress_mymac_prefix_allocate(
    117     int unit,
    118     uint8 is_arp,
    119     bcm_mac_t l3a_mac_addr,
    120     int *mymac_prefix,
    121     uint8 *is_first_mymac_reference);
    122 
    123 /**
    124 * \brief
    125 *  Exchange mac address prefixes in SW.
    126 *   \param [in] unit     - The Unit number.
    127 *   \param [in] is_arp         - Whether it is mymac that is required for ARP entry.
    128 *   \param [in] l3a_mac_addr         -  Requested mac address to be checked.
    129 *   \param [in] old_mymac_prefix         -  mac address prefix to be exchanged
    130 *   \param [out] new_mymac_prefix         -  Valid pointer to mac address prefix provided by the algorithm.
    131 *   \param [out] is_first_mymac_reference         -  if set 'new_mymac_prefix' is new new entry - need to allocate in HW as well
    132 *   \param [out] is_last_mymac_reference         -  if set 'old_mymac_prefix' not used any more and freed in SW, free in HW as well
    133 * \return
    134 *   shr_error_e
    135 */
    136 shr_error_e dnx_l3_intf_egress_mymac_prefix_exchange(
    137     int unit,
    138     uint8 is_arp,
    139     bcm_mac_t l3a_mac_addr,
    140     int old_mymac_prefix,
    141     int *new_mymac_prefix,
    142     uint8 *is_first_mymac_reference,
    143     uint8 *is_last_mymac_reference);
    144 
    145 /**
    146 * \brief
    147 *  Free mac address prefix in SW
    148 *   \param [in] unit     - The Unit number.
    149 *   \param [in] src_mac_prefix         -  mac address prefix to be freed
    150 *   \param [out] last_ref         -  if set 'old_mymac_prefix' not used any more and freed in SW, free in HW as well
    151 * \return
    152 *   shr_error_e
    153 */
    154 shr_error_e dnx_l3_intf_egress_mymac_prefix_free(
    155     int unit,
    156     int src_mac_prefix,
    157     uint8 *last_ref);
    158 
    159 /**
    160  * \brief 
    161  *   Write the source address MSBs to soruce_address table given the mymac index
    162  * \param [in] unit - 
    163  *   The unit number.
    164  * \param [in] is_arp -
    165  *   Whether it is mymac that is required for ARP entry.
    166  * \param [in] l3a_mac_addr - 
    167  *   Requested MSB mac address to be written. (not shifted)
    168  * \param [in] mymac_prefix_profile - 
    169  *  MAC prefix to be saved to Index to the table (retrieve from the source_address template manager)
    170  * \return
    171  *   \retval Zero if no error was detected
    172  *   \retval Negative if error was detected. See \ref shr_error_e
    173  * \remark
    174  *   * None
    175  * \see
    176  *   * None
    177  */
    178 shr_error_e dnx_l3_intf_egress_mymac_set(
    179     int unit,
    180     uint8 is_arp,
    181     bcm_mac_t l3a_mac_addr,
    182     int mymac_prefix_profile);
    183 
    184 /**
    185  * \brief 
    186  *   Clear the source address MSBs to soruce_address table given the mymac index
    187  * \param [in] unit - 
    188  *      The unit number.
    189  * \param [in] is_arp -
    190  *      Whether it is mymac that is required for ARP entry.
    191  * \param [in] mymac_prefix_profile - 
    192  *      MAC prefix to be saved to Index to the table (retrieve from the source_address template manager)
    193  * \return
    194  *   \retval Zero if no error was detected
    195  *   \retval Negative if error was detected. See \ref shr_error_e 
    196  * \remark
    197  *   * None
    198  * \see
    199  *   * None
    200  */
    201 shr_error_e dnx_l3_intf_egress_mymac_clear(
    202     int unit,
    203     uint8 is_arp,
    204     int mymac_prefix_profile);
    205 
    206 /**
    207  * \brief
    208  *   Checks if intf was created
    209  * \param [in] unit -
    210  *      The unit number.
    211  * \param [in] intf_id -
    212  *      Interface ID to check.
    213  * \param [out] intf_exists -
    214  *      * 0 - the interface exists.
    215  *      * 1 - the interface does not exists.
    216  * \return
    217  *   \retval Zero if no error was detected
    218  *   \retval Negative if error was detected. See \ref shr_error_e
    219  * \remark
    220  *   Checks VSI table in the corresponding entry,
    221  *   and validates that the my_mac prefix is valid by making sure the prefix profile
    222  *   doesn't point to the default invalid profile (in index 0 in prefix template manager).
    223  * \see
    224  *   * None
    225  */
    226 shr_error_e dnx_l3_check_if_ingress_intf_exists(
    227     int unit,
    228     bcm_if_t intf_id,
    229     uint8 *intf_exists);
    230 /*
    231  * }
    232  */
    233 #endif /* L3_H_INCLUDED */