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

algo_l2.h (6241B)


      1 /**
      2  * \file algo_l2.h 
      3  * Internal DNX L2 Managment APIs 
      4  * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file.
      5  * 
      6  * Copyright 2007-2020 Broadcom Inc. All rights reserved. 
      7  */
      8 
      9 #ifndef ALGO_L2_H_INCLUDED
     10 /*
     11  * { 
     12  */
     13 #define ALGO_L2_H_INCLUDED
     14 
     15 #include <shared/shrextend/shrextend_debug.h>
     16 #include <bcm_int/dnx/algo/template_mngr/template_manager_types.h>
     17 
     18 #ifndef BCM_DNX_SUPPORT
     19 #error "This file is for use by DNX (JR2) family only!"
     20 #endif
     21 
     22 /**
     23  * Resource name defines for algo l2. 
     24  * {
     25  */
     26 #define DNX_ALGO_L2_EVENT_FORWARDING_PROFILE_TEMPLATE     "VSI forwarding profile template"
     27 #define DNX_ALGO_L2_VSI_LEARNING_PROFILE_TEMPLATE         "VSI learning profile template"
     28 #define DNX_ALGO_L2_VSI_AGING_PROFILE_TEMPLATE            "VSI aging profile template"
     29 
     30 #define DNX_VSI_LEARNING_PROFILE_DEFAULT_PROFILE_ID 0
     31 #define DNX_FORWARDING_EVENT_PROFILE_DEFAULT_PROFILE_ID 0
     32 #define DNX_VSI_AGING_PROFILE_DEFAULT_PROFILE_ID 0
     33 
     34 #define OLP_ILLEGAL_DISTRIBUTION 0xFFFFFFFF
     35 
     36 #define BUILD_OLP_DISTRIBUTION_BUFFER(loopback, mc, cpu, cpu_dma)   ((loopback) | ((mc)<<1) | ((cpu)<<2) | ((cpu_dma)<<3))
     37 /** 1 if the distribution is set in the buffer; 0 otherwise */
     38 #define GET_LOOPBACK_DISTRIBUTION_FROM_BUFFER(buffer)   (((buffer) & 0x1))
     39 #define GET_MC_DISTRIBUTION_FROM_BUFFER(buffer)         (((buffer) & 0x2)>>1)
     40 #define GET_CPU_DISTRIBUTION_FROM_BUFFER(buffer)        (((buffer) & 0x4)>>2)
     41 #define GET_CPU_DMA_DISTRIBUTION_FROM_BUFFER(buffer)    (((buffer) & 0x8)>>3)
     42 
     43 #define AGING_PROFILE_INVALID_AGE (-1)
     44 /**
     45  * }
     46  */
     47 
     48   /**
     49  * \brief - data of a vsi profile.
     50  */
     51 typedef struct
     52 {
     53     /** A limit for the number of entries in the MACT */
     54     uint32 limit;
     55 
     56     /** Enable interrupts when limit is crossed */
     57     uint8 interrupt_enable;
     58 
     59     /** Enable OLP messages when limit is crossed */
     60     uint8 message_enable;
     61 
     62     /** Profile describing the distribution of the OLP events */
     63     uint32 event_forwarding_profile;
     64 
     65     /** Profile describing which events are raised in each age state */
     66     uint32 aging_profile;
     67 
     68     /** Control the aging cycle period */
     69     uint32 cycle_period;
     70 
     71     /** Mask the cycle period */
     72     uint32 cycle_mask;
     73 
     74 } dnx_vsi_learning_profile_info_t;
     75 
     76 /**
     77  * \brief - data of a vsi forwarding profile.
     78  */
     79 typedef struct
     80 {
     81     /** Distribution queues of the learn event */
     82     uint32 learn_distribution;
     83 
     84     /** Distribution queues of the transplant event */
     85     uint32 transplant_distribution;
     86 
     87     /** Distribution queues of the delete event */
     88     uint32 delete_distribution;
     89 
     90     /** Distribution queues of the refresh event */
     91     uint32 refresh_distribution;
     92 
     93     /** Distribution queues of the ack event */
     94     uint32 ack_distribution;
     95 
     96 } dnx_event_forwarding_profile_info_t;
     97 
     98 typedef struct
     99 {
    100     /** The age which is configured for age out event. RBD bit is concatenated as the MSB */
    101     uint32 ageout_age;
    102 
    103     /** The age which is configured for delete operation. RBD bit is concatenated as the MSB */
    104     uint32 delete_age;
    105 
    106     /** The age which is configured for refresh event. RBD bit is concatenated as the MSB */
    107     uint32 refresh_age;
    108 
    109 } dnx_aging_profile_info_t;
    110 
    111 /** Set this value if the event's distribution should stay as is and you are updating only the other events */
    112 #define DISTRIBUTION_NO_CHANGE 0xFFFFFFFF
    113 
    114 /**
    115  * \brief - Increase the reference of a forwarding profile using get and allocate on this profile.
    116  *
    117  * \param [in] unit - unit id
    118  * \param [in] forwarding_profile - profile id
    119  *
    120  * \return
    121  *   shr_error_e
    122  *
    123  * \remark
    124  *   * None
    125  * \see
    126  *   * None
    127  */
    128 shr_error_e dnx_algo_l2_event_forwarding_profile_increase_ref(
    129     int unit,
    130     int forwarding_profile);
    131 
    132 /**
    133  * \brief - Decrease the reference of a forwarding profile.
    134  *
    135  * \param [in] unit - unit id
    136  * \param [in] forwarding_profile - profile id
    137  *
    138  * \return
    139  *   shr_error_e
    140  *
    141  * \remark
    142  *   * None
    143  * \see
    144  *   * None
    145  */
    146 shr_error_e dnx_algo_l2_event_forwarding_profile_decrease_ref(
    147     int unit,
    148     int forwarding_profile);
    149 
    150 /**
    151  * \brief - Increase the reference of a aging profile using get and allocate on this profile.
    152  *
    153  * \param [in] unit - unit id
    154  * \param [in] aging_profile - profile id
    155  *
    156  * \return
    157  *   shr_error_e
    158  *
    159  * \remark
    160  *   * None
    161  * \see
    162  *   * None
    163  */
    164 shr_error_e dnx_algo_l2_aging_profile_increase_ref(
    165     int unit,
    166     int aging_profile);
    167 
    168 /**
    169  * \brief - Decrease the reference of a aging profile.
    170  *
    171  * \param [in] unit - unit id
    172  * \param [in] aging_profile - profile id
    173  *
    174  * \return
    175  *   shr_error_e
    176  *
    177  * \remark
    178  *   * None
    179  * \see
    180  *   * None
    181  */
    182 shr_error_e dnx_algo_l2_aging_profile_decrease_ref(
    183     int unit,
    184     int aging_profile);
    185 
    186 /**
    187  * \brief - Print an entry of the vsi profile template. See
    188  *       \ref dnx_algo_template_print_data_cb for more details.
    189  * 
    190  * \param [in] unit - unit id
    191  * \param [in] data - Pointer to the struct to be printed.
    192  *      \b As \b input - \n
    193  *       The pointer is expected to hold a struct of type uint32[2]. \n
    194  *       It's the user's responsibility to verify it beforehand.
    195  * \return
    196  * \remark
    197  *   * None
    198  * \see
    199  *   * None
    200  */
    201 void dnx_l2_vsi_profile_print_cb(
    202     int unit,
    203     const void *data);
    204 
    205 /**
    206  * \brief - Print an entry of the vsi forwarding profile template. See
    207  *       \ref dnx_algo_template_print_data_cb for more details.
    208  * 
    209  * \param [in] unit - unit id
    210  * \param [in] data - Pointer to the struct to be printed.
    211  * \return
    212  * \remark 
    213  *  None
    214  * \see
    215  *    dnx_algo_template_print_data_cb
    216  */
    217 void dnx_l2_event_forwarding_profile_print_cb(
    218     int unit,
    219     const void *data);
    220 
    221 /**
    222  * \brief - Print an entry of the vsi aging profile template. See
    223  *       \ref dnx_algo_template_print_data_cb for more details.
    224  * 
    225  * \param [in] unit - unit id
    226  * \param [in] data - Pointer to the struct to be printed.
    227  * \return
    228  * \remark
    229  *   * None
    230  * \see
    231  *   * None
    232  */
    233 void dnx_l2_vsi_aging_print_cb(
    234     int unit,
    235     const void *data);
    236 
    237 /**
    238  * \brief - Intialize l2 algorithms.
    239  * 
    240  * \param [in] unit - unit id
    241  *   
    242  * \return
    243  *   shr_error_e 
    244  *   
    245  * \remark
    246  *   * None
    247  * \see
    248  *   * None
    249  */
    250 shr_error_e dnx_algo_l2_init(
    251     int unit);
    252 
    253 /*
    254  * } 
    255  */
    256 #endif/*_ALGO_L3_API_INCLUDED__*/