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

field_presel.h (7670B)


      1 /**
      2  *  \file bcm_int/dnx/field/field_presel.h 
      3  *
      4  *  This file exposes DNX level functions for Field Preselection,
      5  *  and their input structure types.
      6  *
      7  *  
      8  *  Internal DNX RX APIs
      9 PIs This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file.
     10 PIs 
     11 PIs Copyright 2007-2020 Broadcom Inc. All rights reserved. 
     12  */
     13 
     14 #ifndef DNX_FIELD_PRESEL_H_INCLUDED
     15 
     16 #define DNX_FIELD_PRESEL_H_INCLUDED
     17 
     18 #ifndef BCM_DNX_SUPPORT
     19 #error "This file is for use by DNX (JR2) family only!"
     20 #endif
     21 
     22 /*
     23  * { Include files 
     24  */
     25 
     26 /** bcm */
     27 #include <bcm/field.h>
     28 #include <bcm/types.h>
     29 #include <bcm_int/dnx/field/field.h>
     30 /** soc */
     31 #include <soc/dnx/dbal/dbal.h>
     32 #include <soc/dnx/swstate/auto_generated/types/dnx_field_types.h>
     33 #include <soc/dnx/dnx_data/auto_generated/dnx_data_device.h>
     34 #include <soc/dnx/dnx_data/auto_generated/dnx_data_field.h>
     35 #include <soc/dnx/dnx_data/auto_generated/dnx_data_max_field.h>
     36 /** shared */
     37 #include <shared/bsl.h>
     38 /*
     39  * } Include files
     40  */
     41 
     42 /*
     43  * { Types 
     44  */
     45 
     46 /** 
     47 *   This structure holds the info to identify a preselector.
     48 *   It has unique ID per stage.
     49 */
     50 typedef struct
     51 {
     52     /*
     53      * Hold the Preselector ID
     54      */
     55     dnx_field_presel_t presel_id;
     56     /*
     57      * Hold the Stage of the preselector
     58      */
     59     dnx_field_stage_e stage;
     60 
     61 } dnx_field_presel_entry_id_t;
     62 
     63 /** 
     64 *   This structure holds the data per preselector qualifier.
     65 */
     66 typedef struct
     67 {
     68     /*
     69      * Hold for each set qualifier the DBAL field to be called
     70      */
     71     dbal_fields_e qual_type_dbal_field;
     72     /*
     73      * Hold the value provided for each set qualifier
     74      */
     75     uint32 qual_value;
     76     /*
     77      * Hold the mask provided for each set qualifier
     78      */
     79     uint32 qual_mask;
     80 
     81 } dnx_field_presel_qual_data_t;
     82 /** 
     83 *   This structure holds the data to be written in preselection.
     84 */
     85 typedef struct
     86 {
     87     /*
     88      * Indicate if the program valid will be set at presel creation
     89      */
     90     uint8 entry_valid;
     91     /*
     92      * Hold the context ID to be associated by this preselector
     93      */
     94     dnx_field_context_t context_id;
     95     /*
     96      * Hold the number of set qualifiers
     97      */
     98     uint32 nof_qualifiers;
     99     /*
    100      * Hold for each set qualifier its data
    101      */
    102     dnx_field_presel_qual_data_t qual_data[DNX_FIELD_CS_QUAL_NOF_MAX];
    103 
    104 } dnx_field_presel_entry_data_t;
    105 
    106 /*
    107  * } Types
    108  */
    109 /**
    110 * \brief
    111 *  Install a functional preselector with access_id (preselector with given ID): Program
    112 *  action and qualifiers data
    113 * \param [in] unit       - Device ID
    114 * \param [in] flags      - preselection flags
    115 * \param [in] entry_id_p   - Identifier of the preselector: 
    116 *                          User-provided preselector ID and stage
    117 * \param [in] entry_data_p - Data to be written in hardware: 
    118 *                          PMF Program ID and valid, qualifiers
    119 *                          data
    120 * \return
    121 *   shr_error_e - Error Type
    122 * \remark
    123 *   * None
    124 * \see
    125 *   * None
    126 */
    127 shr_error_e dnx_field_presel_set(
    128     int unit,
    129     uint32 flags,
    130     dnx_field_presel_entry_id_t * entry_id_p,
    131     dnx_field_presel_entry_data_t * entry_data_p);
    132 
    133 /**
    134 * \brief
    135 *  Get the HW data associated with access_id (preselector with given ID):
    136 *  Program action and qualifiers data
    137 * \param [in] unit       - Device ID
    138 * \param [in] flags      - preselection flags
    139 * \param [in] entry_id_p   - Identifier of the preselector: 
    140 *                          User-provided preselector ID and stage
    141 * \param [out] entry_data_p - Data contained in hardware: 
    142 *                          PMF Program ID and valid, qualifiers
    143 *                          data
    144 * \return
    145 *   shr_error_e - Error Type
    146 * \remark
    147 *   * None
    148 * \see
    149 *   * None
    150 */
    151 shr_error_e dnx_field_presel_get(
    152     int unit,
    153     uint32 flags,
    154     dnx_field_presel_entry_id_t * entry_id_p,
    155     dnx_field_presel_entry_data_t * entry_data_p);
    156 
    157 /**
    158 * \brief
    159 *  Returns first free preselector ID for the given stage.
    160 * \param [in] unit       - Device ID
    161 * \param [in] field_stage   -
    162 *  Stage for which free presel ID have to be taken.
    163 * \param [out] presel_id_p -
    164 *  First free preselector ID for the given stage.
    165 *
    166 * \return
    167 *   shr_error_e - Error Type
    168 * \remark
    169 *   * None
    170 * \see
    171 *   * None
    172 */
    173 shr_error_e dnx_field_presel_free_id_get(
    174     int unit,
    175     dnx_field_stage_e field_stage,
    176     dnx_field_presel_t * presel_id_p);
    177 
    178 /**
    179 * \brief
    180 *  Clear the dnx_field_group_info_t, set it to preferred init values
    181 * \param [in] unit          - Device ID
    182 * \param [in] entry_id_p    - Pointer to input structure of
    183 *                        dnx_field_presel_entry_id_t that needs to be init
    184 * \return
    185 *   shr_error_e - Error Type
    186 * \remark
    187 *   * None
    188 * \see
    189 *   * None
    190 */
    191 shr_error_e dnx_field_presel_entry_id_t_init(
    192     int unit,
    193     dnx_field_presel_entry_id_t * entry_id_p);
    194 /**
    195 * \brief
    196 *  Clear the dnx_field_group_info_t, set it to preferred init values
    197 * \param [in] unit          - Device ID
    198 * \param [in] entry_data_p  - Pointer to input structure of
    199 *                           dnx_field_presel_entry_data_t that needs to be init
    200 * \return
    201 *   shr_error_e - Error Type
    202 * \remark
    203 *   * None
    204 * \see
    205 *   * None
    206 */
    207 shr_error_e dnx_field_presel_entry_data_t_init(
    208     int unit,
    209     dnx_field_presel_entry_data_t * entry_data_p);
    210 
    211 /**
    212 * \brief Convert BCM preselection ID to DNX format
    213 * \param [in] unit         - Device ID
    214 * \param [in] flags        - preselection flags
    215 * \param [in] bcm_entry_id_p - preselection entry identifier in
    216 *        BCM format
    217 * \param [out] dnx_entry_id_p - preselection entry identifier in
    218 *        DNX format
    219 * \return
    220 *   shr_error_e - Error Type
    221 * \remark
    222 *   * None
    223 * \see
    224 *   * None
    225 */
    226 shr_error_e dnx_field_presel_id_bcm_to_dnx_convert(
    227     int unit,
    228     uint32 flags,
    229     bcm_field_presel_entry_id_t * bcm_entry_id_p,
    230     dnx_field_presel_entry_id_t * dnx_entry_id_p);
    231 
    232 /**
    233 * \brief Convert BCM preselection data to DNX format
    234 * \param [in] unit         - Device ID
    235 * \param [in] flags        - preselection flags
    236 * \param [in] stage        - Stage
    237 * \param [in] bcm_entry_data_p - preselection entry data in BCM
    238 *        format
    239 * \param [out] dnx_entry_data_p - preselection entry data in DNX
    240 *        format
    241 * \return
    242 *   shr_error_e - Error Type
    243 * \remark
    244 *   * None
    245 * \see
    246 *   * None
    247 */
    248 shr_error_e dnx_field_presel_data_bcm_to_dnx_convert(
    249     int unit,
    250     uint32 flags,
    251     dnx_field_stage_e stage,
    252     bcm_field_presel_entry_data_t * bcm_entry_data_p,
    253     dnx_field_presel_entry_data_t * dnx_entry_data_p);
    254 
    255 /**
    256 * \brief Convert DNX preselection data to BCM format
    257 * \param [in] unit         - Device ID
    258 * \param [in] flags        - preselection flags
    259 * \param [in] dnx_entry_id_p - preselection entry identifier in
    260 *        DNX format
    261 * \param [out] dnx_entry_data_p - preselection entry data in DNX
    262 *        format
    263 * \param [in] bcm_entry_data_p - preselection entry data in BCM
    264 *        format
    265 * \return
    266 *   shr_error_e - Error Type
    267 * \remark
    268 *   * None
    269 * \see
    270 *   * None
    271 */
    272 shr_error_e dnx_field_presel_data_dnx_to_bcm_convert(
    273     int unit,
    274     uint32 flags,
    275     dnx_field_presel_entry_id_t * dnx_entry_id_p,
    276     dnx_field_presel_entry_data_t * dnx_entry_data_p,
    277     bcm_field_presel_entry_data_t * bcm_entry_data_p);
    278 
    279 /**
    280 * \brief
    281 *  run init for Presel module, such as default context presel entry.
    282 * \param [in] unit       - Device ID
    283 * \return
    284 *   shr_error_e - Error Type
    285 * \remark
    286 *   * None
    287 * \see
    288 *   * None
    289 */
    290 shr_error_e dnx_field_presel_init(
    291     int unit);
    292 
    293 /**
    294 * \brief
    295 *  run deinit for Presel module.
    296 * \param [in] unit       - Device ID
    297 * \return
    298 *   shr_error_e - Error Type
    299 * \remark
    300 *   * None
    301 * \see
    302 *   * None
    303 */
    304 shr_error_e dnx_field_presel_deinit(
    305     int unit);
    306 
    307 #endif/*_FIELD_API_INCLUDED_*/