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


      1 /**
      2  *  \file bcm_int/dnx/field/field_context.h
      3  * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file.
      4  * 
      5  * Copyright 2007-2020 Broadcom Inc. All rights reserved.
      6  *
      7  * This file is header file  for
      8  * Field Context procedures for DNX.
      9  *
     10  * Context id management and context info parameter
     11  */
     12 
     13 #ifndef DNX_FIELD_CONTEXT_H_INCLUDED
     14 /* { */
     15 #define DNX_FIELD_CONTEXT_H_INCLUDED
     16 
     17 /*
     18  * { Include files
     19  */
     20 
     21 #include <include/bcm_int/dnx/field/field.h>
     22 #include <include/bcm_int/dnx/field/field_key.h>
     23 #include <include/bcm_int/dnx/field/field_group.h>
     24 #include <soc/dnx/swstate/auto_generated/types/dnx_field_context_types.h>
     25 
     26 /*
     27  * } Include files
     28  */
     29 /*
     30  * Typedefs
     31  * {
     32  */
     33 
     34 typedef enum
     35 {
     36     DNX_FIELD_CONTEXT_FLAG_WITH_ID = 0x1,
     37     DNX_FIELD_CONTEXT_FLAG_NOF
     38 } dnx_field_context_flags_e;
     39 
     40 typedef enum
     41 {
     42     DNX_FIELD_CONTEXT_SYS_HDR_PROFILE_INVALID = -1,
     43     DNX_FIELD_CONTEXT_SYS_HDR_PROFILE_FIRST = 0,
     44     DNX_FIELD_CONTEXT_SYS_HDR_PROFILE_FTMH_TSH_PPH_UDH = DNX_FIELD_CONTEXT_SYS_HDR_PROFILE_FIRST,
     45     DNX_FIELD_CONTEXT_SYS_HDR_PROFILE_FTMH = 1,
     46     DNX_FIELD_CONTEXT_SYS_HDR_PROFILE_FTMH_TSH_PPH = 2,
     47     DNX_FIELD_CONTEXT_SYS_HDR_PROFILE_EMPTY = 3,
     48     DNX_FIELD_CONTEXT_SYS_HDR_PROFILE_FTMH_PPH = 4,
     49     DNX_FIELD_CONTEXT_SYS_HDR_PROFILE_FTMH_TSH = 5,
     50     DNX_FIELD_CONTEXT_SYS_HDR_PROFILE_FTMH_UDH = 6,
     51     DNX_FIELD_CONTEXT_SYS_HDR_PROFILE_NOF,
     52 } dnx_field_context_sys_hdr_profile_e;
     53 
     54 /**
     55  * This enum contains key ids values for the first and second compare keys
     56  */
     57 typedef enum
     58 {
     59     DNX_FIELD_CONTEXT_COMPARE_FIRST_KEY = 0,
     60     DNX_FIELD_CONTEXT_COMPARE_SECOND_KEY = 1,
     61 } dnx_field_context_compare_key_id_e;
     62 
     63 /**
     64  * Future use
     65  */
     66 typedef enum
     67 {
     68 
     69     DNX_FIELD_CONTEXT_HASH_FLAGS_FIRST = 0x0,
     70     DNX_FIELD_CONTEXT_HASH_FLAGS_NONE = DNX_FIELD_CONTEXT_HASH_FLAGS_FIRST,
     71     DNX_FIELD_CONTEXT_HASH_FLAGS_UPDATE = 0x1,
     72     DNX_FIELD_CONTEXT_HASH_FLAGS_NOF
     73 } dnx_field_context_hash_flags_e;
     74 
     75 /**
     76  * Future use
     77  */
     78 typedef enum
     79 {
     80 
     81     DNX_FIELD_CONTEXT_COMPARE_FLAGS_FIRST = 0x0,
     82     DNX_FIELD_CONTEXT_COMPARE_FLAGS_NONE = DNX_FIELD_CONTEXT_HASH_FLAGS_FIRST,
     83     DNX_FIELD_CONTEXT_COMPARE_FLAGS_NOF
     84 } dnx_field_context_compare_flags_e;
     85 
     86 /**
     87  * Compare pair indicator, indicates which pair of keys should be compared.
     88  */
     89 typedef enum
     90 {
     91     DNX_FIELD_CONTEXT_COMPARE_FIRST_PAIR = 0x1,
     92     DNX_FIELD_CONTEXT_COMPARE_SECOND_PAIR = 0x2,
     93 } dnx_field_context_compare_pair_e;
     94 
     95 /**
     96  * This struct represents iPMF1 mode parameters, it's used in context create to specify iPMF1 context mode
     97  */
     98 typedef struct
     99 {
    100     /** Specifies compare mode for the first pair */
    101     dnx_field_context_compare_mode_e compare_mode_1;
    102     /** Specifies compare mode for the second pair */
    103     dnx_field_context_compare_mode_e compare_mode_2;
    104     /** Specifies hashing mode */
    105     dnx_field_context_hash_mode_e hash_mode;
    106 } dnx_field_context_ipmf1_mode_t;
    107 
    108 /**
    109  * This struct represents iPMF2 mode parameters, it's used in context create to specify iPMF2 context mode
    110  */
    111 typedef struct
    112 {
    113     /** Specifies which context the current iPMF2 context is cascaded from */
    114     dnx_field_context_t cascaded_from;
    115 } dnx_field_context_ipmf2_mode_t;
    116 
    117 /**
    118  * This struct represents context mode parameters, it's used in context create to specify both iPMF1/iPMF2 context mode
    119  */
    120 typedef struct
    121 {
    122     /** Specifies mode for iPMF1 context */
    123     dnx_field_context_ipmf1_mode_t context_ipmf1_mode;
    124     /** Specifies mode for iPMF2 context */
    125     dnx_field_context_ipmf2_mode_t context_ipmf2_mode;
    126     /** Specifies state table feature mode */
    127     dnx_field_context_state_table_mode_e state_table_mode;
    128     /**
    129      * Name of the context.
    130      */
    131     char name[DBAL_MAX_STRING_LENGTH];
    132 } dnx_field_context_mode_t;
    133 
    134 /**
    135  * This struct represents the apptype info used for creating a dynamic apptype.
    136  */
    137 typedef struct
    138 {
    139     /** Specifies the static apptype that the dynamic apptype cascades from. */
    140     bcm_field_AppType_t base_static_apptype;
    141     /**
    142      * Name of the context.
    143      */
    144     char name[DBAL_MAX_STRING_LENGTH];
    145 } dnx_field_context_apptype_info_t;
    146 
    147 /**
    148  * This structure represents a single context_key element.
    149  * The context key element is a collection of quals/quals_info, that by itself can construct a key in PMF (key is
    150  * defined to be a collection of FFCs).
    151  * This is an abstract struct used only by other structs as a uniformed way to define 'context_keys'
    152  */
    153 typedef struct
    154 {
    155        /**
    156         * The qualifier order, type and number must be the same as was passed to dnx_field_group_add API
    157         * Number of meaningful elements on this array: All elements until
    158         * DNX_FIELD_QUAL_TYPE_INVALID is encountered.
    159         */
    160     dnx_field_qual_t dnx_quals[DNX_DATA_MAX_FIELD_GROUP_NOF_QUALS_PER_FG];
    161        /**
    162         * Indicate how to read the relevant qualifier from PBUS
    163         * The information is aligned to the qualifier types array above
    164         * Number of elements set by dnx_quals array
    165         */
    166     dnx_field_qual_attach_info_t qual_info[DNX_DATA_MAX_FIELD_GROUP_NOF_QUALS_PER_FG];
    167 
    168 } dnx_field_context_key_qual_info_t;
    169 
    170 /*
    171  * This structure holds detailed info about hash configuration, needed
    172  * for bcm_field_context_hash_info_t struct.
    173  * See dnx_field_context_hash_create().
    174  */
    175 typedef struct
    176 {
    177     /**
    178      * One of the various lb-keys which are iPMF1 output.
    179      */
    180     dbal_enum_value_field_field_hash_lb_key_e action_key;
    181     /**
    182      * Hashing Action which selects weather to keep the input lb-key or to replace it.
    183      */
    184     dbal_enum_value_field_hash_action_e hash_action;
    185     /**
    186      * CRC Action which selects CRC Polynomial to apply on hash function ouput (in case hash action is augment).
    187      */
    188     dbal_enum_value_field_crc_select_e crc_select;
    189 
    190 } dnx_field_context_hash_config_t;
    191 
    192 /**
    193  * This structure holds the information for the hash key used for hashing mechanism.
    194  * See dnx_field_context_hash_create().
    195  */
    196 typedef struct
    197 {
    198 
    199     /** The key information */
    200     dnx_field_context_key_qual_info_t key_info;
    201     /** Enable/Disable the compression data */
    202     uint8 compression;
    203     /** Enable/Disable the order of data */
    204     uint8 order;
    205     /** Hashing configuration params, describing which hash action is performed and which signals */
    206     dnx_field_context_hash_config_t hash_config[DNX_DATA_MAX_FIELD_CONTEXT_NOF_HASH_KEYS];
    207     /** Hashing polynomial for hashing mechanism. */
    208     dbal_enum_value_field_context_hash_function_e hash_function;
    209 
    210 } dnx_field_context_hash_info_t;
    211 
    212 typedef struct
    213 {
    214     /** The information for the first key*/
    215     dnx_field_context_key_qual_info_t first_key_info;
    216     /** The information for the second key*/
    217     dnx_field_context_key_qual_info_t second_key_info;
    218 
    219 } dnx_field_key_compare_pair_info_t;
    220 
    221 /*
    222  * Typedefs
    223  * }
    224  */
    225 
    226 /**
    227 * \brief
    228 *  Init the Sw state of Field Context module
    229 * \param [in] unit  - Device id
    230 * \return
    231 *   shr_error_e - Error Type
    232 * \remark
    233 *   * None
    234 * \see
    235 *   * None
    236 */
    237 shr_error_e dnx_field_context_sw_state_init(
    238     int unit);
    239 
    240 /**
    241 * \brief
    242 *  Init the Sw state of Field Apptype module
    243 * \param [in] unit  - Device id
    244 * \return
    245 *   shr_error_e - Error Type
    246 * \remark
    247 *   * None
    248 * \see
    249 *   * None
    250 */
    251 shr_error_e dnx_field_context_apptype_sw_state_init(
    252     int unit);
    253 
    254 /**
    255 * \brief
    256 *  Inits a dnx_field_mode_t struct.
    257 *  Sets compare_modes to NONE, hashing to disabled as iPMF1 context mode, and sets iPMF2 context mode
    258 *  to not cascaded from any valid context.
    259 * \param [in] unit            - Device ID
    260 * \param [out] context_mode_p - The struct to init / Needs to be allocated by user
    261 * \return
    262 *   shr_error_e - Error Type
    263 * \remark
    264 *   * None
    265 * \see
    266 *   * None
    267  */
    268 shr_error_e dnx_field_context_mode_t_init(
    269     int unit,
    270     dnx_field_context_mode_t * context_mode_p);
    271 
    272 /**
    273 * \brief
    274 *  Inits a dnx_field_context_apptype_info_t struct.
    275 * \param [in] unit            - Device ID
    276 * \param [out] apptype_info_p - The struct to init
    277 * \return
    278 *   shr_error_e - Error Type
    279 * \remark
    280 *   * None
    281 * \see
    282 *   * None
    283  */
    284 shr_error_e dnx_field_context_apptype_info_t_init(
    285     int unit,
    286     dnx_field_context_apptype_info_t * apptype_info_p);
    287 
    288 /**
    289 * \brief
    290 *  Allocates Context Id in the allowed range per Stage
    291 * \param [in] unit                - Device ID
    292 * \param [in] flags               - Flags for context creation (WITH_ID)
    293 * \param [in] stage               - Field Stage to create context for
    294 * \param [in] context_mode_p      - Context properties struct (see dnx_field_context_types.h)
    295 *                                   Will only take into consideration the substructure related to the field stage.
    296 *                                   At the moment only iPMF1 and iPMF2 have their own substructures.
    297 * \param [in,out] field_context_id_p  - Pointer to Context ID
    298 *                                          As in - Context id to allocate in case WITH ID is set
    299 *                                          As out - Allocated context id by algo
    300 * \return
    301 *   shr_error_e - Error Type
    302 * \remark
    303 *   * None
    304 * \see
    305 *   * None
    306 */
    307 shr_error_e dnx_field_context_create(
    308     int unit,
    309     dnx_field_context_flags_e flags,
    310     dnx_field_stage_e stage,
    311     dnx_field_context_mode_t * context_mode_p,
    312     dnx_field_context_t * field_context_id_p);
    313 
    314 /**
    315 * \brief
    316 *  Allocates Context Id in the allowed range per Stage
    317 * \param [in] unit                - Device ID
    318 * \param [in] flags               - Flags for context creation (WITH_ID)
    319 * \param [in] apptype_info_p      - The structure containing the name of the new apptype and the static apptype
    320 *                                   it cascades from.
    321 * \param [in,out] apptype_p       - Pointer to Apptype.
    322 *                                          As in - Apptype to allocate in case WITH ID is set
    323 *                                          As out - Allocated Apptype by algo
    324 * \return
    325 *   shr_error_e - Error Type
    326 * \remark
    327 *   * None
    328 * \see
    329 *   * None
    330 */
    331 shr_error_e dnx_field_context_apptype_create(
    332     int unit,
    333     dnx_field_context_flags_e flags,
    334     dnx_field_context_apptype_info_t * apptype_info_p,
    335     bcm_field_AppType_t * apptype_p);
    336 
    337 /**
    338  * \brief
    339 *  Get the cascaded static apptype of a dynamic apptype.
    340 * \param [in] unit       - Device ID
    341 * \param [in] dynamic_apptype     - The cascading dynamic apptype.
    342 * \param [out] base_static_apptype_p  - The cascaded static apptype.
    343 * \return
    344 *   shr_error_e - Error Type
    345 * \remark
    346 *   * None
    347 * \see
    348 *   * None
    349 */
    350 shr_error_e dnx_field_context_apptype_cascaded_get(
    351     int unit,
    352     bcm_field_AppType_t dynamic_apptype,
    353     bcm_field_AppType_t * base_static_apptype_p);
    354 
    355 /**
    356 * \brief
    357 *  Get the context apptype info.
    358 * \param [in] unit       - Device ID
    359 * \param [in] apptype     - The apptype for which info will be returned.
    360 * \param [out] apptype_info_p  - Pointer to the structure containing the
    361 *                                name of the apptype and the static
    362 *                                apptype it cascades from.
    363 * \return
    364 *   shr_error_e - Error Type
    365 * \remark
    366 *   * None
    367 * \see
    368 *   * None
    369 */
    370 shr_error_e dnx_field_context_apptype_info_get(
    371     int unit,
    372     bcm_field_AppType_t apptype,
    373     dnx_field_context_apptype_info_t * apptype_info_p);
    374 
    375 /**
    376 * \brief
    377 *  Get the list of user defined Apptypes that cascade from a predefined Apptype.
    378 * \param [in] unit       - Device ID
    379 * \param [in] predef_app_type  - The parent predefiend Apptype.
    380 * \param [out] nof_child_apptypes_p  - The number of user defiend Apptypes that cascade from the predefine Apptype.
    381 * \param [out] user_app_types  - The user defiend Apptypes that cascade from the predefine Apptype.
    382 * \return
    383 *   shr_error_e - Error Type
    384 * \remark
    385 *   * None
    386 * \see
    387 *   * None
    388 */
    389 shr_error_e dnx_field_context_apptype_to_child_apptypes(
    390     int unit,
    391     bcm_field_AppType_t predef_app_type,
    392     int *nof_child_apptypes_p,
    393     bcm_field_AppType_t user_app_types[DNX_DATA_MAX_FIELD_KBP_APPTYPE_USER_NOF]);
    394 
    395 /**
    396 * \brief
    397 *  Get the predefined Apptype upon which a user defined apptype is based.
    398 * \param [in] unit       - Device ID
    399 * \param [in] user_app_type       - The user defiend Apptypes that cascade from the predefine Apptype.
    400 * \param [out] predef_app_type_p  - The parent predefiend Apptype.
    401 * \return
    402 *   shr_error_e - Error Type
    403 * \remark
    404 *   * None
    405 * \see
    406 *   * None
    407 */
    408 shr_error_e dnx_field_context_user_apptype_to_predef_apptype(
    409     int unit,
    410     bcm_field_AppType_t user_app_type,
    411     bcm_field_AppType_t * predef_app_type_p);
    412 
    413 /**
    414  * \brief
    415 *  Get context compare info of a Field context
    416 * \param [in] unit       - Device ID
    417 * \param [in] context_id     - Field Context ID
    418 * \param [out] context_compare_info_p  - Field Context compare info_field_context_types.h)
    419 * \return
    420 *   shr_error_e - Error Type
    421 * \remark
    422 *   * The mode can be one of the following: Hashing/Compare
    423 * \see
    424 *   * None
    425 */
    426 shr_error_e dnx_field_context_cmp_info_get(
    427     int unit,
    428     dnx_field_context_t context_id,
    429     dnx_field_context_compare_info_t * context_compare_info_p);
    430 
    431 /**
    432 * \brief
    433 *  Init the struct of Field Context Compare info
    434 * \param [in] unit  - Device id
    435 * \param [in] compare_info_p  - context compare struct (see dnx_field_context_types.h)
    436 * \return
    437 *   shr_error_e - Error Type
    438 * \remark
    439 *   * None
    440 * \see
    441 *   * None
    442 */
    443 shr_error_e dnx_field_context_compare_info_t_init(
    444     int unit,
    445     dnx_field_context_compare_info_t * compare_info_p);
    446 
    447 /**
    448 * \brief
    449 *  Init the struct of Field Context Hashing info
    450 * \param [in] unit  - Device id
    451 * \param [in] hash_info_p  - context hashing struct (see dnx_field_context_types.h)
    452 * \return
    453 *   shr_error_e - Error Type
    454 * \remark
    455 *   * None
    456 * \see
    457 *   * None
    458 */
    459 shr_error_e dnx_field_context_hashing_info_t_init(
    460     int unit,
    461     dnx_field_context_hashing_info_t * hash_info_p);
    462 
    463 /**
    464 * \brief
    465 *  Init the struct of Field Context state table info
    466 * \param [in] unit  - Device id
    467 * \param [in] state_table_info_p  - context state table info struct (see dnx_field_context_types.h)
    468 * \return
    469 *   shr_error_e - Error Type
    470 * \remark
    471 *   * None
    472 * \see
    473 *   * None
    474 */
    475 shr_error_e dnx_field_context_state_table_info_t_init(
    476     int unit,
    477     dnx_field_context_state_table_info_t * state_table_info_p);
    478 
    479 /**
    480 * \brief
    481 *  Set context State Table information of a Field context
    482 * \param [in] unit       - Device ID
    483 * \param [in] context_id - Field Context ID
    484 * \param [in] state_table_info_p  - Field State Table info (see dnx_field_context_types.h)
    485 * \return
    486 *   shr_error_e - Error Type
    487 * \remark
    488 *   * The mode can be one of the following: Hashing/Compare
    489 * \see
    490 *   * None
    491 */
    492 shr_error_e dnx_field_context_state_table_info_set(
    493     int unit,
    494     dnx_field_context_t context_id,
    495     dnx_field_context_state_table_info_t * state_table_info_p);
    496 
    497 /**
    498 * \brief
    499 *  Get context hashing information  of a Field context
    500 * \param [in] unit       - Device ID
    501 * \param [in] context_id     - Field Context ID
    502 * \param [out] context_hashing_info_p  - Field Hashing info (see dnx_field_context_types.h)
    503 * \return
    504 *   shr_error_e - Error Type
    505 * \remark
    506 *   * The mode can be one of the following: Hashing/Compare
    507 * \see
    508 *   * None
    509 */
    510 shr_error_e dnx_field_context_hashing_info_get(
    511     int unit,
    512     dnx_field_context_t context_id,
    513     dnx_field_context_hashing_info_t * context_hashing_info_p);
    514 
    515 /**
    516 * \brief
    517 *  Get context state table information  of a Field context
    518 * \param [in] unit       - Device ID
    519 * \param [in] context_id     - Field Context ID
    520 * \param [out] state_table_info_p  - Field State Table info (see dnx_field_context_types.h)
    521 * \return
    522 *   shr_error_e - Error Type
    523 * \remark
    524 * \see
    525 *   * None
    526 */
    527 shr_error_e dnx_field_context_state_table_info_get(
    528     int unit,
    529     dnx_field_context_t context_id,
    530     dnx_field_context_state_table_info_t * state_table_info_p);
    531 
    532 /**
    533  * \brief
    534  *  Get context cascaded from of a Field context.
    535  * \param [in] unit       - Device ID
    536  * \param [in] stage      - DNX PMF Stage. Only iPMF2 can use this function.
    537  * \param [in] context_id - Field Context ID
    538  * \param [out] cascaded_from_context_id_p  - The iPMF1 context that the iPMF2 context cascades from.
    539  *                                          Note that all iPMF2 context must have a valid iPMF1 context to cascade from.
    540  * \return
    541  *   shr_error_e -
    542  *     * Error Type
    543  *     * If 'context_id' has not been allocated for specified stage then
    544  *       returned error code is '_SHR_E_NOT_FOUND'
    545  * \remark
    546  *   *
    547  * \see
    548  *   * None
    549  */
    550 shr_error_e dnx_field_context_cascaded_from_context_id_get(
    551     int unit,
    552     dnx_field_stage_e stage,
    553     dnx_field_context_t context_id,
    554     dnx_field_context_t * cascaded_from_context_id_p);
    555 
    556 /**
    557  * \brief
    558  *   Given a 'main_context_id', which is KNOWN to be allocated and to be on IPMF1,
    559  *   find a 'cascaded_context_id', on IPMF2, which is cascaded from 'main context_id'
    560  *   and which is higher, in number, than specified input 'cascaded_context_id'.
    561  *   If input 'cascaded_context_id' is DNX_FIELD_CONTEXT_ID_INVALID then look for
    562  *   the first occurrence.
    563  *   If no such 'cascaded_context_id' is found then the value of
    564  *   DNX_FIELD_CONTEXT_ID_INVALID is returned.
    565  * \param [in] unit              -
    566  *   Device id
    567  * \param [in] main_field_context_id  -
    568  *   Context id, assumed to be on IPMF1, to get the list of 'siblings' for (on
    569  *   IPMF2), one by one.
    570  * \param [in] include_main_field_context_id  -
    571  *   In the search, include 'main_field_context_id' itself if it is its own
    572  *   'sibling'.
    573  * \param [in,out] cascaded_field_context_id_p  -
    574  *   \b As \b input:
    575  *     This is a pointer to 'context_id':
    576  *     This is the context id to start searching at (look for higher numbers). If set
    577  *     to DNX_FIELD_CONTEXT_ID_INVALID then look for the first.
    578  *   \b As \b output:
    579  *     This procedure loads pointed memory by 'context_id':
    580  *     This is the 'next' context id. See description above. If no 'next' context id is
    581  *     found then a value of DNX_FIELD_CONTEXT_ID_INVALID is loaded.
    582  * \return
    583  *   \retval Zero - On success
    584  *   \retval Error - Identifier as per shr_error_e
    585  * \remark
    586  *   * None
    587  * \see
    588  *   * dnx_field_group_fems_context_attach()
    589  */
    590 shr_error_e dnx_field_context_next_cascaded_find(
    591     int unit,
    592     dnx_field_context_t main_field_context_id,
    593     unsigned int include_main_field_context_id,
    594     dnx_field_context_t * cascaded_field_context_id_p);
    595 
    596 /**
    597 * \brief
    598 *  Destoy created context
    599 * \param [in] unit              - Device id
    600 * \param [in] stage             - field stage
    601 * \param [in] field_context_id  - Context id to destroy
    602 * \return
    603 *   shr_error_e - Error Type
    604 * \remark
    605 *   * None
    606 * \see
    607 *   * None
    608 */
    609 shr_error_e dnx_field_context_destroy(
    610     int unit,
    611     dnx_field_stage_e stage,
    612     dnx_field_context_t field_context_id);
    613 
    614 /**
    615 * \brief
    616 *  Get all SW-state context info of a Field context
    617 * \param [in] unit       - Device ID
    618 * \param [in] stage      - field stage
    619 * \param [in] context_id - Field Context ID
    620 * \param [out] context_mode_p  - Field Context info
    621 * \return
    622 *   shr_error_e - Error Type
    623 * \remark
    624 *   * None
    625 * \see
    626 *   * None
    627 */
    628 shr_error_e dnx_field_context_mode_get(
    629     int unit,
    630     dnx_field_stage_e stage,
    631     dnx_field_context_t context_id,
    632     dnx_field_context_mode_t * context_mode_p);
    633 
    634 /**
    635 * \brief
    636 *  Init the struct of  Context compare pair info
    637 * \param [in] unit  - Device id
    638 * \param [in] pair_info_p  - context compare pair info struct (see field_context.h)
    639 * \return
    640 *   shr_error_e - Error Type
    641 * \remark
    642 *   * None
    643 * \see
    644 *   * None
    645 */
    646 shr_error_e dnx_field_context_compare_pair_info_t_init(
    647     int unit,
    648     dnx_field_key_compare_pair_info_t * pair_info_p);
    649 
    650 /**
    651 * \brief
    652 *  Init the struct of  Context Hash info
    653 * \param [in] unit  - Device id
    654 * \param [in] hash_info_p  - context Hash info struct (see field_context.h)
    655 * \return
    656 *   shr_error_e - Error Type
    657 * \remark
    658 *   * None
    659 * \see
    660 *   * None
    661 */
    662 shr_error_e dnx_field_context_hash_info_t_init(
    663     int unit,
    664     dnx_field_context_hash_info_t * hash_info_p);
    665 
    666 /**
    667 * \brief
    668 *  Configure HASH key which is used to create CRC
    669 * \param [in] unit       - Device ID
    670 * \param [in] flags      - flags (can be UPDATE)
    671 * \param [in] stage      - Field Stage. Only iPMF1 can use this function.
    672 * \param [in] context_id - Field Context ID
    673 * \param [in] hash_info_p  - structure for hash key info (see filed_context.h)
    674 * \return
    675 *   shr_error_e - Error Type
    676 * \remark
    677 *   * Can be used only for context of iPMF1 stage. Sum of qualifiers bits in hash key must be up to 320 bits.
    678 * \see
    679 *   * None
    680 */
    681 shr_error_e dnx_field_context_hash_create(
    682     int unit,
    683     dnx_field_context_hash_flags_e flags,
    684     dnx_field_stage_e stage,
    685     dnx_field_context_t context_id,
    686     dnx_field_context_hash_info_t * hash_info_p);
    687 
    688 /**
    689 * \brief
    690 *  Get HASH key information which is used to create CRC
    691 * \param [in] unit       - Device ID
    692 * \param [in] stage      - Field Stage. Only iPMF1 can use this function.
    693 * \param [in] context_id - Field Context ID
    694 * \param [in] hash_info_p  - structure for hash key info (see filed_context.h)
    695 * \return
    696 *   shr_error_e - Error Type
    697 * \remark
    698 *   * Can be used only for context of iPMF1 stage. Sum of qualifiers bits in hash key must be up to 320 bits.
    699 *   * If the hash_info_p->hash_config.action_key is specified, the information regarding this action_key
    700 *   * will be stored in hash_config, otherwise, the first action key will be stored.
    701 *   * The information of the rest lb-keys will be stored in additional_hash_config.
    702 * \see
    703 *   * None
    704 */
    705 shr_error_e dnx_field_context_hash_info_get(
    706     int unit,
    707     dnx_field_stage_e stage,
    708     dnx_field_context_t context_id,
    709     dnx_field_context_hash_info_t * hash_info_p);
    710 
    711 shr_error_e dnx_field_context_state_table_attach(
    712     int unit,
    713     dnx_field_stage_e stage,
    714     dnx_field_context_t context_id);
    715 
    716 shr_error_e dnx_field_context_state_table_detach(
    717     int unit,
    718     dnx_field_stage_e stage,
    719     dnx_field_context_t context_id);
    720 
    721 /**
    722 * \brief
    723 *  destroy HASH key which is used to create CRC, deallocate all resources allocated by dnx_field_context_hash_set.
    724 * \param [in] unit       - Device ID
    725 * \param [in] flags      - flags (future use)
    726 * \param [in] stage      - Field Stage. Only iPMF1 can use this function.
    727 * \param [in] context_id - Field Context ID
    728 * \return
    729 *   shr_error_e - Error Type
    730 * \remark
    731 *   * Can be used only for context of iPMF1 stage.
    732 * \see
    733 *   * None
    734 */
    735 shr_error_e dnx_field_context_hash_destroy(
    736     int unit,
    737     dnx_field_context_hash_flags_e flags,
    738     dnx_field_stage_e stage,
    739     dnx_field_context_t context_id);
    740 
    741 /**
    742 * \brief
    743 *  Creates the compare keys for the given context.
    744 *  There are two pairs of comparison keys in which the user can allocate one of these pairs or both according to his
    745 *  needs, but user needs to make sure beforehand to set the context mode accordingly for keys comparison usage.
    746 *  Context Mode is configured in dnx_field_context_create().
    747 *  This function can be called separately for each pair.
    748 *
    749 * \param [in] unit          - Device ID
    750 * \param [in] flags         - flags (future use)
    751 * \param [in] stage         - Field Stage. Only iPMF1 can use this function.
    752 * \param [in] context_id    - Field Context ID to set the compare-keys for.
    753 * \param [in] pair_id       - Identifier of the pair ID(Can be either 1 or 2, see dnx_field_context_compare_pair_e).
    754 * \param [in] cmp_pair_p    - The pair of keys information. Each key information is composed of
    755 *                             DNX quals(types/info).
    756 */
    757 shr_error_e dnx_field_context_compare_create(
    758     int unit,
    759     dnx_field_context_compare_flags_e flags,
    760     dnx_field_stage_e stage,
    761     dnx_field_context_t context_id,
    762     dnx_field_context_compare_pair_e pair_id,
    763     dnx_field_key_compare_pair_info_t * cmp_pair_p);
    764 
    765 /**
    766 * \brief
    767 *  Retrieves information about the compare keys for the given context.
    768 *  There are two pairs of comparison keys for which information can be retrieve.
    769 *  This function can be called separately for each pair.
    770 *
    771 * \param [in] unit          - Device ID
    772 * \param [in] stage         - Field Stage. Only iPMF1 can use this function.
    773 * \param [in] context_id    - Field Context ID to get the compare-keys for.
    774 * \param [in] pair_id       - Identifier of the pair ID(Can be either 1 or 2, see dnx_field_context_compare_pair_e).
    775 * \param [in] cmp_pair_p    - The pair of keys information. Each key information is composed of
    776 *                             DNX quals(types/info).
    777 */
    778 shr_error_e dnx_field_context_compare_info_get(
    779     int unit,
    780     dnx_field_stage_e stage,
    781     dnx_field_context_t context_id,
    782     dnx_field_context_compare_pair_e pair_id,
    783     dnx_field_key_compare_pair_info_t * cmp_pair_p);
    784 
    785 /**
    786 * \brief
    787 *  Destroys the compare keys in the given context, for both pairs.
    788 *
    789 * \param [in] unit          - Device ID
    790 * \param [in] flags         - TBD
    791 * \param [in] stage         - Field Stage. Only iPMF1 can use this function.
    792 * \param [in] context_id    - Field Context ID
    793 * \param [in] pair_id       - The pair ID
    794 */
    795 shr_error_e dnx_field_context_compare_destroy(
    796     int unit,
    797     uint32 flags,
    798     dnx_field_stage_e stage,
    799     dnx_field_context_t context_id,
    800     dnx_field_context_compare_pair_e pair_id);
    801 
    802 /**
    803 * \brief
    804 *  Retrieve a context ID from a name.
    805 *
    806 * \param [in] unit          - Device ID
    807 * \param [in] stage         - Field Stage.
    808 * \param [in] name          - Name of the context. Number of elements DBAL_MAX_STRING_LENGTH.
    809 * \param [out] context_id_p - Field Context ID. DNX_FIELD_CONTEXT_ID_INVALID if not found.
    810 */
    811 shr_error_e dnx_field_context_name_to_context(
    812     int unit,
    813     dnx_field_stage_e stage,
    814     char name[DBAL_MAX_STRING_LENGTH],
    815     dnx_field_context_t * context_id_p);
    816 
    817 /**
    818 * \brief
    819 *  Retrieve an Apptype ID from a name.
    820 *
    821 * \param [in] unit          - Device ID
    822 * \param [in] name          - Name of the Apptype. Number of elements DBAL_MAX_STRING_LENGTH.
    823 * \param [out] apptype_p    - Apptype ID. DNX_FIELD_APPTYPE_INVALID if not found.
    824 */
    825 shr_error_e dnx_field_context_name_to_apptype(
    826     int unit,
    827     char name[DBAL_MAX_STRING_LENGTH],
    828     bcm_field_AppType_t * apptype_p);
    829 
    830 /**
    831 * \brief
    832 *  Init context profile mapping based on ACL context coming from FWD.
    833 * \param [in] unit  - Device ID
    834 * \return
    835 *   shr_error_e - Error Type
    836 * \remark
    837 *   * None
    838 * \see
    839 *   * None
    840 */
    841 shr_error_e dnx_field_context_profile_map_kbp_context_init(
    842     int unit);
    843 
    844 /**
    845 * \brief
    846 *  run init for Context module, such as default context creation.
    847 * \param [in] unit       - Device ID
    848 * \return
    849 *   shr_error_e - Error Type
    850 * \remark
    851 *   * None
    852 * \see
    853 *   * None
    854 */
    855 shr_error_e dnx_field_context_init(
    856     int unit);
    857 
    858 /**
    859 * \brief
    860 *  run deinit for Context module.
    861 * \param [in] unit       - Device ID
    862 * \return
    863 *   shr_error_e - Error Type
    864 * \remark
    865 *   * None
    866 * \see
    867 *   * None
    868 */
    869 shr_error_e dnx_field_context_deinit(
    870     int unit);
    871 
    872 /**
    873  * \brief
    874  *  This function initiates the ACL resources.
    875  *
    876  * \param [in] unit        - Device Id
    877  *
    878  * \return
    879  *   shr_error_e - Error Type
    880  * \remark
    881  *   * This function is called from the dnx_general_pp_init() because we need
    882  *   the PEMLA to finish it's initializations for the key/ffc resource recognition.
    883  *   EMLA finishes it's initialization after Field module, thus we call the acl_init from
    884  *   dnx_general_pp_init().
    885  * \see
    886  *   * None
    887  */
    888 shr_error_e dnx_field_context_ifwd2_kbp_acl_init(
    889     int unit);
    890 
    891 /**
    892 * \brief
    893 *  Trigger the NEVER_ADD_LEARN_EXT in the default system header profile
    894 *  in case enable = TRUE , NEVER_ADD_LEARN_EXT=1
    895 * \param [in] unit  - Device id
    896 * \param [in] enable  - enable = TRUE , NEVER_ADD_LEARN_EXT=1
    897 * \return
    898 *   shr_error_e - Error Type
    899 * \remark
    900 *   * None
    901 * \see
    902 *   * None
    903 */
    904 shr_error_e dnx_field_context_default_sys_header_learn_ext(
    905     int unit,
    906     uint32 enable);
    907 
    908 /**
    909 * \brief
    910 *  Deallocate the Context ID for Field module per Stage
    911 * \param [in] unit        - Device id
    912 * \param [in] stage        - Field Stage the context is in
    913 * \param [in] context_id  - Context id to check
    914 * \param [out] is_allocated_p  - TRUE if context was allocated, false otherwise
    915 * \return
    916 *   shr_error_e - Error Type
    917 * \remark
    918 *   * None
    919 * \see
    920 *   * None
    921 */
    922 shr_error_e dnx_field_context_id_is_allocated(
    923     int unit,
    924     dnx_field_stage_e stage,
    925     dnx_field_context_t context_id,
    926     uint8 *is_allocated_p);
    927 
    928 /**
    929 * \brief
    930 *  Init ACL CPU trap code profile table.
    931 * \param [in] unit  - Device ID
    932 * \param [in] trap_type  - The ingress trap code.
    933 * \param [in] trap_profile  - Trap profile value to be set.
    934 * \return
    935 *   shr_error_e - Error Type
    936 * \remark
    937 *   * None
    938 * \see
    939 *   * None
    940 */
    941 shr_error_e dnx_field_context_acl_cpu_trap_code_profile_update(
    942     int unit,
    943     int trap_type,
    944     uint32 trap_profile);
    945 
    946 /**
    947 * \brief
    948 *  Get ACL CPU trap code profile of the given trap_type.
    949 * \param [in] unit  - Device ID
    950 * \param [in] trap_type  - The ingress trap code.
    951 * \param [out] trap_profile_p  - Returned trap profile.
    952 * \return
    953 *   shr_error_e - Error Type
    954 * \remark
    955 *   * None
    956 * \see
    957 *   * None
    958 */
    959 shr_error_e dnx_field_context_acl_cpu_trap_code_profile_get(
    960     int unit,
    961     int trap_type,
    962     uint32 *trap_profile_p);
    963 #endif /* DNX_FIELD_CONTEXT_H_INCLUDED */