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


      1 /**
      2  * \file bcm_int/dnx/field/field_group.h
      3  *
      4  *
      5  * Field Processor definitions for database for DNX
      6  *
      7  * Purpose:
      8  *     'Field Processor' (FP) definitions for Field Group functions for other field modules for Packet Processor.
      9  *     Devices starting at DNX
     10  */
     11 /*
     12  * 
     13  * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file.
     14  * 
     15  * Copyright 2007-2020 Broadcom Inc. All rights reserved.
     16  */
     17 
     18 #ifndef FIELD_FIELD_GROUP_H_INCLUDED
     19 /* { */
     20 #define FIELD_FIELD_GROUP_H_INCLUDED
     21 
     22 #ifndef BCM_DNX_SUPPORT
     23 #error "This file is for use by DNX (JR2) family only!"
     24 #endif
     25 /*
     26  * Include files
     27  * {
     28  */
     29 #include <include/bcm_int/dnx/field/tcam/tcam_handler.h>
     30 #include <include/bcm_int/dnx/field/field.h>
     31 #include <include/bcm_int/dnx/field/field_key.h>
     32 #include <include/soc/dnx/swstate/auto_generated/types/dnx_field_actions_types.h>
     33 #include <include/soc/dnx/swstate/auto_generated/types/dnx_field_key_types.h>
     34 #include <include/soc/dnx/swstate/auto_generated/types/dnx_field_group_types.h>
     35 /*
     36  * field_actions.h is required for 'dnx_field_actions_fes_get_info_t' (definitions
     37  * related to 'get' procedures).
     38  */
     39 #include <include/bcm_int/dnx/field/field_actions.h>
     40 /*
     41  * }
     42  */
     43 /*
     44  * Defines
     45  * {
     46  */
     47 /*
     48  * }
     49  */
     50 /*
     51  * Typedefs
     52  * {
     53  */
     54 
     55 /**
     56  * TCAM information for pre-allocating TCAM banks.
     57  * (Used only for TCAM FGs).
     58  */
     59 typedef struct
     60 {
     61     /**
     62      * The list of TCAM bank IDs to reserve for the field group to be created.
     63      * This list is only valid for TCAM field groups.
     64      */
     65     int tcam_bank_ids[DNX_DATA_MAX_FIELD_TCAM_NOF_BANKS];
     66     /**
     67      * Number of TCAM banks to reserve for the given field group.
     68      */
     69     int nof_tcam_banks;
     70     /**
     71      * Specifies TCAM bank allocation mode, see Enum definition for more info.
     72      */
     73     dnx_field_tcam_bank_allocation_mode_e bank_allocation_mode;
     74 } dnx_field_group_tcam_info_t;
     75 
     76 /**
     77  * KBP information for adding properties to KBP.
     78  */
     79 typedef struct
     80 {
     81     /** True when min_capacity has a meaningful info, otherwise default values are set. */
     82     uint8 min_capacity_valid;
     83     /*
     84      * Set the minimum capacity reserved in EXTERNAL TCAM. Used if capacity_valid is true.
     85      */
     86     uint32 min_capacity;
     87     /*
     88      * Whether to set the property ALGORITHMIC for algorithmic mode
     89      */
     90     uint8 algorithmic_mode_valid;
     91     /*
     92      * Set the algorithmic mode (algorithmic property) to this value. Used if algorithmic_mode_valid is true.
     93      */
     94     uint32 algorithmic_mode;
     95 } dnx_field_group_add_kbp_info_t;
     96 
     97 /**
     98  * Struct contains the information about the Field group that would appear in SW state.
     99  * This structure exist here to allow functions to be used jointly without worrying about different sizes of arrays.
    100  * See dnx_field_group_fg_sw_info_t.
    101  */
    102 typedef struct
    103 {
    104     /**
    105      * The Field stage in which the field group exists.
    106      */
    107     dnx_field_stage_e field_stage;
    108     /**
    109      * The Field group type (TCAM, Direct Extraction, EXEM...)
    110      */
    111     dnx_field_group_type_e fg_type;
    112     /**
    113      * Field group name.
    114      */
    115     field_group_name_t group_name;
    116     /**
    117      * The list of contexts attached to the field group.
    118      */
    119     dnx_field_attach_context_info_t context_info[DNX_DATA_MAX_FIELD_COMMON_MAX_VAL_NOF_CONTEXTS];
    120     /**
    121      * Mapping of the qualifier inside the key
    122      */
    123     dnx_field_key_template_t key_template;
    124     /**
    125      * This enum indicate the size of the Key, some Field Groups use only part of the key
    126      */
    127     dnx_field_key_length_type_e key_length_type;
    128     /**
    129      * This enum indicate the size of the payload block used.
    130      * For example a TCAM field group can use 32, 64 or 128 bit payloads.
    131      * Not used by HASH or direct extraction field groups.
    132      */
    133     dnx_field_action_length_type_e action_length_type;
    134     /**
    135      * Hold the information regarding the configured actions for Field Group.
    136      * This field is different from SW state, with different array sizes.
    137      */
    138     dnx_field_actions_fg_payload_info_t actions_payload_info;
    139     /**
    140      * Holds the ID of DBAL table that was created for the field group.
    141      */
    142     dbal_tables_e dbal_table_id;
    143     /**
    144      * Flags with which Field Group was created, needed for Get functionality (dnx_field_group_get).
    145      */
    146     dnx_field_group_add_flags_e flags;
    147     /**
    148      * TCAM info for pre-allocating banks.
    149      */
    150     dnx_field_group_tcam_info_t tcam_info;
    151 } dnx_field_group_fg_info_for_sw_t;
    152 
    153 /**
    154  * Struct contains the information about the ACE format that would appear in SW state.
    155  * This structure exist here to allow functions to be used jointly without worrying about different sizes of arrays.
    156  * See dnx_field_ace_format_sw_info_t.
    157  */
    158 typedef struct
    159 {
    160     /**
    161      * Hold the information regarding the configured actions for ACE Format.
    162      * This field is different from SW state, with different array sizes.
    163      */
    164     dnx_field_actions_ace_payload_info_t actions_payload_info;
    165     /**
    166      * Flags with which ACE format was created, needed for Get functionality (dnx_field_ace_format_get).
    167      */
    168     dnx_field_ace_format_add_flags_e flags;
    169     /**
    170      * Name of the ACE Format.
    171      */
    172     char name[DBAL_MAX_STRING_LENGTH];
    173 } dnx_field_ace_format_info_for_sw_t;
    174 
    175 /**
    176  * This structure holds the basic parameters for dnx_field_group_add() function
    177  * This is not part of field SW state
    178  * See dnx_field_group_get().
    179  */
    180 typedef struct
    181 {
    182     /** Field stage, for which stage the Database was created*/
    183     dnx_field_stage_e field_stage;
    184     /**
    185      *  Database type: The database may be:TCAM, Direct Table,
    186      *  or Direct Extraction.
    187      */
    188     dnx_field_group_type_e fg_type;
    189 
    190     /**
    191      * DNX level qualifier look at dnx_field_qual_t for more info
    192      * Number of meaningful elements on this array: All elements until
    193      * DNX_FIELD_QUAL_TYPE_INVALID is encountered.
    194      */
    195     dnx_field_qual_t dnx_quals[DNX_DATA_MAX_FIELD_GROUP_NOF_QUALS_PER_FG];
    196     /**
    197      * For each qualifier in dnx_quals, we have an indication whether or not the qualifier expects to receive ranges.
    198      * Only external (KBP) field groups support ranged qualifiers.
    199      */
    200     uint8 qual_is_ranged[DNX_DATA_MAX_FIELD_GROUP_NOF_QUALS_PER_FG];
    201     /**
    202      * DNX Actions applied by the database.
    203      * Can hold any of the dnx action depending on class and stage:
    204      * See List of available ones in field_map_data.c
    205      * Number of meaningful elements on this array: All elements until
    206      * DNX_FIELD_ACTION_INVALID is encountered.
    207      */
    208     dnx_field_action_t dnx_actions[DNX_DATA_MAX_FIELD_COMMON_MAX_VAL_NOF_ACTION_PER_GROUP];
    209 
    210     /**
    211      * For each action in dnx_actions, we have an indication whether or not the action uses a valid bit or not.
    212      */
    213     uint8 use_valid_bit[DNX_DATA_MAX_FIELD_COMMON_MAX_VAL_NOF_ACTION_PER_GROUP];
    214 
    215      /**
    216       * This struct holds all advanced parameters for TCAM field group.
    217       * For further information see struct definition.
    218       */
    219     dnx_field_group_tcam_info_t tcam_info;
    220     /**
    221       * This struct holds all advanced parameters for KBP (external TCAM) field group.
    222       * Specifically, it indicated properties to be set and minimum capacity.
    223       */
    224     dnx_field_group_add_kbp_info_t kbp_info;
    225     /**
    226      * Name of the field group.
    227      */
    228     char name[DBAL_MAX_STRING_LENGTH];
    229 } dnx_field_group_info_t;
    230 
    231 /**
    232  * This structure holds the basic parameters for dnx_field_ace_format_add() function
    233  * This is not part of field SW state
    234  * See dnx_field_ace_format_get().
    235  */
    236 typedef struct
    237 {
    238     /**
    239      * DNX Actions applied by the ACE format.
    240      * Can hold any of the dnx action depending on class and stage:
    241      * See List of available ones in field_map_data.c
    242      * Number of meaningful elements on this array: All elements until
    243      * DNX_FIELD_ACTION_INVALID is encountered.
    244      */
    245     dnx_field_action_t dnx_actions[DNX_DATA_MAX_FIELD_COMMON_MAX_VAL_NOF_ACTION_PER_GROUP];
    246 
    247     /**
    248      * For each action in dnx_actions, we have an indication whether or not the action uses a valid bit or not.
    249      */
    250     uint8 use_valid_bit[DNX_DATA_MAX_FIELD_COMMON_MAX_VAL_NOF_ACTION_PER_GROUP];
    251 
    252     /**
    253      * Name of the ACE Format.
    254      */
    255     char name[DBAL_MAX_STRING_LENGTH];
    256 } dnx_field_ace_format_info_t;
    257 
    258 /**
    259  * This structure holds the full detailed parameters for dnx_field_group_add function
    260  * This is not part of field SW state
    261  * Note that there is some redundancy since 'dnx_field_group_basic_info_t' contains info
    262  * which may be extracted from 'dnx_field_group_fg_info_for_sw_t'
    263  * See dnx_field_group_get().
    264  * See dnx_field_group_add().
    265  */
    266 typedef struct
    267 {
    268     /**
    269      * Basic info containing information related to dnx_field_group_add()
    270      */
    271     dnx_field_group_info_t group_basic_info;
    272     /**
    273      * Detailed info containing information related to dnx_field_group_add().
    274      * This is the sw-state database of field group.
    275      */
    276     dnx_field_group_fg_info_for_sw_t group_full_info;
    277     /**
    278      * Identifier of the field group on TCAM driver.
    279      * Get 'tcam_handler_id' using dbal_tables_tcam_handler_id_get() with
    280      * 'dbal_table_id' as input. 'dbal_table_id' is an element on the sw state
    281      * in 'dnx_field_group_fg_info_for_sw_t'.
    282      */
    283     uint32 tcam_handler_id;
    284     /**
    285      * The HW identifier of the logical database.
    286      * In tcam, it is the access_profile_id:
    287      *    The index, in the access profile memory, corresponding to 'tcam_handler_id'
    288      *    Get access_profile_id using dnx_field_tcam_handler_access_profile_id_get()
    289      *    with 'tcam_handler_id' as input.
    290      * In MDB databases (such as EXEM), it is the APP_DB_ID of the database in MDB.
    291      */
    292     dnx_field_app_db_id_t app_db_id;
    293 } dnx_field_group_full_info_t;
    294 
    295 /**
    296  * This structure holds the full detailed parameters for dnx_field_ace_format_add function
    297  * This is not part of field SW state
    298  * Note that there is some redundancy since 'ace_format_basic_info_t' contains info
    299  * which may be extracted from 'dnx_field_ace_format_info_for_sw_t'.
    300  * See dnx_field_ace_format_get().
    301  * See dnx_field_ace_format_add().
    302  * See dnx_field_group_full_info_t.
    303  * See dnx_field_group_context_full_info_t.
    304  */
    305 typedef struct
    306 {
    307     /**
    308      * Basic info containing information related to dnx_field_ace_format_add()
    309      */
    310     dnx_field_ace_format_info_t format_basic_info;
    311     /**
    312      * Detailed info containing information related to dnx_field_ace_format_add().
    313      * This is the sw-state database of ACE format.
    314      */
    315     dnx_field_ace_format_info_for_sw_t format_full_info;
    316     /**
    317      * Information about the FES instructions used by the ACE ID.
    318      */
    319     dnx_field_actions_fes_ace_get_info_t actions_fes_info;
    320 } dnx_field_ace_format_full_info_t;
    321 
    322 /**
    323  * This structure holds the limited detailed parameters for  for API's:
    324  * See dnx_field_group_context_attach().
    325  * See dnx_field_group_context_get().
    326  */
    327 typedef struct
    328 {
    329     /**
    330      * The qualifier order, type and number must be the same as was passed to dnx_field_group_add API
    331      * Number of meaningful elements on this array: All elements until
    332      * DNX_FIELD_QUAL_TYPE_INVALID is encountered.
    333      */
    334     dnx_field_qual_t dnx_quals[DNX_DATA_MAX_FIELD_GROUP_NOF_QUALS_PER_FG];
    335     /**
    336      * Indicate how to read the relevant qualifier from PBUS
    337      * The information is aligned to the qualifier types array above
    338      * Number of elements set by qual_types array
    339      */
    340     dnx_field_qual_attach_info_t qual_info[DNX_DATA_MAX_FIELD_GROUP_NOF_QUALS_PER_FG];
    341     /**
    342      * DNX Actions applied by this context.
    343      * Can hold any of the dnx action depending on class and stage:
    344      * See List of available ones in field_map_data.c
    345      * Number of meaningful elements on this array: All elements until
    346      * DNX_FIELD_ACTION_INVALID is encountered.
    347      * The action order, type and number MUST be the same as was passed to dnx_field_group_add API
    348      */
    349     dnx_field_action_t dnx_actions[DNX_DATA_MAX_FIELD_COMMON_MAX_VAL_NOF_ACTION_PER_GROUP];
    350     /**
    351      * Include information on each action that was configured in attach API, such as action priority.
    352      * Number of valid elements is set as per 'dnx_actions' array
    353      */
    354     dnx_field_action_attach_info_t action_info[DNX_DATA_MAX_FIELD_COMMON_MAX_VAL_NOF_ACTION_PER_GROUP];
    355     /**
    356      * An array of FEMs that are added to the field group, but are not to be used by the context.
    357      */
    358     dnx_field_fem_id_t fems_invalidate[DNX_DATA_MAX_FIELD_COMMON_MAX_VAL_NOF_FEM_ID];
    359     /**
    360      * Compare attributes - in case the context has compare mode - which key/tcam result to compare
    361      * CMP1 : this FG will be compared against CMP1, internally SDK will try to allocate key B
    362      * CMP2 : this FG will be compared against CMP2, internally SDK will try to allocate key D*
    363      */
    364     dnx_field_group_compare_id_e compare_id;
    365     /**
    366      * Payload Offset - Relevant ONLY for the KBP FG
    367      * Payload Offset is the offset of the result of current FG inside the result buffer received from the KBP
    368      * The KBP result buffer is a concatenation of the result buffers of it's field groups and it's size is 240b.
    369      * This offset may vary for the same FG when it is attached to different contexts.
    370      */
    371     uint32 payload_offset;
    372     /**
    373      * Payload id - Relevant ONLY for the KBP FG
    374      * Payload id is the [0-7] id of the result of current FG inside the result buffer received from the KBP
    375      * The KBP result buffer is a concatenation of the result buffers of it's field groups and it's size is 240b.
    376      * The id represents the relevant hit-bit that indicates if the payload is valid.
    377      * This id may vary for the same FG when it is attached to different contexts.
    378      */
    379     uint32 payload_id;
    380 } dnx_field_group_attach_info_t;
    381 
    382 /**
    383  * Struct contains the origin in parameter for the dnx_field_group_context_attach() and addtional diteailed info
    384  * See dnx_field_group_context_get().
    385  * See dnx_field_group_context_attach().
    386  */
    387 typedef struct
    388 {
    389     /**
    390      * Basic info containing information related to dnx_field_context_attach()
    391      */
    392     dnx_field_group_attach_info_t attach_basic_info;
    393     /**
    394      * FFC detailed info that was supplied by key module
    395      * Holds FFC id allocated per qualifier and Key id allocated for the context
    396  */
    397     dnx_field_key_group_ffc_info_t group_ffc_info;
    398     /**
    399      * Field IO, indicator of where the output is written to.
    400      */
    401     dbal_enum_value_field_field_io_e field_io;
    402     /**
    403      * Attached key info
    404      */
    405     /**
    406      * Keys allocated for this context
    407      */
    408     dnx_field_key_id_t key_id;
    409     /**
    410      * Lenght-type of key which has been allocated by key module
    411      */
    412     dnx_field_key_length_type_e key_length_type;
    413     /**
    414      * Access parameter for KBR (See, for example, DBAL table KLEAP_IPMF1_KBR_INFO (IPPC_PMF_KBR_PASS_1/))
    415      * Used from TCAM/MDB/EXEM - To know how to perform HW lookup within the databases
    416      */
    417     int app_db_id;
    418     /**
    419      * Information about the FES quartets
    420      */
    421     dnx_field_actions_fes_context_group_get_info_t actions_fes_info;
    422 } dnx_field_group_context_full_info_t;
    423 
    424 /**
    425  * Struct contains the parameters of the EXEM PDB in use (LEXEM or SEXEM)
    426  * See dnx_field_group_exem_info().
    427  */
    428 typedef struct
    429 {
    430     /**
    431      * The maxcimum size of the key.
    432      */
    433     unsigned int max_key_size;
    434     /**
    435      * The maxcimum size of the payload.
    436      */
    437     unsigned int max_payload_size;
    438     /**
    439      * The number of bits in the APP_DB_ID.
    440      */
    441     unsigned int app_db_id_size;
    442     /**
    443      * The key length type that refers to the PDB.
    444      */
    445     dnx_field_key_length_type_e key_length_type;
    446     /**
    447      * The action length type that refers to the PDB.
    448      */
    449     dnx_field_action_length_type_e action_length_type;
    450     /**
    451      * The DB ID of the PDB.
    452      */
    453     dbal_physical_tables_e dbal_physical_table_id;
    454 
    455 } dnx_field_group_exem_info_t;
    456 
    457 /*
    458  * } Types
    459  */
    460 
    461 /**
    462  * \brief
    463  *   Convert IO enum values to text (for display purposes only)
    464  *   See 'dbal_enum_value_field_field_io_e'.
    465  * \param [in] field_io -
    466  *   IO identifier (from enum) to trabslate to text.
    467  * \return
    468  *   Null-terminated string describing input IO value.
    469  * \remark
    470  *   None
    471  * \see
    472  *   * dbal_enum_value_field_field_io_e
    473  */
    474 char *dnx_field_io_text(
    475     dbal_enum_value_field_field_io_e field_io);
    476 /**
    477 * \brief
    478 *  Clear the dnx_field_group_info_t, set it to preferred init values
    479 * \param [in] unit          - Device ID
    480 * \param [in] fg_info_in_p  - Pointer to input structure of dnx_field_group_info_t that needs to be init
    481 * \return
    482 *   shr_error_e - Error Type
    483 * \remark
    484 *   * None
    485 * \see
    486 *   * None
    487 */
    488 shr_error_e dnx_field_group_info_t_init(
    489     int unit,
    490     dnx_field_group_info_t * fg_info_in_p);
    491 
    492 /**
    493 * \brief
    494 *  Clear the dnx_field_ace_format_info_t, set it to preferred init values
    495 * \param [in] unit                 - Device ID
    496 * \param [in] ace_format_info_in_p  - Pointer to input structure of dnx_field_ace_format_info_t that needs to be init
    497 * \return
    498 *   shr_error_e - Error Type
    499 * \remark
    500 *   * None
    501 * \see
    502 *   * None
    503 */
    504 shr_error_e dnx_field_ace_format_info_t_init(
    505     int unit,
    506     dnx_field_ace_format_info_t * ace_format_info_in_p);
    507 
    508 /**
    509 * \brief
    510 *  Init Structure dnx_field_group_attach_info_t to invalid params
    511 * \param [in] unit           - Device Id
    512 * \param [in] attach_info_p  - Structure pointer to init
    513 * \return
    514 *   shr_error_e - Error Type
    515 * \remark
    516 *   * None
    517 * \see
    518 *   * None
    519 */
    520 shr_error_e dnx_field_group_attach_info_t_init(
    521     int unit,
    522     dnx_field_group_attach_info_t * attach_info_p);
    523 
    524 /**
    525  * \brief
    526  *  This function creates a field group, i.e. per set (qualifier,action).
    527  * \param [in] unit     - Device ID
    528  * \param [in] flags    - Flags of field group add API, look at dnx_field_group_add_flags_e
    529  * \param [in] fg_info_in_p  -pointer to database info that will be created
    530                                      look at dnx_field_group_info_t
    531  * \param [in,out] fg_id_p    - Field group ID,
    532             as in - in case flag WITH_ID is set, will hold the field group ID
    533             as out - in case flag WITH_ID is not set, will return the created field group ID
    534  * \return
    535  *   shr_error_e - Type of Error
    536  * \remark
    537  *   * If this procedure fails to allocate because of resource issues, an
    538  *     error, _SHR_E_RESOURCE, will be returned.
    539  * \see
    540  *   * None
    541  */
    542 shr_error_e dnx_field_group_add(
    543     int unit,
    544     dnx_field_group_add_flags_e flags,
    545     dnx_field_group_info_t * fg_info_in_p,
    546     dnx_field_group_t * fg_id_p);
    547 
    548 /**
    549 * \brief
    550 *  Init the Sw state of Field Group Database module
    551 * \param [in] unit  - Device id
    552 * \return
    553 *   shr_error_e - Error Type
    554 * \remark
    555 *   * None
    556 * \see
    557 *   * None
    558 */
    559 shr_error_e dnx_field_group_sw_state_init(
    560     int unit);
    561 
    562 /**
    563 * \brief
    564 *  De-Init the Sw state of Field Group Database module
    565 * Destroy all memory
    566 * \param [in] unit  - Device id
    567 * \return
    568 *   shr_error_e - Error Type
    569 * \remark
    570 *   * None
    571 * \see
    572 *   * None
    573 */
    574 shr_error_e dnx_field_group_sw_state_deinit(
    575     int unit);
    576 
    577 /**
    578  *  \brief
    579  *    Given HW identifier of data base, get an array of all context IDs which
    580  *    are on it.
    581  * \param [in] unit -
    582  *    Identifier of HW platform.
    583  * \param [in] fg_id -
    584  *    Field group id. Indicate field gourp id in DNX lavel that being configured.
    585  * \param [out] context_id -
    586  *     array of uint32 size of DNX_DATA_MAX_FIELD_COMMON_MAX_VAL_NOF_CONTEXTS
    587  *    This procedure loads pointed memory by all context IDs
    588  *    on specified data base ('db_id_ndx'). Number of elements on this array is
    589  *    is defined by last parameter DNX_FIELD_CONTEXT_ID_INVALID
    590  * \return
    591  *   \retval Zero - On success
    592  *   \retval Error - Identifier as per shr_error_e
    593  * \remark
    594  *    None
    595  * \see
    596  */
    597 shr_error_e dnx_field_group_context_id_arr_get(
    598     int unit,
    599     dnx_field_group_t fg_id,
    600     dnx_field_context_t context_id[DNX_DATA_MAX_FIELD_COMMON_MAX_VAL_NOF_CONTEXTS]);
    601 /**
    602  * \brief
    603  *   Given 'field group' and 'context id', get an indication on whether 'context id'
    604  *   is attached to that 'field group'.
    605  * \param [in] unit -
    606  *   Identifier of HW platform.
    607  * \param [in] fg_id -
    608  *   Field Group id to search list of contexts of
    609  * \param [in] context_id -
    610  *   Identifier of context to search for within the list of contexts attached to
    611  *   this field group.
    612  * \param [out] found_p -
    613  *   Pointer to unsigned int. This procedure loads pointed memory by a non-zero value
    614  *   if context is attached to this field group (fg_id). Otherwise, zero is loaded.
    615  * \return
    616  *   \retval Zero - On success
    617  *   \retval Error - Identifier as per shr_error_e
    618  * \remark
    619  *    None
    620  * \see
    621  *   * dnx_field_group_context_id_arr_get()
    622  */
    623 shr_error_e dnx_field_group_is_context_id_on_arr(
    624     int unit,
    625     dnx_field_group_t fg_id,
    626     dnx_field_context_t context_id,
    627     unsigned int *found_p);
    628 /**
    629  *  \brief
    630  *    Given qualifier ID, get info about it within specified data base:
    631  *    Bit location, within 'key template', where it resides, width (bits).
    632  *    Note that this is not the offset on the actual key since allocation
    633  *    on key depends on algorithm. For example, if allocation is in 80 bits
    634  *    resolution then offset '0' on 'key template' may be offset '80' on
    635  *    key.
    636  * \param [in] unit -
    637  *    Identifier of HW platform.
    638  * \param [in] fg_id -
    639  *    Field group id. Indicate field gourp id in DNX level that being configured.
    640  * \param [in] qualifier -
    641  *    Variable of type dnx_field_qual_t. Identifier of the qualifier to search
    642  *    for within specified data base.
    643  * \param [out] qualifier_bit_lsb_location_p -
    644  *    Pointer to uint. This procedure loads pointed memory by the bit location (starting
    645  *    from the LSB, which is marked as 0) within the carrying 'key template'.
    646  *    Expected range is 0 - 159
    647  * \param [out] qualifier_bit_width_p -
    648  *    Pointer to uint. This procedure loads pointed memory by the number of bits which this
    649  *    qualifier occupies on specified key template.
    650  * \return
    651  *   \retval Zero - On success
    652  *   \retval Error - Identifier as per shr_error_e
    653  * \remark
    654  *    None
    655  * \see
    656  *   * None
    657  */
    658 shr_error_e dnx_field_group_qualifier_info_get(
    659     int unit,
    660     dnx_field_group_t fg_id,
    661     dnx_field_qual_t qualifier,
    662     unsigned int *qualifier_bit_lsb_location_p,
    663     unsigned int *qualifier_bit_width_p);
    664 
    665 /**
    666 * \brief
    667 *  Get context ID info from SW state of Field group
    668 * \param [in] unit            - Device ID
    669 * \param [in] fg_id           - Field group id that context ID being attached to
    670 * \param [in] context_id      - Context ID
    671 * \param [out] context_info_p - Pointer type of dnx_field_attach_context_info_t that hold the context ID info
    672 * \return
    673 *   shr_error_e - Error Type
    674 * \remark
    675 *   * None
    676 * \see
    677 *   * None
    678 */
    679 shr_error_e dnx_field_group_context_info_get(
    680     int unit,
    681     dnx_field_group_t fg_id,
    682     dnx_field_context_t context_id,
    683     dnx_field_attach_context_info_t * context_info_p);
    684 
    685 /**
    686  * \brief
    687  *  Returns the configured key per Field database
    688  * \param [in] unit       - Device Id
    689  * \param [in] fg_id      - Database ID
    690  * \param [in] context_id - Each context ID has its own Key id that allocated for Field Group Database
    691  * \param [in] key_id_p   - Structure that holds an array of key IDs.
    692  * \return
    693  *   shr_error_e - Error Type
    694  * \remark
    695  *   * None
    696  * \see
    697  *   * None
    698  */
    699 shr_error_e dnx_field_group_context_key_id_get(
    700     int unit,
    701     dnx_field_group_t fg_id,
    702     dnx_field_context_t context_id,
    703     dnx_field_key_id_t *key_id_p);
    704 
    705 /**
    706  * \brief
    707  *  Retruns the position of a direct extraction field group attached to a context.
    708  * \param [in] unit        - Device Id
    709  * \param [in] fg_id       - Database ID
    710  * \param [in] context_id  - Each context ID has its own Key id that allocated for Field Group Database
    711  * \param [in] group_lsb_p - The LSB of the group within the key that it is in.
    712  * \return
    713  *   shr_error_e - Error Type
    714  * \remark
    715  *   * None
    716  * \see
    717  *   * None
    718  */
    719 shr_error_e dnx_field_group_context_de_position_get(
    720     int unit,
    721     dnx_field_group_t fg_id,
    722     dnx_field_context_t context_id,
    723     int *group_lsb_p);
    724 
    725 /**
    726  * \brief
    727  *  Returns the key attach info for a field group
    728  * \param [in] unit       - Device Id
    729  * \param [in] fg_id      - Database ID
    730  * \param [in] context_id - Each context ID has different attach info for the same field group
    731  * \param [out] qual_info - Array of size DNX_DATA_MAX_FIELD_GROUP_NOF_QUALS_PER_FG.
    732  *                          Filled with the attach info for each qualifier.
    733  * \return
    734  *   shr_error_e - Error Type
    735  * \remark
    736  *   * None
    737  * \see
    738  *   * None
    739  */
    740 shr_error_e dnx_field_group_context_qualifier_attach_info_get(
    741     int unit,
    742     dnx_field_group_t fg_id,
    743     dnx_field_context_t context_id,
    744     dnx_field_qual_attach_info_t qual_info[DNX_DATA_MAX_FIELD_GROUP_NOF_QUALS_PER_FG]);
    745 
    746 /**
    747 * \brief
    748 * Return the DBAL table that was created for Field Group
    749 * DBAL Table is not created for FG type of Direct Extract
    750 * \param [in] unit             - Device ID
    751 * \param [in] fg_id            - Field Group ID
    752 * \param [out] dbal_table_id_p  - DBAL table id
    753 * \return
    754 *   shr_error_e - Error Type
    755 * \remark
    756 *   * None
    757 * \see
    758 *   * None
    759 */
    760 shr_error_e dnx_field_group_dbal_table_id_get(
    761     int unit,
    762     dnx_field_group_t fg_id,
    763     dbal_tables_e * dbal_table_id_p);
    764 
    765 /**
    766 * \brief
    767 * Return result_type_index, the DBAL ID that was created for ACE format.
    768 * \param [in] unit                  - Device ID
    769 * \param [in] ace_id                - ACE ID
    770 * \param [out] result_type_index_p  - The DBAL ID of the ACE format.
    771 * \return
    772 *   shr_error_e - Error Type
    773 * \remark
    774 *   * None
    775 * \see
    776 *   * dnx_field_group_dbal_table_id_get
    777 */
    778 shr_error_e dnx_field_ace_format_result_type_index_get(
    779     int unit,
    780     dnx_field_ace_id_t ace_id,
    781     int *result_type_index_p);
    782 
    783 /**
    784 * \brief
    785 * Return The ACE_ID associated with result_type_index, the DBAL ID that was created for ACE format.
    786 * \param [in] unit                  - Device ID.
    787 * \param [in] result_type_index     - The DBAL ID of the ACE format.
    788 * \param [out] ace_id_p             - ACE ID.
    789 * \return
    790 *   shr_error_e - Error Type
    791 * \remark
    792 *   * None
    793 * \see
    794 *   * dnx_field_ace_format_result_type_index_get
    795 */
    796 shr_error_e dnx_field_ace_format_result_type_index_to_ace_id(
    797     int unit,
    798     int result_type_index,
    799     dnx_field_ace_id_t * ace_id_p);
    800 
    801 /**
    802 * \brief
    803 *  Get Field Stage from certain Field group
    804 * \param [in] unit           - Device ID
    805 * \param [in] fg_id          - Field Group ID
    806 * \param [in] field_stage_p  - Field Group stage (look dnx_field_stage_e)
    807 * \return
    808 *   shr_error_e - Error Type
    809 * \remark
    810 *   * None
    811 * \see
    812 *   * None
    813 */
    814 shr_error_e dnx_field_group_field_stage_get(
    815     int unit,
    816     dnx_field_group_t fg_id,
    817     dnx_field_stage_e * field_stage_p);
    818 
    819 /**
    820 * \brief
    821 *  Get field group type of a group
    822 * \param [in] unit       - Device ID
    823 * \param [in] fg_id      - Field Group ID
    824 * \param [out] fg_type_p  - Field Group Type
    825 * \return
    826 *   shr_error_e - Error Type
    827 * \remark
    828 *   * None
    829 * \see
    830 *   * None
    831 */
    832 shr_error_e dnx_field_group_type_get(
    833     int unit,
    834     dnx_field_group_t fg_id,
    835     dnx_field_group_type_e * fg_type_p);
    836 
    837 /**
    838 * \brief
    839 *  Get field group type of a group
    840 * \param [in] unit                - Device ID
    841 * \param [in] fg_id               - Field Group ID
    842 * \param [out] key_length_type_p  - Enum indicating the size of the lookup key.
    843 *                                   Not necessariliy all of it is used, for example TCAM can have a key size of
    844 *                                   half key (80 bits), but only use 5 bits (and they would be aligned to the LSB).
    845 * \return
    846 *   shr_error_e - Error Type
    847 * \remark
    848 *   * None
    849 * \see
    850 *   * None
    851 */
    852 shr_error_e dnx_field_group_key_length_type_get(
    853     int unit,
    854     dnx_field_group_t fg_id,
    855     dnx_field_key_length_type_e * key_length_type_p);
    856 
    857 /**
    858 * \brief
    859 *  Get field group type of a group
    860 * \param [in] unit                   - Device ID
    861 * \param [in] fg_id                  - Field Group ID
    862 * \param [out] action_length_type_p  - Enum indicating the size of the lookup key.
    863 *                                      Not necessariliy all of it is used, for example TCAM can have a result size of
    864 *                                      half key (32 bits), but only use 5 bits (and they would be aligned to the MSB).
    865 * \return
    866 *   shr_error_e - Error Type
    867 * \remark
    868 *   * None
    869 * \see
    870 *   * None
    871 */
    872 shr_error_e dnx_field_group_action_length_type_get(
    873     int unit,
    874     dnx_field_group_t fg_id,
    875     dnx_field_action_length_type_e * action_length_type_p);
    876 
    877 /**
    878 * \brief
    879 *  Get action template
    880 * \param [in] unit                    - Device ID
    881 * \param [in] fg_id                   - Field Group
    882 * \param [out] actions_payload_info_p  - Action tempalte as was created in field group add
    883 * \return
    884 *   shr_error_e - Error Type
    885 * \remark
    886 *   * None
    887 * \see
    888 *   * None
    889 */
    890 shr_error_e dnx_field_group_action_template_get(
    891     int unit,
    892     dnx_field_group_t fg_id,
    893     dnx_field_actions_fg_payload_info_t * actions_payload_info_p);
    894 
    895 /**
    896 * \brief
    897 *  Get action template
    898 * \param [in] unit           - Device ID.
    899 * \param [in] fg_id          - Field Group.
    900 * \param [out] nof_actions_p - Number of actions in the field group's template.
    901 * \return
    902 *   shr_error_e - Error Type
    903 * \remark
    904 *   * None
    905 * \see
    906 *   * None
    907 */
    908 shr_error_e dnx_field_group_action_nof_get(
    909     int unit,
    910     dnx_field_group_t fg_id,
    911     unsigned int *nof_actions_p);
    912 
    913 /**
    914 * \brief
    915 *  This function provides the VMV size of a specific physical DB.
    916 * \param [in] unit                 - Device ID
    917 * \param [in] dbal_physical_table  - The EXEM physical table
    918 * \param [out] vmv_size_p          - The size of the VMV
    919 * \return
    920 *   shr_error_e - Error Type
    921 * \remark
    922 *   * None
    923 * \see
    924 *   * None
    925 */
    926 shr_error_e dnx_field_group_physical_db_vmv_size_get(
    927     int unit,
    928     dbal_physical_tables_e dbal_physical_table,
    929     uint8 *vmv_size_p);
    930 
    931 /**
    932 * \brief
    933 *  Get the starting position of the payload buffer on the field group in the HW, relative to the action buffer.
    934 * \param [in] unit                    - Device ID
    935 * \param [in] fg_id                   - Field Group
    936 * \param [out] buffer_shift_p         - Action tempalte as was created in field group add, adjusted by
    937 * \return
    938 *   shr_error_e - Error Type
    939 * \remark
    940 *   * None
    941 * \see
    942 *   * dnx_field_group_action_template_get
    943 */
    944 shr_error_e dnx_field_group_action_buffer_shift_get(
    945     int unit,
    946     dnx_field_group_t fg_id,
    947     int *buffer_shift_p);
    948 
    949 /**
    950 * \brief
    951 *  Get action template
    952 * \param [in] unit                     - Device ID
    953 * \param [in] ace_id                   - ACE ID
    954 * \param [out] actions_payload_info_p  - Action template as was created in ACE format add
    955 * \return
    956 *   shr_error_e - Error Type
    957 * \remark
    958 *   * None
    959 * \see
    960 *   * None
    961 */
    962 shr_error_e dnx_field_ace_format_action_template_get(
    963     int unit,
    964     dnx_field_ace_id_t ace_id,
    965     dnx_field_actions_ace_payload_info_t * actions_payload_info_p);
    966 
    967 /**
    968 * \brief
    969 *  Get the minimum and maximum bits of the payload template.
    970 * \param [in] unit                     - Device ID
    971 * \param [in] fg_id                    - Field group ID
    972 * \param [out] min_offset_p            - The lsb of the first action. -1 if no action with positive size found.
    973 * \param [out] max_offset_p            - The msb of the last action. -1 if no action with positive size found.
    974 * \return
    975 *   shr_error_e - Error Type
    976 * \remark
    977 *   * None
    978 * \see
    979 *   * dnx_field_ace_format_payload_template_min_max_get
    980 */
    981 shr_error_e dnx_field_group_payload_template_min_max_get(
    982     int unit,
    983     dnx_field_group_t fg_id,
    984     int *min_offset_p,
    985     int *max_offset_p);
    986 
    987 /**
    988 * \brief
    989 *  Get the amount of bits used by the actions on the payload, including spaces between actions.
    990 * \param [in] unit                     - Device ID
    991 * \param [in] ace_id                   - ACE ID
    992 * \param [out] min_offset_p            - The lsb of the first action. -1 if no action with positive size found.
    993 * \param [out] max_offset_p            - The lsb of the first action. -1 if no action with positive size found.
    994 * \return
    995 *   shr_error_e - Error Type
    996 * \remark
    997 *   * None
    998 * \see
    999 *   * dnx_field_group_payload_template_min_max_get
   1000 */
   1001 shr_error_e dnx_field_ace_format_payload_template_min_max_get(
   1002     int unit,
   1003     dnx_field_ace_id_t ace_id,
   1004     int *min_offset_p,
   1005     int *max_offset_p);
   1006 
   1007 /**
   1008 * \brief
   1009 *  Get the total sum of bits on all actions on the paylaod.
   1010 * \param [in] unit            - Device ID
   1011 * \param [in] fg_id           - Field group ID
   1012 * \param [out] payload_size_p - The total size of all actions on payload.
   1013 * \return
   1014 *   shr_error_e - Error Type
   1015 * \remark
   1016 *   * None
   1017 * \see
   1018 *   * dnx_field_group_actions_spread_on_payload_get
   1019 */
   1020 shr_error_e dnx_field_group_actions_payload_size_get(
   1021     int unit,
   1022     dnx_field_group_t fg_id,
   1023     unsigned int *payload_size_p);
   1024 
   1025 /**
   1026 * \brief
   1027 *
   1028 * \param [in] unit            -
   1029 * \param [in] fg_id           -
   1030 * \param [out] key_template_p  -
   1031 * \return
   1032 *   shr_error_e - Error Type
   1033 * \remark
   1034 *   * None
   1035 * \see
   1036 *   * None
   1037 */
   1038 shr_error_e dnx_field_group_key_template_get(
   1039     int unit,
   1040     dnx_field_group_t fg_id,
   1041     dnx_field_key_template_t * key_template_p);
   1042 
   1043 /**
   1044 * \brief
   1045 *  Get the TCAM handler ID for specific Field Group
   1046 * \param [in] unit               - Device ID
   1047 * \param [in] fg_id              - Field Group
   1048 * \param [out] tcam_handler_id_p  - TCAM handler ID
   1049 * \return
   1050 *   shr_error_e - Error Type
   1051 * \remark
   1052 *   * None
   1053 * \see
   1054 *   * None
   1055 */
   1056 shr_error_e dnx_field_group_tcam_handler_id_get(
   1057     int unit,
   1058     dnx_field_group_t fg_id,
   1059     uint32 *tcam_handler_id_p);
   1060 
   1061 /**
   1062 * \brief
   1063 *  Get the payload field_io of a field group for a specific context.
   1064 * \param [in] unit               - Device ID
   1065 * \param [in] fg_id              - Field group ID.
   1066 * \param [in] context_id         - The context the field group is attached to.
   1067 * \param [out] field_io_p        - To be loaded with the payload field_io.
   1068 * \return
   1069 *   shr_error_e - Error Type
   1070 * \remark
   1071 *   * None
   1072 * \see
   1073 *   * None
   1074 */
   1075 shr_error_e dnx_field_group_field_io_get(
   1076     int unit,
   1077     dnx_field_group_t fg_id,
   1078     dnx_field_context_t context_id,
   1079     dbal_enum_value_field_field_io_e * field_io_p);
   1080 
   1081 /**
   1082 * \brief
   1083 *  Get the list of FEMs that are invalidated for a specific field group in s specific context.
   1084 * \param [in] unit               - Device ID
   1085 * \param [in] fg_id              - Field group ID.
   1086 * \param [in] context_id         - The context the field group is attached to.
   1087 * \param [out] fems_invalidate   - To be loaded with the invalidated FEMs
   1088 * \return
   1089 *   shr_error_e - Error Type
   1090 * \remark
   1091 *   * None
   1092 * \see
   1093 *   * None
   1094 */
   1095 shr_error_e dnx_field_group_fem_invalidated_fems(
   1096     int unit,
   1097     dnx_field_group_t fg_id,
   1098     dnx_field_context_t context_id,
   1099     dnx_field_fem_id_t fems_invalidate[DNX_DATA_MAX_FIELD_COMMON_MAX_VAL_NOF_FEM_ID]);
   1100 
   1101 /**
   1102 * \brief
   1103 *  Goes over all FGs in the system, searching for the one and only that meets the following
   1104 *  conditions we are looking for:
   1105 *   1) Is attached on the given context ID
   1106 *   2) Has the exact same FG type
   1107 *   3) The 'first' key ID it resides on (in the given context) is equal to the 'first' key ID given
   1108 *  In case no such FG exists, this function throws an error.
   1109 *
   1110 * \param [in] unit       - Device ID
   1111 * \param [in] context_id - Context ID the FG ID we're looking for is attached on
   1112 * \param [in] fg_type    - FG Type that we're looking for
   1113 * \param [in] fg_key     - The key ID that the FG should reside on (in the given context)
   1114 * \param [out] fg_id_p   - The FG ID that meets the above conditions, in case it exists
   1115 *
   1116 * \return
   1117 *   shr_error_e - Error Type
   1118 * \remark
   1119 *   * None
   1120 * \see
   1121 *   * None
   1122 */
   1123 shr_error_e dnx_field_group_convert_context_key_to_fg_id(
   1124     int unit,
   1125     dnx_field_context_t context_id,
   1126     dnx_field_group_type_e fg_type,
   1127     dnx_field_key_id_t fg_key,
   1128     dnx_field_group_t * fg_id_p);
   1129 
   1130 /**
   1131 * \brief
   1132 *  Attach Field Group to context IDs
   1133 * \param [in] unit         - Device id
   1134 * \param [in] flags        - context attach flags (see dnx_field_group_context_attach_flags_e)
   1135 * \param [in] fg_id        - Field Group id to attach programs to
   1136 * \param [in] context_id        - PMF PGM id to attach to FG
   1137 * \param [in] group_attach_info_p  -Pointer to attach info look at (dnx_field_group_attach_info_t)
   1138 * \return
   1139 *   shr_error_e - Error Type
   1140 * \remark
   1141 *   * None
   1142 * \see
   1143 *   * None
   1144 */
   1145 shr_error_e dnx_field_group_context_attach(
   1146     int unit,
   1147     uint32 flags,
   1148     dnx_field_group_t fg_id,
   1149     dnx_field_context_t context_id,
   1150     dnx_field_group_attach_info_t * group_attach_info_p);
   1151 /*
   1152  * \brief
   1153  *   Check whether specified Field Group resides on some FEMs and, in that case,
   1154  *   detach specified contexts from those FEMs by updating contexts table.
   1155  *   This procedure is for internal usa only. Do not use on operational code.
   1156  * \param [in] unit -
   1157  *   Identifier of HW platform.
   1158  * \param [in] fg_id -
   1159  *   Identifier of a field group to search for on the list of owners of all
   1160  *   'fem_id's.
   1161  * \param [in] context_id -
   1162  *   Context ID to be detached from specified 'fg_id' and which needs to be updated
   1163  *   in HW.
   1164  *   FEMs)
   1165  * \return
   1166  *   \retval Zero - On success
   1167  *   \retval Error - Identifier as per shr_error_e
   1168  * \remark
   1169  *    * This should actually be a 'static' proceduer and is made global
   1170  *      only for the sake of negative tests.
   1171  * \see
   1172  *    * dnx_field_group_fems_context_attach
   1173  *    * dnx_field_fem_is_fg_owner
   1174  *    * dnx_field_fem_is_fg_secondary
   1175  *    * dnx_field_group_fes_unconfig()
   1176  */
   1177 shr_error_e dnx_field_group_fems_context_detach(
   1178     int unit,
   1179     dnx_field_group_t fg_id,
   1180     dnx_field_context_t context_id);
   1181 
   1182 /**
   1183  * \brief
   1184  *  Reset/deallocate all resources that were allocated for the context ID at input to the FG at input
   1185  * \param [in] unit        - Device Id
   1186  * \param [in] fg_id       - Field Group to detach Program From
   1187  * \param [in] context_id  - Context ID to detach
   1188  * \return
   1189  *   shr_error_e - Error Type
   1190  * \remark
   1191  *   * None
   1192  * \see
   1193  *   * None
   1194  */
   1195 shr_error_e dnx_field_group_context_detach(
   1196     int unit,
   1197     dnx_field_group_t fg_id,
   1198     dnx_field_context_t context_id);
   1199 
   1200 /**
   1201  * \brief
   1202  *  Get the action array out of payload info that was saved in Field group Sw state
   1203  * \param [in] unit                  - Device ID
   1204  * \param [in] fg_id     - Field group id to get action types
   1205  * \param [out] dnx_actions  -
   1206  *   This is a pointer to an array.
   1207  *   Maximal number of actions accepted here: DNX_DATA_MAX_FIELD_COMMON_MAX_VAL_NOF_ACTION_PER_GROUP.
   1208  *   The list of actions ends when an action of value 'DNX_FIELD_ACTION_INVALID' is detected.
   1209  * \param [out] nof_actions_p -Loaded with the number of valid elements in each the array dnx_actions.
   1210  * \return
   1211  *   shr_error_e - Error Type
   1212  * \remark
   1213  *   * None
   1214  * \see
   1215  *   * None
   1216  */
   1217 shr_error_e dnx_field_group_dnx_action_arr_get(
   1218     int unit,
   1219     dnx_field_group_t fg_id,
   1220     dnx_field_action_t dnx_actions[DNX_DATA_MAX_FIELD_COMMON_MAX_VAL_NOF_ACTION_PER_GROUP],
   1221     unsigned int *nof_actions_p);
   1222 
   1223 /**
   1224  * \brief
   1225  *  Get the action array out of payload info that was saved in ACE format Sw state
   1226  * \param [in] unit                  - Device ID
   1227  * \param [in] ace_id     - ACE id to get action types
   1228  * \param [out] dnx_actions  -
   1229  *   Action arrays to contain all actions.
   1230  *   Maximal number of actions accepted here: DNX_DATA_MAX_FIELD_COMMON_MAX_VAL_NOF_ACTION_PER_GROUP.
   1231  * \param[out] nof_actions_p - The number of valid elements in the array dnx_actions.
   1232  * \return
   1233  *   shr_error_e - Error Type
   1234  * \remark
   1235  *   * None
   1236  * \see
   1237  *   * None
   1238  */
   1239 shr_error_e dnx_field_ace_format_dnx_action_arr_get(
   1240     int unit,
   1241     dnx_field_ace_id_t ace_id,
   1242     dnx_field_action_t dnx_actions[DNX_DATA_MAX_FIELD_COMMON_MAX_VAL_NOF_ACTION_PER_GROUP],
   1243     unsigned int *nof_actions_p);
   1244 
   1245 /**
   1246 * \brief
   1247 *  Returns the offset on the payload buffer of the given dnx_action on the given fg_id.
   1248 *  If the action is not present in the FG, an error is returned.
   1249 *
   1250 * \param [in] unit       - Device ID
   1251 * \param [in] fg_id      - FG ID that contains the action
   1252 * \param [in] dnx_action - The action to return its offset on the payload buffer
   1253 * \param [out] offset_p    - Offset of the action in the payload buffer of the given FG
   1254 * \return
   1255 *   shr_error_e - Error Type
   1256 * \remark
   1257 *   * None
   1258 * \see
   1259 *   * None
   1260 */
   1261 shr_error_e dnx_field_group_action_offset_get(
   1262     int unit,
   1263     dnx_field_group_t fg_id,
   1264     dnx_field_action_t dnx_action,
   1265     int *offset_p);
   1266 
   1267 /**
   1268 * \brief
   1269 *  Returns the indices on the master key of the segments uses by each qualifier of a field group.
   1270 *
   1271 * \param [in] unit                - Device ID
   1272 * \param [in] fg_id               - field group
   1273 * \param [in] opcode_id           - Opcode
   1274 * \param [out] seg_index_on_master_by_qual - For each qualifier, the index of the corresponding segment on the
   1275 *                                            opcode's master key.
   1276 * \param [out] qual_index_on_segment    - For each qualifier, it's index within the segment.
   1277 *                                            Zero for non packed quals, as when ther are
   1278 *                                            multiple quals per segment they are packed.
   1279 * \param [out] qual_offset_on_segment   - For each qualifier, it's offset from the lsb of the segment in bits.
   1280 * \return
   1281 *   shr_error_e - Error Type
   1282 * \remark
   1283 *   * None
   1284 * \see
   1285 *   * None
   1286 */
   1287 shr_error_e dnx_field_group_kbp_segment_indices(
   1288     int unit,
   1289     dnx_field_group_t fg_id,
   1290     dbal_enum_value_field_kbp_fwd_opcode_e opcode_id,
   1291     uint8 seg_index_on_master_by_qual[DNX_DATA_MAX_FIELD_GROUP_NOF_QUALS_PER_FG],
   1292     uint8 qual_index_on_segment[DNX_DATA_MAX_FIELD_GROUP_NOF_QUALS_PER_FG],
   1293     uint8 qual_offset_on_segment[DNX_DATA_MAX_FIELD_GROUP_NOF_QUALS_PER_FG]);
   1294 
   1295 /**
   1296 * \brief
   1297 *  Returns the number of segmentd used by FWD for a opcode.
   1298 *
   1299 * \param [in] unit                - Device ID
   1300 * \param [in] opcode_id           - Opcode
   1301 * \param [out] nof_fwd_segments_p - Number of FWD segments
   1302 * \return
   1303 *   shr_error_e - Error Type
   1304 * \remark
   1305 *   * None
   1306 * \see
   1307 *   * None
   1308 */
   1309 shr_error_e dnx_field_group_kbp_opcode_nof_fwd_segments(
   1310     int unit,
   1311     dbal_enum_value_field_kbp_fwd_opcode_e opcode_id,
   1312     uint8 *nof_fwd_segments_p);
   1313 
   1314 /**
   1315 * \brief
   1316 *  Get the qualifier array out of key template  that was saved in Field group Sw state
   1317 * \param [in] unit                  - Device ID
   1318 * \param [in] fg_id     - Field group id to get qualifier types
   1319 * \param [out] dnx_quals  - Array of DNX qualifiers
   1320 * \param[out] nof_quals_p - Number of valid elements in the array dnx_quals.
   1321 * \return
   1322 *   shr_error_e - Error Type
   1323 * \remark
   1324 *   * None
   1325 * \see
   1326 *   * None
   1327 */
   1328 shr_error_e dnx_field_group_dnx_qual_arr_get(
   1329     int unit,
   1330     dnx_field_group_t fg_id,
   1331     dnx_field_qual_t dnx_quals[DNX_DATA_MAX_FIELD_GROUP_NOF_QUALS_PER_FG],
   1332     unsigned int *nof_quals_p);
   1333 
   1334 /**
   1335 * \brief
   1336 * Compare a qualifiers array with the qualifiers of a field group, verifying that they are both the same.
   1337 * Returns _SHR_E_PARAM if the arrays are not identical.
   1338 * \param [in] unit                    - Device ID
   1339 * \param [in] fg_id                   - The ID of the field group to whose qualifiers we compare.
   1340 * \param [in] dnx_quals               - The qualifier array to be compared.
   1341 *                                       The number of qualifiers in the array is determined by the first element
   1342 *                                       that equals DNX_FIELD_ACTION_INVALID. If no such element is found, the
   1343 *                                       number of elements is regarded as DNX_DATA_MAX_FIELD_GROUP_NOF_QUALS_PER_FG.
   1344 * \return
   1345 *   shr_error_e - Error Type
   1346 * \remark
   1347 *   * None
   1348 * \see
   1349 *   * None
   1350 */
   1351 shr_error_e dnx_field_group_qual_arr_compare_verify(
   1352     int unit,
   1353     dnx_field_group_t fg_id,
   1354     dnx_field_qual_t dnx_quals[DNX_DATA_MAX_FIELD_GROUP_NOF_QUALS_PER_FG]);
   1355 
   1356 /**
   1357 * \brief
   1358 * Compare a qualifiers array with the qualifiers of a field group, verifying that all the qualifiers present in the field group,
   1359 * and there are no duplicates on dnx_quals.
   1360 * Returns _SHR_E_PARAM if not.
   1361 * \param [in] unit                    - Device ID
   1362 * \param [in] fg_id                   - The ID of the field group to whose qualifiers we compare.
   1363 * \param [in] dnx_quals               - The qualifier array to be compared.
   1364 *                                       The number of qualifiers in the array is determined by the first element
   1365 *                                       that equals DNX_FIELD_ACTION_INVALID. If no such element is found, the
   1366 *                                       number of elements is regarded as DNX_DATA_MAX_FIELD_GROUP_NOF_QUALS_PER_FG.
   1367 * \return
   1368 *   shr_error_e - Error Type
   1369 * \remark
   1370 *   * None
   1371 * \see
   1372 *   * None
   1373 */
   1374 shr_error_e dnx_field_group_qual_arr_subset_verify(
   1375     int unit,
   1376     dnx_field_group_t fg_id,
   1377     dnx_field_qual_t dnx_quals[DNX_DATA_MAX_FIELD_GROUP_NOF_QUALS_PER_FG]);
   1378 
   1379 /**
   1380 * \brief
   1381 * Compare a actions array with the actions of a field group, verifying that all the actions present in the field group,
   1382 * and there are no duplicates on dnx_actions.
   1383 * Returns _SHR_E_PARAM if not.
   1384 * \param [in] unit                    - Device ID
   1385 * \param [in] fg_id                   - The ID of the field group to whose actions we compare.
   1386 * \param [in] dnx_actions             - The action array to be compared.
   1387 *                                       The number of actions in the array is determined by the first element
   1388 *                                       that equals DNX_FIELD_ACTION_INVALID. If no such element is found, the
   1389 *                                       number of elements is regarded as DNX_DATA_MAX_FIELD_GROUP_NOF_ACTION_PER_FG.
   1390 * \return
   1391 *   shr_error_e - Error Type
   1392 * \remark
   1393 *   * None
   1394 * \see
   1395 *   * None
   1396 */
   1397 shr_error_e dnx_field_group_action_arr_subset_verify(
   1398     int unit,
   1399     dnx_field_group_t fg_id,
   1400     dnx_field_action_t dnx_actions[DNX_DATA_MAX_FIELD_GROUP_NOF_ACTION_PER_FG]);
   1401 
   1402 /**
   1403 * \brief
   1404 *  Get Context information that was configured for specific Field Group context attach.
   1405 *  Can also optionally return EFES information.
   1406 * \param [in] unit           - Device ID
   1407 * \param [in] fg_id          -  Field Group ID
   1408 * \param [in] context_id     - Context ID that's conntected to Field group, to gets its info
   1409 * \param [out] attach_basic_info_p  - Field group context attach information
   1410 * \param [out] fes_group_info_p     - EFES information. If NULL, won't be filled.
   1411 * \return
   1412 *   shr_error_e - Error Type
   1413 * \remark
   1414 *   * None
   1415 * \see
   1416 *   * dnx_field_group_context_get
   1417 */
   1418 shr_error_e dnx_field_group_context_basic_info_get(
   1419     int unit,
   1420     dnx_field_group_t fg_id,
   1421     dnx_field_context_t context_id,
   1422     dnx_field_group_attach_info_t * attach_basic_info_p,
   1423     dnx_field_actions_fes_context_group_get_info_t * fes_group_info_p);
   1424 
   1425 /**
   1426 * \brief
   1427 *  Get Context atach information for specific Field Group
   1428 * \param [in] unit           - Device ID
   1429 * \param [in] fg_id          -  Field Group ID
   1430 * \param [in] context_id     - Context ID that's conntected to Field group, to gets its info
   1431 * \param [out] attach_full_info_p  - pointer to dnx_field_group_context_full_info_t (look on struct description)
   1432 * \return
   1433 *   shr_error_e - Error Type
   1434 * \remark
   1435 *   * None
   1436 * \see
   1437 *   * dnx_field_group_context_basic_info_get
   1438 */
   1439 shr_error_e dnx_field_group_context_get(
   1440     int unit,
   1441     dnx_field_group_t fg_id,
   1442     dnx_field_context_t context_id,
   1443     dnx_field_group_context_full_info_t * attach_full_info_p);
   1444 
   1445 /**
   1446 * \brief
   1447 *  Delete Field Group, deallocate all relevant resources
   1448 * \param [in] unit   - Device Id
   1449 * \param [in] fg_id  - Field Group Id to delete
   1450 * \return
   1451 *   shr_error_e - Error Type
   1452 * \remark
   1453 *   * Note that this operation is rejected if 'fg_id' is marked
   1454 *     as 'secondary field group' on any FEM which has been added
   1455 *     to any field group. In that case, this FEM needs, first, to
   1456 *     be removed (dnx_field_fem_action_remove()).
   1457 * \see
   1458 *   * None
   1459 */
   1460 shr_error_e dnx_field_group_delete(
   1461     int unit,
   1462     dnx_field_group_t fg_id);
   1463 
   1464 /**
   1465 * \brief
   1466 *  Delete ACE format, deallocate all relevant resources
   1467 * \param [in] unit   - Device Id
   1468 * \param [in] ace_id - ACE format Id to delete
   1469 * \return
   1470 *   shr_error_e - Error Type
   1471 * \remark
   1472 *   * None
   1473 * \see
   1474 *   * None
   1475 */
   1476 shr_error_e dnx_field_ace_format_delete(
   1477     int unit,
   1478     dnx_field_ace_id_t ace_id);
   1479 
   1480 /**
   1481 * \brief
   1482 *  Updates FESes for newly created cascading contexts when the FESes are shared between two stages.
   1483 *  Meaning, when we create a context in iPMF2, we need to update the iPMF1 FESes of the context we cascades from.
   1484 * \param [in] unit                - Device ID
   1485 * \param [in] stage               - Field Stage to create context for
   1486 * \param [in] context_id          - The created context ID.
   1487 * \param [in] cascaded_from       - The context we cascade from.
   1488 * \return
   1489 *   shr_error_e - Error Type
   1490 * \remark
   1491 *   * None
   1492 * \see
   1493 *   * dnx_field_context_create()
   1494 *   * dnx_field_group_fes_config()
   1495  */
   1496 shr_error_e dnx_field_group_context_create_fes_update(
   1497     int unit,
   1498     dnx_field_stage_e stage,
   1499     dnx_field_context_t context_id,
   1500     dnx_field_context_t cascaded_from);
   1501 
   1502 /**
   1503 * \brief
   1504 *  Delete FESes for destroyed cascading contexts when the FESes are shared between two stages.
   1505 *  Meaning, when we destroy a context in iPMF2, we need to delete the iPMF1 FESes of the context we cascades from.
   1506 * \param [in] unit                - Device ID
   1507 * \param [in] stage               - Field Stage to create context for
   1508 * \param [in] context_id          - The created context ID.
   1509 * \param [in] cascaded_from       - The iPMF1 context context_id cascade from.
   1510 * \return
   1511 *   shr_error_e - Error Type
   1512 * \remark
   1513 *   * None
   1514 * \see
   1515 *   * dnx_field_context_destroy()
   1516 *   * dnx_field_group_fes_unconfig()
   1517 *   * dnx_field_group_context_destroy_fem_update()
   1518 */
   1519 shr_error_e dnx_field_group_context_destroy_fes_update(
   1520     int unit,
   1521     dnx_field_stage_e stage,
   1522     dnx_field_context_t context_id,
   1523     dnx_field_context_t cascaded_from);
   1524 
   1525 /**
   1526 * \brief
   1527 *  Updates FEMs for newly created cascading contexts when the FEMs are shared between two stages.
   1528 *  Meaning, when we create a context in iPMF2, we need to update the iPMF1 FEMs of the context we cascades from.
   1529 * \param [in] unit                - Device ID
   1530 * \param [in] stage               - Field Stage to create context for
   1531 * \param [in] context_id          - The created context ID.
   1532 * \param [in] cascaded_from       - The context we cascade from.
   1533 * \return
   1534 *   shr_error_e - Error Type
   1535 * \remark
   1536 *   * None
   1537 * \see
   1538 *   * dnx_field_context_create()
   1539 *   * dnx_field_group_fems_context_attach()
   1540 *   * dnx_field_group_context_create_fes_update()
   1541 */
   1542 shr_error_e dnx_field_group_context_create_fem_update(
   1543     int unit,
   1544     dnx_field_stage_e stage,
   1545     dnx_field_context_t context_id,
   1546     dnx_field_context_t cascaded_from);
   1547 
   1548 /**
   1549 * \brief
   1550 *  Delete FEM references for destroyed cascading contexts when the FEMs are shared between two stages.
   1551 *  Meaning, when we destroy a context in iPMF2, we need to delete the iPMF1 FEM references of the context we
   1552 *  cascades from.
   1553 * \param [in] unit                - Device ID
   1554 * \param [in] stage               - Field Stage to create context for
   1555 * \param [in] context_id          - The created context ID.
   1556 * \param [in] cascaded_from       - The iPMF1 context context_id cascade from.
   1557 * \return
   1558 *   shr_error_e - Error Type
   1559 * \remark
   1560 *   * We do not check that the context is attached to the field group.
   1561 *   * Unlike dnx_field_group_context_destroy_fes_update(), we delete all references to FEMs from the context.
   1562 * \see
   1563 *   * dnx_field_context_destroy()
   1564 *   * dnx_field_group_fems_context_detach()
   1565 *   * dnx_field_group_context_destroy_fes_update();
   1566 */
   1567 shr_error_e dnx_field_group_context_destroy_fem_update(
   1568     int unit,
   1569     dnx_field_stage_e stage,
   1570     dnx_field_context_t context_id,
   1571     dnx_field_context_t cascaded_from);
   1572 
   1573 /**
   1574  * \brief
   1575  *  Get the 'flags' that were configured for field group in dnx_field_group_add()
   1576  * \param [in] unit       - Device ID
   1577  * \param [in] fg_id      - Field group ID
   1578  * \param [in] context_id - Contexts field group is attached to.
   1579  * \param [out] flags_p   - Flags that were set for the atach (of type dnx_field_group_context_attach_flags_e)
   1580  * \return
   1581  *   shr_error_e - Error Type
   1582  * \remark
   1583  *   * None
   1584  * \see
   1585  *   * None
   1586  */
   1587 shr_error_e dnx_field_group_context_attach_flags_get(
   1588     int unit,
   1589     dnx_field_group_t fg_id,
   1590     dnx_field_context_t context_id,
   1591     dnx_field_group_context_attach_flags_e * flags_p);
   1592 
   1593 /**
   1594  * \brief
   1595  *  Get the 'flags' that were configured for field group in dnx_field_group_add()
   1596  * \param [in] unit     - Device ID
   1597  * \param [in] fg_id    - Field group ID
   1598  * \param [out] flags_p  - Flags that were set for the Field Group (of type dnx_field_group_add_flags_e)
   1599  * \return
   1600  *   shr_error_e - Error Type
   1601  * \remark
   1602  *   * None
   1603  * \see
   1604  *   * None
   1605  */
   1606 shr_error_e dnx_field_group_flags_get(
   1607     int unit,
   1608     dnx_field_group_t fg_id,
   1609     dnx_field_group_add_flags_e * flags_p);
   1610 
   1611 /**
   1612  * \brief
   1613  *  Get the 'flags' that were configured for ACE format in dnx_field_ace_format_add()
   1614  * \param [in] unit     - Device ID
   1615  * \param [in] ace_id    - ACE ID
   1616  * \param [out] flags_p  - Flags that were set for the ACE format (of type dnx_field_ace_format_add_flags_e)
   1617  * \return
   1618  *   shr_error_e - Error Type
   1619  * \remark
   1620  *   * None
   1621  * \see
   1622  *   * None
   1623  */
   1624 shr_error_e dnx_field_ace_format_flags_get(
   1625     int unit,
   1626     dnx_field_ace_id_t ace_id,
   1627     dnx_field_ace_format_add_flags_e * flags_p);
   1628 
   1629 /**
   1630 * \brief
   1631 *  Obtains if an exem field group is LEXEM.
   1632 * \param [in] unit                    - Device ID
   1633 * \param [in] fg_id                   - Field Group
   1634 * \param [out] is_lexem_p             - If true the field group is LEXEM, if false SEXEM.
   1635 * \return
   1636 *   shr_error_e - Error Type
   1637 * \remark
   1638 *   * None
   1639 * \see
   1640 *   * None
   1641 */
   1642 shr_error_e dnx_field_group_exem_is_lexem(
   1643     int unit,
   1644     dnx_field_group_t fg_id,
   1645     int *is_lexem_p);
   1646 
   1647 /**
   1648 * \brief
   1649 *  Obtains if an exem field group is LEXEM.
   1650 * \param [in] unit                    - Device ID.
   1651 * \param [in] fg_id                   - Field Group.
   1652 * \param [out] app_db_id_size_p       - The size in bits of the app_db_id.
   1653 * \param [out] app_db_id_p            - The app_db_id of the field group.
   1654 * \return
   1655 *   shr_error_e - Error Type
   1656 * \remark
   1657 *   * None
   1658 * \see
   1659 *   * None
   1660 */
   1661 shr_error_e dnx_field_group_app_db_id_get(
   1662     int unit,
   1663     dnx_field_group_t fg_id,
   1664     int *app_db_id_size_p,
   1665     dnx_field_app_db_id_t * app_db_id_p);
   1666 
   1667 /**
   1668 * \brief
   1669 *  Obtains if an exem field group is LEXEM.
   1670 * \param [in] unit                    - Device ID.
   1671 * \param [in] fg_id                   - Field Group.
   1672 * \param [out] vmv_size_p             - The size in bits of the vmv.
   1673 * \param [out] vmv_value_p            - The vmv the field group.
   1674 * \return
   1675 *   shr_error_e - Error Type
   1676 * \remark
   1677 *   * None
   1678 * \see
   1679 *   * None
   1680 */
   1681 shr_error_e dnx_field_group_vmv_get(
   1682     int unit,
   1683     dnx_field_group_t fg_id,
   1684     uint8 *vmv_value_p,
   1685     uint8 *vmv_size_p);
   1686 
   1687 shr_error_e dnx_field_group_name_get(
   1688     int unit,
   1689     dnx_field_group_t fg_id,
   1690     char name[DBAL_MAX_STRING_LENGTH]);
   1691 
   1692 /**
   1693  * \brief
   1694  *  Get Whetehr a KBP field group supports packing (has the packing flag used, BCM_FIELD_FLAG_QUAL_PACKING).
   1695  * \param [in] unit     - Device ID
   1696  * \param [in] fg_id    - Field group ID
   1697  * \param [out] is_support_packing_p - TRUE if BCM_FIELD_FLAG_QUAL_PACKING flag is used for the field group.
   1698  * \return
   1699  *   shr_error_e - Error Type
   1700  * \remark
   1701  *   * None
   1702  * \see
   1703  *   * None
   1704  */
   1705 shr_error_e dnx_field_group_kbp_support_packing(
   1706     int unit,
   1707     dnx_field_group_t fg_id,
   1708     int *is_support_packing_p);
   1709 
   1710 /**
   1711  * \brief
   1712  *  Get the field group ID by name;
   1713  * \param [in] unit     - Device ID
   1714  * \param [in] name     - The name of the field group. Number of elements in array DBAL_MAX_STRING_LENGTH.
   1715  * \param [out] fg_id_p - Field group ID. If not found, DNX_FIELD_GROUP_INVALID is returned.
   1716  * \return
   1717  *   shr_error_e - Error Type
   1718  * \remark
   1719  *   * None
   1720  * \see
   1721  *   * None
   1722  */
   1723 shr_error_e dnx_field_group_name_to_id(
   1724     int unit,
   1725     char name[DBAL_MAX_STRING_LENGTH],
   1726     dnx_field_group_t * fg_id_p);
   1727 
   1728 /**
   1729  * \brief
   1730  *  Get name of an ACE format.
   1731  * \param [in] unit     - Device ID
   1732  * \param [in] ace_id   - Field group ID
   1733  * \param [out] name    - The name of the field group. Number of elements in array DBAL_MAX_STRING_LENGTH.
   1734  * \return
   1735  *   shr_error_e - Error Type
   1736  * \remark
   1737  *   * None
   1738  * \see
   1739  *   * None
   1740  */
   1741 shr_error_e dnx_field_ace_format_name_get(
   1742     int unit,
   1743     dnx_field_ace_id_t ace_id,
   1744     char name[DBAL_MAX_STRING_LENGTH]);
   1745 
   1746 /**
   1747  * \brief
   1748  *  Get an ACE format ID by name;
   1749  * \param [in] unit      - Device ID
   1750  * \param [in] name      - The name of the field group. Number of elements in array DBAL_MAX_STRING_LENGTH.
   1751  * \param [out] ace_id_p - Field group ID. If not found, DNX_FIELD_GROUP_INVALID is returned.
   1752  * \return
   1753  *   shr_error_e - Error Type
   1754  * \remark
   1755  *   * None
   1756  * \see
   1757  *   * None
   1758  */
   1759 shr_error_e dnx_field_ace_format_name_to_id(
   1760     int unit,
   1761     char name[DBAL_MAX_STRING_LENGTH],
   1762     dnx_field_ace_id_t * ace_id_p);
   1763 
   1764 /**
   1765  * \brief
   1766  *  Gets all field groups that are attached to the given program id in the given stage
   1767  *
   1768  * \param [in] unit        - Device ID
   1769  * \param [in] field_stage - The stage of the program ID
   1770  * \param [in] context_id  - Program ID to retrieve the field groups attached to it
   1771  * \param [out] fg_ids     - Array of IDs of the field groups attached to the given program ID
   1772  * \param [out] fg_count   - The total count of the field groups array
   1773  *
   1774 * \return
   1775 *   shr_error_e - Error Type
   1776 * \remark
   1777 *   * None
   1778 * \see
   1779 *   * None
   1780  */
   1781 shr_error_e dnx_field_group_context_fgs_get(
   1782     int unit,
   1783     dnx_field_stage_e field_stage,
   1784     dnx_field_context_t context_id,
   1785     dnx_field_group_t * fg_ids,
   1786     int *fg_count);
   1787 
   1788 /**
   1789  * \brief
   1790  *   Calculates the total number of bits used by the actions and their valid bits on the payload for function
   1791  *   dnx_field_group_tcam_key_and_action_length_type_calc().
   1792  *   This function is used for field groups that use lookup and 2msb feature (TCAM, EXEM).
   1793  * \param [in] unit            -
   1794  *   Device ID
   1795  * \param [in] field_stage     -
   1796  *   Field Stage (iPMF1/2..)
   1797  * \param [in]  actions_info_arr    -
   1798  *   Array of type dnx_field_action_in_group_info_t.
   1799  *   This is a pointer to an array.
   1800  *   Maximal number of actions accepted here: DNX_DATA_MAX_FIELD_COMMON_MAX_VAL_NOF_ACTION_PER_GROUP.
   1801  *   The list of actions ends when an action of value 'DNX_FIELD_ACTION_INVALID' is detected.
   1802  *   Only the 'dnx_action' and 'dont_use_valid_bit' are read to calculate the action size of the sizes,
   1803  *   'lsb' field need not be filled.
   1804  * \param [out] actions_size_in_bits_p  -
   1805  *   This procedure loads each pointed memory by the sum of sizes, in bit resolution, of all actions and valid bits
   1806  *   in the array of 'actions_info_arr'.
   1807  * \return
   1808  *   shr_error_e - Error Type
   1809  * \remark
   1810  *   * This procedure takes a two dimensional array of actions, and uses
   1811  *     dnx_field_group_calc_actions_bit_size_1_arr() to find the bit size of each of the four one dimensional arrays.
   1812  * \see
   1813  *   * dnx_field_ace_format_calc_actions_bit_size().
   1814  */
   1815 shr_error_e dnx_field_group_calc_actions_bit_size(
   1816     int unit,
   1817     dnx_field_stage_e field_stage,
   1818     dnx_field_action_in_group_info_t actions_info_arr[DNX_DATA_MAX_FIELD_COMMON_MAX_VAL_NOF_ACTION_PER_GROUP],
   1819     unsigned int *actions_size_in_bits_p);
   1820 
   1821 /**
   1822 * \brief
   1823 *  Find the size in bits of the payload block used by the lookup mechanism for a certain action_length_type enum.
   1824 * \param [in] unit                  - Device ID
   1825 * \param [in] action_length_type    - An enum indication the size of the action block used by the lookup mechanism.
   1826 * \param [out] block_size           - The number of bits available on the payload to write to
   1827 *                                     (to which we do MDB align to the payload we want to write).
   1828 * \return
   1829 *   shr_error_e - Error Type
   1830 * \remark
   1831 *   * None
   1832 * \see
   1833 *   * None
   1834 */
   1835 shr_error_e dnx_field_group_action_length_to_bit_size(
   1836     int unit,
   1837     dnx_field_action_length_type_e action_length_type,
   1838     unsigned int *block_size);
   1839 
   1840 /**
   1841  * \brief
   1842  *  Get the information about Field group which is related to dnx_field_group_add();
   1843  * \param [in] unit          - Device ID
   1844  * \param [in] fg_id         - Field Group id to get its info
   1845  * \param [out] fg_basic_info_p - Pointer to dnx_field_group_info_t that holds basic FG information.
   1846  * \return
   1847  *   shr_error_e - Error Type
   1848  * \remark
   1849  *   * In case of TCAM field group retrieve the TCAM handler-ID and the access profile-ID for the Field group
   1850  * \see
   1851  *   * dnx_field_group_get
   1852  */
   1853 shr_error_e dnx_field_group_basic_info_get(
   1854     int unit,
   1855     dnx_field_group_t fg_id,
   1856     dnx_field_group_info_t * fg_basic_info_p);
   1857 
   1858 /**
   1859  * \brief
   1860  *  Get the information about Field group.
   1861  * \param [in] unit          - Device ID
   1862  * \param [in] fg_id         - Field Group id to get its info
   1863  * \param [out] fg_info_p    -
   1864  *   Pointer to dnx_field_group_full_info_t that holds full FG information,
   1865  *   mainly from sw state.
   1866  * \return
   1867  *   shr_error_e - Error Type
   1868  * \remark
   1869  *   * In case of TCAM field group retrieve the TCAM handler-ID and the access profile-ID for the Field group
   1870  * \see
   1871  *   * dnx_field_group_basic_info_get
   1872  */
   1873 shr_error_e dnx_field_group_get(
   1874     int unit,
   1875     dnx_field_group_t fg_id,
   1876     dnx_field_group_full_info_t * fg_info_p);
   1877 
   1878 /**
   1879  * \brief
   1880  *  Get the information about ACE format which is related to dnx_field_ace_format_add();
   1881  * \param [in] unit          - Device ID
   1882  * \param [in] ace_id        - ACE format ID.
   1883  * \param [out] ace_id_info_p -
   1884  *   Pointer to dnx_field_ace_format_full_info_t that holds full ACE format information,
   1885  *   mainly from sw state.
   1886  * \return
   1887  *   shr_error_e - Error Type
   1888  * \remark
   1889  *   * None
   1890  * \see
   1891  *   * None
   1892  */
   1893 shr_error_e dnx_field_ace_format_get(
   1894     int unit,
   1895     dnx_field_ace_id_t ace_id,
   1896     dnx_field_ace_format_full_info_t * ace_id_info_p);
   1897 
   1898 /**
   1899 * \brief
   1900 *  Adds a field group of ACE table (PPMC table) lookup for MC replication entries and ACE pointers.
   1901 *  Parrallels field group add and field group context attach.
   1902 * \param [in] unit                - Device ID
   1903 * \param [in] flags               - Can be WITH_ID
   1904 * \param [in] ace_format_info_in_p - All the information required to configure the ACE format.
   1905 *                                   Includes an array of actions that the ACE format can perform.
   1906 * \param [in,out] ace_id_p        - ID of the ACE format.
   1907 *                                   Also serves as result type of the PPMC entries and context of the ACE ACR EFES).
   1908 *                                   Serves as input if WITH_ID flag is set.
   1909 * \return
   1910 *   shr_error_e - Error Type
   1911 * \remark
   1912 *   * None
   1913 * \see
   1914 *   * None
   1915 */
   1916 shr_error_e dnx_field_ace_format_add(
   1917     int unit,
   1918     dnx_field_ace_format_add_flags_e flags,
   1919     dnx_field_ace_format_info_t * ace_format_info_in_p,
   1920     dnx_field_ace_id_t * ace_id_p);
   1921 
   1922 /**
   1923  * \brief
   1924  * Returns the first entry handle for the given fg_id.
   1925  * The first entry handle for a given handler is defined to be the handle
   1926  * of the entry that both belongs to the field group and is the first
   1927  * in line between all other entries that belongs to the same field group
   1928  * inside the TCAM banks of the given core.
   1929  *
   1930  * \param [in] unit            - Device ID
   1931  * \param [in] core            - Core ID
   1932  * \param [in] fg_id           - ID of the field group to get the first entry id for
   1933  * \param [out] first_entry_handle - The id of the first entry for the given field group - if exists.
   1934  *                               DNX_FIELD_ENTRY_ACCESS_ID_INVALID otherwise
   1935  *
   1936  * \return
   1937  *  \retval _SHR_E_NONE - success
   1938  */
   1939 shr_error_e dnx_field_group_entry_first(
   1940     int unit,
   1941     int core,
   1942     dnx_field_group_t fg_id,
   1943     uint32 *first_entry_handle);
   1944 
   1945 /**
   1946  * \brief
   1947  * Returns the next entry handle following the given current entry handle for the specified field group id.
   1948  * The next entry is defined to be the next-in-line to come inside the TCAM Banks of the given core after
   1949  * the given entry handle that belongs to the given field group.
   1950  *
   1951  * \param [in] unit               - Device ID
   1952  * \param [in] core               - Core ID
   1953  * \param [in] fg_id              - ID of the field group to get the next entry handle for
   1954  * \param [in] cur_entry_handle   - The entry handle that precedes the entry that will be returned
   1955  * \param [out] next_entry_handle - The entry handle that both belongs to the handler and comes
   1956  *                                  after the given entry_id - if exists.
   1957  *                                  DNX_FIELD_ENTRY_ACCESS_ID_INVALID otherwise
   1958  *
   1959  * \return
   1960  *  \retval _SHR_E_NONE - success
   1961  */
   1962 shr_error_e dnx_field_group_entry_next(
   1963     int unit,
   1964     int core,
   1965     dnx_field_group_t fg_id,
   1966     uint32 cur_entry_handle,
   1967     uint32 *next_entry_handle);
   1968 
   1969 /* Group Entry Section */
   1970 /* { */
   1971 
   1972 /**
   1973 * \brief
   1974 *  Delete all HW entries that were created for specific Field Group
   1975 * \param [in] unit   - Device ID
   1976 * \param [in] fg_id  - Field group to delete entries for
   1977 * \return
   1978 *   shr_error_e - Error Type
   1979 * \remark
   1980 *   * None
   1981 * \see
   1982 *   * None
   1983 */
   1984 shr_error_e dnx_field_group_entry_delete_all(
   1985     int unit,
   1986     dnx_field_group_t fg_id);
   1987 
   1988 /**
   1989 * \brief
   1990 *  Delete all HW entries that were created for all field groups.
   1991 * \param [in] unit   - Device ID
   1992 * \return
   1993 *   shr_error_e - Error Type
   1994 * \remark
   1995 *   * None
   1996 * \see
   1997 *   * None
   1998 */
   1999 shr_error_e dnx_field_group_all_entry_delete_all(
   2000     int unit);
   2001 
   2002 shr_error_e dnx_field_group_kbp_set(
   2003     int unit);
   2004 
   2005 /**
   2006 * \brief
   2007 *  Returns the TCAM handler IDs of all the FGs that share a context
   2008 *  with the given tcam_handler_id's FG.
   2009 *
   2010 * \param [in] unit              - Device ID
   2011 * \param [in] tcam_handler_id   - The TCAM handler ID for the FG to get sharing context FGs tcam handler IDs for
   2012 * \param [out] tcam_handler_ids - Array of all the TCAM handler IDs that their corresponding FGs share a context with the given TCAM handler ID's FG (Should be allocated by caller with size DNX_DATA_MAX_FIELD_TCAM_NOF_TCAM_HANDLERS + 1). The array ends with DNX_FIELD_TCAM_HANDLER_INVALID define.
   2013 *
   2014 * \return
   2015 *   shr_error_e - Error Type
   2016 * \remark
   2017 *   * This function is used by the TCAM bank manager to figure out which
   2018 *     TCAM handlers share the same context in order to prevent them from
   2019 *     sharing the same bank (HW limitation)
   2020 * \see
   2021 *   * tcam/tcam_bank_manager.c
   2022 */
   2023 shr_error_e dnx_field_group_context_sharing_tcam_handlers_get(
   2024     int unit,
   2025     uint32 tcam_handler_id,
   2026     uint32 tcam_handler_ids[]);
   2027 
   2028 /**
   2029  * \brief
   2030  * Evacuates the given fg_id from the given bank_id on all cores.
   2031  * The evacuation process involves moving all fg's entries on the
   2032  * given bank to other banks allocated by the same fg.
   2033  * If the evacuation process succeeds, the fg is removed from the bank (therefore,
   2034  * helping to remove constraints for other fgs to use the evacuated bank).
   2035  *
   2036  * This function starts moving entries to other banks allocated by the given fg
   2037  * until either all fg's entries on the bank are moved to other banks, or no
   2038  * more empty space is left in the other banks allocated by the given fg.
   2039  * In case no empty space is left, all the entries that were moved until this point stay
   2040  * as-is and the function fails.
   2041  *
   2042  * \param[in] unit       - Device ID
   2043  * \param[in] fg_id      - FG ID to move its entries from given bank
   2044  * \param[in] nof_banks  - Number of banks to evacuate
   2045  * \param[in] bank_ids   - Array of bank IDs to evacuate
   2046  *
   2047 * \return
   2048 *   shr_error_e - Error Type
   2049  */
   2050 
   2051 shr_error_e dnx_field_group_tcam_bank_evacuate(
   2052     int unit,
   2053     dnx_field_group_t fg_id,
   2054     int nof_banks,
   2055     int bank_ids[]);
   2056 
   2057 /**
   2058  * \brief
   2059  * Adds the given bank_ids to the given FG-ID.
   2060  *
   2061  * \param[in] unit       - Device ID
   2062  * \param[in] fg_id      - FG ID to add to banks
   2063  * \param[in] nof_banks  - Number of banks to add
   2064  * \param[in] bank_ids   - Array of bank IDs to add the FG to
   2065  *
   2066 * \return
   2067 *   shr_error_e - Error Type
   2068  */
   2069 
   2070 shr_error_e dnx_field_group_tcam_bank_add(
   2071     int unit,
   2072     dnx_field_group_t fg_id,
   2073     int nof_banks,
   2074     int bank_ids[]);
   2075 
   2076 /**
   2077  * \brief
   2078  *  Returns the FG ID of the given entry ID.
   2079  *
   2080  * \param [in] unit        - Device ID
   2081  * \param [in] entry_id    - Entry ID to return the FG ID for
   2082  * \param [out] fg_id      - FG ID of the given entry ID
   2083  *
   2084  * \return
   2085  *   \retval _SHR_E_NONE success
   2086  */
   2087 shr_error_e dnx_field_group_tcam_entry_fg_id(
   2088     int unit,
   2089     bcm_field_entry_t entry_id,
   2090     bcm_field_group_t * fg_id);
   2091 
   2092 /**
   2093  * \brief
   2094  * Initialize the master key info in SW state, specifically the number of segments used by FWD.
   2095  * \param[in] unit       - Device ID
   2096  * \return
   2097  *   shr_error_e - Error Type
   2098  */
   2099 shr_error_e dnx_field_group_kbp_master_key_init(
   2100     int unit);
   2101 
   2102 /* } */
   2103 
   2104 #endif