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

out_lif_profile.h (11417B)


      1 /** \file out_lif_profile.h
      2  *
      3  * out_lif profile management for DNX.
      4  *
      5  * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file.
      6  * 
      7  * Copyright 2007-2020 Broadcom Inc. All rights reserved.
      8  */
      9 #ifndef OUT_LIF_PROFILE_H_INCLUDED
     10 /*
     11  * {
     12  */
     13 #define OUT_LIF_PROFILE_H_INCLUDED
     14 
     15 #ifndef BCM_DNX_SUPPORT
     16 #error "This file is for use by DNX (JR2) family only!"
     17 #endif /* BCM_DNX_SUPPORT */
     18 
     19 #include <bcm/l3.h>
     20 #include <shared/shrextend/shrextend_debug.h>
     21 #include <soc/dnx/dbal/auto_generated/dbal_defines_fields.h>
     22 
     23 /***************************************************************************************/
     24 /*
     25  * Defines
     26  */
     27 /***************************************************************************************/
     28 /*
     29  * Default profiles/values defines
     30  */
     31 /**
     32  * Specify default out_lif_profile
     33  */
     34 #define DNX_OUT_LIF_PROFILE_DEFAULT (0)
     35 /**
     36  * Specify default out_lif_orientation
     37  */
     38 #define DNX_OUT_LIF_PROFILE_DEFAULT_ORIENTATION (0)
     39 #define DNX_OUT_LIF_PROFILE_DEFAULT_ORIENTATION_PROFILE (56)
     40 /**
     41  * Specify default split_horizon enable
     42  */
     43 #define DNX_OUT_LIF_PROFILE_SPLIT_HORIZON_ENABLE (1)
     44 /**
     45  * Specify default split_horizon disable
     46  */
     47 #define DNX_OUT_LIF_PROFILE_SPLIT_HORIZON_DISABLE (0)
     48 /**
     49  * Specify default OAM LIF Profile
     50  */
     51 #define DNX_OUT_LIF_PROFILE_OAM_PROFILE (0)
     52 /**
     53  * Specify default TTL Scope Threshold
     54  */
     55 #define DNX_OUT_LIF_PROFILE_DEFAULT_TTL_THRESHOLD (0)
     56 /**
     57  * Used for smart template manager to indicate to keep default ip tunnel profile
     58  */
     59 #define DNX_OUT_LIF_PROFILE_KEEP_DEFAULT_IP_TUNNEL_PROFILE 1
     60 
     61 /***************************************************************************************/
     62 /*
     63  * Enums
     64  */
     65 /***************************************************************************************/
     66 /*
     67  * Structures
     68  */
     69 
     70 /**
     71  * /brief - out_lif template data structure.
     72  * The template manager's data of out_lif_profile used for orientation only.
     73  * this structure is for inner usage only.
     74  */
     75 typedef struct
     76 {
     77     uint8 out_lif_orientation;
     78 } etpp_out_lif_template_data_orientation_t;
     79 
     80 /**
     81  * /brief - out_lif template data structure.
     82  * The template manager's data of out_lif_profile used for oam_profile only.
     83  * this structure is for inner usage only.
     84  */
     85 typedef struct
     86 {
     87     uint8 oam_lif_profile;
     88 } etpp_out_lif_template_data_oam_profile_t;
     89 
     90 /**
     91  * /brief - out_lif template data structure.
     92  * The template manager's data of out_lif_profile used for all data-fields.
     93  * this structure is for inner usage only.
     94  */
     95 typedef struct
     96 {
     97     uint8 out_lif_orientation;
     98     uint8 etpp_split_horizon_enable;
     99     uint8 oam_lif_profile;
    100     /** Used only for smart template manager */
    101     uint8 keep_internal_default_profile;
    102 } etpp_out_lif_template_data_t;
    103 
    104 /**
    105  * \brief - the input structure of dnx_out_lif_profile_exchange,
    106  * includes the out_lif profile properties to set.
    107  * \remark
    108  *  need to call out_lif_profile_info_t_init in order to initiate the fields to the default valid values
    109  *  and then to update the structure and send it to the API.
    110  */
    111 typedef struct
    112 {
    113     uint8 out_lif_orientation;
    114     uint8 etpp_split_horizon_enable;
    115     uint8 oam_lif_profile;
    116     /** Used only for smart template manager */
    117     uint8 keep_internal_default_profile;
    118 } etpp_out_lif_profile_info_t;
    119 
    120 /**
    121  * \brief - the input structure of dnx_erpp_out_lif_profile_exchange,
    122  * includes the erpp_out_lif profile properties to set.
    123  * \remark
    124  *  need to call erpp_out_lif_profile_info_t_init in order to initiate the fields to the default valid values
    125  *  and then to update the structure and send it to the API.
    126  */
    127 typedef struct
    128 {
    129     uint8 ttl_scope_threshold;
    130 } erpp_out_lif_profile_info_t;
    131 /**
    132  * /brief - erpp_out_lif_profile data structure.
    133  * The template manager's data of ERPP outlif profile.
    134  * this structure is for inner usage only.
    135  */
    136 typedef struct
    137 {
    138     uint8 ttl_scope_threshold;
    139 } erpp_out_lif_template_data_t;
    140 /***************************************************************************************/
    141 /*
    142  * API
    143  */
    144 /**
    145  * \brief
    146  *   initializes the module out_lif_profile:
    147  *   writes default profiles/values to relevant tables, for example:
    148  *   OUT_LIF_PROFILE_TABLE
    149  * \param [in] unit -
    150  *   The unit number.
    151  * \return
    152  *   \retval Zero if no error was detected
    153  *   \retval Negative if error was detected. See \ref shr_error_e
    154  * \remark
    155  *   * updates dbal tables OUT_LIF_PROFILE_TABLE
    156  * \see
    157  *   * None
    158  */
    159 shr_error_e dnx_out_lif_profile_module_init(
    160     int unit);
    161 
    162 /**
    163  * \brief
    164  *   updates template manager for L2/L3 profiles, and exchanges the old out_lif_profile with
    165  *   new out_lif_profile according to LIF properties which are stored in out_lif_profile_info.
    166  * \param [in] unit -
    167  *   The unit number.
    168  * \param [out] dbal_table_id -
    169  *   DBAL table ID, used to differentiate between the supported outlif profile supported ranges \n
    170  * \param [out] flags -
    171  *   Flags, which might be used in future, to differentiate between the supported outlif profile supported ranges \n
    172  * \param [in] etpp_out_lif_profile_info -
    173  *   Pointer to out_lif_profile_info \n
    174  *     Pointed memory includes LIF-PROFILE properties
    175  * \param [in] old_etpp_out_lif_profile -
    176  *   old out_lif_profile id to exchange
    177  * \param [out] new_etpp_out_lif_profile -
    178  *   Pointer to new_out_lif_profile \n
    179  *     This procedure loads pointed memory by the newly assigned out_lif_profile
    180  *     id in template manager
    181  * \param [out] is_last -
    182  *     Determines if it is last reference in the out_lif template manager
    183  *
    184  * \return
    185  *   \retval Zero if no error was detected
    186  *   \retval Negative if error was detected. See \ref shr_error_e
    187  * \remark
    188  *   We don't clean HW tables in case of last profile case, because of the
    189  *   issue that when we delete the profile till we move the InLIF
    190  *   to the new place traffic will get some "undefine" state.
    191  * \see
    192  *   * dnx_out_lif_profile_algo_handle_routing_enablers_profile
    193  *   * dnx_out_lif_profile_algo_convert_to_rpf_mode
    194  *   * dnx_algo_template_exchange
    195  *   * DBAL_TABLE_OUT_LIF_PROFILE_TABLE
    196  *   * NOF_ROUTING_PROFILES_DUPLICATES
    197  */
    198 shr_error_e dnx_etpp_out_lif_profile_exchange(
    199     int unit,
    200     dbal_tables_e dbal_table_id,
    201     uint32 flags,
    202     etpp_out_lif_profile_info_t * etpp_out_lif_profile_info,
    203     int old_etpp_out_lif_profile,
    204     int *new_etpp_out_lif_profile,
    205     uint8 *is_last);
    206 
    207 /**
    208  * \brief
    209  *   updates template manager for L2/L3 profiles, and exchanges the old erpp_out_lif_profile with
    210  *   new erpp_out_lif_profile according to LIF properties which are stored in erpp_out_lif_profile_info.
    211  * \param [in] unit -
    212  *   The unit number.
    213  * \param [in] erpp_out_lif_profile_info -
    214  *   Pointer to erpp_out_lif_profile_info \n
    215  *     Pointed memory includes ERPP LIF-PROFILE properties
    216  * \param [in] old_erpp_out_lif_profile -
    217  *   old erpp_out_lif_profile id to exchange
    218  * \param [out] new_erpp_out_lif_profile -
    219  *   Pointer to new_erpp_out_lif_profile \n
    220  *     This procedure loads pointed memory by the newly assigned erpp_out_lif_profile
    221  *     id in template manager
    222  * \return
    223  *   \retval Zero if no error was detected
    224  *   \retval Negative if error was detected. See \ref shr_error_e
    225  */
    226 shr_error_e dnx_erpp_out_lif_profile_exchange(
    227     int unit,
    228     erpp_out_lif_profile_info_t * erpp_out_lif_profile_info,
    229     int old_erpp_out_lif_profile,
    230     int *new_erpp_out_lif_profile);
    231 /**
    232  * \brief
    233  *   gets out_lif_profile and returns references count
    234  * \param [in] unit -
    235  *   The unit number.
    236  * \param [in] etpp_out_lif_profile -
    237  *   out_lif_profile id to get ref_count for
    238  * \param [out] ref_count -
    239  *   Pointer to ref_count \n
    240  *     Pointed memory includes references count of the out_lif_profile
    241  * \return
    242  *   \retval Zero if no error was detected
    243  *   \retval Negative if error was detected. See \ref shr_error_e
    244  * \remark
    245  *   * None
    246  * \see
    247  *   * None
    248  */
    249 shr_error_e dnx_etpp_out_lif_profile_get_ref_count(
    250     int unit,
    251     int etpp_out_lif_profile,
    252     int *ref_count);
    253 
    254 /**
    255  * \brief
    256  *   gets out_lif_profile and returns out_lif_profile data
    257  * \param [in] unit -
    258  *   The unit number.
    259  * \param [in] etpp_out_lif_profile -
    260  *   out_lif_profile id to get data for
    261  * \param [out] etpp_out_lif_profile_info -
    262  *   Pointer to out_lif_profile_info \n
    263  *     Pointed memory includes out_lif_profile properties
    264  *
    265  * \return
    266  *   \retval Zero if no error was detected
    267  *   \retval Negative if error was detected. See \ref shr_error_e
    268  * \remark
    269  *   * None
    270  * \see
    271  *   * None
    272  */
    273 shr_error_e dnx_etpp_out_lif_profile_get_data(
    274     int unit,
    275     int etpp_out_lif_profile,
    276     etpp_out_lif_profile_info_t * etpp_out_lif_profile_info);
    277 
    278 /**
    279  * \brief
    280  *   gets out_lif_profile and returns out_lif_profile data
    281  * \param [in] unit -
    282  *   The unit number.
    283  * \param [in] erpp_out_lif_profile -
    284  *   erpp_out_lif_profile id to get data for
    285  * \param [out] erpp_out_lif_profile_info -
    286  *   Pointer to erpp_out_lif_profile_info \n
    287  *     Pointed memory includes erpp_out_lif_profile properties
    288  * \return
    289  *   \retval Zero if no error was detected
    290  *   \retval Negative if error was detected. See \ref shr_error_e
    291  * \remark
    292  *   * None
    293  * \see
    294  *   * None
    295  */
    296 shr_error_e dnx_erpp_out_lif_profile_get_data(
    297     int unit,
    298     int erpp_out_lif_profile,
    299     erpp_out_lif_profile_info_t * erpp_out_lif_profile_info);
    300 
    301 /*
    302  * \brief
    303  *      initialize fields of the structure out_lif_profile_info_t to the default values
    304  * \param [in] unit -
    305  *   The unit number.
    306  * \param [out] etpp_out_lif_profile_info -
    307  *   Pointer to out_lif_profile_info \n
    308  *     Pointed memory includes LIF-PROFILE properties initiated to the default values
    309  * \return
    310  *   * None
    311  * \remark
    312  *   * None
    313  * \see
    314  *   * None
    315  */
    316 void etpp_out_lif_profile_info_t_init(
    317     int unit,
    318     etpp_out_lif_profile_info_t * etpp_out_lif_profile_info);
    319 
    320 /*
    321  * \brief
    322  *      initialize fields of the structure erpp_out_lif_profile_info_t to the default values
    323  * \param [in] unit -
    324  *   The unit number.
    325  * \param [out] erpp_out_lif_profile_info -
    326  *   Pointer to erpp_out_lif_profile_info \n
    327  *     Pointed memory includes ERPP LIF-PROFILE properties initiated to the default values
    328  * \return
    329  *   * None
    330  * \remark
    331  *   * None
    332  * \see
    333  *   * None
    334  */
    335 void erpp_out_lif_profile_info_t_init(
    336     int unit,
    337     erpp_out_lif_profile_info_t * erpp_out_lif_profile_info);
    338 
    339 /**
    340 * \brief
    341 *  This function purpose is to set Out Lif profile in HW
    342 * \par DIRECT INPUT:
    343 *   \param [in] unit  -  unit Id
    344 *   \param [in] port  - InLIF gport
    345 *   \param [in] new_out_lif_profile  -  OutLIF-profile to configure
    346 * \par INDIRECT INPUT:
    347 *   * None
    348 * \par DIRECT OUTPUT:
    349 *   shr_error_e - Error type
    350 * \par INDIRECT OUTPUT:
    351 *   * None
    352 * \remark
    353 *   * None
    354 * \see
    355 *   * None
    356 */
    357 shr_error_e dnx_out_lif_profile_set(
    358     int unit,
    359     bcm_gport_t port,
    360     int new_out_lif_profile);
    361 
    362 /**
    363 * \brief
    364 *  This function purpose is to get the out Lif profile for given inLIF
    365 * \par DIRECT INPUT:
    366 *   \param [in] unit  -  unit Id
    367 *   \param [in] port  - OutLIF gport
    368 *   \param [out] out_lif_profile_p  -  OutLIF-profile configured for InLIF given
    369 * \par INDIRECT INPUT:
    370 *   * None
    371 * \par DIRECT OUTPUT:
    372 *   shr_error_e - Error type
    373 * \par INDIRECT OUTPUT:
    374 *   * None
    375 * \remark
    376 *   * None
    377 * \see
    378 *   * None
    379 */
    380 shr_error_e dnx_out_lif_profile_get(
    381     int unit,
    382     bcm_gport_t port,
    383     int *out_lif_profile_p);
    384 /*
    385  * }
    386  */
    387 #endif /* OUT_LIF_PROFILE_H_INCLUDED */